@joebigelow / wix / commits / 0d294d63

Port wix3 ARM64 fix.

Bob Arnson committed May 17, 2020 at 17:33 UTC 0d294d6306004a495317d21a220e1a64f392fdc4
1 file changed +20 -1
src/dutil/procutil.cpp
+20 -1
@@ -68,6 +68,24 @@ extern "C" HRESULT DAPI ProcWow64(
68 HRESULT hr = S_OK;
69 BOOL fIsWow64 = FALSE;
70
71 + typedef BOOL(WINAPI* LPFN_ISWOW64PROCESS2)(HANDLE, USHORT *, USHORT *);
72 + LPFN_ISWOW64PROCESS2 pfnIsWow64Process2 = (LPFN_ISWOW64PROCESS2)::GetProcAddress(::GetModuleHandleW(L"kernel32"), "IsWow64Process2");
73 +
74 + if (pfnIsWow64Process2)
75 + {
76 + USHORT pProcessMachine = IMAGE_FILE_MACHINE_UNKNOWN;
77 + if (!pfnIsWow64Process2(hProcess, &pProcessMachine, nullptr))
78 + {
79 + ExitWithLastError(hr, "Failed to check WOW64 process - IsWow64Process2.");
80 + }
81 +
82 + if (pProcessMachine != IMAGE_FILE_MACHINE_UNKNOWN)
83 + {
84 + fIsWow64 = TRUE;
85 + }
86 + }
87 + else
88 + {
89 typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS)(HANDLE, PBOOL);
90 LPFN_ISWOW64PROCESS pfnIsWow64Process = (LPFN_ISWOW64PROCESS)::GetProcAddress(::GetModuleHandleW(L"kernel32"), "IsWow64Process");
91
@@ -75,7 +93,8 @@ extern "C" HRESULT DAPI ProcWow64(
93 {
94 if (!pfnIsWow64Process(hProcess, &fIsWow64))
95 {
78 - ExitWithLastError(hr, "Failed to check WOW64 process.");
96 + ExitWithLastError(hr, "Failed to check WOW64 process - IsWow64Process.");
97 + }
98 }
99 }
100