Alexandre Julliard : user32: Fix GetClipboardFormatName behavior for integer formats.
Alexandre Julliard
julliard at winehq.org
Wed Sep 14 10:28:51 CDT 2016
Module: wine
Branch: master
Commit: 4bdcf512cf5c93ec4833ed772cfe87770ef970e6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4bdcf512cf5c93ec4833ed772cfe87770ef970e6
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Sep 14 14:20:31 2016 +0900
user32: Fix GetClipboardFormatName behavior for integer formats.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/clipboard.c | 12 ++++++------
dlls/user32/tests/clipboard.c | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/dlls/user32/clipboard.c b/dlls/user32/clipboard.c
index 326ea03..d8fb68d 100644
--- a/dlls/user32/clipboard.c
+++ b/dlls/user32/clipboard.c
@@ -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 );
}
diff --git a/dlls/user32/tests/clipboard.c b/dlls/user32/tests/clipboard.c
index ff5b6fb..61b0d2c 100644
--- a/dlls/user32/tests/clipboard.c
+++ b/dlls/user32/tests/clipboard.c
@@ -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 : "");
More information about the wine-cvs
mailing list