windows-nt/Source/XPSP1/NT/sdktools/profiler/memory.c

47 lines
714 B
C
Raw Normal View History

2020-09-26 03:20:57 -05:00
#include <windows.h>
#include <stdio.h>
#include "memory.h"
static HANDLE hHeap = 0;
BOOL
InitializeHeap(VOID)
{
HANDLE hResult;
hResult = HeapCreate(HEAP_GENERATE_EXCEPTIONS,
HEAP_DEFAULT_SIZE,
0);
if (0 == hResult) {
return FALSE;
}
hHeap = hResult;
return TRUE;
}
LPVOID
AllocMem(DWORD dwBytes)
{
LPVOID lpResult = 0;
lpResult = HeapAlloc(hHeap,
HEAP_ZERO_MEMORY,
dwBytes);
return lpResult;
}
BOOL
FreeMem(LPVOID lpMem)
{
BOOL bResult = FALSE;
bResult = HeapFree(hHeap,
0,
lpMem);
return bResult;
}