Archive: Help with System::call


Help with System::call
Trying to figure out system::call to get to an external .dll that I've written.

The DLL's function declaration is pretty simple. It takes a string to search for, and returns a boolean whether it's installed:

__declspec(dllexport) int __cdecl CheckProductInstalled(LPTSTR)

I've tried various versions of the system::call string, but I think this is correct, based on what I can get from the readme.

System::Call 'EnumProductsDLL.dll::CheckProductInstalled(t r0) i.r2?e'

Where $0 contains the string to search for.

However, I keep getting 'error' back in $2. If I pop the stack to get the lastdllerror I always get 0.

I don't think I'm actually getting to the .dll because there is some debug logic in the .dll that doesn't appear to be happening.

Anything obvious where I might have messed up?

Thanks,

Mike


You are using cdecl. The default is stdcall. Use ?c.

Stu


Seems to me like System can't find the DLL. Have you extracted it somewhere it can be found?


Thanks for the help.

Afrow,

I tried with both ?c and removing the cdecl from the declaration, same results.

Kickik

I am extracting the file immediately before this call. The logic from my test program is below:
INSTDIR is set to C:\temp

SetOutPath $INSTDIR
file "enumproductsdll.dll"
strcpy $0 'Symantec Antivirus'
System::Call 'EnumProductsDLL.dll::CheckProductInstalled(t r0) i.r2?e'
messagebox mb_ok $2
pop $5
messagebox mb_ok $5

Thanks,

Mike


Are you sure all of its dependencies can also be loaded? Open it from that directory with Dependency Walker to make sure.


Originally posted by kichik
Are you sure all of its dependencies can also be loaded? Open it from that directory with Dependency Walker to make sure.
Hmmm... well, that was at least part of the problem (hadn't statically linked it to msvcrt8). However, after doing that, am still having issues.

Well, that's about it. Either the DLL can not be found due to a typo or wrong search path or it can't be loaded due to missing dependencies. Unless you're trying to load x86 DLL on x64, which is quite impossible considering NSIS doesn't build on x64, it's those two.