Commit e7ffa2ae authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

ole32: Don't allocate the ole clipboard object in global memory - we're not…

ole32: Don't allocate the ole clipboard object in global memory - we're not going to directly expose it to other processes.
parent e6eeb3aa
...@@ -108,16 +108,6 @@ struct OLEClipbrd ...@@ -108,16 +108,6 @@ struct OLEClipbrd
IDataObject* pIDataObjectSrc; IDataObject* pIDataObjectSrc;
/* /*
* The registered DataObject clipboard format
*/
UINT cfDataObj;
/*
* The handle to ourself
*/
HGLOBAL hSelf;
/*
* Reference count of this object * Reference count of this object
*/ */
LONG ref; LONG ref;
...@@ -647,68 +637,33 @@ void OLEClipbrd_UnInitialize(void) ...@@ -647,68 +637,33 @@ void OLEClipbrd_UnInitialize(void)
*/ */
static OLEClipbrd* OLEClipbrd_Construct(void) static OLEClipbrd* OLEClipbrd_Construct(void)
{ {
OLEClipbrd* newObject = NULL; OLEClipbrd* This;
HGLOBAL hNewObject = 0;
/*
* Allocate space for the object. We use GlobalAlloc since we need
* an HGLOBAL to expose our DataObject as a registered clipboard type.
*/
hNewObject = GlobalAlloc( GMEM_DDESHARE|GMEM_MOVEABLE|GMEM_ZEROINIT,
sizeof(OLEClipbrd));
if (hNewObject==0)
return NULL;
/*
* Lock the handle for the entire lifetime of the clipboard.
*/
newObject = GlobalLock(hNewObject);
/*
* Initialize the virtual function table.
*/
newObject->lpvtbl1 = &OLEClipbrd_IDataObject_VTable;
/* This = HeapAlloc( GetProcessHeap(), 0, sizeof(*This) );
* Start with one reference count. The caller of this function if (!This) return NULL;
* must release the interface pointer when it is done.
*/
newObject->ref = 1;
newObject->hSelf = hNewObject; This->lpvtbl1 = &OLEClipbrd_IDataObject_VTable;
This->ref = 1;
/* This->hWndClipboard = NULL;
* The Ole clipboard is a singleton - save the global handle and pointer This->pIDataObjectSrc = NULL;
*/
theOleClipboard = newObject;
return theOleClipboard; theOleClipboard = This;
return This;
} }
static void OLEClipbrd_Destroy(OLEClipbrd* ptrToDestroy) static void OLEClipbrd_Destroy(OLEClipbrd* This)
{ {
TRACE("()\n"); TRACE("()\n");
if ( !ptrToDestroy ) if (!This) return;
return;
/* theOleClipboard = NULL;
* Destroy the Ole clipboard window
*/
if ( ptrToDestroy->hWndClipboard )
OLEClipbrd_DestroyWindow(ptrToDestroy->hWndClipboard);
/* if ( This->hWndClipboard )
* Free the actual OLE Clipboard structure. OLEClipbrd_DestroyWindow(This->hWndClipboard);
*/
TRACE("() - Destroying clipboard data object.\n");
GlobalUnlock(ptrToDestroy->hSelf);
GlobalFree(ptrToDestroy->hSelf);
/* HeapFree(GetProcessHeap(), 0, This);
* The Ole clipboard is a singleton (ptrToDestroy == theOleClipboard)
*/
theOleClipboard = NULL;
} }
......
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