ReactOS 0.4.15-dev-8428-g6910fa6
CHeapPtrList.cpp File Reference
#include "atltest.h"
#include <atlcoll.h>
Include dependency graph for CHeapPtrList.cpp:

Go to the source code of this file.

Classes

class  CComHeapPtrList< T >
 
struct  CHeapPtrListMallocSpy
 

Functions

static PDWORD test_Alloc (DWORD value)
 
 START_TEST (CHeapPtrList)
 

Variables

static LONG g_OpenAllocations = 0
 
static LONG g_Reallocations = 0
 
static CHeapPtrListMallocSpy g_Spy
 

Function Documentation

◆ START_TEST()

START_TEST ( CHeapPtrList  )

Definition at line 87 of file CHeapPtrList.cpp.

88{
90 ok(SUCCEEDED(hr), "Expected CoRegisterMallocSpy to succeed, but it failed: 0x%lx\n", hr);
91
92 {
93 ok(g_OpenAllocations == 0, "Expected there to be 0 allocations, was: %ld\n", g_OpenAllocations);
95 ok(g_OpenAllocations == 0, "Expected there to be 0 allocations, was: %ld\n", g_OpenAllocations);
96 PDWORD Ptr = test_Alloc(0x11111111);
97 ok(g_OpenAllocations == 1, "Expected there to be 1 allocations, was: %ld\n", g_OpenAllocations);
99 ok(g_OpenAllocations == 1, "Expected there to be 1 allocations, was: %ld\n", g_OpenAllocations);
100 heapPtr1.AddTail(tmp);
101 ok(tmp.m_pData == NULL, "Expected m_pData to be transfered\n");
102 ok(g_OpenAllocations == 1, "Expected there to be 1 allocations, was: %ld\n", g_OpenAllocations);
103 Ptr = test_Alloc(0x22222222);
104 ok(g_OpenAllocations == 2, "Expected there to be 1 allocations, was: %ld\n", g_OpenAllocations);
105#if defined(_MSC_VER) && !defined(__clang__)
106 heapPtr1.AddTail(CComHeapPtr<DWORD>(Ptr));
107#else
109 heapPtr1.AddTail(xxx);
110#endif
111 ok(g_OpenAllocations == 2, "Expected there to be 1 allocations, was: %ld\n", g_OpenAllocations);
112 }
113 ok(g_OpenAllocations == 0, "Expected there to be 0 allocations, was: %ld\n", g_OpenAllocations);
114
116 ok(SUCCEEDED(hr), "Expected CoRevokeMallocSpy to succeed, but it failed: 0x%lx\n", hr);
117}
static CHeapPtrListMallocSpy g_Spy
static LONG g_OpenAllocations
#define ok(value,...)
Definition: atltest.h:57
POSITION AddTail(INARGTYPE element)
Definition: atlcoll.h:626
#define NULL
Definition: types.h:112
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
HRESULT WINAPI CoRevokeMallocSpy(void)
Definition: ifs.c:522
HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy)
Definition: ifs.c:482
#define SUCCEEDED(hr)
Definition: intsafe.h:50
static void test_Alloc(void)
Definition: misc.c:148
DWORD * PDWORD
Definition: pedump.c:68
HRESULT hr
Definition: shlfolder.c:183

◆ test_Alloc()

static PDWORD test_Alloc ( DWORD  value)
static

Definition at line 16 of file CHeapPtrList.cpp.

17{
19 *ptr = value;
20 return ptr;
21}
unsigned long DWORD
Definition: ntddk_ex.h:95
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
static PVOID ptr
Definition: dispmode.c:27
Definition: pdh_main.c:94

Variable Documentation

◆ g_OpenAllocations

LONG g_OpenAllocations = 0
static

◆ g_Reallocations

LONG g_Reallocations = 0
static

Definition at line 38 of file CHeapPtrList.cpp.

Referenced by CHeapPtrListMallocSpy::PostRealloc().

◆ g_Spy

CHeapPtrListMallocSpy g_Spy
static

Definition at line 84 of file CHeapPtrList.cpp.

Referenced by START_TEST().