6 #ifndef _INC_cWinHeap_H
7 #define _INC_cWinHeap_H
15 #if defined(_WIN32) && ! defined(UNDER_CE)
30 : m_hHeap(::GetProcessHeap())
35 cWinHeap(HANDLE hHeap,
bool bManaged =
true) noexcept
37 , m_bManaged(bManaged)
41 cWinHeap(DWORD flOptions, SIZE_T dwInitialSize = 0, SIZE_T dwMaximumSize = 0) noexcept
42 : m_hHeap(::HeapCreate(flOptions, dwInitialSize, dwMaximumSize))
51 ::HeapDestroy(m_hHeap);
55 HANDLE get_Handle() const noexcept
59 bool isValidHeap() const noexcept
64 SIZE_T Compact(DWORD dwFlags = 0) const noexcept
68 return ::HeapCompact(m_hHeap, dwFlags);
75 return ::HeapLock(m_hHeap);
80 return ::HeapUnlock(m_hHeap);
82 bool QueryInformation(HEAP_INFORMATION_CLASS HeapInformationClass,
void* pData, SIZE_T* pnSizeData) noexcept
85 return ::HeapQueryInformation(m_hHeap, HeapInformationClass, pData, *pnSizeData, pnSizeData);
87 bool SetInformation(HEAP_INFORMATION_CLASS HeapInformationClass,
const void* pData, SIZE_T nSizeData) noexcept
90 return ::HeapSetInformation(m_hHeap, HeapInformationClass,
const_cast<void*
>(pData), nSizeData);
98 bool IsValidHeapPtr(
void* pMem =
nullptr, DWORD dwFlags = 0) const noexcept
102 return ::HeapValidate(m_hHeap, dwFlags, pMem);
105 void* AllocPtr(SIZE_T dwBytes, DWORD dwFlags = 0)
108 return ::HeapAlloc(m_hHeap, dwFlags, dwBytes);
110 void* ReAllocPtr(
void* pMem, SIZE_T dwBytes, DWORD dwFlags = 0)
113 return ::HeapReAlloc(m_hHeap, dwFlags, pMem, dwBytes);
115 bool FreePtr(
void* pMem, DWORD dwFlags = 0)
118 return ::HeapFree(m_hHeap, dwFlags, pMem);
120 SIZE_T GetAllocPtrSize(
const void* pMem, DWORD dwFlags = 0) const noexcept
124 return ::HeapSize(m_hHeap, dwFlags, pMem);
#define GRAYCORE_LINK
Definition: GrayCore.h:47
#define HANDLE_NULL
Invalid OS handle for _WIN32. Not invalid OS handle for linux.
Definition: cOSHandle.h:21
#define UNITTEST_FRIEND(n)
Define this in the class body to be unit tested. Allow the unit test to access private/protected stuf...
Definition: cUnitTestDecl.h:17
< The main namespace for all Core functions.
Definition: GrayCore.cpp:14