ReactOS  0.4.15-dev-1207-g698a8e6
RtlRangeList.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS kernel-mode tests
3  * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4  * PURPOSE: Test for Rtl Range Lists
5  * COPYRIGHT: Copyright 2020 Thomas Faber (thomas.faber@reactos.org)
6  */
7 
8 #include <kmt_test.h>
9 #include <ndk/rtlfuncs.h>
10 
13 
14 /* Helpers *******************************************************************/
15 static
18  _Inout_ PRTL_RANGE_LIST RangeList,
19  _In_ const RTL_RANGE *Range,
21 {
22  return RtlAddRange(RangeList,
23  Range->Start,
24  Range->End,
25  Range->Attributes,
26  Flags,
27  Range->UserData,
28  Range->Owner);
29 }
30 
31 static
32 void
34  _In_ PCSTR File,
35  _In_ INT Line,
37  _In_ const RTL_RANGE *ActualRange,
38  _In_ const RTL_RANGE *ExpectedRange)
39 {
40  CHAR FileAndLine[128];
41  RtlStringCbPrintfA(FileAndLine, sizeof(FileAndLine), "%s:%d", File, Line);
42 
43  KmtOk(ActualRange->Start == ExpectedRange->Start, FileAndLine,
44  "[%lu] Start = 0x%I64x, expected 0x%I64x\n", Index, ActualRange->Start, ExpectedRange->Start);
45  KmtOk(ActualRange->End == ExpectedRange->End, FileAndLine,
46  "[%lu] End = 0x%I64x, expected 0x%I64x\n", Index, ActualRange->End, ExpectedRange->End);
47  KmtOk(ActualRange->UserData == ExpectedRange->UserData, FileAndLine,
48  "[%lu] UserData = %p, expected %p\n", Index, ActualRange->UserData, ExpectedRange->UserData);
49  KmtOk(ActualRange->Owner == ExpectedRange->Owner, FileAndLine,
50  "[%lu] Owner = %p, expected %p\n", Index, ActualRange->Owner, ExpectedRange->Owner);
51  KmtOk(ActualRange->Attributes == ExpectedRange->Attributes, FileAndLine,
52  "[%lu] Attributes = 0x%x, expected 0x%x\n", Index, ActualRange->Attributes, ExpectedRange->Attributes);
53  KmtOk(ActualRange->Flags == ExpectedRange->Flags, FileAndLine,
54  "[%lu] Flags = 0x%x, expected 0x%x\n", Index, ActualRange->Flags, ExpectedRange->Flags);
55 }
56 
57 static
58 void
60  _In_ PCSTR File,
61  _In_ INT Line,
62  _In_ RTL_RANGE_LIST *RangeList,
63  _In_ ULONG NumRanges,
64  _In_reads_(NumRanges) const RTL_RANGE *Ranges)
65 {
67  ULONG i;
68  RTL_RANGE_LIST_ITERATOR Iterator;
70  CHAR FileAndLine[128];
71  RtlStringCbPrintfA(FileAndLine, sizeof(FileAndLine), "%s:%d", File, Line);
72 
73  RtlFillMemory(&Iterator, sizeof(Iterator), 0x55);
75  Status = RtlGetFirstRange(RangeList, &Iterator, &Range);
76 #ifdef _WIN64
77  /* Padding at the end is uninitialized */
78  C_ASSERT(sizeof(Iterator) == RTL_SIZEOF_THROUGH_FIELD(RTL_RANGE_LIST_ITERATOR, Stamp) + sizeof(ULONG));
79  KmtOk((&Iterator.Stamp)[1] == 0x55555555, FileAndLine,
80  "Padding is 0x%lx\n", (&Iterator.Stamp)[1]);
81 #endif
82 
83  for (i = 0; i < NumRanges; i++)
84  {
85  if (!KmtSkip(NT_SUCCESS(Status), FileAndLine, "Range does not have %lu element(s)\n", i + 1))
86  {
87  ExpectRange(File, Line, i, Range, &Ranges[i]);
88 
89  /* Validate iterator */
90  KmtOk(Iterator.RangeListHead == &RangeList->ListHead, FileAndLine,
91  "[%lu] Iterator.RangeListHead = %p, expected %p\n", i, Iterator.RangeListHead, &RangeList->ListHead);
92  KmtOk(Iterator.MergedHead == NULL, FileAndLine,
93  "[%lu] Iterator.MergedHead = %p\n", i, Iterator.MergedHead);
94  KmtOk(Iterator.Current == Range, FileAndLine,
95  "[%lu] Iterator.Current = %p, expected %p\n", i, Iterator.Current, Range);
96  KmtOk(Iterator.Stamp == RangeList->Stamp, FileAndLine,
97  "[%lu] Iterator.Stamp = %lu, expected %lu\n", i, Iterator.Stamp, RangeList->Stamp);
98  }
99 
101  Status = RtlGetNextRange(&Iterator, &Range, TRUE);
102  }
103 
104  /* Final iteration status */
105  KmtOk(Status == STATUS_NO_MORE_ENTRIES, FileAndLine,
106  "Status = 0x%lx after enumeration\n", Status);
107  KmtOk(Range == NULL, FileAndLine,
108  "[%lu] Range = %p\n", i, Range);
109  KmtOk(Iterator.RangeListHead == &RangeList->ListHead, FileAndLine,
110  "[%lu] Iterator.RangeListHead = %p, expected %p\n", i, Iterator.RangeListHead, &RangeList->ListHead);
111  KmtOk(Iterator.MergedHead == NULL, FileAndLine,
112  "[%lu] Iterator.MergedHead = %p\n", i, Iterator.MergedHead);
113  KmtOk(Iterator.Current == NULL, FileAndLine,
114  "[%lu] Iterator.Current = %p\n", i, Iterator.Current);
115  KmtOk(Iterator.Stamp == RangeList->Stamp, FileAndLine,
116  "[%lu] Iterator.Stamp = %lu, expected %lu\n", i, Iterator.Stamp, RangeList->Stamp);
117 
118  /* Try one more iteration */
120  Status = RtlGetNextRange(&Iterator, &Range, TRUE);
121  KmtOk(Status == STATUS_NO_MORE_ENTRIES, FileAndLine,
122  "Status = 0x%lx after enumeration\n", Status);
123  KmtOk(Range == NULL, FileAndLine,
124  "[%lu] Range = %p\n", i, Range);
125  KmtOk(Iterator.RangeListHead == &RangeList->ListHead, FileAndLine,
126  "[%lu] Iterator.RangeListHead = %p, expected %p\n", i, Iterator.RangeListHead, &RangeList->ListHead);
127  KmtOk(Iterator.MergedHead == NULL, FileAndLine,
128  "[%lu] Iterator.MergedHead = %p\n", i, Iterator.MergedHead);
129  KmtOk(Iterator.Current == NULL, FileAndLine,
130  "[%lu] Iterator.Current = %p\n", i, Iterator.Current);
131  KmtOk(Iterator.Stamp == RangeList->Stamp, FileAndLine,
132  "[%lu] Iterator.Stamp = %lu, expected %lu\n", i, Iterator.Stamp, RangeList->Stamp);
133 }
134 
135 #define expect_range_entries(RangeList, NumRanges, Ranges) \
136  ExpectRangeEntryList(__FILE__, __LINE__, RangeList, NumRanges, Ranges)
137 
138 /* Test functions ************************************************************/
139 static
140 void
142  _Inout_ PRTL_RANGE_LIST RangeList,
143  _Inout_ PRTL_RANGE Ranges)
144 {
146  ULONG StartStamp = RangeList->Stamp;
147 
148  Ranges[1].Start = 0x300;
149  Ranges[1].End = 0x2ff;
150  Ranges[1].Attributes = 2;
151  Ranges[1].Flags = 0;
152  Ranges[1].UserData = &MyUserData2;
153  Ranges[1].Owner = &MyOwner2;
154 
155  /* Start > End bails out early with invalid parameter */
156  Status = RtlAddRangeWrapper(RangeList, &Ranges[1], 0);
158 
159  /* List should be unchanged */
160  ok_eq_ulong(RangeList->Flags, 0UL);
161  ok_eq_ulong(RangeList->Count, 1UL);
162  ok_eq_ulong(RangeList->Stamp, StartStamp);
163  expect_range_entries(RangeList, 1, &Ranges[0]);
164 }
165 
166 static
167 void
169  _Inout_ PRTL_RANGE_LIST RangeList,
170  _Inout_ PRTL_RANGE Ranges)
171 {
173  ULONG StartStamp = RangeList->Stamp;
174 
175  Ranges[1].Start = 0x300;
176  Ranges[1].End = 0x300;
177  Ranges[1].Attributes = 0xff;
178  Ranges[1].Flags = 0;
179  Ranges[1].UserData = &MyUserData2;
180  Ranges[1].Owner = &MyOwner2;
181 
182  /* Start == End is valid */
183  Status = RtlAddRangeWrapper(RangeList, &Ranges[1], 0);
185 
186  /* List now has two entries */
187  ok_eq_ulong(RangeList->Flags, 0UL);
188  ok_eq_ulong(RangeList->Count, 2UL);
189  ok_eq_ulong(RangeList->Stamp, StartStamp + 1);
190  expect_range_entries(RangeList, 2, &Ranges[0]);
191 
192  /* Delete our new entry -- List goes back to one entry */
193  Status = RtlDeleteRange(RangeList, Ranges[1].Start, Ranges[1].End, Ranges[1].Owner);
195  ok_eq_ulong(RangeList->Flags, 0UL);
196  ok_eq_ulong(RangeList->Count, 1UL);
197  ok_eq_ulong(RangeList->Stamp, StartStamp + 2);
198  expect_range_entries(RangeList, 1, &Ranges[0]);
199 }
200 
201 static
202 void
204  _Inout_ PRTL_RANGE_LIST RangeList,
205  _Inout_ PRTL_RANGE Ranges)
206 {
208  ULONG StartStamp = RangeList->Stamp;
209 
210  Ranges[1].Start = 0x300;
211  Ranges[1].End = 0x400;
212  Ranges[1].Attributes = 2;
213  Ranges[1].Flags = RTL_RANGE_SHARED;
214  Ranges[1].UserData = &MyUserData2;
215  Ranges[1].Owner = &MyOwner2;
216 
217  /* Pass in the shared flag */
218  Status = RtlAddRangeWrapper(RangeList, &Ranges[1], RTL_RANGE_LIST_ADD_SHARED);
220 
221  /* List now has two entries */
222  ok_eq_ulong(RangeList->Flags, 0UL);
223  ok_eq_ulong(RangeList->Count, 2UL);
224  ok_eq_ulong(RangeList->Stamp, StartStamp + 1);
225  expect_range_entries(RangeList, 2, &Ranges[0]);
226 
227  /* Delete our new entry -- List goes back to one entry */
228  Status = RtlDeleteRange(RangeList, Ranges[1].Start, Ranges[1].End, Ranges[1].Owner);
230  ok_eq_ulong(RangeList->Flags, 0UL);
231  ok_eq_ulong(RangeList->Count, 1UL);
232  ok_eq_ulong(RangeList->Stamp, StartStamp + 2);
233  expect_range_entries(RangeList, 1, &Ranges[0]);
234 }
235 
236 static
237 void
239  _Inout_ PRTL_RANGE_LIST RangeList,
240  _Inout_ PRTL_RANGE Ranges)
241 {
243  BOOLEAN Available;
244  ULONG StartStamp = RangeList->Stamp;
245 
246 #define is_range_available(RangeList, Start, End, pAvail) \
247  RtlIsRangeAvailable(RangeList, \
248  Start, \
249  End, \
250  0, \
251  0, \
252  NULL, \
253  NULL, \
254  pAvail)
255 
256  /* Single item range before Start */
257  Status = is_range_available(RangeList,
258  Ranges[0].Start - 1,
259  Ranges[0].Start - 1,
260  &Available);
262  ok_eq_bool(Available, TRUE);
263 
264  /* Single item range at Start */
265  Status = is_range_available(RangeList,
266  Ranges[0].Start,
267  Ranges[0].Start,
268  &Available);
270  ok_eq_bool(Available, FALSE);
271 
272  /* Single item range at End */
273  Status = is_range_available(RangeList,
274  Ranges[0].End,
275  Ranges[0].End,
276  &Available);
278  ok_eq_bool(Available, FALSE);
279 
280  /* Single item range after End */
281  Status = is_range_available(RangeList,
282  Ranges[0].End + 1,
283  Ranges[0].End + 1,
284  &Available);
286  ok_eq_bool(Available, TRUE);
287 
288  /* Range ending before Start */
289  Status = is_range_available(RangeList,
290  0x0,
291  Ranges[0].Start - 1,
292  &Available);
294  ok_eq_bool(Available, TRUE);
295 
296  /* Range ending at Start */
297  Status = is_range_available(RangeList,
298  0x0,
299  Ranges[0].Start,
300  &Available);
302  ok_eq_bool(Available, FALSE);
303 
304  /* Range ending in the middle */
305  Status = is_range_available(RangeList,
306  0x0,
307  (Ranges[0].Start + Ranges[0].End) / 2,
308  &Available);
310  ok_eq_bool(Available, FALSE);
311 
312  /* Range going all the way through */
313  Status = is_range_available(RangeList,
314  0x0,
315  Ranges[0].End + 0x100,
316  &Available);
318  ok_eq_bool(Available, FALSE);
319 
320  /* Range starting in the middle */
321  Status = is_range_available(RangeList,
322  (Ranges[0].Start + Ranges[0].End) / 2,
323  Ranges[0].End + 0x100,
324  &Available);
326  ok_eq_bool(Available, FALSE);
327 
328  /* Range starting at End */
329  Status = is_range_available(RangeList,
330  Ranges[0].End,
331  Ranges[0].End + 0x100,
332  &Available);
334  ok_eq_bool(Available, FALSE);
335 
336  /* Range starting after End */
337  Status = is_range_available(RangeList,
338  Ranges[0].End + 1,
339  Ranges[0].End + 0x100,
340  &Available);
342  ok_eq_bool(Available, TRUE);
343 
344  /* Start > End, at start */
345  Status = is_range_available(RangeList,
346  Ranges[0].Start,
347  Ranges[0].Start - 1,
348  &Available);
350  ok_eq_bool(Available, TRUE);
351 
352  /* Start > End, at start */
353  Status = is_range_available(RangeList,
354  Ranges[0].Start + 1,
355  Ranges[0].Start,
356  &Available);
358  ok_eq_bool(Available, FALSE);
359 
360  /* Start > End, at end */
361  Status = is_range_available(RangeList,
362  Ranges[0].End + 1,
363  Ranges[0].End,
364  &Available);
366  ok_eq_bool(Available, TRUE);
367 
368  /* Start > End, at end */
369  Status = is_range_available(RangeList,
370  Ranges[0].End,
371  Ranges[0].End - 1,
372  &Available);
374  ok_eq_bool(Available, FALSE);
375 
376  /* Start > End, through the range */
377  Status = is_range_available(RangeList,
378  Ranges[0].End + 1,
379  Ranges[0].Start - 1,
380  &Available);
382  ok_eq_bool(Available, TRUE);
383 
384  /* AttributesAvailableMask will make our range available */
385  Status = RtlIsRangeAvailable(RangeList,
386  0x0,
387  Ranges[0].End + 0x100,
388  0,
389  Ranges[0].Attributes,
390  NULL,
391  NULL,
392  &Available);
394  ok_eq_bool(Available, TRUE);
395 
396  /* AttributesAvailableMask with additional bits */
397  Status = RtlIsRangeAvailable(RangeList,
398  0x0,
399  Ranges[0].End + 0x100,
400  0,
401  0xFF,
402  NULL,
403  NULL,
404  &Available);
406  ok_eq_bool(Available, TRUE);
407 
408  ok_eq_ulong(RangeList->Stamp, StartStamp);
409 }
410 
411 /* Entry point ***************************************************************/
412 START_TEST(RtlRangeList)
413 {
415  RTL_RANGE_LIST RangeList;
416  RTL_RANGE Ranges[5];
417  ULONG Stamp;
418 
419  RtlFillMemory(&RangeList, sizeof(RangeList), 0x55);
420  RtlInitializeRangeList(&RangeList);
421  ok(IsListEmpty(&RangeList.ListHead),
422  "RangeList.ListHead %p %p %p, expected empty\n",
423  &RangeList.ListHead, RangeList.ListHead.Flink, RangeList.ListHead.Blink);
424  ok_eq_ulong(RangeList.Flags, 0UL);
425  ok_eq_ulong(RangeList.Count, 0UL);
426  ok_eq_ulong(RangeList.Stamp, 0UL);
427 #ifdef _WIN64
428  /* Padding at the end is uninitialized */
429  C_ASSERT(sizeof(RangeList) == RTL_SIZEOF_THROUGH_FIELD(RTL_RANGE_LIST, Stamp) + sizeof(ULONG));
430  ok_eq_ulong((&RangeList.Stamp)[1], 0x55555555UL);
431 #endif
432 
433  /* Add a simple range */
434  Ranges[0].Start = 0x100;
435  Ranges[0].End = 0x200;
436  Ranges[0].Attributes = 1;
437  Ranges[0].Flags = 0;
438  Ranges[0].UserData = &MyUserData1;
439  Ranges[0].Owner = &MyOwner1;
440  Status = RtlAddRangeWrapper(&RangeList, &Ranges[0], 0);
442  ok_eq_ulong(RangeList.Flags, 0UL);
443  ok_eq_ulong(RangeList.Count, 1UL);
444  ok_eq_ulong(RangeList.Stamp, 1UL);
445  expect_range_entries(&RangeList, 1, &Ranges[0]);
446 
447  /*
448  * Individual tests.
449  * These should always leave the list with our single start entry.
450  * Stamp may change between tests.
451  */
452  TestStartGreaterThanEnd(&RangeList, Ranges);
453  TestStartEqualsEnd(&RangeList, Ranges);
454  TestSharedFlag(&RangeList, Ranges);
455  TestIsAvailable(&RangeList, Ranges);
456 
457  Stamp = RangeList.Stamp;
458 
459  /* Free it and check the result */
460  RtlFreeRangeList(&RangeList);
461  ok_eq_ulong(RangeList.Flags, 0UL);
462  ok_eq_ulong(RangeList.Count, 0UL);
463  ok_eq_ulong(RangeList.Stamp, Stamp);
464  expect_range_entries(&RangeList, 0, NULL);
465 }
#define ok_eq_ulong(value, expected)
static UCHAR MyOwner2
Definition: RtlRangeList.c:12
#define KmtInvalidPointer
Definition: kmt_test.h:275
static void ExpectRange(_In_ PCSTR File, _In_ INT Line, _In_ ULONG Index, _In_ const RTL_RANGE *ActualRange, _In_ const RTL_RANGE *ExpectedRange)
Definition: RtlRangeList.c:33
#define STATUS_NO_MORE_ENTRIES
Definition: ntstatus.h:205
GLint x0
Definition: linetemp.h:95
ULONGLONG Start
Definition: rtltypes.h:1467
#define expect_range_entries(RangeList, NumRanges, Ranges)
Definition: RtlRangeList.c:135
#define TRUE
Definition: types.h:120
PLIST_ENTRY RangeListHead
Definition: rtltypes.h:1477
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _LIST_ENTRY * Blink
Definition: typedefs.h:122
PLIST_ENTRY MergedHead
Definition: rtltypes.h:1478
char CHAR
Definition: xmlstorage.h:175
static void ExpectRangeEntryList(_In_ PCSTR File, _In_ INT Line, _In_ RTL_RANGE_LIST *RangeList, _In_ ULONG NumRanges, _In_reads_(NumRanges) const RTL_RANGE *Ranges)
Definition: RtlRangeList.c:59
LONG NTSTATUS
Definition: precomp.h:26
static void TestSharedFlag(_Inout_ PRTL_RANGE_LIST RangeList, _Inout_ PRTL_RANGE Ranges)
Definition: RtlRangeList.c:203
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)
BOOLEAN BOOLEAN VOID VOID BOOLEAN BOOLEAN KmtSkip(INT Condition, PCSTR FileAndLine, PCSTR Format,...) KMT_FORMAT(ms_printf
PVOID UserData
Definition: rtltypes.h:1469
int32_t INT
Definition: typedefs.h:58
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
static void TestStartEqualsEnd(_Inout_ PRTL_RANGE_LIST RangeList, _Inout_ PRTL_RANGE Ranges)
Definition: RtlRangeList.c:168
LIST_ENTRY ListHead
Definition: rtltypes.h:1459
struct tagRange Range
UCHAR Flags
Definition: rtltypes.h:1472
BOOLEAN BOOLEAN KmtOk(INT Condition, PCSTR FileAndLine, PCSTR Format,...) KMT_FORMAT(ms_printf
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define RTL_RANGE_LIST_ADD_SHARED
Definition: rtltypes.h:82
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI VOID NTAPI RtlFreeRangeList(_In_ PRTL_RANGE_LIST RangeList)
#define ok_eq_bool(value, expected)
Definition: kmt_test.h:258
#define C_ASSERT(e)
Definition: intsafe.h:71
NTSYSAPI NTSTATUS NTAPI RtlAddRange(_Inout_ PRTL_RANGE_LIST RangeList, _In_ ULONGLONG Start, _In_ ULONGLONG End, _In_ UCHAR Attributes, _In_ ULONG Flags, _In_opt_ PVOID UserData, _In_opt_ PVOID Owner)
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1148
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
static UCHAR MyUserData2
Definition: RtlRangeList.c:11
#define is_range_available(RangeList, Start, End, pAvail)
static void TestIsAvailable(_Inout_ PRTL_RANGE_LIST RangeList, _Inout_ PRTL_RANGE Ranges)
Definition: RtlRangeList.c:238
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593
static const UCHAR Index[8]
Definition: usbohci.c:18
#define RTL_SIZEOF_THROUGH_FIELD(type, field)
Definition: ntbasedef.h:673
#define _Inout_
Definition: no_sal2.h:162
static NTSTATUS RtlAddRangeWrapper(_Inout_ PRTL_RANGE_LIST RangeList, _In_ const RTL_RANGE *Range, _In_ ULONG Flags)
Definition: RtlRangeList.c:17
Definition: partlist.h:33
Definition: ncftp.h:79
static void TestStartGreaterThanEnd(_Inout_ PRTL_RANGE_LIST RangeList, _Inout_ PRTL_RANGE Ranges)
Definition: RtlRangeList.c:141
unsigned char UCHAR
Definition: xmlstorage.h:181
Status
Definition: gdiplustypes.h:24
UCHAR Attributes
Definition: rtltypes.h:1471
Definition: range.c:39
#define RTL_RANGE_SHARED
Definition: rtltypes.h:84
#define _In_
Definition: no_sal2.h:158
_Must_inspect_result_ _In_ USHORT _In_ PHIDP_PREPARSED_DATA _Out_writes_to_ LengthAttributes PHIDP_EXTENDED_ATTRIBUTES Attributes
Definition: hidpi.h:348
ULONGLONG End
Definition: rtltypes.h:1468
#define ok(value,...)
Definition: atltest.h:57
static UCHAR MyUserData1
Definition: RtlRangeList.c:11
PVOID Owner
Definition: rtltypes.h:1470
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL _Inout_ PULONG _Out_writes_bytes_to_opt_ SaclSize PACL _Inout_ PULONG _Out_writes_bytes_to_opt_ OwnerSize PSID Owner
Definition: rtlfuncs.h:1556
unsigned int ULONG
Definition: retypes.h:1
const char * PCSTR
Definition: typedefs.h:52
#define ok_eq_hex(value, expected)
Definition: File.h:15
#define _In_reads_(s)
Definition: no_sal2.h:168
NTSYSAPI VOID NTAPI RtlInitializeRangeList(_Out_ PRTL_RANGE_LIST RangeList)
return STATUS_SUCCESS
Definition: btrfs.c:3014
NTSYSAPI NTSTATUS NTAPI RtlDeleteRange(_Inout_ PRTL_RANGE_LIST RangeList, _In_ ULONGLONG Start, _In_ ULONGLONG End, _In_ PVOID Owner)
NTSYSAPI NTSTATUS NTAPI RtlGetNextRange(_Inout_ PRTL_RANGE_LIST_ITERATOR Iterator, _Outptr_ PRTL_RANGE *Range, _In_ BOOLEAN MoveForwards)
#define UL
Definition: tui.h:82
START_TEST(RtlRangeList)
Definition: RtlRangeList.c:412
NTSYSAPI NTSTATUS NTAPI RtlGetFirstRange(_In_ PRTL_RANGE_LIST RangeList, _Out_ PRTL_RANGE_LIST_ITERATOR Iterator, _Outptr_ PRTL_RANGE *Range)
static UCHAR MyOwner1
Definition: RtlRangeList.c:12