ReactOS  0.4.14-dev-49-gfb4591c
kmt_test.h File Reference
#include <kmt_platform.h>
Include dependency graph for kmt_test.h:

Go to the source code of this file.

Classes

struct  KMT_TEST
 
struct  KMT_RESULTBUFFER
 
union  _KMT_RESPONSE
 
struct  _KMT_CALLBACK_REQUEST_PACKET
 

Macros

#define Test_NtQueryVirtualMemory(BaseAddress, Size, AllocationType, ProtectionType)
 
#define KMT_FORMAT(type, fmt, first)
 
#define START_TEST(name)   VOID Test_##name(VOID)
 
#define KMT_STRINGIZE(x)   #x
 
#define ok(test, ...)   ok_(test, __FILE__, __LINE__, __VA_ARGS__)
 
#define trace(...)   trace_( __FILE__, __LINE__, __VA_ARGS__)
 
#define skip(test, ...)   skip_(test, __FILE__, __LINE__, __VA_ARGS__)
 
#define ok_(test, file, line, ...)   KmtOk(test, file ":" KMT_STRINGIZE(line), __VA_ARGS__)
 
#define trace_(file, line, ...)   KmtTrace( file ":" KMT_STRINGIZE(line), __VA_ARGS__)
 
#define skip_(test, file, line, ...)   KmtSkip(test, file ":" KMT_STRINGIZE(line), __VA_ARGS__)
 
#define ok_eq_print(value, expected, spec)   ok((value) == (expected), #value " = " spec ", expected " spec "\n", value, expected)
 
#define ok_eq_pointer(value, expected)   ok_eq_print(value, expected, "%p")
 
#define ok_eq_int(value, expected)   ok_eq_print(value, expected, "%d")
 
#define ok_eq_uint(value, expected)   ok_eq_print(value, expected, "%u")
 
#define ok_eq_long(value, expected)   ok_eq_print(value, expected, "%ld")
 
#define ok_eq_ulong(value, expected)   ok_eq_print(value, expected, "%lu")
 
#define ok_eq_longlong(value, expected)   ok_eq_print(value, expected, "%I64d")
 
#define ok_eq_ulonglong(value, expected)   ok_eq_print(value, expected, "%I64u")
 
#define ok_eq_char(value, expected)   ok_eq_print(value, expected, "%c")
 
#define ok_eq_wchar(value, expected)   ok_eq_print(value, expected, "%C")
 
#define ok_eq_size(value, expected)   ok_eq_print(value, (SIZE_T)(expected), "%lu")
 
#define ok_eq_longptr(value, expected)   ok_eq_print(value, (LONG_PTR)(expected), "%ld")
 
#define ok_eq_ulongptr(value, expected)   ok_eq_print(value, (ULONG_PTR)(expected), "%lu")
 
#define ok_eq_hex(value, expected)   ok_eq_print(value, expected, "0x%08lx")
 
#define ok_bool_true(value, desc)   ok((value) == TRUE, desc " FALSE, expected TRUE\n")
 
#define ok_bool_false(value, desc)   ok((value) == FALSE, desc " TRUE, expected FALSE\n")
 
#define ok_eq_bool(value, expected)
 
#define ok_eq_str(value, expected)   ok(!strcmp(value, expected), #value " = \"%s\", expected \"%s\"\n", value, expected)
 
#define ok_eq_wstr(value, expected)   ok(!wcscmp(value, expected), #value " = \"%ls\", expected \"%ls\"\n", value, expected)
 
#define ok_eq_tag(value, expected)   ok_eq_print(value, expected, "0x%08lx")
 
#define KMT_MAKE_CODE(ControlCode)
 
#define MICROSECOND   10
 
#define MILLISECOND   (1000 * MICROSECOND)
 
#define SECOND   (1000 * MILLISECOND)
 
#define KmtInvalidPointer   ((PVOID)0x5555555555555555ULL)
 
#define KmtStartSeh()
 
#define KmtEndSeh(ExpectedStatus)
 
#define KmtGetSystemOrEmbeddedRoutineAddress(RoutineName)
 

Typedefs

typedef VOID KMT_TESTFUNC(VOID)
 
typedef KMT_TESTFUNCPKMT_TESTFUNC
 
typedef struct KMT_TESTPKMT_TEST
 
typedef const KMT_TEST CKMT_TEST
 
typedef const KMT_TESTPCKMT_TEST
 
typedef struct KMT_RESULTBUFFERPKMT_RESULTBUFFER
 
typedef enum _KMT_CALLBACK_INFORMATION_CLASS KMT_CALLBACK_INFORMATION_CLASS
 
typedef enum _KMT_CALLBACK_INFORMATION_CLASSPKMT_CALLBACK_INFORMATION_CLASS
 
typedef union _KMT_RESPONSE KMT_RESPONSE
 
typedef union _KMT_RESPONSEPKMT_RESPONSE
 
typedef struct _KMT_CALLBACK_REQUEST_PACKET KMT_CALLBACK_REQUEST_PACKET
 
typedef struct _KMT_CALLBACK_REQUEST_PACKETPKMT_CALLBACK_REQUEST_PACKET
 

Enumerations

enum  _KMT_CALLBACK_INFORMATION_CLASS { QueryVirtualMemory }
 

Functions

PKMT_RESPONSE KmtUserModeCallback (KMT_CALLBACK_INFORMATION_CLASS Operation, PVOID Parameters)
 
VOID KmtFreeCallbackResponse (PKMT_RESPONSE Response)
 
BOOLEAN KmtVOk (INT Condition, PCSTR FileAndLine, PCSTR Format, va_list Arguments) KMT_FORMAT(ms_printf
 
BOOLEAN BOOLEAN KmtOk (INT Condition, PCSTR FileAndLine, PCSTR Format,...) KMT_FORMAT(ms_printf
 
BOOLEAN BOOLEAN VOID KmtVTrace (PCSTR FileAndLine, PCSTR Format, va_list Arguments) KMT_FORMAT(ms_printf
 
BOOLEAN BOOLEAN VOID VOID KmtTrace (PCSTR FileAndLine, PCSTR Format,...) KMT_FORMAT(ms_printf
 
BOOLEAN BOOLEAN VOID VOID BOOLEAN KmtVSkip (INT Condition, PCSTR FileAndLine, PCSTR Format, va_list Arguments) KMT_FORMAT(ms_printf
 
BOOLEAN BOOLEAN VOID VOID BOOLEAN BOOLEAN KmtSkip (INT Condition, PCSTR FileAndLine, PCSTR Format,...) KMT_FORMAT(ms_printf
 
BOOLEAN BOOLEAN VOID VOID BOOLEAN BOOLEAN PVOID KmtAllocateGuarded (SIZE_T SizeRequested)
 
VOID KmtFreeGuarded (PVOID Pointer)
 

Variables

const KMT_TEST TestList []
 
PKMT_RESULTBUFFER ResultBuffer
 

Macro Definition Documentation

◆ KMT_FORMAT

#define KMT_FORMAT (   type,
  fmt,
  first 
)

Definition at line 208 of file kmt_test.h.

◆ KMT_MAKE_CODE

#define KMT_MAKE_CODE (   ControlCode)
Value:
0xC00 + (ControlCode), \
#define FILE_ANY_ACCESS
Definition: nt_native.h:609
_IRQL_requires_same_ typedef _In_ ULONG ControlCode
Definition: wmitypes.h:55
#define CTL_CODE(DeviceType, Function, Method, Access)
Definition: nt_native.h:586
#define METHOD_BUFFERED
Definition: nt_native.h:594
#define FILE_DEVICE_UNKNOWN
Definition: winioctl.h:139

Definition at line 265 of file kmt_test.h.

◆ KMT_STRINGIZE

#define KMT_STRINGIZE (   x)    #x

Definition at line 214 of file kmt_test.h.

◆ KmtEndSeh

#define KmtEndSeh (   ExpectedStatus)
Value:
} \
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) \
{ \
ExceptionStatus = _SEH2_GetExceptionCode(); \
} \
_SEH2_END; \
ok_eq_hex(ExceptionStatus, (ExpectedStatus)); \
}
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12

Definition at line 283 of file kmt_test.h.

◆ KmtGetSystemOrEmbeddedRoutineAddress

#define KmtGetSystemOrEmbeddedRoutineAddress (   RoutineName)
Value:
p##RoutineName = KmtGetSystemRoutineAddress(L ## #RoutineName); \
if (!p##RoutineName) \
{ \
p##RoutineName = RoutineName; \
trace("Using embedded routine for " #RoutineName "\n"); \
} \
trace("Using system routine for " #RoutineName "\n");
#define trace(...)
Definition: kmt_test.h:217
PVOID KmtGetSystemRoutineAddress(IN PCWSTR RoutineName)
static const WCHAR L[]
Definition: oid.c:1250
GLfloat GLfloat p
Definition: glext.h:8902

Definition at line 293 of file kmt_test.h.

◆ KmtInvalidPointer

#define KmtInvalidPointer   ((PVOID)0x5555555555555555ULL)

Definition at line 275 of file kmt_test.h.

◆ KmtStartSeh

#define KmtStartSeh ( )
Value:
{ \
NTSTATUS ExceptionStatus = STATUS_SUCCESS; \
_SEH2_TRY \
{
return STATUS_SUCCESS
Definition: btrfs.c:2966

Definition at line 277 of file kmt_test.h.

◆ MICROSECOND

#define MICROSECOND   10

Definition at line 270 of file kmt_test.h.

◆ MILLISECOND

#define MILLISECOND   (1000 * MICROSECOND)

Definition at line 271 of file kmt_test.h.

◆ ok

#define ok (   test,
  ... 
)    ok_(test, __FILE__, __LINE__, __VA_ARGS__)

Definition at line 216 of file kmt_test.h.

◆ ok_

#define ok_ (   test,
  file,
  line,
  ... 
)    KmtOk(test, file ":" KMT_STRINGIZE(line), __VA_ARGS__)

Definition at line 220 of file kmt_test.h.

◆ ok_bool_false

#define ok_bool_false (   value,
  desc 
)    ok((value) == FALSE, desc " TRUE, expected FALSE\n")

Definition at line 257 of file kmt_test.h.

◆ ok_bool_true

#define ok_bool_true (   value,
  desc 
)    ok((value) == TRUE, desc " FALSE, expected TRUE\n")

Definition at line 256 of file kmt_test.h.

◆ ok_eq_bool

#define ok_eq_bool (   value,
  expected 
)
Value:
ok((value) == (expected), #value " = %s, expected %s\n", \
(value) ? "TRUE" : "FALSE", \
(expected) ? "TRUE" : "FALSE")
#define ok(test,...)
Definition: kmt_test.h:216
BOOL expected
Definition: store.c:2063

Definition at line 258 of file kmt_test.h.

◆ ok_eq_char

#define ok_eq_char (   value,
  expected 
)    ok_eq_print(value, expected, "%c")

Definition at line 244 of file kmt_test.h.

◆ ok_eq_hex

#define ok_eq_hex (   value,
  expected 
)    ok_eq_print(value, expected, "0x%08lx")

Definition at line 255 of file kmt_test.h.

◆ ok_eq_int

#define ok_eq_int (   value,
  expected 
)    ok_eq_print(value, expected, "%d")

Definition at line 238 of file kmt_test.h.

◆ ok_eq_long

#define ok_eq_long (   value,
  expected 
)    ok_eq_print(value, expected, "%ld")

Definition at line 240 of file kmt_test.h.

◆ ok_eq_longlong

#define ok_eq_longlong (   value,
  expected 
)    ok_eq_print(value, expected, "%I64d")

Definition at line 242 of file kmt_test.h.

◆ ok_eq_longptr

#define ok_eq_longptr (   value,
  expected 
)    ok_eq_print(value, (LONG_PTR)(expected), "%ld")

Definition at line 248 of file kmt_test.h.

◆ ok_eq_pointer

#define ok_eq_pointer (   value,
  expected 
)    ok_eq_print(value, expected, "%p")

Definition at line 237 of file kmt_test.h.

◆ ok_eq_print

#define ok_eq_print (   value,
  expected,
  spec 
)    ok((value) == (expected), #value " = " spec ", expected " spec "\n", value, expected)

Definition at line 236 of file kmt_test.h.

◆ ok_eq_size

#define ok_eq_size (   value,
  expected 
)    ok_eq_print(value, (SIZE_T)(expected), "%lu")

Definition at line 247 of file kmt_test.h.

◆ ok_eq_str

#define ok_eq_str (   value,
  expected 
)    ok(!strcmp(value, expected), #value " = \"%s\", expected \"%s\"\n", value, expected)

Definition at line 261 of file kmt_test.h.

◆ ok_eq_tag

#define ok_eq_tag (   value,
  expected 
)    ok_eq_print(value, expected, "0x%08lx")

Definition at line 263 of file kmt_test.h.

◆ ok_eq_uint

#define ok_eq_uint (   value,
  expected 
)    ok_eq_print(value, expected, "%u")

Definition at line 239 of file kmt_test.h.

◆ ok_eq_ulong

#define ok_eq_ulong (   value,
  expected 
)    ok_eq_print(value, expected, "%lu")

Definition at line 241 of file kmt_test.h.

◆ ok_eq_ulonglong

#define ok_eq_ulonglong (   value,
  expected 
)    ok_eq_print(value, expected, "%I64u")

Definition at line 243 of file kmt_test.h.

◆ ok_eq_ulongptr

#define ok_eq_ulongptr (   value,
  expected 
)    ok_eq_print(value, (ULONG_PTR)(expected), "%lu")

Definition at line 249 of file kmt_test.h.

◆ ok_eq_wchar

#define ok_eq_wchar (   value,
  expected 
)    ok_eq_print(value, expected, "%C")

Definition at line 245 of file kmt_test.h.

◆ ok_eq_wstr

#define ok_eq_wstr (   value,
  expected 
)    ok(!wcscmp(value, expected), #value " = \"%ls\", expected \"%ls\"\n", value, expected)

Definition at line 262 of file kmt_test.h.

◆ SECOND

#define SECOND   (1000 * MILLISECOND)

Definition at line 272 of file kmt_test.h.

◆ skip

#define skip (   test,
  ... 
)    skip_(test, __FILE__, __LINE__, __VA_ARGS__)

Definition at line 218 of file kmt_test.h.

◆ skip_

#define skip_ (   test,
  file,
  line,
  ... 
)    KmtSkip(test, file ":" KMT_STRINGIZE(line), __VA_ARGS__)

Definition at line 222 of file kmt_test.h.

◆ START_TEST

#define START_TEST (   name)    VOID Test_##name(VOID)

Definition at line 211 of file kmt_test.h.

◆ Test_NtQueryVirtualMemory

#define Test_NtQueryVirtualMemory (   BaseAddress,
  Size,
  AllocationType,
  ProtectionType 
)
Value:
do { \
PKMT_RESPONSE NtQueryTest = KmtUserModeCallback(QueryVirtualMemory, BaseAddress); \
if (NtQueryTest != NULL) \
{ \
ok_eq_hex(NtQueryTest->MemInfo.Protect, ProtectionType); \
ok_eq_hex(NtQueryTest->MemInfo.State, AllocationType); \
ok_eq_size(NtQueryTest->MemInfo.RegionSize, Size); \
KmtFreeCallbackResponse(NtQueryTest); \
} \
} while (0) \
smooth NULL
Definition: ftsmooth.c:416
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T _In_ SECTION_INHERIT _In_ ULONG AllocationType
Definition: mmfuncs.h:404
PKMT_RESPONSE KmtUserModeCallback(KMT_CALLBACK_INFORMATION_CLASS Operation, PVOID Parameters)

Definition at line 72 of file kmt_test.h.

◆ trace

#define trace (   ...)    trace_( __FILE__, __LINE__, __VA_ARGS__)

Definition at line 217 of file kmt_test.h.

◆ trace_

#define trace_ (   file,
  line,
  ... 
)    KmtTrace( file ":" KMT_STRINGIZE(line), __VA_ARGS__)

Definition at line 221 of file kmt_test.h.

Typedef Documentation

◆ CKMT_TEST

Definition at line 30 of file kmt_test.h.

◆ KMT_CALLBACK_INFORMATION_CLASS

◆ KMT_CALLBACK_REQUEST_PACKET

◆ KMT_RESPONSE

typedef union _KMT_RESPONSE KMT_RESPONSE

◆ KMT_TESTFUNC

typedef VOID KMT_TESTFUNC(VOID)

Definition at line 21 of file kmt_test.h.

◆ PCKMT_TEST

Definition at line 30 of file kmt_test.h.

◆ PKMT_CALLBACK_INFORMATION_CLASS

◆ PKMT_CALLBACK_REQUEST_PACKET

◆ PKMT_RESPONSE

typedef union _KMT_RESPONSE * PKMT_RESPONSE

◆ PKMT_RESULTBUFFER

◆ PKMT_TEST

◆ PKMT_TESTFUNC

Definition at line 22 of file kmt_test.h.

Enumeration Type Documentation

◆ _KMT_CALLBACK_INFORMATION_CLASS

Enumerator
QueryVirtualMemory 

Definition at line 49 of file kmt_test.h.

50 {
enum _KMT_CALLBACK_INFORMATION_CLASS * PKMT_CALLBACK_INFORMATION_CLASS
enum _KMT_CALLBACK_INFORMATION_CLASS KMT_CALLBACK_INFORMATION_CLASS

Function Documentation

◆ KmtAllocateGuarded()

◆ KmtFreeCallbackResponse()

VOID KmtFreeCallbackResponse ( PKMT_RESPONSE  Response)

Definition at line 606 of file kmtest_drv.c.

608 {
609  PAGED_CODE();
610 
611  ExFreePoolWithTag(Response, 'pseR');
612 }
#define PAGED_CODE()
Definition: video.h:57
Definition: ncftp.h:89
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

Referenced by KmtCleanUsermodeCallbacks().

◆ KmtFreeGuarded()

◆ KmtOk()

BOOLEAN BOOLEAN KmtOk ( INT  Condition,
PCSTR  FileAndLine,
PCSTR  Format,
  ... 
)

Referenced by CheckSid__(), and VCheckAcl__().

◆ KmtSkip()

BOOLEAN BOOLEAN VOID VOID BOOLEAN BOOLEAN KmtSkip ( INT  Condition,
PCSTR  FileAndLine,
PCSTR  Format,
  ... 
)

Referenced by CheckSid__(), and VCheckAcl__().

◆ KmtTrace()

BOOLEAN BOOLEAN VOID VOID KmtTrace ( PCSTR  FileAndLine,
PCSTR  Format,
  ... 
)

◆ KmtUserModeCallback()

PKMT_RESPONSE KmtUserModeCallback ( KMT_CALLBACK_INFORMATION_CLASS  Operation,
PVOID  Parameters 
)

◆ KmtVOk()

BOOLEAN KmtVOk ( INT  Condition,
PCSTR  FileAndLine,
PCSTR  Format,
va_list  Arguments 
)

◆ KmtVSkip()

BOOLEAN BOOLEAN VOID VOID BOOLEAN KmtVSkip ( INT  Condition,
PCSTR  FileAndLine,
PCSTR  Format,
va_list  Arguments 
)

◆ KmtVTrace()

BOOLEAN BOOLEAN VOID KmtVTrace ( PCSTR  FileAndLine,
PCSTR  Format,
va_list  Arguments 
)

Variable Documentation

◆ ResultBuffer

◆ TestList

Definition at line 17 of file testlist.cpp.

Referenced by NumTests().