ReactOS 0.4.15-dev-8138-g1e75ea8
kmt_test_kernel.h File Reference

Go to the source code of this file.

Classes

struct  _POOL_HEADER
 

Typedefs

typedef struct _POOL_HEADER POOL_HEADER
 
typedef struct _POOL_HEADERPPOOL_HEADER
 

Functions

VOID KmtSetIrql (IN KIRQL NewIrql)
 
BOOLEAN KmtAreInterruptsEnabled (VOID)
 
ULONG KmtGetPoolTag (PVOID Memory)
 
USHORT KmtGetPoolType (PVOID Memory)
 
PVOID KmtGetSystemRoutineAddress (IN PCWSTR RoutineName)
 
PKTHREAD KmtStartThread (IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext OPTIONAL)
 
VOID KmtFinishThread (IN PKTHREAD Thread OPTIONAL, IN PKEVENT Event OPTIONAL)
 
INT __cdecl KmtVSNPrintF (PSTR Buffer, SIZE_T BufferMaxLength, PCSTR Format, va_list Arguments) KMT_FORMAT(ms_printf
 

Variables

BOOLEAN KmtIsCheckedBuild
 
BOOLEAN KmtIsMultiProcessorBuild
 
PCSTR KmtMajorFunctionNames []
 

Typedef Documentation

◆ POOL_HEADER

◆ PPOOL_HEADER

Function Documentation

◆ KmtAreInterruptsEnabled()

BOOLEAN KmtAreInterruptsEnabled ( VOID  )

Definition at line 58 of file kmt_test_kernel.h.

59{
60 return (__readeflags() & (1 << 9)) != 0;
61}
__INTRIN_INLINE uintptr_t __readeflags(void)
Definition: intrin_x86.h:1674

Referenced by START_TEST().

◆ KmtFinishThread()

VOID KmtFinishThread ( IN PKTHREAD Thread  OPTIONAL,
IN PKEVENT Event  OPTIONAL 
)

Definition at line 171 of file kmt_test_kernel.h.

172{
174
175 if (skip(Thread != NULL, "No thread\n"))
176 return;
177
178 if (Event)
181 Executive,
183 FALSE,
184 NULL);
187}
#define ok_eq_hex(value, expected)
Definition: apitest.h:77
#define skip(...)
Definition: atltest.h:64
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
Status
Definition: gdiplustypes.h:25
#define KernelMode
Definition: asm.h:34
#define STATUS_SUCCESS
Definition: shellext.h:65
#define IO_NO_INCREMENT
Definition: iotypes.h:598
@ Executive
Definition: ketypes.h:415
#define ObDereferenceObject
Definition: obfuncs.h:203

Referenced by FinishWorkerThread(), PerformTest(), START_TEST(), TestConnect(), TestEventScheduling(), and TestTdi().

◆ KmtGetPoolTag()

ULONG KmtGetPoolTag ( PVOID  Memory)

Definition at line 101 of file kmt_test_kernel.h.

102{
104
105 /* it's not so easy for allocations of PAGE_SIZE */
106 if (((ULONG_PTR)Memory & (PAGE_SIZE - 1)) == 0)
107 return 'TooL';
108
109 Header = Memory;
110 Header--;
111
112 return Header->PoolTag;
113}
Definition: Header.h:9
#define PAGE_SIZE
Definition: env_spec_w32.h:49
uint32_t ULONG_PTR
Definition: typedefs.h:65
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY * Memory
Definition: wdfmemory.h:169

Referenced by START_TEST(), TestDriverObject(), TestPoolTags(), and TestPrivateFunctions().

◆ KmtGetPoolType()

USHORT KmtGetPoolType ( PVOID  Memory)

Definition at line 115 of file kmt_test_kernel.h.

116{
118
119 /* it's not so easy for allocations of PAGE_SIZE */
120 if (((ULONG_PTR)Memory & (PAGE_SIZE - 1)) == 0)
121 return 0;
122
123 Header = Memory;
124 Header--;
125
126 return Header->PoolType;
127}

Referenced by TestDriverObject(), and TestPoolQuota().

◆ KmtGetSystemRoutineAddress()

PVOID KmtGetSystemRoutineAddress ( IN PCWSTR  RoutineName)

Definition at line 129 of file kmt_test_kernel.h.

130{
131 UNICODE_STRING RoutineNameString;
132 RtlInitUnicodeString(&RoutineNameString, (PWSTR)RoutineName);
133 return MmGetSystemRoutineAddress(&RoutineNameString);
134}
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
PVOID NTAPI MmGetSystemRoutineAddress(IN PUNICODE_STRING SystemRoutineName)
Definition: sysldr.c:3604
uint16_t * PWSTR
Definition: typedefs.h:56

Referenced by _IRQL_requires_min_(), and START_TEST().

◆ KmtSetIrql()

VOID KmtSetIrql ( IN KIRQL  NewIrql)

Definition at line 49 of file kmt_test_kernel.h.

50{
52 if (Irql > NewIrql)
54 else if (Irql < NewIrql)
56}
_Out_ PKIRQL Irql
Definition: csq.h:179
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
_Requires_lock_held_ SpinLock _Releases_lock_ SpinLock _In_ _IRQL_restores_ KIRQL NewIrql
Definition: ke.h:114

Referenced by START_TEST(), TestEventFunctional(), TestFastMutex(), and TestSpinLock().

◆ KmtStartThread()

PKTHREAD KmtStartThread ( IN PKSTART_ROUTINE  StartRoutine,
IN PVOID StartContext  OPTIONAL 
)

Definition at line 136 of file kmt_test_kernel.h.

137{
140 HANDLE ThreadHandle;
142
144 NULL,
146 NULL,
147 NULL);
148 ThreadHandle = INVALID_HANDLE_VALUE;
149 Status = PsCreateSystemThread(&ThreadHandle,
152 NULL,
153 NULL,
155 StartContext);
157 if (!skip(NT_SUCCESS(Status) && ThreadHandle != NULL && ThreadHandle != INVALID_HANDLE_VALUE, "No thread\n"))
158 {
159 Status = ObReferenceObjectByHandle(ThreadHandle,
164 NULL);
166 ObCloseHandle(ThreadHandle, KernelMode);
167 }
168 return ThreadObject;
169}
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
@ ThreadObject
Definition: ketypes.h:412
#define SYNCHRONIZE
Definition: nt_native.h:61
POBJECT_TYPE PsThreadType
Definition: thread.c:20
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
Definition: thread.c:602
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3379
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:494
_In_ ULONG _In_opt_ POBJECT_ATTRIBUTES _In_opt_ HANDLE _Out_opt_ PCLIENT_ID _In_ PKSTART_ROUTINE StartRoutine
Definition: psfuncs.h:91

Referenced by PerformTest(), START_TEST(), StartWorkerThread(), TestConnect(), TestEventScheduling(), and TestTdi().

◆ KmtVSNPrintF()

INT __cdecl KmtVSNPrintF ( PSTR  Buffer,
SIZE_T  BufferMaxLength,
PCSTR  Format,
va_list  Arguments 
)

Variable Documentation

◆ KmtIsCheckedBuild

◆ KmtIsMultiProcessorBuild

BOOLEAN KmtIsMultiProcessorBuild

Definition at line 16 of file kmt_test_kernel.h.

Referenced by DriverEntry(), START_TEST(), TestEventFunctional(), and TestSpinLock().

◆ KmtMajorFunctionNames

PCSTR KmtMajorFunctionNames[]

Definition at line 17 of file kmt_test_kernel.h.

Referenced by DriverDispatch(), TestDispatch(), and TestIrpHandler().