From 495370ff9311d406da9c043cd208ce836a0303ff Mon Sep 17 00:00:00 2001 From: Eric StJohn Date: Mon, 30 Aug 2021 15:26:42 -0700 Subject: Add NativeMachine to Burn and WIX_NATIVE_MACHINE to UtilExtension --- src/ext/Util/ca/OsInfo.cpp | 28 ++++++++++++++++++++++++++ src/ext/Util/ca/utilca.def | 1 + src/ext/Util/wixlib/UtilExtension_Platform.wxi | 12 +++++++++++ 3 files changed, 41 insertions(+) (limited to 'src/ext') diff --git a/src/ext/Util/ca/OsInfo.cpp b/src/ext/Util/ca/OsInfo.cpp index 4783673e..eb76a3a0 100644 --- a/src/ext/Util/ca/OsInfo.cpp +++ b/src/ext/Util/ca/OsInfo.cpp @@ -485,3 +485,31 @@ LExit: } return WcaFinalize(er); } + +/******************************************************************** +WixQueryNativeMachine - entry point for WixQueryNativeMachine custom action + + Called as Type 1 custom action (DLL from the Binary table) from + Windows Installer to set properties that indicates the native machine architecture +********************************************************************/ +extern "C" UINT __stdcall WixQueryNativeMachine( + __in MSIHANDLE hInstall + ) +{ + HRESULT hr = S_OK; + USHORT usNativeMachine = IMAGE_FILE_MACHINE_UNKNOWN; + DWORD er = ERROR_SUCCESS; + + hr = WcaInitialize(hInstall, "WixQueryNativeMachine"); + ExitOnFailure(hr, "WixQueryNativeMachine failed to initialize"); + + hr = ::ProcNativeMachine(::GetCurrentProcess(), &usNativeMachine); + ExitOnFailure(hr, "Failed to get native machine value."); + + WcaSetIntProperty(L"WIX_NATIVE_MACHINE", usNativeMachine); + +LExit: + if (FAILED(hr)) + er = ERROR_INSTALL_FAILURE; + return WcaFinalize(er); +} \ No newline at end of file diff --git a/src/ext/Util/ca/utilca.def b/src/ext/Util/ca/utilca.def index 412d86a3..3912ce56 100644 --- a/src/ext/Util/ca/utilca.def +++ b/src/ext/Util/ca/utilca.def @@ -22,6 +22,7 @@ EXPORTS WixQueryOsDirs WixQueryOsWellKnownSID WixQueryOsDriverInfo + WixQueryNativeMachine ; netshortcuts.cpp WixSchedInternetShortcuts WixCreateInternetShortcuts diff --git a/src/ext/Util/wixlib/UtilExtension_Platform.wxi b/src/ext/Util/wixlib/UtilExtension_Platform.wxi index 913c01b9..ab436adc 100644 --- a/src/ext/Util/wixlib/UtilExtension_Platform.wxi +++ b/src/ext/Util/wixlib/UtilExtension_Platform.wxi @@ -353,6 +353,18 @@ + + + + + + + + + + + + -- cgit v1.2.3-55-g6feb