Hi,
I'm just starting with NSIS and I have the following problem:
I want to copy a dll file to system32 directory (I must copy it to this directory), I use this test code:
!include "MUI2.nsh"
!include 'LogicLib.nsh'
!include "x64.nsh"
RequestExecutionLevel highest
OutFile "TestInstall.exe"
Function MoveDlls
SetOutPath $SYSDIR
${If} ${RunningX64}
${EnableX64FSRedirection}
${EndIf}
# Copy DLL files into Windows system dir
File "C:\V500_22.1\Product\Dll\log2vis.dll"
${if} ${Errors}
MessageBox MB_OK "Could not copy log2vis.dll"
${endif}
${If} ${RunningX64}
${DisableX64FSRedirection}
${EndIf}
FunctionEnd
Section "Basic Installing DLL"
Call MoveDlls
SectionEnd
When I compile and try to run the exe file, I get error:
Error opening file for writing:
C:\V500_22.1\Product\Dll\log2vis.dll
How can I avoid this error?
Thanks
copy dll to system32
4 posts
The file might be there already and in use by some application, add "SetOverwrite Try" to your script before the File instruction.
Also, you must use RequestExecutionLevel admin.
Turning off 64-bit redirection does not make sense, you are installing a 32-bit .dll AFAIK.
...and as a final note, you are not really supposed to install your own files in system32!
Also, you must use RequestExecutionLevel admin.
Turning off 64-bit redirection does not make sense, you are installing a 32-bit .dll AFAIK.
...and as a final note, you are not really supposed to install your own files in system32!
OK.
I see that the exe created by this code can run when changing the compatibility mode to 'Windows XP' without error.
Any idea why?
Thanks
I see that the exe created by this code can run when changing the compatibility mode to 'Windows XP' without error.
Any idea why?
Thanks
Just for reference: http://nsis.sourceforge.net/Docs/Cha...executionlevel.
Don't use compatibility mode, that's for old programs that don't run correctly. I shouldn't have to change my computer settings just to run an installer. Anyway, setting the compatibility mode to 'Windows XP' is the same as using RequestExecutionLevel admin.
According to the NSIS docs, the 'highest' setting is dependent on the current user, which means that different users will have different privileges. Most of the time it's not administrator mode. You need administrator mode to write into $SYSDIR.
Again, why do you need to write to $SYSDIR? Your program should be able to load a .dll in the same folder/child folder as the program.
Don't use compatibility mode, that's for old programs that don't run correctly. I shouldn't have to change my computer settings just to run an installer. Anyway, setting the compatibility mode to 'Windows XP' is the same as using RequestExecutionLevel admin.
According to the NSIS docs, the 'highest' setting is dependent on the current user, which means that different users will have different privileges. Most of the time it's not administrator mode. You need administrator mode to write into $SYSDIR.
Again, why do you need to write to $SYSDIR? Your program should be able to load a .dll in the same folder/child folder as the program.