ReactOS 0.4.16-dev-197-g92996da
heap.c File Reference
#include <freeldr.h>
#include <debug.h>
Include dependency graph for heap.c:

Go to the source code of this file.

Classes

struct  _BLOCK_DATA
 
struct  _HEAP_BLOCK
 
struct  _HEAP
 

Macros

#define FREELDR_HEAP_VERIFIER
 
#define REDZONE_MARK   0xCCCCCCCCCCCCCCCCULL
 
#define REDZONE_ALLOCATION   24
 
#define REDZONE_LOW_OFFSET   16
 
#define REDZONE_SIZE(Block)   ((ULONG64*)Block->Data)
 
#define REDZONE_LOW(Block)   ((ULONG64*)Block->Data + 1)
 
#define REDZONE_HI(Block)   ((ULONG64*)((PUCHAR)Block->Data + 16 + *REDZONE_SIZE(Block)))
 

Typedefs

typedef struct _BLOCK_DATA BLOCK_DATA
 
typedef struct _BLOCK_DATAPBLOCK_DATA
 
typedef struct _HEAP_BLOCK HEAP_BLOCK
 
typedef struct _HEAP_BLOCKPHEAP_BLOCK
 
typedef struct _HEAP HEAP
 
typedef struct _HEAPPHEAP
 

Functions

 DBG_DEFAULT_CHANNEL (HEAP)
 
PVOID FrLdrHeapCreate (SIZE_T MaximumSize, TYPE_OF_MEMORY MemoryType)
 
VOID FrLdrHeapDestroy (PVOID HeapHandle)
 
VOID FrLdrHeapVerify (PVOID HeapHandle)
 
VOID FrLdrHeapRelease (PVOID HeapHandle)
 
VOID FrLdrHeapCleanupAll (VOID)
 
static VOID FrLdrHeapRemoveFreeList (PHEAP Heap, PHEAP_BLOCK Block)
 
static VOID FrLdrHeapInsertFreeList (PHEAP Heap, PHEAP_BLOCK FreeBlock)
 
PVOID FrLdrHeapAllocateEx (PVOID HeapHandle, SIZE_T ByteSize, ULONG Tag)
 
VOID FrLdrHeapFreeEx (PVOID HeapHandle, PVOID Pointer, ULONG Tag)
 
VOID MmInitializeHeap (PVOID PageLookupTable)
 
PVOID NTAPI ExAllocatePoolWithTag (IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes, IN ULONG Tag)
 
PVOID NTAPI ExAllocatePool (IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes)
 
VOID NTAPI ExFreePool (IN PVOID P)
 
VOID NTAPI ExFreePoolWithTag (IN PVOID P, IN ULONG Tag)
 
