Commit 3ad8d3f0 authored by Sander van Leeuwen's avatar Sander van Leeuwen Committed by Alexandre Julliard

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).
parent fed8f1cb
......@@ -1200,6 +1200,7 @@ static HRESULT WINAPI OLEClipbrd_IDataObject_GetData(
HANDLE hData = 0;
BOOL bClipboardOpen = FALSE;
HRESULT hr = S_OK;
LPVOID src;
/*
* Declare "This" pointer
......@@ -1239,6 +1240,25 @@ static HRESULT WINAPI OLEClipbrd_IDataObject_GetData(
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
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment