installer - WiX - Passing parameters to a CustomAction (DLL) -


i've got dll old wise installer i'm trying working in wix, i'm pretty sure dll works msi-based installers.

here definition:

<binary id="setupdll" sourcefile="../tools/setup.dll" /> <customaction id="readconfigfiles" binarykey="setupdll" dllentry="readconfigfiles" /> 

and usage:

<publish dialog="installdirdlg" control="next" event="doaction" value="readconfigfiles" order="3">1</publish> 

my c++ function looks this:

extern "c" uint __stdcall readconfigfiles(msihandle hinstall, char * szdirectory) 

where can pass in parameters?

you can't pass parameters directly because in order work, function has exported right footprint. when call readconfigfiles in custom action dll, should have footprint this:

extern "c" uint __stdcall readconfigfiles(msihandle hinstaller); 

you can use hinstaller parameter read properties msi. use msigetproperty():

hresult getproperty(msihandle hinstaller, lpcwstr property, lpwstr value, dword cch_value) {     uint err = msigetproperty(hinstaller, property, value, &cch_value);     return (err == error_success ? s_ok : e_fail); } 

then make sure set property in .wxs file:

<property id="your-property-name">your-property-value</property> 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -