#ifndef _NTRTL_H
/**
* The RtlCreateHeap routine creates a heap object that can be used by the calling process. This routine reserves
* space in the virtual address space of the process and allocates physical storage for a specified initial portion of this block.
*
* @param Flags Flags specifying optional attributes of the heap.
* @param HeapBase If HeapBase is a non-NULL value, it specifies the base address for a block of caller-allocated memory to use for the heap.
* @param ReserveSize If ReserveSize is a nonzero value, it specifies the initial amount of memory, in bytes, to reserve for the heap.
* @param CommitSize If CommitSize is a nonzero value, it specifies the initial amount of memory, in bytes, to commit for the heap.
* @param Lock Pointer to an opaque structure to be used as the heap lock.
* @param Parameters Pointer to a RTL_HEAP_PARAMETERS structure that contains parameters to be applied when creating the heap.
* @return RtlCreateHeap returns a handle to be used in accessing the created heap.
* \remarks https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/nf-ntifs-rtlcreateheap
*/
_Must_inspect_result_
NTSYSAPI
PVOID
NTAPI
RtlCreateHeap(
_In_ ULONG Flags,
_In_opt_ PVOID HeapBase,
_In_opt_ SIZE_T ReserveSize,
_In_opt_ SIZE_T CommitSize,
_In_opt_ PVOID Lock,
_When_((Flags & HEAP_CREATE_SEGMENT_HEAP) != 0, _In_reads_bytes_opt_(sizeof(RTL_SEGMENT_HEAP_PARAMETERS)))
_When_((Flags & HEAP_CREATE_SEGMENT_HEAP) == 0, _In_reads_bytes_opt_(sizeof(RTL_HEAP_PARAMETERS)))
_In_opt_ PVOID Parameters
);
View code on GitHub
This function is documented in Windows Driver Kit.
Flags are defined in <WinNT.h>. Can be one of following:
HEAP_NO_SERIALIZE
HEAP_GROWABLE
HEAP_GENERATE_EXCEPTIONS
HEAP_ZERO_MEMORY
HEAP_REALLOC_IN_PLACE_ONLY
HEAP_TAIL_CHECKING_ENABLED
HEAP_FREE_CHECKING_ENABLED
HEAP_DISABLE_COALESCE_ON_FREE
HEAP_CREATE_ALIGN_16
HEAP_CREATE_ENABLE_TRACING
Base address, where heap should be created. If memory was previously allocated at this address, heap is created at the nearest possible virtual address.
How much bytes should be reserved. See NtAllocateVirtualMemory
.
How many bytes should be committed. If Reserve
is greater than zero, Commit
must be less or equal to Reserve
.
If set, heap will be locked. See RtlLockHeap
/ RtlUnlockHeap
.
Pointer to RTL_HEAP_DEFINITION
structure. On NT 4.0 all bytes of this (except length field) are set to zero.
NtAllocateVirtualMemory
NtLockVirtualMemory
RTL_HEAP_DEFINITION
RtlDestroyHeap
RtlLockHeap
RtlUnlockHeap