From a18aeee659e50a96c0ee018df1da68378dcee84a Mon Sep 17 00:00:00 2001 From: sonyps5201314 Date: Fri, 4 Sep 2020 11:16:59 +0800 Subject: [PATCH] merge code from Detours 3.0 Build_343 Detours 4.0.1 looks like it's Detours 3.0 build_339 changed its name by comparing the code and looking at git commit logs, so the code in follow version need to be merged. --- CREDITS.TXT | 3 +++ src/modules.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CREDITS.TXT b/CREDITS.TXT index a1226767..275b5f0a 100644 --- a/CREDITS.TXT +++ b/CREDITS.TXT @@ -3,6 +3,9 @@ The following individuals have helped identify specific bugs and improvements in Detours. The entire Detours community has benefited from their help. ============================================================================== +* Jay Krell: Identified error in DetourFindPayload that caused a + incorrect failure when pcbData is NULL. (Build_342) + * Jay Krell: Identified issue with VirtualSize == 0 files created in NT 3.1 images. (Build_339) diff --git a/src/modules.cpp b/src/modules.cpp index ade78c97..a797121c 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -803,9 +803,9 @@ PVOID WINAPI DetourFindPayload(_In_opt_ HMODULE hModule, if (pcbData) { *pcbData = pSection->cbBytes - sizeof(*pSection); - SetLastError(NO_ERROR); - return (PBYTE)(pSection + 1); } + SetLastError(NO_ERROR); + return (PBYTE)(pSection + 1); } pbData = (PBYTE)pSection + pSection->cbBytes;