This might not be quite directly related to wix, apologies if this is
not the right list. There's the largest number of windows installer
experts here and this might be useful to all custom action authors :)

 

I've been working on unit-testing our C++ custom actions. In the
beginning I had a shim that simulated MSI functions, but once we got to
the complex ones (MsiExecuteQuery), it became clear that that's not the
way to go. Today I create a database on the fly and can call any MSI
function. Wrapped into CPPUNIT this makes a complete MSI testing
framework.

 

It looks roughly like this:

 

MsiOpenDatabase(temporary file, MSIDBOPEN_CREATEDIRECT); // create a new
blank database

MsiGetSummaryInformation(...) // get existing summary information

MsiSummaryInfoSetProperty(...) // set new minimal summary information
for msi to be happy (PID_REVNUMBER, PID_PAGECOUNT and PID_WORDCOUNT),
repeat for each property

MsiSummaryInfoPersist // persist the property information in the msi

MsiDatabaseCommit // commit the changes to disk

MsiOpenPackage(temporaryfilename, & handle) // reopen the database as a
runtime package

 

Now I have an MSIHANDLE that can be passed into MSI functions. To call
MsiDoAction, I also import the CustomAction and Binary tables that have
the declaration of my custom action and the custom action binary
respectively. Works well for immediate CAs.

 

The one thing I can't figure out is how to execute deferred CAs? I tried
running the whole sequence via MsiDoAction, but it always fails in
InstallInitialize with 0x80070643: Fatal error during installation.

 

Any ideas?

 

Thx

dB.

 

-dB.

dblock.org <http://www.dblock.org/>  / foodcandy.com
<http://www.foodcandy.com/> 

 

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to