diff options
-rw-r--r-- | src/dlfcn.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/dlfcn.c b/src/dlfcn.c index 9620692..8cd2fc9 100644 --- a/src/dlfcn.c +++ b/src/dlfcn.c | |||
@@ -362,14 +362,12 @@ void *dlsym( void *handle, const char *name ) | |||
362 | FARPROC symbol; | 362 | FARPROC symbol; |
363 | HMODULE hCaller; | 363 | HMODULE hCaller; |
364 | HMODULE hModule; | 364 | HMODULE hModule; |
365 | HANDLE hCurrentProc; | ||
366 | 365 | ||
367 | error_occurred = FALSE; | 366 | error_occurred = FALSE; |
368 | 367 | ||
369 | symbol = NULL; | 368 | symbol = NULL; |
370 | hCaller = NULL; | 369 | hCaller = NULL; |
371 | hModule = GetModuleHandle( NULL ); | 370 | hModule = GetModuleHandle( NULL ); |
372 | hCurrentProc = GetCurrentProcess( ); | ||
373 | 371 | ||
374 | if( handle == RTLD_DEFAULT ) | 372 | if( handle == RTLD_DEFAULT ) |
375 | { | 373 | { |
@@ -407,11 +405,14 @@ void *dlsym( void *handle, const char *name ) | |||
407 | 405 | ||
408 | if( hModule == handle || handle == RTLD_NEXT ) | 406 | if( hModule == handle || handle == RTLD_NEXT ) |
409 | { | 407 | { |
408 | HANDLE hCurrentProc; | ||
410 | HMODULE *modules; | 409 | HMODULE *modules; |
411 | DWORD cbNeeded; | 410 | DWORD cbNeeded; |
412 | DWORD dwSize; | 411 | DWORD dwSize; |
413 | size_t i; | 412 | size_t i; |
414 | 413 | ||
414 | hCurrentProc = GetCurrentProcess( ); | ||
415 | |||
415 | /* GetModuleHandle( NULL ) only returns the current program file. So | 416 | /* GetModuleHandle( NULL ) only returns the current program file. So |
416 | * if we want to get ALL loaded module including those in linked DLLs, | 417 | * if we want to get ALL loaded module including those in linked DLLs, |
417 | * we have to use EnumProcessModules( ). | 418 | * we have to use EnumProcessModules( ). |