Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

heap.h File Reference

#include <heappage.h>

Go to the source code of this file.

Classes

struct  _HEAP_ENTRY
struct  _HEAP_ENTRY_EXTRA
struct  _HEAP_FREE_ENTRY_EXTRA
struct  _HEAP_VIRTUAL_ALLOC_ENTRY
struct  _HEAP_FREE_ENTRY
struct  _HEAP_UNCOMMMTTED_RANGE
struct  _HEAP_SEGMENT
struct  _HEAP_LOCK
struct  _HEAP_UCR_SEGMENT
struct  _HEAP_TAG_ENTRY
struct  _HEAP_PSEUDO_TAG_ENTRY
struct  _HEAP
struct  _HEAP_STOP_ON_TAG
struct  _HEAP_STOP_ON_VALUES

Defines

#define HEAP_LARGE_TAG_MASK   0xFF000000
#define ROUND_UP_TO_POWER2(x, n)   (((ULONG_PTR)(x) + ((n)-1)) & ~((ULONG_PTR)(n)-1))
#define ROUND_DOWN_TO_POWER2(x, n)   ((ULONG_PTR)(x) & ~((ULONG_PTR)(n)-1))
#define HEAP_GRANULARITY   ((LONG) sizeof( HEAP_ENTRY ))
#define HEAP_GRANULARITY_SHIFT   3
#define HEAP_MAXIMUM_BLOCK_SIZE   (USHORT)(((0x10000 << HEAP_GRANULARITY_SHIFT) - PAGE_SIZE) >> HEAP_GRANULARITY_SHIFT)
#define HEAP_MAXIMUM_FREELISTS   128
#define HEAP_MAXIMUM_SEGMENTS   64
#define HEAP_ENTRY_BUSY   0x01
#define HEAP_ENTRY_EXTRA_PRESENT   0x02
#define HEAP_ENTRY_FILL_PATTERN   0x04
#define HEAP_ENTRY_VIRTUAL_ALLOC   0x08
#define HEAP_ENTRY_LAST_ENTRY   0x10
#define HEAP_ENTRY_SETTABLE_FLAG1   0x20
#define HEAP_ENTRY_SETTABLE_FLAG2   0x40
#define HEAP_ENTRY_SETTABLE_FLAG3   0x80
#define HEAP_ENTRY_SETTABLE_FLAGS   0xE0
#define HEAP_SEGMENT_SIGNATURE   0xFFEEFFEE
#define HEAP_SEGMENT_USER_ALLOCATED   (ULONG)0x00000001
#define HEAP_SIGNATURE   (ULONG)0xEEFFEEFF
#define HEAP_LOCK_USER_ALLOCATED   (ULONG)0x80000000
#define HEAP_VALIDATE_PARAMETERS_ENABLED   (ULONG)0x40000000
#define HEAP_VALIDATE_ALL_ENABLED   (ULONG)0x20000000
#define HEAP_SKIP_VALIDATION_CHECKS   (ULONG)0x10000000
#define HEAP_CAPTURE_STACK_BACKTRACES   (ULONG)0x08000000
#define CHECK_HEAP_TAIL_SIZE   HEAP_GRANULARITY
#define CHECK_HEAP_TAIL_FILL   0xAB
#define FREE_HEAP_FILL   0xFEEEFEEE
#define ALLOC_HEAP_FILL   0xBAADF00D
#define HEAP_MAXIMUM_SMALL_TAG   0xFF
#define HEAP_SMALL_TAG_MASK   (HEAP_MAXIMUM_SMALL_TAG << HEAP_TAG_SHIFT)
#define HEAP_NEED_EXTRA_FLAGS
#define HEAP_NUMBER_OF_PSEUDO_TAG   (HEAP_MAXIMUM_FREELISTS+1)

Typedefs

