windows - Display end-user message in case of an error in custom action in MSI with Wix -
say, have following wix markup instructs msi installer call custom action included dll:
<customaction id="ca_setproperties_finalize" property="ca_oninstallfinalize" value="[installed],[reinstall],[upgradingproductcode],[remove]" /> <customaction id='ca_oninstallfinalize' binarykey='cadll' dllentry='msioninstallfinalize' execute='deferred' impersonate='no' /> <installexecutesequence> <custom action='ca_setproperties_finalize' before='installfinalize'></custom> <custom action='ca_oninstallfinalize' after='ca_setproperties_finalize'></custom> </installexecutesequence> <binary id='cadll' sourcefile='sources\ca-installer.dll' />
and dll has following c++ code custom action:
#pragma comment(linker, "/export:msioninstallfinalize=_msioninstallfinalize@4") extern "c" uint __stdcall msioninstallfinalize(msihandle hinstall) { //do work if(dowork(hinstall) == false) { //error, cannot continue! return error_install_failure; } return error_success; }
what happens when dowork
method fails, installation should not continue, return error_install_failure
. issue in case installer quits , installation gui window goes away.
so curious, there way change wix markup able show user message in case custom action returns error?
i use create message boxes handle errors within dll:
pmsihandle hrecord = msicreaterecord(0); msirecordsetstring(hrecord, 0, text("enter text error!")); msiprocessmessage(hinstall, installmessage(installmessage_error + mb_ok), hrecord); return error_install_userexit;
Comments
Post a Comment