[wix-users] Having issue running an executable from package in a managed custom action

Phill Hogland phill.hogland at rimage.com
Tue Feb 21 07:09:58 PST 2017


I do not know the answer to your question about launching an exe from within a MSI without installing it.  I use a Burn bundle to chain my MSIs, and burn can launch a configuration app at the end of the chain.  See ApprovedExeForElevation in the CHM.  I believe that DComPerm was a sample from the WinSDK from Win2K/WinXP era and it is known to have some issues with regard to newer x64 OS.  If using a managed CA it seems that using WMI objects would be a better choice.  For a native CA I found looking at the WixComPlus extension's source to be helpful when writing a CA that configures DCOM security.   This might be helpful.

http://stackoverflow.com/questions/11363342/change-dcom-config-security-settings-using-powershell


________________________________
From: wix-users <wix-users-bounces at lists.wixtoolset.org> on behalf of Tigran Galoyan <tigran.galoyan at gmail.com>
Sent: Tuesday, February 21, 2017 8:37:01 AM
To: wix-users at lists.wixtoolset.org
Subject: [wix-users] Having issue running an executable from package in a managed custom action

Hi all,


I have a MSI package that besides the actual components to be installed
also on the target machine also has an executable, that should not be
installed, rather just be launched after a successful installation in the
managed custom action. The custom action code snippet is the following:








*public class CustomActions{    [CustomAction]    public static
ActionResult CAM_RunDComPerm(Session session)    {        try
{            string path2DComPermExe =
Path.Combine(Assembly.GetExecutingAssembly().Location, "DComPerm.exe");*










*            using (Process proc = Process.Start(path2DComPermExe, "-runas
\"{SOME-GUID}\" username password"))            {
proc.WaitForExit(5000);            }                            return
ActionResult.Success;        }        catch (Exception ex)
{            session.Log("ERROR in CAM_RunDComPerm custom action {0}",
ex.ToString());*



*            return ActionResult.Failure;        }    }}*

What it does exactly, it sets some DCOM settings for a specific component
that gets installed as part of the MSI package. To do that I run a special
tool DComPerm.exe with the "-runas \"{SOME-GUID}\" username password"
command line arguments.

To call the custom action I have the following in my main wxs file:



*<InstallExecuteSequence>     <Custom Action="CA_LaunchDComPerm"
After="InstallFinalize">NOT Installed</Custom></InstallExecuteSequence>*

*<Binary Id="MyInstallerCustomActions" SourceFile
="..\Output\MyCustomActions.CA.dll" />*
*<CustomAction Id="CA_LaunchDComPerm" Return="check"
BinaryKey="MyInstallerCustomActions" DllEntry="CAM_RunDComPerm"
Impersonate="no" />*

However, the custom action call fails right at the beginning when combining
the path to get the absolute path to the DComPerm.exe tool to be called.
Looks like it cannot figure out the absolute path to the tool in the MSI
package. I don't want to install that tool along with other components and
then launch it at the end from the INSTALLDIRECTORY (my target directory to
install to), but to simply launch it as it exists in the package.
Unfortunately cannot specify the absolute path to it.

Any help how to make this happen?


Thanks,
Tigran

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/


More information about the wix-users mailing list