dll: MemAlloc/MemFree

This commit is contained in:
Bill Zissimopoulos
2015-12-15 14:32:11 -08:00
parent f3b87304e8
commit 2b1edc8d29
6 changed files with 66 additions and 26 deletions

View File

@ -21,4 +21,24 @@
#define DEBUGLOG(fmt, ...) ((void)0)
#endif
static inline PVOID MemAlloc(SIZE_T Size)
{
extern HANDLE ProcessHeap;
return HeapAlloc(ProcessHeap, 0, Size);
}
static inline PVOID MemAllocSLE(SIZE_T Size)
{
extern HANDLE ProcessHeap;
PVOID Pointer = HeapAlloc(ProcessHeap, 0, Size);
if (0 == Pointer)
SetLastError(ERROR_NO_SYSTEM_RESOURCES);
return Pointer;
}
static inline VOID MemFree(PVOID Pointer)
{
extern HANDLE ProcessHeap;
if (0 != Pointer)
HeapFree(ProcessHeap, 0, Pointer);
}
#endif