Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

165 lines
3.6 KiB

  1. #pragma once
  2. #ifdef __cplusplus
  3. extern "C" {
  4. #endif
  5. typedef struct _RTL_GROWING_LIST_CHUNK {
  6. //
  7. // Pointer back to the parent list
  8. //
  9. struct _RTL_GROWING_LIST *pGrowingListParent;
  10. //
  11. // Pointer to the next chunk in the list
  12. //
  13. struct _RTL_GROWING_LIST_CHUNK *pNextChunk;
  14. }
  15. RTL_GROWING_LIST_CHUNK, *PRTL_GROWING_LIST_CHUNK;
  16. #define GROWING_LIST_FLAG_IS_SORTED (0x00000001)
  17. typedef struct _RTL_GROWING_LIST {
  18. //
  19. // Any flags about this list?
  20. //
  21. ULONG ulFlags;
  22. //
  23. // How many total elments are in this growing list?
  24. //
  25. ULONG cTotalElements;
  26. //
  27. // How big is each element in this list?
  28. //
  29. SIZE_T cbElementSize;
  30. //
  31. // How many to allocate per list chunk? As each piece of the growing list
  32. // fills up, this is the number of elements to allocate to the new chunk
  33. // of the list.
  34. //
  35. ULONG cElementsPerChunk;
  36. //
  37. // How many are in the initial internal list?
  38. //
  39. ULONG cInternalElements;
  40. //
  41. // Pointer to the intial "internal" list, if specified by the caller
  42. //
  43. PVOID pvInternalList;
  44. //
  45. // The allocation-freeing context and function pointers
  46. //
  47. RTL_ALLOCATOR Allocator;
  48. //
  49. // First chunk
  50. //
  51. PRTL_GROWING_LIST_CHUNK pFirstChunk;
  52. //
  53. // Last chunk (quick access)
  54. //
  55. PRTL_GROWING_LIST_CHUNK pLastChunk;
  56. }
  57. RTL_GROWING_LIST, *PRTL_GROWING_LIST;
  58. NTSTATUS
  59. RtlInitializeGrowingList(
  60. PRTL_GROWING_LIST pList,
  61. SIZE_T cbElementSize,
  62. ULONG cElementsPerChunk,
  63. PVOID pvInitialListBuffer,
  64. SIZE_T cbInitialListBuffer,
  65. PRTL_ALLOCATOR Allocator
  66. );
  67. NTSTATUS
  68. RtlIndexIntoGrowingList(
  69. PRTL_GROWING_LIST pList,
  70. ULONG ulIndex,
  71. PVOID *ppvPointerToSpace,
  72. BOOLEAN fGrowingAllowed
  73. );
  74. NTSTATUS
  75. RtlDestroyGrowingList(
  76. PRTL_GROWING_LIST pList
  77. );
  78. //
  79. // The growing list control structure can be placed anywhere in the allocation
  80. // that's optimal (on cache boundaries, etc.)
  81. //
  82. #define RTL_INIT_GROWING_LIST_EX_FLAG_LIST_ANYWHERE (0x00000001)
  83. NTSTATUS
  84. RtlInitializeGrowingListEx(
  85. ULONG ulFlags,
  86. PVOID pvBlob,
  87. SIZE_T cbBlobSpace,
  88. SIZE_T cbElementSize,
  89. ULONG cElementsPerChunk,
  90. PRTL_ALLOCATOR Allocator,
  91. PRTL_GROWING_LIST *ppBuiltListPointer,
  92. PVOID pvReserved
  93. );
  94. NTSTATUS
  95. RtlCloneGrowingList(
  96. ULONG ulFlags,
  97. PRTL_GROWING_LIST pDestination,
  98. PRTL_GROWING_LIST pSource,
  99. ULONG ulCount
  100. );
  101. NTSTATUS
  102. RtlAllocateGrowingList(
  103. PRTL_GROWING_LIST *ppGrowingList,
  104. SIZE_T cbThingSize,
  105. PRTL_ALLOCATOR Allocator
  106. );
  107. typedef NTSTATUS (__cdecl *PFN_LIST_COMPARISON_CALLBACK)(
  108. PRTL_GROWING_LIST HostList,
  109. PVOID Left,
  110. PVOID Right,
  111. PVOID Context,
  112. int *Result
  113. );
  114. NTSTATUS
  115. RtlSortGrowingList(
  116. PRTL_GROWING_LIST pGrowingList,
  117. ULONG ItemCount,
  118. PFN_LIST_COMPARISON_CALLBACK SortCallback,
  119. PVOID SortContext
  120. );
  121. NTSTATUS
  122. RtlSearchGrowingList(
  123. PRTL_GROWING_LIST TheList,
  124. ULONG ItemCount,
  125. PFN_LIST_COMPARISON_CALLBACK SearchCallback,
  126. PVOID SearchTarget,
  127. PVOID SearchContext,
  128. PVOID *pvFoundItem
  129. );
  130. #ifdef __cplusplus
  131. }; // extern "C"
  132. #endif