user32: Fix GetClipboardFormatName behavior for integer formats.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2016-09-14 14:20:31 +09:00
parent 30179166d2
commit 4bdcf512cf
2 changed files with 8 additions and 8 deletions

View File

@ -456,20 +456,20 @@ UINT WINAPI RegisterClipboardFormatA( LPCSTR name )
/**************************************************************************
* GetClipboardFormatNameW (USER32.@)
*/
INT WINAPI GetClipboardFormatNameW(UINT wFormat, LPWSTR retStr, INT maxlen)
INT WINAPI GetClipboardFormatNameW( UINT format, LPWSTR buffer, INT maxlen )
{
if (wFormat < MAXINTATOM) return 0;
return GlobalGetAtomNameW( wFormat, retStr, maxlen );
if (format < MAXINTATOM || format > 0xffff) return 0;
return GlobalGetAtomNameW( format, buffer, maxlen );
}
/**************************************************************************
* GetClipboardFormatNameA (USER32.@)
*/
INT WINAPI GetClipboardFormatNameA(UINT wFormat, LPSTR retStr, INT maxlen)
INT WINAPI GetClipboardFormatNameA( UINT format, LPSTR buffer, INT maxlen )
{
if (wFormat < MAXINTATOM) return 0;
return GlobalGetAtomNameA( wFormat, retStr, maxlen );
if (format < MAXINTATOM || format > 0xffff) return 0;
return GlobalGetAtomNameA( format, buffer, maxlen );
}

View File

@ -416,12 +416,12 @@ todo_wine
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "err %d\n", GetLastError());
}
for (format_id = 0; format_id < 0xffff; format_id++)
for (format_id = 0; format_id < 0x10fff; format_id++)
{
SetLastError(0xdeadbeef);
len = GetClipboardFormatNameA(format_id, buf, 256);
if (format_id < 0xc000)
if (format_id < 0xc000 || format_id > 0xffff)
ok(!len, "GetClipboardFormatNameA should fail, but it returned %d (%s)\n", len, buf);
else if (len && winetest_debug > 1)
trace("%04x: %s\n", format_id, len ? buf : "");