summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inject/injectee.cpp7
-rw-r--r--wrappers/trace.py3
2 files changed, 6 insertions, 4 deletions
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);
diff --git a/wrappers/trace.py b/wrappers/trace.py
index 6f5dab42..a7a0a0b0 100644
--- a/wrappers/trace.py
+++ b/wrappers/trace.py
@@ -896,7 +896,8 @@ class Tracer:
print r' riid.Data4[0], riid.Data4[1], riid.Data4[2], riid.Data4[3], riid.Data4[4], riid.Data4[5], riid.Data4[6], riid.Data4[7]);'
print r' void * pVtbl = *(void **)pvObj;'
print r' HMODULE hModule = 0;'
- print r' BOOL bRet = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,'
+ print r' BOOL bRet = GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |'
+ print r' GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,'
print r' (LPCTSTR)pVtbl,'
print r' &hModule);'
print r' assert(bRet);'