ReactOS  0.4.14-dev-342-gdc047f9
ExSingleList.c File Reference
#include <kmt_test.h>
#include "ExXList.h"
Include dependency graph for ExSingleList.c:

Go to the source code of this file.

Macros

#define ok_eq_free2(Value, Expected)
 
#define CheckListHeader(ListHead, ExpectedPointer, ExpectedDepth)
 
#define PXLIST_HEADER   PSINGLE_LIST_ENTRY
 
#define PXLIST_ENTRY   PSINGLE_LIST_ENTRY
 
#define PushXList   ExInterlockedPushEntryList
 
#define PopXList   ExInterlockedPopEntryList
 
#define FlushXList   FlushList
 
#define ok_free_xlist   ok_eq_free2
 
#define CheckXListHeader   CheckListHeader
 
#define TestXListFunctional   TestListFunctional
 
#define TestXListFunctional   TestListFunctionalExports
 
#define PushXList   PushEntryListWrapper
 
#define PopXList(h, s)   PopEntryList(h)
 
#define ok_free_xlist   ok_eq_pointer
 
#define TestXListFunctional   TestListFunctionalNoInterlocked
 

Functions

PSINGLE_LIST_ENTRY FlushList (PSINGLE_LIST_ENTRY ListHead)
 
USHORT QueryDepthList (PSINGLE_LIST_ENTRY ListHead)
 
PSINGLE_LIST_ENTRY PushEntryListWrapper (PSINGLE_LIST_ENTRY ListHead, PSINGLE_LIST_ENTRY Entry, PKSPIN_LOCK Lock)
 
 START_TEST (ExSingleList)
 

Macro Definition Documentation

◆ CheckListHeader

#define CheckListHeader (   ListHead,
  ExpectedPointer,
  ExpectedDepth 
)
Value:
do \
{ \
ok_eq_pointer((ListHead)->Next, ExpectedPointer); \
ok_eq_uint(QueryDepthList(ListHead), ExpectedDepth); \
ok_irql(HIGH_LEVEL); \
ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:"); \
} while (0)
BOOLEAN KmtAreInterruptsEnabled(VOID)
#define HIGH_LEVEL
Definition: env_spec_w32.h:703
USHORT QueryDepthList(PSINGLE_LIST_ENTRY ListHead)
Definition: ExSingleList.c:31

Definition at line 51 of file ExSingleList.c.

◆ CheckXListHeader

#define CheckXListHeader   CheckListHeader

Definition at line 65 of file ExSingleList.c.

◆ FlushXList

#define FlushXList   FlushList

Definition at line 63 of file ExSingleList.c.

◆ ok_eq_free2

#define ok_eq_free2 (   Value,
  Expected 
)
Value:
do \
{ \
ok_eq_pointer(Value, (PVOID)(ULONG_PTR)0xBADDD0FFBADDD0FFULL); \
} while (0)
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
#define ok_eq_pointer(value, expected)
uint32_t ULONG_PTR
Definition: typedefs.h:63
BOOLEAN KmtIsCheckedBuild
BOOLEAN Expected

Definition at line 16 of file ExSingleList.c.

◆ ok_free_xlist [1/2]

#define ok_free_xlist   ok_eq_free2

Definition at line 79 of file ExSingleList.c.

◆ ok_free_xlist [2/2]

#define ok_free_xlist   ok_eq_pointer

Definition at line 79 of file ExSingleList.c.

◆ PopXList [1/2]

Definition at line 77 of file ExSingleList.c.

◆ PopXList [2/2]

#define PopXList (   h,
  s 
)    PopEntryList(h)

Definition at line 77 of file ExSingleList.c.

◆ PushXList [1/2]

Definition at line 75 of file ExSingleList.c.

◆ PushXList [2/2]

#define PushXList   PushEntryListWrapper

Definition at line 75 of file ExSingleList.c.

◆ PXLIST_ENTRY

#define PXLIST_ENTRY   PSINGLE_LIST_ENTRY

Definition at line 60 of file ExSingleList.c.

◆ PXLIST_HEADER

#define PXLIST_HEADER   PSINGLE_LIST_ENTRY

Definition at line 59 of file ExSingleList.c.

◆ TestXListFunctional [1/3]

#define TestXListFunctional   TestListFunctional

Definition at line 80 of file ExSingleList.c.

◆ TestXListFunctional [2/3]

#define TestXListFunctional   TestListFunctionalExports

Definition at line 80 of file ExSingleList.c.

◆ TestXListFunctional [3/3]

#define TestXListFunctional   TestListFunctionalNoInterlocked

Definition at line 80 of file ExSingleList.c.

Function Documentation

◆ FlushList()

PSINGLE_LIST_ENTRY FlushList ( PSINGLE_LIST_ENTRY  ListHead)

Definition at line 24 of file ExSingleList.c.

25 {
26  PSINGLE_LIST_ENTRY Ret = ListHead->Next;
27  ListHead->Next = NULL;
28  return Ret;
29 }
Definition: ntbasedef.h:635
smooth NULL
Definition: ftsmooth.c:416
struct _SINGLE_LIST_ENTRY * Next
Definition: ntbasedef.h:636

Referenced by USBPORT_FlushController().

◆ PushEntryListWrapper()

PSINGLE_LIST_ENTRY PushEntryListWrapper ( PSINGLE_LIST_ENTRY  ListHead,
PSINGLE_LIST_ENTRY  Entry,
PKSPIN_LOCK  Lock 
)

Definition at line 42 of file ExSingleList.c.

43 {
46  Ret = ListHead->Next;
47  PushEntryList(ListHead, Entry);
48  return Ret;
49 }
Definition: ntbasedef.h:635
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
FORCEINLINE VOID PushEntryList(_Inout_ PSINGLE_LIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PSINGLE_LIST_ENTRY Entry)
Definition: rtlfuncs.h:253
struct _SINGLE_LIST_ENTRY * Next
Definition: ntbasedef.h:636
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment IN PNDIS_RW_LOCK Lock
Definition: CrNtStubs.h:75
base of all file and directory entries
Definition: entries.h:82

◆ QueryDepthList()

USHORT QueryDepthList ( PSINGLE_LIST_ENTRY  ListHead)

Definition at line 31 of file ExSingleList.c.

32 {
33  USHORT Depth = 0;
34  while (ListHead->Next)
35  {
36  ++Depth;
37  ListHead = ListHead->Next;
38  }
39  return Depth;
40 }
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION _In_ ULONG _In_ SIZE_T _In_ ULONG _In_ USHORT Depth
Definition: exfuncs.h:656
struct _SINGLE_LIST_ENTRY * Next
Definition: ntbasedef.h:636
unsigned short USHORT
Definition: pedump.c:61

◆ START_TEST()

START_TEST ( ExSingleList  )

Definition at line 83 of file ExSingleList.c.

84 {
86  PSINGLE_LIST_ENTRY ListHead;
88  SIZE_T EntriesSize = 5 * sizeof *Entries;
89  PCHAR Buffer;
90  KIRQL Irql;
91 
93 
94  /* make sure stuff is as un-aligned as possible ;) */
95  Buffer = ExAllocatePoolWithTag(NonPagedPool, sizeof *ListHead + EntriesSize + 1, 'TLiS');
96  ListHead = (PVOID)&Buffer[1];
97  Entries = (PVOID)&ListHead[1];
99 
100  RtlFillMemory(Entries, sizeof(*Entries), 0x55);
101  ListHead->Next = NULL;
102  TestListFunctional(ListHead, Entries, &SpinLock);
103 
104  RtlFillMemory(Entries, sizeof(*Entries), 0x55);
105  ListHead->Next = NULL;
106  TestListFunctionalExports(ListHead, Entries, &SpinLock);
107 
108  RtlFillMemory(Entries, sizeof(*Entries), 0x55);
109  ListHead->Next = NULL;
110  TestListFunctionalNoInterlocked(ListHead, Entries, &SpinLock);
111 
112  KeLowerIrql(Irql);
113  ExFreePoolWithTag(Buffer, 'TLiS');
114 }
signed char * PCHAR
Definition: retypes.h:7
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
Definition: ntbasedef.h:635
_Out_ PKIRQL Irql
Definition: csq.h:179
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798
UCHAR KIRQL
Definition: env_spec_w32.h:591
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:251
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
void * PVOID
Definition: retypes.h:9
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
struct _SINGLE_LIST_ENTRY * Next
Definition: ntbasedef.h:636
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define HIGH_LEVEL
Definition: env_spec_w32.h:703
LIST_ENTRY Entries[5]
Definition: ExDoubleList.c:8
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593