typedef _HEAP_ENTRY HEAP_ENTRY
typedef _HEAP_ENTRYPHEAP_ENTRY
typedef _HEAP_ENTRY_EXTRA HEAP_ENTRY_EXTRA
typedef _HEAP_ENTRY_EXTRAPHEAP_ENTRY_EXTRA
typedef _HEAP_FREE_ENTRY_EXTRA HEAP_FREE_ENTRY_EXTRA
typedef _HEAP_FREE_ENTRY_EXTRAPHEAP_FREE_ENTRY_EXTRA
typedef _HEAP_VIRTUAL_ALLOC_ENTRY HEAP_VIRTUAL_ALLOC_ENTRY
typedef _HEAP_VIRTUAL_ALLOC_ENTRYPHEAP_VIRTUAL_ALLOC_ENTRY
typedef _HEAP_FREE_ENTRY HEAP_FREE_ENTRY
typedef _HEAP_FREE_ENTRYPHEAP_FREE_ENTRY
typedef _HEAP_UNCOMMMTTED_RANGE HEAP_UNCOMMMTTED_RANGE
typedef _HEAP_UNCOMMMTTED_RANGEPHEAP_UNCOMMMTTED_RANGE
typedef _HEAP_SEGMENT HEAP_SEGMENT
typedef _HEAP_SEGMENTPHEAP_SEGMENT
typedef _HEAP_LOCK HEAP_LOCK
typedef _HEAP_LOCKPHEAP_LOCK
typedef _HEAP_UCR_SEGMENT HEAP_UCR_SEGMENT
typedef _HEAP_UCR_SEGMENTPHEAP_UCR_SEGMENT
typedef _HEAP_TAG_ENTRY HEAP_TAG_ENTRY
typedef _HEAP_TAG_ENTRYPHEAP_TAG_ENTRY
typedef _HEAP_PSEUDO_TAG_ENTRY HEAP_PSEUDO_TAG_ENTRY
typedef _HEAP_PSEUDO_TAG_ENTRYPHEAP_PSEUDO_TAG_ENTRY
typedef _HEAP HEAP
typedef _HEAPPHEAP
typedef _HEAP_STOP_ON_TAG HEAP_STOP_ON_TAG
typedef _HEAP_STOP_ON_TAGPHEAP_STOP_ON_TAG
typedef _HEAP_STOP_ON_VALUES HEAP_STOP_ON_VALUES
typedef _HEAP_STOP_ON_VALUESPHEAP_STOP_ON_VALUES

Functions

BOOLEAN RtlpHeapIsLocked (IN PVOID HeapHandle)

Variables

BOOLEAN RtlpDebugHeap
BOOLEAN RtlpValidateHeapHdrsEnable
BOOLEAN RtlpValidateHeapTagsEnable
PHEAP RtlpGlobalTagHeap
HEAP_STOP_ON_VALUES RtlpHeapStopOn


Define Documentation

#define ALLOC_HEAP_FILL   0xBAADF00D
 

Definition at line 397 of file heap.h.

Referenced by RtlAllocateHeapSlowly(), RtlpGrowBlockInPlace(), and RtlReAllocateHeap().

#define CHECK_HEAP_TAIL_FILL   0xAB
 

Definition at line 395 of file heap.h.

Referenced by RtlAllocateHeapSlowly(), RtlpGrowBlockInPlace(), and RtlReAllocateHeap().

#define CHECK_HEAP_TAIL_SIZE   HEAP_GRANULARITY
 

Definition at line 394 of file heap.h.

Referenced by RtlAllocateHeapSlowly(), RtlCreateHeap(), RtlInitializeHeapManager(), RtlpCheckBusyBlockTail(), RtlpGrowBlockInPlace(), and RtlReAllocateHeap().

#define FREE_HEAP_FILL   0xFEEEFEEE
 

Definition at line 396 of file heap.h.

Referenced by RtlpValidateHeapSegment(), and RtlZeroHeap().

#define HEAP_CAPTURE_STACK_BACKTRACES   (ULONG)0x08000000
 

Definition at line 392 of file heap.h.

Referenced by RtlCreateHeap(), RtlDebugAllocateHeap(), RtlDebugCreateHeap(), RtlDebugReAllocateHeap(), RtlFreeHeapSlowly(), and RtlpAllocateTags().

#define HEAP_ENTRY_BUSY   0x01
 

Definition at line 236 of file heap.h.

