blob: a52ad0d68fbd305dbc90b4321b2c6eb573c9ca97 [file] [log] [blame] [raw]
#include <windows.h>
#include <nt.h>
//extern void *ProcessHeap;
static void *ProcessHeap(){
PROCESS_BASIC_INFORMATION pbi;
NtQueryInformationProcess((void *)-1, ProcessBasicInformation, &pbi, sizeof(pbi), NULL);
return pbi.PebBaseAddress->ProcessHeap;
}
void *malloc(size_t size){
return RtlAllocateHeap(ProcessHeap(), 0, size);
}
void *realloc(void *ptr, size_t size){
return RtlReAllocateHeap(ProcessHeap(), 0, ptr, size);
}
void free(void *ptr){
RtlFreeHeap(ProcessHeap(), 0, ptr);
}