ReactOS 0.4.16-dev-297-gc569aee
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)
USHORT QueryDepthList(PSINGLE_LIST_ENTRY ListHead)
Definition: ExSingleList.c:31
#define HIGH_LEVEL
Definition: env_spec_w32.h:703
BOOLEAN KmtAreInterruptsEnabled(VOID)

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); \
else \
ok_eq_pointer(Value, Expected); \
} while (0)
BOOLEAN Expected
BOOLEAN KmtIsCheckedBuild
uint32_t ULONG_PTR
Definition: typedefs.h:65
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

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}
#define NULL
Definition: types.h:112
Definition: ntbasedef.h:636
struct _SINGLE_LIST_ENTRY * Next
Definition: ntbasedef.h:637

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}
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325
base of all file and directory entries
Definition: entries.h:83
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:127
FORCEINLINE VOID PushEntryList(_Inout_ PSINGLE_LIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PSINGLE_LIST_ENTRY Entry)
Definition: rtlfuncs.h:256

◆ 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}
unsigned short USHORT
Definition: pedump.c:61
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION _In_ ULONG _In_ SIZE_T _In_ ULONG _In_ USHORT Depth
Definition: exfuncs.h:819

◆ 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;
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
113 ExFreePoolWithTag(Buffer, 'TLiS');
114}
static const ENTRY Entries[]
Definition: bufpool.h:45
_Out_ PKIRQL Irql
Definition: csq.h:179
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
UCHAR KIRQL
Definition: env_spec_w32.h:591
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
#define NonPagedPool
Definition: env_spec_w32.h:307
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:599
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
void * PVOID
Definition: typedefs.h:50
ULONG_PTR SIZE_T
Definition: typedefs.h:80
char * PCHAR
Definition: typedefs.h:51
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFSPINLOCK * SpinLock
Definition: wdfsync.h:228