75{
77 ok(
SUCCEEDED(
hr),
"Expected CoRegisterMallocSpy to succeed, but it failed: 0x%lx\n",
hr);
78
79 {
81 CComHeapPtr<DWORD> heapPtr1;
83 CComHeapPtr<DWORD> heapPtr2(
test_Alloc(0x11111111));
85
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);
89
90 {
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);
101 }
103
104 ok(heapPtr1.Allocate(1),
"Expected Allocate to succeed\n");
107
108 *heapPtr1 = 0x22222222;
109 ok(*heapPtr1 == 0x22222222,
"Expected *heapPtr1 to be 0x22222222, but was: 0x%lx\n", *heapPtr1);
110
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);
116
117 heapPtr2 = 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);
122 }
124
126 ok(
SUCCEEDED(
hr),
"Expected CoRevokeMallocSpy to succeed, but it failed: 0x%lx\n",
hr);
127}
static LONG g_Reallocations
static LONG g_OpenAllocations
HRESULT WINAPI CoRevokeMallocSpy(void)
HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy)
static void test_Alloc(void)