Archive: Dll function isn't called on Vista 64-bit


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
>

I made a small non-silent test installer that only calls the dll and got the attached error.


Are you sure it's in C:\Program Files (x86) and not C:\Program Files?


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.


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}.


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?


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.

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?