Skip to content

Commit b610a01

Browse files
committed
add bIs32BitProcess and non bIs32BitExe check.
1 parent 0a1627e commit b610a01

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/creatwth.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -718,10 +718,17 @@ BOOL WINAPI DetourUpdateProcessWithDllEx(_In_ HANDLE hProcess,
718718
return FALSE;
719719
}
720720
#elif defined(DETOURS_64BIT)
721-
if (bIs32BitProcess || bIs32BitExe) {
722-
if (!UpdateImports32(hProcess, hModule, rlpDlls, nDlls)) {
721+
if (bIs32BitProcess) {
722+
if(bIs32BitExe) {
723+
if (!UpdateImports32(hProcess, hModule, rlpDlls, nDlls)) {
724+
return FALSE;
725+
}
726+
}
727+
else {
728+
// Can't detour a 32-bit process with 64-bit code.
729+
SetLastError(ERROR_INVALID_HANDLE);
723730
return FALSE;
724-
}
731+
}
725732
}
726733
else {
727734
// 64-bit native or 64-bit managed process on any platform.

0 commit comments

Comments
 (0)