1 /*
2  * PROJECT:     ReactOS kernel-mode tests
3  * LICENSE:     LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+)
4  * PURPOSE:     Kernel-Mode Test Suite platform declarations
5  * COPYRIGHT:   Copyright 2011-2018 Thomas Faber <thomas.faber@reactos.org>
6  *              Copyright 2017 Ged Murphy <gedmurphy@reactos.org>
7  */
8 
9 #ifndef _KMTEST_PLATFORM_H_
10 #define _KMTEST_PLATFORM_H_
11 
12 #if !defined _KMTEST_TEST_H_
13 #error include kmt_test.h instead of including kmt_platform.h!
14 #endif /* !defined _KMTEST_TEST_H_ */
15 
16 #include <limits.h>
17 #include <malloc.h>
18 #include <stdarg.h>
19 
20 #if defined KMT_KERNEL_MODE || defined KMT_STANDALONE_DRIVER
21 #include <ntddk.h>
22 #include <ntifs.h>
23 #include <ndk/exfuncs.h>
24 #include <ndk/kefuncs.h>
25 #include <ndk/mmfuncs.h>
26 #include <ndk/obfuncs.h>
27 #include <ndk/psfuncs.h>
28 #include <ndk/sefuncs.h>
29 #include <ntstrsafe.h>
30 #if defined KMT_FILTER_DRIVER
31 #include <fltkernel.h>
32 #endif
33 
34 #elif defined KMT_USER_MODE
35 #define WIN32_NO_STATUS
36 #define UNICODE
37 #include <windef.h>
38 #include <winbase.h>
39 #include <winreg.h>
40 #include <winsvc.h>
41 #include <ndk/cmfuncs.h>
42 #include <ndk/iofuncs.h>
43 #include <ndk/obfuncs.h>
44 #include <ndk/rtlfuncs.h>
45 #include <ndk/mmfuncs.h>
46 #include <strsafe.h>
47 #include <fltuser.h>
48 
49 
50 #ifdef KMT_EMULATE_KERNEL
51 #define ok_irql(i)
52 #define KIRQL int
53 typedef const UCHAR CUCHAR, *PCUCHAR;
54 typedef ULONG LOGICAL, *PLOGICAL;
55 
56 #undef KeRaiseIrql
57 #define KeRaiseIrql(new, old) *(old) = 123
58 #undef KeLowerIrql
59 #define KeLowerIrql(i) (void)(i)
60 #define ExAllocatePool(type, size)              HeapAlloc(GetProcessHeap(), 0, size)
61 #define ExAllocatePoolWithTag(type, size, tag)  HeapAlloc(GetProcessHeap(), 0, size)
62 #define ExFreePool(p)                           HeapFree(GetProcessHeap(), 0, p)
63 #define ExFreePoolWithTag(p, tag)               HeapFree(GetProcessHeap(), 0, p)
64 #define RtlCopyMemoryNonTemporal                RtlCopyMemory
65 #define RtlPrefetchMemoryNonTemporal(s, l)
66 #define ExRaiseStatus                           RtlRaiseStatus
67 #define KmtIsCheckedBuild                       FALSE
68 #endif /* defined KMT_EMULATE_KERNEL */
69 
70 #endif /* defined KMT_USER_MODE */
71 
72 #include <pseh/pseh2.h>
73 
74 #endif /* !defined _KMTEST_PLATFORM_H_ */
75