Archive: System::Call crashing installer


System::Call crashing installer
I'm not sure what I'm doing wrong here but it crashes the setup exe. I'm writing a new installer to do away with our ancient InstallShield scripts to install one of our products. I need to make a call to one of our dlls to check the device manager if certain hardware is installed. I'm calling W2kIsDeviceIdInstalledA in voysetupc6.dll and passing it two ansi strings "PCI" and "VEN_104C&DEV_8025&SUBSYS_702A14DB" it returns a 0 or 1 depending if it finds the driver or not.

First here's how it works in the InstallShield script:
prototype VoySetupC6.W2kIsDeviceIdInstalledA( string, string );
string szQVI5MegHWId;
szQVI5MegHWId = "VEN_104C&DEV_8025&SUBSYS_702A14DB";
if ( W2kIsDeviceIdInstalledA("PCI", szQVI5MegHWId) > 0 ) then


Here's how I have coded it in the NSIS script which crashes the installer:
!define VoySetupDll "voysetupc6.dll"
!define PCI "PCI"
!define szQVI5MegHWId "VEN_104C&DEV_8025&SUBSYS_702A14DB"

InitPluginsDir
ReserveFile "${VoySetupDll}"
File "/ONAME=$PLUGINSDIR\voysetupc6.dll" "${VoySetupDll}"
System::Call 'VoySetupc6::W2kIsDeviceIdInstalledA(${PCI}, ${szQVI5MegHWId}) i.r0'
StrCmp $0 1 0 notfound
MessageBox MB_OK|MB_ICONEXCLAMATION "Found" /SD IDOK
notfound:
MessageBox MB_OK|MB_ICONEXCLAMATION "Not found" /SD IDOK

Any help would be appreciated I've wasted most of the day trying to get this to work.


you're forgetting to specify the data types in your System call, I think?

i.e.

System::Call'VoySetupc6::W2kIsDeviceIdInstalledA(${PCI},${szQVI5MegHWId})i.r0'

expands to...
System::Call'VoySetupc6::W2kIsDeviceIdInstalledA("PCI","VEN_104C&DEV_8025&SUBSYS_702A14DB")i.r0'

System doesn't know what datatype "PCI" is without you explicitly specifying it. Presuming the DLL needs ANSI strings, the type should be "m":
System::Call'VoySetupc6::W2kIsDeviceIdInstalledA(m"PCI",m"VEN_104C&DEV_8025&SUBSYS_702A14DB")i.r0'

( type "t" for 'text' is unicode-context-sensitive; within the Unicode build of NSIS, it passes unicode strings )

So try again with the datatypes specified.. with any luck, that will have been it. Otherwise, double-check the function's prototype, and post again with whatever the new error might be if you're sure you're calling it correctly.

Unforunately that didn't work with m or t. It's crashing with a code 5 STATUS_ACCESS_VIOLATION. Maybe I'm not calling it correctly. Here's the header of the method:

BOOL WINAPI W2kIsDeviceIdInstalledA (LPCASTR pszPnpEnum, LPCASTR pszDeviceId)

It takes two strings and returns true or false. Since it works fine in InstallShield I have to be doing something wrong in NSIS.

Thanks for the help!


Also if anybody has a solution that I can use that doesn't involve this dll that would be great too. I just need to look at the devices installed to see which drivers are installed based off the vendor ID. In the above code I'm looking to see that a Texas Instruments firewire driver is present.


No ideas?


not I.. the call looks like it should be correct - but the System plugin can be a bit of a beast.. which doesn't help when trying to eliminate that DLL.. looks like the SetupDi* functions ( http://msdn.microsoft.com/en-us/libr...=VS.85%29.aspx ) are what you'd be looking at.