Referenced by RtlAllocateHeap(), RtlAllocateHeapSlowly(), RtlCreateHeap(), RtlFreeHeap(), RtlFreeHeapSlowly(), RtlGetUserInfoHeap(), RtlpCoalesceFreeBlocks(), RtlpGrowBlockInPlace(), RtlpInitializeHeapSegment(), RtlpValidateHeap(), RtlpValidateHeapEntry(), RtlpValidateHeapSegment(), RtlQueryProcessHeapInformation(), RtlReAllocateHeap(), RtlSetUserFlagsHeap(), RtlSetUserValueHeap(), RtlSizeHeap(), RtlUsageHeap(), RtlWalkHeap(), and RtlZeroHeap().

#define HEAP_ENTRY_EXTRA_PRESENT   0x02
 

Definition at line 237 of file heap.h.

Referenced by RtlAllocateHeap(), RtlAllocateHeapSlowly(), RtlDebugAllocateHeap(), RtlDebugFreeHeap(), RtlDebugReAllocateHeap(), RtlFreeHeapSlowly(), RtlGetUserInfoHeap(), RtlpGrowBlockInPlace(), RtlpValidateHeapSegment(), RtlQueryProcessHeapInformation(), RtlReAllocateHeap(), RtlSetUserValueHeap(), RtlUsageHeap(), and RtlWalkHeap().

#define HEAP_ENTRY_FILL_PATTERN   0x04
 

Definition at line 238 of file heap.h.

Referenced by RtlAllocateHeapSlowly(), RtlpValidateHeap(), RtlpValidateHeapEntry(), RtlpValidateHeapSegment(), and RtlZeroHeap().

#define HEAP_ENTRY_LAST_ENTRY   0x10
 

Definition at line 240 of file heap.h.

Referenced by RtlAllocateHeap(), RtlAllocateHeapSlowly(), RtlFreeHeap(), RtlFreeHeapSlowly(), RtlpCoalesceFreeBlocks(), RtlpCoalesceHeap(), RtlpDeCommitFreeBlock(), RtlpFindAndCommitPages(), RtlpGrowBlockInPlace(), RtlpInitializeHeapSegment(), RtlpInsertFreeBlock(), RtlpValidateHeapSegment(), RtlQueryProcessHeapInformation(), RtlReAllocateHeap(), RtlUsageHeap(), RtlWalkHeap(), and RtlZeroHeap().

#define HEAP_ENTRY_SETTABLE_FLAG1   0x20
 

Definition at line 241 of file heap.h.

#define HEAP_ENTRY_SETTABLE_FLAG2   0x40
 

Definition at line 242 of file heap.h.

#define HEAP_ENTRY_SETTABLE_FLAG3   0x80
 

Definition at line 243 of file heap.h.

#define HEAP_ENTRY_SETTABLE_FLAGS   0xE0
 

Definition at line 244 of file heap.h.

Referenced by RtlGetUserInfoHeap(), RtlpGrowBlockInPlace(), RtlQueryProcessHeapInformation(), RtlReAllocateHeap(), and RtlWalkHeap().

#define HEAP_ENTRY_VIRTUAL_ALLOC   0x08
 

Definition at line 239 of file heap.h.

Referenced by RtlAllocateHeap(), RtlAllocateHeapSlowly(), RtlFreeHeap(), RtlFreeHeapSlowly(), RtlpCheckBusyBlockTail(), RtlpGetExtraStuffPointer(), RtlpValidateHeapEntry(), RtlReAllocateHeap(), RtlSizeHeap(), and RtlWalkHeap().

#define HEAP_GRANULARITY   ((LONG) sizeof( HEAP_ENTRY ))
 

Definition at line 224 of file heap.h.

Referenced by RtlAllocateHeap(), RtlCreateHeap(), RtlpAllocateDebugInfo(), RtlpInitializeHeapSegment(), RtlpValidateHeapEntry(), and RtlQueryProcessHeapInformation().

#define HEAP_GRANULARITY_SHIFT   3
 

Definition at line 228 of file heap.h.

Referenced by RtlAllocateHeap(), RtlAllocateHeapSlowly(), RtlCompactHeap(), RtlCreateHeap(), RtlDebugFreeHeap(), RtlFreeHeapSlowly(), RtlpCheckBusyBlockTail(), RtlpCoalesceHeap(), RtlpDeCommitFreeBlock(), RtlpExtendHeap(), RtlpFindAndCommitPages(), RtlpGetTagName(), RtlpGrowBlockInPlace(), RtlpInitializeHeapSegment(), RtlpQueryProcessEnumHeapsRoutine(), RtlpValidateHeap(), RtlpValidateHeapSegment(), RtlQueryProcessHeapInformation(), RtlQueryTagHeap(), RtlReAllocateHeap(), RtlSizeHeap(), RtlUsageHeap(), RtlWalkHeap(), and RtlZeroHeap().

#define HEAP_LARGE_TAG_MASK   0xFF000000
 

Definition at line 28 of file heap.h.

#define HEAP_LOCK_USER_ALLOCATED   (ULONG)0x80000000
 

Definition at line 388 of file heap.h.

Referenced by RtlCreateHeap(), and RtlDestroyHeap().

#define HEAP_MAXIMUM_BLOCK_SIZE   (USHORT)(((0x10000 << HEAP_GRANULARITY_SHIFT) - PAGE_SIZE) >> HEAP_GRANULARITY_SHIFT)
 

Definition at line 231 of file heap.h.

Referenced by RtlAllocateHeap(), RtlAllocateHeapSlowly(), RtlCreateHeap(), RtlFreeHeap(), RtlFreeHeapSlowly(), RtlpCoalesceFreeBlocks(), RtlpGrowBlockInPlace(), RtlpInsertFreeBlock(), and RtlReAllocateHeap().

#define HEAP_MAXIMUM_FREELISTS   128
 

Definition at line 233 of file heap.h.

Referenced by RtlAllocateHeap(), RtlAllocateHeapSlowly(), RtlCreateHeap(), RtlFreeHeap(), RtlpCoalesceHeap(), RtlpGetTagName(), RtlpUpdateTagEntry(), RtlpValidateHeap(), RtlQueryProcessHeapInformation(), RtlValidateHeap(), and RtlWalkHeap().

#define HEAP_MAXIMUM_SEGMENTS   64
 

Definition at line 234 of file heap.h.

Referenced by RtlCompactHeap(), RtlDestroyHeap(), RtlExtendHeap(), RtlFreeHeap(), RtlFreeHeapSlowly(), RtlpExtendHeap(), RtlpQueryProcessEnumHeapsRoutine(), RtlProtectHeap(), RtlpValidateHeap(), RtlpValidateHeapEntry(), RtlQueryProcessHeapInformation(), RtlUsageHeap(), RtlWalkHeap(), and RtlZeroHeap().

#define HEAP_MAXIMUM_SMALL_TAG   0xFF
 

Definition at line 399 of file heap.h.

#define HEAP_NEED_EXTRA_FLAGS
 

Value:

((HEAP_TAG_MASK ^ HEAP_SMALL_TAG_MASK) | \ HEAP_CAPTURE_STACK_BACKTRACES | \ HEAP_SETTABLE_USER_VALUE \ )

Definition at line 401 of file heap.h.

Referenced by RtlAllocateHeapSlowly(), and RtlReAllocateHeap().

#define HEAP_NUMBER_OF_PSEUDO_TAG   (HEAP_MAXIMUM_FREELISTS+1)
 

Definition at line 405 of file heap.h.

Referenced by RtlCreateHeap(), RtlpGetTagName(), RtlpResetTags(), RtlpUpdateTagEntry(), RtlpValidateHeap(), RtlpValidateHeapSegment(), RtlQueryProcessHeapInformation(), and RtlQueryTagHeap().

#define HEAP_SEGMENT_SIGNATURE   0xFFEEFFEE
 

Definition at line 280 of file heap.h.

Referenced by RtlpInitializeHeapSegment().

#define HEAP_SEGMENT_USER_ALLOCATED   (ULONG)0x00000001
 

Definition at line 281 of file heap.h.

Referenced by RtlCreateHeap(), RtlExtendHeap(), and RtlpDestroyHeapSegment().

#define HEAP_SIGNATURE   (ULONG)0xEEFFEEFF
 

Definition at line 387 of file heap.h.

Referenced by RtlCreateHeap(), RtlpAllocateTags(), and RtlpCheckHeapSignature().

#define HEAP_SKIP_VALIDATION_CHECKS   (ULONG)0x10000000
 

Definition at line 391 of file heap.h.

