Patch for OLEClipbrd_IDataObject_GetData

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Changelog:
Must make a copy of global handle returned by GetClipboardData; it is not valid after we call CloseClipboard
Application is responsible for freeing the memory  (fixes copy/paste in mail body in Forte Agent)


Index: clipboard.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/clipboard.c,v
retrieving revision 1.19
diff -u -r1.19 clipboard.c
--- clipboard.c	2001/07/29 20:19:51	1.19
+++ clipboard.c	2002/02/15 11:44:20
@@ -1200,6 +1200,7 @@
   HANDLE      hData = 0;
   BOOL bClipboardOpen = FALSE;
   HRESULT hr = S_OK;
+  LPVOID src;
 
   /*
    * Declare "This" pointer 
@@ -1238,6 +1239,25 @@
     HANDLE_ERROR( CLIPBRD_E_CANT_OPEN );
 
   hData = GetClipboardData(pformatetcIn->cfFormat);
+
+  /* Must make a copy of global handle returned by GetClipboardData; it
+   * is not valid after we call CloseClipboard
+   * Application is responsible for freeing the memory (Forte Agent does this)
+   */
+  src = GlobalLock(hData);
+  if(src) {
+      LPVOID dest;
+      ULONG  size;
+      HANDLE hDest;
+
+      size = GlobalSize(hData);
+      hDest = GlobalAlloc(GHND, size);
+      dest  = GlobalLock(hDest);
+      memcpy(dest, src, size);
+      GlobalUnlock(hDest);
+      GlobalUnlock(hData);
+      hData = hDest;
+  }
 
   /* 
    * Return the clipboard data in the storage medium structure





[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux