77 ok(
SUCCEEDED(
hr),
"Expected CoRegisterMallocSpy to succeed, but it failed: 0x%lx\n",
hr);
81 CComHeapPtr<DWORD> heapPtr1;
83 CComHeapPtr<DWORD> heapPtr2(
test_Alloc(0x11111111));
86 ok((
PDWORD)heapPtr1 ==
NULL,
"Expected heapPtr1 to be NULL, was: 0x%p\n", (
PDWORD)heapPtr1);
87 ok((
PDWORD)heapPtr2 !=
NULL,
"Expected heapPtr2 to not be NULL\n");
88 ok(*heapPtr2 == 0x11111111,
"Expected *heapPtr2 to be 0x11111111, but was: 0x%lx\n", *heapPtr2);
92 CComHeapPtr<DWORD> heapPtrSteal1(heapPtr1);
94 ok((
PDWORD)heapPtr1 ==
NULL,
"Expected heapPtr1 to be NULL, was: 0x%p\n", (
PDWORD)heapPtr1);
95 ok((
PDWORD)heapPtrSteal1 ==
NULL,
"Expected heapPtrSteal1 to be NULL, was: 0x%p\n", (
PDWORD)heapPtrSteal1);
96 CComHeapPtr<DWORD> heapPtrSteal2(heapPtr2);
98 ok((
PDWORD)heapPtr2 ==
NULL,
"Expected heapPtr2 to be NULL, was: 0x%p\n", (
PDWORD)heapPtr2);
99 ok((
PDWORD)heapPtrSteal2 !=
NULL,
"Expected heapPtrSteal2 to not be NULL\n");
100 ok(*heapPtrSteal2 == 0x11111111,
"Expected *heapPtrSteal2 to be 0x11111111, but was: 0x%lx\n", *heapPtrSteal2);
104 ok(heapPtr1.Allocate(1),
"Expected Allocate to succeed\n");
108 *heapPtr1 = 0x22222222;
109 ok(*heapPtr1 == 0x22222222,
"Expected *heapPtr1 to be 0x22222222, but was: 0x%lx\n", *heapPtr1);
111 ok(heapPtr1.Reallocate(2),
"Expected Reallocate to succeed\n");
112 heapPtr1[1] = 0x33333333;
113 ok(*heapPtr1 == 0x22222222,
"Expected *heapPtr1 to be 0x22222222, but was: 0x%lx\n", *heapPtr1);
119 ok(*heapPtr2 == 0x22222222,
"Expected *heapPtr2 to be 0x33333333, but was: 0x%lx\n", *heapPtr2);
120 ok(heapPtr2[1] == 0x33333333,
"Expected heapPtr2[1] to be 0x33333333, but was: 0x%lx\n", heapPtr2[1]);
121 ok((
PDWORD)heapPtr1 ==
NULL,
"Expected heapPtr1 to be NULL, was: 0x%p\n", (
PDWORD)heapPtr1);
126 ok(
SUCCEEDED(
hr),
"Expected CoRevokeMallocSpy to succeed, but it failed: 0x%lx\n",
hr);
static LONG g_Reallocations
static LONG g_OpenAllocations
#define InterlockedIncrement
#define InterlockedDecrement
#define STDMETHODCALLTYPE
HRESULT WINAPI CoRevokeMallocSpy(void)
HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy)
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
static void test_Alloc(void)
#define IsEqualGUID(rguid1, rguid2)
virtual LPVOID STDMETHODCALLTYPE PostAlloc(LPVOID pActual)
STDMETHODIMP QueryInterface(REFIID riid, void **ppvObject)
virtual LPVOID STDMETHODCALLTYPE PreGetSize(LPVOID pRequest, BOOL)
virtual SIZE_T STDMETHODCALLTYPE PreAlloc(SIZE_T cbRequest)
virtual void STDMETHODCALLTYPE PostHeapMinimize()
virtual SIZE_T STDMETHODCALLTYPE PreRealloc(LPVOID pRequest, SIZE_T cbRequest, LPVOID *ppNewRequest, BOOL)
virtual void STDMETHODCALLTYPE PostFree(BOOL fSpyed)
virtual LPVOID STDMETHODCALLTYPE PreFree(LPVOID pRequest, BOOL)
virtual int STDMETHODCALLTYPE PostDidAlloc(LPVOID, BOOL, int fActual)
virtual LPVOID STDMETHODCALLTYPE PostRealloc(LPVOID pActual, BOOL fSpyed)
virtual ULONG STDMETHODCALLTYPE AddRef()
virtual ULONG STDMETHODCALLTYPE Release()
virtual void STDMETHODCALLTYPE PreHeapMinimize()
virtual SIZE_T STDMETHODCALLTYPE PostGetSize(SIZE_T cbActual, BOOL)
virtual LPVOID STDMETHODCALLTYPE PreDidAlloc(LPVOID pRequest, BOOL)
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject