ReactOS  0.4.15-dev-5146-g069b08d
ntddk.template.h
Go to the documentation of this file.
1 /*
2  * ntddk.h
3  *
4  * Windows NT Device Driver Kit
5  *
6  * This file is part of the ReactOS DDK package.
7  *
8  * Contributors:
9  * Amine Khaldi
10  * Timo Kreuzer (timo.kreuzer@reactos.org)
11  *
12  * THIS SOFTWARE IS NOT COPYRIGHTED
13  *
14  * This source code is offered for use in the public domain. You may
15  * use, modify or distribute it freely.
16  *
17  * This code is distributed in the hope that it will be useful but
18  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
19  * DISCLAIMED. This includes but is not limited to warranties of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21  *
22  */
23 
24 #pragma once
25 
26 #define _NTDDK_
27 
28 #if !defined(_NTHAL_) && !defined(_NTIFS_)
29 #define _NTDDK_INCLUDED_
30 #define _DDK_DRIVER_
31 #endif
32 
33 /* Dependencies */
34 
35 #define NT_INCLUDED
36 #define _CTYPE_DISABLE_MACROS
37 
38 #include <wdm.h>
39 #include <excpt.h>
40 #include <ntdef.h>
41 #include <ntstatus.h>
42 #include <mce.h>
43 #include <bugcodes.h>
44 #include <ntiologc.h>
45 
46 #include <stdarg.h> // FIXME
47 #include <basetyps.h> // FIXME
48 
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 /* GUID and UUID */
55 #ifndef _NTLSA_IFS_
56 #ifndef _NTLSA_AUDIT_
57 #define _NTLSA_AUDIT_
58 
59 #ifndef GUID_DEFINED
60 #include <guiddef.h>
61 #endif
62 
63 #endif /* _NTLSA_AUDIT_ */
64 #endif /* _NTLSA_IFS_ */
65 
66 typedef GUID UUID;
67 
68 /* Forward declarations */
70 struct _CREATE_DISK;
71 struct _DRIVE_LAYOUT_INFORMATION_EX;
72 struct _SET_PARTITION_INFORMATION_EX;
73 struct _DISK_GEOMETRY_EX;
74 
75 /* Structures not exposed to drivers */
76 typedef struct _BUS_HANDLER *PBUS_HANDLER;
77 typedef struct _DEVICE_HANDLER_OBJECT *PDEVICE_HANDLER_OBJECT;
78 #if defined(_NTHAL_INCLUDED_)
79 typedef struct _KAFFINITY_EX *PKAFFINITY_EX;
80 #endif
81 typedef struct _PEB *PPEB;
82 
83 #ifndef _NTIMAGE_
84 
87 
88 #ifdef _WIN64
90 #else
92 #endif
93 
94 #endif /* _NTIMAGE_ */
95 
97 $include (extypes.h)
98 $include (cmtypes.h)
99 $include (iotypes.h)
100 $include (haltypes.h)
101 $include (ketypes.h)
102 $include (kdtypes.h)
103 $include (mmtypes.h)
104 $include (pstypes.h)
105 $include (rtltypes.h)
106 $include (setypes.h)
107 
108 #if defined(_M_IX86)
109 $include(x86/ke.h)
110 $include(x86/mm.h)
111 #elif defined(_M_AMD64)
112 $include(amd64/ke.h)
113 $include(amd64/mm.h)
114 #elif defined(_M_IA64)
115 $include(ia64/ke.h)
116 #elif defined(_M_PPC)
117 $include(ppc/ke.h)
118 #elif defined(_M_MIPS)
119 $include(mips/ke.h)
120 #elif defined(_M_ARM)
121 $include(arm/ke.h)
122 $include(arm/mm.h)
123 #elif defined(_M_ARM64)
124 $include(arm64/ke.h)
125 #else
126 #error Unknown Architecture
127 #endif
128 
129 $include (exfuncs.h)
130 $include (halfuncs.h)
131 $include (iofuncs.h)
132 $include (kdfuncs.h)
133 $include (kefuncs.h)
134 $include (mmfuncs.h)
135 $include (psfuncs.h)
136 $include (rtlfuncs.h)
137 $include (sefuncs.h)
138 $include (zwfuncs.h)
139 
140 
141 /* UNSORTED */
142 
143 #define VER_SET_CONDITION(ConditionMask, TypeBitMask, ComparisonType) \
144  ((ConditionMask) = VerSetConditionMask((ConditionMask), \
145  (TypeBitMask), (ComparisonType)))
146 
147 #if (NTDDI_VERSION >= NTDDI_WIN2K)
148 NTSYSAPI
149 ULONGLONG
150 NTAPI
154  IN UCHAR Condition);
155 #endif
156 
157 typedef struct _KERNEL_USER_TIMES {
163 
164 /* NtXxx Functions */
165 
170 
178 
179 typedef NTSTATUS
181  _Inout_ PSYSTEM_FIRMWARE_TABLE_INFORMATION SystemFirmwareTableInfo);
182 
189 
190 typedef ULONG_PTR
192  _In_ PVOID Context);
193 
198 
199 #define DRIVER_VERIFIER_SPECIAL_POOLING 0x0001
200 #define DRIVER_VERIFIER_FORCE_IRQL_CHECKING 0x0002
201 #define DRIVER_VERIFIER_INJECT_ALLOCATION_FAILURES 0x0004
202 #define DRIVER_VERIFIER_TRACK_POOL_ALLOCATIONS 0x0008
203 #define DRIVER_VERIFIER_IO_CHECKING 0x0010
204 
205 #define SHARED_GLOBAL_FLAGS_ERROR_PORT_V 0x0
206 #define SHARED_GLOBAL_FLAGS_ERROR_PORT (1UL << SHARED_GLOBAL_FLAGS_ERROR_PORT_V)
207 
208 #define SHARED_GLOBAL_FLAGS_ELEVATION_ENABLED_V 0x1
209 #define SHARED_GLOBAL_FLAGS_ELEVATION_ENABLED (1UL << SHARED_GLOBAL_FLAGS_ELEVATION_ENABLED_V)
210 
211 #define SHARED_GLOBAL_FLAGS_VIRT_ENABLED_V 0x2
212 #define SHARED_GLOBAL_FLAGS_VIRT_ENABLED (1UL << SHARED_GLOBAL_FLAGS_VIRT_ENABLED_V)
213 
214 #define SHARED_GLOBAL_FLAGS_INSTALLER_DETECT_ENABLED_V 0x3
215 #define SHARED_GLOBAL_FLAGS_INSTALLER_DETECT_ENABLED \
216  (1UL << SHARED_GLOBAL_FLAGS_INSTALLER_DETECT_ENABLED_V)
217 
218 #define SHARED_GLOBAL_FLAGS_SPARE_V 0x4
219 #define SHARED_GLOBAL_FLAGS_SPARE \
220  (1UL << SHARED_GLOBAL_FLAGS_SPARE_V)
221 
222 #define SHARED_GLOBAL_FLAGS_DYNAMIC_PROC_ENABLED_V 0x5
223 #define SHARED_GLOBAL_FLAGS_DYNAMIC_PROC_ENABLED \
224  (1UL << SHARED_GLOBAL_FLAGS_DYNAMIC_PROC_ENABLED_V)
225 
226 #define SHARED_GLOBAL_FLAGS_SEH_VALIDATION_ENABLED_V 0x6
227 #define SHARED_GLOBAL_FLAGS_SEH_VALIDATION_ENABLED \
228  (1UL << SHARED_GLOBAL_FLAGS_SEH_VALIDATION_ENABLED_V)
229 
230 #define EX_INIT_BITS(Flags, Bit) \
231  *((Flags)) |= (Bit) // Safe to use before concurrently accessible
232 
233 #define EX_TEST_SET_BIT(Flags, Bit) \
234  InterlockedBitTestAndSet ((PLONG)(Flags), (Bit))
235 
236 #define EX_TEST_CLEAR_BIT(Flags, Bit) \
237  InterlockedBitTestAndReset ((PLONG)(Flags), (Bit))
238 
239 #define PCCARD_MAP_ERROR 0x01
240 #define PCCARD_DEVICE_PCI 0x10
241 
242 #define PCCARD_SCAN_DISABLED 0x01
243 #define PCCARD_MAP_ZERO 0x02
244 #define PCCARD_NO_TIMER 0x03
245 #define PCCARD_NO_PIC 0x04
246 #define PCCARD_NO_LEGACY_BASE 0x05
247 #define PCCARD_DUP_LEGACY_BASE 0x06
248 #define PCCARD_NO_CONTROLLERS 0x07
249 
250 #define MAXIMUM_EXPANSION_SIZE (KERNEL_LARGE_STACK_SIZE - (PAGE_SIZE / 2))
251 
252 /* Filesystem runtime library routines */
253 
254 #if (NTDDI_VERSION >= NTDDI_WIN2K)
257 BOOLEAN
258 NTAPI
261 #endif
262 
263 #ifdef __cplusplus
264 }
265 #endif
#define IN
Definition: typedefs.h:39
ULONGLONG NTAPI VerSetConditionMask(IN ULONGLONG ConditionMask, IN ULONG TypeMask, IN UCHAR Condition)
Definition: version.c:262
PDRIVER_VERIFIER_THUNK_ROUTINE NewRoutine
#define _Inout_
Definition: ms_sal.h:378
#define __cdecl
Definition: accygwin.h:79
#define ANYSIZE_ARRAY
Definition: typedefs.h:46
$include(setypes.h) $include(obtypes.h) $include(rtltypes.h) $include(rtlfuncs.h) _IRQL_requires_max_(PASSIVE_LEVEL) __kernel_entry NTSYSCALLAPI NTSTATUS NTAPI NtQueryObject(_In_opt_ HANDLE Handle
LONG NTSTATUS
Definition: precomp.h:26
LARGE_INTEGER UserTime
Definition: winternl.h:1063
ULONG_PTR(NTAPI * PDRIVER_VERIFIER_THUNK_ROUTINE)(_In_ PVOID Context)
struct _IMAGE_NT_HEADERS64 * PIMAGE_NT_HEADERS64
_SYSTEM_FIRMWARE_TABLE_ACTION
IN ULONG TypeMask
#define NTSYSAPI
Definition: ntoskrnl.h:12
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
LARGE_INTEGER ExitTime
Definition: winternl.h:1061
struct _SYSTEM_FIRMWARE_TABLE_INFORMATION SYSTEM_FIRMWARE_TABLE_INFORMATION
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
PDRIVER_VERIFIER_THUNK_ROUTINE PristineRoutine
struct _KERNEL_USER_TIMES KERNEL_USER_TIMES
struct _BUS_HANDLER * PBUS_HANDLER
unsigned char BOOLEAN
#define _In_
Definition: ms_sal.h:308
#define NTKERNELAPI
IN ULONG IN UCHAR Condition
struct _IMAGE_NT_HEADERS * PIMAGE_NT_HEADERS32
Status
Definition: gdiplustypes.h:24
enum _SYSTEM_FIRMWARE_TABLE_ACTION SYSTEM_FIRMWARE_TABLE_ACTION
uint64_t ULONGLONG
Definition: typedefs.h:67
LARGE_INTEGER CreateTime
Definition: winternl.h:1060
struct _SYSTEM_FIRMWARE_TABLE_INFORMATION * PSYSTEM_FIRMWARE_TABLE_INFORMATION
NTSTATUS(__cdecl * PFNFTH)(_Inout_ PSYSTEM_FIRMWARE_TABLE_INFORMATION SystemFirmwareTableInfo)
unsigned char UCHAR
Definition: xmlstorage.h:181
#define NTSTATUS
Definition: precomp.h:20
#define _Must_inspect_result_
Definition: ms_sal.h:558
$define(_NTDDK_) $include(extypes.h) $include(cmtypes.h) $include(iotypes.h) $include(haltypes.h) $include(ketypes.h) $include(kdtypes.h) $include(mmtypes.h) $include(pstypes.h) $include(rtltypes.h) $include(setypes.h) $include(exfuncs.h) $include(halfuncs.h) $include(iofuncs.h) $include(kdfuncs.h) $include(kefuncs.h) $include(mmfuncs.h) $include(psfuncs.h) $include(rtlfuncs.h) $include(sefuncs.h) $include(zwfuncs.h) NTSYSAPI ULONGLONG NTAPI VerSetConditionMask(IN ULONGLONG ConditionMask
struct _SYSTEM_FIRMWARE_TABLE_HANDLER SYSTEM_FIRMWARE_TABLE_HANDLER
struct _PEB * PPEB
SYSTEM_FIRMWARE_TABLE_ACTION Action
struct _DRIVER_VERIFIER_THUNK_PAIRS * PDRIVER_VERIFIER_THUNK_PAIRS
Definition: optimize.h:109
_In_ ULONG _In_ ULONGLONG ConditionMask
Definition: rtlfuncs.h:4663
LOCAL ex_t * exfuncs
Definition: comerr.c:50
struct tagContext Context
Definition: acpixf.h:1034
unsigned int ULONG
Definition: retypes.h:1
#define ULONG_PTR
Definition: config.h:101
struct _SYSTEM_FIRMWARE_TABLE_HANDLER * PSYSTEM_FIRMWARE_TABLE_HANDLER
PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
LARGE_INTEGER KernelTime
Definition: winternl.h:1062
struct _DRIVER_VERIFIER_THUNK_PAIRS DRIVER_VERIFIER_THUNK_PAIRS
#define _NTDDK_
GUID UUID
struct _KERNEL_USER_TIMES * PKERNEL_USER_TIMES
_Must_inspect_result_ NTKERNELAPI BOOLEAN NTAPI FsRtlIsTotalDeviceFailure(_In_ NTSTATUS Status)
struct _DEVICE_HANDLER_OBJECT * PDEVICE_HANDLER_OBJECT