PVOID NTAPI RtlAllocateHeap (IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
 
BOOLEAN NTAPI RtlFreeHeap (IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
 

Variables

PVOID FrLdrDefaultHeap
 
PVOID FrLdrTempHeap
 

Macro Definition Documentation

◆ FREELDR_HEAP_VERIFIER

#define FREELDR_HEAP_VERIFIER

Definition at line 25 of file heap.c.

◆ REDZONE_ALLOCATION

#define REDZONE_ALLOCATION   24

Definition at line 28 of file heap.c.

◆ REDZONE_HI

#define REDZONE_HI (   Block)    ((ULONG64*)((PUCHAR)Block->Data + 16 + *REDZONE_SIZE(Block)))

Definition at line 32 of file heap.c.

◆ REDZONE_LOW

#define REDZONE_LOW (   Block)    ((ULONG64*)Block->Data + 1)

Definition at line 31 of file heap.c.

◆ REDZONE_LOW_OFFSET

#define REDZONE_LOW_OFFSET   16

Definition at line 29 of file heap.c.

◆ REDZONE_MARK

#define REDZONE_MARK   0xCCCCCCCCCCCCCCCCULL

Definition at line 27 of file heap.c.

◆ REDZONE_SIZE

#define REDZONE_SIZE (   Block)    ((ULONG64*)Block->Data)

Definition at line 30 of file heap.c.

Typedef Documentation

◆ BLOCK_DATA

◆ HEAP

typedef struct _HEAP HEAP

◆ HEAP_BLOCK

◆ PBLOCK_DATA

◆ PHEAP

typedef struct _HEAP * PHEAP

◆ PHEAP_BLOCK

Function Documentation

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( HEAP  )

◆ ExAllocatePool()

PVOID NTAPI ExAllocatePool ( IN POOL_TYPE  PoolType,
IN SIZE_T  NumberOfBytes 
)

Definition at line 564 of file heap.c.

567{
569}
PVOID FrLdrHeapAllocateEx(PVOID HeapHandle, SIZE_T ByteSize, ULONG Tag)
Definition: heap.c:321
PVOID FrLdrDefaultHeap
Definition: heap.c:34
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:1036

◆ ExAllocatePoolWithTag()

PVOID NTAPI ExAllocatePoolWithTag ( IN POOL_TYPE  PoolType,
IN SIZE_T  NumberOfBytes,
IN ULONG  Tag 
)

Definition at line 554 of file heap.c.

558{
560}
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4065

◆ ExFreePool()

VOID NTAPI ExFreePool ( IN PVOID  P)

Definition at line 573 of file heap.c.

575{
577}
VOID FrLdrHeapFreeEx(PVOID HeapHandle, PVOID Pointer, ULONG Tag)
Definition: heap.c:439
#define P(row, col)

◆ ExFreePoolWithTag()

VOID NTAPI ExFreePoolWithTag ( IN PVOID  P,
IN ULONG  Tag 
)

Definition at line 581 of file heap.c.

◆ FrLdrHeapAllocateEx()

PVOID FrLdrHeapAllocateEx ( PVOID  HeapHandle,
SIZE_T  ByteSize,
ULONG  Tag 
)

Definition at line 321 of file heap.c.

325{
326 PHEAP Heap = HeapHandle;
327 PHEAP_BLOCK Block, NextBlock;
328 USHORT BlockSize, Remaining;
329#if DBG && !defined(_M_ARM)
331#endif
332
333#ifdef FREELDR_HEAP_VERIFIER
334 /* Verify the heap */
335 FrLdrHeapVerify(HeapHandle);
336
337 /* Add space for a size field and 2 redzones */
339#endif
340
341 /* Check if the allocation is too large */
342 if ((ByteSize + sizeof(HEAP_BLOCK)) > MAXUSHORT * sizeof(HEAP_BLOCK))
343 {
344 ERR("HEAP: Allocation of 0x%lx bytes too large\n", ByteSize);
345 return NULL;
346 }
347
348 /* We need a proper tag */
349 if (Tag == 0) Tag = 'enoN';
350
351 /* Calculate alloc size */
352 BlockSize = (USHORT)((ByteSize + sizeof(HEAP_BLOCK) - 1) / sizeof(HEAP_BLOCK));
353
354 /* Walk the free block list */
355 Block = &Heap->Blocks + Heap->TerminatingBlock;
356 for (Block = &Heap->Blocks + Block->Data[0].Flink;
357 Block->Size != 0;
358 Block = &Heap->Blocks + Block->Data[0].Flink)
359 {
360 ASSERT(Block->Tag == 0);
361
362 /* Continue, if its too small */
363 if (Block->Size < BlockSize) continue;
364
365 /* This block is just fine, use it */
366 Block->Tag = Tag;
367
368 /* Remove this entry from the free list */
369 FrLdrHeapRemoveFreeList(Heap, Block);
370
371 /* Calculate the remaining size */
372 Remaining = Block->Size - BlockSize;
373
374 /* Check if the remaining space is large enough for a new block */
375 if (Remaining > 1)
376 {
377 /* Make the allocated block as large as necessary */
378 Block->Size = BlockSize;
379
380 /* Get pointer to the new block */
381 NextBlock = Block + 1 + BlockSize;
382
383 /* Make it a free block */
384 NextBlock->Tag = 0;
385 NextBlock->Size = Remaining - 1;
386 NextBlock->PreviousSize = BlockSize;
387 BlockSize = NextBlock->Size;
388 FrLdrHeapInsertFreeList(Heap, NextBlock);
389
390 /* Advance to the next block */
391 NextBlock = NextBlock + 1 + BlockSize;
392 }
393 else
394 {
395 /* Not enough left, use the full block */
396 BlockSize = Block->Size;
397
398 /* Get the next block */
399 NextBlock = Block + 1 + BlockSize;
400 }
401
402 /* Update the next blocks back link */
403 NextBlock->PreviousSize = BlockSize;
404
405 /* Update heap usage */
406 Heap->NumAllocs++;
407 Heap->CurrentAllocBytes += Block->Size * sizeof(HEAP_BLOCK);
408 Heap->MaxAllocBytes = max(Heap->MaxAllocBytes, Heap->CurrentAllocBytes);
410 Block->Size * sizeof(HEAP_BLOCK));
411#if DBG && !defined(_M_ARM)
412 Heap->AllocationTime += (__rdtsc() - Time);
413#endif
414 TRACE("HeapAllocate(%p, %ld, %.4s) -> return %p\n",
415 HeapHandle, ByteSize, &Tag, Block->Data);
416
417 /* HACK: zero out the allocation */
418 RtlZeroMemory(Block->Data, Block->Size * sizeof(HEAP_BLOCK));
419
420#ifdef FREELDR_HEAP_VERIFIER
421 /* Write size and redzones */
423 *REDZONE_LOW(Block) = REDZONE_MARK;
424 *REDZONE_HI(Block) = REDZONE_MARK;
425
426 /* Allocation starts after size field and redzone */
427 return (PUCHAR)Block->Data + REDZONE_LOW_OFFSET;
428#endif
429 /* Return pointer to the data */
430 return Block->Data;
431 }
432
433 /* We found nothing */
434 WARN("HEAP: nothing suitable found for 0x%lx bytes\n", ByteSize);
435 return NULL;
436}
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
struct _HEAP_BLOCK HEAP_BLOCK
#define REDZONE_SIZE(Block)
Definition: heap.c:30
#define REDZONE_ALLOCATION
Definition: heap.c:28
static VOID FrLdrHeapInsertFreeList(PHEAP Heap, PHEAP_BLOCK FreeBlock)
Definition: heap.c:299
#define REDZONE_LOW(Block)
Definition: heap.c:31
static VOID FrLdrHeapRemoveFreeList(PHEAP Heap, PHEAP_BLOCK Block)
Definition: heap.c:281
#define REDZONE_LOW_OFFSET
Definition: heap.c:29
VOID FrLdrHeapVerify(PVOID HeapHandle)
Definition: heap.c:157
#define REDZONE_MARK
Definition: heap.c:27
#define REDZONE_HI(Block)
Definition: heap.c:32
#define NULL
Definition: types.h:112
PPC_QUAL unsigned long long __rdtsc(void)
Definition: intrin_ppc.h:688
#define ASSERT(a)
Definition: mode.c:44
static PLARGE_INTEGER Time
Definition: time.c:105
unsigned short USHORT
Definition: pedump.c:61
#define TRACE(s)
Definition: solgame.cpp:4
ULONG_PTR Flink
Definition: heap.c:39
USHORT Size
Definition: heap.c:45
ULONG Tag
Definition: heap.c:47
USHORT PreviousSize
Definition: heap.c:46
BLOCK_DATA Data[]
Definition: heap.c:48
Definition: heap.c:52
SIZE_T LargestAllocation
Definition: heap.c:58
ULONG_PTR TerminatingBlock
Definition: heap.c:61
SIZE_T CurrentAllocBytes
Definition: heap.c:54
HEAP_BLOCK Blocks
Definition: heap.c:62
SIZE_T MaxAllocBytes
Definition: heap.c:55
ULONG NumAllocs
Definition: heap.c:56
ULONGLONG AllocationTime
Definition: heap.c:59
#define max(a, b)
Definition: svc.c:63
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define MAXUSHORT
Definition: typedefs.h:83
unsigned char * PUCHAR
Definition: typedefs.h:53
uint64_t ULONGLONG
Definition: typedefs.h:67
_IRQL_requires_same_ _In_ CLONG ByteSize
Definition: rtltypes.h:412

Referenced by ExAllocatePool(), ExAllocatePoolWithTag(), FrLdrHeapAlloc(), FrLdrTempAlloc(), RtlAllocateHeap(), and RtlpAllocateMemory().

◆ FrLdrHeapCleanupAll()

VOID FrLdrHeapCleanupAll ( VOID  )

Definition at line 249 of file heap.c.

250{
251#if DBG
252 PHEAP Heap;
253
254 Heap = FrLdrDefaultHeap;
255 TRACE("Heap statistics for default heap:\n"
256 "CurrentAlloc=0x%lx, MaxAlloc=0x%lx, LargestAllocation=0x%lx\n"
257 "NumAllocs=%ld, NumFrees=%ld\n",
259 Heap->NumAllocs, Heap->NumFrees);
260 TRACE("AllocTime = %I64d, FreeTime = %I64d, sum = %I64d\n",
261 Heap->AllocationTime, Heap->FreeTime, Heap->AllocationTime + Heap->FreeTime);
262#endif
263
264 /* Release free pages from the default heap */
266
267#if DBG
268 Heap = FrLdrTempHeap;
269 TRACE("Heap statistics for temp heap:\n"
270 "CurrentAlloc=0x%lx, MaxAlloc=0x%lx, LargestAllocation=0x%lx\n"
271 "NumAllocs=%ld, NumFrees=%ld\n",
273 Heap->NumAllocs, Heap->NumFrees);
274#endif
275
276 /* Destroy the temp heap */
278}
VOID FrLdrHeapDestroy(PVOID HeapHandle)
Definition: heap.c:138
VOID FrLdrHeapRelease(PVOID HeapHandle)
Definition: heap.c:182
PVOID FrLdrTempHeap
Definition: heap.c:35
ULONGLONG FreeTime
Definition: heap.c:60
ULONG NumFrees
Definition: heap.c:57

Referenced by WinLdrSetupMemoryLayout().

◆ FrLdrHeapCreate()

PVOID FrLdrHeapCreate ( SIZE_T  MaximumSize,
TYPE_OF_MEMORY  MemoryType 
)

Definition at line 66 of file heap.c.

69{
70 PHEAP Heap;
71 PHEAP_BLOCK Block;
72 SIZE_T Remaining;
73 USHORT PreviousSize;
74
75 TRACE("HeapCreate(MemoryType=%ld)\n", MemoryType);
76
77 /* Allocate some memory for the heap */
78 MaximumSize = ALIGN_UP_BY(MaximumSize, MM_PAGE_SIZE);
79 Heap = MmAllocateMemoryWithType(MaximumSize, MemoryType);
80 if (!Heap)
81 {
82 ERR("HEAP: Failed to allocate heap of size 0x%lx, Type %lu\n",
83 MaximumSize, MemoryType);
84 return NULL;
85 }
86
87 /* Initialize the heap header */
89 Heap->CurrentAllocBytes = 0;
90 Heap->MaxAllocBytes = 0;
91 Heap->NumAllocs = 0;
92 Heap->NumFrees = 0;
93 Heap->LargestAllocation = 0;
94
95 /* Calculate what's left to process */
96 Remaining = (MaximumSize - sizeof(HEAP)) / sizeof(HEAP_BLOCK);
97 TRACE("Remaining = %ld\n", Remaining);
98
99 /* Substract 2 for the terminating entry (header + free entry) */
100 Remaining -= 2;
101
102 Block = &Heap->Blocks;
103 PreviousSize = 0;
104
105 /* Create free blocks */
106 while (Remaining > 1)
107 {
108 /* Initialize this free block */
109 Block->Size = (USHORT)min(MAXUSHORT, Remaining - 1);
110 Block->PreviousSize = PreviousSize;
111 Block->Tag = 0;
112 Block->Data[0].Flink = (Block - &Heap->Blocks) + Block->Size + 1;
113 Block->Data[0].Blink = (Block - &Heap->Blocks) - 1 - PreviousSize;
114
115 /* Substract current block size from remainder */
116 Remaining -= (Block->Size + 1);
117
118 /* Go to next block */
119 PreviousSize = Block->Size;
120 Block = Block + Block->Size + 1;
121
122 TRACE("Remaining = %ld\n", Remaining);
123 }
124
125 /* Now finish with a terminating block */
126 Heap->TerminatingBlock = Block - &Heap->Blocks;
127 Block->Size = 0;
128 Block->PreviousSize = PreviousSize;
129 Block->Tag = 'dnE#';
130 Block->Data[0].Flink = 0;
131 Block->Data[0].Blink = (Block - &Heap->Blocks) - 1 - PreviousSize;
132 Heap->Blocks.Data[0].Blink = Heap->TerminatingBlock;
133
134 return Heap;
135}
#define ALIGN_UP_BY(size, align)
PVOID MmAllocateMemoryWithType(SIZE_T MemorySize, TYPE_OF_MEMORY MemoryType)
Definition: mm.c:31
struct _HEAP HEAP
#define min(a, b)
Definition: monoChain.cc:55
_In_ ACCESS_MASK _In_opt_ POBJECT_ATTRIBUTES _In_opt_ PLARGE_INTEGER MaximumSize
Definition: mmfuncs.h:362
ULONG_PTR Blink
Definition: heap.c:40
SIZE_T MaximumSize
Definition: heap.c:53
ULONG_PTR SIZE_T
Definition: typedefs.h:80

Referenced by MmInitializeHeap().

◆ FrLdrHeapDestroy()

VOID FrLdrHeapDestroy ( PVOID  HeapHandle)

Definition at line 138 of file heap.c.

140{
141 PHEAP Heap = HeapHandle;
142
143 /* Mark all pages as firmware temporary, so they are free for the kernel */
145 (ULONG_PTR)Heap / MM_PAGE_SIZE,
146 (PFN_COUNT)(Heap->MaximumSize / MM_PAGE_SIZE),
148
149#if DBG
150 /* Make sure everything is dead */
151 RtlFillMemory(Heap, Heap->MaximumSize, 0xCCCCCCCC);
152#endif
153}
PVOID PageLookupTableAddress
Definition: meminit.c:26
VOID MmMarkPagesInLookupTable(PVOID PageLookupTable, PFN_NUMBER StartPage, PFN_NUMBER PageCount, TYPE_OF_MEMORY PageAllocated)
Definition: meminit.c:506
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:599
@ LoaderFirmwareTemporary
Definition: arc.h:179
uint32_t ULONG_PTR
Definition: typedefs.h:65
ULONG PFN_COUNT
Definition: mmtypes.h:102

Referenced by FrLdrHeapCleanupAll().

◆ FrLdrHeapFreeEx()

VOID FrLdrHeapFreeEx ( PVOID  HeapHandle,
PVOID  Pointer,
ULONG  Tag 
)

Definition at line 439 of file heap.c.

443{
444 PHEAP Heap = HeapHandle;
445 PHEAP_BLOCK Block, PrevBlock, NextBlock;
446#if DBG && !defined(_M_ARM)
448#endif
449
450 TRACE("HeapFree(%p, %p)\n", HeapHandle, Pointer);
451 ASSERT(Tag != 'dnE#');
452
453#ifdef FREELDR_HEAP_VERIFIER
454 /* Verify the heap */
455 FrLdrHeapVerify(HeapHandle);
456#endif
457
458 /* Check if the block is really inside this heap */
459 if ((Pointer < (PVOID)(Heap + 1)) ||
460 (Pointer > (PVOID)((PUCHAR)Heap + Heap->MaximumSize)))
461 {
462 ERR("HEAP: trying to free %p outside of heap %p\n", Pointer, Heap);
463 ASSERT(FALSE);
464 }
465
466 Block = ((PHEAP_BLOCK)Pointer) - 1;
467#ifdef FREELDR_HEAP_VERIFIER
468 Block = (PHEAP_BLOCK)((PUCHAR)Block - REDZONE_LOW_OFFSET);
469
470 /* Verify size and redzones */
471 ASSERT(*REDZONE_SIZE(Block) <= Block->Size * sizeof(HEAP_BLOCK));
472 ASSERT(*REDZONE_LOW(Block) == REDZONE_MARK);
473 ASSERT(*REDZONE_HI(Block) == REDZONE_MARK);
474#endif
475
476 /* Check if the tag matches */
477 if ((Tag && (Block->Tag != Tag)) || (Block->Tag == 0))
478 {
479 ERR("HEAP: Bad tag! Pointer=%p: block tag '%.4s', requested '%.4s', size=0x%lx\n",
480 Pointer, &Block->Tag, &Tag, Block->Size);
481 ASSERT(FALSE);
482 }
483
484 /* Mark as free */
485 Block->Tag = 0;
486
487#if DBG
488 /* Erase contents */
489 RtlFillMemory(Block->Data, Block->Size * sizeof(HEAP_BLOCK), 0xCCCCCCCC);
490#endif
491
492 /* Update heap usage */
493 Heap->NumFrees++;
494 Heap->CurrentAllocBytes -= Block->Size * sizeof(HEAP_BLOCK);
495
496 /* Get pointers to the next and previous block */
497 PrevBlock = Block - Block->PreviousSize - 1;
498 NextBlock = Block + Block->Size + 1;
499
500 /* Check if next block is free */
501 if ((NextBlock->Tag == 0) &&
502 ((Block->Size + NextBlock->Size + 1) <= MAXUSHORT))
503 {
504 /* Merge next block into current */
505 Block->Size += NextBlock->Size + 1;
506 FrLdrHeapRemoveFreeList(Heap, NextBlock);
507
508 NextBlock = Block + Block->Size + 1;
509 }
510
511 /* Check if there is a block before and it's free */
512 if ((Block->PreviousSize != 0) && (PrevBlock->Tag == 0) &&
513 ((PrevBlock->Size + Block->Size + 1) <= MAXUSHORT))
514 {
515 /* Merge current block into previous */
516 PrevBlock->Size += Block->Size + 1;
517 Block = PrevBlock;
518 }
519 else
520 {
521 /* Insert the entry into the free list */
522 FrLdrHeapInsertFreeList(Heap, Block);
523 }
524
525 /* Update the next block's back link */
526 NextBlock->PreviousSize = Block->Size;
527#if DBG && !defined(_M_ARM)
528 Heap->FreeTime += (__rdtsc() - Time);
529#endif
530}
struct _HEAP_BLOCK * PHEAP_BLOCK
#define FALSE
Definition: types.h:117

Referenced by ExFreePool(), ExFreePoolWithTag(), FrLdrHeapFree(), FrLdrTempFree(), RtlFreeHeap(), and RtlpFreeMemory().

◆ FrLdrHeapInsertFreeList()

static VOID FrLdrHeapInsertFreeList ( PHEAP  Heap,
PHEAP_BLOCK  FreeBlock 
)
static

Definition at line 299 of file heap.c.

302{
303 PHEAP_BLOCK ListHead, NextBlock;
304 ASSERT(FreeBlock->Tag == 0);
305
306 /* Terminating block serves as free list head */
307 ListHead = &Heap->Blocks + Heap->TerminatingBlock;
308
309 for (NextBlock = &Heap->Blocks + ListHead->Data[0].Flink;
310 NextBlock < FreeBlock;
311 NextBlock = &Heap->Blocks + NextBlock->Data[0].Flink);
312
313 FreeBlock->Data[0].Flink = NextBlock - &Heap->Blocks;
314 FreeBlock->Data[0].Blink = NextBlock->Data[0].Blink;
315 NextBlock->Data[0].Blink = FreeBlock - &Heap->Blocks;
316 NextBlock = &Heap->Blocks + FreeBlock->Data[0].Blink;
317 NextBlock->Data[0].Flink = FreeBlock - &Heap->Blocks;
318}

Referenced by FrLdrHeapAllocateEx(), and FrLdrHeapFreeEx().

◆ FrLdrHeapRelease()

VOID FrLdrHeapRelease ( PVOID  HeapHandle)

Definition at line 182 of file heap.c.

184{
185 PHEAP Heap = HeapHandle;
186 PHEAP_BLOCK Block;
187 PUCHAR StartAddress, EndAddress;
188 PFN_COUNT FreePages, AllFreePages = 0;
189
190 TRACE("HeapRelease(%p)\n", HeapHandle);
191
192 /* Loop all heap chunks */
193 for (Block = &Heap->Blocks;
194 Block->Size != 0;
195 Block = Block + 1 + Block->Size)
196 {
197 /* Continue, if its not free */
198 if (Block->Tag != 0)
199 {
200#ifdef FREELDR_HEAP_VERIFIER
201 /* Verify size and redzones */
202 ASSERT(*REDZONE_SIZE(Block) <= Block->Size * sizeof(HEAP_BLOCK));
203 ASSERT(*REDZONE_LOW(Block) == REDZONE_MARK);
204 ASSERT(*REDZONE_HI(Block) == REDZONE_MARK);
205#endif
206 continue;
207 }
208
209 /* Calculate page aligned start address of the free region */
210 StartAddress = ALIGN_UP_POINTER_BY(Block->Data, PAGE_SIZE);
211
212 /* Walk over adjacent free blocks */
213 while (Block->Tag == 0) Block = Block + Block->Size + 1;
214
215 /* Check if this was the last block */
216 if (Block->Size == 0)
217 {
218 /* Align the end address up to cover the end of the heap */
219 EndAddress = ALIGN_UP_POINTER_BY(Block->Data, PAGE_SIZE);
220 }
221 else
222 {
223 /* Align the end address down to not cover any allocations */
224 EndAddress = ALIGN_DOWN_POINTER_BY(Block->Data, PAGE_SIZE);
225 }
226
227 /* Check if we have free pages */
228 if (EndAddress > StartAddress)
229 {
230 /* Calculate the size of the free region in pages */
231 FreePages = (PFN_COUNT)((EndAddress - StartAddress) / MM_PAGE_SIZE);
232 AllFreePages += FreePages;
233
234 /* Now mark the pages free */
236 (ULONG_PTR)StartAddress / MM_PAGE_SIZE,
237 FreePages,
238 LoaderFree);
239 }
240
241 /* bail out, if it was the last block */
242 if (Block->Size == 0) break;
243 }
244
245 TRACE("HeapRelease() done, freed %lu of %lu pages\n", AllFreePages, Heap->MaximumSize / MM_PAGE_SIZE);
246}
#define PAGE_SIZE
Definition: env_spec_w32.h:49
@ LoaderFree
Definition: arc.h:176
#define ALIGN_UP_POINTER_BY(ptr, align)
Definition: umtypes.h:85
#define ALIGN_DOWN_POINTER_BY(ptr, align)
Definition: umtypes.h:82

