15#define HEAP_SEGMENTS 64
17#define HEAP_ENTRY_SIZE ((ULONG)sizeof(HEAP_ENTRY))
19#define HEAP_ENTRY_SHIFT 4
21#define HEAP_ENTRY_SHIFT 3
23#define HEAP_MAX_BLOCK_SIZE ((0x80000 - PAGE_SIZE) >> HEAP_ENTRY_SHIFT)
25#define ARENA_INUSE_FILLER 0xBAADF00D
26#define ARENA_FREE_FILLER 0xFEEEFEEE
27#define HEAP_TAIL_FILL 0xab
30#define HEAP_GLOBAL_TAG 0x0800
31#define HEAP_PSEUDO_TAG_FLAG 0x8000
32#define HEAP_TAG_MASK (HEAP_MAXIMUM_TAG << HEAP_TAG_SHIFT)
33#define HEAP_TAGS_MASK (HEAP_TAG_MASK ^ (0xFF << HEAP_TAG_SHIFT))
35#define HEAP_EXTRA_FLAGS_MASK (HEAP_CAPTURE_STACK_BACKTRACES | \
36 HEAP_SETTABLE_USER_VALUE | \
40#define HEAP_ENTRY_BUSY 0x01
41#define HEAP_ENTRY_EXTRA_PRESENT 0x02
42#define HEAP_ENTRY_FILL_PATTERN 0x04
43#define HEAP_ENTRY_VIRTUAL_ALLOC 0x08
44#define HEAP_ENTRY_LAST_ENTRY 0x10
45#define HEAP_ENTRY_SETTABLE_FLAG1 0x20
46#define HEAP_ENTRY_SETTABLE_FLAG2 0x40
47#define HEAP_ENTRY_SETTABLE_FLAG3 0x80
48#define HEAP_ENTRY_SETTABLE_FLAGS (HEAP_ENTRY_SETTABLE_FLAG1 | HEAP_ENTRY_SETTABLE_FLAG2 | HEAP_ENTRY_SETTABLE_FLAG3)
51#define HEAP_SIGNATURE 0xeefeeff
52#define HEAP_SEGMENT_SIGNATURE 0xffeeffee
55#define HEAP_USER_ALLOCATED 0x1
81 PVOID PreviousBlockPrivateData;
96 ULONG SubSegmentCodeDummy;
206#define HEAP_SEGMENT_MEMBERS \
208 ULONG SegmentSignature; \
209 ULONG SegmentFlags; \
210 LIST_ENTRY SegmentListEntry; \
211 struct _HEAP *Heap; \
213 ULONG NumberOfPages; \
214 PHEAP_ENTRY FirstEntry; \
215 PHEAP_ENTRY LastValidEntry; \
216 ULONG NumberOfUnCommittedPages; \
217 ULONG NumberOfUnCommittedRanges; \
218 USHORT SegmentAllocatorBackTraceIndex; \
220 LIST_ENTRY UCRSegmentList
388 ULONG UserFlagsReset,
449 ULONG UserFlagsReset,
unsigned long long UINT64
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T CommitSize
#define HEAP_SKIP_VALIDATION_CHECKS
#define HEAP_VALIDATE_ALL_ENABLED
#define HEAP_CAPTURE_STACK_BACKTRACES
#define HEAP_VALIDATE_PARAMETERS_ENABLED
#define HEAP_FLAG_PAGE_ALLOCS
#define HEAP_CREATE_ENABLE_TRACING
NTSTATUS(* PRTL_HEAP_COMMIT_ROUTINE)(IN PVOID Base, IN OUT PVOID *CommitAddress, IN OUT PULONG CommitSize)
struct _HEAP_ENTRY_EXTRA HEAP_ENTRY_EXTRA
SIZE_T NTAPI RtlDebugSizeHeap(HANDLE HeapPtr, ULONG Flags, PVOID Ptr)
PVOID NTAPI RtlDebugAllocateHeap(PVOID HeapPtr, ULONG Flags, SIZE_T Size)
PHEAP_FREE_ENTRY NTAPI RtlpCoalesceFreeBlocks(PHEAP Heap, PHEAP_FREE_ENTRY FreeEntry, PSIZE_T FreeSize, BOOLEAN Remove)
BOOLEAN NTAPI RtlDebugSetUserValueHeap(PVOID HeapHandle, ULONG Flags, PVOID BaseAddress, PVOID UserValue)
struct _HEAP_UCR_DESCRIPTOR HEAP_UCR_DESCRIPTOR
struct _HEAP_TAG_ENTRY * PHEAP_TAG_ENTRY
struct _HEAP_ENTRY * PHEAP_ENTRY
PVOID NTAPI RtlpPageHeapDestroy(HANDLE HeapPtr)
struct _HEAP_TUNING_PARAMETERS HEAP_TUNING_PARAMETERS
HEAP_ENTRY_EXTRA * PHEAP_FREE_ENTRY_EXTRA
SIZE_T NTAPI RtlpPageHeapSize(HANDLE HeapPtr, ULONG Flags, PVOID Ptr)
struct _HEAP_UCR_SEGMENT HEAP_UCR_SEGMENT
BOOLEAN NTAPI RtlpValidateHeap(PHEAP Heap, BOOLEAN ForceValidation)
BOOLEAN NTAPI RtlpPageHeapLock(HANDLE HeapPtr)
PVOID NTAPI RtlpPageHeapReAllocate(HANDLE HeapPtr, ULONG Flags, PVOID Ptr, SIZE_T Size)
struct _HEAP_LIST_LOOKUP HEAP_LIST_LOOKUP
struct _HEAP_SEGMENT HEAP_SEGMENT
struct _HEAP_VIRTUAL_ALLOC_ENTRY HEAP_VIRTUAL_ALLOC_ENTRY
struct _HEAP_FREE_ENTRY HEAP_FREE_ENTRY
struct _HEAP_ENTRY_EXTRA * PHEAP_ENTRY_EXTRA
FORCEINLINE BOOLEAN RtlpHeapIsSpecial(ULONG Flags)
struct _HEAP_UCR_SEGMENT * PHEAP_UCR_SEGMENT
struct _HEAP_TAG_ENTRY HEAP_TAG_ENTRY
BOOLEAN NTAPI RtlDebugFreeHeap(HANDLE HeapPtr, ULONG Flags, PVOID Ptr)
struct _HEAP_PSEUDO_TAG_ENTRY HEAP_PSEUDO_TAG_ENTRY
VOID NTAPI RtlpAddHeapToProcessList(PHEAP Heap)
BOOLEAN NTAPI RtlDebugDestroyHeap(HANDLE HeapPtr)
HEAP_ENTRY_EXTRA HEAP_FREE_ENTRY_EXTRA
BOOLEAN NTAPI RtlpValidateHeapHeaders(PHEAP Heap, BOOLEAN Recalculate)
struct _HEAP_COUNTERS HEAP_COUNTERS
BOOLEAN NTAPI RtlDebugSetUserFlagsHeap(PVOID HeapHandle, ULONG Flags, PVOID BaseAddress, ULONG UserFlagsReset, ULONG UserFlagsSet)
NTSYSAPI HANDLE NTAPI RtlDebugCreateHeap(ULONG Flags, PVOID Addr, SIZE_T TotalSize, SIZE_T CommitSize, PVOID Lock, PRTL_HEAP_PARAMETERS Parameters)
BOOLEAN NTAPI RtlpPageHeapSetUserValue(PVOID HeapHandle, ULONG Flags, PVOID BaseAddress, PVOID UserValue)
VOID NTAPI RtlInitializeHeapManager(VOID)
BOOLEAN NTAPI RtlpPageHeapGetUserInfo(PVOID HeapHandle, ULONG Flags, PVOID BaseAddress, PVOID *UserValue, PULONG UserFlags)
PVOID NTAPI RtlDebugReAllocateHeap(HANDLE HeapPtr, ULONG Flags, PVOID Ptr, SIZE_T Size)
struct _HEAP_VIRTUAL_ALLOC_ENTRY * PHEAP_VIRTUAL_ALLOC_ENTRY
struct _HEAP_PSEUDO_TAG_ENTRY * PHEAP_PSEUDO_TAG_ENTRY
struct _HEAP_UCR_DESCRIPTOR * PHEAP_UCR_DESCRIPTOR
RTL_CRITICAL_SECTION RtlpProcessHeapsListLock
BOOLEAN RtlpPageHeapEnabled
BOOLEAN NTAPI RtlpPageHeapFree(HANDLE HeapPtr, ULONG Flags, PVOID Ptr)
struct _HEAP_COUNTERS * PHEAP_COUNTERS
struct _HEAP_FREE_ENTRY * PHEAP_FREE_ENTRY
VOID NTAPI RtlpRemoveHeapFromProcessList(PHEAP Heap)
BOOLEAN NTAPI RtlDebugGetUserInfoHeap(PVOID HeapHandle, ULONG Flags, PVOID BaseAddress, PVOID *UserValue, PULONG UserFlags)
struct _HEAP_ENTRY HEAP_ENTRY
BOOLEAN NTAPI RtlpValidateHeapEntry(PHEAP Heap, PHEAP_ENTRY HeapEntry)
PVOID NTAPI RtlpPageHeapAllocate(IN PVOID HeapPtr, IN ULONG Flags, IN SIZE_T Size)
BOOLEAN NTAPI RtlpPageHeapUnlock(HANDLE HeapPtr)
PHEAP_ENTRY_EXTRA NTAPI RtlpGetExtraStuffPointer(PHEAP_ENTRY HeapEntry)
BOOLEAN NTAPI RtlpDebugPageHeapValidate(PVOID HeapPtr, ULONG Flags, PVOID Block)
BOOLEAN NTAPI RtlpPageHeapSetUserFlags(PVOID HeapHandle, ULONG Flags, PVOID BaseAddress, ULONG UserFlagsReset, ULONG UserFlagsSet)
struct _HEAP_SEGMENT * PHEAP_SEGMENT
struct _HEAP_LIST_LOOKUP * PHEAP_LIST_LOOKUP
HANDLE NTAPI RtlpPageHeapCreate(ULONG Flags, PVOID Addr, SIZE_T TotalSize, SIZE_T CommitSize, PVOID Lock, PRTL_HEAP_PARAMETERS Parameters)
struct _HEAP_TUNING_PARAMETERS * PHEAP_TUNING_PARAMETERS
UCHAR ExtendedBlockSignature
SIZE_T TotalMemoryLargeUCR
SIZE_T TotalMemoryCommitted
SIZE_T InBlockDeccomitSize
SIZE_T TotalSizeInVirtualBlocks
SIZE_T TotalMemoryReserved
ULONG InBlockCommitFailures
struct _HEAP_LIST_LOOKUP * ExtendedLookup
USHORT CreatorBackTraceIndex
ULONG CommittThresholdShift
SIZE_T MaxPreCommittThreshold
HEAP_ENTRY_EXTRA ExtraStuff
USHORT HeaderValidateLength
ULONG VirtualMemoryThreshold
PRTL_HEAP_COMMIT_ROUTINE CommitRoutine
PLIST_ENTRY FreeHints[ANYSIZE_ARRAY]
USHORT NextAvailableTagIndex
RTL_BITMAP FreeHintBitmap
LIST_ENTRY VirtualAllocdBlocks
USHORT ProcessHeapsListIndex
PHEAP_PSEUDO_TAG_ENTRY PseudoTagEntries
PHEAP_TAG_ENTRY TagEntries
USHORT AllocatorBackTraceIndex
SIZE_T MaximumAllocationSize
ULONG NonDedicatedListLength
HEAP_TUNING_PARAMETERS TuningParameters
SIZE_T DeCommitFreeBlockThreshold
USHORT FrontHeapLockCount
SIZE_T DeCommitTotalFreeThreshold
struct _HEAP_SEGMENT * Segments[HEAP_SEGMENTS]
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
_Must_inspect_result_ _In_ ULONG Flags