summaryrefslogtreecommitdiff
path: root/inject
diff options
context:
space:
mode:
authorJose Fonseca <jfonseca@vmware.com>2015-07-10 10:50:32 +0100
committerJose Fonseca <jfonseca@vmware.com>2015-07-10 10:51:10 +0100
commit3a6e9c7fb0e42bd78650cfee496674de4d0373ae (patch)
treeb103ab6b091056b2f890f7d2128b3ab85f69d968 /inject
parentd6da96636b92e7692d3e7c363e00424a4b42b122 (diff)
Revert "inject: Ensure we always get the real module handle."
This reverts commit bd725c22b9e0ee5341cfd34a00c6f68a64a608e6. It's causing problems.
Diffstat (limited to 'inject')
-rw-r--r--inject/injectee.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/inject/injectee.cpp b/inject/injectee.cpp
index 5ffdbafd..e31df595 100644
--- a/inject/injectee.cpp
+++ b/inject/injectee.cpp
@@ -586,9 +586,6 @@ enum Action {
};
-static char g_szSystemDirectory[MAX_PATH];
-
-
template< class T >
void
patchDescriptor(HMODULE hModule,
@@ -611,9 +608,7 @@ patchDescriptor(HMODULE hModule,
// Knowning the real address is useful when patching imports by ordinal
LPVOID lpRealAddress = NULL;
- char szRealModule[MAX_PATH];
- _snprintf(szRealModule, sizeof szRealModule, "%s\\%s", g_szSystemDirectory, szDescriptorName);
- HMODULE hRealModule = GetModuleHandleA(szRealModule);
+ HMODULE hRealModule = GetModuleHandleA(szDescriptorName);
if (hRealModule) {
assert(hRealModule != g_hHookModule);
lpRealAddress = (LPVOID)GetProcAddress(hRealModule, szFunctionName);
@@ -1035,10 +1030,6 @@ DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
debugPrintf("inject: attached to process %s\n", szProcess);
}
- if (!GetSystemDirectoryA(g_szSystemDirectory, _countof(g_szSystemDirectory))) {
- assert(0);
- }
-
/*
* Calling LoadLibrary inside DllMain is strongly discouraged. But it
* works quite well, provided that the loaded DLL does not require or do