mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 18:13:03 +00:00
[OLE32]
- Apply Wine commit 110665a3 (ole32: Don't call spy on IMalloc::Free(NULL)) by Nikolay Sivov. Fixes test failures in atl:CComHeapPtr CORE-11107 #resolve svn path=/trunk/; revision=71119
This commit is contained in:
parent
a59f1989c5
commit
acfe26b095
2 changed files with 138 additions and 0 deletions
|
@ -241,6 +241,9 @@ static void WINAPI IMalloc_fnFree(IMalloc *iface, void *pv)
|
||||||
|
|
||||||
TRACE("(%p)\n",pv);
|
TRACE("(%p)\n",pv);
|
||||||
|
|
||||||
|
if(!pv)
|
||||||
|
return;
|
||||||
|
|
||||||
if(Malloc32.pSpy) {
|
if(Malloc32.pSpy) {
|
||||||
EnterCriticalSection(&IMalloc32_SpyCS);
|
EnterCriticalSection(&IMalloc32_SpyCS);
|
||||||
fSpyed = RemoveMemoryLocation(pv);
|
fSpyed = RemoveMemoryLocation(pv);
|
||||||
|
|
|
@ -2936,6 +2936,140 @@ static void test_CoGetApartmentType(void)
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static HRESULT WINAPI testspy_QI(IMallocSpy *iface, REFIID riid, void **obj)
|
||||||
|
{
|
||||||
|
if (IsEqualIID(riid, &IID_IMallocSpy) || IsEqualIID(riid, &IID_IUnknown))
|
||||||
|
{
|
||||||
|
*obj = iface;
|
||||||
|
IMallocSpy_AddRef(iface);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI testspy_AddRef(IMallocSpy *iface)
|
||||||
|
{
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI testspy_Release(IMallocSpy *iface)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static SIZE_T WINAPI testspy_PreAlloc(IMallocSpy *iface, SIZE_T cb)
|
||||||
|
{
|
||||||
|
ok(0, "unexpected call\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void* WINAPI testspy_PostAlloc(IMallocSpy *iface, void *ptr)
|
||||||
|
{
|
||||||
|
ok(0, "unexpected call\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void* WINAPI testspy_PreFree(IMallocSpy *iface, void *ptr, BOOL spyed)
|
||||||
|
{
|
||||||
|
ok(0, "unexpected call\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void WINAPI testspy_PostFree(IMallocSpy *iface, BOOL spyed)
|
||||||
|
{
|
||||||
|
ok(0, "unexpected call\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static SIZE_T WINAPI testspy_PreRealloc(IMallocSpy *iface, void *ptr, SIZE_T cb, void **newptr, BOOL spyed)
|
||||||
|
{
|
||||||
|
ok(0, "unexpected call\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void* WINAPI testspy_PostRealloc(IMallocSpy *iface, void *ptr, BOOL spyed)
|
||||||
|
{
|
||||||
|
ok(0, "unexpected call\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void* WINAPI testspy_PreGetSize(IMallocSpy *iface, void *ptr, BOOL spyed)
|
||||||
|
{
|
||||||
|
ok(0, "unexpected call\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static SIZE_T WINAPI testspy_PostGetSize(IMallocSpy *iface, SIZE_T actual, BOOL spyed)
|
||||||
|
{
|
||||||
|
ok(0, "unexpected call\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void* WINAPI testspy_PreDidAlloc(IMallocSpy *iface, void *ptr, BOOL spyed)
|
||||||
|
{
|
||||||
|
ok(0, "unexpected call\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int WINAPI testspy_PostDidAlloc(IMallocSpy *iface, void *ptr, BOOL spyed, int actual)
|
||||||
|
{
|
||||||
|
ok(0, "unexpected call\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void WINAPI testspy_PreHeapMinimize(IMallocSpy *iface)
|
||||||
|
{
|
||||||
|
ok(0, "unexpected call\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void WINAPI testspy_PostHeapMinimize(IMallocSpy *iface)
|
||||||
|
{
|
||||||
|
ok(0, "unexpected call\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static const IMallocSpyVtbl testspyvtbl =
|
||||||
|
{
|
||||||
|
testspy_QI,
|
||||||
|
testspy_AddRef,
|
||||||
|
testspy_Release,
|
||||||
|
testspy_PreAlloc,
|
||||||
|
testspy_PostAlloc,
|
||||||
|
testspy_PreFree,
|
||||||
|
testspy_PostFree,
|
||||||
|
testspy_PreRealloc,
|
||||||
|
testspy_PostRealloc,
|
||||||
|
testspy_PreGetSize,
|
||||||
|
testspy_PostGetSize,
|
||||||
|
testspy_PreDidAlloc,
|
||||||
|
testspy_PostDidAlloc,
|
||||||
|
testspy_PreHeapMinimize,
|
||||||
|
testspy_PostHeapMinimize
|
||||||
|
};
|
||||||
|
|
||||||
|
static IMallocSpy testspy = { &testspyvtbl };
|
||||||
|
|
||||||
|
static void test_IMallocSpy(void)
|
||||||
|
{
|
||||||
|
IMalloc *imalloc;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
hr = CoRegisterMallocSpy(&testspy);
|
||||||
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
|
||||||
|
imalloc = NULL;
|
||||||
|
hr = CoGetMalloc(MEMCTX_TASK, &imalloc);
|
||||||
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
ok(imalloc != NULL, "got %p\n", imalloc);
|
||||||
|
|
||||||
|
IMalloc_Free(imalloc, NULL);
|
||||||
|
|
||||||
|
IMalloc_Release(imalloc);
|
||||||
|
|
||||||
|
hr = CoRevokeMallocSpy();
|
||||||
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
}
|
||||||
|
|
||||||
static void init_funcs(void)
|
static void init_funcs(void)
|
||||||
{
|
{
|
||||||
HMODULE hOle32 = GetModuleHandleA("ole32");
|
HMODULE hOle32 = GetModuleHandleA("ole32");
|
||||||
|
@ -3003,4 +3137,5 @@ START_TEST(compobj)
|
||||||
test_CoGetMalloc();
|
test_CoGetMalloc();
|
||||||
test_OleRegGetUserType();
|
test_OleRegGetUserType();
|
||||||
test_CoGetApartmentType();
|
test_CoGetApartmentType();
|
||||||
|
test_IMallocSpy();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue