mirror of
https://github.com/reactos/wine.git
synced 2024-11-28 14:10:32 +00:00
mscms: GetColorDirectory: fixed incorrect A -> W conversions.
This commit is contained in:
parent
f2ee10aed7
commit
4b88fd842a
@ -91,14 +91,13 @@ BOOL WINAPI GetColorDirectoryA( PCSTR machine, PSTR buffer, PDWORD size )
|
||||
|
||||
if (bufferW)
|
||||
{
|
||||
ret = GetColorDirectoryW( NULL, bufferW, &sizeW );
|
||||
*size = WideCharToMultiByte( CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL );
|
||||
|
||||
if (ret)
|
||||
if ((ret = GetColorDirectoryW( NULL, bufferW, &sizeW )))
|
||||
{
|
||||
len = WideCharToMultiByte( CP_ACP, 0, bufferW, *size, buffer, *size, NULL, NULL );
|
||||
*size = WideCharToMultiByte( CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL );
|
||||
len = WideCharToMultiByte( CP_ACP, 0, bufferW, -1, buffer, *size, NULL, NULL );
|
||||
if (!len) ret = FALSE;
|
||||
}
|
||||
else *size = sizeW / sizeof(WCHAR);
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, bufferW );
|
||||
}
|
||||
@ -132,13 +131,14 @@ BOOL WINAPI GetColorDirectoryW( PCWSTR machine, PWSTR buffer, PDWORD size )
|
||||
|
||||
len = lstrlenW( colordir ) * sizeof(WCHAR);
|
||||
|
||||
if (len <= *size && buffer)
|
||||
if (buffer && len <= *size)
|
||||
{
|
||||
lstrcpyW( buffer, colordir );
|
||||
*size = len;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
SetLastError( ERROR_MORE_DATA );
|
||||
*size = len;
|
||||
return FALSE;
|
||||
}
|
||||
@ -389,14 +389,13 @@ BOOL WINAPI GetStandardColorSpaceProfileA( PCSTR machine, DWORD id, PSTR profile
|
||||
|
||||
if (profileW)
|
||||
{
|
||||
ret = GetStandardColorSpaceProfileW( NULL, id, profileW, &sizeW );
|
||||
*size = WideCharToMultiByte( CP_ACP, 0, profileW, -1, NULL, 0, NULL, NULL );
|
||||
|
||||
if (ret)
|
||||
if ((ret = GetStandardColorSpaceProfileW( NULL, id, profileW, &sizeW )))
|
||||
{
|
||||
len = WideCharToMultiByte( CP_ACP, 0, profileW, *size, profile, *size, NULL, NULL );
|
||||
*size = WideCharToMultiByte( CP_ACP, 0, profileW, -1, NULL, 0, NULL, NULL );
|
||||
len = WideCharToMultiByte( CP_ACP, 0, profileW, -1, profile, *size, NULL, NULL );
|
||||
if (!len) ret = FALSE;
|
||||
}
|
||||
else *size = sizeW / sizeof(WCHAR);
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, profileW );
|
||||
}
|
||||
@ -451,20 +450,22 @@ BOOL WINAPI GetStandardColorSpaceProfileW( PCWSTR machine, DWORD id, PWSTR profi
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case 0x52474220: /* 'RGB ' */
|
||||
case SPACE_RGB: /* 'RGB ' */
|
||||
lstrcatW( rgbprofile, rgbprofilefile );
|
||||
len = lstrlenW( rgbprofile ) * sizeof(WCHAR);
|
||||
|
||||
if (*size < len || !profile)
|
||||
{
|
||||
*size = len;
|
||||
return TRUE;
|
||||
SetLastError( ERROR_MORE_DATA );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
lstrcpyW( profile, rgbprofile );
|
||||
break;
|
||||
|
||||
default:
|
||||
SetLastError( ERROR_FILE_NOT_FOUND );
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -597,7 +597,6 @@ static void test_GetStandardColorSpaceProfileA(void)
|
||||
|
||||
SetLastError(0xfaceabee); /* 2nd param, */
|
||||
ret = pGetStandardColorSpaceProfileA(NULL, (DWORD)-1, newprofile, &sizeP);
|
||||
todo_wine
|
||||
ok( !ret && GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileA() returns %d (GLE=%d)\n", ret, GetLastError() );
|
||||
|
||||
SetLastError(0xfaceabee); /* 4th param, */
|
||||
@ -612,17 +611,14 @@ static void test_GetStandardColorSpaceProfileA(void)
|
||||
|
||||
SetLastError(0xfaceabee); /* dereferenced 4th param, */
|
||||
ret = pGetStandardColorSpaceProfileA(NULL, SPACE_RGB, newprofile, &zero);
|
||||
todo_wine
|
||||
ok( !ret && (GetLastError() == ERROR_MORE_DATA || GetLastError() == ERROR_INSUFFICIENT_BUFFER), "GetStandardColorSpaceProfileA() returns %d (GLE=%d)\n", ret, GetLastError() );
|
||||
} else {
|
||||
SetLastError(0xfaceabee); /* 3rd param, */
|
||||
ret = pGetStandardColorSpaceProfileA(NULL, SPACE_RGB, NULL, &sizeP);
|
||||
todo_wine
|
||||
ok( !ret && GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileA() returns %d (GLE=%d)\n", ret, GetLastError() );
|
||||
|
||||
SetLastError(0xfaceabee); /* dereferenced 4th param. */
|
||||
ret = pGetStandardColorSpaceProfileA(NULL, SPACE_RGB, newprofile, &sizeP);
|
||||
todo_wine
|
||||
ok( !ret && GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileA() returns %d (GLE=%d)\n", ret, GetLastError() );
|
||||
}
|
||||
|
||||
@ -642,7 +638,7 @@ static void test_GetStandardColorSpaceProfileA(void)
|
||||
|
||||
SetLastError(0xfaceabee); /* maybe 2nd param. */
|
||||
ret = pGetStandardColorSpaceProfileA(NULL, 0, newprofile, &sizeP);
|
||||
if (!ret) todo_wine ok( GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileA() returns %d (GLE=%d)\n", ret, GetLastError() );
|
||||
if (!ret) ok( GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileA() returns %d (GLE=%d)\n", ret, GetLastError() );
|
||||
else ok( !lstrcmpiA( newprofile, emptyA ) && GetLastError() == 0xfaceabee, "GetStandardColorSpaceProfileA() returns %d (GLE=%d)\n", ret, GetLastError() );
|
||||
|
||||
/* Functional checks */
|
||||
@ -689,7 +685,6 @@ static void test_GetStandardColorSpaceProfileW(void)
|
||||
|
||||
SetLastError(0xfaceabee); /* 2nd param, */
|
||||
ret = pGetStandardColorSpaceProfileW(NULL, (DWORD)-1, newprofile, &sizeP);
|
||||
todo_wine
|
||||
ok( !ret && GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileW() returns %d (GLE=%d)\n", ret, GetLastError() );
|
||||
|
||||
SetLastError(0xfaceabee); /* 3th param, */
|
||||
@ -702,7 +697,6 @@ static void test_GetStandardColorSpaceProfileW(void)
|
||||
|
||||
SetLastError(0xfaceabee); /* dereferenced 4th param. */
|
||||
ret = pGetStandardColorSpaceProfileW(NULL, SPACE_RGB, newprofile, &zero);
|
||||
todo_wine
|
||||
ok( !ret && (GetLastError() == ERROR_MORE_DATA || GetLastError() == ERROR_INSUFFICIENT_BUFFER), "GetStandardColorSpaceProfileW() returns %d (GLE=%d)\n", ret, GetLastError() );
|
||||
|
||||
/* Several invalid parameter checks: */
|
||||
@ -721,7 +715,7 @@ static void test_GetStandardColorSpaceProfileW(void)
|
||||
|
||||
SetLastError(0xfaceabee); /* maybe 2nd param. */
|
||||
ret = pGetStandardColorSpaceProfileW(NULL, 0, newprofile, &sizeP);
|
||||
if (!ret) todo_wine ok( GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileW() returns %d (GLE=%d)\n", ret, GetLastError() );
|
||||
if (!ret) ok( GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileW() returns %d (GLE=%d)\n", ret, GetLastError() );
|
||||
else ok( !lstrcmpiW( newprofile, emptyW ) && GetLastError() == 0xfaceabee, "GetStandardColorSpaceProfileW() returns %d (GLE=%d)\n", ret, GetLastError() );
|
||||
|
||||
/* Functional checks */
|
||||
|
Loading…
Reference in New Issue
Block a user