PDA

View Full Version : INSTALLDIR always empy in "CLASSIC" signature DLL.



johnd2
07-29-2004, 09:24 AM
Hello All,

I've got a DLL that I've hooked up to perform a custom action.

I've declared the exported function to have the "Classic" signature because that's an easy way to get the INSTALLDIR parameter.

Problem is that the INSTALLDIR parameter (in fact all the LPSTR parameters) refer to empty strings. Incidentally the HWND parameter is not NULL (and is a valid window handle) despite the online help saying "Parameter 1 passes the installation's window handle. This parameter always returns NULL."

I've installed the custom action at "After File Transfer" and "After Register Product" but to no avail. INSTALLDIR is empty.

So - why is INSTALLDIR empty?

Thanks,

john

Mike Marino
07-29-2004, 04:44 PM
This has to do with an MSI (Windows Installer) concept called Deferred Execution Custom Actions. Basically what this means is that many installer properties are not available to DLL custom actions that are considered deferred. EXE custom actions, can get this information when placed in the exact same place. So if instead of writing a DLL custom action, you wrote a small EXE, by setting the command line parameter of the EXE custom action to [INSTALLDIR] you can get INSTALLDIR to where you need it to.

INSTALLDIR will be populated in Classic Style DLLs in all but the following (deferred) locations:

"After File Transfer"
"After COM Registration"
"After Register Product"
"Before File Transfer"

Hope this helps.

johnd2
07-30-2004, 03:04 AM
Originally posted by Mike Marino
This has to do with an MSI (Windows Installer) concept called Deferred Execution Custom Actions. Basically what this means is that many installer properties are not available to DLL custom actions that are considered deferred. EXE custom actions, can get this information when placed in the exact same place. So if instead of writing a DLL custom action, you wrote a small EXE, by setting the command line parameter of the EXE custom action to [INSTALLDIR] you can get INSTALLDIR to where you need it to.

INSTALLDIR will be populated in Classic Style DLLs in all but the following (deferred) locations:

"After File Transfer"
"After COM Registration"
"After Register Product"
"Before File Transfer"

Hope this helps.

Thanks Mike,

I may also be suffering from another related problem. I have a custom action (again in a DLL) which I am trying to call at "After File Transfer" time. However when the DLL is called none of the files exist on the target machine. Are the file transfers delayed in a similar way?

/john

Mike Marino
07-30-2004, 01:11 PM
The files should exist on the machine at that point....however how is your DLL trying to locate the files? If it is using the INSTALLDIR being passed in, it will not find that because that value will be an empty string.

I did a quick test to verify that the files would be present if a Custom Action was launched at that point and they were.

Hope this helps