BuilderBob
17th June 2008 12:24 UTC
Dll function isn't called on Vista 64-bit
Hello,
I have an external dll function that i want to call from nsis. It works on any Win 32bit, but not on Vista 64-bit.
I added a MessageBox as the first line of the dll function, but didn't see it, so even the first line isn't reached.
I checked that the nsis installer knows exactly where the dll is with a MessageBox in the installer. Checked ok.
Is there a known bug and workaround for this? Should I have special definitions in the dll source code?
SetCompressor lzma
OutFile.Setup.exe
Name "Setup"
>RequestExecutionLevel admin
SilentInstall silent
>!Include LogicLib.nsh
Section
StrCpy$0 "$PROGRAMFILES\ExistingDir\Existing.dll"
System::Call "$0::FuncWithInt(i) v(4.).. ? u"
>SectionEnd
>
BuilderBob
17th June 2008 14:46 UTC
I made a small non-silent test installer that only calls the dll and got the attached error.
kichik
17th June 2008 18:49 UTC
Are you sure it's in C:\Program Files (x86) and not C:\Program Files?
BuilderBob
18th June 2008 09:19 UTC
Yes, I checked the path with a MessageBox.
The annoying fact (but also one that saves me right now) is that doing it in WISE works. Also, writing in WISE only the part that calls the dll, and executing it from NSIS, works.
kichik
18th June 2008 15:12 UTC
Try adding the `e' flag to the System::Call flags (right after that last `u') and pop the error code. It might shed some light on the issue. But if it's only on x64 it really sounds like a bad path. Try having NSIS check it for you with ${If} ${FileExists}.
nonubik
27th June 2008 16:10 UTC
I have the same problem. My code is:
${DisableX64FSRedirection}
MessageBox MB_OK "$INSTDIR\Mydll.dll"
IfFileExists "$INSTDIR\Mydll.dll" 0 +2
MessageBox MB_OK "yes"
System::Call '$INSTDIR\MyDll.dll::Run(t `"$INSTDIR\Myexe.exe"`) i.r1 ?e'
Pop $1
MessageBox MB_OK "$INSTDIR\Myexe.exe"
MessageBox MB_OK $1
${EnableX64FSRedirection}
As you can see, lots of Message boxes. All shows Mydll.dll in its place, C:\Program Files\..etc and it's really there, not in C:\Program Files(x86)\
I also have the 'yes' message box, so the file is there, as for the error, it's 0.
My guess is that the exported function from dll it's not even called. In x86 it works just fine.
I also suspect that's because internally System::Call does a LoadLibrary, GetProcAddress and then calls the function. But from an x86 process (i.e. the installer) you cannot load an x64 dll (Mydll.dll).
Does System::Call use LoadLibrary and the rest?
mani95
30th June 2008 22:37 UTC
Originally posted by BuilderBob
Yes, I checked the path with a MessageBox.
The annoying fact (but also one that saves me right now) is that doing it in WISE works. Also, writing in WISE only the part that calls the dll, and executing it from NSIS, works.
Even it works very fine in InstallAware also, which has excellent 32/64 bit support and vista compliancy.
Red Wine
30th June 2008 22:45 UTC
Originally posted by mani95
Even it works very fine in InstallAware also, which has excellent 32/64 bit support and vista compliancy.
mani95 don't you know any better way to make money instead of advertising InstallAware (sucks) here in nsis discussion forums?