diff options
| author | Eric StJohn <ericstj@microsoft.com> | 2021-09-13 13:52:09 -0700 |
|---|---|---|
| committer | Eric StJohn <ericstj@microsoft.com> | 2021-09-13 13:52:09 -0700 |
| commit | fe77e96629575d6cfc16f8a868f13af89c198d13 (patch) | |
| tree | baf7d3b6c3bf8982c7b4f2903ccebfb3decaaaa0 | |
| parent | 495370ff9311d406da9c043cd208ce836a0303ff (diff) | |
| download | wix-fe77e96629575d6cfc16f8a868f13af89c198d13.tar.gz wix-fe77e96629575d6cfc16f8a868f13af89c198d13.tar.bz2 wix-fe77e96629575d6cfc16f8a868f13af89c198d13.zip | |
Don't set NativeMachine variables when IsWow64Process2 is unavailable
| -rw-r--r-- | src/burn/engine/variable.cpp | 7 | ||||
| -rw-r--r-- | src/ext/Util/ca/OsInfo.cpp | 5 | ||||
| -rw-r--r-- | src/libs/dutil/WixToolset.DUtil/procutil.cpp | 4 |
3 files changed, 12 insertions, 4 deletions
diff --git a/src/burn/engine/variable.cpp b/src/burn/engine/variable.cpp index e81704ce..04d64f18 100644 --- a/src/burn/engine/variable.cpp +++ b/src/burn/engine/variable.cpp | |||
| @@ -1845,8 +1845,11 @@ static HRESULT InitializeVariableNativeMachine( | |||
| 1845 | hr = ProcNativeMachine(::GetCurrentProcess(), &usNativeMachine); | 1845 | hr = ProcNativeMachine(::GetCurrentProcess(), &usNativeMachine); |
| 1846 | ExitOnFailure(hr, "Failed to get native machine value."); | 1846 | ExitOnFailure(hr, "Failed to get native machine value."); |
| 1847 | 1847 | ||
| 1848 | hr = BVariantSetNumeric(pValue, usNativeMachine); | 1848 | if (hr != S_FALSE) |
| 1849 | ExitOnFailure(hr, "Failed to set variant value."); | 1849 | { |
| 1850 | hr = BVariantSetNumeric(pValue, usNativeMachine); | ||
| 1851 | ExitOnFailure(hr, "Failed to set variant value."); | ||
| 1852 | } | ||
| 1850 | 1853 | ||
| 1851 | LExit: | 1854 | LExit: |
| 1852 | return hr; | 1855 | return hr; |
diff --git a/src/ext/Util/ca/OsInfo.cpp b/src/ext/Util/ca/OsInfo.cpp index eb76a3a0..3f91a9e5 100644 --- a/src/ext/Util/ca/OsInfo.cpp +++ b/src/ext/Util/ca/OsInfo.cpp | |||
| @@ -506,7 +506,10 @@ extern "C" UINT __stdcall WixQueryNativeMachine( | |||
| 506 | hr = ::ProcNativeMachine(::GetCurrentProcess(), &usNativeMachine); | 506 | hr = ::ProcNativeMachine(::GetCurrentProcess(), &usNativeMachine); |
| 507 | ExitOnFailure(hr, "Failed to get native machine value."); | 507 | ExitOnFailure(hr, "Failed to get native machine value."); |
| 508 | 508 | ||
| 509 | WcaSetIntProperty(L"WIX_NATIVE_MACHINE", usNativeMachine); | 509 | if (hr != S_FALSE) |
| 510 | { | ||
| 511 | WcaSetIntProperty(L"WIX_NATIVE_MACHINE", usNativeMachine); | ||
| 512 | } | ||
| 510 | 513 | ||
| 511 | LExit: | 514 | LExit: |
| 512 | if (FAILED(hr)) | 515 | if (FAILED(hr)) |
diff --git a/src/libs/dutil/WixToolset.DUtil/procutil.cpp b/src/libs/dutil/WixToolset.DUtil/procutil.cpp index 5cd067f0..a3131b7a 100644 --- a/src/libs/dutil/WixToolset.DUtil/procutil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/procutil.cpp | |||
| @@ -124,7 +124,8 @@ extern "C" HRESULT DAPI ProcNativeMachine( | |||
| 124 | __out USHORT* pusNativeMachine | 124 | __out USHORT* pusNativeMachine |
| 125 | ) | 125 | ) |
| 126 | { | 126 | { |
| 127 | HRESULT hr = S_OK; | 127 | // S_FALSE will indicate that the method is not supported. |
| 128 | HRESULT hr = S_FALSE; | ||
| 128 | 129 | ||
| 129 | typedef BOOL(WINAPI* LPFN_ISWOW64PROCESS2)(HANDLE, USHORT *, USHORT *); | 130 | typedef BOOL(WINAPI* LPFN_ISWOW64PROCESS2)(HANDLE, USHORT *, USHORT *); |
| 130 | LPFN_ISWOW64PROCESS2 pfnIsWow64Process2 = (LPFN_ISWOW64PROCESS2)::GetProcAddress(::GetModuleHandleW(L"kernel32"), "IsWow64Process2"); | 131 | LPFN_ISWOW64PROCESS2 pfnIsWow64Process2 = (LPFN_ISWOW64PROCESS2)::GetProcAddress(::GetModuleHandleW(L"kernel32"), "IsWow64Process2"); |
| @@ -136,6 +137,7 @@ extern "C" HRESULT DAPI ProcNativeMachine( | |||
| 136 | { | 137 | { |
| 137 | ExitWithLastError(hr, "Failed to check WOW64 process - IsWow64Process2."); | 138 | ExitWithLastError(hr, "Failed to check WOW64 process - IsWow64Process2."); |
| 138 | } | 139 | } |
| 140 | hr = S_OK; | ||
| 139 | } | 141 | } |
| 140 | 142 | ||
| 141 | LExit: | 143 | LExit: |
