https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2c4a554d72cc5c0375b9b…
commit 2c4a554d72cc5c0375b9b654a445091b1e983da1
Author: Thomas Faber <thomas.faber(a)reactos.org>
AuthorDate: Sat Jun 13 11:55:53 2020 +0200
Commit: Thomas Faber <thomas.faber(a)reactos.org>
CommitDate: Sat Aug 15 21:31:29 2020 +0200
[NDK] Complete range list function & structure declarations. CORE-6372
* Add the remaining functions & annotate.
* Add the RTLP_RANGE_LIST_ENTRY structure, which is present in symbols
Note: range list declarations should really be !NTOS_MODE_USER, since ntdll
doesn't export these functions; however, our RTL itself is built with
NTOS_MODE_USER, so that's not an option at this point.
---
sdk/include/ndk/rtlfuncs.h | 94 +++++++++++++++++++++++++++++++++++++++++++++-
sdk/include/ndk/rtltypes.h | 25 +++++++++++-
2 files changed, 117 insertions(+), 2 deletions(-)
diff --git a/sdk/include/ndk/rtlfuncs.h b/sdk/include/ndk/rtlfuncs.h
index 4fa1bde2747..85110d3c213 100644
--- a/sdk/include/ndk/rtlfuncs.h
+++ b/sdk/include/ndk/rtlfuncs.h
@@ -3574,7 +3574,7 @@ NTSYSAPI
VOID
NTAPI
RtlInitializeRangeList(
- _Inout_ PRTL_RANGE_LIST RangeList
+ _Out_ PRTL_RANGE_LIST RangeList
);
NTSYSAPI
@@ -3584,6 +3584,32 @@ RtlFreeRangeList(
_In_ PRTL_RANGE_LIST RangeList
);
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlCopyRangeList(
+ _Out_ PRTL_RANGE_LIST CopyRangeList,
+ _In_ PRTL_RANGE_LIST RangeList
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlMergeRangeLists(
+ _Out_ PRTL_RANGE_LIST MergedRangeList,
+ _In_ PRTL_RANGE_LIST RangeList1,
+ _In_ PRTL_RANGE_LIST RangeList2,
+ _In_ ULONG Flags
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlInvertRangeList(
+ _Out_ PRTL_RANGE_LIST InvertedRangeList,
+ _In_ PRTL_RANGE_LIST RangeList
+);
+
NTSYSAPI
NTSTATUS
NTAPI
@@ -3597,6 +3623,72 @@ RtlAddRange(
_In_opt_ PVOID Owner
);
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlDeleteRange(
+ _Inout_ PRTL_RANGE_LIST RangeList,
+ _In_ ULONGLONG Start,
+ _In_ ULONGLONG End,
+ _In_ PVOID Owner
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlDeleteOwnersRanges(
+ _Inout_ PRTL_RANGE_LIST RangeList,
+ _In_ _Maybenull_ PVOID Owner
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlFindRange(
+ _In_ PRTL_RANGE_LIST RangeList,
+ _In_ ULONGLONG Minimum,
+ _In_ ULONGLONG Maximum,
+ _In_ ULONG Length,
+ _In_ ULONG Alignment,
+ _In_ ULONG Flags,
+ _In_ UCHAR AttributeAvailableMask,
+ _In_opt_ PVOID Context,
+ _In_opt_ PRTL_CONFLICT_RANGE_CALLBACK Callback,
+ _Out_ PULONGLONG Start
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlIsRangeAvailable(
+ _In_ PRTL_RANGE_LIST RangeList,
+ _In_ ULONGLONG Start,
+ _In_ ULONGLONG End,
+ _In_ ULONG Flags,
+ _In_ UCHAR AttributeAvailableMask,
+ _In_opt_ PVOID Context,
+ _In_opt_ PRTL_CONFLICT_RANGE_CALLBACK Callback,
+ _Out_ PBOOLEAN Available
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlGetFirstRange(
+ _In_ PRTL_RANGE_LIST RangeList,
+ _Out_ PRTL_RANGE_LIST_ITERATOR Iterator,
+ _Outptr_ PRTL_RANGE *Range
+);
+
+NTSYSAPI
+NTSTATUS
+NTAPI
+RtlGetNextRange(
+ _Inout_ PRTL_RANGE_LIST_ITERATOR Iterator,
+ _Outptr_ PRTL_RANGE *Range,
+ _In_ BOOLEAN MoveForwards
+);
+
//
// Debug Functions
//
diff --git a/sdk/include/ndk/rtltypes.h b/sdk/include/ndk/rtltypes.h
index 74e8551c4be..0799bcce4cb 100644
--- a/sdk/include/ndk/rtltypes.h
+++ b/sdk/include/ndk/rtltypes.h
@@ -697,7 +697,6 @@ typedef NTSTATUS
//
// RTL Range List callbacks
//
-#ifdef NTOS_MODE_USER
typedef BOOLEAN
(NTAPI *PRTL_CONFLICT_RANGE_CALLBACK)(
PVOID Context,
@@ -707,6 +706,7 @@ typedef BOOLEAN
//
// Custom Heap Commit Routine for RtlCreateHeap
//
+#ifdef NTOS_MODE_USER
typedef NTSTATUS
(NTAPI * PRTL_HEAP_COMMIT_ROUTINE)(
_In_ PVOID Base,
@@ -1480,6 +1480,29 @@ typedef struct _RANGE_LIST_ITERATOR
ULONG Stamp;
} RTL_RANGE_LIST_ITERATOR, *PRTL_RANGE_LIST_ITERATOR;
+typedef struct _RTLP_RANGE_LIST_ENTRY
+{
+ ULONGLONG Start;
+ ULONGLONG End;
+ union
+ {
+ struct
+ {
+ PVOID UserData;
+ PVOID Owner;
+ } Allocated;
+ struct
+ {
+ LIST_ENTRY ListHead;
+ } Merged;
+ };
+ UCHAR Attributes;
+ UCHAR PublicFlags;
+ USHORT PrivateFlags;
+ LIST_ENTRY ListEntry;
+} RTLP_RANGE_LIST_ENTRY, *PRTLP_RANGE_LIST_ENTRY;
+C_ASSERT(RTL_SIZEOF_THROUGH_FIELD(RTL_RANGE, Flags) ==
RTL_SIZEOF_THROUGH_FIELD(RTLP_RANGE_LIST_ENTRY, PublicFlags));
+
//
// RTL Resource
//