Referenced by FrLdrHeapCleanupAll().

◆ FrLdrHeapRemoveFreeList()

static VOID FrLdrHeapRemoveFreeList ( PHEAP  Heap,
PHEAP_BLOCK  Block 
)
static

Definition at line 281 of file heap.c.

284{
285 PHEAP_BLOCK Previous, Next;
286
287 Next = &Heap->Blocks + Block->Data[0].Flink;
288 Previous = &Heap->Blocks + Block->Data[0].Blink;
289 ASSERT((Next->Tag == 0) || (Next->Tag == 'dnE#'));
290 ASSERT(Next->Data[0].Blink == Block - &Heap->Blocks);
291 ASSERT((Previous->Tag == 0) || (Previous->Tag == 'dnE#'));
292 ASSERT(Previous->Data[0].Flink == Block - &Heap->Blocks);
293
294 Next->Data[0].Blink = Previous - &Heap->Blocks;
295 Previous->Data[0].Flink = Next - &Heap->Blocks;
296}

Referenced by FrLdrHeapAllocateEx(), and FrLdrHeapFreeEx().

◆ FrLdrHeapVerify()

VOID FrLdrHeapVerify ( PVOID  HeapHandle)

Definition at line 157 of file heap.c.

159{
160 PHEAP Heap = HeapHandle;
161 PHEAP_BLOCK Block;
162
163 /* Loop all heap chunks */
164 for (Block = &Heap->Blocks;
165 Block->Size != 0;
166 Block = Block + 1 + Block->Size)
167 {
168 /* Continue, if its not free */
169 if (Block->Tag != 0)
170 {
171 /* Verify size and redzones */
172 ASSERT(*REDZONE_SIZE(Block) <= Block->Size * sizeof(HEAP_BLOCK));
173 ASSERT(*REDZONE_LOW(Block) == REDZONE_MARK);
174 ASSERT(*REDZONE_HI(Block) == REDZONE_MARK);
175 continue;
176 }
177 }
178}

Referenced by FrLdrHeapAllocateEx(), and FrLdrHeapFreeEx().

◆ MmInitializeHeap()

VOID MmInitializeHeap ( PVOID  PageLookupTable)

Definition at line 536 of file heap.c.

537{
538 TRACE("MmInitializeHeap()\n");
539
540 /* Create the default heap */
543
544 /* Create a temporary heap */
547
548 TRACE("MmInitializeHeap() done, default heap %p, temp heap %p\n",
550}
#define DEFAULT_HEAP_SIZE
Definition: mm.h:133
#define TEMP_HEAP_SIZE
Definition: mm.h:134
PVOID FrLdrHeapCreate(SIZE_T MaximumSize, TYPE_OF_MEMORY MemoryType)
Definition: heap.c:66
@ LoaderOsloaderHeap
Definition: arc.h:181

Referenced by MmInitializeMemoryManager().

◆ RtlAllocateHeap()

PVOID NTAPI RtlAllocateHeap ( IN PVOID  HeapHandle,
IN ULONG  Flags,
IN SIZE_T  Size 
)
Examples
/srv/doxygen/reactos/win32ss/gdi/gdi32/objects/utils.c.

Definition at line 590 of file heap.c.

594{
595 PVOID ptr;
596
598 if (ptr && (Flags & HEAP_ZERO_MEMORY))
599 {
601 }
602
603 return ptr;
604}
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
static PVOID ptr
Definition: dispmode.c:27
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by __RegisterConsoleVDM(), AccessCheckEmptyMappingTest(), AccessGrantedMultipleObjectsTests(), AccessGrantedNoDaclTests(), AccessGrantedTests(), add_assembly(), add_compat_context(), add_dependent_assembly_id(), add_dll_redirect(), add_entity(), add_entry(), AddBootStoreEntry(), AddBSMRequest(), AddConsoleCtrlHandler(), AddDialogListEntry(), AddDiskToList(), AddNotificationDll(), AddNTOSInstallation(), AddPartitionToDisk(), AddProvider(), AddSfcNotification(), AddVolumeToList(), AfdBind(), AfdConnect(), AfdCreateSocket(), AfdSendTo(), AllowAccessOnSession(), AllowDesktopAccessToUser(), AllowWinstaAccessToUser(), AppendGenericListEntry(), ApphelpCheckRunAppEx(), AttachToConsoleInternal(), AVrfInitializeVerifier(), BaseCheckVDM(), BaseInitializeStaticServerData(), BasepAllocateActivationContextActivationBlock(), BasepComputeProcessPath(), BasepGetVolumeNameFromReparsePoint(), BasepIsProcessAllowed(), BasepMoveFileDelayed(), BaseQuerySystemFirmware(), BaseSrvCopyCommand(), BaseSrvCreateConsoleRecord(), BaseSrvInitializeIniFileMappings(), build_assembly_dir(), build_assembly_id(), build_clr_surrogate_section(), build_comserver_section(), build_dllredirect_section(), build_ifaceps_section(), build_progid_section(), build_tlib_section(), build_wndclass_section(), BuildSubSysCommandLine(), CallNt(), calloc(), CheckForCurrentHostname(), CheckTokenMembership(), clean_main(), CliImmInitializeHotKeys(), cmdGroup(), cmdLocalGroup(), com_class_add_progid(), CommandDumpSector(), CommandPartInfo(), ConsoleCreateFileHandler(), ConvertBitmapInfo(), ConvertThreadToFiberEx(), ConvertToSelfRelative(), create_lost_and_found(), CreateApplicationDesktopSecurity(), CreateBaseAcls(), CreateDefaultProcessSecurityCommon(), CreateDirectoryExW(), CreateExtendedPartition(), CreateFiberEx(), CreateFileSystemList(), CreateFileW(), CreateGenericList(), CreateHardLinkW(), CreateHardwareTimer(), CreateInsertBlankRegion(), CreateLogicalPartition(), CreateNewDefaultDacl(), CreatePartitionList(), CreatePrimaryPartition(), CreateProcessInternalW(), CreateProgressBarEx(), CreateRecordForIpAddress(), CreateScreenSaverSecurity(), CreateSymbolicLinkW(), CreateUmaDescriptor(), CreateWinlogonDesktopSecurity(), CreateWinstaSecurity(), CSR_API(), CsrAllocateCaptureBuffer(), CsrAllocateNtSession(), CsrAllocateProcess(), CsrAllocateThread(), CsrApiPortInitialize(), CsrCaptureArguments(), CsrCreateLocalSystemSD(), CsrGetProcessLuid(), CsrInitCsrRootProcess(), CsrInitializeWait(), CsrLoadServerDll(), CsrpConnectToServer(), CsrSbApiPortInitialize(), CsrSetProcessSecurity(), CsrSrvCreateSharedSection(), DefaultProcessEntry(), DenyAccessTests(), DesktopHeapAlloc(), DesktopHeapReAlloc(), DisplayGroup(), DisplayLocalGroup(), DisplayMessage(), DnsAcquireContextHandle_W(), DnsApiAlloc(), DnsCToW(), DnsQuery_CodePage(), DnsUTF8ToW(), DnsWToC(), DnsWToUTF8(), do_reg_operation(), DosCreateDeviceNode(), DosReadFile(), DosStart(), DosStartProcess32(), DosWriteFile(), DumpDisk(), DumpPartition(), DuplicateQuotedString(), DuplicateString(), DuplicateTokenAsEffective(), EMFDC_WriteEscape(), EMFDC_WriteNamedEscape(), EmsDrvInitialize(), EmulatorCopyMemory(), EngCreateSemaphore(), EnumDisplaySettingsExA(), EnumDisplaySettingsExW(), EnumerateBiosDiskEntries(), EnumHKCRKey(), EnumHKCRValue(), EnumPropsA(), EnumPropsExA(), EnumPropsExW(), EnumPropsW(), ExpandEnvironmentStringsA(), ext2_add_entry(), ext2_alloc_block(), ext2_allocate_block_bitmap(), ext2_allocate_group_desc(), ext2_allocate_inode_bitmap(), ext2_build_bdl(), ext2_expand_block(), ext2_get_block(), ext2_new_dir_block(), ext2_write_block_bitmap(), ext2_write_inode_bitmap(), Ext2ReadDisk(), Ext2WriteDisk(), Fat12WriteBootSector(), Fat12WriteFAT(), Fat12WriteRootDirectory(), Fat16WriteBootSector(), Fat16WriteFAT(), Fat16WriteRootDirectory(), Fat32WriteBootSector(), Fat32WriteFAT(), Fat32WriteFsInfo(), Fat32WriteRootDirectory(), FatWipeSectors(), Fatx16WriteFAT(), Fatx32WriteFAT(), FatxWriteBootSector(), FatxWriteRootDirectory(), FilterConnectCommunicationPort(), FilterLoadUnload(), find_actctx_dll(), FindFirstFileExW(), FindFirstStreamW(), FindFirstVolumeA(), FindFirstVolumeW(), FindNextVolumeA(), FlsAlloc(), FlsSetValue(), FreeLdrEnumerateBootEntries(), get_buffer(), get_manifest_in_associated_manifest(), get_module_filename(), GetAccountDomainSid(), GetBuiltinDomainSid(), GetClipboardFormatNameA(), GetComputerIdentifier(), GetComputerNameExA(), GetComputerNameFromRegistry(), GetDisplayIdentifier(), GetDosDevicesProtection(), GetEnvironmentStringsA(), GetEnvironmentStringsW(), GetEnvironmentVariableA(), GetFinalPathNameByHandleA(), GetFullPathNameA(), GetKeyName(), GetLongPathNameA(), GetLongPathNameW(), GetModuleFileNameA(), GetNamedPipeHandleStateA(), GetNtAuthorityDomainSid(), GetShortPathNameA(), GetShortPathNameW(), GetSiteSidFromToken(), GetStartupInfoA(), GetSystemTimes(), GetTempFileNameA(), GetVolumeExtents(), GetVolumeInformationA(), GetVolumeInformationW(), GetVolumeNameForRoot(), GetVolumeNameForVolumeMountPointA(), GetVolumePathNameA(), GetVolumePathNamesForVolumeNameA(), GetVolumePathNamesForVolumeNameW(), GetVolumePathNameW(), GlobalAlloc(), GlobalReAlloc(), GrantedAccessTests(), HEAP_alloc(), INF_GetDataField(), IniCacheAddKeyAorW(), IniCacheAddSectionAorW(), IniCacheCreate(), IniCacheLoadByHandle(), IniCacheSaveByHandle(), IniFindFirstValue(), InitFunctionPtrs(), InitializeFmIfsOnce(), InitTTFontCache(), InitVolume(), InstallDevice(), IntEnumFontFamilies(), InternalExplicitAccessAToW(), InternalGetAtomName(), InternalTrusteeAToW(), IntWriteConsoleOutput(), IsAcpiComputer(), IsGlobalDeviceMap(), IsGlobalSymbolicLink(), LdrGetDllHandleEx(), LdrpAllocateDataTableEntry(), LdrpAllocateTls(), LdrpAllocateUnicodeString(), LdrpCheckForKnownDll(), LdrpGetProcedureAddress(), LdrpInitializeDotLocalSupport(), LdrpInitializeProcess(), LdrpInitializeProcessCompat(), LdrpInitializeTls(), LdrpResolveDllName(), LdrpRunInitializeRoutines(), LdrpSearchPath(), LdrQueryImageFileKeyOption(), LoadAllocStringW(), LoadInstallableVDD(), LoadLibraryA(), LoadModule(), LoadPrinterDriver(), LocalAlloc(), LocalReAlloc(), LogfAllocAndBuildNewRecord(), LogfpAlloc(), LogonUserExW(), lookup_assembly(), lookup_manifest_file(), lookup_winsxs(), LsaApLogonUserEx2(), LsapAddAuthPackage(), LsapAddDefaultGroups(), LsapAddLocalGroups(), LsapAddNotification(), LsapAddPrivilegeToTokenPrivileges(), LsapAddSamGroups(), LsapAllocateHeap(), LsapAllocateHeapZero(), LsapAppendSidToGroups(), LsapCallAuthenticationPackage(), LsapCheckLogonProcess(), LsapCopyLocalGroups(), LsapCreateAccountSd(), LsapCreateDatabaseObjects(), LsapCreateDbObject(), LsapCreateLogonSession(), LsapCreatePolicySd(), LsapCreateSecretSd(), LsapCreateSid(), LsapCreateTokenSd(), LsapEnumLogonSessions(), LsapGetDomainInfo(), LsapGetLogonSessionData(), LsapIsTrustedClient(), LsapLogonUser(), LsapOpenDbObject(), LsapRegEnumerateSubKey(), LsapRegEnumerateValue(), LsapRegQueryValue(), LsapSetLogonSessionData(), LsarAddAccountRights(), LsarEnumerateAccounts(), LsarEnumerateAccountsWithUserRight(), LsarRemoveAccountRights(), LsarSetAccountDomain(), LsarSetAuditEvents(), LsarSetPrimaryDomain(), LsarSetSecurityObject(), main(), malloc(), MBToWCSEx(), MemInstallFastMemoryHook(), MessageBoxTextToClipboard(), midl_user_allocate(), MoveFileWithProgressW(), MsgiAnsiToUnicodeMessage(), MsgiUnicodeToAnsiMessage(), MSZipAlloc(), MyLogonUser(), NetGroupSetUsers(), NtLdrEnumerateBootEntries(), NtProcessStartup(), OpenIniBootLoaderStore(), ParamsValidationTests(), ParamValidationNoObjsList(), parse_manifest(), PeekNamedPipe(), PNP_RegisterNotification(), PnpEventThread(), PrintMessageAnsi(), ProcessLangEntry(), Query_Main(), QueryDosDeviceA(), QueryDosDeviceW(), QueryFullProcessImageNameA(), QueryFullProcessImageNameW(), QueryOriginalDefaultDacl(), QueryTokenDefaultDaclTests(), QueryTokenGroupsTests(), QueryTokenOwnerTests(), QueryTokenPrimaryGroupTests(), QueryTokenPrivilegesAndGroupsTests(), QueryTokenPrivilegesTests(), QueryTokenRestrictedSidsTest(), QueryTokenSourceTests(), QueryTokenStatisticsTests(), QueryTokenUserTests(), ReadBootCodeByHandle(), ReadDisk(), RegDeleteTreeW(), RegEnumKeyExA(), RegEnumKeyExW(), RegEnumValueA(), RegOpenUserClassesRoot(), RegpCopyTree(), RegQueryInfoKeyW(), RegQueryValueExA(), RemoveDirectoryW(), ReplaceFileW(), RosSymAllocMemUM(), RtlAcquirePrivilege(), RtlActivateActivationContextEx(), RtlAddAttributeActionToRXact(), RtlCopySecurityDescriptor(), RtlCreateActivationContext(), RtlCreateProcessParameters(), RtlCreateTimer(), RtlCreateTimerQueue(), RtlDebugAllocateHeap(), RtlDefaultNpAcl(), RtlDosSearchPath_U(), RtlGetFullPathName_Ustr(), RtlInitializeRXact(), RtlMultipleAllocateHeap(), RtlpAddVectoredHandler(), RtlpAllocateDebugInfo(), RtlpAllocateMemory(), RtlpAllocAtomTable(), RtlpAllocAtomTableEntry(), RtlpCheckDeviceName(), RtlpDosPathNameToRelativeNtPathName_Ustr(), RtlpNtEnumerateSubKey(), RtlpNtQueryValueKey(), RtlpSetSecurityObject(), RtlpWin32NTNameToNtPathName_U(), RtlQueueWorkItem(), RtlReAllocateHeap(), RtlRegisterWait(), RtlSetCurrentDirectory_U(), RtlStartRXact(), SampCreateAccountDomainSD(), SampCreateAccountSid(), SampCreateAliasSD(), SampCreateBuiltinDomainSD(), SampCreateDbObject(), SampCreateGroupSD(), SampCreateServerSD(), SampCreateUserSD(), SampDeleteAccountDbObject(), SampFillUserDisplayCache(), SampInitializeSAM(), SampOpenDbObject(), SampRegEnumerateSubKey(), SampRegEnumerateValue(), SampRegQueryValue(), SamrSetSecurityObject(), SamValidateUser(), SaveProcessHandle(), SaveThreadHandle(), ScAllocateAndInitializeSid(), ScanForUnpartitionedDiskSpace(), ScDomainIdToSid(), ScmCreateAcls(), ScmCreateDefaultSD(), ScmCreateDefaultServiceSD(), ScmCreatePipeSD(), ScmCreateSids(), ScmReadSecurityDescriptor(), SdbPackAppCompatData(), SdbpAlloc(), SearchPathA(), SetAdministratorPassword(), SetDIBitsToDevice(), SetFileShortNameW(), SetupMoveFile(), SetupOpenFileQueue(), SetupQueueCopyWithCab(), SetupQueueDeleteW(), SetupQueueRenameW(), SetVolumeLabelW(), ShowFileSystemInfo(), SmLookupSubsystem(), SmpAcquirePrivilege(), SmpAllocateSessionId(), SmpConfigureEnvironment(), SmpCreateEmergencyPagingFile(), SmpCreatePagingFileDescriptor(), SmpCreateSecurityDescriptors(), SmpCreateVolumeDescriptors(), SmpHandleConnectionRequest(), SmpInitializeKnownDllPath(), SmpLoadSubSystem(), SmpParseCommandLine(), SmpParseToken(), SmpProcessFileRenames(), SmpSaveRegistryValue(), SmpSbCreateSession(), SoftModalMessageBox(), split(), START_TEST(), StartServiceCtrlDispatcherA(), StartServiceCtrlDispatcherW(), strdupW(), StretchDIBits(), SystemConfigurationDataQueryRoutine(), Test_KeyFullInformation(), Test_KeyNameInformation(), test_specialhandling(), TlsAlloc(), TlsSetValue(), User32CreateWindowEx(), UserHeapAlloc(), UserHeapReAlloc(), UserInitializeDesktop(), UserpCaptureStringParameters(), UserpFormatMessages(), UserpGetClientFileName(), UserpShowInformationBalloon(), VDDInstallMemoryHook(), VDDInstallUserHook(), VgaInitializePalette(), WaitForMultipleObjectsEx(), WaitNamedPipeW(), WCSToMBEx(), wine_get_dos_file_name(), WriteConsoleOutputCharacterA(), WriteConsoleOutputCharacterW(), WriteDisk(), xmlstrdupW(), xstrsave(), xstrsaveA(), zap_sector(), and zero_blocks().

◆ RtlFreeHeap()

BOOLEAN NTAPI RtlFreeHeap ( IN PVOID  HeapHandle,
IN ULONG  Flags,
IN PVOID  HeapBase 
)

Definition at line 608 of file heap.c.

612{
614 return TRUE;
615}
#define TRUE
Definition: types.h:120
_In_opt_ PVOID HeapBase
Definition: rtlfuncs.h:2181

Referenced by __RegisterConsoleVDM(), _tmain(), AccessCheckEmptyMappingTest(), AccessGrantedMultipleObjectsTests(), AccessGrantedNoDaclTests(), AccessGrantedTests(), AccpOpenNamedObject(), actctx_release(), add_entry(), AddBootStoreEntry(), AddConsoleCtrlHandler(), AddDiskToList(), AddNotificationDll(), AddProvider(), AddSfcNotification(), AddVolumeToList(), AfdBind(), AfdConnect(), AfdCreateSocket(), AfdSendTo(), AllowAccessOnSession(), AllowDesktopAccessToUser(), AllowWinstaAccessToUser(), AttachToConsoleInternal(), AVrfInitializeVerifier(), BackupEventLogW(), BaseCheckRunApp(), BaseCheckVDM(), BasepComputeProcessPath(), BasepFreeActivationContextActivationBlock(), BasepFreeAppCompatData(), BasepGetVolumeNameFromReparsePoint(), BasepIsProcessAllowed(), BasepMoveFileDelayed(), BasePushProcessParameters(), BaseQuerySystemFirmware(), BaseRundownFls(), BaseSrvBSMThread(), BaseSrvCleanupVDMResources(), BaseSrvDestroyConsoleRecord(), BaseSrvFreeVDMInfo(), build_clr_surrogate_section(), build_comserver_section(), build_ifaceps_section(), build_progid_section(), build_tlib_section(), CallNt(), ChangeDisplaySettingsExA(), CheckForCurrentHostname(), CheckTokenMembership(), clean_main(), CleanupNotifications(), ClearEventLogW(), ClearTTFontCache(), CliImmInitializeHotKeys(), CloseAllProcessHandles(), CloseIniBootLoaderStore(), cmdGroup(), cmdLocalGroup(), CommandDumpSector(), CommandPartInfo(), ConvertFiberToThread(), ConvertToSelfRelative(), create_lost_and_found(), CreateApplicationDesktopSecurity(), CreateBaseAcls(), CreateDefaultProcessSecurityCommon(), CreateDIBitmap(), CreateDIBPatternBrush(), CreateDIBPatternBrushPt(), CreateDIBSection(), CreateDirectoryExW(), CreateDirectoryW(), CreateFiberEx(), CreateFileW(), CreateHardLinkW(), CreateMailslotW(), CreateNamedPipeW(), CreateNewDefaultDacl(), CreatePartitionList(), CreateProcessAsUserCommon(), CreateProcessInternalA(), CreateProcessInternalW(), CreateRecordForIpAddress(), CreateScreenSaverSecurity(), CreateSymbolicLinkA(), CreateSymbolicLinkW(), CreateWindowStationAndDesktops(), CreateWinlogonDesktopSecurity(), CreateWinstaSecurity(), CSR_API(), CsrCaptureArguments(), CsrCreateLocalSystemSD(), CsrCreateWait(), CsrDeallocateProcess(), CsrDeallocateThread(), CsrDereferenceNtSession(), CsrDereferenceWait(), CsrFreeCaptureBuffer(), CsrGetProcessLuid(), CsrLoadServerDll(), CsrNotifyWaitBlock(), CsrReleaseCapturedArguments(), CsrSbApiPortInitialize(), CsrSetProcessSecurity(), DeleteFiber(), DeleteFileW(), DeletePartition(), DenyAccessTests(), DesktopHeapFree(), DesktopHeapReAlloc(), DestroyFileSystemList(), DestroyGenericList(), DestroyHardwareTimer(), DestroyPartitionList(), DestroyProgressBar(), DestroyRegion(), DestroyVolumeList(), DeviceInstallThread(), DismountPartition(), DisplayGroup(), DisplayLocalGroup(), DisplayMessage(), disposeResInfo(), DnsAcquireContextHandle_W(), DnsApiFree(), DnsFlushResolverCacheEntry_A(), DnsFlushResolverCacheEntry_UTF8(), DnsFree(), DnsIntFreeRecordList(), DnsQuery_CodePage(), DnsReleaseContextHandle(), do_reg_operation(), DosDeleteDevice(), DosReadFile(), DosStartProcess32(), DosWriteFile(), DumpDisk(), DumpPartition(), DuplicateTokenAsEffective(), EMFDC_WriteEscape(), EMFDC_WriteNamedEscape(), EmsDrvCleanup(), EmsDrvInitialize(), EngDeleteSemaphore(), EnumDisplaySettingsExA(), EnumDisplaySettingsExW(), EnumerateBiosDiskEntries(), EnumHKCRKey(), EnumHKCRValue(), EnumPropsA(), EnumPropsExA(), EnumPropsExW(), EnumPropsW(), ExpandEnvironmentStringsA(), ext2_alloc_block(), ext2_allocate_block_bitmap(), ext2_allocate_inode_bitmap(), ext2_build_bdl(), ext2_expand_block(), ext2_free_generic_bitmap(), ext2_free_group_desc(), ext2_get_block(), ext2_mkdir(), ext2_read_inode(), ext2_write_block_bitmap(), ext2_write_inode(), ext2_write_inode_bitmap(), Ext2ReadDisk(), Ext2WriteDisk(), ExtCreatePen(), Fat12WriteBootSector(), Fat12WriteFAT(), Fat12WriteRootDirectory(), Fat16WriteBootSector(), Fat16WriteFAT(), Fat16WriteRootDirectory(), Fat32WriteBootSector(), Fat32WriteFAT(), Fat32WriteFsInfo(), Fat32WriteRootDirectory(), FatWipeSectors(), Fatx16WriteFAT(), Fatx32WriteFAT(), FatxWriteBootSector(), FatxWriteRootDirectory(), FilterConnectCommunicationPort(), FilterLoadUnload(), find_actctx_dll(), find_clr_surrogate(), find_cominterface_redirection(), find_comserver_redirection(), find_dll_redirection(), find_progid_redirection(), find_tlib_redirection(), find_window_class(), FindClose(), FindFirstChangeNotificationW(), FindFirstFileExW(), FindFirstStreamW(), FindFirstVolumeA(), FindFirstVolumeW(), FindNextVolumeA(), FindVolumeClose(), free(), free_assembly_identity(), free_depend_manifests(), free_entity_array(), FreeBootCode(), FreeDosDevicesProtection(), FreeEnvironmentStringsA(), FreeEnvironmentStringsW(), FreeLdrEnumerateBootEntries(), freep(), FreeUmaDescriptor(), GetBuiltinDomainSid(), GetClipboardFormatNameA(), GetComputerIdentifier(), GetComputerNameExA(), GetComputerNameFromRegistry(), GetDiskFreeSpaceExW(), GetDiskFreeSpaceW(), GetDisplayIdentifier(), GetDosDevicesProtection(), GetDriveTypeW(), GetEnvironmentStringsA(), GetEnvironmentVariableA(), GetFileSecurityW(), GetFinalPathNameByHandleA(), GetFontResourceInfoW(), GetFullPathNameA(), GetKeyName(), GetLongPathNameA(), GetLongPathNameW(), GetModuleFileNameA(), GetModuleHandleForUnicodeString(), GetNamedPipeHandleStateA(), GetShortPathNameA(), GetShortPathNameW(), GetSiteSidFromToken(), GetStartupInfoA(), GetSystemTimes(), GetTempFileNameA(), GetVolumeExtents(), GetVolumeInformationA(), GetVolumeInformationW(), GetVolumeNameForRoot(), GetVolumeNameForVolumeMountPointA(), GetVolumePathNameA(), GetVolumePathNamesForVolumeNameA(), GetVolumePathNamesForVolumeNameW(), GetVolumePathNameW(), GlobalFree(), GlobalReAlloc(), GrantedAccessTests(), HEAP_free(), INF_FreeData(), INF_GetDataField(), IniCacheAddKeyAorW(), IniCacheAddSectionAorW(), IniCacheDestroy(), IniCacheFreeKey(), IniCacheFreeSection(), IniCacheLoadByHandle(), IniCacheSaveByHandle(), IniFindClose(), InitFunctionPtrs(), InitializeFmIfsOnce(), InstallDevice(), InstallReactOS(), IntEnumFontFamilies(), InternalExplicitAccessAToW(), InternalFreeConvertedTrustee(), InternalGetAtomName(), InternalTrusteeAToW(), IntWriteConsoleOutput(), IsAcpiComputer(), IsGlobalDeviceMap(), IsGlobalSymbolicLink(), LdrGetDllHandleEx(), LdrpCheckForKnownDll(), LdrpCheckForLoadedDll(), LdrpFinalizeAndDeallocateDataTableEntry(), LdrpFreeTls(), LdrpFreeUnicodeString(), LdrpGetProcedureAddress(), LdrpInitializeDotLocalSupport(), LdrpMapDll(), LdrpResolveDllName(), LdrpRunInitializeRoutines(), LdrpSearchPath(), LdrQueryImageFileKeyOption(), LdrShutdownThread(), LoadInstallableVDD(), LoadLibraryA(), LoadLibraryExW(), LoadModule(), LoadPrinterDriver(), LocalReAlloc(), LogfFreeRecord(), LogfpFree(), LogonUserExW(), lookup_assembly(), lookup_manifest_file(), lookup_winsxs(), LsaApLogonUserEx2(), LsaFreeMemory(), LsapAddAuthPackage(), LsapAddDefaultGroups(), LsapAddLocalGroups(), LsapAddNotification(), LsapAddPrivilegeToTokenPrivileges(), LsapAddSamGroups(), LsapAppendSidToGroups(), LsapCallAuthenticationPackage(), LsapCloseDbObject(), LsapCopyLocalGroups(), LsapCreateAccountSd(), LsapCreateDatabaseObjects(), LsapCreateLogonSession(), LsapCreatePolicySd(), LsapCreateSecretSd(), LsapCreateSid(), LsapCreateTokenSd(), LsapDeleteDbObject(), LsapDeleteLogonSession(), LsapDeregisterLogonProcess(), LsapEnumLogonSessions(), LsapFreeHeap(), LsapGetDomainInfo(), LsapGetLogonSessionData(), LsapIsTrustedClient(), LsapLogonUser(), LsapRegEnumerateSubKey(), LsapRegEnumerateValue(), LsapRegQueryValue(), LsapRemoveNotification(), LsapSetLogonSessionData(), LsarAddAccountRights(), LsarCreateSecret(), LsarEnumerateAccounts(), LsarEnumerateAccountsWithUserRight(), LsarpCreateAccount(), LsarRemoveAccountRights(), LsarSetAccountDomain(), LsarSetAuditEvents(), LsarSetPrimaryDomain(), LsarSetSecurityObject(), main(), MemCleanup(), MemRemoveFastMemoryHook(), MessageBoxTextToClipboard(), MessageBoxTimeoutIndirectW(), midl_user_free(), MoveFileWithProgressW(), MsgiAnsiToUnicodeCleanup(), MsgiUnicodeToAnsiCleanup(), MsgiUnicodeToAnsiMessage(), MSZipFree(), MyLogonUser(), NetGroupSetUsers(), NetUserEnum(), NetUserGetGroups(), NetUserGetInfo(), NetUserGetLocalGroups(), NetUserModalsGet(), NtLdrEnumerateBootEntries(), OpenAccountDomain(), OpenBackupEventLogW(), OpenBuiltinDomain(), OpenFile(), OpenIniBootLoaderStore(), ParamsValidationTests(), ParamValidationNoObjsList(), parse_add_interface_class(), parse_cominterface_proxy_stub_elem(), parse_dependent_assembly_elem(), parse_manifest(), PeekNamedPipe(), PerformMount(), PNP_RegisterNotification(), PNP_UnregisterNotification(), PnpEventThread(), PrintMessageAnsi(), PrivMoveFileIdentityW(), Query_Main(), QueryDosDeviceA(), QueryDosDeviceW(), QueryFullProcessImageNameA(), QueryFullProcessImageNameW(), QueryOriginalDefaultDacl(), QueryTokenDefaultDaclTests(), QueryTokenGroupsTests(), QueryTokenOwnerTests(), QueryTokenPrimaryGroupTests(), QueryTokenPrivilegesAndGroupsTests(), QueryTokenPrivilegesTests(), QueryTokenRestrictedSidsTest(), QueryTokenSourceTests(), QueryTokenStatisticsTests(), QueryTokenUserTests(), queue_remove_timer(), read_bitmaps(), ReadBootCodeByHandle(), ReadDisk(), RegDeleteTreeW(), RegEnumKeyExA(), RegEnumKeyExW(), RegEnumValueA(), RegisterInShimCache(), RegLoadKeyW(), RegOpenUserClassesRoot(), RegpCopyTree(), RegQueryInfoKeyW(), RegQueryValueExA(), RegReplaceKeyW(), RegRestoreKeyW(), RegSaveKeyW(), RemoveComSpecInfo(), RemoveDialogListEntry(), RemoveDirectoryW(), RemoveHandles(), RemoveVolume(), ReplaceFileW(), RosSymFreeMemUM(), RtlAbortRXact(), RtlAcquirePrivilege(), RtlAddAttributeActionToRXact(), RtlCreateActivationContext(), RtlCreateTimer(), RtlCreateTimerQueue(), RtlCreateUserSecurityObject(), RtlDeactivateActivationContext(), RtlDebugFreeHeap(), RtlDefaultNpAcl(), RtlDeleteSecurityObject(), RtlDeregisterWaitEx(), RtlDestroyProcessParameters(), RtlDoesFileExists_UstrEx(), RtlDosSearchPath_U(), RtlFreeLargeString(), RtlFreeThreadActivationContextStack(), RtlGetFullPathName_Ustr(), RtlInitializeRXact(), RtlMultipleFreeHeap(), RtlpCallVectoredHandlers(), RtlpCheckDeviceName(), RtlpDosPathNameToRelativeNtPathName_Ustr(), RtlpDphFreeDelayedBlocksFromHeap(), RtlpExecuteIoWorkItem(), RtlpExecuteWorkItem(), RtlpFreeAtomTable(), RtlpFreeAtomTableEntry(), RtlpFreeDebugInfo(), RtlpFreeMemory(), RtlpNtEnumerateSubKey(), RtlpNtQueryValueKey(), RtlpRemoveVectoredHandler(), RtlpSetSecurityObject(), RtlQueryInformationActivationContext(), RtlQueueWorkItem(), RtlReAllocateHeap(), RtlRegisterWait(), RtlReleasePrivilege(), RtlReleaseRelativeName(), RtlSetCurrentDirectory_U(), RunApphelpCacheControlTests(), SampCloseDbObject(), SampCreateAccountDomainSD(), SampCreateAccountSid(), SampCreateAliasSD(), SampCreateBuiltinDomainSD(), SampCreateDbObject(), SampCreateGroupSD(), SampCreateServerSD(), SampCreateUserSD(), SampDeleteAccountDbObject(), SampInitializeSAM(), SampOpenDbObject(), SampRegEnumerateSubKey(), SampRegEnumerateValue(), SampRegQueryValue(), SampSetupCreateAliasAccount(), SampSetupCreateDomain(), SampSetupCreateGroupAccount(), SampSetupCreateServer(), SampSetupCreateUserAccount(), SamrCreateAliasInDomain(), SamrCreateGroupInDomain(), SamrCreateUser2InDomain(), SamrCreateUserInDomain(), SamrSetSecurityObject(), SamValidateNormalUser(), ScDomainIdToSid(), ScmCreateDefaultServiceSD(), ScmFreeAcls(), ScmFreeDefaultSD(), ScmFreePipeSD(), ScmFreeSids(), ScmReadSecurityDescriptor(), SdbPackAppCompatData(), SdbpFree(), SearchPathA(), SearchPathW(), SetConsoleOutputCP(), SetDIBitsToDevice(), SetEntriesInAclA(), SetFileAttributesW(), SetFileSecurityW(), SetFileShortNameW(), SetTokenDefaultDaclTests(), SetupCloseFileQueue(), SetupDeleteQueueEntry(), SetupMoveFile(), SetupQueueCopyWithCab(), SetupQueueDeleteW(), SetupQueueRenameW(), SetVolumeLabelW(), ShowFileSystemInfo(), SmLookupSubsystem(), SmpAcquirePrivilege(), SmpCreatePagingFileDescriptor(), SmpCreateSecurityDescriptors(), SmpCreateVolumeDescriptors(), SmpDeleteSession(), SmpDereferenceSubsystem(), SmpExecuteCommand(), SmpExecuteInitialCommand(), SmpHandleConnectionRequest(), SmpInitializeDosDevices(), SmpInitializeKnownDlls(), SmpInitializeKnownDllsInternal(), SmpLoadDataFromRegistry(), SmpLoadSubSystem(), SmpLoadSubSystemsForMuSession(), SmpParseCommandLine(), SmpProcessFileRenames(), SmpReleasePrivilege(), SmpSaveRegistryValue(), SoftModalMessageBox(), split(), START_TEST(), StartServiceCtrlDispatcherA(), StartServiceCtrlDispatcherW(), StretchDIBits(), Test_ApphelpCheckRunApp(), Test_KeyFullInformation(), Test_KeyNameInformation(), Test_Shimdata(), test_specialhandling(), timer_queue_thread_proc(), UserHeapFree(), UserHeapReAlloc(), UserpCaptureStringParameters(), UserpFreeStringParameters(), UserpGetClientFileName(), UserpShowInformationBalloon(), VDDDeInstallMemoryHook(), VDDDeInstallUserHook(), VDDInstallMemoryHook(), VgaInitializePalette(), Wait_thread_proc(), WaitForMultipleObjectsEx(), WaitNamedPipeW(), wine_get_dos_file_name(), WriteConsoleOutputCharacterA(), WriteConsoleOutputCharacterW(), WriteDisk(), zap_sector(), and zero_blocks().

Variable Documentation

◆ FrLdrDefaultHeap

◆ FrLdrTempHeap

PVOID FrLdrTempHeap

Definition at line 35 of file heap.c.

Referenced by FrLdrHeapCleanupAll(), FrLdrTempAlloc(), FrLdrTempFree(), and MmInitializeHeap().