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).
This commit is contained in:
Sander van Leeuwen 2002-02-19 18:22:28 +00:00 committed by Alexandre Julliard
parent fed8f1cbf2
commit 3ad8d3f0d0

View File

@ -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
*/