LPSTR HeapAlloc(hHeap, cbAlloc) | |||||
HANDLE hHeap; | /* identifies the heap | */ | |||
DWORD cbAlloc; | /* number of bytes to allocate | */ |
The HeapAlloc function allocates a block of memory from a heap. The allocated memory is not movable and is not zero-initialized.
hHeap
Identifies the heap to allocate from. This handle is returned by the HeapCreate function.
cbAlloc
Specifies the number of bytes to be allocated.
If the function is successful, the return value is a pointer to the allocated memory block. Otherwise, the return value is NULL. Use the GetLastError function to obtain extended error information.
If the HeapAlloc function is successful, it allocates at least the amount requested. The actual amount allocated may be greater; the application can use the entire amount. Use the HeapSize function to determine the actual size of the allocated block.
HeapCreate, HeapDestroy HeapSize