49 *ppNewRequest = pRequest;
72 ok(
SUCCEEDED(
hr),
"Expected CoRegisterMallocSpy to succeed, but it failed: 0x%lx\n",
hr);
76 CComHeapPtr<DWORD> heapPtr1;
78 CComHeapPtr<DWORD> heapPtr2(
test_Alloc(0x11111111));
81 ok((
PDWORD)heapPtr1 ==
NULL,
"Expected heapPtr1 to be NULL, was: 0x%p\n", (
PDWORD)heapPtr1);
82 ok((
PDWORD)heapPtr2 !=
NULL,
"Expected heapPtr2 to not be NULL\n");
83 ok(*heapPtr2 == 0x11111111,
"Expected *heapPtr2 to be 0x11111111, but was: 0x%lx\n", *heapPtr2);
87 CComHeapPtr<DWORD> heapPtrSteal1(heapPtr1);
89 ok((
PDWORD)heapPtr1 ==
NULL,
"Expected heapPtr1 to be NULL, was: 0x%p\n", (
PDWORD)heapPtr1);
90 ok((
PDWORD)heapPtrSteal1 ==
NULL,
"Expected heapPtrSteal1 to be NULL, was: 0x%p\n", (
PDWORD)heapPtrSteal1);
91 CComHeapPtr<DWORD> heapPtrSteal2(heapPtr2);
93 ok((
PDWORD)heapPtr2 ==
NULL,
"Expected heapPtr2 to be NULL, was: 0x%p\n", (
PDWORD)heapPtr2);
94 ok((
PDWORD)heapPtrSteal2 !=
NULL,
"Expected heapPtrSteal2 to not be NULL\n");
95 ok(*heapPtrSteal2 == 0x11111111,
"Expected *heapPtrSteal2 to be 0x11111111, but was: 0x%lx\n", *heapPtrSteal2);
99 ok(heapPtr1.Allocate(1),
"Expected Allocate to succeed\n");
103 *heapPtr1 = 0x22222222;
104 ok(*heapPtr1 == 0x22222222,
"Expected *heapPtr1 to be 0x22222222, but was: 0x%lx\n", *heapPtr1);
106 ok(heapPtr1.Reallocate(2),
"Expected Reallocate to succeed\n");
107 heapPtr1[1] = 0x33333333;
108 ok(*heapPtr1 == 0x22222222,
"Expected *heapPtr1 to be 0x22222222, but was: 0x%lx\n", *heapPtr1);
114 ok(*heapPtr2 == 0x22222222,
"Expected *heapPtr2 to be 0x33333333, but was: 0x%lx\n", *heapPtr2);
115 ok(heapPtr2[1] == 0x33333333,
"Expected heapPtr2[1] to be 0x33333333, but was: 0x%lx\n", heapPtr2[1]);
116 ok((
PDWORD)heapPtr1 ==
NULL,
"Expected heapPtr1 to be NULL, was: 0x%p\n", (
PDWORD)heapPtr1);
121 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
virtual LPVOID STDMETHODCALLTYPE PreDidAlloc(LPVOID pRequest, BOOL)
GLsizei const GLfloat * value
#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)