diff options
| author | Eric StJohn <ericstj@microsoft.com> | 2021-08-30 15:26:42 -0700 |
|---|---|---|
| committer | Eric StJohn <ericstj@microsoft.com> | 2021-08-30 15:26:42 -0700 |
| commit | 495370ff9311d406da9c043cd208ce836a0303ff (patch) | |
| tree | ac5aa19b393dce498ad1938a0ce7410eceff93ba /src/libs | |
| parent | a4dc574fa13d828614058906c4e99fcb45965fe5 (diff) | |
| download | wix-495370ff9311d406da9c043cd208ce836a0303ff.tar.gz wix-495370ff9311d406da9c043cd208ce836a0303ff.tar.bz2 wix-495370ff9311d406da9c043cd208ce836a0303ff.zip | |
Add NativeMachine to Burn and WIX_NATIVE_MACHINE to UtilExtension
Diffstat (limited to 'src/libs')
| -rw-r--r-- | src/libs/dutil/WixToolset.DUtil/inc/procutil.h | 4 | ||||
| -rw-r--r-- | src/libs/dutil/WixToolset.DUtil/procutil.cpp | 39 |
2 files changed, 35 insertions, 8 deletions
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 | ) |
