ReactOS  0.4.14-dev-98-gb0d4763
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:1555

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,
182  KernelMode,
183  FALSE,
184  NULL);
187 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
smooth NULL
Definition: ftsmooth.c:416
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
Status
Definition: gdiplustypes.h:24
#define skip(...)
Definition: atltest.h:64
#define IO_NO_INCREMENT
Definition: iotypes.h:566
#define ok_eq_hex(value, expected)
return STATUS_SUCCESS
Definition: btrfs.c:2966

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 }
static ULONGLONG Memory
Definition: CcMapData_drv.c:35
uint32_t ULONG_PTR
Definition: typedefs.h:63
Definition: Header.h:8
#define PAGE_SIZE
Definition: env_spec_w32.h:49

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 }
static ULONGLONG Memory
Definition: CcMapData_drv.c:35
uint32_t ULONG_PTR
Definition: typedefs.h:63
Definition: Header.h:8
#define PAGE_SIZE
Definition: env_spec_w32.h:49

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 }
uint16_t * PWSTR
Definition: typedefs.h:54
PVOID NTAPI MmGetSystemRoutineAddress(IN PUNICODE_STRING SystemRoutineName)
Definition: sysldr.c:3417
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)

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 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define KeRaiseIrql(irql, oldIrql)
Definition: env_spec_w32.h:597
#define KeLowerIrql(oldIrql)
Definition: env_spec_w32.h:602
_Out_ PKIRQL Irql
Definition: csq.h:179
UCHAR KIRQL
Definition: env_spec_w32.h:591
_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,
150  SYNCHRONIZE,
152  NULL,
153  NULL,
154  StartRoutine,
155  StartContext);
157  if (!skip(NT_SUCCESS(Status) && ThreadHandle != NULL && ThreadHandle != INVALID_HANDLE_VALUE, "No thread\n"))
158  {
159  Status = ObReferenceObjectByHandle(ThreadHandle,
160  SYNCHRONIZE,
161  *PsThreadType,
162  KernelMode,
163  &ThreadObject,
164  NULL);
166  ObCloseHandle(ThreadHandle, KernelMode);
167  }
168  return ThreadObject;
169 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_In_ ULONG _In_opt_ POBJECT_ATTRIBUTES _In_opt_ HANDLE _Out_opt_ PCLIENT_ID _In_ PKSTART_ROUTINE StartRoutine
Definition: psfuncs.h:87
LONG NTSTATUS
Definition: precomp.h:26
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
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:496
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3376
POBJECT_TYPE PsThreadType
Definition: thread.c:20
#define SYNCHRONIZE
Definition: nt_native.h:61
Status
Definition: gdiplustypes.h:24
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
#define skip(...)
Definition: atltest.h:64
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define ok_eq_hex(value, expected)
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231

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(), and TestEventFunctional().

◆ KmtMajorFunctionNames

PCSTR KmtMajorFunctionNames[]

Definition at line 17 of file kmt_test_kernel.h.

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