ReactOS  0.4.14-dev-115-g4576127
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 
69 struct _CREATE_DISK;
72 struct _DISK_GEOMETRY_EX;
73 
74 typedef struct _BUS_HANDLER *PBUS_HANDLER;
75 typedef struct _DEVICE_HANDLER_OBJECT *PDEVICE_HANDLER_OBJECT;
76 #if defined(_NTHAL_INCLUDED_)
77 typedef struct _KAFFINITY_EX *PKAFFINITY_EX;
78 #endif
79 typedef struct _PEB *PPEB;
80 
81 #ifndef _NTIMAGE_
82 
85 
86 #ifdef _WIN64
88 #else
90 #endif
91 
92 #endif /* _NTIMAGE_ */
93 
95 $include (extypes.h)
96 $include (cmtypes.h)
97 $include (iotypes.h)
98 $include (haltypes.h)
99 $include (ketypes.h)
100 $include (kdtypes.h)
101 $include (mmtypes.h)
102 $include (pstypes.h)
103 $include (rtltypes.h)
104 $include (setypes.h)
105 
106 #if defined(_M_IX86)
107 $include(x86/ke.h)
108 $include(x86/mm.h)
109 #elif defined(_M_AMD64)
110 $include(amd64/ke.h)
111 $include(amd64/mm.h)
112 #elif defined(_M_IA64)
113 $include(ia64/ke.h)
114 #elif defined(_M_PPC)
115 $include(ppc/ke.h)
116 #elif defined(_M_MIPS)
117 $include(mips/ke.h)
118 #elif defined(_M_ARM)
119 $include(arm/ke.h)
120 $include(arm/mm.h)
121 #else
122 #error Unknown Architecture
123 #endif
124 
125 $include (exfuncs.h)
126 $include (halfuncs.h)
127 $include (iofuncs.h)
128 $include (kdfuncs.h)
129 $include (kefuncs.h)
130 $include (mmfuncs.h)
131 $include (psfuncs.h)
132 $include (rtlfuncs.h)
133 $include (sefuncs.h)
134 $include (zwfuncs.h)
135 
136 
137 /* UNSORTED */
138 
139 #define VER_SET_CONDITION(ConditionMask, TypeBitMask, ComparisonType) \
140  ((ConditionMask) = VerSetConditionMask((ConditionMask), \
141  (TypeBitMask), (ComparisonType)))
142 
143 #if (NTDDI_VERSION >= NTDDI_WIN2K)
144 NTSYSAPI
145 ULONGLONG
146 NTAPI
150  IN UCHAR Condition);
151 #endif
152 
153 typedef struct _KERNEL_USER_TIMES {
159 
160 /* NtXxx Functions */
161 
166 
174 
175 typedef NTSTATUS
177  _Inout_ PSYSTEM_FIRMWARE_TABLE_INFORMATION SystemFirmwareTableInfo);
178 
185 
186 typedef ULONG_PTR
188  _In_ PVOID Context);
189 
194 
195 #define DRIVER_VERIFIER_SPECIAL_POOLING 0x0001
196 #define DRIVER_VERIFIER_FORCE_IRQL_CHECKING 0x0002
197 #define DRIVER_VERIFIER_INJECT_ALLOCATION_FAILURES 0x0004
198 #define DRIVER_VERIFIER_TRACK_POOL_ALLOCATIONS 0x0008
199 #define DRIVER_VERIFIER_IO_CHECKING 0x0010
200 
201 #define SHARED_GLOBAL_FLAGS_ERROR_PORT_V 0x0
202 #define SHARED_GLOBAL_FLAGS_ERROR_PORT (1UL << SHARED_GLOBAL_FLAGS_ERROR_PORT_V)
203 
204 #define SHARED_GLOBAL_FLAGS_ELEVATION_ENABLED_V 0x1
205 #define SHARED_GLOBAL_FLAGS_ELEVATION_ENABLED (1UL << SHARED_GLOBAL_FLAGS_ELEVATION_ENABLED_V)
206 
207 #define SHARED_GLOBAL_FLAGS_VIRT_ENABLED_V 0x2
208 #define SHARED_GLOBAL_FLAGS_VIRT_ENABLED (1UL << SHARED_GLOBAL_FLAGS_VIRT_ENABLED_V)
209 
210 #define SHARED_GLOBAL_FLAGS_INSTALLER_DETECT_ENABLED_V 0x3
211 #define SHARED_GLOBAL_FLAGS_INSTALLER_DETECT_ENABLED \
212  (1UL << SHARED_GLOBAL_FLAGS_INSTALLER_DETECT_ENABLED_V)
213 
214 #define SHARED_GLOBAL_FLAGS_SPARE_V 0x4
215 #define SHARED_GLOBAL_FLAGS_SPARE \
216  (1UL << SHARED_GLOBAL_FLAGS_SPARE_V)
217 
218 #define SHARED_GLOBAL_FLAGS_DYNAMIC_PROC_ENABLED_V 0x5
219 #define SHARED_GLOBAL_FLAGS_DYNAMIC_PROC_ENABLED \
220  (1UL << SHARED_GLOBAL_FLAGS_DYNAMIC_PROC_ENABLED_V)
221 
222 #define SHARED_GLOBAL_FLAGS_SEH_VALIDATION_ENABLED_V 0x6
223 #define SHARED_GLOBAL_FLAGS_SEH_VALIDATION_ENABLED \
224  (1UL << SHARED_GLOBAL_FLAGS_SEH_VALIDATION_ENABLED_V)
225 
226 #define EX_INIT_BITS(Flags, Bit) \
227  *((Flags)) |= (Bit) // Safe to use before concurrently accessible
228 
229 #define EX_TEST_SET_BIT(Flags, Bit) \
230  InterlockedBitTestAndSet ((PLONG)(Flags), (Bit))
231 
232 #define EX_TEST_CLEAR_BIT(Flags, Bit) \
233  InterlockedBitTestAndReset ((PLONG)(Flags), (Bit))
234 
235 #define PCCARD_MAP_ERROR 0x01
236 #define PCCARD_DEVICE_PCI 0x10
237 
238 #define PCCARD_SCAN_DISABLED 0x01
239 #define PCCARD_MAP_ZERO 0x02
240 #define PCCARD_NO_TIMER 0x03
241 #define PCCARD_NO_PIC 0x04
242 #define PCCARD_NO_LEGACY_BASE 0x05
243 #define PCCARD_DUP_LEGACY_BASE 0x06
244 #define PCCARD_NO_CONTROLLERS 0x07
245 
246 #define MAXIMUM_EXPANSION_SIZE (KERNEL_LARGE_STACK_SIZE - (PAGE_SIZE / 2))
247 
248 /* Filesystem runtime library routines */
249 
250 #if (NTDDI_VERSION >= NTDDI_WIN2K)
253 BOOLEAN
254 NTAPI
257 #endif
258 
259 #ifdef __cplusplus
260 }
261 #endif
#define IN
Definition: typedefs.h:38
#define _Must_inspect_result_
Definition: no_sal2.h:314
ULONGLONG NTAPI VerSetConditionMask(IN ULONGLONG ConditionMask, IN ULONG TypeMask, IN UCHAR Condition)
Definition: version.c:262
PDRIVER_VERIFIER_THUNK_ROUTINE NewRoutine
#define __cdecl
Definition: accygwin.h:79
#define ANYSIZE_ARRAY
Definition: typedefs.h:45
$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:14
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 NTKERNELAPI
IN ULONG IN UCHAR Condition
struct _IMAGE_NT_HEADERS * PIMAGE_NT_HEADERS32
enum _SYSTEM_FIRMWARE_TABLE_ACTION SYSTEM_FIRMWARE_TABLE_ACTION
uint64_t ULONGLONG
Definition: typedefs.h:65
LARGE_INTEGER CreateTime
Definition: winternl.h:1060
struct _SYSTEM_FIRMWARE_TABLE_INFORMATION * PSYSTEM_FIRMWARE_TABLE_INFORMATION
#define _Inout_
Definition: no_sal2.h:244
NTSTATUS(__cdecl * PFNFTH)(_Inout_ PSYSTEM_FIRMWARE_TABLE_INFORMATION SystemFirmwareTableInfo)
unsigned char UCHAR
Definition: xmlstorage.h:181
#define NTSTATUS
Definition: precomp.h:20
$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
Status
Definition: gdiplustypes.h:24
#define _In_
Definition: no_sal2.h:204
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:4464
LOCAL ex_t * exfuncs
Definition: comerr.c:50
struct tagContext Context
Definition: acpixf.h:1024
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