From a316c6e87916853c0e8f31bc73503e469cd77e96 Mon Sep 17 00:00:00 2001 From: Jose Fonseca Date: Fri, 10 Jul 2015 11:07:10 +0100 Subject: trace,inject: Don't increment refcount on GetModuleHandleExA. --- inject/injectee.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'inject') diff --git a/inject/injectee.cpp b/inject/injectee.cpp index 4ed8488d..89cd6129 100644 --- a/inject/injectee.cpp +++ b/inject/injectee.cpp @@ -747,9 +747,10 @@ MyLoadLibraryA(LPCSTR lpLibFileName) void *caller = __builtin_return_address (0); HMODULE hModule = 0; - BOOL bRet = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, - (LPCTSTR)caller, - &hModule); + BOOL bRet = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | + GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, + (LPCTSTR)caller, + &hModule); assert(bRet); char szCaller[MAX_PATH]; DWORD dwRet = GetModuleFileNameA(hModule, szCaller, sizeof szCaller); -- cgit v1.2.3