Referenced by RtlCreateHeap(), RtlDebugAllocateHeap(), RtlDebugCompactHeap(), RtlDebugCreateHeap(), RtlDebugCreateTagHeap(), RtlDebugFreeHeap(), RtlDebugGetUserInfoHeap(), RtlDebugQueryTagHeap(), RtlDebugReAllocateHeap(), RtlDebugSetUserFlagsHeap(), RtlDebugSetUserValueHeap(), RtlDebugSizeHeap(), RtlDebugUsageHeap(), and RtlDebugZeroHeap().

#define HEAP_SMALL_TAG_MASK   (HEAP_MAXIMUM_SMALL_TAG << HEAP_TAG_SHIFT)
 

Definition at line 400 of file heap.h.

Referenced by RtlAllocateHeapSlowly().

#define HEAP_VALIDATE_ALL_ENABLED   (ULONG)0x20000000
 

Definition at line 390 of file heap.h.

Referenced by RtlCreateHeap(), RtlDebugAllocateHeap(), and RtlpValidateHeap().

#define HEAP_VALIDATE_PARAMETERS_ENABLED   (ULONG)0x40000000
 

Definition at line 389 of file heap.h.

Referenced by RtlCreateHeap().

#define ROUND_DOWN_TO_POWER2 x,
n   )     ((ULONG_PTR)(x) & ~((ULONG_PTR)(n)-1))
 

Definition at line 31 of file heap.h.

Referenced by RtlpDeCommitFreeBlock().

#define ROUND_UP_TO_POWER2 x,
n   )     (((ULONG_PTR)(x) + ((n)-1)) & ~((ULONG_PTR)(n)-1))
 

Definition at line 30 of file heap.h.

Referenced by RtlCreateHeap(), RtlpDeCommitFreeBlock(), RtlpGrowBlockInPlace(), RtlpInitializeHeapSegment(), and RtlReAllocateHeap().


Typedef Documentation

typedef struct _HEAP HEAP
 

Referenced by RtlCreateHeap().

typedef struct _HEAP_ENTRY HEAP_ENTRY
 

Referenced by RtlCreateHeap(), and RtlpQueryProcessEnumHeapsRoutine().

typedef struct _HEAP_ENTRY_EXTRA HEAP_ENTRY_EXTRA
 

Referenced by RtlAllocateHeapSlowly().

typedef struct _HEAP_FREE_ENTRY HEAP_FREE_ENTRY
 

Referenced by RtlAllocateHeap().

typedef struct _HEAP_FREE_ENTRY_EXTRA HEAP_FREE_ENTRY_EXTRA
 

typedef struct _HEAP_LOCK HEAP_LOCK
 

Referenced by RtlCreateHeap().

typedef struct _HEAP_PSEUDO_TAG_ENTRY HEAP_PSEUDO_TAG_ENTRY
 

Referenced by RtlCreateHeap().

typedef struct _HEAP_SEGMENT HEAP_SEGMENT
 

typedef struct _HEAP_STOP_ON_TAG HEAP_STOP_ON_TAG
 

typedef struct _HEAP_STOP_ON_VALUES HEAP_STOP_ON_VALUES
 

typedef struct _HEAP_TAG_ENTRY HEAP_TAG_ENTRY
 

typedef struct _HEAP_UCR_SEGMENT HEAP_UCR_SEGMENT
 

typedef struct _HEAP_UNCOMMMTTED_RANGE HEAP_UNCOMMMTTED_RANGE
 

typedef struct _HEAP_VIRTUAL_ALLOC_ENTRY HEAP_VIRTUAL_ALLOC_ENTRY
 

Referenced by RtlDestroyHeap(), and RtlQueryProcessHeapInformation().

typedef struct _HEAP * PHEAP
 

Referenced by RtlpQueryProcessEnumHeapsRoutine().

typedef struct _HEAP_ENTRY * PHEAP_ENTRY
 

Referenced by RtlAllocateHeap(), and RtlQueryProcessHeapInformation().

typedef struct _HEAP_ENTRY_EXTRA * PHEAP_ENTRY_EXTRA
 

Referenced by RtlAllocateHeapSlowly(), and RtlQueryProcessHeapInformation().

typedef struct _HEAP_FREE_ENTRY * PHEAP_FREE_ENTRY
 

