diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/burn/engine/variable.cpp | 25 | ||||
| -rw-r--r-- | src/burn/test/BurnUnitTest/VariableTest.cpp | 1 | ||||
| -rw-r--r-- | src/ext/Util/ca/OsInfo.cpp | 28 | ||||
| -rw-r--r-- | src/ext/Util/ca/utilca.def | 1 | ||||
| -rw-r--r-- | src/ext/Util/wixlib/UtilExtension_Platform.wxi | 12 | ||||
| -rw-r--r-- | src/libs/dutil/WixToolset.DUtil/inc/procutil.h | 4 | ||||
| -rw-r--r-- | src/libs/dutil/WixToolset.DUtil/procutil.cpp | 39 | ||||
| -rw-r--r-- | src/wix/WixToolset.Converters/WixConverter.cs | 3 | ||||
| -rw-r--r-- | src/wix/WixToolset.Core/CompilerCore.cs | 1 |
9 files changed, 106 insertions, 8 deletions
diff --git a/src/burn/engine/variable.cpp b/src/burn/engine/variable.cpp index e7391a9f..e81704ce 100644 --- a/src/burn/engine/variable.cpp +++ b/src/burn/engine/variable.cpp | |||
| @@ -97,6 +97,10 @@ static HRESULT InitializeVariableVersionNT( | |||
| 97 | __in DWORD_PTR dwpData, | 97 | __in DWORD_PTR dwpData, |
| 98 | __inout BURN_VARIANT* pValue | 98 | __inout BURN_VARIANT* pValue |
| 99 | ); | 99 | ); |
| 100 | static HRESULT InitializeVariableNativeMachine( | ||
| 101 | __in DWORD_PTR dwpData, | ||
| 102 | __inout BURN_VARIANT* pValue | ||
| 103 | ); | ||
| 100 | static HRESULT InitializeVariableOsInfo( | 104 | static HRESULT InitializeVariableOsInfo( |
| 101 | __in DWORD_PTR dwpData, | 105 | __in DWORD_PTR dwpData, |
| 102 | __inout BURN_VARIANT* pValue | 106 | __inout BURN_VARIANT* pValue |
| @@ -223,6 +227,7 @@ extern "C" HRESULT VariableInitialize( | |||
| 223 | {L"LocalAppDataFolder", InitializeVariableCsidlFolder, CSIDL_LOCAL_APPDATA}, | 227 | {L"LocalAppDataFolder", InitializeVariableCsidlFolder, CSIDL_LOCAL_APPDATA}, |
| 224 | {VARIABLE_LOGONUSER, InitializeVariableLogonUser, 0}, | 228 | {VARIABLE_LOGONUSER, InitializeVariableLogonUser, 0}, |
| 225 | {L"MyPicturesFolder", InitializeVariableCsidlFolder, CSIDL_MYPICTURES}, | 229 | {L"MyPicturesFolder", InitializeVariableCsidlFolder, CSIDL_MYPICTURES}, |
| 230 | {L"NativeMachine", InitializeVariableNativeMachine, 0}, | ||
| 226 | {L"NTProductType", InitializeVariableOsInfo, OS_INFO_VARIABLE_NTProductType}, | 231 | {L"NTProductType", InitializeVariableOsInfo, OS_INFO_VARIABLE_NTProductType}, |
| 227 | {L"NTSuiteBackOffice", InitializeVariableOsInfo, OS_INFO_VARIABLE_NTSuiteBackOffice}, | 232 | {L"NTSuiteBackOffice", InitializeVariableOsInfo, OS_INFO_VARIABLE_NTSuiteBackOffice}, |
| 228 | {L"NTSuiteDataCenter", InitializeVariableOsInfo, OS_INFO_VARIABLE_NTSuiteDataCenter}, | 233 | {L"NTSuiteDataCenter", InitializeVariableOsInfo, OS_INFO_VARIABLE_NTSuiteDataCenter}, |
| @@ -1827,6 +1832,26 @@ LExit: | |||
| 1827 | return hr; | 1832 | return hr; |
| 1828 | } | 1833 | } |
| 1829 | 1834 | ||
| 1835 | static HRESULT InitializeVariableNativeMachine( | ||
| 1836 | __in DWORD_PTR dwpData, | ||
| 1837 | __inout BURN_VARIANT* pValue | ||
| 1838 | ) | ||
| 1839 | { | ||
| 1840 | UNREFERENCED_PARAMETER(dwpData); | ||
| 1841 | |||
| 1842 | HRESULT hr = S_OK; | ||
| 1843 | USHORT usNativeMachine = IMAGE_FILE_MACHINE_UNKNOWN; | ||
| 1844 | |||
| 1845 | hr = ProcNativeMachine(::GetCurrentProcess(), &usNativeMachine); | ||
| 1846 | ExitOnFailure(hr, "Failed to get native machine value."); | ||
| 1847 | |||
| 1848 | hr = BVariantSetNumeric(pValue, usNativeMachine); | ||
| 1849 | ExitOnFailure(hr, "Failed to set variant value."); | ||
| 1850 | |||
| 1851 | LExit: | ||
| 1852 | return hr; | ||
| 1853 | } | ||
| 1854 | |||
| 1830 | static HRESULT InitializeVariableComputerName( | 1855 | static HRESULT InitializeVariableComputerName( |
| 1831 | __in DWORD_PTR dwpData, | 1856 | __in DWORD_PTR dwpData, |
| 1832 | __inout BURN_VARIANT* pValue | 1857 | __inout BURN_VARIANT* pValue |
diff --git a/src/burn/test/BurnUnitTest/VariableTest.cpp b/src/burn/test/BurnUnitTest/VariableTest.cpp index 259fb468..2ae829dc 100644 --- a/src/burn/test/BurnUnitTest/VariableTest.cpp +++ b/src/burn/test/BurnUnitTest/VariableTest.cpp | |||
| @@ -477,6 +477,7 @@ namespace Bootstrapper | |||
| 477 | Assert::Equal(E_INVALIDARG, hr); | 477 | Assert::Equal(E_INVALIDARG, hr); |
| 478 | Assert::False(EvaluateConditionHelper(&variables, L"VersionNT = \"VAL\"")); | 478 | Assert::False(EvaluateConditionHelper(&variables, L"VersionNT = \"VAL\"")); |
| 479 | 479 | ||
| 480 | VariableGetNumericHelper(&variables, L"NativeMachine"); | ||
| 480 | VariableGetNumericHelper(&variables, L"NTProductType"); | 481 | VariableGetNumericHelper(&variables, L"NTProductType"); |
| 481 | VariableGetNumericHelper(&variables, L"NTSuiteBackOffice"); | 482 | VariableGetNumericHelper(&variables, L"NTSuiteBackOffice"); |
| 482 | VariableGetNumericHelper(&variables, L"NTSuiteDataCenter"); | 483 | VariableGetNumericHelper(&variables, L"NTSuiteDataCenter"); |
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: | |||
| 485 | } | 485 | } |
| 486 | return WcaFinalize(er); | 486 | return WcaFinalize(er); |
| 487 | } | 487 | } |
| 488 | |||
| 489 | /******************************************************************** | ||
| 490 | WixQueryNativeMachine - entry point for WixQueryNativeMachine custom action | ||
| 491 | |||
| 492 | Called as Type 1 custom action (DLL from the Binary table) from | ||
| 493 | Windows Installer to set properties that indicates the native machine architecture | ||
| 494 | ********************************************************************/ | ||
| 495 | extern "C" UINT __stdcall WixQueryNativeMachine( | ||
| 496 | __in MSIHANDLE hInstall | ||
| 497 | ) | ||
| 498 | { | ||
| 499 | HRESULT hr = S_OK; | ||
| 500 | USHORT usNativeMachine = IMAGE_FILE_MACHINE_UNKNOWN; | ||
| 501 | DWORD er = ERROR_SUCCESS; | ||
| 502 | |||
| 503 | hr = WcaInitialize(hInstall, "WixQueryNativeMachine"); | ||
| 504 | ExitOnFailure(hr, "WixQueryNativeMachine failed to initialize"); | ||
| 505 | |||
| 506 | hr = ::ProcNativeMachine(::GetCurrentProcess(), &usNativeMachine); | ||
| 507 | ExitOnFailure(hr, "Failed to get native machine value."); | ||
| 508 | |||
| 509 | WcaSetIntProperty(L"WIX_NATIVE_MACHINE", usNativeMachine); | ||
| 510 | |||
| 511 | LExit: | ||
| 512 | if (FAILED(hr)) | ||
| 513 | er = ERROR_INSTALL_FAILURE; | ||
| 514 | return WcaFinalize(er); | ||
| 515 | } \ 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 | |||
| 22 | WixQueryOsDirs | 22 | WixQueryOsDirs |
| 23 | WixQueryOsWellKnownSID | 23 | WixQueryOsWellKnownSID |
| 24 | WixQueryOsDriverInfo | 24 | WixQueryOsDriverInfo |
| 25 | WixQueryNativeMachine | ||
| 25 | ; netshortcuts.cpp | 26 | ; netshortcuts.cpp |
| 26 | WixSchedInternetShortcuts | 27 | WixSchedInternetShortcuts |
| 27 | WixCreateInternetShortcuts | 28 | 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 @@ | |||
| 353 | <Custom Action="$(var.Prefix)QueryOsDriverInfo$(var.Suffix)" After="AppSearch" Overridable="yes" Condition="VersionNT > 400 OR (VersionNT = 400 AND ServicePackLevel > 3)" /> | 353 | <Custom Action="$(var.Prefix)QueryOsDriverInfo$(var.Suffix)" After="AppSearch" Overridable="yes" Condition="VersionNT > 400 OR (VersionNT = 400 AND ServicePackLevel > 3)" /> |
| 354 | </InstallUISequence> | 354 | </InstallUISequence> |
| 355 | </Fragment> | 355 | </Fragment> |
| 356 | |||
| 357 | <Fragment> | ||
| 358 | <CustomAction Id="$(var.Prefix)QueryNativeMachine$(var.Suffix)" DllEntry="WixQueryNativeMachine" Execute="firstSequence" Return="check" SuppressModularization="yes" BinaryRef="$(var.Prefix)UtilCA$(var.Suffix)" /> | ||
| 359 | |||
| 360 | <InstallExecuteSequence> | ||
| 361 | <Custom Action="$(var.Prefix)QueryNativeMachine$(var.Suffix)" After="AppSearch" Overridable="yes" Condition="VersionNT > 400 OR (VersionNT = 400 AND ServicePackLevel > 3)" /> | ||
| 362 | </InstallExecuteSequence> | ||
| 363 | |||
| 364 | <InstallUISequence> | ||
| 365 | <Custom Action="$(var.Prefix)QueryNativeMachine$(var.Suffix)" After="AppSearch" Overridable="yes" Condition="VersionNT > 400 OR (VersionNT = 400 AND ServicePackLevel > 3)" /> | ||
| 366 | </InstallUISequence> | ||
| 367 | </Fragment> | ||
| 356 | 368 | ||
| 357 | <Fragment> | 369 | <Fragment> |
| 358 | <Binary Id="$(var.Prefix)UtilCA$(var.Suffix)" SourceFile="!(bindpath.$(var.platform))utilca.dll" /> | 370 | <Binary Id="$(var.Prefix)UtilCA$(var.Suffix)" SourceFile="!(bindpath.$(var.platform))utilca.dll" /> |
diff --git a/src/libs/dutil/WixToolset.DUtil/inc/procutil.h b/src/libs/dutil/WixToolset.DUtil/inc/procutil.h index 00f3f358..4f49313b 100644 --- a/src/libs/dutil/WixToolset.DUtil/inc/procutil.h +++ b/src/libs/dutil/WixToolset.DUtil/inc/procutil.h | |||
| @@ -22,6 +22,10 @@ HRESULT DAPI ProcWow64( | |||
| 22 | __in HANDLE hProcess, | 22 | __in HANDLE hProcess, |
| 23 | __out BOOL* pfWow64 | 23 | __out BOOL* pfWow64 |
| 24 | ); | 24 | ); |
| 25 | HRESULT DAPI ProcNativeMachine( | ||
| 26 | __in HANDLE hProcess, | ||
| 27 | __out USHORT* pusNativeMachine | ||
| 28 | ); | ||
| 25 | HRESULT DAPI ProcDisableWowFileSystemRedirection( | 29 | HRESULT DAPI ProcDisableWowFileSystemRedirection( |
| 26 | __in PROC_FILESYSTEMREDIRECTION* pfsr | 30 | __in PROC_FILESYSTEMREDIRECTION* pfsr |
| 27 | ); | 31 | ); |
diff --git a/src/libs/dutil/WixToolset.DUtil/procutil.cpp b/src/libs/dutil/WixToolset.DUtil/procutil.cpp index 6bfe5017..5cd067f0 100644 --- a/src/libs/dutil/WixToolset.DUtil/procutil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/procutil.cpp | |||
| @@ -88,26 +88,26 @@ extern "C" HRESULT DAPI ProcWow64( | |||
| 88 | 88 | ||
| 89 | if (pfnIsWow64Process2) | 89 | if (pfnIsWow64Process2) |
| 90 | { | 90 | { |
| 91 | USHORT pProcessMachine = IMAGE_FILE_MACHINE_UNKNOWN; | 91 | USHORT usProcessMachine = IMAGE_FILE_MACHINE_UNKNOWN; |
| 92 | if (!pfnIsWow64Process2(hProcess, &pProcessMachine, nullptr)) | 92 | if (!pfnIsWow64Process2(hProcess, &usProcessMachine, nullptr)) |
| 93 | { | 93 | { |
| 94 | ProcExitWithLastError(hr, "Failed to check WOW64 process - IsWow64Process2."); | 94 | ProcExitWithLastError(hr, "Failed to check WOW64 process - IsWow64Process2."); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | if (pProcessMachine != IMAGE_FILE_MACHINE_UNKNOWN) | 97 | if (usProcessMachine != IMAGE_FILE_MACHINE_UNKNOWN) |
| 98 | { | 98 | { |
| 99 | fIsWow64 = TRUE; | 99 | fIsWow64 = TRUE; |
| 100 | } | 100 | } |
| 101 | } | 101 | } |
| 102 | else | 102 | else |
| 103 | { | 103 | { |
| 104 | typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS)(HANDLE, PBOOL); | 104 | typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS)(HANDLE, PBOOL); |
| 105 | LPFN_ISWOW64PROCESS pfnIsWow64Process = (LPFN_ISWOW64PROCESS)::GetProcAddress(::GetModuleHandleW(L"kernel32"), "IsWow64Process"); | 105 | LPFN_ISWOW64PROCESS pfnIsWow64Process = (LPFN_ISWOW64PROCESS)::GetProcAddress(::GetModuleHandleW(L"kernel32"), "IsWow64Process"); |
| 106 | 106 | ||
| 107 | if (pfnIsWow64Process) | 107 | if (pfnIsWow64Process) |
| 108 | { | ||
| 109 | if (!pfnIsWow64Process(hProcess, &fIsWow64)) | ||
| 110 | { | 108 | { |
| 109 | if (!pfnIsWow64Process(hProcess, &fIsWow64)) | ||
| 110 | { | ||
| 111 | ProcExitWithLastError(hr, "Failed to check WOW64 process - IsWow64Process."); | 111 | ProcExitWithLastError(hr, "Failed to check WOW64 process - IsWow64Process."); |
| 112 | } | 112 | } |
| 113 | } | 113 | } |
| @@ -119,6 +119,29 @@ LExit: | |||
| 119 | return hr; | 119 | return hr; |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | extern "C" HRESULT DAPI ProcNativeMachine( | ||
| 123 | __in HANDLE hProcess, | ||
| 124 | __out USHORT* pusNativeMachine | ||
| 125 | ) | ||
| 126 | { | ||
| 127 | HRESULT hr = S_OK; | ||
| 128 | |||
| 129 | typedef BOOL(WINAPI* LPFN_ISWOW64PROCESS2)(HANDLE, USHORT *, USHORT *); | ||
| 130 | LPFN_ISWOW64PROCESS2 pfnIsWow64Process2 = (LPFN_ISWOW64PROCESS2)::GetProcAddress(::GetModuleHandleW(L"kernel32"), "IsWow64Process2"); | ||
| 131 | |||
| 132 | if (pfnIsWow64Process2) | ||
| 133 | { | ||
| 134 | USHORT usProcessMachineUnused = IMAGE_FILE_MACHINE_UNKNOWN; | ||
| 135 | if (!pfnIsWow64Process2(hProcess, &usProcessMachineUnused, pusNativeMachine)) | ||
| 136 | { | ||
| 137 | ExitWithLastError(hr, "Failed to check WOW64 process - IsWow64Process2."); | ||
| 138 | } | ||
| 139 | } | ||
| 140 | |||
| 141 | LExit: | ||
| 142 | return hr; | ||
| 143 | } | ||
| 144 | |||
| 122 | extern "C" HRESULT DAPI ProcDisableWowFileSystemRedirection( | 145 | extern "C" HRESULT DAPI ProcDisableWowFileSystemRedirection( |
| 123 | __in PROC_FILESYSTEMREDIRECTION* pfsr | 146 | __in PROC_FILESYSTEMREDIRECTION* pfsr |
| 124 | ) | 147 | ) |
diff --git a/src/wix/WixToolset.Converters/WixConverter.cs b/src/wix/WixToolset.Converters/WixConverter.cs index a343f35a..e72d0024 100644 --- a/src/wix/WixToolset.Converters/WixConverter.cs +++ b/src/wix/WixToolset.Converters/WixConverter.cs | |||
| @@ -1374,6 +1374,9 @@ namespace WixToolset.Converters | |||
| 1374 | case "WIX_ACCOUNT_PERFLOGUSERS_NODOMAIN": | 1374 | case "WIX_ACCOUNT_PERFLOGUSERS_NODOMAIN": |
| 1375 | newElementName = "QueryWindowsWellKnownSIDs"; | 1375 | newElementName = "QueryWindowsWellKnownSIDs"; |
| 1376 | break; | 1376 | break; |
| 1377 | case "WIX_NATIVE_MACHINE": | ||
| 1378 | newElementName = "QueryNativeMachine"; | ||
| 1379 | break; | ||
| 1377 | } | 1380 | } |
| 1378 | 1381 | ||
| 1379 | if (!String.IsNullOrEmpty(newElementName) | 1382 | if (!String.IsNullOrEmpty(newElementName) |
diff --git a/src/wix/WixToolset.Core/CompilerCore.cs b/src/wix/WixToolset.Core/CompilerCore.cs index 727084eb..98bbd19e 100644 --- a/src/wix/WixToolset.Core/CompilerCore.cs +++ b/src/wix/WixToolset.Core/CompilerCore.cs | |||
| @@ -61,6 +61,7 @@ namespace WixToolset.Core | |||
| 61 | "LocalAppDataFolder", | 61 | "LocalAppDataFolder", |
| 62 | "LogonUser", | 62 | "LogonUser", |
| 63 | "MyPicturesFolder", | 63 | "MyPicturesFolder", |
| 64 | "NativeMachine", | ||
| 64 | "NTProductType", | 65 | "NTProductType", |
| 65 | "NTSuiteBackOffice", | 66 | "NTSuiteBackOffice", |
| 66 | "NTSuiteDataCenter", | 67 | "NTSuiteDataCenter", |
