HANDLE hHeap, // handle to private heap block
DWORD dwFlags, // heap allocation controlSIZE_T dwBytes // number of bytes to allocate);
DECLAREINTEGER HeapAlloc IN kernel32;
[in] Specifies the heap from which the memory will be allocated. This parameter is a handle returned by the HeapCreate or GetProcessHeap function.
[in] Specifies several controllable aspects of heap allocation. Specifying any of these values will override the corresponding value specified when the heap was created with HeapCreate.
[in] Specifies the number of bytes to be allocated.
If the function succeeds, the return value is a pointer to the allocated memory block. If the function fails the return value is NULL or an exception generated if you have specified HEAP_GENERATE_EXCEPTIONS in dwFlags.
MSDN: To determine the actual size of the allocated block, use the HeapSize function. To free a block of memory allocated by HeapAlloc, use the HeapFree function. Memory allocated by HeapAlloc is not movable. Since the memory is not movable, it is possible for the heap to become fragmented.