Implement ExePackage/CommandLine. #238

Merged
merged 3 commits into from Apr 25, 2015

Projects

None yet

3 participants

@barnson
Member
barnson commented Apr 20, 2015
  • Add WixBundleExecutePackageAction variable: Set to the BOOTSTRAPPER_ACTION_STATE of the package as it's about to executed.
  • Add ExePackage/CommandLine to compiler and binder.
  • Update Burn to parse CommandLine table in manifest and apply it during ExePackage execution.
barnson added some commits Apr 20, 2015
@barnson barnson Squashed commit of the following:
commit b0fdb29
Merge: 8557187 a2cfba8
Author: Rob Mensching <rob@robmensching.com>
Date:   Fri Apr 17 17:00:15 2015 -0700

    Merge pull request #3 from firegiant/ExePackageCommandLine

    Implement ExePackage/CommandLine.

commit a2cfba8
Author: Bob Arnson <bob@firegiant.com>
Date:   Fri Apr 17 18:05:39 2015 -0400

    Re-address review feedback.

commit 3595f70
Author: Bob Arnson <bob@firegiant.com>
Date:   Thu Apr 16 17:46:12 2015 -0400

    Address review feedback.

commit 3af9028
Author: Bob Arnson <bob@firegiant.com>
Date:   Wed Apr 1 20:25:53 2015 -0400

    Implement ExePackage/CommandLine.

    - Add WixBundleExecutePackageAction variable: Set to the BOOTSTRAPPER_ACTION_STATE of the package as it's about to executed.
    - Add ExePackage/CommandLine to compiler and binder.
    - Update Burn to parse CommandLine table in manifest and apply it during ExePackage execution.
c50afbc
@barnson barnson Add History.md entry. d391bf2
@rseanhall rseanhall and 1 other commented on an outdated diff Apr 21, 2015
src/burn/engine/exeengine.cpp
@@ -25,7 +25,7 @@ static HRESULT HandleExitCode(
// function definitions
-extern "C" HRESULT ExeEngineParsePackageFromXml(
+static HRESULT ParseExitCodesFromXml(
@rseanhall
rseanhall Apr 21, 2015 Member

Static methods don't belong up here.

@barnson
barnson Apr 23, 2015 Member

I hate making the compiler's job easier by duplicating declarations.

@rseanhall rseanhall commented on the diff Apr 21, 2015
src/burn/engine/exeengine.cpp
@@ -165,6 +115,146 @@ extern "C" HRESULT ExeEngineParsePackageFromXml(
return hr;
}
+static HRESULT ParseCommandLineArgumentsFromXml(
+ __in IXMLDOMNode* pixnExePackage,
+ __in BURN_PACKAGE* pPackage
+ )
+{
+ HRESULT hr = S_OK;
+ IXMLDOMNodeList* pixnNodes = NULL;
+ IXMLDOMNode* pixnNode = NULL;
+ DWORD cNodes = 0;
+ LPWSTR scz = NULL;
+
+ // select exit code nodes
@rseanhall
rseanhall Apr 21, 2015 Member

The WiX style is for comments to be complete sentences, so they should always be capitalized and have periods.

@rseanhall rseanhall commented on an outdated diff Apr 21, 2015
src/burn/engine/exeengine.cpp
+ ExitOnFailure(hr, "Failed to get command-line argument for install.");
+ break;
+
+ case BOOTSTRAPPER_ACTION_STATE_UNINSTALL:
+ hr = StrAllocConcat(&sczArguments, commandLineArgument->sczUninstallArgument, 0);
+ ExitOnFailure(hr, "Failed to get command-line argument for uninstall.");
+ break;
+
+ case BOOTSTRAPPER_ACTION_STATE_REPAIR:
+ hr = StrAllocConcat(&sczArguments, commandLineArgument->sczRepairArgument, 0);
+ ExitOnFailure(hr, "Failed to get command-line argument for repair.");
+ break;
+
+ default:
+ hr = E_INVALIDARG;
+ ExitOnFailure1(hr, "Invalid Exe package action: %d.", pExecuteAction->exePackage.action);
@rseanhall
rseanhall Apr 21, 2015 Member

Changing to ExitOnFailure will make it easier to port to wix4.

@rseanhall rseanhall commented on the diff Apr 21, 2015
src/burn/engine/exeengine.cpp
}
// build command
- if (wzArguments && *wzArguments)
+ if (0 < lstrlenW(sczArguments))
@rseanhall
rseanhall Apr 21, 2015 Member

Why can't we use if (*sczArguments)?

@barnson
barnson Apr 23, 2015 Member

It might be an empty string.

@rseanhall rseanhall commented on an outdated diff Apr 21, 2015
src/burn/engine/variable.cpp
@@ -262,6 +262,7 @@ extern "C" HRESULT VariableInitialize(
{L"WindowsVolume", InitializeVariableWindowsVolumeFolder, 0},
{BURN_BUNDLE_ACTION, InitializeVariableNumeric, 0},
{BURN_BUNDLE_EXECUTE_PACKAGE_CACHE_FOLDER, InitializeVariableString, NULL},
+ {BURN_BUNDLE_EXECUTE_PACKAGE_ACTION, InitializeVariableNumeric, 0},
@rseanhall
rseanhall Apr 21, 2015 Member

The default should be NULL, which requires using InitializeVariableString.

@rseanhall rseanhall commented on the diff Apr 21, 2015
src/tools/wix/CommandLineInfo.cs
+// LICENSE.TXT at the root directory of the distribution.
+// </copyright>
+//
+// <summary>
+// Utility class for Burn ExePackage CommandLine information.
+// </summary>
+//-------------------------------------------------------------------------------------------------
+
+namespace Microsoft.Tools.WindowsInstallerXml
+{
+ using System;
+
+ /// <summary>
+ /// Utility class for Burn CommandLine information.
+ /// </summary>
+ internal class CommandLineInfo
@rseanhall
rseanhall Apr 21, 2015 Member

Creating new Info classes makes me sad.

@barnson
barnson Apr 23, 2015 Member

Mission accomplished. :) Fair point but it turns out there are few *Row classes to model. I thought I had one with WixApprovedExeForElevationRow but then I found ApprovedExeForElevation. :)

@rseanhall rseanhall and 1 other commented on an outdated diff Apr 21, 2015
src/tools/wix/Xsd/wix.xsd
@@ -1232,6 +1233,43 @@
</xs:attribute>
</xs:complexType>
</xs:element>
+ <xs:element name="CommandLine">
+ <xs:annotation>
+ <xs:documentation>Describes additional, conditional command-line arguments for an ExePackage.</xs:documentation>
+ <xs:appinfo>
+ <xse:parent namespace="http://schemas.microsoft.com/wix/2006/wi" ref="ExePackage" />
@rseanhall
rseanhall Apr 21, 2015 Member

xse:parent elements are only necessary when the parent element is defined in a separate xsd file.

@rseanhall
rseanhall Apr 21, 2015 Member

Cool, this would have made things a lot easier. Can't wait for the MSI property version :)

@barnson
barnson Apr 23, 2015 Member

We have hundreds of those...oh well. MsiProperty is in the queue (brain queue, not PR queue).

@robmen robmen merged commit 3eea1e8 into wixtoolset:develop Apr 25, 2015
@barnson barnson deleted the barnson:feat4719 branch May 8, 2015
@barnson barnson restored the barnson:feat4719 branch Feb 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment