diff options
-rw-r--r-- | dlfcn.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -362,10 +362,17 @@ void *dlsym( void *handle, const char *name ) | |||
362 | size_t sLen; | 362 | size_t sLen; |
363 | sLen = VirtualQueryEx( hCurrentProc, _ReturnAddress(), &info, sizeof( info ) ); | 363 | sLen = VirtualQueryEx( hCurrentProc, _ReturnAddress(), &info, sizeof( info ) ); |
364 | if( sLen != sizeof( info ) ) | 364 | if( sLen != sizeof( info ) ) |
365 | { | ||
366 | if( sLen != 0 ) | ||
367 | SetLastError( ERROR_INVALID_PARAMETER ); | ||
365 | goto end; | 368 | goto end; |
369 | } | ||
366 | hCaller = (HMODULE) info.AllocationBase; | 370 | hCaller = (HMODULE) info.AllocationBase; |
367 | if(!hCaller) | 371 | if( !hCaller ) |
372 | { | ||
373 | SetLastError( ERROR_INVALID_PARAMETER ); | ||
368 | goto end; | 374 | goto end; |
375 | } | ||
369 | } | 376 | } |
370 | 377 | ||
371 | if( handle != RTLD_NEXT ) | 378 | if( handle != RTLD_NEXT ) |
@@ -423,6 +430,8 @@ void *dlsym( void *handle, const char *name ) | |||
423 | end: | 430 | end: |
424 | if( symbol == NULL ) | 431 | if( symbol == NULL ) |
425 | { | 432 | { |
433 | if( GetLastError() == 0 ) | ||
434 | SetLastError( ERROR_PROC_NOT_FOUND ); | ||
426 | save_err_str( name ); | 435 | save_err_str( name ); |
427 | } | 436 | } |
428 | 437 | ||