Alexandre Julliard : Revert "user32: Moved some 16-bit functions."

Alexandre Julliard julliard at winehq.org
Mon Dec 17 06:42:04 CST 2007


Module: wine
Branch: master
Commit: 61bace5ba98cdb1178e713a8a3e9a2c169089c8b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=61bace5ba98cdb1178e713a8a3e9a2c169089c8b

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Dec 17 11:56:05 2007 +0100

Revert "user32: Moved some 16-bit functions."

This partially reverts commit 6e9fea22f82fe60624e1081d74ad990a5c428eed.
16-bit and 32-bit clipboard handles aren't interchangeable.

---

 dlls/user32/clipboard.c |   51 +++++++++++++++++++++++++++++++++++++++++++++++
 dlls/user32/user16.c    |   18 ----------------
 2 files changed, 51 insertions(+), 18 deletions(-)

diff --git a/dlls/user32/clipboard.c b/dlls/user32/clipboard.c
index 59d93ab..137ace9 100644
--- a/dlls/user32/clipboard.c
+++ b/dlls/user32/clipboard.c
@@ -486,6 +486,35 @@ BOOL WINAPI ChangeClipboardChain(HWND hWnd, HWND hWndNext)
 
 
 /**************************************************************************
+ *		SetClipboardData (USER.141)
+ */
+HANDLE16 WINAPI SetClipboardData16(UINT16 wFormat, HANDLE16 hData)
+{
+    CLIPBOARDINFO cbinfo;
+    HANDLE16 hResult = 0;
+
+    TRACE("(%04X, %04x) !\n", wFormat, hData);
+
+    /* If it's not owned, data can only be set if the format doesn't exists
+       and its rendering is not delayed */
+    if (!CLIPBOARD_GetClipboardInfo(&cbinfo) ||
+        (!(cbinfo.flags & CB_OWNER) && !hData))
+    {
+        WARN("Clipboard not owned by calling task. Operation failed.\n");
+        return 0;
+    }
+
+    if (USER_Driver->pSetClipboardData(wFormat, hData, 0, cbinfo.flags & CB_OWNER))
+    {
+        hResult = hData;
+        bCBHasChanged = TRUE;
+    }
+
+    return hResult;
+}
+
+
+/**************************************************************************
  *		SetClipboardData (USER32.@)
  */
 HANDLE WINAPI SetClipboardData(UINT wFormat, HANDLE hData)
@@ -557,6 +586,28 @@ BOOL WINAPI IsClipboardFormatAvailable(UINT wFormat)
 
 
 /**************************************************************************
+ *		GetClipboardData (USER.142)
+ */
+HANDLE16 WINAPI GetClipboardData16(UINT16 wFormat)
+{
+    HANDLE16 hData = 0;
+    CLIPBOARDINFO cbinfo;
+
+    if (!CLIPBOARD_GetClipboardInfo(&cbinfo) ||
+        (~cbinfo.flags & CB_OPEN))
+    {
+        WARN("Clipboard not opened by calling task.\n");
+        SetLastError(ERROR_CLIPBOARD_NOT_OPEN);
+        return 0;
+    }
+
+    if (!USER_Driver->pGetClipboardData(wFormat, &hData, NULL)) hData = 0;
+
+    return hData;
+}
+
+
+/**************************************************************************
  *		GetClipboardData (USER32.@)
  */
 HANDLE WINAPI GetClipboardData(UINT wFormat)
diff --git a/dlls/user32/user16.c b/dlls/user32/user16.c
index b8951f2..b55c8ed 100644
--- a/dlls/user32/user16.c
+++ b/dlls/user32/user16.c
@@ -447,24 +447,6 @@ BOOL16 WINAPI EmptyClipboard16(void)
 
 
 /**************************************************************************
- *		SetClipboardData (USER.141)
- */
-HANDLE16 WINAPI SetClipboardData16(UINT16 wFormat, HANDLE16 hData)
-{
-    return HANDLE_16(SetClipboardData(wFormat, HANDLE_32(hData)));
-}
-
-
-/**************************************************************************
- *		GetClipboardData (USER.142)
- */
-HANDLE16 WINAPI GetClipboardData16(UINT16 wFormat)
-{
-    return HANDLE_16(GetClipboardData(wFormat));
-}
-
-
-/**************************************************************************
  *		CountClipboardFormats (USER.143)
  */
 INT16 WINAPI CountClipboardFormats16(void)




More information about the wine-cvs mailing list