c++ - Can I access strings from a .wxl localization file from a custom action with WiX? -


i 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, display end-user message...         pmsihandle hrecord = msicreaterecord(0);         msirecordsetstring(hrecord, 0, text("error cannot continue!"));         msiprocessmessage(hinstall, installmessage(installmessage_error + mb_ok), hrecord);          return error_install_failure;     }      return error_success; } 

as see end-user message hard-coded. in actual wix markup use localization .wxl file strings such:

<property id="arpcontact" value="!(loc.contactinfo)" secure="yes" /> 

and then, instance, lang_en-us.wxl file be:

<?xml version="1.0" encoding="utf-8"?> <wixlocalization culture="en-us" xmlns="http://schemas.microsoft.com/wix/2006/localization">   <string id="contactinfo">to hold of me yell out of window...</string> </wixlocalization> 

so curious, there way access localization strings .wxl file in c++ custom action code?

you can access windows installer database , session tables custom action. common table access properties table.

as know, wix build database tables localized values each culture builds .msi for. so, yes, localization strings can accessed, example, property values.

(but, no, custom action cannot read them directly .wxl file unless use .wxl in different way. .wxl files in project not included in installer except individual localized string reference replacements.)

it other words, you're overthinking this. set , use properties localized values appropriate.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -