Allocating Memory

Important

The type of actions that can be performed will depend on the protection assigned to the allocated memory region.

Allocating a memory to a buffer of 100 bytes.

Using Malloc()

PVOID pAddress = malloc(100);

using heapalloc()

PVOID pAddress = HeapAlloc(GetProcessHeap(), 0, 100);

using localalloc()

PVOID pAddress = LocalAlloc(LPTR, 100);