diff options
| author | Pali Rohár <pali.rohar@gmail.com> | 2024-01-01 15:36:03 +0100 |
|---|---|---|
| committer | Silvio <silvio.traversaro@iit.it> | 2025-04-28 14:49:51 +0200 |
| commit | ce6d045bc3d6f26109f70f8eca0e2b564cc18989 (patch) | |
| tree | 23705ae91a4ae09f01d1da70ab5b31c8eed5c7e1 | |
| parent | b5004cdcc136421217e3afc9832fbce3445ddddb (diff) | |
| download | dlfcn-win32-ce6d045bc3d6f26109f70f8eca0e2b564cc18989.tar.gz dlfcn-win32-ce6d045bc3d6f26109f70f8eca0e2b564cc18989.tar.bz2 dlfcn-win32-ce6d045bc3d6f26109f70f8eca0e2b564cc18989.zip | |
Consistently always use GetModuleHandleA() to reduce number of imports
| -rw-r--r-- | src/dlfcn.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/dlfcn.c b/src/dlfcn.c index 4b5719f..2bee0fa 100644 --- a/src/dlfcn.c +++ b/src/dlfcn.c | |||
| @@ -369,13 +369,13 @@ void *dlopen( const char *file, int mode ) | |||
| 369 | * symbol object must be provided. That object must be able to access | 369 | * symbol object must be provided. That object must be able to access |
| 370 | * all symbols from the original program file, and any objects loaded | 370 | * all symbols from the original program file, and any objects loaded |
| 371 | * with the RTLD_GLOBAL flag. | 371 | * with the RTLD_GLOBAL flag. |
| 372 | * The return value from GetModuleHandle( ) allows us to retrieve | 372 | * The return value from GetModuleHandleA( ) allows us to retrieve |
| 373 | * symbols only from the original program file. EnumProcessModules() is | 373 | * symbols only from the original program file. EnumProcessModules() is |
| 374 | * used to access symbols from other libraries. For objects loaded | 374 | * used to access symbols from other libraries. For objects loaded |
| 375 | * with the RTLD_LOCAL flag, we create our own list later on. They are | 375 | * with the RTLD_LOCAL flag, we create our own list later on. They are |
| 376 | * excluded from EnumProcessModules() iteration. | 376 | * excluded from EnumProcessModules() iteration. |
| 377 | */ | 377 | */ |
| 378 | hModule = GetModuleHandle( NULL ); | 378 | hModule = GetModuleHandleA( NULL ); |
| 379 | 379 | ||
| 380 | if( !hModule ) | 380 | if( !hModule ) |
| 381 | save_err_str( "(null)", GetLastError( ) ); | 381 | save_err_str( "(null)", GetLastError( ) ); |
| @@ -468,7 +468,7 @@ int dlclose( void *handle ) | |||
| 468 | error_occurred = FALSE; | 468 | error_occurred = FALSE; |
| 469 | 469 | ||
| 470 | /* dlopen(NULL, ...) does not call LoadLibrary(), so do not call FreeLibrary(). */ | 470 | /* dlopen(NULL, ...) does not call LoadLibrary(), so do not call FreeLibrary(). */ |
| 471 | if( hModule == GetModuleHandle( NULL ) ) | 471 | if( hModule == GetModuleHandleA( NULL ) ) |
| 472 | return 0; | 472 | return 0; |
| 473 | 473 | ||
| 474 | ret = FreeLibrary( hModule ); | 474 | ret = FreeLibrary( hModule ); |
| @@ -500,7 +500,7 @@ void *dlsym( void *handle, const char *name ) | |||
| 500 | 500 | ||
| 501 | symbol = NULL; | 501 | symbol = NULL; |
| 502 | hCaller = NULL; | 502 | hCaller = NULL; |
| 503 | hModule = GetModuleHandle( NULL ); | 503 | hModule = GetModuleHandleA( NULL ); |
| 504 | dwMessageId = 0; | 504 | dwMessageId = 0; |
| 505 | 505 | ||
| 506 | if( handle == RTLD_DEFAULT ) | 506 | if( handle == RTLD_DEFAULT ) |
| @@ -553,7 +553,7 @@ void *dlsym( void *handle, const char *name ) | |||
| 553 | 553 | ||
| 554 | hCurrentProc = GetCurrentProcess( ); | 554 | hCurrentProc = GetCurrentProcess( ); |
| 555 | 555 | ||
| 556 | /* GetModuleHandle( NULL ) only returns the current program file. So | 556 | /* GetModuleHandleA( NULL ) only returns the current program file. So |
| 557 | * if we want to get ALL loaded module including those in linked DLLs, | 557 | * if we want to get ALL loaded module including those in linked DLLs, |
| 558 | * we have to use EnumProcessModules( ). | 558 | * we have to use EnumProcessModules( ). |
| 559 | */ | 559 | */ |
