mscms/tests: Allocate the profile buffer dynamically to make sure it's large enough.

This commit is contained in:
Alexandre Julliard 2007-08-17 11:52:29 +02:00
parent 33e1b6ffef
commit 106b900113
1 changed files with 21 additions and 9 deletions

View File

@ -760,13 +760,12 @@ static void test_GetStandardColorSpaceProfileW(void)
static void test_EnumColorProfilesA(void)
{
BOOL ret;
DWORD size, number;
DWORD total, size, number;
ENUMTYPEA record;
BYTE buffer[MAX_PATH];
BYTE *buffer;
/* Parameter checks */
size = sizeof(buffer);
memset( &record, 0, sizeof(ENUMTYPEA) );
record.dwSize = sizeof(ENUMTYPEA);
@ -774,6 +773,12 @@ static void test_EnumColorProfilesA(void)
record.dwFields |= ET_DATACOLORSPACE;
record.dwDataColorSpace = SPACE_RGB;
total = 0;
ret = pEnumColorProfilesA( NULL, &record, NULL, &total, &number );
ok( !ret, "EnumColorProfilesA() failed (%d)\n", GetLastError() );
buffer = HeapAlloc( GetProcessHeap(), 0, total );
size = total;
ret = pEnumColorProfilesA( machine, &record, buffer, &size, &number );
ok( !ret, "EnumColorProfilesA() succeeded (%d)\n", GetLastError() );
@ -798,23 +803,23 @@ static void test_EnumColorProfilesA(void)
if (standardprofile)
{
size = sizeof(buffer);
size = total;
ret = pEnumColorProfilesA( NULL, &record, buffer, &size, &number );
ok( ret, "EnumColorProfilesA() failed (%d)\n", GetLastError() );
}
HeapFree( GetProcessHeap(), 0, buffer );
}
static void test_EnumColorProfilesW(void)
{
BOOL ret;
DWORD size, number;
DWORD total, size, number;
ENUMTYPEW record;
BYTE buffer[MAX_PATH * sizeof(WCHAR)];
BYTE *buffer;
/* Parameter checks */
size = sizeof(buffer);
memset( &record, 0, sizeof(ENUMTYPEW) );
record.dwSize = sizeof(ENUMTYPEW);
@ -822,6 +827,12 @@ static void test_EnumColorProfilesW(void)
record.dwFields |= ET_DATACOLORSPACE;
record.dwDataColorSpace = SPACE_RGB;
total = 0;
ret = pEnumColorProfilesW( NULL, &record, NULL, &total, &number );
ok( !ret, "EnumColorProfilesW() failed (%d)\n", GetLastError() );
buffer = HeapAlloc( GetProcessHeap(), 0, total * sizeof(WCHAR) );
size = total;
ret = pEnumColorProfilesW( machineW, &record, buffer, &size, &number );
ok( !ret, "EnumColorProfilesW() succeeded (%d)\n", GetLastError() );
@ -833,7 +844,7 @@ static void test_EnumColorProfilesW(void)
if (standardprofileW)
{
ret = pEnumColorProfilesW( NULL, &record, buffer, &size, NULL );
ret = pEnumColorProfilesW( NULL, &record, buffer, &size, &number );
ok( ret, "EnumColorProfilesW() failed (%d)\n", GetLastError() );
}
@ -846,11 +857,12 @@ static void test_EnumColorProfilesW(void)
if (standardprofileW)
{
size = sizeof(buffer);
size = total;
ret = pEnumColorProfilesW( NULL, &record, buffer, &size, &number );
ok( ret, "EnumColorProfilesW() failed (%d)\n", GetLastError() );
}
HeapFree( GetProcessHeap(), 0, buffer );
}
static void test_InstallColorProfileA(void)