gdi32/tests: Prevent a crash on win95.

This commit is contained in:
Paul Vriens 2008-09-10 17:47:49 +02:00 committed by Alexandre Julliard
parent 631f751fe1
commit c50d922ef6
1 changed files with 12 additions and 4 deletions

View File

@ -51,20 +51,28 @@ static void test_GetICMProfileA( HDC dc )
ret = GetICMProfileA( dc, &size, NULL );
ok( !ret, "GetICMProfileA succeeded\n" );
ret = GetICMProfileA( dc, NULL, filename );
ok( !ret, "GetICMProfileA succeeded\n" );
size = MAX_PATH;
ret = GetICMProfileA( NULL, &size, filename );
ok( !ret, "GetICMProfileA succeeded\n" );
size = 0;
filename[0] = 0;
SetLastError(0xdeadbeef);
ret = GetICMProfileA( dc, &size, filename );
error = GetLastError();
ok( !ret, "GetICMProfileA succeeded\n" );
ok( size, "expected size > 0\n" );
ok( error == ERROR_INSUFFICIENT_BUFFER, "got %d, expected ERROR_INSUFFICIENT_BUFFER\n", error );
ok( filename[0] == 0, "Expected filename to be empty\n" );
ok( error == ERROR_INSUFFICIENT_BUFFER ||
error == ERROR_SUCCESS, /* Win95 */
"got %d, expected ERROR_INSUFFICIENT_BUFFER or ERROR_SUCCESS(Win95)\n", error );
/* Next test will crash on Win95 */
if ( error == ERROR_INSUFFICIENT_BUFFER )
{
ret = GetICMProfileA( dc, NULL, filename );
ok( !ret, "GetICMProfileA succeeded\n" );
}
size = MAX_PATH;
ret = GetICMProfileA( dc, &size, filename );