diff options
Diffstat (limited to 'src/libs/dutil/WixToolset.DUtil/procutil.cpp')
| -rw-r--r-- | src/libs/dutil/WixToolset.DUtil/procutil.cpp | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/procutil.cpp b/src/libs/dutil/WixToolset.DUtil/procutil.cpp index 6bfe5017..a3131b7a 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,31 @@ 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 | // S_FALSE will indicate that the method is not supported. | ||
| 128 | HRESULT hr = S_FALSE; | ||
| 129 | |||
| 130 | typedef BOOL(WINAPI* LPFN_ISWOW64PROCESS2)(HANDLE, USHORT *, USHORT *); | ||
| 131 | LPFN_ISWOW64PROCESS2 pfnIsWow64Process2 = (LPFN_ISWOW64PROCESS2)::GetProcAddress(::GetModuleHandleW(L"kernel32"), "IsWow64Process2"); | ||
| 132 | |||
| 133 | if (pfnIsWow64Process2) | ||
| 134 | { | ||
| 135 | USHORT usProcessMachineUnused = IMAGE_FILE_MACHINE_UNKNOWN; | ||
| 136 | if (!pfnIsWow64Process2(hProcess, &usProcessMachineUnused, pusNativeMachine)) | ||
| 137 | { | ||
| 138 | ExitWithLastError(hr, "Failed to check WOW64 process - IsWow64Process2."); | ||
| 139 | } | ||
| 140 | hr = S_OK; | ||
| 141 | } | ||
| 142 | |||
| 143 | LExit: | ||
| 144 | return hr; | ||
| 145 | } | ||
| 146 | |||
| 122 | extern "C" HRESULT DAPI ProcDisableWowFileSystemRedirection( | 147 | extern "C" HRESULT DAPI ProcDisableWowFileSystemRedirection( |
| 123 | __in PROC_FILESYSTEMREDIRECTION* pfsr | 148 | __in PROC_FILESYSTEMREDIRECTION* pfsr |
| 124 | ) | 149 | ) |
