ReactOS 0.4.16-dev-1360-g66b782d
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
 
BOOLEAN KmtIsVirtualMachine
 
PCSTR KmtMajorFunctionNames []
 

Typedef Documentation

◆ POOL_HEADER

◆ PPOOL_HEADER

Function Documentation

◆ KmtAreInterruptsEnabled()

BOOLEAN KmtAreInterruptsEnabled ( VOID  )

Definition at line 59 of file kmt_test_kernel.h.

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

Referenced by START_TEST().

◆ KmtFinishThread()

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

Definition at line 172 of file kmt_test_kernel.h.

173{
175
176 if (skip(Thread != NULL, "No thread\n"))
177 return;
178
179 if (Event)
182 Executive,
184 FALSE,
185 NULL);
188}
#define ok_eq_hex(value, expected)
Definition: apitest.h:58
#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:38
#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 102 of file kmt_test_kernel.h.

103{
105
106 /* it's not so easy for allocations of PAGE_SIZE */
107 if (((ULONG_PTR)Memory & (PAGE_SIZE - 1)) == 0)
108 return 'TooL';
109
110 Header = Memory;
111 Header--;
112
113 return Header->PoolTag;
114}
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 116 of file kmt_test_kernel.h.

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

Referenced by TestDriverObject(), and TestPoolQuota().

◆ KmtGetSystemRoutineAddress()

PVOID KmtGetSystemRoutineAddress ( IN PCWSTR  RoutineName)

Definition at line 130 of file kmt_test_kernel.h.

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

Referenced by _IRQL_requires_min_(), and START_TEST().

◆ KmtSetIrql()

VOID KmtSetIrql ( IN KIRQL  NewIrql)

Definition at line 50 of file kmt_test_kernel.h.

51{
53 if (Irql > NewIrql)
55 else if (Irql < NewIrql)
57}
_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 137 of file kmt_test_kernel.h.

138{
141 HANDLE ThreadHandle;
143
145 NULL,
147 NULL,
148 NULL);
149 ThreadHandle = INVALID_HANDLE_VALUE;
150 Status = PsCreateSystemThread(&ThreadHandle,
153 NULL,
154 NULL,
156 StartContext);
158 if (!skip(NT_SUCCESS(Status) && ThreadHandle != NULL && ThreadHandle != INVALID_HANDLE_VALUE, "No thread\n"))
159 {
160 Status = ObReferenceObjectByHandle(ThreadHandle,
165 NULL);
167 ObCloseHandle(ThreadHandle, KernelMode);
168 }
169 return ThreadObject;
170}
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#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().

◆ KmtIsVirtualMachine

BOOLEAN KmtIsVirtualMachine

Definition at line 17 of file kmt_test_kernel.h.

Referenced by TestStringIo().

◆ KmtMajorFunctionNames

PCSTR KmtMajorFunctionNames[]

Definition at line 18 of file kmt_test_kernel.h.

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