aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2021-02-03 20:58:15 +0100
committerPali Rohár <pali.rohar@gmail.com>2021-02-03 20:58:15 +0100
commitb89f89323c13a9804d9d521ea9800983f955560a (patch)
tree1f743f6dfc487dfc36112df152dc069e98775c06 /src
parentf7e7a5d7345cb416c5514b983f2d8ad387b6f915 (diff)
downloaddlfcn-win32-b89f89323c13a9804d9d521ea9800983f955560a.tar.gz
dlfcn-win32-b89f89323c13a9804d9d521ea9800983f955560a.tar.bz2
dlfcn-win32-b89f89323c13a9804d9d521ea9800983f955560a.zip
Move hCurrentProc variable to scope where is used
Diffstat (limited to 'src')
-rw-r--r--src/dlfcn.c5
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( ).