gdi32: Handle NULL filename in GetICMProfileA().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Andrey Melnikov <temnota.am@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Andrey Melnikov 2015-12-21 12:22:41 +03:00 committed by Alexandre Julliard
parent e5d7d69f72
commit d4d304f436
2 changed files with 8 additions and 2 deletions

View File

@ -116,11 +116,18 @@ BOOL WINAPI GetICMProfileA(HDC hdc, LPDWORD size, LPSTR 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))
{
int len = WideCharToMultiByte(CP_ACP, 0, filenameW, -1, NULL, 0, NULL, NULL);
if (!filename)
{
*size = len;
return FALSE;
}
if (*size >= len)
{
WideCharToMultiByte(CP_ACP, 0, filenameW, -1, filename, *size, NULL, NULL);

View File

@ -55,7 +55,6 @@ static void test_GetICMProfileA( HDC dc )
size = 0;
ret = GetICMProfileA( dc, &size, NULL );
ok( !ret, "GetICMProfileA succeeded\n" );
todo_wine
ok( size > 0, "got %u\n", size );
size = MAX_PATH;