Commit d4d304f4 authored by Andrey Melnikov's avatar Andrey Melnikov Committed by Alexandre Julliard

gdi32: Handle NULL filename in GetICMProfileA().

parent e5d7d69f
...@@ -116,11 +116,18 @@ BOOL WINAPI GetICMProfileA(HDC hdc, LPDWORD size, LPSTR filename) ...@@ -116,11 +116,18 @@ BOOL WINAPI GetICMProfileA(HDC hdc, LPDWORD size, LPSTR filename)
TRACE("%p, %p, %p\n", hdc, size, filename); TRACE("%p, %p, %p\n", hdc, size, filename);
if (!hdc || !size || !filename) return FALSE; if (!hdc || !size) return FALSE;
if (GetICMProfileW(hdc, &buflen, filenameW)) if (GetICMProfileW(hdc, &buflen, filenameW))
{ {
int len = WideCharToMultiByte(CP_ACP, 0, filenameW, -1, NULL, 0, NULL, NULL); int len = WideCharToMultiByte(CP_ACP, 0, filenameW, -1, NULL, 0, NULL, NULL);
if (!filename)
{
*size = len;
return FALSE;
}
if (*size >= len) if (*size >= len)
{ {
WideCharToMultiByte(CP_ACP, 0, filenameW, -1, filename, *size, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, filenameW, -1, filename, *size, NULL, NULL);
......
...@@ -55,7 +55,6 @@ static void test_GetICMProfileA( HDC dc ) ...@@ -55,7 +55,6 @@ static void test_GetICMProfileA( HDC dc )
size = 0; size = 0;
ret = GetICMProfileA( dc, &size, NULL ); ret = GetICMProfileA( dc, &size, NULL );
ok( !ret, "GetICMProfileA succeeded\n" ); ok( !ret, "GetICMProfileA succeeded\n" );
todo_wine
ok( size > 0, "got %u\n", size ); ok( size > 0, "got %u\n", size );
size = MAX_PATH; size = MAX_PATH;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment