ReactOS  r75907
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

Function Documentation

BOOLEAN KmtAreInterruptsEnabled ( VOID  )

Definition at line 58 of file kmt_test_kernel.h.

Referenced by START_TEST().

59 {
60  return (__readeflags() & (1 << 9)) != 0;
61 }
__INTRIN_INLINE uintptr_t __readeflags(void)
Definition: intrin_x86.h:1456
VOID KmtFinishThread ( IN PKTHREAD Thread  OPTIONAL,
IN PKEVENT Event  OPTIONAL 
)

Definition at line 171 of file kmt_test_kernel.h.

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

172 {
174 
175  if (skip(Thread != NULL, "No thread\n"))
176  return;
177 
178  if (Event)
180  Status = KeWaitForSingleObject(Thread,
181  Executive,
182  KernelMode,
183  FALSE,
184  NULL);
185  ok_eq_hex(Status, STATUS_SUCCESS);
187 }
#define TRUE
Definition: types.h:120
return STATUS_SUCCESS
Definition: btrfs.c:2664
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:267
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
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:513
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
Status
Definition: gdiplustypes.h:24
LONG NTSTATUS
Definition: DriverTester.h:11
#define skip(...)
Definition: CString.cpp:57
#define IO_NO_INCREMENT
Definition: iotypes.h:565
#define ok_eq_hex(value, expected)
ULONG KmtGetPoolTag ( PVOID  Memory)

Definition at line 101 of file kmt_test_kernel.h.

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

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 }
uint32_t ULONG_PTR
Definition: typedefs.h:64
Definition: Header.h:8
ACPI_EFI_MEMORY_TYPE UINTN ACPI_EFI_PHYSICAL_ADDRESS * Memory
Definition: acefiex.h:530
#define PAGE_SIZE
Definition: env_spec_w32.h:49
USHORT KmtGetPoolType ( PVOID  Memory)

Definition at line 115 of file kmt_test_kernel.h.

Referenced by TestDriverObject(), and TestPoolQuota().

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 }
uint32_t ULONG_PTR
Definition: typedefs.h:64
Definition: Header.h:8
ACPI_EFI_MEMORY_TYPE UINTN ACPI_EFI_PHYSICAL_ADDRESS * Memory
Definition: acefiex.h:530
#define PAGE_SIZE
Definition: env_spec_w32.h:49
PVOID KmtGetSystemRoutineAddress ( IN PCWSTR  RoutineName)

Definition at line 129 of file kmt_test_kernel.h.

Referenced by _IRQL_requires_min_(), and START_TEST().

130 {
131  UNICODE_STRING RoutineNameString;
132  RtlInitUnicodeString(&RoutineNameString, (PWSTR)RoutineName);
133  return MmGetSystemRoutineAddress(&RoutineNameString);
134 }
PVOID *typedef PWSTR
Definition: winlogon.h:57
PVOID NTAPI MmGetSystemRoutineAddress(IN PUNICODE_STRING SystemRoutineName)
Definition: sysldr.c:3452
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
VOID KmtSetIrql ( IN KIRQL  NewIrql)

Definition at line 49 of file kmt_test_kernel.h.

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

50 {
52  if (Irql > NewIrql)
54  else if (Irql < NewIrql)
55  KeRaiseIrql(NewIrql, &Irql);
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
PKTHREAD KmtStartThread ( IN PKSTART_ROUTINE  StartRoutine,
IN PVOID StartContext  OPTIONAL 
)

Definition at line 136 of file kmt_test_kernel.h.

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

137 {
140  HANDLE ThreadHandle;
142 
143  InitializeObjectAttributes(&ObjectAttributes,
144  NULL,
146  NULL,
147  NULL);
148  ThreadHandle = INVALID_HANDLE_VALUE;
149  Status = PsCreateSystemThread(&ThreadHandle,
150  SYNCHRONIZE,
151  &ObjectAttributes,
152  NULL,
153  NULL,
154  StartRoutine,
155  StartContext);
156  ok_eq_hex(Status, STATUS_SUCCESS);
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);
165  ok_eq_hex(Status, STATUS_SUCCESS);
166  ObCloseHandle(ThreadHandle, KernelMode);
167  }
168  return ThreadObject;
169 }
DWORD *typedef PVOID
Definition: winlogon.h:52
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
return STATUS_SUCCESS
Definition: btrfs.c:2664
#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:388
smooth NULL
Definition: ftsmooth.c:513
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3369
POBJECT_TYPE PsThreadType
Definition: thread.c:20
#define SYNCHRONIZE
Definition: nt_native.h:61
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: cmd.c:149
DWORD *typedef HANDLE
Definition: winlogon.h:52
LONG NTSTATUS
Definition: DriverTester.h:11
#define skip(...)
Definition: CString.cpp:57
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 InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define ok_eq_hex(value, expected)
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
INT __cdecl KmtVSNPrintF ( PSTR  Buffer,
SIZE_T  BufferMaxLength,
PCSTR  Format,
va_list  Arguments 
)

Variable Documentation

BOOLEAN KmtIsMultiProcessorBuild

Definition at line 16 of file kmt_test_kernel.h.

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

PCSTR KmtMajorFunctionNames[]

Definition at line 17 of file kmt_test_kernel.h.

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