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_OpenAllocations
virtual SIZE_T STDMETHODCALLTYPE PreAlloc(SIZE_T cbRequest)
virtual void STDMETHODCALLTYPE PreHeapMinimize()
virtual void STDMETHODCALLTYPE PostHeapMinimize()
virtual int STDMETHODCALLTYPE PostDidAlloc(LPVOID, BOOL, int fActual)
HRESULT WINAPI CoRevokeMallocSpy(void)
virtual LPVOID STDMETHODCALLTYPE PreGetSize(LPVOID pRequest, BOOL)
virtual ULONG STDMETHODCALLTYPE AddRef()
virtual LPVOID STDMETHODCALLTYPE PostRealloc(LPVOID pActual, BOOL fSpyed)
virtual SIZE_T STDMETHODCALLTYPE PostGetSize(SIZE_T cbActual, BOOL)
static LONG g_Reallocations
static PDWORD test_Alloc(DWORD value)
#define STDMETHODCALLTYPE
virtual LPVOID STDMETHODCALLTYPE PostAlloc(LPVOID pActual)
virtual LPVOID STDMETHODCALLTYPE PreFree(LPVOID pRequest, BOOL)
virtual void STDMETHODCALLTYPE PostFree(BOOL fSpyed)
#define InterlockedDecrement
virtual ULONG STDMETHODCALLTYPE Release()
REFIID LPVOID * ppvObject
GLsizei const GLfloat * value
virtual LPVOID STDMETHODCALLTYPE PreDidAlloc(LPVOID pRequest, BOOL)
#define InterlockedIncrement
HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy)
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
virtual SIZE_T STDMETHODCALLTYPE PreRealloc(LPVOID pRequest, SIZE_T cbRequest, LPVOID *ppNewRequest, BOOL)
STDMETHODIMP QueryInterface(REFIID riid, void **ppvObject)
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)