Turn off GUI error messages around LoadLibraryA also in test Otherwise running test show GUI error messages which needs to be closed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
diff --git a/test.c b/test.c
index 0070f8c..0d07f12 100644
--- a/test.c
+++ b/test.c
@@ -88,6 +88,7 @@ int main()
char nonlibraryfile[MAX_PATH];
HANDLE tempfile;
DWORD dummy;
+ UINT uMode;
#ifdef _DEBUG
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
@@ -118,8 +119,10 @@ int main()
CloseHandle( tempfile );
+ uMode = SetErrorMode( SEM_FAILCRITICALERRORS );
library3 = LoadLibraryA( nonlibraryfile );
code = GetLastError( );
+ SetErrorMode( uMode );
if( library3 )
{
printf( "ERROR\tNon-library file %s was opened via WINAPI\n", nonlibraryfile );
@@ -189,8 +192,10 @@ int main()
else
printf( "SUCCESS\tCould not open file with too long file name: %s\n", error );
+ uMode = SetErrorMode( SEM_FAILCRITICALERRORS );
library3 = LoadLibraryA( toolongfile );
code = GetLastError( );
+ SetErrorMode( uMode );
if( library3 )
{
printf( "ERROR\tFile with too long file name was opened via WINAPI\n" );
@@ -526,7 +531,9 @@ int main()
printf("SUCCESS\tGot symbol from global handle: %p\n", function);
+ uMode = SetErrorMode( SEM_FAILCRITICALERRORS );
library3 = LoadLibraryA("testdll3.dll");
+ SetErrorMode( uMode );
if (!library3)
{
printf( "ERROR\tCould not open library3 via WINAPI\n" );