ReactOS 0.4.15-dev-7788-g1ad9096
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 ok_eq_hex64(value, expected)   ok_eq_print(value, expected, "%I64x")
 
#define ok_eq_xmm(value, expected)   ok((value).Low == (expected).Low, #value " = %I64x'%08I64x, expected %I64x'%08I64x\n", (value).Low, (value).High, (expected).Low, (expected).High)
 
#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 210 of file kmt_test.h.

◆ KMT_MAKE_CODE

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

Definition at line 270 of file kmt_test.h.

◆ KMT_STRINGIZE

#define KMT_STRINGIZE (   x)    #x

Definition at line 216 of file kmt_test.h.

◆ KmtEndSeh

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

Definition at line 288 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"); \
} \
else \
trace("Using system routine for " #RoutineName "\n");
GLfloat GLfloat p
Definition: glext.h:8902
PVOID KmtGetSystemRoutineAddress(IN PCWSTR RoutineName)
#define L(x)
Definition: ntvdm.h:50

Definition at line 298 of file kmt_test.h.

◆ KmtInvalidPointer

#define KmtInvalidPointer   ((PVOID)0x5555555555555555ULL)

Definition at line 280 of file kmt_test.h.

◆ KmtStartSeh

#define KmtStartSeh ( )
Value:
{ \
NTSTATUS ExceptionStatus = STATUS_SUCCESS; \
{
LONG NTSTATUS
Definition: precomp.h:26
#define _SEH2_TRY
Definition: filesup.c:19
#define STATUS_SUCCESS
Definition: shellext.h:65

Definition at line 282 of file kmt_test.h.

◆ MICROSECOND

#define MICROSECOND   10

Definition at line 275 of file kmt_test.h.

◆ MILLISECOND

#define MILLISECOND   (1000 * MICROSECOND)

Definition at line 276 of file kmt_test.h.

◆ ok

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

Definition at line 218 of file kmt_test.h.

◆ ok_

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

Definition at line 222 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 259 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 258 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:218
BOOL expected
Definition: store.c:2063
Definition: pdh_main.c:94

Definition at line 260 of file kmt_test.h.

◆ ok_eq_char

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

Definition at line 246 of file kmt_test.h.

◆ ok_eq_hex

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

Definition at line 257 of file kmt_test.h.

◆ ok_eq_hex64

#define ok_eq_hex64 (   value,
  expected 
)    ok_eq_print(value, expected, "%I64x")

Definition at line 267 of file kmt_test.h.

◆ ok_eq_int

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

Definition at line 240 of file kmt_test.h.

◆ ok_eq_long

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

Definition at line 242 of file kmt_test.h.

◆ ok_eq_longlong

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

Definition at line 244 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 250 of file kmt_test.h.

◆ ok_eq_pointer

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

Definition at line 239 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 238 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 249 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 263 of file kmt_test.h.

◆ ok_eq_tag

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

Definition at line 265 of file kmt_test.h.

◆ ok_eq_uint

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

Definition at line 241 of file kmt_test.h.

◆ ok_eq_ulong

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

Definition at line 243 of file kmt_test.h.

◆ ok_eq_ulonglong

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

Definition at line 245 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 251 of file kmt_test.h.

◆ ok_eq_wchar

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

Definition at line 247 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 264 of file kmt_test.h.

◆ ok_eq_xmm

#define ok_eq_xmm (   value,
  expected 
)    ok((value).Low == (expected).Low, #value " = %I64x'%08I64x, expected %I64x'%08I64x\n", (value).Low, (value).High, (expected).Low, (expected).High)

Definition at line 268 of file kmt_test.h.

◆ SECOND

#define SECOND   (1000 * MILLISECOND)

Definition at line 277 of file kmt_test.h.

◆ skip

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

Definition at line 220 of file kmt_test.h.

◆ skip_

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

Definition at line 224 of file kmt_test.h.

◆ START_TEST

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

Definition at line 213 of file kmt_test.h.

◆ Test_NtQueryVirtualMemory

#define Test_NtQueryVirtualMemory (   BaseAddress,
  Size,
  AllocationType,
  ProtectionType 
)
Value:
do { \
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) \
#define NULL
Definition: types.h:112
PKMT_RESPONSE KmtUserModeCallback(KMT_CALLBACK_INFORMATION_CLASS Operation, PVOID Parameters)
@ QueryVirtualMemory
Definition: kmt_test.h:51
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
_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:410
MEMORY_BASIC_INFORMATION MemInfo
Definition: kmt_test.h:57
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

Definition at line 72 of file kmt_test.h.

◆ trace

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

Definition at line 219 of file kmt_test.h.

◆ trace_

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

Definition at line 223 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 KMT_CALLBACK_INFORMATION_CLASS
enum _KMT_CALLBACK_INFORMATION_CLASS * PKMT_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
612}
#define PAGED_CODE()
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
Definition: ncftp.h:89

Referenced by KmtCleanUsermodeCallbacks().

◆ KmtFreeGuarded()

◆ KmtOk()

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

◆ KmtSkip()

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

◆ 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().