Remember, Merge Modules modularizes all identifiers.

On Thu, Jun 20, 2013 at 12:13 PM, Steven Ogilvie
<steven.ogil...@titus.com>wrote:

> Classification: Public
> Solved...
> This is an issue with Merge Modules, moved the deferred custom actions
> that have passwords from the Merge Module to the Product.wxs!
>
> Is this a MSI issue or a WIX issue? (seems <Property Hidden=Yes> and
> <Custom Action HideTarget=yes> doesn't work in Merge Modules :(
>
> Steve
>
> -----Original Message-----
> From: Steven Ogilvie [mailto:steven.ogil...@titus.com]
> Sent: June-20-13 1:12 PM
> To: General discussion for Windows Installer XML toolset.
> Subject: Re: [WiX-users] How to turn off Logging within C# custom actions
> [P]
> Importance: High
>
> Classification: Public
> Sigh,
>
> This is what I did but my SQL Server database password is STILL showing up
> in the MSI log file, what is weird is that the deferred custom actions that
> are called in the Product.wxs are hidden, but the deferred custom actions
> in my merge module are NOT...
>
> Product.wxs:
> <Property Id="MsiLogging" Value="voicewarmupx"/> <Property
> Id="DATABASE_PASSWORD" Hidden="yes" Secure="yes"/>
>
> <CustomAction Id="CA_DataBasePassword.SetProperty"
> Property="CA_DataBasePassword" HideTarget="yes"
> Value="DATABASE_PASSWORD=[DATABASE_PASSWORD]"/>
>
> <CustomAction Id="CA_Set_ConfigUtilStr" Property="CA_SETCONFIGUTILSTR"
> HideTarget="yes"
> Value="KEY0=[DATABASE_USERNAME];KEY1=[DATABASE_PASSWORD];KEY2=[DATABASE_SERVERNAME];KEY3=[DATABASE_NAME];KEY4=[DATABASE_WINDOWSAUTHENTICATION];KEY5=[CONFIGUTIL_SERVICE_PATH];KEY6=MyApp.exe.config"/>
>
> <CustomAction Id="CA_SETCONFIGUTILSTR" BinaryKey="BIN_CustomAction"
> DllEntry="CallUpdateConnectionString" HideTarget="yes" Impersonate="no"
> Execute="deferred" Return="check" />
>
> <InstallExecuteSequence>
> <Custom Action="CA_DataBasePassword.SetProperty" After="InstallFiles">NOT
> Installed</Custom> <Custom Action="CA_Set_ConfigUtilStr"
> After="InstallValidate">NOT Installed</Custom> <Custom
> Action="CA_SETCONFIGUTILSTR" After="InstallFiles">NOT Installed</Custom>
>
> In my C# Custom Action DLL:
> [CustomAction]
>         public static ActionResult CallUpdateConnectionString (Session
> session)
>         {
>             string configFileName = null;
>             try
>             {
>                 if (session == null)
>                 {
>                     throw new ArgumentNullException("session");
>                 }
>
>                 var cad = session.CustomActionData;
>
>                 var userName = cad["KEY0"];
>                 var userPassword = cad["KEY1"];
>                 var sqlServer = cad["KEY2"];
>                 var databaseName = cad["KEY3"];
>                 var tempStr = cad["KEY4"];
>                 var serverPath = cad["KEY5"];
>                 configFileName = cad["KEY6"];
>                 var windowsAthentication = tempStr == "1";
>
> Am I doing anything wrong?
>
> Steve
>
> -----Original Message-----
> From: Fyodor Koryazhkin [mailto:fyodor...@gmail.com]
> Sent: June-20-13 7:10 AM
> To: wix-users@lists.sourceforge.net
> Subject: Re: [WiX-users] How to turn off Logging with C# custom actions
>
> Hi,
> To prevent CustomActionData to be logged you should add
> *msidbCustomActionTypeHideTarget
> *(8192) attribute to CustomAction attributes.
>
> To read CustomActionData you should create property in the following
> format: PROPERTY1=VALUE1;PROPERY2=VALUE2;....;PROPERTYn=VALUEn.
> Then you read it like this: CustomActionData cad =
> session.CustomActionData; values you read: string VALUE1= cad[PROPERTY1];
> string value2= cad[PROPERTY2]; Please note that in general case the value
> can be null and in this case the above example will throw an exception.
> Therefore it is helpful first to check if specified element of an array
> exists.
>
> Regards
>
> Fyodor Koryazhkin
>
> >
> > I have database passwords and web app pool username passwords showing
> > up in my MSI log file I have verbose logging on:
> > <Property Id="MsiLogging" Value="voicewarmupx"/>
> >
> > I have the properties set like this:
> > <Property Id="DATABASE_PASSWORD" Hidden="yes" Secure="yes"/>
> >
> > I have my deferred custom action set like this:
> > <CustomAction Id="CA_Set_ConfigUtilStr" Property="CA_SETCONFIGUTILSTR"
> > HideTarget="yes"
> >
> > Value="[DATABASE_USERNAME]|[DATABASE_PASSWORD]|[DATABASE_SERVERNAME]|[
> > DATABASE_NAME]|[DATABASE_WINDOWSAUTHENTICATION]|[CONFIGUTIL_SERVICE_PA
> > TH]|MyApplication.exe.config"/>
> >
> > <CustomAction Id="CA_SETCONFIGUTILSTR" BinaryKey="BIN_CustomAction"
> > DllEntry="CallUpdateServerConnectionString" Impersonate="no"
> > Execute="deferred" Return="check" />
> >
> > <InstallExecuteSequence>
> > <Custom Action="CA_SETCONFIGUTILSTR" After="InstallFiles">NOT
> > Installed</Custom>
> >
> > in my custom action:
> >
> > [CustomAction]
> >         public static ActionResult
> > CallUpdateServerConnectionString(Session
> > session)
> >         {
> >             string configFileName = null;
> >             try
> >             {
> >                 if (session == null)
> >                 {
> >                     throw new ArgumentNullException("session");
> >                 }
> >
> >                 var tempString = GetSessionProperty(session,
> > "CustomActionData", false);
> >                 var parts = tempString.Split(new[] { '|' });
> >                 var userName = parts[0];
> >                 var userPassword = parts[1];
> >                 var sqlServer = parts[2];
> >                 var databaseName = parts[3];
> >                 var tempStr = parts[4];
> >                 var serverPath = parts[5];
> >                 configFileName = parts[6];
> >                 var windowsAthentication = tempStr == "1";
> >
> > and the function that gets the CustomActionData is:
> >
> > private static string GetSessionProperty(Session session, string
> > propertyName, bool isCustomActionData)
> >         {
> >             string sessionProperty = string.Empty;
> >
> >             try
> >             {
> >                 if (session == null)
> >                 {
> >                     throw new ArgumentNullException("session");
> >                 }
> >
> >                 sessionProperty = isCustomActionData ?
> > session.CustomActionData[propertyName] : session[propertyName];
> >             }
> >             catch (Exception ex)
> >             {
> >                 WriteErrorLogInstall(session, "Exception when
> > executing GetSessionProperty.", ex, true);
> >             }
> >
> >             return sessionProperty;
> >         }
> >
> > if I call the above function with isCustomActionData = true the custom
> > action fails with "index was outside the bounds of the array" so it is
> > false.
> >
> > the only part in the MSI that logs it is the CustomActionData...
> >
> > How can I turn logging off when i get the CustomActionData then turn
> > the logging back on?
> >
> > most likely something VERY simple that I have missed :(
> >
> > Thanks,
> >
> > Steve
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
>
>
> This message has been marked as Public by Steven Ogilvie on June-20-13
> 1:11:52 PM.
>
> The above classification labels were added to the message by TITUS Message
> Classification. For more information visit www.titus.com.
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
>
>
> This message has been marked as Public by Steven Ogilvie on June-20-13
> 3:13:02 PM.
>
> The above classification labels were added to the message by TITUS Message
> Classification.
> For more information visit www.titus.com.
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
>
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to