diff options
| author | Silvio Traversaro <silvio@traversaro.it> | 2019-07-23 18:00:04 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-07-23 18:00:04 -0500 |
| commit | 4e17b0832b399136e7992b9407d970e2a9cf3f7d (patch) | |
| tree | 15c475623faf13512c8d6a922a47ec8c5d6dd204 | |
| parent | 11ff86bfab0e3baf6d17d2f2743aa735b3656ef7 (diff) | |
| parent | 5c2ec8f9355eb10940375efc95d2d08b7db7dba1 (diff) | |
| download | dlfcn-win32-4e17b0832b399136e7992b9407d970e2a9cf3f7d.tar.gz dlfcn-win32-4e17b0832b399136e7992b9407d970e2a9cf3f7d.tar.bz2 dlfcn-win32-4e17b0832b399136e7992b9407d970e2a9cf3f7d.zip | |
Merge pull request #55 from pali/master
Turn off GUI error messages around LoadLibraryA also in test
| -rw-r--r-- | test.c | 7 |
1 files changed, 7 insertions, 0 deletions
| @@ -88,6 +88,7 @@ int main() | |||
| 88 | char nonlibraryfile[MAX_PATH]; | 88 | char nonlibraryfile[MAX_PATH]; |
| 89 | HANDLE tempfile; | 89 | HANDLE tempfile; |
| 90 | DWORD dummy; | 90 | DWORD dummy; |
| 91 | UINT uMode; | ||
| 91 | 92 | ||
| 92 | #ifdef _DEBUG | 93 | #ifdef _DEBUG |
| 93 | _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); | 94 | _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); |
| @@ -118,8 +119,10 @@ int main() | |||
| 118 | 119 | ||
| 119 | CloseHandle( tempfile ); | 120 | CloseHandle( tempfile ); |
| 120 | 121 | ||
| 122 | uMode = SetErrorMode( SEM_FAILCRITICALERRORS ); | ||
| 121 | library3 = LoadLibraryA( nonlibraryfile ); | 123 | library3 = LoadLibraryA( nonlibraryfile ); |
| 122 | code = GetLastError( ); | 124 | code = GetLastError( ); |
| 125 | SetErrorMode( uMode ); | ||
| 123 | if( library3 ) | 126 | if( library3 ) |
| 124 | { | 127 | { |
| 125 | printf( "ERROR\tNon-library file %s was opened via WINAPI\n", nonlibraryfile ); | 128 | printf( "ERROR\tNon-library file %s was opened via WINAPI\n", nonlibraryfile ); |
| @@ -189,8 +192,10 @@ int main() | |||
| 189 | else | 192 | else |
| 190 | printf( "SUCCESS\tCould not open file with too long file name: %s\n", error ); | 193 | printf( "SUCCESS\tCould not open file with too long file name: %s\n", error ); |
| 191 | 194 | ||
| 195 | uMode = SetErrorMode( SEM_FAILCRITICALERRORS ); | ||
| 192 | library3 = LoadLibraryA( toolongfile ); | 196 | library3 = LoadLibraryA( toolongfile ); |
| 193 | code = GetLastError( ); | 197 | code = GetLastError( ); |
| 198 | SetErrorMode( uMode ); | ||
| 194 | if( library3 ) | 199 | if( library3 ) |
| 195 | { | 200 | { |
| 196 | printf( "ERROR\tFile with too long file name was opened via WINAPI\n" ); | 201 | printf( "ERROR\tFile with too long file name was opened via WINAPI\n" ); |
| @@ -526,7 +531,9 @@ int main() | |||
| 526 | printf("SUCCESS\tGot symbol from global handle: %p\n", function); | 531 | printf("SUCCESS\tGot symbol from global handle: %p\n", function); |
| 527 | 532 | ||
| 528 | 533 | ||
| 534 | uMode = SetErrorMode( SEM_FAILCRITICALERRORS ); | ||
| 529 | library3 = LoadLibraryA("testdll3.dll"); | 535 | library3 = LoadLibraryA("testdll3.dll"); |
| 536 | SetErrorMode( uMode ); | ||
| 530 | if (!library3) | 537 | if (!library3) |
| 531 | { | 538 | { |
| 532 | printf( "ERROR\tCould not open library3 via WINAPI\n" ); | 539 | printf( "ERROR\tCould not open library3 via WINAPI\n" ); |
