server: allow OpenClipboard to succeed when already open
Eric Frias
efrias at syncad.com
Tue Feb 7 10:57:42 CST 2006
When OpenClipboard is called twice in a row with the same HWND as a
parameter, wine lets the first call succeed, but the second call fails
because the clipboard was already locked. Although it's not specified
in the docs, Windows allows the second call to succeed (and something
deep inside of our app depends on this). I think I submitted a version
of this patch a year or two back, but it wasn't accepted.
Diff to server/clipboard.c
--- clipboard.c (.../vendor/wine/current/server/clipboard.c)
(revision 31964)
+++ clipboard.c (.../trunk/wine/server/clipboard.c) (revision 31964)
@@ -193,7 +193,8 @@
if (clipboard->open_thread)
{
/* clipboard already opened */
- set_error(STATUS_WAS_LOCKED);
+ if (clipboard->open_win != req->clipboard)
+ set_error(STATUS_WAS_LOCKED);
return;
}
Diff to dlls/user/tests/clipboard.c, this passes on Win2k, fails on
stock wine, passes on wine with the above patch.
--- clipboard.c.orig 2006-02-07 10:23:47.381076800 -0500
+++ clipboard.c 2006-02-07 10:23:27.950611200 -0500
@@ -64,6 +64,7 @@
ok( ret, "CloseClipboard error %ld\n", GetLastError());
ok(OpenClipboard(hWnd1), "OpenClipboard failed\n");
+ ok(OpenClipboard(hWnd1), "OpenClipboard failed to reopen for the
same window\n");
SetLastError(0xdeadbeef);
ok(!OpenClipboard(hWnd2) && GetLastError() == 0xdeadbeef,
More information about the wine-patches
mailing list