Loader/Agent Memory Allocation
The what
LPVOID allocate_memory ( size_t size, DWORD protection );DECLSPEC_IMPORT LPVOID WINAPI KERNEL32$VirtualAlloc ( LPVOID, SIZE_T, DWORD, DWORD );
LPVOID allocate_memory ( size_t size, DWORD protection ) {
return KERNEL32$VirtualAlloc ( NULL, size, MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN, protection );
}DECLSPEC_IMPORT BOOL WINAPI KERNEL32$VirtualFree ( LPVOID, SIZE_T, DWORD );
void free_memory ( LPVOID address ) {
KERNEL32$VirtualFree ( address, 0, MEM_RELEASE );
}The why
The how
Last updated