PDA

View Full Version : merge module support files - PLEASE HELP



Kelter
09-20-2010, 06:24 PM
someone MUST have a solution to this:

i have a merge module which contains custom actions which depend on some DLLs. since there is no concept of support files in a merge module (nothing automatically extracted to the SUPPORTDIR) i wrote some logic to extract a file from the binary table and then load it. this is only okay in immediate mode CAs, however, as the handle passed to deferred execution CAs is not valid for calls to MsiDataBaseOpenView.

can somebody please help me?

RobertDickau
09-20-2010, 06:37 PM
Can you extract the file in immediate mode and then use (and later delete) it in deferred mode?

(It's unsurprising that you can't access the raw MSI tables during deferred mode, since the installer's internal script is finished by then. General access exceptions are MsiGetProperty+CustomActionData and the other things mentioned in "Obtaining Context Information for Deferred Execution Custom Actions", but those seem to be special cases.)

Kelter
09-20-2010, 06:49 PM
(apologies for the dup threads...i've been posting about this and related issues on the 2008 forum, but nobody looks at that anymore...bad practice + results > good practice + no results)

hmmm...i'll have to revisit that idea...originally i tried to mimic the installshield logic with a CA that would extract all the necessary setup files, and another CA would clean them up at the end of the install, but the files were getting deleted automagically before the deferred execution sequence. perhaps my problem was that i was extracting these files to a directory MSI knows about...so if i extract to a different directory, maybe they won't get cleaned up prematurely, and...i think i've got this... i'll write again with a result...

Kelter
09-20-2010, 07:26 PM
thanks for the tip!!! seems like i had a pile of problems, and only managed to fix one of them at a time. as indicated previously, i was extracting files to SUPPORTDIR, and they were being deleted as soon as the CA ended. this isn't helpful when extracting files for another CA to use.

i ran into another problem in how I was passing MySupportDir to the Deferred CAs...because some of the logic is shared among CAs, some immediate, and some deferred, the following only worked in some cases:

MySupportDir=[MySupportDir.F7043BE0_A202_4A53_BF3D_07086AC51ABC]
then i changed my script to look for

MySupportDir.F7043BE0_A202_4A53_BF3D_07086AC51ABC
which fixed the problem for Def CAs, but broke it for Imm CAs. :p

this is (somewhat obviously) what i meant to do all along:

MySupportDir.F7043BE0_A202_4A53_BF3D_07086AC51ABC=[MySupportDir.F7043BE0_A202_4A53_BF3D_07086AC51ABC]

in summary, the following are things to keep in mind when you have a merge module with def ex CAs which require support files:
1. Extract these files at the beginning of the installation to a directory that MSI logic doesn't know about
2. Make sure you are useing the "<PROPERTY_NAME>.<MODULEID> wherever appropriate
3. Make sure you cleanup these support files at the end of the install.

Also, see this thread for a simple bit of script for extracting a file from the binary table:
http://community.flexerasoftware.com/showthread.php?t=170906

Thanks again Robert!