From 07478c2e3ef7a16732d2c5911e377999e77b538c Mon Sep 17 00:00:00 2001 From: Francis Beaudet Date: Sun, 28 Feb 1999 09:57:40 +0000 Subject: [PATCH] Implemented the CoTaskMemRealloc API. Also clean-up around that API call. --- ole/compobj.c | 29 +++++++++++++++++++++++++---- relay32/ole32.spec | 2 +- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/ole/compobj.c b/ole/compobj.c index 0c8d340f7ad..57b40d2e6ad 100644 --- a/ole/compobj.c +++ b/ole/compobj.c @@ -1407,9 +1407,10 @@ LPVOID WINAPI CoTaskMemAlloc( LPMALLOC lpmalloc; HRESULT ret = CoGetMalloc(0,&lpmalloc); - if (ret) + if (FAILED(ret)) return NULL; - return lpmalloc->lpvtbl->fnAlloc(lpmalloc,size); + + return IMalloc_Alloc(lpmalloc,size); } /*********************************************************************** @@ -1421,8 +1422,28 @@ VOID WINAPI CoTaskMemFree( LPMALLOC lpmalloc; HRESULT ret = CoGetMalloc(0,&lpmalloc); - if (ret) return; - lpmalloc->lpvtbl->fnFree(lpmalloc,ptr); + if (FAILED(ret)) + return; + + IMalloc_Free(lpmalloc, ptr); +} + +/*********************************************************************** + * CoTaskMemRealloc (OLE32.45) + * RETURNS + * pointer to newly allocated block + */ +LPVOID WINAPI CoTaskMemRealloc( + LPVOID pvOld, + ULONG size) /* [in] size of memoryblock to be allocated */ +{ + LPMALLOC lpmalloc; + HRESULT ret = CoGetMalloc(0,&lpmalloc); + + if (FAILED(ret)) + return NULL; + + return IMalloc_Realloc(lpmalloc, pvOld, size); } /*********************************************************************** diff --git a/relay32/ole32.spec b/relay32/ole32.spec index 6a251fa2cd0..e5a4f35a203 100644 --- a/relay32/ole32.spec +++ b/relay32/ole32.spec @@ -45,7 +45,7 @@ type win32 42 stdcall CoSetState(ptr) CoSetState 43 stdcall CoTaskMemAlloc(long) CoTaskMemAlloc 44 stdcall CoTaskMemFree(ptr) CoTaskMemFree - 45 stub CoTaskMemRealloc # stdcall (ptr long) return 0,ERR_NOTIMPLEMENTED + 45 stdcall CoTaskMemRealloc(ptr long) CoTaskMemRealloc 46 stub CoTreatAsClass # stdcall (ptr ptr) return 0,ERR_NOTIMPLEMENTED 47 stdcall CoUninitialize() CoUninitialize 48 stub CoUnloadingWOW