user32: Call GlobalUnlock with the correct argument in SetClipboardData.

Sebastian Lackner sebastian at fds-team.de
Tue Sep 27 12:01:48 CDT 2016


Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
---

Unfortunately GlobalUnlock sets the last error to 0, so we have to store the status.

 dlls/user32/clipboard.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/dlls/user32/clipboard.c b/dlls/user32/clipboard.c
index 9d80813..04d062d 100644
--- a/dlls/user32/clipboard.c
+++ b/dlls/user32/clipboard.c
@@ -868,7 +868,7 @@ HANDLE WINAPI SetClipboardData( UINT format, HANDLE data )
     void *ptr = NULL;
     data_size_t size = 0;
     HANDLE handle = data, retval = 0;
-    BOOL ret;
+    NTSTATUS status = STATUS_SUCCESS;
 
     TRACE( "%s %p\n", debugstr_format( format ), data );
 
@@ -888,14 +888,14 @@ HANDLE WINAPI SetClipboardData( UINT format, HANDLE data )
         req->format = format;
         req->lcid = GetUserDefaultLCID();
         wine_server_add_data( req, ptr, size );
-        if ((ret = !wine_server_call_err( req )))
+        if (!(status = wine_server_call( req )))
         {
             if (cache) cache->seqno = reply->seqno;
         }
     }
     SERVER_END_REQ;
 
-    if (ret)
+    if (!status)
     {
         /* free the previous entry if any */
         struct cached_format *prev;
@@ -909,8 +909,9 @@ HANDLE WINAPI SetClipboardData( UINT format, HANDLE data )
     LeaveCriticalSection( &clipboard_cs );
 
 done:
-    if (ptr) GlobalUnlock( ptr );
+    if (ptr) GlobalUnlock( handle );
     if (handle != data) GlobalFree( handle );
+    if (status) SetLastError( RtlNtStatusToDosError( status ));
     return retval;
 }
 
-- 
2.9.0



More information about the wine-patches mailing list