Implemented the CoTaskMemRealloc API. Also clean-up around that API

call.
This commit is contained in:
Francis Beaudet 1999-02-28 09:57:40 +00:00 committed by Alexandre Julliard
parent b67b8e7a84
commit 07478c2e3e
2 changed files with 26 additions and 5 deletions

View File

@ -1407,9 +1407,10 @@ LPVOID WINAPI CoTaskMemAlloc(
LPMALLOC lpmalloc; LPMALLOC lpmalloc;
HRESULT ret = CoGetMalloc(0,&lpmalloc); HRESULT ret = CoGetMalloc(0,&lpmalloc);
if (ret) if (FAILED(ret))
return NULL; return NULL;
return lpmalloc->lpvtbl->fnAlloc(lpmalloc,size);
return IMalloc_Alloc(lpmalloc,size);
} }
/*********************************************************************** /***********************************************************************
@ -1421,8 +1422,28 @@ VOID WINAPI CoTaskMemFree(
LPMALLOC lpmalloc; LPMALLOC lpmalloc;
HRESULT ret = CoGetMalloc(0,&lpmalloc); HRESULT ret = CoGetMalloc(0,&lpmalloc);
if (ret) return; if (FAILED(ret))
lpmalloc->lpvtbl->fnFree(lpmalloc,ptr); 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);
} }
/*********************************************************************** /***********************************************************************

View File

@ -45,7 +45,7 @@ type win32
42 stdcall CoSetState(ptr) CoSetState 42 stdcall CoSetState(ptr) CoSetState
43 stdcall CoTaskMemAlloc(long) CoTaskMemAlloc 43 stdcall CoTaskMemAlloc(long) CoTaskMemAlloc
44 stdcall CoTaskMemFree(ptr) CoTaskMemFree 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 46 stub CoTreatAsClass # stdcall (ptr ptr) return 0,ERR_NOTIMPLEMENTED
47 stdcall CoUninitialize() CoUninitialize 47 stdcall CoUninitialize() CoUninitialize
48 stub CoUnloadingWOW 48 stub CoUnloadingWOW