typedef struct _HEAP_FREE_ENTRY_EXTRA * PHEAP_FREE_ENTRY_EXTRA
 

Referenced by RtlFreeHeapSlowly(), and RtlQueryProcessHeapInformation().

typedef struct _HEAP_LOCK * PHEAP_LOCK
 

Referenced by RtlCreateHeap().

typedef struct _HEAP_PSEUDO_TAG_ENTRY * PHEAP_PSEUDO_TAG_ENTRY
 

Referenced by RtlCreateHeap(), and RtlQueryProcessHeapInformation().

typedef struct _HEAP_SEGMENT * PHEAP_SEGMENT
 

Referenced by RtlpQueryProcessEnumHeapsRoutine().

typedef struct _HEAP_STOP_ON_TAG * PHEAP_STOP_ON_TAG
 

typedef struct _HEAP_STOP_ON_VALUES * PHEAP_STOP_ON_VALUES
 

typedef struct _HEAP_TAG_ENTRY * PHEAP_TAG_ENTRY
 

typedef struct _HEAP_UCR_SEGMENT * PHEAP_UCR_SEGMENT
 

Referenced by RtlDestroyHeap().

typedef struct _HEAP_UNCOMMMTTED_RANGE * PHEAP_UNCOMMMTTED_RANGE
 

Referenced by RtlQueryProcessHeapInformation().

typedef struct _HEAP_VIRTUAL_ALLOC_ENTRY * PHEAP_VIRTUAL_ALLOC_ENTRY
 

Referenced by RtlAllocateHeap(), and RtlQueryProcessHeapInformation().


Function Documentation

BOOLEAN RtlpHeapIsLocked IN PVOID  HeapHandle  ) 
 

Definition at line 6152 of file heapdll.c.

References HeapHandle, IF_DEBUG_PAGE_HEAP_THEN_RETURN, _HEAP_LOCK::Lock, _HEAP::LockVariable, NULL, and RtlpDebugPageHeapIsLocked().

Referenced by LdrShutdownProcess().

06158 : 06159 06160 This routine is used to determine if a heap is locked 06161 06162 Arguments: 06163 06164 HeapHandle - Supplies a pointer to the heap being queried 06165 06166 Return Value: 06167 06168 BOOLEAN - TRUE if the heap is locked and FALSE otherwise 06169 06170 --*/ 06171 06172 { 06173 PHEAP Heap; 06174 06175 // 06176 // Check if this is guard page version of heap 06177 // 06178 06179 IF_DEBUG_PAGE_HEAP_THEN_RETURN( HeapHandle, 06180 RtlpDebugPageHeapIsLocked( HeapHandle )); 06181 06182 Heap = (PHEAP)HeapHandle; 06183 06184 // 06185 // The heap is locked if there is a lock variable, and it has an 06186 // owning thread or the lockcount is not -1 06187 // 06188 06189 return (( Heap->LockVariable != NULL ) && 06190 ( Heap->LockVariable->Lock.CriticalSection.OwningThread || 06191 Heap->LockVariable->Lock.CriticalSection.LockCount != -1 )); 06192 }


Variable Documentation

BOOLEAN RtlpDebugHeap
 

Definition at line 459 of file heap.h.

PHEAP RtlpGlobalTagHeap
 

Definition at line 462 of file heap.h.

Referenced by LdrpDefineDllTag(), RtlCreateTagHeap(), RtlpAllocateTags(), RtlpGetTagName(), RtlpUpdateTagEntry(), and RtlQueryProcessHeapInformation().

HEAP_STOP_ON_VALUES RtlpHeapStopOn
 

Definition at line 463 of file heap.h.

Referenced by RtlDebugAllocateHeap(), RtlDebugFreeHeap(), RtlDebugReAllocateHeap(), and RtlpUpdateHeapListIndex().

BOOLEAN RtlpValidateHeapHdrsEnable
 

Definition at line 460 of file heap.h.

Referenced by RtlpValidateHeapHeaders().

BOOLEAN RtlpValidateHeapTagsEnable
 

Definition at line 461 of file heap.h.

Referenced by RtlpValidateHeap().


Generated on Sat May 15 19:44:03 2004 for test by doxygen 1.3.7