source: Daodan/MinGW/include/ddk/winddk.h@ 1131

Last change on this file since 1131 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 215.3 KB
Line 
1/*
2 * ddk/winddk.h
3 *
4 * Windows Device Driver Kit -- common elements.
5 *
6 * $Id: winddk.h,v 6d2220f53104 2016/07/21 21:20:34 keithmarshall $
7 *
8 * Written by Casper S. Hornstrup <chorns@users.sourceforge.net>
9 * Copyright (C) 2002-2004, 2006, 2008-2011, 2015, 2016, MinGW.org Project.
10 *
11 *
12 * Permission is hereby granted, free of charge, to any person obtaining a
13 * copy of this software and associated documentation files (the "Software"),
14 * to deal in the Software without restriction, including without limitation
15 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 * and/or sell copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following conditions:
18 *
19 * The above copyright notice, this permission notice, and the following
20 * disclaimer shall be included in all copies or substantial portions of
21 * the Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER
29 * DEALINGS IN THE SOFTWARE.
30 *
31 */
32#ifndef _DDK_WINDDK_H
33#pragma GCC system_header
34
35#if ! (defined _DDK_NTDDK_H || defined __WINIOCTL_H_SOURCED__)
36/* Unless sourced by <winioctl.h>, (which represents only partial inclusion),
37 * <ddk/winddk.h> is subsidiary to <ddk/ntddk.h>, and cannot stand alone.
38 */
39# error "Never include <ddk/winddk.h> directly; use <ddk/ntddk.h> instead."
40#else
41/* We've reached here by a legitimate sequence of header inclusion...
42 */
43# ifndef __WINIOCTL_H_SOURCED__
44 /* ...but it is NOT sourced by <winioctl.h>, so this is full inclusion:
45 * set the repeat inclusion guard, so we will not include it again.
46 */
47# define _DDK_WINDDK_H
48# endif
49
50#if ! (defined _DDK_WINDDK_H && defined _WINIOCTL_H)
51/* The declarations within this section are common to <ddk/winddk.h> and
52 * to <winioctl.h>, but if BOTH repeat inclusion guards are now defined,
53 * then we've already seen this; there is no need to process it again.
54 */
55#define CTL_CODE(DT,FN,M,A) (((DT)<<16)|((FN)<<2)|((A)<<14)|(M))
56#define DEVICE_TYPE_FROM_CTL_CODE(C) (((ULONG)((C) & (0xFFFF0000)) >> 16)
57
58typedef ULONG DEVICE_TYPE;
59enum
60{ FILE_DEVICE_BEEP = 0x00000001UL,
61 FILE_DEVICE_CD_ROM = 0x00000002UL,
62 FILE_DEVICE_CD_ROM_FILE_SYSTEM = 0x00000003UL,
63 FILE_DEVICE_CONTROLLER = 0x00000004UL,
64 FILE_DEVICE_DATALINK = 0x00000005UL,
65 FILE_DEVICE_DFS = 0x00000006UL,
66 FILE_DEVICE_DISK = 0x00000007UL,
67 FILE_DEVICE_DISK_FILE_SYSTEM = 0x00000008UL,
68 FILE_DEVICE_FILE_SYSTEM = 0x00000009UL,
69 FILE_DEVICE_INPORT_PORT = 0x0000000AUL,
70 FILE_DEVICE_KEYBOARD = 0x0000000BUL,
71 FILE_DEVICE_MAILSLOT = 0x0000000CUL,
72 FILE_DEVICE_MIDI_IN = 0x0000000DUL,
73 FILE_DEVICE_MIDI_OUT = 0x0000000EUL,
74 FILE_DEVICE_MOUSE = 0x0000000FUL,
75 FILE_DEVICE_MULTI_UNC_PROVIDER = 0x00000010UL,
76 FILE_DEVICE_NAMED_PIPE = 0x00000011UL,
77 FILE_DEVICE_NETWORK = 0x00000012UL,
78 FILE_DEVICE_NETWORK_BROWSER = 0x00000013UL,
79 FILE_DEVICE_NETWORK_FILE_SYSTEM = 0x00000014UL,
80 FILE_DEVICE_NULL = 0x00000015UL,
81 FILE_DEVICE_PARALLEL_PORT = 0x00000016UL,
82 FILE_DEVICE_PHYSICAL_NETCARD = 0x00000017UL,
83 FILE_DEVICE_PRINTER = 0x00000018UL,
84 FILE_DEVICE_SCANNER = 0x00000019UL,
85 FILE_DEVICE_SERIAL_MOUSE_PORT = 0x0000001AUL,
86 FILE_DEVICE_SERIAL_PORT = 0x0000001BUL,
87 FILE_DEVICE_SCREEN = 0x0000001CUL,
88 FILE_DEVICE_SOUND = 0x0000001DUL,
89 FILE_DEVICE_STREAMS = 0x0000001EUL,
90 FILE_DEVICE_TAPE = 0x0000001FUL,
91 FILE_DEVICE_TAPE_FILE_SYSTEM = 0x00000020UL,
92 FILE_DEVICE_TRANSPORT = 0x00000021UL,
93 FILE_DEVICE_UNKNOWN = 0x00000022UL,
94 FILE_DEVICE_VIDEO = 0x00000023UL,
95 FILE_DEVICE_VIRTUAL_DISK = 0x00000024UL,
96 FILE_DEVICE_WAVE_IN = 0x00000025UL,
97 FILE_DEVICE_WAVE_OUT = 0x00000026UL,
98 FILE_DEVICE_8042_PORT = 0x00000027UL,
99 FILE_DEVICE_NETWORK_REDIRECTOR = 0x00000028UL,
100 FILE_DEVICE_BATTERY = 0x00000029UL,
101 FILE_DEVICE_BUS_EXTENDER = 0x0000002AUL,
102 FILE_DEVICE_MODEM = 0x0000002BUL,
103 FILE_DEVICE_VDM = 0x0000002CUL,
104 FILE_DEVICE_MASS_STORAGE = 0x0000002DUL,
105 FILE_DEVICE_SMB = 0x0000002EUL,
106 FILE_DEVICE_KS = 0x0000002FUL,
107 FILE_DEVICE_CHANGER = 0x00000030UL,
108 FILE_DEVICE_SMARTCARD = 0x00000031UL,
109 FILE_DEVICE_ACPI = 0x00000032UL,
110 FILE_DEVICE_DVD = 0x00000033UL,
111 FILE_DEVICE_FULLSCREEN_VIDEO = 0x00000034UL,
112 FILE_DEVICE_DFS_FILE_SYSTEM = 0x00000035UL,
113 FILE_DEVICE_DFS_VOLUME = 0x00000036UL,
114 FILE_DEVICE_SERENUM = 0x00000037UL,
115 FILE_DEVICE_TERMSRV = 0x00000038UL,
116 FILE_DEVICE_KSEC = 0x00000039UL,
117 FILE_DEVICE_FIPS = 0x0000003AUL
118};
119
120enum
121{ FILE_ANY_ACCESS = 0x00000000UL,
122 FILE_SPECIAL_ACCESS = FILE_ANY_ACCESS,
123 FILE_READ_ACCESS = 0x00000001UL,
124 FILE_WRITE_ACCESS = 0x00000002UL
125};
126
127enum
128{ METHOD_BUFFERED = 0,
129 METHOD_IN_DIRECT = 1,
130 METHOD_OUT_DIRECT = 2,
131 METHOD_NEITHER = 3
132};
133
134/* Some derived convenience macros; Microsoft do not specify these,
135 * but they help to keep the CTL_CODE specifications tidy.
136 */
137#define __FILE_RW_ACCESS (FILE_READ_ACCESS | FILE_WRITE_ACCESS)
138#define __FILE_AM_BUFFERED(F,OP) F(OP, METHOD_BUFFERED, FILE_ANY_ACCESS)
139#define __FILE_RD_BUFFERED(F,OP) F(OP, METHOD_BUFFERED, FILE_READ_ACCESS)
140#define __FILE_RW_BUFFERED(F,OP) F(OP, METHOD_BUFFERED, __FILE_RW_ACCESS)
141
142typedef
143struct _DRIVE_LAYOUT_INFORMATION_MBR
144/* https://msdn.microsoft.com/en-us/library/windows/hardware/ff552668(v=vs.85).aspx */
145{ ULONG Signature;
146} DRIVE_LAYOUT_INFORMATION_MBR, *PDRIVE_LAYOUT_INFORMATION_MBR;
147
148typedef
149struct _DRIVE_LAYOUT_INFORMATION_GPT
150/* https://msdn.microsoft.com/en-us/library/windows/hardware/ff552664(v=vs.85).aspx */
151{ GUID DiskId;
152 LARGE_INTEGER StartingUsableOffset;
153 LARGE_INTEGER UsableLength;
154 ULONG MaxPartitionCount;
155} DRIVE_LAYOUT_INFORMATION_GPT, *PDRIVE_LAYOUT_INFORMATION_GPT;
156
157typedef
158struct _PARTITION_INFORMATION_MBR
159/* https://msdn.microsoft.com/en-us/library/windows/hardware/ff563767(v=vs.85).aspx */
160{ UCHAR PartitionType;
161 BOOLEAN BootIndicator;
162 BOOLEAN RecognizedPartition;
163 ULONG HiddenSectors;
164} PARTITION_INFORMATION_MBR, *PPARTITION_INFORMATION_MBR;
165
166typedef
167enum _PARTITION_STYLE
168/* https://msdn.microsoft.com/en-us/library/windows/hardware/ff563773(v=vs.85).aspx */
169{ PARTITION_STYLE_MBR = 0,
170 PARTITION_STYLE_GPT = 1,
171 PARTITION_STYLE_RAW = 2
172} PARTITION_STYLE;
173
174typedef
175struct _CREATE_DISK_MBR
176/* https://msdn.microsoft.com/en-us/library/windows/hardware/ff552490(v=vs.85).aspx */
177{ ULONG Signature;
178} CREATE_DISK_MBR, *PCREATE_DISK_MBR;
179
180typedef
181struct _CREATE_DISK_GPT
182/* https://msdn.microsoft.com/en-us/library/windows/hardware/ff552486(v=vs.85).aspx */
183{ GUID DiskId;
184 ULONG MaxPartitionCount;
185} CREATE_DISK_GPT, *PCREATE_DISK_GPT;
186
187typedef
188struct _CREATE_DISK
189/* https://msdn.microsoft.com/en-us/library/windows/hardware/ff552490(v=vs.85).aspx */
190{ PARTITION_STYLE PartitionStyle;
191 _ANONYMOUS_UNION union
192 { CREATE_DISK_MBR Mbr;
193 CREATE_DISK_GPT Gpt;
194 } DUMMYUNIONNAME;
195} CREATE_DISK, *PCREATE_DISK;
196
197/* End of _DDK_WINDDK_H and _WINIOCTL_H common declarations.
198 */
199#endif
200#ifdef _DDK_WINDDK_H
201/* Definitions specific to _DDK_WINDDK_H
202 */
203
204_BEGIN_C_DECLS
205
206#define DDKAPI __stdcall
207#define DDKFASTAPI __fastcall
208#define DDKCDECLAPI __cdecl
209
210#if defined(_NTOSKRNL_)
211# ifndef NTOSAPI
212# define NTOSAPI DECL_EXPORT
213# endif
214# define DECLARE_INTERNAL_OBJECT(x) typedef struct _##x; typedef struct _##x *P##x;
215# define DECLARE_INTERNAL_OBJECT2(x,y) typedef struct _##x; typedef struct _##x *P##y;
216#else
217# ifndef NTOSAPI
218# define NTOSAPI DECL_IMPORT
219# endif
220# define DECLARE_INTERNAL_OBJECT(x) struct _##x; typedef struct _##x *P##x;
221# define DECLARE_INTERNAL_OBJECT2(x,y) struct _##x; typedef struct _##x *P##y;
222#endif
223
224#ifndef _NO_W32_PSEUDO_MODIFIERS
225 /* Pseudo modifiers for parameters...
226 *
227 * We don't use these unnecessary defines in the w32api headers. Define
228 * them by default since that is what people expect, but allow users to
229 * avoid the pollution, by defining _NO_W32_PSEUDO_MODIFIERS.
230 */
231# define IN
232# define OUT
233# define OPTIONAL
234# define UNALLIGNED
235#endif
236
237#define CONST const
238#define VOLATILE volatile
239
240#define RESTRICTED_POINTER
241#define POINTER_ALIGNMENT
242
243#ifdef NONAMELESSUNION
244# define _DDK_DUMMYUNION_MEMBER(name) DUMMYUNIONNAME.name
245# define _DDK_DUMMYUNION_N_MEMBER(n, name) DUMMYUNIONNAME##n.name
246#else
247# define _DDK_DUMMYUNION_MEMBER(name) name
248# define _DDK_DUMMYUNION_N_MEMBER(n, name) name
249#endif
250
251/* Forward declarations
252 */
253struct _IRP;
254struct _MDL;
255struct _KAPC;
256struct _KDPC;
257struct _KPCR;
258struct _KPRCB;
259struct _KTSS;
260struct _FILE_OBJECT;
261struct _DMA_ADAPTER;
262struct _DEVICE_OBJECT;
263struct _DRIVER_OBJECT;
264struct _SECTION_OBJECT;
265struct _IO_STATUS_BLOCK;
266struct _DEVICE_DESCRIPTION;
267struct _SCATTER_GATHER_LIST;
268
269DECLARE_INTERNAL_OBJECT(ADAPTER_OBJECT)
270DECLARE_INTERNAL_OBJECT(DMA_ADAPTER)
271DECLARE_INTERNAL_OBJECT(IO_STATUS_BLOCK)
272DECLARE_INTERNAL_OBJECT(SECTION_OBJECT)
273
274#if 1
275/* FIXME: Unknown definitions
276 */
277struct _SET_PARTITION_INFORMATION_EX;
278typedef ULONG WAIT_TYPE;
279typedef HANDLE TRACEHANDLE;
280typedef PVOID PWMILIB_CONTEXT;
281typedef PVOID PSYSCTL_IRP_DISPOSITION;
282typedef ULONG LOGICAL;
283#endif
284
285/* Routines specific to this DDK
286 */
287#define TAG(_a, _b, _c, _d) (ULONG) \
288 (((_a) << 0) + ((_b) << 8) + ((_c) << 16) + ((_d) << 24))
289
290#ifdef __GNUC__
291static __inline__ struct _KPCR * KeGetCurrentKPCR( VOID )
292{
293 ULONG Value;
294
295 __asm__ __volatile__ (
296#if (__GNUC__ >= 3)
297 /* support -masm=intel */
298 "mov{l} {%%fs:0x18, %0|%0, %%fs:0x18}\n\t"
299#else
300 "movl %%fs:0x18, %0\n\t"
301#endif
302 : "=r" (Value)
303 : /* no inputs */
304 );
305 return (struct _KPCR *)(Value);
306}
307
308#elif defined( __WATCOMC__ )
309extern struct _KPCR * KeGetCurrentKPCR( void );
310#pragma aux KeGetCurrentKPCR = \
311 "mov eax, fs:[0x18]" \
312 value [ eax ];
313#endif
314
315/* Simple structures
316 */
317typedef LONG KPRIORITY;
318typedef UCHAR KIRQL, *PKIRQL;
319typedef ULONG_PTR KSPIN_LOCK, *PKSPIN_LOCK;
320typedef ULONG_PTR KAFFINITY, *PKAFFINITY;
321typedef CCHAR KPROCESSOR_MODE;
322
323typedef
324enum _MODE
325{ KernelMode,
326 UserMode,
327 MaximumMode
328} MODE;
329
330
331/* Structures not exposed to drivers
332 */
333typedef struct _IO_TIMER *PIO_TIMER;
334typedef struct _EPROCESS *PEPROCESS;
335typedef struct _ETHREAD *PETHREAD;
336typedef struct _KINTERRUPT *PKINTERRUPT;
337typedef struct _OBJECT_TYPE *POBJECT_TYPE;
338typedef struct _KTHREAD *PKTHREAD, *PRKTHREAD;
339typedef struct _COMPRESSED_DATA_INFO *PCOMPRESSED_DATA_INFO;
340typedef struct _HAL_DISPATCH_TABLE *PHAL_DISPATCH_TABLE;
341typedef struct _HAL_PRIVATE_DISPATCH_TABLE *PHAL_PRIVATE_DISPATCH_TABLE;
342typedef struct _DRIVE_LAYOUT_INFORMATION *PDRIVE_LAYOUT_INFORMATION;
343typedef struct _DRIVE_LAYOUT_INFORMATION_EX *PDRIVE_LAYOUT_INFORMATION_EX;
344
345/* Constants
346 */
347#define MAXIMUM_PROCESSORS 32
348#define MAXIMUM_WAIT_OBJECTS 64
349
350#define LOW_PRIORITY 0
351#define LOW_REALTIME_PRIORITY 16
352#define HIGH_PRIORITY 31
353#define MAXIMUM_PRIORITY 32
354
355#define FILE_SUPERSEDED 0x00000000
356#define FILE_OPENED 0x00000001
357#define FILE_CREATED 0x00000002
358#define FILE_OVERWRITTEN 0x00000003
359#define FILE_EXISTS 0x00000004
360#define FILE_DOES_NOT_EXIST 0x00000005
361
362#if 1
363/* FIXME: also in winnt.h; hence, already defined?
364 */
365#define FILE_LIST_DIRECTORY 0x00000001
366#define FILE_READ_DATA 0x00000001
367#define FILE_ADD_FILE 0x00000002
368#define FILE_WRITE_DATA 0x00000002
369#define FILE_ADD_SUBDIRECTORY 0x00000004
370#define FILE_APPEND_DATA 0x00000004
371#define FILE_CREATE_PIPE_INSTANCE 0x00000004
372#define FILE_READ_EA 0x00000008
373#define FILE_WRITE_EA 0x00000010
374#define FILE_EXECUTE 0x00000020
375#define FILE_TRAVERSE 0x00000020
376#define FILE_DELETE_CHILD 0x00000040
377#define FILE_READ_ATTRIBUTES 0x00000080
378#define FILE_WRITE_ATTRIBUTES 0x00000100
379
380#define FILE_SHARE_READ 0x00000001
381#define FILE_SHARE_WRITE 0x00000002
382#define FILE_SHARE_DELETE 0x00000004
383#define FILE_SHARE_VALID_FLAGS 0x00000007
384
385#define FILE_ATTRIBUTE_READONLY 0x00000001
386#define FILE_ATTRIBUTE_HIDDEN 0x00000002
387#define FILE_ATTRIBUTE_SYSTEM 0x00000004
388#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
389#define FILE_ATTRIBUTE_ARCHIVE 0x00000020
390#define FILE_ATTRIBUTE_DEVICE 0x00000040
391#define FILE_ATTRIBUTE_NORMAL 0x00000080
392#define FILE_ATTRIBUTE_TEMPORARY 0x00000100
393#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
394#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
395#define FILE_ATTRIBUTE_COMPRESSED 0x00000800
396#define FILE_ATTRIBUTE_OFFLINE 0x00001000
397#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
398#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
399#define FILE_ATTRIBUTE_VIRTUAL 0x00010000
400
401#define FILE_ATTRIBUTE_VALID_FLAGS 0x00017fb7
402#define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
403
404#define FILE_COPY_STRUCTURED_STORAGE 0x00000041
405#define FILE_STRUCTURED_STORAGE 0x00000441
406
407#define FILE_VALID_OPTION_FLAGS 0x00ffffff
408#define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032
409#define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032
410#define FILE_VALID_SET_FLAGS 0x00000036
411
412#define FILE_SUPERSEDE 0x00000000
413#define FILE_OPEN 0x00000001
414#define FILE_CREATE 0x00000002
415#define FILE_OPEN_IF 0x00000003
416#define FILE_OVERWRITE 0x00000004
417#define FILE_OVERWRITE_IF 0x00000005
418#define FILE_MAXIMUM_DISPOSITION 0x00000005
419
420#define FILE_DIRECTORY_FILE 0x00000001
421#define FILE_WRITE_THROUGH 0x00000002
422#define FILE_SEQUENTIAL_ONLY 0x00000004
423#define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
424#define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
425#define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
426#define FILE_NON_DIRECTORY_FILE 0x00000040
427#define FILE_CREATE_TREE_CONNECTION 0x00000080
428#define FILE_COMPLETE_IF_OPLOCKED 0x00000100
429#define FILE_NO_EA_KNOWLEDGE 0x00000200
430#define FILE_OPEN_FOR_RECOVERY 0x00000400
431#define FILE_RANDOM_ACCESS 0x00000800
432#define FILE_DELETE_ON_CLOSE 0x00001000
433#define FILE_OPEN_BY_FILE_ID 0x00002000
434#define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
435#define FILE_NO_COMPRESSION 0x00008000
436#define FILE_RESERVE_OPFILTER 0x00100000
437#define FILE_OPEN_REPARSE_POINT 0x00200000
438#define FILE_OPEN_NO_RECALL 0x00400000
439#define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
440
441#define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF)
442
443#define FILE_GENERIC_EXECUTE \
444 (STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES | FILE_EXECUTE | SYNCHRONIZE)
445
446#define FILE_GENERIC_READ \
447 (STANDARD_RIGHTS_READ | FILE_READ_DATA | FILE_READ_ATTRIBUTES \
448 | FILE_READ_EA | SYNCHRONIZE)
449
450#define FILE_GENERIC_WRITE \
451 (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES \
452 | FILE_WRITE_EA | FILE_APPEND_DATA | SYNCHRONIZE)
453
454#endif /* winnt.h */
455
456#define DIRECTORY_QUERY (0x0001)
457#define DIRECTORY_TRAVERSE (0x0002)
458#define DIRECTORY_CREATE_OBJECT (0x0004)
459#define DIRECTORY_CREATE_SUBDIRECTORY (0x0008)
460#define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF)
461
462/* Exported object types
463 */
464extern NTOSAPI POBJECT_TYPE ExDesktopObjectType;
465extern NTOSAPI POBJECT_TYPE ExEventObjectType;
466extern NTOSAPI POBJECT_TYPE ExSemaphoreObjectType;
467extern NTOSAPI POBJECT_TYPE ExWindowStationObjectType;
468extern NTOSAPI POBJECT_TYPE IoAdapterObjectType;
469extern NTOSAPI ULONG IoDeviceHandlerObjectSize;
470extern NTOSAPI POBJECT_TYPE IoDeviceHandlerObjectType;
471extern NTOSAPI POBJECT_TYPE IoDeviceObjectType;
472extern NTOSAPI POBJECT_TYPE IoDriverObjectType;
473extern NTOSAPI POBJECT_TYPE IoFileObjectType;
474extern NTOSAPI POBJECT_TYPE LpcPortObjectType;
475extern NTOSAPI POBJECT_TYPE MmSectionObjectType;
476extern NTOSAPI POBJECT_TYPE SeTokenObjectType;
477
478extern NTOSAPI CCHAR KeNumberProcessors;
479extern NTOSAPI PHAL_DISPATCH_TABLE HalDispatchTable;
480extern NTOSAPI PHAL_PRIVATE_DISPATCH_TABLE HalPrivateDispatchTable;
481
482
483/* IRP function codes
484 */
485#define IRP_MJ_CREATE 0x00
486#define IRP_MJ_CREATE_NAMED_PIPE 0x01
487#define IRP_MJ_CLOSE 0x02
488#define IRP_MJ_READ 0x03
489#define IRP_MJ_WRITE 0x04
490#define IRP_MJ_QUERY_INFORMATION 0x05
491#define IRP_MJ_SET_INFORMATION 0x06
492#define IRP_MJ_QUERY_EA 0x07
493#define IRP_MJ_SET_EA 0x08
494#define IRP_MJ_FLUSH_BUFFERS 0x09
495#define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a
496#define IRP_MJ_SET_VOLUME_INFORMATION 0x0b
497#define IRP_MJ_DIRECTORY_CONTROL 0x0c
498#define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d
499#define IRP_MJ_DEVICE_CONTROL 0x0e
500#define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f
501#define IRP_MJ_SCSI 0x0f
502#define IRP_MJ_SHUTDOWN 0x10
503#define IRP_MJ_LOCK_CONTROL 0x11
504#define IRP_MJ_CLEANUP 0x12
505#define IRP_MJ_CREATE_MAILSLOT 0x13
506#define IRP_MJ_QUERY_SECURITY 0x14
507#define IRP_MJ_SET_SECURITY 0x15
508#define IRP_MJ_POWER 0x16
509#define IRP_MJ_SYSTEM_CONTROL 0x17
510#define IRP_MJ_DEVICE_CHANGE 0x18
511#define IRP_MJ_QUERY_QUOTA 0x19
512#define IRP_MJ_SET_QUOTA 0x1a
513#define IRP_MJ_PNP 0x1b
514#define IRP_MJ_PNP_POWER 0x1b
515#define IRP_MJ_MAXIMUM_FUNCTION 0x1b
516
517#define IRP_MN_QUERY_DIRECTORY 0x01
518#define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02
519
520#define IRP_MN_USER_FS_REQUEST 0x00
521#define IRP_MN_MOUNT_VOLUME 0x01
522#define IRP_MN_VERIFY_VOLUME 0x02
523#define IRP_MN_LOAD_FILE_SYSTEM 0x03
524#define IRP_MN_TRACK_LINK 0x04
525#define IRP_MN_KERNEL_CALL 0x04
526
527#define IRP_MN_LOCK 0x01
528#define IRP_MN_UNLOCK_SINGLE 0x02
529#define IRP_MN_UNLOCK_ALL 0x03
530#define IRP_MN_UNLOCK_ALL_BY_KEY 0x04
531
532#define IRP_MN_NORMAL 0x00
533#define IRP_MN_DPC 0x01
534#define IRP_MN_MDL 0x02
535#define IRP_MN_COMPLETE 0x04
536#define IRP_MN_COMPRESSED 0x08
537
538#define IRP_MN_MDL_DPC (IRP_MN_MDL | IRP_MN_DPC)
539#define IRP_MN_COMPLETE_MDL (IRP_MN_COMPLETE | IRP_MN_MDL)
540#define IRP_MN_COMPLETE_MDL_DPC (IRP_MN_COMPLETE_MDL | IRP_MN_DPC)
541
542#define IRP_MN_SCSI_CLASS 0x01
543
544#define IRP_MN_START_DEVICE 0x00
545#define IRP_MN_QUERY_REMOVE_DEVICE 0x01
546#define IRP_MN_REMOVE_DEVICE 0x02
547#define IRP_MN_CANCEL_REMOVE_DEVICE 0x03
548#define IRP_MN_STOP_DEVICE 0x04
549#define IRP_MN_QUERY_STOP_DEVICE 0x05
550#define IRP_MN_CANCEL_STOP_DEVICE 0x06
551
552#define IRP_MN_QUERY_DEVICE_RELATIONS 0x07
553#define IRP_MN_QUERY_INTERFACE 0x08
554#define IRP_MN_QUERY_CAPABILITIES 0x09
555#define IRP_MN_QUERY_RESOURCES 0x0A
556#define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B
557#define IRP_MN_QUERY_DEVICE_TEXT 0x0C
558#define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
559
560#define IRP_MN_READ_CONFIG 0x0F
561#define IRP_MN_WRITE_CONFIG 0x10
562#define IRP_MN_EJECT 0x11
563#define IRP_MN_SET_LOCK 0x12
564#define IRP_MN_QUERY_ID 0x13
565#define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14
566#define IRP_MN_QUERY_BUS_INFORMATION 0x15
567#define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16
568#define IRP_MN_SURPRISE_REMOVAL 0x17
569#define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18
570
571#define IRP_MN_WAIT_WAKE 0x00
572#define IRP_MN_POWER_SEQUENCE 0x01
573#define IRP_MN_SET_POWER 0x02
574#define IRP_MN_QUERY_POWER 0x03
575
576#define IRP_MN_QUERY_ALL_DATA 0x00
577#define IRP_MN_QUERY_SINGLE_INSTANCE 0x01
578#define IRP_MN_CHANGE_SINGLE_INSTANCE 0x02
579#define IRP_MN_CHANGE_SINGLE_ITEM 0x03
580#define IRP_MN_ENABLE_EVENTS 0x04
581#define IRP_MN_DISABLE_EVENTS 0x05
582#define IRP_MN_ENABLE_COLLECTION 0x06
583#define IRP_MN_DISABLE_COLLECTION 0x07
584#define IRP_MN_REGINFO 0x08
585#define IRP_MN_EXECUTE_METHOD 0x09
586
587#define IRP_MN_REGINFO_EX 0x0b
588
589typedef
590enum _IO_ALLOCATION_ACTION
591{ KeepObject = 1,
592 DeallocateObject = 2,
593 DeallocateObjectKeepRegisters = 3
594} IO_ALLOCATION_ACTION, *PIO_ALLOCATION_ACTION;
595
596typedef IO_ALLOCATION_ACTION
597(DDKAPI *PDRIVER_CONTROL)(
598 /*IN*/ struct _DEVICE_OBJECT *DeviceObject,
599 /*IN*/ struct _IRP *Irp,
600 /*IN*/ PVOID MapRegisterBase,
601 /*IN*/ PVOID Context
602);
603
604typedef VOID
605(DDKAPI *PDRIVER_LIST_CONTROL)(
606 /*IN*/ struct _DEVICE_OBJECT *DeviceObject,
607 /*IN*/ struct _IRP *Irp,
608 /*IN*/ struct _SCATTER_GATHER_LIST *ScatterGather,
609 /*IN*/ PVOID Context
610);
611
612typedef NTSTATUS
613(DDKAPI *PDRIVER_ADD_DEVICE)(
614 /*IN*/ struct _DRIVER_OBJECT *DriverObject,
615 /*IN*/ struct _DEVICE_OBJECT *PhysicalDeviceObject
616);
617
618typedef NTSTATUS
619(DDKAPI *PIO_COMPLETION_ROUTINE)(
620 /*IN*/ struct _DEVICE_OBJECT *DeviceObject,
621 /*IN*/ struct _IRP *Irp,
622 /*IN*/ PVOID Context
623);
624
625typedef VOID
626(DDKAPI *PDRIVER_CANCEL)(
627 /*IN*/ struct _DEVICE_OBJECT *DeviceObject,
628 /*IN*/ struct _IRP *Irp
629);
630
631typedef VOID
632(DDKAPI *PKDEFERRED_ROUTINE)(
633 /*IN*/ struct _KDPC *Dpc,
634 /*IN*/ PVOID DeferredContext,
635 /*IN*/ PVOID SystemArgument1,
636 /*IN*/ PVOID SystemArgument2
637);
638
639typedef NTSTATUS
640(DDKAPI *PDRIVER_DISPATCH)(
641 /*IN*/ struct _DEVICE_OBJECT *DeviceObject,
642 /*IN*/ struct _IRP *Irp
643);
644
645typedef VOID
646(DDKAPI *PIO_DPC_ROUTINE)(
647 /*IN*/ struct _KDPC *Dpc,
648 /*IN*/ struct _DEVICE_OBJECT *DeviceObject,
649 /*IN*/ struct _IRP *Irp,
650 /*IN*/ PVOID Context
651);
652
653typedef NTSTATUS
654(DDKAPI *PMM_DLL_INITIALIZE)(
655 /*IN*/ PUNICODE_STRING RegistryPath
656);
657
658typedef NTSTATUS
659(DDKAPI *PMM_DLL_UNLOAD)( VOID );
660
661typedef NTSTATUS
662(DDKAPI *PDRIVER_ENTRY)(
663 /*IN*/ struct _DRIVER_OBJECT *DriverObject,
664 /*IN*/ PUNICODE_STRING RegistryPath
665);
666
667typedef NTSTATUS
668(DDKAPI *PDRIVER_INITIALIZE)(
669 /*IN*/ struct _DRIVER_OBJECT *DriverObject,
670 /*IN*/ PUNICODE_STRING RegistryPath
671);
672
673typedef BOOLEAN
674(DDKAPI *PKSERVICE_ROUTINE)(
675 /*IN*/ struct _KINTERRUPT *Interrupt,
676 /*IN*/ PVOID ServiceContext
677);
678
679typedef VOID
680(DDKAPI *PIO_TIMER_ROUTINE)(
681 /*IN*/ struct _DEVICE_OBJECT *DeviceObject,
682 /*IN*/ PVOID Context
683);
684
685typedef VOID
686(DDKAPI *PDRIVER_REINITIALIZE)(
687 /*IN*/ struct _DRIVER_OBJECT *DriverObject,
688 /*IN*/ PVOID Context,
689 /*IN*/ ULONG Count
690);
691
692typedef NTSTATUS
693(DDKAPI *PDRIVER_STARTIO)(
694 /*IN*/ struct _DEVICE_OBJECT *DeviceObject,
695 /*IN*/ struct _IRP *Irp
696);
697
698typedef BOOLEAN
699(DDKAPI *PKSYNCHRONIZE_ROUTINE)(
700 /*IN*/ PVOID SynchronizeContext
701);
702
703typedef VOID
704(DDKAPI *PDRIVER_UNLOAD)(
705 /*IN*/ struct _DRIVER_OBJECT *DriverObject
706);
707
708
709
710/*
711** Plug and Play structures
712*/
713typedef VOID DDKAPI
714(*PINTERFACE_REFERENCE)(
715 PVOID Context
716);
717
718typedef VOID DDKAPI
719(*PINTERFACE_DEREFERENCE)(
720 PVOID Context
721);
722
723typedef BOOLEAN DDKAPI
724(*PTRANSLATE_BUS_ADDRESS)(
725 /*IN*/ PVOID Context,
726 /*IN*/ PHYSICAL_ADDRESS BusAddress,
727 /*IN*/ ULONG Length,
728 /*IN OUT*/ PULONG AddressSpace,
729 /*OUT*/ PPHYSICAL_ADDRESS TranslatedAddress
730);
731
732typedef struct _DMA_ADAPTER* DDKAPI
733(*PGET_DMA_ADAPTER)(
734 /*IN*/ PVOID Context,
735 /*IN*/ struct _DEVICE_DESCRIPTION *DeviceDescriptor,
736 /*OUT*/ PULONG NumberOfMapRegisters
737);
738
739typedef ULONG DDKAPI
740(*PGET_SET_DEVICE_DATA)(
741 /*IN*/ PVOID Context,
742 /*IN*/ ULONG DataType,
743 /*IN*/ PVOID Buffer,
744 /*IN*/ ULONG Offset,
745 /*IN*/ ULONG Length
746);
747
748typedef
749union _POWER_STATE
750{ SYSTEM_POWER_STATE SystemState;
751 DEVICE_POWER_STATE DeviceState;
752} POWER_STATE, *PPOWER_STATE;
753
754typedef
755enum _POWER_STATE_TYPE
756{ SystemPowerState,
757 DevicePowerState
758} POWER_STATE_TYPE, *PPOWER_STATE_TYPE;
759
760typedef
761struct _BUS_INTERFACE_STANDARD
762{ USHORT Size;
763 USHORT Version;
764 PVOID Context;
765 PINTERFACE_REFERENCE InterfaceReference;
766 PINTERFACE_DEREFERENCE InterfaceDereference;
767 PTRANSLATE_BUS_ADDRESS TranslateBusAddress;
768 PGET_DMA_ADAPTER GetDmaAdapter;
769 PGET_SET_DEVICE_DATA SetBusData;
770 PGET_SET_DEVICE_DATA GetBusData;
771} BUS_INTERFACE_STANDARD, *PBUS_INTERFACE_STANDARD;
772
773typedef
774struct _DEVICE_CAPABILITIES
775{ USHORT Size;
776 USHORT Version;
777 ULONG DeviceD1 : 1;
778 ULONG DeviceD2 : 1;
779 ULONG LockSupported : 1;
780 ULONG EjectSupported : 1;
781 ULONG Removable : 1;
782 ULONG DockDevice : 1;
783 ULONG UniqueID : 1;
784 ULONG SilentInstall : 1;
785 ULONG RawDeviceOK : 1;
786 ULONG SurpriseRemovalOK : 1;
787 ULONG WakeFromD0 : 1;
788 ULONG WakeFromD1 : 1;
789 ULONG WakeFromD2 : 1;
790 ULONG WakeFromD3 : 1;
791 ULONG HardwareDisabled : 1;
792 ULONG NonDynamic : 1;
793 ULONG WarmEjectSupported : 1;
794 ULONG NoDisplayInUI : 1;
795 ULONG Reserved : 14;
796 ULONG Address;
797 ULONG UINumber;
798 DEVICE_POWER_STATE DeviceState[PowerSystemMaximum];
799 SYSTEM_POWER_STATE SystemWake;
800 DEVICE_POWER_STATE DeviceWake;
801 ULONG D1Latency;
802 ULONG D2Latency;
803 ULONG D3Latency;
804} DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;
805
806typedef
807struct _DEVICE_INTERFACE_CHANGE_NOTIFICATION
808{ USHORT Version;
809 USHORT Size;
810 GUID Event;
811 GUID InterfaceClassGuid;
812 PUNICODE_STRING SymbolicLinkName;
813} DEVICE_INTERFACE_CHANGE_NOTIFICATION, *PDEVICE_INTERFACE_CHANGE_NOTIFICATION;
814
815typedef
816struct _HWPROFILE_CHANGE_NOTIFICATION
817{ USHORT Version;
818 USHORT Size;
819 GUID Event;
820} HWPROFILE_CHANGE_NOTIFICATION, *PHWPROFILE_CHANGE_NOTIFICATION;
821
822#undef INTERFACE
823
824typedef
825struct _INTERFACE
826{ USHORT Size;
827 USHORT Version;
828 PVOID Context;
829 PINTERFACE_REFERENCE InterfaceReference;
830 PINTERFACE_DEREFERENCE InterfaceDereference;
831} INTERFACE, *PINTERFACE;
832
833typedef
834struct _PLUGPLAY_NOTIFICATION_HEADER
835{ USHORT Version;
836 USHORT Size;
837 GUID Event;
838} PLUGPLAY_NOTIFICATION_HEADER, *PPLUGPLAY_NOTIFICATION_HEADER;
839
840typedef ULONG PNP_DEVICE_STATE, *PPNP_DEVICE_STATE;
841
842/* PNP_DEVICE_STATE */
843
844#define PNP_DEVICE_DISABLED 0x00000001
845#define PNP_DEVICE_DONT_DISPLAY_IN_UI 0x00000002
846#define PNP_DEVICE_FAILED 0x00000004
847#define PNP_DEVICE_REMOVED 0x00000008
848#define PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED 0x00000010
849#define PNP_DEVICE_NOT_DISABLEABLE 0x00000020
850
851typedef
852struct _TARGET_DEVICE_CUSTOM_NOTIFICATION
853{ USHORT Version;
854 USHORT Size;
855 GUID Event;
856 struct _FILE_OBJECT *FileObject;
857 LONG NameBufferOffset;
858 UCHAR CustomDataBuffer[1];
859} TARGET_DEVICE_CUSTOM_NOTIFICATION, *PTARGET_DEVICE_CUSTOM_NOTIFICATION;
860
861typedef
862struct _TARGET_DEVICE_REMOVAL_NOTIFICATION
863{ USHORT Version;
864 USHORT Size;
865 GUID Event;
866 struct _FILE_OBJECT *FileObject;
867} TARGET_DEVICE_REMOVAL_NOTIFICATION, *PTARGET_DEVICE_REMOVAL_NOTIFICATION;
868
869typedef
870enum _BUS_QUERY_ID_TYPE
871{ BusQueryDeviceID,
872 BusQueryHardwareIDs,
873 BusQueryCompatibleIDs,
874 BusQueryInstanceID,
875 BusQueryDeviceSerialNumber
876} BUS_QUERY_ID_TYPE, *PBUS_QUERY_ID_TYPE;
877
878typedef
879enum _DEVICE_TEXT_TYPE
880{ DeviceTextDescription,
881 DeviceTextLocationInformation
882} DEVICE_TEXT_TYPE, *PDEVICE_TEXT_TYPE;
883
884typedef
885enum _DEVICE_USAGE_NOTIFICATION_TYPE
886{ DeviceUsageTypeUndefined,
887 DeviceUsageTypePaging,
888 DeviceUsageTypeHibernation,
889 DeviceUsageTypeDumpFile
890} DEVICE_USAGE_NOTIFICATION_TYPE;
891
892typedef
893struct _POWER_SEQUENCE
894{ ULONG SequenceD1;
895 ULONG SequenceD2;
896 ULONG SequenceD3;
897} POWER_SEQUENCE, *PPOWER_SEQUENCE;
898
899typedef enum
900{ DevicePropertyDeviceDescription,
901 DevicePropertyHardwareID,
902 DevicePropertyCompatibleIDs,
903 DevicePropertyBootConfiguration,
904 DevicePropertyBootConfigurationTranslated,
905 DevicePropertyClassName,
906 DevicePropertyClassGuid,
907 DevicePropertyDriverKeyName,
908 DevicePropertyManufacturer,
909 DevicePropertyFriendlyName,
910 DevicePropertyLocationInformation,
911 DevicePropertyPhysicalDeviceObjectName,
912 DevicePropertyBusTypeGuid,
913 DevicePropertyLegacyBusType,
914 DevicePropertyBusNumber,
915 DevicePropertyEnumeratorName,
916 DevicePropertyAddress,
917 DevicePropertyUINumber,
918 DevicePropertyInstallState,
919 DevicePropertyRemovalPolicy
920} DEVICE_REGISTRY_PROPERTY;
921
922typedef
923enum _IO_NOTIFICATION_EVENT_CATEGORY
924{ EventCategoryReserved,
925 EventCategoryHardwareProfileChange,
926 EventCategoryDeviceInterfaceChange,
927 EventCategoryTargetDeviceChange
928} IO_NOTIFICATION_EVENT_CATEGORY;
929
930#define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES 0x00000001
931
932typedef NTSTATUS DDKAPI
933(*PDRIVER_NOTIFICATION_CALLBACK_ROUTINE)(
934 /*IN*/ PVOID NotificationStructure,
935 /*IN*/ PVOID Context
936);
937
938typedef VOID DDKAPI
939(*PDEVICE_CHANGE_COMPLETE_CALLBACK)(
940 /*IN*/ PVOID Context
941);
942
943/* System structures
944 */
945#define SYMBOLIC_LINK_QUERY 0x0001
946#define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
947
948#if 1
949/* FIXME: also in winnt.h; hence already defined?
950 */
951#define DUPLICATE_CLOSE_SOURCE 0x00000001
952#define DUPLICATE_SAME_ACCESS 0x00000002
953#define DUPLICATE_SAME_ATTRIBUTES 0x00000004
954
955#endif /* winnt.h */
956
957typedef
958struct _OBJECT_NAME_INFORMATION
959{ UNICODE_STRING Name;
960} OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION;
961
962typedef VOID DDKAPI
963(*PIO_APC_ROUTINE)(
964 /*IN*/ PVOID ApcContext,
965 /*IN*/ PIO_STATUS_BLOCK IoStatusBlock,
966 /*IN*/ ULONG Reserved
967);
968
969typedef
970struct _IO_STATUS_BLOCK
971{ _ANONYMOUS_UNION union
972 { NTSTATUS Status;
973 PVOID Pointer;
974 } DUMMYUNIONNAME;
975 ULONG_PTR Information;
976} IO_STATUS_BLOCK;
977
978typedef VOID DDKAPI
979(*PKNORMAL_ROUTINE)(
980 /*IN*/ PVOID NormalContext,
981 /*IN*/ PVOID SystemArgument1,
982 /*IN*/ PVOID SystemArgument2
983);
984
985typedef VOID DDKAPI
986(*PKKERNEL_ROUTINE)(
987 /*IN*/ struct _KAPC *Apc,
988 /*IN OUT*/ PKNORMAL_ROUTINE *NormalRoutine,
989 /*IN OUT*/ PVOID *NormalContext,
990 /*IN OUT*/ PVOID *SystemArgument1,
991 /*IN OUT*/ PVOID *SystemArgument2
992);
993
994typedef VOID DDKAPI
995(*PKRUNDOWN_ROUTINE)(
996 /*IN*/ struct _KAPC *Apc
997);
998
999typedef BOOLEAN DDKAPI
1000(*PKTRANSFER_ROUTINE)( VOID );
1001
1002typedef
1003struct _KAPC
1004{ CSHORT Type;
1005 CSHORT Size;
1006 ULONG Spare0;
1007 struct _KTHREAD *Thread;
1008 LIST_ENTRY ApcListEntry;
1009 PKKERNEL_ROUTINE KernelRoutine;
1010 PKRUNDOWN_ROUTINE RundownRoutine;
1011 PKNORMAL_ROUTINE NormalRoutine;
1012 PVOID NormalContext;
1013 PVOID SystemArgument1;
1014 PVOID SystemArgument2;
1015 CCHAR ApcStateIndex;
1016 KPROCESSOR_MODE ApcMode;
1017 BOOLEAN Inserted;
1018} KAPC, *PKAPC, *RESTRICTED_POINTER PRKAPC;
1019
1020typedef
1021struct _KDEVICE_QUEUE
1022{ CSHORT Type;
1023 CSHORT Size;
1024 LIST_ENTRY DeviceListHead;
1025 KSPIN_LOCK Lock;
1026 BOOLEAN Busy;
1027} KDEVICE_QUEUE, *PKDEVICE_QUEUE, *RESTRICTED_POINTER PRKDEVICE_QUEUE;
1028
1029typedef
1030struct _KDEVICE_QUEUE_ENTRY
1031{ LIST_ENTRY DeviceListEntry;
1032 ULONG SortKey;
1033 BOOLEAN Inserted;
1034} KDEVICE_QUEUE_ENTRY, *PKDEVICE_QUEUE_ENTRY,
1035*RESTRICTED_POINTER PRKDEVICE_QUEUE_ENTRY;
1036
1037#define LOCK_QUEUE_WAIT 1
1038#define LOCK_QUEUE_OWNER 2
1039
1040typedef
1041enum _KSPIN_LOCK_QUEUE_NUMBER
1042{ LockQueueDispatcherLock,
1043 LockQueueContextSwapLock,
1044 LockQueuePfnLock,
1045 LockQueueSystemSpaceLock,
1046 LockQueueVacbLock,
1047 LockQueueMasterLock,
1048 LockQueueNonPagedPoolLock,
1049 LockQueueIoCancelLock,
1050 LockQueueWorkQueueLock,
1051 LockQueueIoVpbLock,
1052 LockQueueIoDatabaseLock,
1053 LockQueueIoCompletionLock,
1054 LockQueueNtfsStructLock,
1055 LockQueueAfdWorkQueueLock,
1056 LockQueueBcbLock,
1057 LockQueueMaximumLock
1058} KSPIN_LOCK_QUEUE_NUMBER, *PKSPIN_LOCK_QUEUE_NUMBER;
1059
1060typedef
1061struct _KSPIN_LOCK_QUEUE
1062{ struct _KSPIN_LOCK_QUEUE *VOLATILE Next;
1063 PKSPIN_LOCK VOLATILE Lock;
1064} KSPIN_LOCK_QUEUE, *PKSPIN_LOCK_QUEUE;
1065
1066typedef
1067struct _KLOCK_QUEUE_HANDLE
1068{ KSPIN_LOCK_QUEUE LockQueue;
1069 KIRQL OldIrql;
1070} KLOCK_QUEUE_HANDLE, *PKLOCK_QUEUE_HANDLE;
1071
1072typedef
1073struct _KDPC
1074{ CSHORT Type;
1075 UCHAR Number;
1076 UCHAR Importance;
1077 LIST_ENTRY DpcListEntry;
1078 PKDEFERRED_ROUTINE DeferredRoutine;
1079 PVOID DeferredContext;
1080 PVOID SystemArgument1;
1081 PVOID SystemArgument2;
1082 PULONG_PTR Lock;
1083} KDPC, *PKDPC, *RESTRICTED_POINTER PRKDPC;
1084
1085typedef
1086struct _WAIT_CONTEXT_BLOCK
1087{ KDEVICE_QUEUE_ENTRY WaitQueueEntry;
1088 struct _DRIVER_CONTROL *DeviceRoutine;
1089 PVOID DeviceContext;
1090 ULONG NumberOfMapRegisters;
1091 PVOID DeviceObject;
1092 PVOID CurrentIrp;
1093 PKDPC BufferChainingDpc;
1094} WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK;
1095
1096typedef
1097struct _DISPATCHER_HEADER
1098{ UCHAR Type;
1099 UCHAR Absolute;
1100 UCHAR Size;
1101 UCHAR Inserted;
1102 LONG SignalState;
1103 LIST_ENTRY WaitListHead;
1104} DISPATCHER_HEADER, *PDISPATCHER_HEADER;
1105
1106typedef
1107struct _KEVENT
1108{ DISPATCHER_HEADER Header;
1109} KEVENT, *PKEVENT, *RESTRICTED_POINTER PRKEVENT;
1110
1111typedef
1112struct _KSEMAPHORE
1113{ DISPATCHER_HEADER Header;
1114 LONG Limit;
1115} KSEMAPHORE, *PKSEMAPHORE, *RESTRICTED_POINTER PRKSEMAPHORE;
1116
1117typedef
1118struct _FAST_MUTEX
1119{ LONG Count;
1120 struct _KTHREAD *Owner;
1121 ULONG Contention;
1122 KEVENT Event;
1123 ULONG OldIrql;
1124} FAST_MUTEX, *PFAST_MUTEX;
1125
1126typedef
1127struct _KTIMER
1128{ DISPATCHER_HEADER Header;
1129 ULARGE_INTEGER DueTime;
1130 LIST_ENTRY TimerListEntry;
1131 struct _KDPC *Dpc;
1132 LONG Period;
1133} KTIMER, *PKTIMER, *RESTRICTED_POINTER PRKTIMER;
1134
1135typedef
1136struct _KMUTANT
1137{ DISPATCHER_HEADER Header;
1138 LIST_ENTRY MutantListEntry;
1139 struct _KTHREAD *RESTRICTED_POINTER OwnerThread;
1140 BOOLEAN Abandoned;
1141 UCHAR ApcDisable;
1142} KMUTANT, *PKMUTANT, *RESTRICTED_POINTER PRKMUTANT, KMUTEX, *PKMUTEX, *RESTRICTED_POINTER PRKMUTEX;
1143
1144typedef
1145enum _TIMER_TYPE
1146{ NotificationTimer,
1147 SynchronizationTimer
1148} TIMER_TYPE;
1149
1150typedef
1151enum _TIMER_INFORMATION_CLASS
1152{ TimerBasicInformation
1153} TIMER_INFORMATION_CLASS;
1154
1155typedef
1156struct _TIMER_BASIC_INFORMATION
1157{ LARGE_INTEGER TimeRemaining;
1158 BOOLEAN SignalState;
1159} TIMER_BASIC_INFORMATION, *PTIMER_BASIC_INFORMATION;
1160
1161#define EVENT_INCREMENT 1
1162#define IO_NO_INCREMENT 0
1163#define IO_CD_ROM_INCREMENT 1
1164#define IO_DISK_INCREMENT 1
1165#define IO_KEYBOARD_INCREMENT 6
1166#define IO_MAILSLOT_INCREMENT 2
1167#define IO_MOUSE_INCREMENT 6
1168#define IO_NAMED_PIPE_INCREMENT 2
1169#define IO_NETWORK_INCREMENT 2
1170#define IO_PARALLEL_INCREMENT 1
1171#define IO_SERIAL_INCREMENT 2
1172#define IO_SOUND_INCREMENT 8
1173#define IO_VIDEO_INCREMENT 1
1174#define SEMAPHORE_INCREMENT 1
1175
1176typedef
1177struct _IRP
1178{ CSHORT Type;
1179 USHORT Size;
1180 struct _MDL *MdlAddress;
1181 ULONG Flags;
1182 union
1183 { struct _IRP *MasterIrp;
1184 LONG IrpCount;
1185 PVOID SystemBuffer;
1186 } AssociatedIrp;
1187 LIST_ENTRY ThreadListEntry;
1188 IO_STATUS_BLOCK IoStatus;
1189 KPROCESSOR_MODE RequestorMode;
1190 BOOLEAN PendingReturned;
1191 CHAR StackCount;
1192 CHAR CurrentLocation;
1193 BOOLEAN Cancel;
1194 KIRQL CancelIrql;
1195 CCHAR ApcEnvironment;
1196 UCHAR AllocationFlags;
1197 PIO_STATUS_BLOCK UserIosb;
1198 PKEVENT UserEvent;
1199 union
1200 { struct
1201 { PIO_APC_ROUTINE UserApcRoutine;
1202 PVOID UserApcContext;
1203 } AsynchronousParameters;
1204 LARGE_INTEGER AllocationSize;
1205 } Overlay;
1206 PDRIVER_CANCEL CancelRoutine;
1207 PVOID UserBuffer;
1208 union
1209 { struct
1210 { _ANONYMOUS_UNION union
1211 { KDEVICE_QUEUE_ENTRY DeviceQueueEntry;
1212 _ANONYMOUS_STRUCT struct
1213 { PVOID DriverContext[4];
1214 } DUMMYSTRUCTNAME;
1215 } DUMMYUNIONNAME;
1216 PETHREAD Thread;
1217 PCHAR AuxiliaryBuffer;
1218 _ANONYMOUS_STRUCT struct
1219 { LIST_ENTRY ListEntry;
1220 _ANONYMOUS_UNION union
1221 { struct _IO_STACK_LOCATION *CurrentStackLocation;
1222 ULONG PacketType;
1223 } DUMMYUNIONNAME;
1224 } DUMMYSTRUCTNAME;
1225 struct _FILE_OBJECT *OriginalFileObject;
1226 } Overlay;
1227 KAPC Apc;
1228 PVOID CompletionKey;
1229 } Tail;
1230} IRP, *PIRP;
1231
1232/* IRP.Flags
1233 */
1234#define SL_FORCE_ACCESS_CHECK 0x01
1235#define SL_OPEN_PAGING_FILE 0x02
1236#define SL_OPEN_TARGET_DIRECTORY 0x04
1237#define SL_CASE_SENSITIVE 0x80
1238
1239#define SL_KEY_SPECIFIED 0x01
1240#define SL_OVERRIDE_VERIFY_VOLUME 0x02
1241#define SL_WRITE_THROUGH 0x04
1242#define SL_FT_SEQUENTIAL_WRITE 0x08
1243
1244#define SL_FAIL_IMMEDIATELY 0x01
1245#define SL_EXCLUSIVE_LOCK 0x02
1246
1247#define SL_RESTART_SCAN 0x01
1248#define SL_RETURN_SINGLE_ENTRY 0x02
1249#define SL_INDEX_SPECIFIED 0x04
1250
1251#define SL_WATCH_TREE 0x01
1252
1253#define SL_ALLOW_RAW_MOUNT 0x01
1254
1255enum
1256{ IRP_NOCACHE = 0x0001,
1257 IRP_PAGING_IO = 0x0002,
1258 IRP_MOUNT_COMPLETION = 0x0002,
1259 IRP_SYNCHRONOUS_API = 0x0004,
1260 IRP_ASSOCIATED_IRP = 0x0008,
1261 IRP_BUFFERED_IO = 0x0010,
1262 IRP_DEALLOCATE_BUFFER = 0x0020,
1263 IRP_INPUT_OPERATION = 0x0040,
1264 IRP_SYNCHRONOUS_PAGING_IO = 0x0040,
1265 IRP_CREATE_OPERATION = 0x0080,
1266 IRP_READ_OPERATION = 0x0100,
1267 IRP_WRITE_OPERATION = 0x0200,
1268 IRP_CLOSE_OPERATION = 0x0400,
1269 IRP_DEFER_IO_COMPLETION = 0x0800,
1270 IRP_OB_QUERY_NAME = 0x1000,
1271 IRP_HOLD_DEVICE_QUEUE = 0x2000,
1272 IRP_RETRY_IO_COMPLETION = 0x4000
1273};
1274
1275typedef
1276struct _BOOTDISK_INFORMATION
1277{ LONGLONG BootPartitionOffset;
1278 LONGLONG SystemPartitionOffset;
1279 ULONG BootDeviceSignature;
1280 ULONG SystemDeviceSignature;
1281} BOOTDISK_INFORMATION, *PBOOTDISK_INFORMATION;
1282
1283typedef
1284struct _BOOTDISK_INFORMATION_EX
1285{ LONGLONG BootPartitionOffset;
1286 LONGLONG SystemPartitionOffset;
1287 ULONG BootDeviceSignature;
1288 ULONG SystemDeviceSignature;
1289 GUID BootDeviceGuid;
1290 GUID SystemDeviceGuid;
1291 BOOLEAN BootDeviceIsGpt;
1292 BOOLEAN SystemDeviceIsGpt;
1293} BOOTDISK_INFORMATION_EX, *PBOOTDISK_INFORMATION_EX;
1294
1295typedef
1296struct _EISA_MEMORY_TYPE
1297{ UCHAR ReadWrite : 1;
1298 UCHAR Cached : 1;
1299 UCHAR Reserved0 : 1;
1300 UCHAR Type : 2;
1301 UCHAR Shared : 1;
1302 UCHAR Reserved1 : 1;
1303 UCHAR MoreEntries : 1;
1304} EISA_MEMORY_TYPE, *PEISA_MEMORY_TYPE;
1305
1306#include <pshpack1.h>
1307typedef
1308struct _EISA_MEMORY_CONFIGURATION
1309{ EISA_MEMORY_TYPE ConfigurationByte;
1310 UCHAR DataSize;
1311 USHORT AddressLowWord;
1312 UCHAR AddressHighByte;
1313 USHORT MemorySize;
1314} EISA_MEMORY_CONFIGURATION, *PEISA_MEMORY_CONFIGURATION;
1315#include <poppack.h>
1316
1317typedef
1318struct _EISA_IRQ_DESCRIPTOR
1319{ UCHAR Interrupt : 4;
1320 UCHAR Reserved : 1;
1321 UCHAR LevelTriggered : 1;
1322 UCHAR Shared : 1;
1323 UCHAR MoreEntries : 1;
1324} EISA_IRQ_DESCRIPTOR, *PEISA_IRQ_DESCRIPTOR;
1325
1326typedef
1327struct _EISA_IRQ_CONFIGURATION
1328{ EISA_IRQ_DESCRIPTOR ConfigurationByte;
1329 UCHAR Reserved;
1330} EISA_IRQ_CONFIGURATION, *PEISA_IRQ_CONFIGURATION;
1331
1332typedef
1333struct _DMA_CONFIGURATION_BYTE0
1334{ UCHAR Channel : 3;
1335 UCHAR Reserved : 3;
1336 UCHAR Shared : 1;
1337 UCHAR MoreEntries : 1;
1338} DMA_CONFIGURATION_BYTE0;
1339
1340typedef
1341struct _DMA_CONFIGURATION_BYTE1
1342{ UCHAR Reserved0 : 2;
1343 UCHAR TransferSize : 2;
1344 UCHAR Timing : 2;
1345 UCHAR Reserved1 : 2;
1346} DMA_CONFIGURATION_BYTE1;
1347
1348typedef
1349struct _EISA_DMA_CONFIGURATION
1350{ DMA_CONFIGURATION_BYTE0 ConfigurationByte0;
1351 DMA_CONFIGURATION_BYTE1 ConfigurationByte1;
1352} EISA_DMA_CONFIGURATION, *PEISA_DMA_CONFIGURATION;
1353
1354#include <pshpack1.h>
1355typedef
1356struct _EISA_PORT_DESCRIPTOR
1357{ UCHAR NumberPorts : 5;
1358 UCHAR Reserved : 1;
1359 UCHAR Shared : 1;
1360 UCHAR MoreEntries : 1;
1361} EISA_PORT_DESCRIPTOR, *PEISA_PORT_DESCRIPTOR;
1362
1363typedef
1364struct _EISA_PORT_CONFIGURATION
1365{ EISA_PORT_DESCRIPTOR Configuration;
1366 USHORT PortAddress;
1367} EISA_PORT_CONFIGURATION, *PEISA_PORT_CONFIGURATION;
1368#include <poppack.h>
1369
1370typedef
1371struct _CM_EISA_FUNCTION_INFORMATION
1372{ ULONG CompressedId;
1373 UCHAR IdSlotFlags1;
1374 UCHAR IdSlotFlags2;
1375 UCHAR MinorRevision;
1376 UCHAR MajorRevision;
1377 UCHAR Selections[26];
1378 UCHAR FunctionFlags;
1379 UCHAR TypeString[80];
1380 EISA_MEMORY_CONFIGURATION EisaMemory[9];
1381 EISA_IRQ_CONFIGURATION EisaIrq[7];
1382 EISA_DMA_CONFIGURATION EisaDma[4];
1383 EISA_PORT_CONFIGURATION EisaPort[20];
1384 UCHAR InitializationData[60];
1385} CM_EISA_FUNCTION_INFORMATION, *PCM_EISA_FUNCTION_INFORMATION;
1386
1387/* CM_EISA_FUNCTION_INFORMATION.FunctionFlags
1388 */
1389#define EISA_FUNCTION_ENABLED 0x80
1390#define EISA_FREE_FORM_DATA 0x40
1391#define EISA_HAS_PORT_INIT_ENTRY 0x20
1392#define EISA_HAS_PORT_RANGE 0x10
1393#define EISA_HAS_DMA_ENTRY 0x08
1394#define EISA_HAS_IRQ_ENTRY 0x04
1395#define EISA_HAS_MEMORY_ENTRY 0x02
1396#define EISA_HAS_TYPE_ENTRY 0x01
1397#define EISA_HAS_INFORMATION \
1398 (EISA_HAS_PORT_RANGE + EISA_HAS_DMA_ENTRY + EISA_HAS_IRQ_ENTRY \
1399 + EISA_HAS_MEMORY_ENTRY + EISA_HAS_TYPE_ENTRY)
1400
1401typedef
1402struct _CM_EISA_SLOT_INFORMATION
1403{ UCHAR ReturnCode;
1404 UCHAR ReturnFlags;
1405 UCHAR MajorRevision;
1406 UCHAR MinorRevision;
1407 USHORT Checksum;
1408 UCHAR NumberFunctions;
1409 UCHAR FunctionInformation;
1410 ULONG CompressedId;
1411} CM_EISA_SLOT_INFORMATION, *PCM_EISA_SLOT_INFORMATION;
1412
1413/* CM_EISA_SLOT_INFORMATION.ReturnCode
1414 */
1415#define EISA_INVALID_SLOT 0x80
1416#define EISA_INVALID_FUNCTION 0x81
1417#define EISA_INVALID_CONFIGURATION 0x82
1418#define EISA_EMPTY_SLOT 0x83
1419#define EISA_INVALID_BIOS_CALL 0x86
1420
1421typedef
1422struct _CM_FLOPPY_DEVICE_DATA
1423{ USHORT Version;
1424 USHORT Revision;
1425 CHAR Size[8];
1426 ULONG MaxDensity;
1427 ULONG MountDensity;
1428 UCHAR StepRateHeadUnloadTime;
1429 UCHAR HeadLoadTime;
1430 UCHAR MotorOffTime;
1431 UCHAR SectorLengthCode;
1432 UCHAR SectorPerTrack;
1433 UCHAR ReadWriteGapLength;
1434 UCHAR DataTransferLength;
1435 UCHAR FormatGapLength;
1436 UCHAR FormatFillCharacter;
1437 UCHAR HeadSettleTime;
1438 UCHAR MotorSettleTime;
1439 UCHAR MaximumTrackValue;
1440 UCHAR DataTransferRate;
1441} CM_FLOPPY_DEVICE_DATA, *PCM_FLOPPY_DEVICE_DATA;
1442
1443typedef
1444enum _INTERFACE_TYPE
1445{ InterfaceTypeUndefined = -1,
1446 Internal,
1447 Isa,
1448 Eisa,
1449 MicroChannel,
1450 TurboChannel,
1451 PCIBus,
1452 VMEBus,
1453 NuBus,
1454 PCMCIABus,
1455 CBus,
1456 MPIBus,
1457 MPSABus,
1458 ProcessorInternal,
1459 InternalPowerBus,
1460 PNPISABus,
1461 PNPBus,
1462 MaximumInterfaceType
1463} INTERFACE_TYPE, *PINTERFACE_TYPE;
1464
1465typedef
1466struct _PNP_BUS_INFORMATION
1467{ GUID BusTypeGuid;
1468 INTERFACE_TYPE LegacyBusType;
1469 ULONG BusNumber;
1470} PNP_BUS_INFORMATION, *PPNP_BUS_INFORMATION;
1471
1472#include <pshpack1.h>
1473typedef
1474struct _CM_PARTIAL_RESOURCE_DESCRIPTOR
1475{ UCHAR Type;
1476 UCHAR ShareDisposition;
1477 USHORT Flags;
1478 union
1479 { struct
1480 { PHYSICAL_ADDRESS Start;
1481 ULONG Length;
1482 } Generic;
1483 struct
1484 { PHYSICAL_ADDRESS Start;
1485 ULONG Length;
1486 } Port;
1487 struct
1488 { ULONG Level;
1489 ULONG Vector;
1490 ULONG Affinity;
1491 } Interrupt;
1492 struct
1493 { PHYSICAL_ADDRESS Start;
1494 ULONG Length;
1495 } Memory;
1496 struct
1497 { ULONG Channel;
1498 ULONG Port;
1499 ULONG Reserved1;
1500 } Dma;
1501 struct
1502 { ULONG Data[3];
1503 } DevicePrivate;
1504 struct
1505 { ULONG Start;
1506 ULONG Length;
1507 ULONG Reserved;
1508 } BusNumber;
1509 struct
1510 { ULONG DataSize;
1511 ULONG Reserved1;
1512 ULONG Reserved2;
1513 } DeviceSpecificData;
1514 } u;
1515} CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
1516
1517/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Type
1518 */
1519#define CmResourceTypeNull 0
1520#define CmResourceTypePort 1
1521#define CmResourceTypeInterrupt 2
1522#define CmResourceTypeMemory 3
1523#define CmResourceTypeDma 4
1524#define CmResourceTypeDeviceSpecific 5
1525#define CmResourceTypeBusNumber 6
1526#define CmResourceTypeMaximum 7
1527#define CmResourceTypeNonArbitrated 128
1528#define CmResourceTypeConfigData 128
1529#define CmResourceTypeDevicePrivate 129
1530#define CmResourceTypePcCardConfig 130
1531#define CmResourceTypeMfCardConfig 131
1532
1533/* CM_PARTIAL_RESOURCE_DESCRIPTOR.ShareDisposition
1534 */
1535typedef
1536enum _CM_SHARE_DISPOSITION
1537{ CmResourceShareUndetermined,
1538 CmResourceShareDeviceExclusive,
1539 CmResourceShareDriverExclusive,
1540 CmResourceShareShared
1541} CM_SHARE_DISPOSITION;
1542
1543/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypePort
1544 */
1545#define CM_RESOURCE_PORT_MEMORY 0x0000
1546#define CM_RESOURCE_PORT_IO 0x0001
1547#define CM_RESOURCE_PORT_10_BIT_DECODE 0x0004
1548#define CM_RESOURCE_PORT_12_BIT_DECODE 0x0008
1549#define CM_RESOURCE_PORT_16_BIT_DECODE 0x0010
1550#define CM_RESOURCE_PORT_POSITIVE_DECODE 0x0020
1551#define CM_RESOURCE_PORT_PASSIVE_DECODE 0x0040
1552#define CM_RESOURCE_PORT_WINDOW_DECODE 0x0080
1553
1554/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeInterrupt
1555 */
1556#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0x0000
1557#define CM_RESOURCE_INTERRUPT_LATCHED 0x0001
1558
1559/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeMemory
1560 */
1561#define CM_RESOURCE_MEMORY_READ_WRITE 0x0000
1562#define CM_RESOURCE_MEMORY_READ_ONLY 0x0001
1563#define CM_RESOURCE_MEMORY_WRITE_ONLY 0x0002
1564#define CM_RESOURCE_MEMORY_PREFETCHABLE 0x0004
1565#define CM_RESOURCE_MEMORY_COMBINEDWRITE 0x0008
1566#define CM_RESOURCE_MEMORY_24 0x0010
1567#define CM_RESOURCE_MEMORY_CACHEABLE 0x0020
1568
1569/* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeDma
1570 */
1571#define CM_RESOURCE_DMA_8 0x0000
1572#define CM_RESOURCE_DMA_16 0x0001
1573#define CM_RESOURCE_DMA_32 0x0002
1574#define CM_RESOURCE_DMA_8_AND_16 0x0004
1575#define CM_RESOURCE_DMA_BUS_MASTER 0x0008
1576#define CM_RESOURCE_DMA_TYPE_A 0x0010
1577#define CM_RESOURCE_DMA_TYPE_B 0x0020
1578#define CM_RESOURCE_DMA_TYPE_F 0x0040
1579
1580typedef
1581struct _CM_PARTIAL_RESOURCE_LIST
1582{ USHORT Version;
1583 USHORT Revision;
1584 ULONG Count;
1585 CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
1586} CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
1587
1588typedef
1589struct _CM_FULL_RESOURCE_DESCRIPTOR
1590{ INTERFACE_TYPE InterfaceType;
1591 ULONG BusNumber;
1592 CM_PARTIAL_RESOURCE_LIST PartialResourceList;
1593} CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
1594
1595typedef
1596struct _CM_RESOURCE_LIST
1597{ ULONG Count;
1598 CM_FULL_RESOURCE_DESCRIPTOR List[1];
1599} CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
1600
1601typedef
1602struct _CM_INT13_DRIVE_PARAMETER
1603{ USHORT DriveSelect;
1604 ULONG MaxCylinders;
1605 USHORT SectorsPerTrack;
1606 USHORT MaxHeads;
1607 USHORT NumberDrives;
1608} CM_INT13_DRIVE_PARAMETER, *PCM_INT13_DRIVE_PARAMETER;
1609#include <poppack.h>
1610
1611typedef
1612struct _CM_KEYBOARD_DEVICE_DATA
1613{ USHORT Version;
1614 USHORT Revision;
1615 UCHAR Type;
1616 UCHAR Subtype;
1617 USHORT KeyboardFlags;
1618} CM_KEYBOARD_DEVICE_DATA, *PCM_KEYBOARD_DEVICE_DATA;
1619
1620#define KEYBOARD_INSERT_ON 0x80
1621#define KEYBOARD_CAPS_LOCK_ON 0x40
1622#define KEYBOARD_NUM_LOCK_ON 0x20
1623#define KEYBOARD_SCROLL_LOCK_ON 0x10
1624#define KEYBOARD_ALT_KEY_DOWN 0x08
1625#define KEYBOARD_CTRL_KEY_DOWN 0x04
1626#define KEYBOARD_LEFT_SHIFT_DOWN 0x02
1627#define KEYBOARD_RIGHT_SHIFT_DOWN 0x01
1628
1629typedef
1630struct _CM_MCA_POS_DATA
1631{ USHORT AdapterId;
1632 UCHAR PosData1;
1633 UCHAR PosData2;
1634 UCHAR PosData3;
1635 UCHAR PosData4;
1636} CM_MCA_POS_DATA, *PCM_MCA_POS_DATA;
1637
1638typedef
1639struct CM_Power_Data_s
1640{ ULONG PD_Size;
1641 DEVICE_POWER_STATE PD_MostRecentPowerState;
1642 ULONG PD_Capabilities;
1643 ULONG PD_D1Latency;
1644 ULONG PD_D2Latency;
1645 ULONG PD_D3Latency;
1646 DEVICE_POWER_STATE PD_PowerStateMapping[PowerSystemMaximum];
1647} CM_POWER_DATA, *PCM_POWER_DATA;
1648
1649#define PDCAP_D0_SUPPORTED 0x00000001
1650#define PDCAP_D1_SUPPORTED 0x00000002
1651#define PDCAP_D2_SUPPORTED 0x00000004
1652#define PDCAP_D3_SUPPORTED 0x00000008
1653#define PDCAP_WAKE_FROM_D0_SUPPORTED 0x00000010
1654#define PDCAP_WAKE_FROM_D1_SUPPORTED 0x00000020
1655#define PDCAP_WAKE_FROM_D2_SUPPORTED 0x00000040
1656#define PDCAP_WAKE_FROM_D3_SUPPORTED 0x00000080
1657#define PDCAP_WARM_EJECT_SUPPORTED 0x00000100
1658
1659typedef
1660struct _CM_SCSI_DEVICE_DATA
1661{ USHORT Version;
1662 USHORT Revision;
1663 UCHAR HostIdentifier;
1664} CM_SCSI_DEVICE_DATA, *PCM_SCSI_DEVICE_DATA;
1665
1666typedef
1667struct _CM_SERIAL_DEVICE_DATA
1668{ USHORT Version;
1669 USHORT Revision;
1670 ULONG BaudClock;
1671} CM_SERIAL_DEVICE_DATA, *PCM_SERIAL_DEVICE_DATA;
1672
1673/* IO_RESOURCE_DESCRIPTOR.Option
1674 */
1675#define IO_RESOURCE_PREFERRED 0x01
1676#define IO_RESOURCE_DEFAULT 0x02
1677#define IO_RESOURCE_ALTERNATIVE 0x08
1678
1679typedef
1680struct _IO_RESOURCE_DESCRIPTOR
1681{ UCHAR Option;
1682 UCHAR Type;
1683 UCHAR ShareDisposition;
1684 UCHAR Spare1;
1685 USHORT Flags;
1686 USHORT Spare2;
1687 union
1688 { struct
1689 { ULONG Length;
1690 ULONG Alignment;
1691 PHYSICAL_ADDRESS MinimumAddress;
1692 PHYSICAL_ADDRESS MaximumAddress;
1693 } Port;
1694 struct
1695 { ULONG Length;
1696 ULONG Alignment;
1697 PHYSICAL_ADDRESS MinimumAddress;
1698 PHYSICAL_ADDRESS MaximumAddress;
1699 } Memory;
1700 struct
1701 { ULONG MinimumVector;
1702 ULONG MaximumVector;
1703 } Interrupt;
1704 struct
1705 { ULONG MinimumChannel;
1706 ULONG MaximumChannel;
1707 } Dma;
1708 struct
1709 { ULONG Length;
1710 ULONG Alignment;
1711 PHYSICAL_ADDRESS MinimumAddress;
1712 PHYSICAL_ADDRESS MaximumAddress;
1713 } Generic;
1714 struct
1715 { ULONG Data[3];
1716 } DevicePrivate;
1717 struct
1718 { ULONG Length;
1719 ULONG MinBusNumber;
1720 ULONG MaxBusNumber;
1721 ULONG Reserved;
1722 } BusNumber;
1723 struct
1724 { ULONG Priority;
1725 ULONG Reserved1;
1726 ULONG Reserved2;
1727 } ConfigData;
1728 } u;
1729} IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
1730
1731typedef
1732struct _IO_RESOURCE_LIST
1733{ USHORT Version;
1734 USHORT Revision;
1735 ULONG Count;
1736 IO_RESOURCE_DESCRIPTOR Descriptors[1];
1737} IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
1738
1739typedef
1740struct _IO_RESOURCE_REQUIREMENTS_LIST
1741{ ULONG ListSize;
1742 INTERFACE_TYPE InterfaceType;
1743 ULONG BusNumber;
1744 ULONG SlotNumber;
1745 ULONG Reserved[3];
1746 ULONG AlternativeLists;
1747 IO_RESOURCE_LIST List[1];
1748} IO_RESOURCE_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
1749
1750typedef
1751struct _CONTROLLER_OBJECT
1752{ CSHORT Type;
1753 CSHORT Size;
1754 PVOID ControllerExtension;
1755 KDEVICE_QUEUE DeviceWaitQueue;
1756 ULONG Spare1;
1757 LARGE_INTEGER Spare2;
1758} CONTROLLER_OBJECT, *PCONTROLLER_OBJECT;
1759
1760typedef
1761enum _DMA_WIDTH
1762{ Width8Bits,
1763 Width16Bits,
1764 Width32Bits,
1765 MaximumDmaWidth
1766} DMA_WIDTH, *PDMA_WIDTH;
1767
1768typedef
1769enum _DMA_SPEED
1770{ Compatible,
1771 TypeA,
1772 TypeB,
1773 TypeC,
1774 TypeF,
1775 MaximumDmaSpeed
1776} DMA_SPEED, *PDMA_SPEED;
1777
1778/* DEVICE_DESCRIPTION.Version
1779 */
1780#define DEVICE_DESCRIPTION_VERSION 0x0000
1781#define DEVICE_DESCRIPTION_VERSION1 0x0001
1782#define DEVICE_DESCRIPTION_VERSION2 0x0002
1783
1784typedef
1785struct _DEVICE_DESCRIPTION
1786{ ULONG Version;
1787 BOOLEAN Master;
1788 BOOLEAN ScatterGather;
1789 BOOLEAN DemandMode;
1790 BOOLEAN AutoInitialize;
1791 BOOLEAN Dma32BitAddresses;
1792 BOOLEAN IgnoreCount;
1793 BOOLEAN Reserved1;
1794 BOOLEAN Dma64BitAddresses;
1795 ULONG BusNumber;
1796 ULONG DmaChannel;
1797 INTERFACE_TYPE InterfaceType;
1798 DMA_WIDTH DmaWidth;
1799 DMA_SPEED DmaSpeed;
1800 ULONG MaximumLength;
1801 ULONG DmaPort;
1802} DEVICE_DESCRIPTION, *PDEVICE_DESCRIPTION;
1803
1804/* VPB.Flags */
1805#define VPB_MOUNTED 0x0001
1806#define VPB_LOCKED 0x0002
1807#define VPB_PERSISTENT 0x0004
1808#define VPB_REMOVE_PENDING 0x0008
1809#define VPB_RAW_MOUNT 0x0010
1810
1811#define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR))
1812
1813typedef
1814struct _VPB
1815{ CSHORT Type;
1816 CSHORT Size;
1817 USHORT Flags;
1818 USHORT VolumeLabelLength;
1819 struct _DEVICE_OBJECT *DeviceObject;
1820 struct _DEVICE_OBJECT *RealDevice;
1821 ULONG SerialNumber;
1822 ULONG ReferenceCount;
1823 WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH / sizeof(WCHAR)];
1824} VPB, *PVPB;
1825
1826/* DEVICE_OBJECT.Flags
1827 */
1828#define DO_VERIFY_VOLUME 0x00000002
1829#define DO_BUFFERED_IO 0x00000004
1830#define DO_EXCLUSIVE 0x00000008
1831#define DO_DIRECT_IO 0x00000010
1832#define DO_MAP_IO_BUFFER 0x00000020
1833#define DO_DEVICE_HAS_NAME 0x00000040
1834#define DO_DEVICE_INITIALIZING 0x00000080
1835#define DO_SYSTEM_BOOT_PARTITION 0x00000100
1836#define DO_LONG_TERM_REQUESTS 0x00000200
1837#define DO_NEVER_LAST_DEVICE 0x00000400
1838#define DO_SHUTDOWN_REGISTERED 0x00000800
1839#define DO_BUS_ENUMERATED_DEVICE 0x00001000
1840#define DO_POWER_PAGABLE 0x00002000
1841#define DO_POWER_INRUSH 0x00004000
1842#define DO_LOW_PRIORITY_FILESYSTEM 0x00010000
1843
1844/* DEVICE_OBJECT.Characteristics
1845 */
1846#define FILE_REMOVABLE_MEDIA 0x00000001
1847#define FILE_READ_ONLY_DEVICE 0x00000002
1848#define FILE_FLOPPY_DISKETTE 0x00000004
1849#define FILE_WRITE_ONCE_MEDIA 0x00000008
1850#define FILE_REMOTE_DEVICE 0x00000010
1851#define FILE_DEVICE_IS_MOUNTED 0x00000020
1852#define FILE_VIRTUAL_VOLUME 0x00000040
1853#define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080
1854#define FILE_DEVICE_SECURE_OPEN 0x00000100
1855
1856/* DEVICE_OBJECT.AlignmentRequirement
1857 */
1858#define FILE_BYTE_ALIGNMENT 0x00000000
1859#define FILE_WORD_ALIGNMENT 0x00000001
1860#define FILE_LONG_ALIGNMENT 0x00000003
1861#define FILE_QUAD_ALIGNMENT 0x00000007
1862#define FILE_OCTA_ALIGNMENT 0x0000000f
1863#define FILE_32_BYTE_ALIGNMENT 0x0000001f
1864#define FILE_64_BYTE_ALIGNMENT 0x0000003f
1865#define FILE_128_BYTE_ALIGNMENT 0x0000007f
1866#define FILE_256_BYTE_ALIGNMENT 0x000000ff
1867#define FILE_512_BYTE_ALIGNMENT 0x000001ff
1868
1869/* DEVICE_OBJECT.DeviceType
1870 */
1871typedef
1872struct _DEVICE_OBJECT
1873{ CSHORT Type;
1874 USHORT Size;
1875 LONG ReferenceCount;
1876 struct _DRIVER_OBJECT *DriverObject;
1877 struct _DEVICE_OBJECT *NextDevice;
1878 struct _DEVICE_OBJECT *AttachedDevice;
1879 struct _IRP *CurrentIrp;
1880 PIO_TIMER Timer;
1881 ULONG Flags;
1882 ULONG Characteristics;
1883 PVPB Vpb;
1884 PVOID DeviceExtension;
1885 DEVICE_TYPE DeviceType;
1886 CCHAR StackSize;
1887 union
1888 { LIST_ENTRY ListEntry;
1889 WAIT_CONTEXT_BLOCK Wcb;
1890 } Queue;
1891 ULONG AlignmentRequirement;
1892 KDEVICE_QUEUE DeviceQueue;
1893 KDPC Dpc;
1894 ULONG ActiveThreadCount;
1895 PSECURITY_DESCRIPTOR SecurityDescriptor;
1896 KEVENT DeviceLock;
1897 USHORT SectorSize;
1898 USHORT Spare1;
1899 struct _DEVOBJ_EXTENSION *DeviceObjectExtension;
1900 PVOID Reserved;
1901} DEVICE_OBJECT, *PDEVICE_OBJECT;
1902
1903typedef
1904enum _DEVICE_RELATION_TYPE
1905{ BusRelations,
1906 EjectionRelations,
1907 PowerRelations,
1908 RemovalRelations,
1909 TargetDeviceRelation,
1910 SingleBusRelations
1911} DEVICE_RELATION_TYPE, *PDEVICE_RELATION_TYPE;
1912
1913typedef
1914struct _DEVICE_RELATIONS
1915{ ULONG Count;
1916 PDEVICE_OBJECT Objects[1];
1917} DEVICE_RELATIONS, *PDEVICE_RELATIONS;
1918
1919typedef
1920struct _SCATTER_GATHER_ELEMENT
1921{ PHYSICAL_ADDRESS Address;
1922 ULONG Length;
1923 ULONG_PTR Reserved;
1924} SCATTER_GATHER_ELEMENT, *PSCATTER_GATHER_ELEMENT;
1925
1926typedef
1927struct _SCATTER_GATHER_LIST
1928{ ULONG NumberOfElements;
1929 ULONG_PTR Reserved;
1930 SCATTER_GATHER_ELEMENT Elements[0];
1931} SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
1932
1933typedef
1934struct _MDL
1935{ struct _MDL *Next;
1936 CSHORT Size;
1937 CSHORT MdlFlags;
1938 struct _EPROCESS *Process;
1939 PVOID MappedSystemVa;
1940 PVOID StartVa;
1941 ULONG ByteCount;
1942 ULONG ByteOffset;
1943} MDL, *PMDL;
1944
1945#define MDL_MAPPED_TO_SYSTEM_VA 0x0001
1946#define MDL_PAGES_LOCKED 0x0002
1947#define MDL_SOURCE_IS_NONPAGED_POOL 0x0004
1948#define MDL_ALLOCATED_FIXED_SIZE 0x0008
1949#define MDL_PARTIAL 0x0010
1950#define MDL_PARTIAL_HAS_BEEN_MAPPED 0x0020
1951#define MDL_IO_PAGE_READ 0x0040
1952#define MDL_WRITE_OPERATION 0x0080
1953#define MDL_PARENT_MAPPED_SYSTEM_VA 0x0100
1954#define MDL_FREE_EXTRA_PTES 0x0200
1955#define MDL_IO_SPACE 0x0800
1956#define MDL_NETWORK_HEADER 0x1000
1957#define MDL_MAPPING_CAN_FAIL 0x2000
1958#define MDL_ALLOCATED_MUST_SUCCEED 0x4000
1959
1960#define MDL_MAPPING_FLAGS ( \
1961 MDL_MAPPED_TO_SYSTEM_VA | \
1962 MDL_PAGES_LOCKED | \
1963 MDL_SOURCE_IS_NONPAGED_POOL | \
1964 MDL_PARTIAL_HAS_BEEN_MAPPED | \
1965 MDL_PARENT_MAPPED_SYSTEM_VA | \
1966 MDL_SYSTEM_VA | \
1967 MDL_IO_SPACE)
1968
1969typedef VOID DDKAPI
1970(*PPUT_DMA_ADAPTER)(
1971 /*IN*/ PDMA_ADAPTER DmaAdapter);
1972
1973typedef PVOID DDKAPI
1974(*PALLOCATE_COMMON_BUFFER)(
1975 /*IN*/ PDMA_ADAPTER DmaAdapter,
1976 /*IN*/ ULONG Length,
1977 /*OUT*/ PPHYSICAL_ADDRESS LogicalAddress,
1978 /*IN*/ BOOLEAN CacheEnabled);
1979
1980typedef VOID DDKAPI
1981(*PFREE_COMMON_BUFFER)(
1982 /*IN*/ PDMA_ADAPTER DmaAdapter,
1983 /*IN*/ ULONG Length,
1984 /*IN*/ PHYSICAL_ADDRESS LogicalAddress,
1985 /*IN*/ PVOID VirtualAddress,
1986 /*IN*/ BOOLEAN CacheEnabled);
1987
1988typedef NTSTATUS DDKAPI
1989(*PALLOCATE_ADAPTER_CHANNEL)(
1990 /*IN*/ PDMA_ADAPTER DmaAdapter,
1991 /*IN*/ PDEVICE_OBJECT DeviceObject,
1992 /*IN*/ ULONG NumberOfMapRegisters,
1993 /*IN*/ PDRIVER_CONTROL ExecutionRoutine,
1994 /*IN*/ PVOID Context);
1995
1996typedef BOOLEAN DDKAPI
1997(*PFLUSH_ADAPTER_BUFFERS)(
1998 /*IN*/ PDMA_ADAPTER DmaAdapter,
1999 /*IN*/ PMDL Mdl,
2000 /*IN*/ PVOID MapRegisterBase,
2001 /*IN*/ PVOID CurrentVa,
2002 /*IN*/ ULONG Length,
2003 /*IN*/ BOOLEAN WriteToDevice);
2004
2005typedef VOID DDKAPI
2006(*PFREE_ADAPTER_CHANNEL)(
2007 /*IN*/ PDMA_ADAPTER DmaAdapter);
2008
2009typedef VOID DDKAPI
2010(*PFREE_MAP_REGISTERS)(
2011 /*IN*/ PDMA_ADAPTER DmaAdapter,
2012 PVOID MapRegisterBase,
2013 ULONG NumberOfMapRegisters);
2014
2015typedef PHYSICAL_ADDRESS DDKAPI
2016(*PMAP_TRANSFER)(
2017 /*IN*/ PDMA_ADAPTER DmaAdapter,
2018 /*IN*/ PMDL Mdl,
2019 /*IN*/ PVOID MapRegisterBase,
2020 /*IN*/ PVOID CurrentVa,
2021 /*IN OUT*/ PULONG Length,
2022 /*IN*/ BOOLEAN WriteToDevice);
2023
2024typedef ULONG DDKAPI
2025(*PGET_DMA_ALIGNMENT)(
2026 /*IN*/ PDMA_ADAPTER DmaAdapter);
2027
2028typedef ULONG DDKAPI
2029(*PREAD_DMA_COUNTER)(
2030 /*IN*/ PDMA_ADAPTER DmaAdapter);
2031
2032typedef NTSTATUS DDKAPI
2033(*PGET_SCATTER_GATHER_LIST)(
2034 /*IN*/ PDMA_ADAPTER DmaAdapter,
2035 /*IN*/ PDEVICE_OBJECT DeviceObject,
2036 /*IN*/ PMDL Mdl,
2037 /*IN*/ PVOID CurrentVa,
2038 /*IN*/ ULONG Length,
2039 /*IN*/ PDRIVER_LIST_CONTROL ExecutionRoutine,
2040 /*IN*/ PVOID Context,
2041 /*IN*/ BOOLEAN WriteToDevice);
2042
2043typedef VOID DDKAPI
2044(*PPUT_SCATTER_GATHER_LIST)(
2045 /*IN*/ PDMA_ADAPTER DmaAdapter,
2046 /*IN*/ PSCATTER_GATHER_LIST ScatterGather,
2047 /*IN*/ BOOLEAN WriteToDevice);
2048
2049typedef NTSTATUS DDKAPI
2050(*PCALCULATE_SCATTER_GATHER_LIST_SIZE)(
2051 /*IN*/ PDMA_ADAPTER DmaAdapter,
2052 /*IN*/ PMDL Mdl /*OPTIONAL*/,
2053 /*IN*/ PVOID CurrentVa,
2054 /*IN*/ ULONG Length,
2055 /*OUT*/ PULONG ScatterGatherListSize,
2056 /*OUT*/ PULONG pNumberOfMapRegisters /*OPTIONAL*/);
2057
2058typedef NTSTATUS DDKAPI
2059(*PBUILD_SCATTER_GATHER_LIST)(
2060 /*IN*/ PDMA_ADAPTER DmaAdapter,
2061 /*IN*/ PDEVICE_OBJECT DeviceObject,
2062 /*IN*/ PMDL Mdl,
2063 /*IN*/ PVOID CurrentVa,
2064 /*IN*/ ULONG Length,
2065 /*IN*/ PDRIVER_LIST_CONTROL ExecutionRoutine,
2066 /*IN*/ PVOID Context,
2067 /*IN*/ BOOLEAN WriteToDevice,
2068 /*IN*/ PVOID ScatterGatherBuffer,
2069 /*IN*/ ULONG ScatterGatherLength);
2070
2071typedef NTSTATUS DDKAPI
2072(*PBUILD_MDL_FROM_SCATTER_GATHER_LIST)(
2073 /*IN*/ PDMA_ADAPTER DmaAdapter,
2074 /*IN*/ PSCATTER_GATHER_LIST ScatterGather,
2075 /*IN*/ PMDL OriginalMdl,
2076 /*OUT*/ PMDL *TargetMdl);
2077
2078typedef
2079struct _DMA_OPERATIONS
2080{ ULONG Size;
2081 PPUT_DMA_ADAPTER PutDmaAdapter;
2082 PALLOCATE_COMMON_BUFFER AllocateCommonBuffer;
2083 PFREE_COMMON_BUFFER FreeCommonBuffer;
2084 PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel;
2085 PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers;
2086 PFREE_ADAPTER_CHANNEL FreeAdapterChannel;
2087 PFREE_MAP_REGISTERS FreeMapRegisters;
2088 PMAP_TRANSFER MapTransfer;
2089 PGET_DMA_ALIGNMENT GetDmaAlignment;
2090 PREAD_DMA_COUNTER ReadDmaCounter;
2091 PGET_SCATTER_GATHER_LIST GetScatterGatherList;
2092 PPUT_SCATTER_GATHER_LIST PutScatterGatherList;
2093 PCALCULATE_SCATTER_GATHER_LIST_SIZE CalculateScatterGatherList;
2094 PBUILD_SCATTER_GATHER_LIST BuildScatterGatherList;
2095 PBUILD_MDL_FROM_SCATTER_GATHER_LIST BuildMdlFromScatterGatherList;
2096} DMA_OPERATIONS, *PDMA_OPERATIONS;
2097
2098typedef
2099struct _DMA_ADAPTER
2100{ USHORT Version;
2101 USHORT Size;
2102 PDMA_OPERATIONS DmaOperations;
2103} DMA_ADAPTER;
2104
2105typedef
2106enum _FILE_INFORMATION_CLASS
2107{ FileDirectoryInformation = 1,
2108 FileFullDirectoryInformation,
2109 FileBothDirectoryInformation,
2110 FileBasicInformation,
2111 FileStandardInformation,
2112 FileInternalInformation,
2113 FileEaInformation,
2114 FileAccessInformation,
2115 FileNameInformation,
2116 FileRenameInformation,
2117 FileLinkInformation,
2118 FileNamesInformation,
2119 FileDispositionInformation,
2120 FilePositionInformation,
2121 FileFullEaInformation,
2122 FileModeInformation,
2123 FileAlignmentInformation,
2124 FileAllInformation,
2125 FileAllocationInformation,
2126 FileEndOfFileInformation,
2127 FileAlternateNameInformation,
2128 FileStreamInformation,
2129 FilePipeInformation,
2130 FilePipeLocalInformation,
2131 FilePipeRemoteInformation,
2132 FileMailslotQueryInformation,
2133 FileMailslotSetInformation,
2134 FileCompressionInformation,
2135 FileObjectIdInformation,
2136 FileCompletionInformation,
2137 FileMoveClusterInformation,
2138 FileQuotaInformation,
2139 FileReparsePointInformation,
2140 FileNetworkOpenInformation,
2141 FileAttributeTagInformation,
2142 FileTrackingInformation,
2143 FileIdBothDirectoryInformation,
2144 FileIdFullDirectoryInformation,
2145 FileValidDataLengthInformation,
2146 FileShortNameInformation,
2147 FileMaximumInformation
2148} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
2149
2150typedef
2151struct _FILE_POSITION_INFORMATION
2152{ LARGE_INTEGER CurrentByteOffset;
2153} FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION;
2154
2155typedef
2156struct _FILE_ALIGNMENT_INFORMATION
2157{ ULONG AlignmentRequirement;
2158} FILE_ALIGNMENT_INFORMATION;
2159
2160typedef
2161struct _FILE_NAME_INFORMATION
2162{ ULONG FileNameLength;
2163 WCHAR FileName[1];
2164} FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION;
2165
2166typedef
2167struct _FILE_BASIC_INFORMATION
2168{ LARGE_INTEGER CreationTime;
2169 LARGE_INTEGER LastAccessTime;
2170 LARGE_INTEGER LastWriteTime;
2171 LARGE_INTEGER ChangeTime;
2172 ULONG FileAttributes;
2173} FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION;
2174
2175typedef
2176struct _FILE_STANDARD_INFORMATION
2177{ LARGE_INTEGER AllocationSize;
2178 LARGE_INTEGER EndOfFile;
2179 ULONG NumberOfLinks;
2180 BOOLEAN DeletePending;
2181 BOOLEAN Directory;
2182} FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION;
2183
2184typedef
2185struct _FILE_NETWORK_OPEN_INFORMATION
2186{ LARGE_INTEGER CreationTime;
2187 LARGE_INTEGER LastAccessTime;
2188 LARGE_INTEGER LastWriteTime;
2189 LARGE_INTEGER ChangeTime;
2190 LARGE_INTEGER AllocationSize;
2191 LARGE_INTEGER EndOfFile;
2192 ULONG FileAttributes;
2193} FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION;
2194
2195typedef
2196struct _FILE_ATTRIBUTE_TAG_INFORMATION
2197{ ULONG FileAttributes;
2198 ULONG ReparseTag;
2199} FILE_ATTRIBUTE_TAG_INFORMATION, *PFILE_ATTRIBUTE_TAG_INFORMATION;
2200
2201typedef
2202struct _FILE_DISPOSITION_INFORMATION
2203{ BOOLEAN DoDeleteFile;
2204} FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION;
2205
2206typedef
2207struct _FILE_END_OF_FILE_INFORMATION
2208{ LARGE_INTEGER EndOfFile;
2209} FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION;
2210
2211typedef
2212struct _FILE_VALID_DATA_LENGTH_INFORMATION
2213{ LARGE_INTEGER ValidDataLength;
2214} FILE_VALID_DATA_LENGTH_INFORMATION, *PFILE_VALID_DATA_LENGTH_INFORMATION;
2215
2216typedef
2217enum _FSINFOCLASS
2218{ FileFsVolumeInformation = 1,
2219 FileFsLabelInformation,
2220 FileFsSizeInformation,
2221 FileFsDeviceInformation,
2222 FileFsAttributeInformation,
2223 FileFsControlInformation,
2224 FileFsFullSizeInformation,
2225 FileFsObjectIdInformation,
2226 FileFsDriverPathInformation,
2227 FileFsMaximumInformation
2228} FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
2229
2230typedef
2231struct _FILE_FS_DEVICE_INFORMATION
2232{ DEVICE_TYPE DeviceType;
2233 ULONG Characteristics;
2234} FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION;
2235
2236typedef
2237struct _FILE_FULL_EA_INFORMATION
2238{ ULONG NextEntryOffset;
2239 UCHAR Flags;
2240 UCHAR EaNameLength;
2241 USHORT EaValueLength;
2242 CHAR EaName[1];
2243} FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
2244
2245typedef ULONG_PTR ERESOURCE_THREAD;
2246typedef ERESOURCE_THREAD *PERESOURCE_THREAD;
2247
2248typedef
2249struct _OWNER_ENTRY
2250{ ERESOURCE_THREAD OwnerThread;
2251 _ANONYMOUS_UNION union
2252 { LONG OwnerCount;
2253 ULONG TableSize;
2254 } DUMMYUNIONNAME;
2255} OWNER_ENTRY, *POWNER_ENTRY;
2256
2257/* ERESOURCE.Flag
2258 */
2259#define ResourceNeverExclusive 0x0010
2260#define ResourceReleaseByOtherThread 0x0020
2261#define ResourceOwnedExclusive 0x0080
2262
2263#define RESOURCE_HASH_TABLE_SIZE 64
2264
2265typedef
2266struct _ERESOURCE
2267{ LIST_ENTRY SystemResourcesList;
2268 POWNER_ENTRY OwnerTable;
2269 SHORT ActiveCount;
2270 USHORT Flag;
2271 PKSEMAPHORE SharedWaiters;
2272 PKEVENT ExclusiveWaiters;
2273 OWNER_ENTRY OwnerThreads[2];
2274 ULONG ContentionCount;
2275 USHORT NumberOfSharedWaiters;
2276 USHORT NumberOfExclusiveWaiters;
2277 _ANONYMOUS_UNION union
2278 { PVOID Address;
2279 ULONG_PTR CreatorBackTraceIndex;
2280 } DUMMYUNIONNAME;
2281 KSPIN_LOCK SpinLock;
2282} ERESOURCE, *PERESOURCE;
2283
2284/* NOTE: PVOID for methods to avoid 'assignment from incompatible pointer type' warning */
2285typedef
2286struct _DRIVER_EXTENSION
2287{ struct _DRIVER_OBJECT *DriverObject;
2288 PVOID AddDevice;
2289 ULONG Count;
2290 UNICODE_STRING ServiceKeyName;
2291} DRIVER_EXTENSION, *PDRIVER_EXTENSION;
2292
2293typedef BOOLEAN DDKAPI
2294(*PFAST_IO_CHECK_IF_POSSIBLE)(
2295 /*IN*/ struct _FILE_OBJECT *FileObject,
2296 /*IN*/ PLARGE_INTEGER FileOffset,
2297 /*IN*/ ULONG Length,
2298 /*IN*/ BOOLEAN Wait,
2299 /*IN*/ ULONG LockKey,
2300 /*IN*/ BOOLEAN CheckForReadOperation,
2301 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2302 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2303
2304typedef BOOLEAN DDKAPI
2305(*PFAST_IO_READ)(
2306 /*IN*/ struct _FILE_OBJECT *FileObject,
2307 /*IN*/ PLARGE_INTEGER FileOffset,
2308 /*IN*/ ULONG Length,
2309 /*IN*/ BOOLEAN Wait,
2310 /*IN*/ ULONG LockKey,
2311 /*OUT*/ PVOID Buffer,
2312 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2313 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2314
2315typedef BOOLEAN DDKAPI
2316(*PFAST_IO_WRITE)(
2317 /*IN*/ struct _FILE_OBJECT *FileObject,
2318 /*IN*/ PLARGE_INTEGER FileOffset,
2319 /*IN*/ ULONG Length,
2320 /*IN*/ BOOLEAN Wait,
2321 /*IN*/ ULONG LockKey,
2322 /*IN*/ PVOID Buffer,
2323 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2324 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2325
2326typedef BOOLEAN DDKAPI
2327(*PFAST_IO_QUERY_BASIC_INFO)(
2328 /*IN*/ struct _FILE_OBJECT *FileObject,
2329 /*IN*/ BOOLEAN Wait,
2330 /*OUT*/ PFILE_BASIC_INFORMATION Buffer,
2331 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2332 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2333
2334typedef BOOLEAN DDKAPI
2335(*PFAST_IO_QUERY_STANDARD_INFO)(
2336 /*IN*/ struct _FILE_OBJECT *FileObject,
2337 /*IN*/ BOOLEAN Wait,
2338 /*OUT*/ PFILE_STANDARD_INFORMATION Buffer,
2339 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2340 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2341
2342typedef BOOLEAN DDKAPI
2343(*PFAST_IO_LOCK)(
2344 /*IN*/ struct _FILE_OBJECT *FileObject,
2345 /*IN*/ PLARGE_INTEGER FileOffset,
2346 /*IN*/ PLARGE_INTEGER Length,
2347 PEPROCESS ProcessId,
2348 ULONG Key,
2349 BOOLEAN FailImmediately,
2350 BOOLEAN ExclusiveLock,
2351 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2352 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2353
2354typedef BOOLEAN DDKAPI
2355(*PFAST_IO_UNLOCK_SINGLE)(
2356 /*IN*/ struct _FILE_OBJECT *FileObject,
2357 /*IN*/ PLARGE_INTEGER FileOffset,
2358 /*IN*/ PLARGE_INTEGER Length,
2359 PEPROCESS ProcessId,
2360 ULONG Key,
2361 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2362 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2363
2364typedef BOOLEAN DDKAPI
2365(*PFAST_IO_UNLOCK_ALL)(
2366 /*IN*/ struct _FILE_OBJECT *FileObject,
2367 PEPROCESS ProcessId,
2368 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2369 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2370
2371typedef BOOLEAN DDKAPI
2372(*PFAST_IO_UNLOCK_ALL_BY_KEY)(
2373 /*IN*/ struct _FILE_OBJECT *FileObject,
2374 PVOID ProcessId,
2375 ULONG Key,
2376 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2377 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2378
2379typedef BOOLEAN DDKAPI
2380(*PFAST_IO_DEVICE_CONTROL)(
2381 /*IN*/ struct _FILE_OBJECT *FileObject,
2382 /*IN*/ BOOLEAN Wait,
2383 /*IN*/ PVOID InputBuffer /*OPTIONAL*/,
2384 /*IN*/ ULONG InputBufferLength,
2385 /*OUT*/ PVOID OutputBuffer /*OPTIONAL*/,
2386 /*IN*/ ULONG OutputBufferLength,
2387 /*IN*/ ULONG IoControlCode,
2388 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2389 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2390
2391typedef VOID DDKAPI
2392(*PFAST_IO_ACQUIRE_FILE)(
2393 /*IN*/ struct _FILE_OBJECT *FileObject);
2394
2395typedef VOID DDKAPI
2396(*PFAST_IO_RELEASE_FILE)(
2397 /*IN*/ struct _FILE_OBJECT *FileObject);
2398
2399typedef VOID DDKAPI
2400(*PFAST_IO_DETACH_DEVICE)(
2401 /*IN*/ struct _DEVICE_OBJECT *SourceDevice,
2402 /*IN*/ struct _DEVICE_OBJECT *TargetDevice);
2403
2404typedef BOOLEAN DDKAPI
2405(*PFAST_IO_QUERY_NETWORK_OPEN_INFO)(
2406 /*IN*/ struct _FILE_OBJECT *FileObject,
2407 /*IN*/ BOOLEAN Wait,
2408 /*OUT*/ struct _FILE_NETWORK_OPEN_INFORMATION *Buffer,
2409 /*OUT*/ struct _IO_STATUS_BLOCK *IoStatus,
2410 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2411
2412typedef NTSTATUS DDKAPI
2413(*PFAST_IO_ACQUIRE_FOR_MOD_WRITE)(
2414 /*IN*/ struct _FILE_OBJECT *FileObject,
2415 /*IN*/ PLARGE_INTEGER EndingOffset,
2416 /*OUT*/ struct _ERESOURCE **ResourceToRelease,
2417 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2418
2419typedef BOOLEAN DDKAPI
2420(*PFAST_IO_MDL_READ)(
2421 /*IN*/ struct _FILE_OBJECT *FileObject,
2422 /*IN*/ PLARGE_INTEGER FileOffset,
2423 /*IN*/ ULONG Length,
2424 /*IN*/ ULONG LockKey,
2425 /*OUT*/ PMDL *MdlChain,
2426 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2427 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2428
2429typedef BOOLEAN DDKAPI
2430(*PFAST_IO_MDL_READ_COMPLETE)(
2431 /*IN*/ struct _FILE_OBJECT *FileObject,
2432 /*IN*/ PMDL MdlChain,
2433 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2434
2435typedef BOOLEAN DDKAPI
2436(*PFAST_IO_PREPARE_MDL_WRITE)(
2437 /*IN*/ struct _FILE_OBJECT *FileObject,
2438 /*IN*/ PLARGE_INTEGER FileOffset,
2439 /*IN*/ ULONG Length,
2440 /*IN*/ ULONG LockKey,
2441 /*OUT*/ PMDL *MdlChain,
2442 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2443 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2444
2445typedef BOOLEAN DDKAPI
2446(*PFAST_IO_MDL_WRITE_COMPLETE)(
2447 /*IN*/ struct _FILE_OBJECT *FileObject,
2448 /*IN*/ PLARGE_INTEGER FileOffset,
2449 /*IN*/ PMDL MdlChain,
2450 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2451
2452typedef BOOLEAN DDKAPI
2453(*PFAST_IO_READ_COMPRESSED)(
2454 /*IN*/ struct _FILE_OBJECT *FileObject,
2455 /*IN*/ PLARGE_INTEGER FileOffset,
2456 /*IN*/ ULONG Length,
2457 /*IN*/ ULONG LockKey,
2458 /*OUT*/ PVOID Buffer,
2459 /*OUT*/ PMDL *MdlChain,
2460 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2461 /*OUT*/ struct _COMPRESSED_DATA_INFO *CompressedDataInfo,
2462 /*IN*/ ULONG CompressedDataInfoLength,
2463 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2464
2465typedef BOOLEAN DDKAPI
2466(*PFAST_IO_WRITE_COMPRESSED)(
2467 /*IN*/ struct _FILE_OBJECT *FileObject,
2468 /*IN*/ PLARGE_INTEGER FileOffset,
2469 /*IN*/ ULONG Length,
2470 /*IN*/ ULONG LockKey,
2471 /*IN*/ PVOID Buffer,
2472 /*OUT*/ PMDL *MdlChain,
2473 /*OUT*/ PIO_STATUS_BLOCK IoStatus,
2474 /*IN*/ struct _COMPRESSED_DATA_INFO *CompressedDataInfo,
2475 /*IN*/ ULONG CompressedDataInfoLength,
2476 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2477
2478typedef BOOLEAN DDKAPI
2479(*PFAST_IO_MDL_READ_COMPLETE_COMPRESSED)(
2480 /*IN*/ struct _FILE_OBJECT *FileObject,
2481 /*IN*/ PMDL MdlChain,
2482 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2483
2484typedef BOOLEAN DDKAPI
2485(*PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED)(
2486 /*IN*/ struct _FILE_OBJECT *FileObject,
2487 /*IN*/ PLARGE_INTEGER FileOffset,
2488 /*IN*/ PMDL MdlChain,
2489 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2490
2491typedef BOOLEAN DDKAPI
2492(*PFAST_IO_QUERY_OPEN)(
2493 /*IN*/ struct _IRP *Irp,
2494 /*OUT*/ PFILE_NETWORK_OPEN_INFORMATION NetworkInformation,
2495 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2496
2497typedef NTSTATUS DDKAPI
2498(*PFAST_IO_RELEASE_FOR_MOD_WRITE)(
2499 /*IN*/ struct _FILE_OBJECT *FileObject,
2500 /*IN*/ struct _ERESOURCE *ResourceToRelease,
2501 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2502
2503typedef NTSTATUS DDKAPI
2504(*PFAST_IO_ACQUIRE_FOR_CCFLUSH)(
2505 /*IN*/ struct _FILE_OBJECT *FileObject,
2506 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2507
2508typedef NTSTATUS DDKAPI
2509(*PFAST_IO_RELEASE_FOR_CCFLUSH) (
2510 /*IN*/ struct _FILE_OBJECT *FileObject,
2511 /*IN*/ struct _DEVICE_OBJECT *DeviceObject);
2512
2513typedef
2514struct _FAST_IO_DISPATCH
2515{ ULONG SizeOfFastIoDispatch;
2516 PFAST_IO_CHECK_IF_POSSIBLE FastIoCheckIfPossible;
2517 PFAST_IO_READ FastIoRead;
2518 PFAST_IO_WRITE FastIoWrite;
2519 PFAST_IO_QUERY_BASIC_INFO FastIoQueryBasicInfo;
2520 PFAST_IO_QUERY_STANDARD_INFO FastIoQueryStandardInfo;
2521 PFAST_IO_LOCK FastIoLock;
2522 PFAST_IO_UNLOCK_SINGLE FastIoUnlockSingle;
2523 PFAST_IO_UNLOCK_ALL FastIoUnlockAll;
2524 PFAST_IO_UNLOCK_ALL_BY_KEY FastIoUnlockAllByKey;
2525 PFAST_IO_DEVICE_CONTROL FastIoDeviceControl;
2526 PFAST_IO_ACQUIRE_FILE AcquireFileForNtCreateSection;
2527 PFAST_IO_RELEASE_FILE ReleaseFileForNtCreateSection;
2528 PFAST_IO_DETACH_DEVICE FastIoDetachDevice;
2529 PFAST_IO_QUERY_NETWORK_OPEN_INFO FastIoQueryNetworkOpenInfo;
2530 PFAST_IO_ACQUIRE_FOR_MOD_WRITE AcquireForModWrite;
2531 PFAST_IO_MDL_READ MdlRead;
2532 PFAST_IO_MDL_READ_COMPLETE MdlReadComplete;
2533 PFAST_IO_PREPARE_MDL_WRITE PrepareMdlWrite;
2534 PFAST_IO_MDL_WRITE_COMPLETE MdlWriteComplete;
2535 PFAST_IO_READ_COMPRESSED FastIoReadCompressed;
2536 PFAST_IO_WRITE_COMPRESSED FastIoWriteCompressed;
2537 PFAST_IO_MDL_READ_COMPLETE_COMPRESSED MdlReadCompleteCompressed;
2538 PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED MdlWriteCompleteCompressed;
2539 PFAST_IO_QUERY_OPEN FastIoQueryOpen;
2540 PFAST_IO_RELEASE_FOR_MOD_WRITE ReleaseForModWrite;
2541 PFAST_IO_ACQUIRE_FOR_CCFLUSH AcquireForCcFlush;
2542 PFAST_IO_RELEASE_FOR_CCFLUSH ReleaseForCcFlush;
2543} FAST_IO_DISPATCH, *PFAST_IO_DISPATCH;
2544
2545typedef
2546struct _DRIVER_OBJECT
2547{ CSHORT Type;
2548 CSHORT Size;
2549 PDEVICE_OBJECT DeviceObject;
2550 ULONG Flags;
2551 PVOID DriverStart;
2552 ULONG DriverSize;
2553 PVOID DriverSection;
2554 PDRIVER_EXTENSION DriverExtension;
2555 UNICODE_STRING DriverName;
2556 PUNICODE_STRING HardwareDatabase;
2557 PFAST_IO_DISPATCH FastIoDispatch;
2558 PDRIVER_INITIALIZE DriverInit;
2559 PDRIVER_STARTIO DriverStartIo;
2560 PDRIVER_UNLOAD DriverUnload;
2561 PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
2562} DRIVER_OBJECT, *PDRIVER_OBJECT;
2563
2564typedef
2565struct _SECTION_OBJECT_POINTERS
2566{ PVOID DataSectionObject;
2567 PVOID SharedCacheMap;
2568 PVOID ImageSectionObject;
2569} SECTION_OBJECT_POINTERS, *PSECTION_OBJECT_POINTERS;
2570
2571typedef
2572struct _IO_COMPLETION_CONTEXT
2573{ PVOID Port;
2574 PVOID Key;
2575} IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT;
2576
2577/* FILE_OBJECT.Flags
2578 */
2579#define FO_FILE_OPEN 0x00000001
2580#define FO_SYNCHRONOUS_IO 0x00000002
2581#define FO_ALERTABLE_IO 0x00000004
2582#define FO_NO_INTERMEDIATE_BUFFERING 0x00000008
2583#define FO_WRITE_THROUGH 0x00000010
2584#define FO_SEQUENTIAL_ONLY 0x00000020
2585#define FO_CACHE_SUPPORTED 0x00000040
2586#define FO_NAMED_PIPE 0x00000080
2587#define FO_STREAM_FILE 0x00000100
2588#define FO_MAILSLOT 0x00000200
2589#define FO_GENERATE_AUDIT_ON_CLOSE 0x00000400
2590#define FO_DIRECT_DEVICE_OPEN 0x00000800
2591#define FO_FILE_MODIFIED 0x00001000
2592#define FO_FILE_SIZE_CHANGED 0x00002000
2593#define FO_CLEANUP_COMPLETE 0x00004000
2594#define FO_TEMPORARY_FILE 0x00008000
2595#define FO_DELETE_ON_CLOSE 0x00010000
2596#define FO_OPENED_CASE_SENSITIVE 0x00020000
2597#define FO_HANDLE_CREATED 0x00040000
2598#define FO_FILE_FAST_IO_READ 0x00080000
2599#define FO_RANDOM_ACCESS 0x00100000
2600#define FO_FILE_OPEN_CANCELLED 0x00200000
2601#define FO_VOLUME_OPEN 0x00400000
2602#define FO_FILE_OBJECT_HAS_EXTENSION 0x00800000
2603#define FO_REMOTE_ORIGIN 0x01000000
2604
2605typedef
2606struct _FILE_OBJECT
2607{ CSHORT Type;
2608 CSHORT Size;
2609 PDEVICE_OBJECT DeviceObject;
2610 PVPB Vpb;
2611 PVOID FsContext;
2612 PVOID FsContext2;
2613 PSECTION_OBJECT_POINTERS SectionObjectPointer;
2614 PVOID PrivateCacheMap;
2615 NTSTATUS FinalStatus;
2616 struct _FILE_OBJECT *RelatedFileObject;
2617 BOOLEAN LockOperation;
2618 BOOLEAN DeletePending;
2619 BOOLEAN ReadAccess;
2620 BOOLEAN WriteAccess;
2621 BOOLEAN DeleteAccess;
2622 BOOLEAN SharedRead;
2623 BOOLEAN SharedWrite;
2624 BOOLEAN SharedDelete;
2625 ULONG Flags;
2626 UNICODE_STRING FileName;
2627 LARGE_INTEGER CurrentByteOffset;
2628 ULONG Waiters;
2629 ULONG Busy;
2630 PVOID LastLock;
2631 KEVENT Lock;
2632 KEVENT Event;
2633 PIO_COMPLETION_CONTEXT CompletionContext;
2634} FILE_OBJECT, *PFILE_OBJECT;
2635
2636typedef
2637enum _SECURITY_OPERATION_CODE
2638{ SetSecurityDescriptor,
2639 QuerySecurityDescriptor,
2640 DeleteSecurityDescriptor,
2641 AssignSecurityDescriptor
2642} SECURITY_OPERATION_CODE, *PSECURITY_OPERATION_CODE;
2643
2644#define INITIAL_PRIVILEGE_COUNT 3
2645
2646typedef
2647struct _INITIAL_PRIVILEGE_SET
2648{ ULONG PrivilegeCount;
2649 ULONG Control;
2650 LUID_AND_ATTRIBUTES Privilege[INITIAL_PRIVILEGE_COUNT];
2651} INITIAL_PRIVILEGE_SET, *PINITIAL_PRIVILEGE_SET;
2652
2653typedef
2654struct _SECURITY_SUBJECT_CONTEXT
2655{ PACCESS_TOKEN ClientToken;
2656 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
2657 PACCESS_TOKEN PrimaryToken;
2658 PVOID ProcessAuditId;
2659} SECURITY_SUBJECT_CONTEXT, *PSECURITY_SUBJECT_CONTEXT;
2660
2661#include <pshpack4.h>
2662typedef
2663struct _ACCESS_STATE
2664{ LUID OperationID;
2665 BOOLEAN SecurityEvaluated;
2666 BOOLEAN GenerateAudit;
2667 BOOLEAN GenerateOnClose;
2668 BOOLEAN PrivilegesAllocated;
2669 ULONG Flags;
2670 ACCESS_MASK RemainingDesiredAccess;
2671 ACCESS_MASK PreviouslyGrantedAccess;
2672 ACCESS_MASK OriginalDesiredAccess;
2673 SECURITY_SUBJECT_CONTEXT SubjectSecurityContext;
2674 PSECURITY_DESCRIPTOR SecurityDescriptor;
2675 PVOID AuxData;
2676 union
2677 { INITIAL_PRIVILEGE_SET InitialPrivilegeSet;
2678 PRIVILEGE_SET PrivilegeSet;
2679 } Privileges;
2680 BOOLEAN AuditPrivileges;
2681 UNICODE_STRING ObjectName;
2682 UNICODE_STRING ObjectTypeName;
2683} ACCESS_STATE, *PACCESS_STATE;
2684#include <poppack.h>
2685
2686typedef
2687struct _IO_SECURITY_CONTEXT
2688{ PSECURITY_QUALITY_OF_SERVICE SecurityQos;
2689 PACCESS_STATE AccessState;
2690 ACCESS_MASK DesiredAccess;
2691 ULONG FullCreateOptions;
2692} IO_SECURITY_CONTEXT, *PIO_SECURITY_CONTEXT;
2693
2694struct _IO_CSQ;
2695
2696typedef
2697struct _IO_CSQ_IRP_CONTEXT
2698{ ULONG Type;
2699 struct _IRP *Irp;
2700 struct _IO_CSQ *Csq;
2701} IO_CSQ_IRP_CONTEXT, *PIO_CSQ_IRP_CONTEXT;
2702
2703typedef VOID DDKAPI
2704(*PIO_CSQ_INSERT_IRP)(
2705 /*IN*/ struct _IO_CSQ *Csq,
2706 /*IN*/ PIRP Irp);
2707
2708typedef VOID DDKAPI
2709(*PIO_CSQ_REMOVE_IRP)(
2710 /*IN*/ struct _IO_CSQ *Csq,
2711 /*IN*/ PIRP Irp);
2712
2713typedef PIRP DDKAPI
2714(*PIO_CSQ_PEEK_NEXT_IRP)(
2715 /*IN*/ struct _IO_CSQ *Csq,
2716 /*IN*/ PIRP Irp,
2717 /*IN*/ PVOID PeekContext);
2718
2719typedef VOID DDKAPI
2720(*PIO_CSQ_ACQUIRE_LOCK)(
2721 /*IN*/ struct _IO_CSQ *Csq,
2722 /*OUT*/ PKIRQL Irql);
2723
2724typedef VOID DDKAPI
2725(*PIO_CSQ_RELEASE_LOCK)(
2726 /*IN*/ struct _IO_CSQ *Csq,
2727 /*IN*/ KIRQL Irql);
2728
2729typedef VOID DDKAPI
2730(*PIO_CSQ_COMPLETE_CANCELED_IRP)(
2731 /*IN*/ struct _IO_CSQ *Csq,
2732 /*IN*/ PIRP Irp);
2733
2734typedef
2735struct _IO_CSQ
2736{ ULONG Type;
2737 PIO_CSQ_INSERT_IRP CsqInsertIrp;
2738 PIO_CSQ_REMOVE_IRP CsqRemoveIrp;
2739 PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp;
2740 PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock;
2741 PIO_CSQ_RELEASE_LOCK CsqReleaseLock;
2742 PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp;
2743 PVOID ReservePointer;
2744} IO_CSQ, *PIO_CSQ;
2745
2746#include <pshpack4.h>
2747typedef
2748struct _IO_STACK_LOCATION
2749{ UCHAR MajorFunction;
2750 UCHAR MinorFunction;
2751 UCHAR Flags;
2752 UCHAR Control;
2753 union
2754 { struct
2755 { PIO_SECURITY_CONTEXT SecurityContext;
2756 ULONG Options;
2757 USHORT POINTER_ALIGNMENT FileAttributes;
2758 USHORT ShareAccess;
2759 ULONG POINTER_ALIGNMENT EaLength;
2760 } Create;
2761 struct
2762 { ULONG Length;
2763 ULONG POINTER_ALIGNMENT Key;
2764 LARGE_INTEGER ByteOffset;
2765 } Read;
2766 struct
2767 { ULONG Length;
2768 ULONG POINTER_ALIGNMENT Key;
2769 LARGE_INTEGER ByteOffset;
2770 } Write;
2771 struct
2772 { ULONG Length;
2773 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass;
2774 } QueryFile;
2775 struct
2776 { ULONG Length;
2777 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass;
2778 PFILE_OBJECT FileObject;
2779 _ANONYMOUS_UNION union
2780 { _ANONYMOUS_STRUCT struct
2781 { BOOLEAN ReplaceIfExists;
2782 BOOLEAN AdvanceOnly;
2783 } DUMMYSTRUCTNAME;
2784 ULONG ClusterCount;
2785 HANDLE DeleteHandle;
2786 } DUMMYUNIONNAME;
2787 } SetFile;
2788 struct
2789 { ULONG Length;
2790 FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass;
2791 } QueryVolume;
2792 struct
2793 { ULONG OutputBufferLength;
2794 ULONG POINTER_ALIGNMENT InputBufferLength;
2795 ULONG POINTER_ALIGNMENT IoControlCode;
2796 PVOID Type3InputBuffer;
2797 } DeviceIoControl;
2798 struct
2799 { SECURITY_INFORMATION SecurityInformation;
2800 ULONG POINTER_ALIGNMENT Length;
2801 } QuerySecurity;
2802 struct
2803 { SECURITY_INFORMATION SecurityInformation;
2804 PSECURITY_DESCRIPTOR SecurityDescriptor;
2805 } SetSecurity;
2806 struct
2807 { PVPB Vpb;
2808 PDEVICE_OBJECT DeviceObject;
2809 } MountVolume;
2810 struct
2811 { PVPB Vpb;
2812 PDEVICE_OBJECT DeviceObject;
2813 } VerifyVolume;
2814 struct
2815 { struct _SCSI_REQUEST_BLOCK *Srb;
2816 } Scsi;
2817 struct
2818 { DEVICE_RELATION_TYPE Type;
2819 } QueryDeviceRelations;
2820 struct
2821 { CONST GUID *InterfaceType;
2822 USHORT Size;
2823 USHORT Version;
2824 PINTERFACE Interface;
2825 PVOID InterfaceSpecificData;
2826 } QueryInterface;
2827 struct
2828 { PDEVICE_CAPABILITIES Capabilities;
2829 } DeviceCapabilities;
2830 struct
2831 { PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList;
2832 } FilterResourceRequirements;
2833 struct
2834 { ULONG WhichSpace;
2835 PVOID Buffer;
2836 ULONG Offset;
2837 ULONG POINTER_ALIGNMENT Length;
2838 } ReadWriteConfig;
2839 struct
2840 { BOOLEAN Lock;
2841 } SetLock;
2842 struct
2843 { BUS_QUERY_ID_TYPE IdType;
2844 } QueryId;
2845 struct
2846 { DEVICE_TEXT_TYPE DeviceTextType;
2847 LCID POINTER_ALIGNMENT LocaleId;
2848 } QueryDeviceText;
2849 struct
2850 { BOOLEAN InPath;
2851 BOOLEAN Reserved[3];
2852 DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT Type;
2853 } UsageNotification;
2854 struct
2855 { SYSTEM_POWER_STATE PowerState;
2856 } WaitWake;
2857 struct
2858 { PPOWER_SEQUENCE PowerSequence;
2859 } PowerSequence;
2860 struct
2861 { ULONG SystemContext;
2862 POWER_STATE_TYPE POINTER_ALIGNMENT Type;
2863 POWER_STATE POINTER_ALIGNMENT State;
2864 POWER_ACTION POINTER_ALIGNMENT ShutdownType;
2865 } Power;
2866 struct
2867 { PCM_RESOURCE_LIST AllocatedResources;
2868 PCM_RESOURCE_LIST AllocatedResourcesTranslated;
2869 } StartDevice;
2870 struct
2871 { ULONG_PTR ProviderId;
2872 PVOID DataPath;
2873 ULONG BufferSize;
2874 PVOID Buffer;
2875 } WMI;
2876 struct
2877 { PVOID Argument1;
2878 PVOID Argument2;
2879 PVOID Argument3;
2880 PVOID Argument4;
2881 } Others;
2882 } Parameters;
2883 PDEVICE_OBJECT DeviceObject;
2884 PFILE_OBJECT FileObject;
2885 PIO_COMPLETION_ROUTINE CompletionRoutine;
2886 PVOID Context;
2887} IO_STACK_LOCATION, *PIO_STACK_LOCATION;
2888#include <poppack.h>
2889
2890/* IO_STACK_LOCATION.Control
2891 */
2892#define SL_PENDING_RETURNED 0x01
2893#define SL_INVOKE_ON_CANCEL 0x20
2894#define SL_INVOKE_ON_SUCCESS 0x40
2895#define SL_INVOKE_ON_ERROR 0x80
2896
2897typedef
2898enum _KEY_INFORMATION_CLASS
2899{ KeyBasicInformation,
2900 KeyNodeInformation,
2901 KeyFullInformation,
2902 KeyNameInformation,
2903 KeyCachedInformation,
2904 KeyFlagsInformation
2905} KEY_INFORMATION_CLASS;
2906
2907typedef
2908struct _KEY_BASIC_INFORMATION
2909{ LARGE_INTEGER LastWriteTime;
2910 ULONG TitleIndex;
2911 ULONG NameLength;
2912 WCHAR Name[1];
2913} KEY_BASIC_INFORMATION, *PKEY_BASIC_INFORMATION;
2914
2915typedef
2916struct _KEY_FULL_INFORMATION
2917{ LARGE_INTEGER LastWriteTime;
2918 ULONG TitleIndex;
2919 ULONG ClassOffset;
2920 ULONG ClassLength;
2921 ULONG SubKeys;
2922 ULONG MaxNameLen;
2923 ULONG MaxClassLen;
2924 ULONG Values;
2925 ULONG MaxValueNameLen;
2926 ULONG MaxValueDataLen;
2927 WCHAR Class[1];
2928} KEY_FULL_INFORMATION, *PKEY_FULL_INFORMATION;
2929
2930typedef
2931struct _KEY_NODE_INFORMATION
2932{ LARGE_INTEGER LastWriteTime;
2933 ULONG TitleIndex;
2934 ULONG ClassOffset;
2935 ULONG ClassLength;
2936 ULONG NameLength;
2937 WCHAR Name[1];
2938} KEY_NODE_INFORMATION, *PKEY_NODE_INFORMATION;
2939
2940typedef
2941struct _KEY_VALUE_BASIC_INFORMATION
2942{ ULONG TitleIndex;
2943 ULONG Type;
2944 ULONG NameLength;
2945 WCHAR Name[1];
2946} KEY_VALUE_BASIC_INFORMATION, *PKEY_VALUE_BASIC_INFORMATION;
2947
2948typedef
2949struct _KEY_VALUE_FULL_INFORMATION
2950{ ULONG TitleIndex;
2951 ULONG Type;
2952 ULONG DataOffset;
2953 ULONG DataLength;
2954 ULONG NameLength;
2955 WCHAR Name[1];
2956} KEY_VALUE_FULL_INFORMATION, *PKEY_VALUE_FULL_INFORMATION;
2957
2958typedef
2959struct _KEY_VALUE_PARTIAL_INFORMATION
2960{ ULONG TitleIndex;
2961 ULONG Type;
2962 ULONG DataLength;
2963 UCHAR Data[1];
2964} KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
2965
2966typedef
2967struct _KEY_VALUE_PARTIAL_INFORMATION_ALIGN64
2968{ ULONG Type;
2969 ULONG DataLength;
2970 UCHAR Data[1];
2971} KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, *PKEY_VALUE_PARTIAL_INFORMATION_ALIGN64;
2972
2973typedef
2974struct _KEY_VALUE_ENTRY
2975{ PUNICODE_STRING ValueName;
2976 ULONG DataLength;
2977 ULONG DataOffset;
2978 ULONG Type;
2979} KEY_VALUE_ENTRY, *PKEY_VALUE_ENTRY;
2980
2981typedef
2982enum _KEY_VALUE_INFORMATION_CLASS
2983{ KeyValueBasicInformation,
2984 KeyValueFullInformation,
2985 KeyValuePartialInformation,
2986 KeyValueFullInformationAlign64,
2987 KeyValuePartialInformationAlign64
2988} KEY_VALUE_INFORMATION_CLASS;
2989
2990/* KEY_VALUE_Xxx.Type
2991 */
2992#define REG_NONE 0
2993#define REG_SZ 1
2994#define REG_EXPAND_SZ 2
2995#define REG_BINARY 3
2996#define REG_DWORD 4
2997#define REG_DWORD_LITTLE_ENDIAN 4
2998#define REG_DWORD_BIG_ENDIAN 5
2999#define REG_LINK 6
3000#define REG_MULTI_SZ 7
3001#define REG_RESOURCE_LIST 8
3002#define REG_FULL_RESOURCE_DESCRIPTOR 9
3003#define REG_RESOURCE_REQUIREMENTS_LIST 10
3004#define REG_QWORD 11
3005#define REG_QWORD_LITTLE_ENDIAN 11
3006
3007#define PCI_TYPE0_ADDRESSES 6
3008#define PCI_TYPE1_ADDRESSES 2
3009#define PCI_TYPE2_ADDRESSES 5
3010
3011typedef
3012struct _PCI_COMMON_CONFIG
3013{ USHORT VendorID;
3014 USHORT DeviceID;
3015 USHORT Command;
3016 USHORT Status;
3017 UCHAR RevisionID;
3018 UCHAR ProgIf;
3019 UCHAR SubClass;
3020 UCHAR BaseClass;
3021 UCHAR CacheLineSize;
3022 UCHAR LatencyTimer;
3023 UCHAR HeaderType;
3024 UCHAR BIST;
3025 union
3026 { struct _PCI_HEADER_TYPE_0
3027 { ULONG BaseAddresses[PCI_TYPE0_ADDRESSES];
3028 ULONG CIS;
3029 USHORT SubVendorID;
3030 USHORT SubSystemID;
3031 ULONG ROMBaseAddress;
3032 UCHAR CapabilitiesPtr;
3033 UCHAR Reserved1[3];
3034 ULONG Reserved2;
3035 UCHAR InterruptLine;
3036 UCHAR InterruptPin;
3037 UCHAR MinimumGrant;
3038 UCHAR MaximumLatency;
3039 } type0;
3040 struct _PCI_HEADER_TYPE_1
3041 { ULONG BaseAddresses[PCI_TYPE1_ADDRESSES];
3042 UCHAR PrimaryBus;
3043 UCHAR SecondaryBus;
3044 UCHAR SubordinateBus;
3045 UCHAR SecondaryLatency;
3046 UCHAR IOBase;
3047 UCHAR IOLimit;
3048 USHORT SecondaryStatus;
3049 USHORT MemoryBase;
3050 USHORT MemoryLimit;
3051 USHORT PrefetchBase;
3052 USHORT PrefetchLimit;
3053 ULONG PrefetchBaseUpper32;
3054 ULONG PrefetchLimitUpper32;
3055 USHORT IOBaseUpper16;
3056 USHORT IOLimitUpper16;
3057 UCHAR CapabilitiesPtr;
3058 UCHAR Reserved1[3];
3059 ULONG ROMBaseAddress;
3060 UCHAR InterruptLine;
3061 UCHAR InterruptPin;
3062 USHORT BridgeControl;
3063 } type1;
3064 struct _PCI_HEADER_TYPE_2
3065 { ULONG SocketRegistersBaseAddress;
3066 UCHAR CapabilitiesPtr;
3067 UCHAR Reserved;
3068 USHORT SecondaryStatus;
3069 UCHAR PrimaryBus;
3070 UCHAR SecondaryBus;
3071 UCHAR SubordinateBus;
3072 UCHAR SecondaryLatency;
3073 struct
3074 { ULONG Base;
3075 ULONG Limit;
3076 } Range[PCI_TYPE2_ADDRESSES - 1];
3077 UCHAR InterruptLine;
3078 UCHAR InterruptPin;
3079 USHORT BridgeControl;
3080 } type2;
3081 } u;
3082 UCHAR DeviceSpecific[192];
3083} PCI_COMMON_CONFIG, *PPCI_COMMON_CONFIG;
3084
3085/* PCI_COMMON_CONFIG.Command
3086 */
3087#define PCI_ENABLE_IO_SPACE 0x0001
3088#define PCI_ENABLE_MEMORY_SPACE 0x0002
3089#define PCI_ENABLE_BUS_MASTER 0x0004
3090#define PCI_ENABLE_SPECIAL_CYCLES 0x0008
3091#define PCI_ENABLE_WRITE_AND_INVALIDATE 0x0010
3092#define PCI_ENABLE_VGA_COMPATIBLE_PALETTE 0x0020
3093#define PCI_ENABLE_PARITY 0x0040
3094#define PCI_ENABLE_WAIT_CYCLE 0x0080
3095#define PCI_ENABLE_SERR 0x0100
3096#define PCI_ENABLE_FAST_BACK_TO_BACK 0x0200
3097
3098/* PCI_COMMON_CONFIG.Status
3099 */
3100#define PCI_STATUS_CAPABILITIES_LIST 0x0010
3101#define PCI_STATUS_66MHZ_CAPABLE 0x0020
3102#define PCI_STATUS_UDF_SUPPORTED 0x0040
3103#define PCI_STATUS_FAST_BACK_TO_BACK 0x0080
3104#define PCI_STATUS_DATA_PARITY_DETECTED 0x0100
3105#define PCI_STATUS_DEVSEL 0x0600
3106#define PCI_STATUS_SIGNALED_TARGET_ABORT 0x0800
3107#define PCI_STATUS_RECEIVED_TARGET_ABORT 0x1000
3108#define PCI_STATUS_RECEIVED_MASTER_ABORT 0x2000
3109#define PCI_STATUS_SIGNALED_SYSTEM_ERROR 0x4000
3110#define PCI_STATUS_DETECTED_PARITY_ERROR 0x8000
3111
3112/* PCI_COMMON_CONFIG.HeaderType
3113 */
3114#define PCI_MULTIFUNCTION 0x80
3115#define PCI_DEVICE_TYPE 0x00
3116#define PCI_BRIDGE_TYPE 0x01
3117#define PCI_CARDBUS_BRIDGE_TYPE 0x02
3118
3119#define PCI_CONFIGURATION_TYPE(PciData) \
3120 (((PPCI_COMMON_CONFIG) (PciData))->HeaderType & ~PCI_MULTIFUNCTION)
3121
3122#define PCI_MULTIFUNCTION_DEVICE(PciData) \
3123 ((((PPCI_COMMON_CONFIG) (PciData))->HeaderType & PCI_MULTIFUNCTION) != 0)
3124
3125typedef
3126struct _PCI_SLOT_NUMBER
3127{ union
3128 { struct
3129 { ULONG DeviceNumber : 5;
3130 ULONG FunctionNumber : 3;
3131 ULONG Reserved : 24;
3132 } bits;
3133 ULONG AsULONG;
3134 } u;
3135} PCI_SLOT_NUMBER, *PPCI_SLOT_NUMBER;
3136
3137typedef
3138enum _POOL_TYPE
3139{ NonPagedPool,
3140 PagedPool,
3141 NonPagedPoolMustSucceed,
3142 DontUseThisType,
3143 NonPagedPoolCacheAligned,
3144 PagedPoolCacheAligned,
3145 NonPagedPoolCacheAlignedMustS,
3146 MaxPoolType,
3147 NonPagedPoolSession = 32,
3148 PagedPoolSession,
3149 NonPagedPoolMustSucceedSession,
3150 DontUseThisTypeSession,
3151 NonPagedPoolCacheAlignedSession,
3152 PagedPoolCacheAlignedSession,
3153 NonPagedPoolCacheAlignedMustSSession
3154} POOL_TYPE;
3155
3156typedef
3157enum _EX_POOL_PRIORITY
3158{ LowPoolPriority = 0,
3159 LowPoolPrioritySpecialPoolOverrun = 8,
3160 LowPoolPrioritySpecialPoolUnderrun = 9,
3161 NormalPoolPriority = 16,
3162 NormalPoolPrioritySpecialPoolOverrun = 24,
3163 NormalPoolPrioritySpecialPoolUnderrun = 25,
3164 HighPoolPriority = 32,
3165 HighPoolPrioritySpecialPoolOverrun = 40,
3166 HighPoolPrioritySpecialPoolUnderrun = 41
3167} EX_POOL_PRIORITY;
3168
3169/* PRIVILEGE_SET.Control
3170 */
3171#define PRIVILEGE_SET_ALL_NECESSARY 1
3172
3173typedef
3174struct _RTL_OSVERSIONINFOW
3175{ ULONG dwOSVersionInfoSize;
3176 ULONG dwMajorVersion;
3177 ULONG dwMinorVersion;
3178 ULONG dwBuildNumber;
3179 ULONG dwPlatformId;
3180 WCHAR szCSDVersion[128];
3181} RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW;
3182
3183typedef
3184struct _RTL_OSVERSIONINFOEXW
3185{ ULONG dwOSVersionInfoSize;
3186 ULONG dwMajorVersion;
3187 ULONG dwMinorVersion;
3188 ULONG dwBuildNumber;
3189 ULONG dwPlatformId;
3190 WCHAR szCSDVersion[128];
3191 USHORT wServicePackMajor;
3192 USHORT wServicePackMinor;
3193 USHORT wSuiteMask;
3194 UCHAR wProductType;
3195 UCHAR wReserved;
3196} RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW;
3197
3198NTOSAPI ULONGLONG DDKAPI
3199VerSetConditionMask(
3200 /*IN*/ ULONGLONG ConditionMask,
3201 /*IN*/ ULONG TypeMask,
3202 /*IN*/ UCHAR Condition
3203);
3204
3205#define VER_SET_CONDITION(ConditionMask, TypeBitMask, ComparisonType) \
3206 ((ConditionMask) = VerSetConditionMask((ConditionMask), \
3207 (TypeBitMask), (ComparisonType)))
3208
3209/* RtlVerifyVersionInfo() TypeMask
3210 */
3211#define VER_MINORVERSION 0x0000001
3212#define VER_MAJORVERSION 0x0000002
3213#define VER_BUILDNUMBER 0x0000004
3214#define VER_PLATFORMID 0x0000008
3215#define VER_SERVICEPACKMINOR 0x0000010
3216#define VER_SERVICEPACKMAJOR 0x0000020
3217#define VER_SUITENAME 0x0000040
3218#define VER_PRODUCT_TYPE 0x0000080
3219
3220/* RtlVerifyVersionInfo() ComparisonType
3221 */
3222#define VER_EQUAL 1
3223#define VER_GREATER 2
3224#define VER_GREATER_EQUAL 3
3225#define VER_LESS 4
3226#define VER_LESS_EQUAL 5
3227#define VER_AND 6
3228#define VER_OR 7
3229
3230#define VER_CONDITION_MASK 7
3231#define VER_NUM_BITS_PER_CONDITION_MASK 3
3232
3233typedef
3234struct _RTL_BITMAP
3235{ ULONG SizeOfBitMap;
3236 PULONG Buffer;
3237} RTL_BITMAP, *PRTL_BITMAP;
3238
3239typedef
3240struct _RTL_BITMAP_RUN
3241{ ULONG StartingIndex;
3242 ULONG NumberOfBits;
3243} RTL_BITMAP_RUN, *PRTL_BITMAP_RUN;
3244
3245typedef NTSTATUS DDKAPI
3246(*PRTL_QUERY_REGISTRY_ROUTINE)(
3247 /*IN*/ PWSTR ValueName,
3248 /*IN*/ ULONG ValueType,
3249 /*IN*/ PVOID ValueData,
3250 /*IN*/ ULONG ValueLength,
3251 /*IN*/ PVOID Context,
3252 /*IN*/ PVOID EntryContext);
3253
3254#define RTL_REGISTRY_ABSOLUTE 0
3255#define RTL_REGISTRY_SERVICES 1
3256#define RTL_REGISTRY_CONTROL 2
3257#define RTL_REGISTRY_WINDOWS_NT 3
3258#define RTL_REGISTRY_DEVICEMAP 4
3259#define RTL_REGISTRY_USER 5
3260
3261/* RTL_QUERY_REGISTRY_TABLE.Flags */
3262#define RTL_QUERY_REGISTRY_SUBKEY 0x00000001
3263#define RTL_QUERY_REGISTRY_TOPKEY 0x00000002
3264#define RTL_QUERY_REGISTRY_REQUIRED 0x00000004
3265#define RTL_QUERY_REGISTRY_NOVALUE 0x00000008
3266#define RTL_QUERY_REGISTRY_NOEXPAND 0x00000010
3267#define RTL_QUERY_REGISTRY_DIRECT 0x00000020
3268#define RTL_QUERY_REGISTRY_DELETE 0x00000040
3269
3270typedef
3271struct _RTL_QUERY_REGISTRY_TABLE
3272{ PRTL_QUERY_REGISTRY_ROUTINE QueryRoutine;
3273 ULONG Flags;
3274 PWSTR Name;
3275 PVOID EntryContext;
3276 ULONG DefaultType;
3277 PVOID DefaultData;
3278 ULONG DefaultLength;
3279} RTL_QUERY_REGISTRY_TABLE, *PRTL_QUERY_REGISTRY_TABLE;
3280
3281typedef
3282struct _TIME_FIELDS
3283{ CSHORT Year;
3284 CSHORT Month;
3285 CSHORT Day;
3286 CSHORT Hour;
3287 CSHORT Minute;
3288 CSHORT Second;
3289 CSHORT Milliseconds;
3290 CSHORT Weekday;
3291} TIME_FIELDS, *PTIME_FIELDS;
3292
3293typedef PVOID DDKAPI
3294(*PALLOCATE_FUNCTION)(
3295 /*IN*/ POOL_TYPE PoolType,
3296 /*IN*/ SIZE_T NumberOfBytes,
3297 /*IN*/ ULONG Tag
3298);
3299
3300typedef VOID DDKAPI
3301(*PFREE_FUNCTION)( /*IN*/ PVOID Buffer );
3302
3303#define GENERAL_LOOKASIDE_S \
3304 SLIST_HEADER ListHead; \
3305 USHORT Depth; \
3306 USHORT MaximumDepth; \
3307 ULONG TotalAllocates; \
3308 _ANONYMOUS_UNION union { \
3309 ULONG AllocateMisses; \
3310 ULONG AllocateHits; \
3311 } DUMMYUNIONNAME; \
3312 ULONG TotalFrees; \
3313 _ANONYMOUS_UNION union { \
3314 ULONG FreeMisses; \
3315 ULONG FreeHits; \
3316 } DUMMYUNIONNAME2; \
3317 POOL_TYPE Type; \
3318 ULONG Tag; \
3319 ULONG Size; \
3320 PALLOCATE_FUNCTION Allocate; \
3321 PFREE_FUNCTION Free; \
3322 LIST_ENTRY ListEntry; \
3323 ULONG LastTotalAllocates; \
3324 _ANONYMOUS_UNION union { \
3325 ULONG LastAllocateMisses; \
3326 ULONG LastAllocateHits; \
3327 } DUMMYUNIONNAME3; \
3328 ULONG Future[2];
3329
3330typedef
3331struct _GENERAL_LOOKASIDE
3332{ GENERAL_LOOKASIDE_S
3333} GENERAL_LOOKASIDE, *PGENERAL_LOOKASIDE;
3334
3335typedef
3336struct _NPAGED_LOOKASIDE_LIST
3337{ GENERAL_LOOKASIDE_S
3338 KSPIN_LOCK Obsoleted;
3339} NPAGED_LOOKASIDE_LIST, *PNPAGED_LOOKASIDE_LIST;
3340
3341typedef
3342struct _PAGED_LOOKASIDE_LIST
3343{ GENERAL_LOOKASIDE_S
3344 FAST_MUTEX Obsoleted;
3345} PAGED_LOOKASIDE_LIST, *PPAGED_LOOKASIDE_LIST;
3346
3347typedef struct _CALLBACK_OBJECT *PCALLBACK_OBJECT;
3348
3349typedef VOID DDKAPI
3350(*PCALLBACK_FUNCTION)(
3351 /*IN*/ PVOID CallbackContext,
3352 /*IN*/ PVOID Argument1,
3353 /*IN*/ PVOID Argument2
3354);
3355
3356typedef
3357enum _EVENT_TYPE
3358{ NotificationEvent,
3359 SynchronizationEvent
3360} EVENT_TYPE;
3361
3362typedef
3363enum _KWAIT_REASON
3364{ Executive,
3365 FreePage,
3366 PageIn,
3367 PoolAllocation,
3368 DelayExecution,
3369 Suspended,
3370 UserRequest,
3371 WrExecutive,
3372 WrFreePage,
3373 WrPageIn,
3374 WrPoolAllocation,
3375 WrDelayExecution,
3376 WrSuspended,
3377 WrUserRequest,
3378 WrEventPair,
3379 WrQueue,
3380 WrLpcReceive,
3381 WrLpcReply,
3382 WrVirtualMemory,
3383 WrPageOut,
3384 WrRendezvous,
3385 Spare2,
3386 Spare3,
3387 Spare4,
3388 Spare5,
3389 Spare6,
3390 WrKernel,
3391 MaximumWaitReason
3392} KWAIT_REASON;
3393
3394typedef
3395struct _KWAIT_BLOCK
3396{ LIST_ENTRY WaitListEntry;
3397 struct _KTHREAD * RESTRICTED_POINTER Thread;
3398 PVOID Object;
3399 struct _KWAIT_BLOCK * RESTRICTED_POINTER NextWaitBlock;
3400 USHORT WaitKey;
3401 USHORT WaitType;
3402} KWAIT_BLOCK, *PKWAIT_BLOCK, *RESTRICTED_POINTER PRKWAIT_BLOCK;
3403
3404typedef struct _IO_REMOVE_LOCK_TRACKING_BLOCK * PIO_REMOVE_LOCK_TRACKING_BLOCK;
3405
3406typedef
3407struct _IO_REMOVE_LOCK_COMMON_BLOCK
3408{ BOOLEAN Removed;
3409 BOOLEAN Reserved[3];
3410 LONG IoCount;
3411 KEVENT RemoveEvent;
3412} IO_REMOVE_LOCK_COMMON_BLOCK;
3413
3414typedef
3415struct _IO_REMOVE_LOCK_DBG_BLOCK
3416{ LONG Signature;
3417 LONG HighWatermark;
3418 LONGLONG MaxLockedTicks;
3419 LONG AllocateTag;
3420 LIST_ENTRY LockList;
3421 KSPIN_LOCK Spin;
3422 LONG LowMemoryCount;
3423 ULONG Reserved1[4];
3424 PVOID Reserved2;
3425 PIO_REMOVE_LOCK_TRACKING_BLOCK Blocks;
3426} IO_REMOVE_LOCK_DBG_BLOCK;
3427
3428typedef
3429struct _IO_REMOVE_LOCK
3430{ IO_REMOVE_LOCK_COMMON_BLOCK Common;
3431#ifdef DBG
3432 IO_REMOVE_LOCK_DBG_BLOCK Dbg;
3433#endif
3434} IO_REMOVE_LOCK, *PIO_REMOVE_LOCK;
3435
3436typedef struct _IO_WORKITEM *PIO_WORKITEM;
3437
3438typedef VOID DDKAPI
3439(*PIO_WORKITEM_ROUTINE)(
3440 /*IN*/ PDEVICE_OBJECT DeviceObject,
3441 /*IN*/ PVOID Context);
3442
3443typedef
3444struct _SHARE_ACCESS
3445{ ULONG OpenCount;
3446 ULONG Readers;
3447 ULONG Writers;
3448 ULONG Deleters;
3449 ULONG SharedRead;
3450 ULONG SharedWrite;
3451 ULONG SharedDelete;
3452} SHARE_ACCESS, *PSHARE_ACCESS;
3453
3454typedef
3455enum _KINTERRUPT_MODE
3456{ LevelSensitive,
3457 Latched
3458} KINTERRUPT_MODE;
3459
3460typedef VOID DDKAPI
3461(*PKINTERRUPT_ROUTINE)( VOID );
3462
3463typedef
3464enum _KPROFILE_SOURCE
3465{ ProfileTime,
3466 ProfileAlignmentFixup,
3467 ProfileTotalIssues,
3468 ProfilePipelineDry,
3469 ProfileLoadInstructions,
3470 ProfilePipelineFrozen,
3471 ProfileBranchInstructions,
3472 ProfileTotalNonissues,
3473 ProfileDcacheMisses,
3474 ProfileIcacheMisses,
3475 ProfileCacheMisses,
3476 ProfileBranchMispredictions,
3477 ProfileStoreInstructions,
3478 ProfileFpInstructions,
3479 ProfileIntegerInstructions,
3480 Profile2Issue,
3481 Profile3Issue,
3482 Profile4Issue,
3483 ProfileSpecialInstructions,
3484 ProfileTotalCycles,
3485 ProfileIcacheIssues,
3486 ProfileDcacheAccesses,
3487 ProfileMemoryBarrierCycles,
3488 ProfileLoadLinkedIssues,
3489 ProfileMaximum
3490} KPROFILE_SOURCE;
3491
3492typedef
3493enum _CREATE_FILE_TYPE
3494{ CreateFileTypeNone,
3495 CreateFileTypeNamedPipe,
3496 CreateFileTypeMailslot
3497} CREATE_FILE_TYPE;
3498
3499typedef
3500struct _CONFIGURATION_INFORMATION
3501{ ULONG DiskCount;
3502 ULONG FloppyCount;
3503 ULONG CdRomCount;
3504 ULONG TapeCount;
3505 ULONG ScsiPortCount;
3506 ULONG SerialCount;
3507 ULONG ParallelCount;
3508 BOOLEAN AtDiskPrimaryAddressClaimed;
3509 BOOLEAN AtDiskSecondaryAddressClaimed;
3510 ULONG Version;
3511 ULONG MediumChangerCount;
3512} CONFIGURATION_INFORMATION, *PCONFIGURATION_INFORMATION;
3513
3514typedef
3515enum _CONFIGURATION_TYPE
3516{ ArcSystem,
3517 CentralProcessor,
3518 FloatingPointProcessor,
3519 PrimaryIcache,
3520 PrimaryDcache,
3521 SecondaryIcache,
3522 SecondaryDcache,
3523 SecondaryCache,
3524 EisaAdapter,
3525 TcAdapter,
3526 ScsiAdapter,
3527 DtiAdapter,
3528 MultiFunctionAdapter,
3529 DiskController,
3530 TapeController,
3531 CdromController,
3532 WormController,
3533 SerialController,
3534 NetworkController,
3535 DisplayController,
3536 ParallelController,
3537 PointerController,
3538 KeyboardController,
3539 AudioController,
3540 OtherController,
3541 DiskPeripheral,
3542 FloppyDiskPeripheral,
3543 TapePeripheral,
3544 ModemPeripheral,
3545 MonitorPeripheral,
3546 PrinterPeripheral,
3547 PointerPeripheral,
3548 KeyboardPeripheral,
3549 TerminalPeripheral,
3550 OtherPeripheral,
3551 LinePeripheral,
3552 NetworkPeripheral,
3553 SystemMemory,
3554 DockingInformation,
3555 RealModeIrqRoutingTable,
3556 MaximumType
3557} CONFIGURATION_TYPE, *PCONFIGURATION_TYPE;
3558
3559typedef NTSTATUS
3560(*PIO_QUERY_DEVICE_ROUTINE)(
3561 /*IN*/ PVOID Context,
3562 /*IN*/ PUNICODE_STRING PathName,
3563 /*IN*/ INTERFACE_TYPE BusType,
3564 /*IN*/ ULONG BusNumber,
3565 /*IN*/ PKEY_VALUE_FULL_INFORMATION *BusInformation,
3566 /*IN*/ CONFIGURATION_TYPE ControllerType,
3567 /*IN*/ ULONG ControllerNumber,
3568 /*IN*/ PKEY_VALUE_FULL_INFORMATION *ControllerInformation,
3569 /*IN*/ CONFIGURATION_TYPE PeripheralType,
3570 /*IN*/ ULONG PeripheralNumber,
3571 /*IN*/ PKEY_VALUE_FULL_INFORMATION *PeripheralInformation
3572);
3573
3574typedef
3575enum _WORK_QUEUE_TYPE
3576{ CriticalWorkQueue,
3577 DelayedWorkQueue,
3578 HyperCriticalWorkQueue,
3579 MaximumWorkQueue
3580} WORK_QUEUE_TYPE;
3581
3582typedef VOID DDKAPI
3583(*PWORKER_THREAD_ROUTINE)(
3584 /*IN*/ PVOID Parameter);
3585
3586typedef
3587struct _WORK_QUEUE_ITEM
3588{ LIST_ENTRY List;
3589 PWORKER_THREAD_ROUTINE WorkerRoutine;
3590 PVOID Parameter;
3591} WORK_QUEUE_ITEM, *PWORK_QUEUE_ITEM;
3592
3593typedef
3594enum _KBUGCHECK_BUFFER_DUMP_STATE
3595{ BufferEmpty,
3596 BufferInserted,
3597 BufferStarted,
3598 BufferFinished,
3599 BufferIncomplete
3600} KBUGCHECK_BUFFER_DUMP_STATE;
3601
3602typedef VOID DDKAPI
3603(*PKBUGCHECK_CALLBACK_ROUTINE)(
3604 /*IN*/ PVOID Buffer,
3605 /*IN*/ ULONG Length);
3606
3607typedef
3608struct _KBUGCHECK_CALLBACK_RECORD
3609{ LIST_ENTRY Entry;
3610 PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine;
3611 PVOID Buffer;
3612 ULONG Length;
3613 PUCHAR Component;
3614 ULONG_PTR Checksum;
3615 UCHAR State;
3616} KBUGCHECK_CALLBACK_RECORD, *PKBUGCHECK_CALLBACK_RECORD;
3617
3618/* VOID
3619 * KeInitializeCallbackRecord(
3620 * IN PKBUGCHECK_CALLBACK_RECORD CallbackRecord)
3621 */
3622#define KeInitializeCallbackRecord(CallbackRecord) \
3623 CallbackRecord->State = BufferEmpty;
3624
3625typedef
3626enum _KDPC_IMPORTANCE
3627{ LowImportance,
3628 MediumImportance,
3629 HighImportance
3630} KDPC_IMPORTANCE;
3631
3632typedef
3633enum _MEMORY_CACHING_TYPE_ORIG
3634{ MmFrameBufferCached = 2
3635} MEMORY_CACHING_TYPE_ORIG;
3636
3637typedef
3638enum _MEMORY_CACHING_TYPE
3639{ MmNonCached = FALSE,
3640 MmCached = TRUE,
3641 MmWriteCombined = MmFrameBufferCached,
3642 MmHardwareCoherentCached,
3643 MmNonCachedUnordered,
3644 MmUSWCCached,
3645 MmMaximumCacheType
3646} MEMORY_CACHING_TYPE;
3647
3648typedef
3649enum _MM_PAGE_PRIORITY
3650{ LowPagePriority = 0,
3651 NormalPagePriority = 16,
3652 HighPagePriority = 32
3653} MM_PAGE_PRIORITY;
3654
3655typedef
3656enum _LOCK_OPERATION
3657{ IoReadAccess,
3658 IoWriteAccess,
3659 IoModifyAccess
3660} LOCK_OPERATION;
3661
3662typedef
3663enum _MM_SYSTEM_SIZE
3664{ MmSmallSystem,
3665 MmMediumSystem,
3666 MmLargeSystem
3667} MM_SYSTEM_SIZE;
3668
3669typedef
3670struct _OBJECT_HANDLE_INFORMATION
3671{ ULONG HandleAttributes;
3672 ACCESS_MASK GrantedAccess;
3673} OBJECT_HANDLE_INFORMATION, *POBJECT_HANDLE_INFORMATION;
3674
3675typedef
3676struct _CLIENT_ID
3677{ HANDLE UniqueProcess;
3678 HANDLE UniqueThread;
3679} CLIENT_ID, *PCLIENT_ID;
3680
3681typedef VOID DDKAPI
3682(*PKSTART_ROUTINE)(
3683 /*IN*/ PVOID StartContext);
3684
3685typedef VOID DDKAPI
3686(*PCREATE_PROCESS_NOTIFY_ROUTINE)(
3687 /*IN*/ HANDLE ParentId,
3688 /*IN*/ HANDLE ProcessId,
3689 /*IN*/ BOOLEAN Create);
3690
3691typedef VOID DDKAPI
3692(*PCREATE_THREAD_NOTIFY_ROUTINE)(
3693 /*IN*/ HANDLE ProcessId,
3694 /*IN*/ HANDLE ThreadId,
3695 /*IN*/ BOOLEAN Create);
3696
3697typedef
3698struct _IMAGE_INFO
3699{ _ANONYMOUS_UNION union
3700 { ULONG Properties;
3701 _ANONYMOUS_STRUCT struct
3702 { ULONG ImageAddressingMode : 8;
3703 ULONG SystemModeImage : 1;
3704 ULONG ImageMappedToAllPids : 1;
3705 ULONG Reserved : 22;
3706 } DUMMYSTRUCTNAME;
3707 } DUMMYUNIONNAME;
3708 PVOID ImageBase;
3709 ULONG ImageSelector;
3710 SIZE_T ImageSize;
3711 ULONG ImageSectionNumber;
3712} IMAGE_INFO, *PIMAGE_INFO;
3713
3714#define IMAGE_ADDRESSING_MODE_32BIT 3
3715
3716typedef VOID DDKAPI
3717(*PLOAD_IMAGE_NOTIFY_ROUTINE)(
3718 /*IN*/ PUNICODE_STRING FullImageName,
3719 /*IN*/ HANDLE ProcessId,
3720 /*IN*/ PIMAGE_INFO ImageInfo);
3721
3722typedef
3723enum _PROCESSINFOCLASS
3724{ ProcessBasicInformation,
3725 ProcessQuotaLimits,
3726 ProcessIoCounters,
3727 ProcessVmCounters,
3728 ProcessTimes,
3729 ProcessBasePriority,
3730 ProcessRaisePriority,
3731 ProcessDebugPort,
3732 ProcessExceptionPort,
3733 ProcessAccessToken,
3734 ProcessLdtInformation,
3735 ProcessLdtSize,
3736 ProcessDefaultHardErrorMode,
3737 ProcessIoPortHandlers,
3738 ProcessPooledUsageAndLimits,
3739 ProcessWorkingSetWatch,
3740 ProcessUserModeIOPL,
3741 ProcessEnableAlignmentFaultFixup,
3742 ProcessPriorityClass,
3743 ProcessWx86Information,
3744 ProcessHandleCount,
3745 ProcessAffinityMask,
3746 ProcessPriorityBoost,
3747 ProcessDeviceMap,
3748 ProcessSessionInformation,
3749 ProcessForegroundInformation,
3750 ProcessWow64Information,
3751 ProcessImageFileName,
3752 ProcessLUIDDeviceMapsEnabled,
3753 ProcessBreakOnTermination,
3754 ProcessDebugObjectHandle,
3755 ProcessDebugFlags,
3756 ProcessHandleTracing,
3757 MaxProcessInfoClass
3758} PROCESSINFOCLASS;
3759
3760typedef
3761enum _THREADINFOCLASS
3762{ ThreadBasicInformation,
3763 ThreadTimes,
3764 ThreadPriority,
3765 ThreadBasePriority,
3766 ThreadAffinityMask,
3767 ThreadImpersonationToken,
3768 ThreadDescriptorTableEntry,
3769 ThreadEnableAlignmentFaultFixup,
3770 ThreadEventPair_Reusable,
3771 ThreadQuerySetWin32StartAddress,
3772 ThreadZeroTlsCell,
3773 ThreadPerformanceCount,
3774 ThreadAmILastThread,
3775 ThreadIdealProcessor,
3776 ThreadPriorityBoost,
3777 ThreadSetTlsArrayAddress,
3778 ThreadIsIoPending,
3779 ThreadHideFromDebugger,
3780 ThreadBreakOnTermination,
3781 MaxThreadInfoClass
3782} THREADINFOCLASS;
3783
3784#define ES_SYSTEM_REQUIRED 0x00000001
3785#define ES_DISPLAY_REQUIRED 0x00000002
3786#define ES_USER_PRESENT 0x00000004
3787#define ES_CONTINUOUS 0x80000000
3788
3789typedef ULONG EXECUTION_STATE;
3790
3791typedef VOID DDKAPI
3792(*PREQUEST_POWER_COMPLETE)(
3793 /*IN*/ PDEVICE_OBJECT DeviceObject,
3794 /*IN*/ UCHAR MinorFunction,
3795 /*IN*/ POWER_STATE PowerState,
3796 /*IN*/ PVOID Context,
3797 /*IN*/ PIO_STATUS_BLOCK IoStatus
3798);
3799
3800typedef
3801enum _TRACE_INFORMATION_CLASS
3802{ TraceIdClass,
3803 TraceHandleClass,
3804 TraceEnableFlagsClass,
3805 TraceEnableLevelClass,
3806 GlobalLoggerHandleClass,
3807 EventLoggerHandleClass,
3808 AllLoggerHandlesClass,
3809 TraceHandleByNameClass
3810} TRACE_INFORMATION_CLASS;
3811
3812typedef NTSTATUS DDKAPI
3813(*PEX_CALLBACK_FUNCTION)(
3814 /*IN*/ PVOID CallbackContext,
3815 /*IN*/ PVOID Argument1,
3816 /*IN*/ PVOID Argument2
3817);
3818
3819
3820/* Storage structures
3821*/
3822typedef
3823struct _DISK_SIGNATURE
3824{ ULONG PartitionStyle;
3825 _ANONYMOUS_UNION union
3826 { struct
3827 { ULONG Signature;
3828 ULONG CheckSum;
3829 } Mbr;
3830 struct
3831 { GUID DiskId;
3832 } Gpt;
3833 } DUMMYUNIONNAME;
3834} DISK_SIGNATURE, *PDISK_SIGNATURE;
3835
3836typedef VOID DDKFASTAPI
3837(*PTIME_UPDATE_NOTIFY_ROUTINE)(
3838 /*IN*/ HANDLE ThreadId,
3839 /*IN*/ KPROCESSOR_MODE Mode
3840);
3841
3842#define DBG_STATUS_CONTROL_C 1
3843#define DBG_STATUS_SYSRQ 2
3844#define DBG_STATUS_BUGCHECK_FIRST 3
3845#define DBG_STATUS_BUGCHECK_SECOND 4
3846#define DBG_STATUS_FATAL 5
3847#define DBG_STATUS_DEBUG_CONTROL 6
3848#define DBG_STATUS_WORKER 7
3849
3850typedef
3851struct _PHYSICAL_MEMORY_RANGE
3852{ PHYSICAL_ADDRESS BaseAddress;
3853 LARGE_INTEGER NumberOfBytes;
3854} PHYSICAL_MEMORY_RANGE, *PPHYSICAL_MEMORY_RANGE;
3855
3856typedef ULONG_PTR
3857(*PDRIVER_VERIFIER_THUNK_ROUTINE)( /*IN*/ PVOID Context );
3858
3859typedef
3860struct _DRIVER_VERIFIER_THUNK_PAIRS
3861{ PDRIVER_VERIFIER_THUNK_ROUTINE PristineRoutine;
3862 PDRIVER_VERIFIER_THUNK_ROUTINE NewRoutine;
3863} DRIVER_VERIFIER_THUNK_PAIRS, *PDRIVER_VERIFIER_THUNK_PAIRS;
3864
3865#define DRIVER_VERIFIER_SPECIAL_POOLING 0x0001
3866#define DRIVER_VERIFIER_FORCE_IRQL_CHECKING 0x0002
3867#define DRIVER_VERIFIER_INJECT_ALLOCATION_FAILURES 0x0004
3868#define DRIVER_VERIFIER_TRACK_POOL_ALLOCATIONS 0x0008
3869#define DRIVER_VERIFIER_IO_CHECKING 0x0010
3870
3871#define RTL_RANGE_LIST_ADD_IF_CONFLICT 0x00000001
3872#define RTL_RANGE_LIST_ADD_SHARED 0x00000002
3873
3874#define RTL_RANGE_LIST_SHARED_OK 0x00000001
3875#define RTL_RANGE_LIST_NULL_CONFLICT_OK 0x00000002
3876
3877#define RTL_RANGE_LIST_SHARED_OK 0x00000001
3878#define RTL_RANGE_LIST_NULL_CONFLICT_OK 0x00000002
3879
3880#define RTL_RANGE_LIST_MERGE_IF_CONFLICT RTL_RANGE_LIST_ADD_IF_CONFLICT
3881
3882typedef
3883struct _RTL_RANGE
3884{ ULONGLONG Start;
3885 ULONGLONG End;
3886 PVOID UserData;
3887 PVOID Owner;
3888 UCHAR Attributes;
3889 UCHAR Flags;
3890} RTL_RANGE, *PRTL_RANGE;
3891
3892#define RTL_RANGE_SHARED 0x01
3893#define RTL_RANGE_CONFLICT 0x02
3894
3895typedef
3896struct _RTL_RANGE_LIST
3897{ LIST_ENTRY ListHead;
3898 ULONG Flags;
3899 ULONG Count;
3900 ULONG Stamp;
3901} RTL_RANGE_LIST, *PRTL_RANGE_LIST;
3902
3903typedef
3904struct _RANGE_LIST_ITERATOR
3905{ PLIST_ENTRY RangeListHead;
3906 PLIST_ENTRY MergedHead;
3907 PVOID Current;
3908 ULONG Stamp;
3909} RTL_RANGE_LIST_ITERATOR, *PRTL_RANGE_LIST_ITERATOR;
3910
3911typedef BOOLEAN
3912(*PRTL_CONFLICT_RANGE_CALLBACK)(
3913 /*IN*/ PVOID Context,
3914 /*IN*/ PRTL_RANGE Range
3915);
3916
3917#define HASH_STRING_ALGORITHM_DEFAULT 0
3918#define HASH_STRING_ALGORITHM_X65599 1
3919#define HASH_STRING_ALGORITHM_INVALID 0xffffffff
3920
3921typedef
3922enum _SUITE_TYPE
3923{ SmallBusiness,
3924 Enterprise,
3925 BackOffice,
3926 CommunicationServer,
3927 TerminalServer,
3928 SmallBusinessRestricted,
3929 EmbeddedNT,
3930 DataCenter,
3931 SingleUserTS,
3932 Personal,
3933 Blade,
3934 MaxSuiteType
3935} SUITE_TYPE;
3936
3937typedef VOID DDKAPI
3938(*PTIMER_APC_ROUTINE)(
3939 /*IN*/ PVOID TimerContext,
3940 /*IN*/ ULONG TimerLowValue,
3941 /*IN*/ LONG TimerHighValue
3942);
3943
3944
3945/* WMI structures
3946*/
3947typedef VOID DDKAPI
3948(*WMI_NOTIFICATION_CALLBACK)(
3949 PVOID Wnode,
3950 PVOID Context
3951);
3952
3953
3954/* Architecture specific structures
3955*/
3956#ifdef _X86_
3957
3958typedef ULONG PFN_NUMBER, *PPFN_NUMBER;
3959
3960#define PASSIVE_LEVEL 0
3961#define LOW_LEVEL 0
3962#define APC_LEVEL 1
3963#define DISPATCH_LEVEL 2
3964#define SYNCH_LEVEL 27
3965#define PROFILE_LEVEL 27
3966#define CLOCK1_LEVEL 28
3967#define CLOCK2_LEVEL 28
3968#define IPI_LEVEL 29
3969#define POWER_LEVEL 30
3970#define HIGH_LEVEL 31
3971
3972typedef
3973struct _KPCR_TIB
3974{ PVOID ExceptionList; /* 00 */
3975 PVOID StackBase; /* 04 */
3976 PVOID StackLimit; /* 08 */
3977 PVOID SubSystemTib; /* 0C */
3978 _ANONYMOUS_UNION union
3979 { PVOID FiberData; /* 10 */
3980 DWORD Version; /* 10 */
3981 } DUMMYUNIONNAME;
3982 PVOID ArbitraryUserPointer; /* 14 */
3983 struct _NT_TIB *Self; /* 18 */
3984} KPCR_TIB, *PKPCR_TIB; /* 1C */
3985
3986#define PCR_MINOR_VERSION 1
3987#define PCR_MAJOR_VERSION 1
3988
3989typedef
3990struct _KPCR
3991{ KPCR_TIB Tib; /* 00 */
3992 struct _KPCR *Self; /* 1C */
3993 struct _KPRCB *PCRCB; /* 20 */
3994 KIRQL Irql; /* 24 */
3995 ULONG IRR; /* 28 */
3996 ULONG IrrActive; /* 2C */
3997 ULONG IDR; /* 30 */
3998 PVOID KdVersionBlock; /* 34 */
3999 PUSHORT IDT; /* 38 */
4000 PUSHORT GDT; /* 3C */
4001 struct _KTSS *TSS; /* 40 */
4002 USHORT MajorVersion; /* 44 */
4003 USHORT MinorVersion; /* 46 */
4004 KAFFINITY SetMember; /* 48 */
4005 ULONG StallScaleFactor; /* 4C */
4006 UCHAR SpareUnused; /* 50 */
4007 UCHAR Number; /* 51 */
4008} KPCR, *PKPCR; /* 54 */
4009
4010typedef
4011struct _KFLOATING_SAVE
4012{ ULONG ControlWord;
4013 ULONG StatusWord;
4014 ULONG ErrorOffset;
4015 ULONG ErrorSelector;
4016 ULONG DataOffset;
4017 ULONG DataSelector;
4018 ULONG Cr0NpxState;
4019 ULONG Spare1;
4020} KFLOATING_SAVE, *PKFLOATING_SAVE;
4021
4022#define PAGE_SIZE 0x1000
4023#define PAGE_SHIFT 12L
4024
4025extern NTOSAPI PVOID *MmHighestUserAddress;
4026extern NTOSAPI PVOID *MmSystemRangeStart;
4027extern NTOSAPI ULONG *MmUserProbeAddress;
4028
4029#define MM_HIGHEST_USER_ADDRESS *MmHighestUserAddress
4030#define MM_SYSTEM_RANGE_START *MmSystemRangeStart
4031#define MM_USER_PROBE_ADDRESS *MmUserProbeAddress
4032#define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
4033#define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xC0C00000
4034
4035#define KI_USER_SHARED_DATA 0xffdf0000
4036#define SharedUserData ((KUSER_SHARED_DATA * CONST) KI_USER_SHARED_DATA)
4037
4038#define EFLAG_SIGN 0x8000
4039#define EFLAG_ZERO 0x4000
4040#define EFLAG_SELECT (EFLAG_SIGN | EFLAG_ZERO)
4041
4042#define RESULT_NEGATIVE ((EFLAG_SIGN & ~EFLAG_ZERO) & EFLAG_SELECT)
4043#define RESULT_ZERO ((~EFLAG_SIGN & EFLAG_ZERO) & EFLAG_SELECT)
4044#define RESULT_POSITIVE ((~EFLAG_SIGN & ~EFLAG_ZERO) & EFLAG_SELECT)
4045
4046typedef
4047enum _INTERLOCKED_RESULT
4048{ ResultNegative = RESULT_NEGATIVE,
4049 ResultZero = RESULT_ZERO,
4050 ResultPositive = RESULT_POSITIVE
4051} INTERLOCKED_RESULT;
4052
4053NTOSAPI KIRQL DDKAPI
4054KeGetCurrentIrql( VOID );
4055
4056/* ULONG
4057 * KeGetCurrentProcessorNumber(
4058 * VOID)
4059 */
4060#define KeGetCurrentProcessorNumber() \
4061 ((ULONG)KeGetCurrentKPCR()->Number)
4062
4063
4064#if __USE_NTOSKRNL__
4065/* CAREFUL: These are exported from ntoskrnl.exe as __fastcall functions,
4066 but are also exported from kernel32.dll and declared in winbase.h as
4067 __stdcall */
4068#if !defined(__INTERLOCKED_DECLARED)
4069#define __INTERLOCKED_DECLARED
4070
4071NTOSAPI LONG DDKFASTAPI
4072InterlockedIncrement( /*IN*/ LONG VOLATILE *Addend );
4073
4074NTOSAPI LONG DDKFASTAPI
4075InterlockedDecrement( /*IN*/ LONG VOLATILE *Addend );
4076
4077NTOSAPI LONG DDKFASTAPI
4078InterlockedCompareExchange(
4079 /*IN OUT*/ PLONG VOLATILE Destination,
4080 /*IN*/ LONG Exchange,
4081 /*IN*/ LONG Comparand
4082);
4083
4084NTOSAPI LONG DDKFASTAPI
4085InterlockedExchange(
4086 /*IN OUT*/ PLONG VOLATILE Target,
4087 /*IN*/ LONG Value
4088);
4089
4090NTOSAPI LONG DDKFASTAPI
4091InterlockedExchangeAdd(
4092 /*IN OUT*/ PLONG VOLATILE Addend,
4093 /*IN*/ LONG Value
4094);
4095
4096/* PVOID
4097 * InterlockedExchangePointer(
4098 * IN OUT PVOID VOLATILE *Target,
4099 * IN PVOID Value)
4100 */
4101#define InterlockedExchangePointer(Target, Value) \
4102 ((PVOID) InterlockedExchange((PLONG) Target, (LONG) Value))
4103
4104/* PVOID InterlockedCompareExchangePointer(
4105 * IN OUT PVOID *Destination,
4106 * IN PVOID Exchange,
4107 * IN PVOID Comparand
4108 * )
4109 */
4110#define InterlockedCompareExchangePointer(Destination, Exchange, Comparand) \
4111 ((PVOID) InterlockedCompareExchange((PLONG) Destination, (LONG) Exchange, (LONG) Comparand))
4112
4113#if (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
4114PSLIST_ENTRY DDKFASTAPI
4115InterlockedPopEntrySList( /*IN*/ PSLIST_HEADER ListHead );
4116
4117NTOSAPI PSLIST_ENTRY DDKFASTAPI
4118InterlockedPushEntrySList(
4119 /*IN*/ PSLIST_HEADER ListHead,
4120 /*IN*/ PSLIST_ENTRY ListEntry
4121);
4122#endif /* _WIN32_WINNT >= _WIN32_WINNT_WINXP */
4123
4124#endif /* !__INTERLOCKED_DECLARED */
4125#endif /* __USE_NTOSKRNL__ */
4126
4127NTOSAPI VOID DDKFASTAPI
4128KefAcquireSpinLockAtDpcLevel( /*IN*/ PKSPIN_LOCK SpinLock );
4129
4130NTOSAPI VOID DDKFASTAPI
4131KefReleaseSpinLockFromDpcLevel( /*IN*/ PKSPIN_LOCK SpinLock );
4132
4133#define KeAcquireSpinLockAtDpcLevel(SpinLock) KefAcquireSpinLockAtDpcLevel(SpinLock)
4134#define KeReleaseSpinLockFromDpcLevel(SpinLock) KefReleaseSpinLockFromDpcLevel(SpinLock)
4135
4136#define RtlCopyMemoryNonTemporal RtlCopyMemory
4137
4138#define KeGetDcacheFillSize() 1L
4139
4140#endif /* _X86_ */
4141
4142/* Utility functions
4143 */
4144#define ARGUMENT_PRESENT(ArgumentPointer) \
4145 ((BOOLEAN) ((PVOID)ArgumentPointer != (PVOID)NULL))
4146
4147/* ULONG BYTE_OFFSET( IN PVOID Va )
4148 */
4149#define BYTE_OFFSET(Va) \
4150 ((ULONG) ((ULONG_PTR) (Va) & (PAGE_SIZE - 1)))
4151
4152/* ULONG BYTES_TO_PAGES( IN ULONG Size )
4153 */
4154#define BYTES_TO_PAGES(Size) \
4155 ((ULONG) ((ULONG_PTR) (Size) >> PAGE_SHIFT) + (((ULONG) (Size) & (PAGE_SIZE - 1)) != 0))
4156
4157/* PCHAR CONTAINING_RECORD(
4158 * IN PCHAR Address,
4159 * IN TYPE Type,
4160 * IN PCHAR Field
4161 * );
4162 */
4163#ifndef CONTAINING_RECORD
4164#define CONTAINING_RECORD(Address, Type, Field) \
4165 ((Type *) (((ULONG_PTR) Address) - FIELD_OFFSET(Type, Field)))
4166#endif
4167
4168/* LONG FIELD_OFFSET( IN TYPE Type, IN PCHAR Field );
4169 */
4170#ifndef FIELD_OFFSET
4171#define FIELD_OFFSET(Type, Field) \
4172 ((LONG) (&(((Type *) 0)->Field)))
4173#endif
4174
4175/* PVOID PAGE_ALIGN( IN PVOID Va )
4176 */
4177#define PAGE_ALIGN(Va) \
4178 ((PVOID) ((ULONG_PTR)(Va) & ~(PAGE_SIZE - 1)))
4179
4180/* ULONG_PTR ROUND_TO_PAGES( IN ULONG_PTR Size )
4181 */
4182#define ROUND_TO_PAGES(Size) \
4183 ((ULONG_PTR) (((ULONG_PTR) Size + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)))
4184
4185NTOSAPI VOID DDKAPI
4186RtlAssert(
4187 /*IN*/ PVOID FailedAssertion,
4188 /*IN*/ PVOID FileName,
4189 /*IN*/ ULONG LineNumber,
4190 /*IN*/ PCHAR Message
4191);
4192
4193#ifdef DBG
4194
4195#define ASSERT(exp) \
4196 ((!(exp)) ? (RtlAssert( #exp, __FILE__, __LINE__, NULL ), FALSE) : TRUE)
4197
4198#define ASSERTMSG(msg, exp) \
4199 ((!(exp)) ? (RtlAssert( #exp, __FILE__, __LINE__, msg ), FALSE) : TRUE)
4200
4201#define RTL_SOFT_ASSERT(exp) \
4202 ((!(_exp)) \
4203 ? (DbgPrint("%s(%d): Soft assertion failed\n Expression: %s\n",__FILE__,__LINE__,#exp),FALSE) \
4204 : TRUE \
4205 )
4206
4207#define RTL_SOFT_ASSERTMSG(msg, exp) \
4208 ((!(exp)) \
4209 ? (DbgPrint("%s(%d): Soft assertion failed\n Expression: %s\n Message: %s\n", \
4210 __FILE__, __LINE__, #exp, (msg)), FALSE) \
4211 : TRUE \
4212 )
4213
4214#define RTL_VERIFY(exp) ASSERT(exp)
4215#define RTL_VERIFYMSG(msg, exp) ASSERT(msg, exp)
4216
4217#define RTL_SOFT_VERIFY(exp) RTL_SOFT_ASSERT(exp)
4218#define RTL_SOFT_VERIFYMSG(msg, exp) RTL_SOFT_ASSERTMSG(msg, exp)
4219
4220#else /* !DBG */
4221
4222#define ASSERT(exp) ((VOID) 0)
4223#define ASSERTMSG(msg, exp) ((VOID) 0)
4224
4225#define RTL_SOFT_ASSERT(exp) ((VOID) 0)
4226#define RTL_SOFT_ASSERTMSG(msg, exp) ((VOID) 0)
4227
4228#define RTL_VERIFY(exp) ((exp) ? TRUE : FALSE)
4229#define RTL_VERIFYMSG(msg, exp) ((exp) ? TRUE : FALSE)
4230
4231#define RTL_SOFT_VERIFY(exp) ((exp) ? TRUE : FALSE)
4232#define RTL_SOFT_VERIFYMSG(msg, exp) ((exp) ? TRUE : FALSE)
4233
4234#endif /* DBG */
4235
4236
4237/* Driver support routines
4238*/
4239
4240/** Runtime library routines **/
4241
4242/* VOID InitializeListHead( IN PLIST_ENTRY ListHead )
4243 */
4244#define InitializeListHead(_ListHead) \
4245{ (_ListHead)->Flink = (_ListHead); \
4246 (_ListHead)->Blink = (_ListHead); \
4247}
4248
4249/* VOID InsertHeadList(
4250 * IN PLIST_ENTRY ListHead,
4251 * IN PLIST_ENTRY Entry
4252 * )
4253 */
4254#define InsertHeadList(_ListHead, _Entry) \
4255{ PLIST_ENTRY _OldFlink; \
4256 _OldFlink = (_ListHead)->Flink; \
4257 (_Entry)->Flink = _OldFlink; \
4258 (_Entry)->Blink = (_ListHead); \
4259 _OldFlink->Blink = (_Entry); \
4260 (_ListHead)->Flink = (_Entry); \
4261}
4262
4263/* VOID InsertTailList(
4264 * IN PLIST_ENTRY ListHead,
4265 * IN PLIST_ENTRY Entry
4266 * )
4267 */
4268#define InsertTailList(_ListHead, _Entry) \
4269{ PLIST_ENTRY _OldBlink; \
4270 _OldBlink = (_ListHead)->Blink; \
4271 (_Entry)->Flink = (_ListHead); \
4272 (_Entry)->Blink = _OldBlink; \
4273 _OldBlink->Flink = (_Entry); \
4274 (_ListHead)->Blink = (_Entry); \
4275}
4276
4277/* BOOLEAN IsListEmpty( IN PLIST_ENTRY ListHead )
4278 */
4279#define IsListEmpty(_ListHead) \
4280 ((_ListHead)->Flink == (_ListHead))
4281
4282static __inline__ PSINGLE_LIST_ENTRY
4283PopEntryList( /*IN*/ PSINGLE_LIST_ENTRY ListHead )
4284{
4285 PSINGLE_LIST_ENTRY Entry;
4286
4287 Entry = ListHead->Next;
4288 if (Entry != NULL)
4289 {
4290 ListHead->Next = Entry->Next;
4291 }
4292 return Entry;
4293}
4294
4295/* VOID PushEntryList(
4296 * IN PSINGLE_LIST_ENTRY ListHead,
4297 * IN PSINGLE_LIST_ENTRY Entry
4298 * )
4299 */
4300#define PushEntryList(_ListHead, _Entry) \
4301{ (_Entry)->Next = (_ListHead)->Next; \
4302 (_ListHead)->Next = (_Entry); \
4303}
4304
4305/* VOID RemoveEntryList( IN PLIST_ENTRY Entry )
4306 */
4307#define RemoveEntryList(_Entry) \
4308{ PLIST_ENTRY _OldFlink; \
4309 PLIST_ENTRY _OldBlink; \
4310 _OldFlink = (_Entry)->Flink; \
4311 _OldBlink = (_Entry)->Blink; \
4312 _OldFlink->Blink = _OldBlink; \
4313 _OldBlink->Flink = _OldFlink; \
4314 (_Entry)->Flink = NULL; \
4315 (_Entry)->Blink = NULL; \
4316}
4317
4318static __inline__ PLIST_ENTRY
4319RemoveHeadList( /*IN*/ PLIST_ENTRY ListHead )
4320{
4321 PLIST_ENTRY OldFlink;
4322 PLIST_ENTRY OldBlink;
4323 PLIST_ENTRY Entry;
4324
4325 Entry = ListHead->Flink;
4326 OldFlink = ListHead->Flink->Flink;
4327 OldBlink = ListHead->Flink->Blink;
4328 OldFlink->Blink = OldBlink;
4329 OldBlink->Flink = OldFlink;
4330
4331 if (Entry != ListHead)
4332 {
4333 Entry->Flink = NULL;
4334 Entry->Blink = NULL;
4335 }
4336 return Entry;
4337}
4338
4339static __inline__ PLIST_ENTRY
4340RemoveTailList( /*IN*/ PLIST_ENTRY ListHead )
4341{
4342 PLIST_ENTRY OldFlink;
4343 PLIST_ENTRY OldBlink;
4344 PLIST_ENTRY Entry;
4345
4346 Entry = ListHead->Blink;
4347 OldFlink = ListHead->Blink->Flink;
4348 OldBlink = ListHead->Blink->Blink;
4349 OldFlink->Blink = OldBlink;
4350 OldBlink->Flink = OldFlink;
4351
4352 if (Entry != ListHead)
4353 {
4354 Entry->Flink = NULL;
4355 Entry->Blink = NULL;
4356 }
4357 return Entry;
4358}
4359
4360/* USHORT QueryDepthSList( IN PSLIST_HEADER SListHead )
4361 */
4362#define QueryDepthSList(_SListHead) \
4363 ((USHORT) ((_SListHead)->Alignment & 0xffff))
4364
4365#define InterlockedFlushSList(ListHead) ExInterlockedFlushSList(ListHead)
4366
4367NTOSAPI ULONG DDKAPI
4368RtlAnsiStringToUnicodeSize( /*IN*/ PANSI_STRING AnsiString );
4369
4370NTOSAPI NTSTATUS DDKAPI
4371RtlAddRange(
4372 /*IN OUT*/ PRTL_RANGE_LIST RangeList,
4373 /*IN*/ ULONGLONG Start,
4374 /*IN*/ ULONGLONG End,
4375 /*IN*/ UCHAR Attributes,
4376 /*IN*/ ULONG Flags,
4377 /*IN*/ PVOID UserData /*OPTIONAL*/,
4378 /*IN*/ PVOID Owner /*OPTIONAL*/
4379);
4380
4381NTOSAPI NTSTATUS DDKAPI
4382RtlAnsiStringToUnicodeString(
4383 /*IN OUT*/ PUNICODE_STRING DestinationString,
4384 /*IN*/ PANSI_STRING SourceString,
4385 /*IN*/ BOOLEAN AllocateDestinationString
4386);
4387
4388NTOSAPI NTSTATUS DDKAPI
4389RtlAppendUnicodeStringToString(
4390 /*IN OUT*/ PUNICODE_STRING Destination,
4391 /*IN*/ PUNICODE_STRING Source
4392);
4393
4394NTOSAPI NTSTATUS DDKAPI
4395RtlAppendUnicodeToString(
4396 /*IN OUT*/ PUNICODE_STRING Destination,
4397 /*IN*/ PCWSTR Source
4398);
4399
4400NTOSAPI BOOLEAN DDKAPI
4401RtlAreBitsClear(
4402 /*IN*/ PRTL_BITMAP BitMapHeader,
4403 /*IN*/ ULONG StartingIndex,
4404 /*IN*/ ULONG Length
4405);
4406
4407NTOSAPI BOOLEAN DDKAPI
4408RtlAreBitsSet(
4409 /*IN*/ PRTL_BITMAP BitMapHeader,
4410 /*IN*/ ULONG StartingIndex,
4411 /*IN*/ ULONG Length
4412);
4413
4414NTOSAPI NTSTATUS DDKAPI
4415RtlCharToInteger(
4416 /*IN*/ PCSZ String,
4417 /*IN*/ ULONG Base /*OPTIONAL*/,
4418 /*IN OUT*/ PULONG Value
4419);
4420
4421NTOSAPI ULONG DDKAPI
4422RtlCheckBit(
4423 /*IN*/ PRTL_BITMAP BitMapHeader,
4424 /*IN*/ ULONG BitPosition
4425);
4426
4427NTOSAPI NTSTATUS DDKAPI
4428RtlCheckRegistryKey(
4429 /*IN*/ ULONG RelativeTo,
4430 /*IN*/ PWSTR Path
4431);
4432
4433NTOSAPI VOID DDKAPI
4434RtlClearAllBits( /*IN*/ PRTL_BITMAP BitMapHeader );
4435
4436NTOSAPI VOID DDKAPI
4437RtlClearBit( PRTL_BITMAP BitMapHeader, ULONG BitNumber );
4438
4439NTOSAPI VOID DDKAPI
4440RtlClearBits(
4441 /*IN*/ PRTL_BITMAP BitMapHeader,
4442 /*IN*/ ULONG StartingIndex,
4443 /*IN*/ ULONG NumberToClear
4444);
4445
4446NTOSAPI SIZE_T DDKAPI
4447RtlCompareMemory(
4448 /*IN*/ CONST VOID *Source1,
4449 /*IN*/ CONST VOID *Source2,
4450 /*IN*/ SIZE_T Length
4451);
4452
4453NTOSAPI LONG DDKAPI
4454RtlCompareString(
4455 /*IN*/ PSTRING String1,
4456 /*IN*/ PSTRING String2,
4457 BOOLEAN CaseInSensitive
4458);
4459
4460NTOSAPI LONG DDKAPI
4461RtlCompareUnicodeString(
4462 /*IN*/ PUNICODE_STRING String1,
4463 /*IN*/ PUNICODE_STRING String2,
4464 /*IN*/ BOOLEAN CaseInSensitive
4465);
4466
4467NTOSAPI LARGE_INTEGER DDKAPI
4468RtlConvertLongToLargeInteger( /*IN*/ LONG SignedInteger );
4469
4470NTOSAPI LUID DDKAPI
4471RtlConvertLongToLuid( /*IN*/ LONG Long );
4472
4473NTOSAPI LARGE_INTEGER DDKAPI
4474RtlConvertUlongToLargeInteger( /*IN*/ ULONG UnsignedInteger );
4475
4476NTOSAPI LUID DDKAPI
4477RtlConvertUlongToLuid( ULONG Ulong );
4478
4479/* VOID RtlCopyMemory(
4480 * IN VOID UNALIGNED *Destination,
4481 * IN CONST VOID UNALIGNED *Source,
4482 * IN SIZE_T Length
4483 * )
4484 */
4485#ifndef RtlCopyMemory
4486#define RtlCopyMemory(Destination, Source, Length) \
4487 memcpy(Destination, Source, Length)
4488#endif
4489
4490#ifndef RtlCopyBytes
4491#define RtlCopyBytes RtlCopyMemory
4492#endif
4493
4494NTOSAPI VOID DDKAPI
4495RtlCopyMemory32(
4496 /*IN*/ VOID UNALIGNED *Destination,
4497 /*IN*/ CONST VOID UNALIGNED *Source,
4498 /*IN*/ ULONG Length
4499);
4500
4501NTOSAPI NTSTATUS DDKAPI
4502RtlCopyRangeList(
4503 /*OUT*/ PRTL_RANGE_LIST CopyRangeList,
4504 /*IN*/ PRTL_RANGE_LIST RangeList
4505);
4506
4507NTOSAPI VOID DDKAPI
4508RtlCopyString(
4509 /*IN OUT*/ PSTRING DestinationString,
4510 /*IN*/ PSTRING SourceString /*OPTIONAL*/
4511);
4512
4513NTOSAPI VOID DDKAPI
4514RtlCopyUnicodeString(
4515 /*IN OUT*/ PUNICODE_STRING DestinationString,
4516 /*IN*/ PUNICODE_STRING SourceString
4517);
4518
4519NTOSAPI NTSTATUS DDKAPI
4520RtlCreateRegistryKey( /*IN*/ ULONG RelativeTo, /*IN*/ PWSTR Path );
4521
4522NTOSAPI NTSTATUS DDKAPI
4523RtlCreateSecurityDescriptor(
4524 /*IN OUT*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
4525 /*IN*/ ULONG Revision
4526);
4527
4528NTOSAPI NTSTATUS DDKAPI
4529RtlDeleteOwnersRanges(
4530 /*IN OUT*/ PRTL_RANGE_LIST RangeList,
4531 /*IN*/ PVOID Owner
4532);
4533
4534NTOSAPI NTSTATUS DDKAPI
4535RtlDeleteRange(
4536 /*IN OUT*/ PRTL_RANGE_LIST RangeList,
4537 /*IN*/ ULONGLONG Start,
4538 /*IN*/ ULONGLONG End,
4539 /*IN*/ PVOID Owner
4540);
4541
4542NTOSAPI NTSTATUS DDKAPI
4543RtlDeleteRegistryValue(
4544 /*IN*/ ULONG RelativeTo,
4545 /*IN*/ PCWSTR Path,
4546 /*IN*/ PCWSTR ValueName
4547);
4548
4549NTOSAPI BOOL DDKAPI
4550RtlDosPathNameToNtPathName_U(
4551 /*IN*/ PCWSTR DosPathName,
4552 /*OUT*/ PUNICODE_STRING NtPathName,
4553 /*OUT*/ PCWSTR *NtFileNamePart,
4554 /*OUT*/ VOID *DirectoryInfo
4555);
4556
4557/* BOOLEAN RtlEqualLuid(
4558 * IN LUID Luid1,
4559 * IN LUID Luid2
4560 * )
4561 */
4562#define RtlEqualLuid(_Luid1, _Luid2) \
4563 ((Luid1.LowPart == Luid2.LowPart) && (Luid1.HighPart == Luid2.HighPart))
4564
4565/* ULONG RtlEqualMemory(
4566 * IN VOID UNALIGNED *Destination,
4567 * IN CONST VOID UNALIGNED *Source,
4568 * IN SIZE_T Length
4569 * )
4570 */
4571#define RtlEqualMemory(Destination, Source, Length) (!memcmp(Destination, Source, Length))
4572
4573NTOSAPI BOOLEAN DDKAPI
4574RtlEqualString(
4575 /*IN*/ PSTRING String1,
4576 /*IN*/ PSTRING String2,
4577 /*IN*/ BOOLEAN CaseInSensitive
4578);
4579
4580NTOSAPI BOOLEAN DDKAPI
4581RtlEqualUnicodeString(
4582 /*IN*/ CONST UNICODE_STRING *String1,
4583 /*IN*/ CONST UNICODE_STRING *String2,
4584 /*IN*/ BOOLEAN CaseInSensitive
4585);
4586
4587/* VOID RtlFillMemory(
4588 * IN VOID UNALIGNED *Destination,
4589 * IN SIZE_T Length,
4590 * IN UCHAR Fill
4591 * )
4592 */
4593#ifndef RtlFillMemory
4594#define RtlFillMemory(Destination, Length, Fill) \
4595 memset(Destination, Fill, Length)
4596#endif
4597
4598#ifndef RtlFillBytes
4599#define RtlFillBytes RtlFillMemory
4600#endif
4601
4602NTOSAPI ULONG DDKAPI
4603RtlFindClearBits(
4604 /*IN*/ PRTL_BITMAP BitMapHeader,
4605 /*IN*/ ULONG NumberToFind,
4606 /*IN*/ ULONG HintIndex
4607);
4608
4609NTOSAPI ULONG DDKAPI
4610RtlFindClearBitsAndSet(
4611 /*IN*/ PRTL_BITMAP BitMapHeader,
4612 /*IN*/ ULONG NumberToFind,
4613 /*IN*/ ULONG HintIndex
4614);
4615
4616NTOSAPI ULONG DDKAPI
4617RtlFindClearRuns(
4618 /*IN*/ PRTL_BITMAP BitMapHeader,
4619 /*OUT*/ PRTL_BITMAP_RUN RunArray,
4620 /*IN*/ ULONG SizeOfRunArray,
4621 /*IN*/ BOOLEAN LocateLongestRuns
4622);
4623
4624NTOSAPI ULONG DDKAPI
4625RtlFindFirstRunClear(
4626 /*IN*/ PRTL_BITMAP BitMapHeader,
4627 /*OUT*/ PULONG StartingIndex
4628);
4629
4630NTOSAPI ULONG DDKAPI
4631RtlFindLastBackwardRunClear(
4632 /*IN*/ PRTL_BITMAP BitMapHeader,
4633 /*IN*/ ULONG FromIndex,
4634 /*OUT*/ PULONG StartingRunIndex
4635);
4636
4637NTOSAPI CCHAR DDKAPI
4638RtlFindLeastSignificantBit( /*IN*/ ULONGLONG Set );
4639
4640NTOSAPI ULONG DDKAPI
4641RtlFindLongestRunClear(
4642 /*IN*/ PRTL_BITMAP BitMapHeader,
4643 /*OUT*/ PULONG StartingIndex
4644);
4645
4646NTOSAPI CCHAR DDKAPI
4647RtlFindMostSignificantBit( /*IN*/ ULONGLONG Set );
4648
4649NTOSAPI ULONG DDKAPI
4650RtlFindNextForwardRunClear(
4651 /*IN*/ PRTL_BITMAP BitMapHeader,
4652 /*IN*/ ULONG FromIndex,
4653 /*OUT*/ PULONG StartingRunIndex
4654);
4655
4656NTOSAPI NTSTATUS DDKAPI
4657RtlFindRange(
4658 /*IN*/ PRTL_RANGE_LIST RangeList,
4659 /*IN*/ ULONGLONG Minimum,
4660 /*IN*/ ULONGLONG Maximum,
4661 /*IN*/ ULONG Length,
4662 /*IN*/ ULONG Alignment,
4663 /*IN*/ ULONG Flags,
4664 /*IN*/ UCHAR AttributeAvailableMask,
4665 /*IN*/ PVOID Context /*OPTIONAL*/,
4666 /*IN*/ PRTL_CONFLICT_RANGE_CALLBACK Callback /*OPTIONAL*/,
4667 /*OUT*/ PULONGLONG Start
4668);
4669
4670NTOSAPI ULONG DDKAPI
4671RtlFindSetBits(
4672 /*IN*/ PRTL_BITMAP BitMapHeader,
4673 /*IN*/ ULONG NumberToFind,
4674 /*IN*/ ULONG HintIndex
4675);
4676
4677NTOSAPI ULONG DDKAPI
4678RtlFindSetBitsAndClear(
4679 /*IN*/ PRTL_BITMAP BitMapHeader,
4680 /*IN*/ ULONG NumberToFind,
4681 /*IN*/ ULONG HintIndex
4682);
4683
4684NTOSAPI VOID DDKAPI
4685RtlFreeAnsiString( /*IN*/ PANSI_STRING AnsiString );
4686
4687NTOSAPI VOID DDKAPI
4688RtlFreeRangeList( /*IN*/ PRTL_RANGE_LIST RangeList );
4689
4690NTOSAPI VOID DDKAPI
4691RtlFreeUnicodeString( /*IN*/ PUNICODE_STRING UnicodeString );
4692
4693NTOSAPI VOID DDKAPI
4694RtlGetCallersAddress(
4695 /*OUT*/ PVOID *CallersAddress,
4696 /*OUT*/ PVOID *CallersCaller
4697);
4698
4699NTOSAPI NTSTATUS DDKAPI
4700RtlGetVersion( /*IN OUT*/ PRTL_OSVERSIONINFOW lpVersionInformation );
4701
4702NTOSAPI NTSTATUS DDKAPI
4703RtlGetFirstRange(
4704 /*IN*/ PRTL_RANGE_LIST RangeList,
4705 /*OUT*/ PRTL_RANGE_LIST_ITERATOR Iterator,
4706 /*OUT*/ PRTL_RANGE *Range
4707);
4708
4709NTOSAPI NTSTATUS DDKAPI
4710RtlGetNextRange(
4711 /*IN OUT*/ PRTL_RANGE_LIST_ITERATOR Iterator,
4712 /*OUT*/ PRTL_RANGE *Range,
4713 /*IN*/ BOOLEAN MoveForwards
4714);
4715
4716#define FOR_ALL_RANGES(RangeList, Iterator, Current) \
4717 for (RtlGetFirstRange((RangeList), (Iterator), &(Current)); \
4718 (Current) != NULL; \
4719 RtlGetNextRange((Iterator), &(Current), TRUE))
4720
4721#define FOR_ALL_RANGES_BACKWARDS(RangeList, Iterator, Current) \
4722 for (RtlGetLastRange((RangeList), (Iterator), &(Current)); \
4723 (Current) != NULL; \
4724 RtlGetNextRange((Iterator), &(Current), FALSE))
4725
4726NTOSAPI NTSTATUS DDKAPI
4727RtlGUIDFromString(
4728 /*IN*/ PUNICODE_STRING GuidString,
4729 /*OUT*/ GUID *Guid
4730);
4731
4732NTOSAPI NTSTATUS DDKAPI
4733RtlHashUnicodeString(
4734 /*IN*/ CONST UNICODE_STRING *String,
4735 /*IN*/ BOOLEAN CaseInSensitive,
4736 /*IN*/ ULONG HashAlgorithm,
4737 /*OUT*/ PULONG HashValue
4738);
4739
4740NTOSAPI VOID DDKAPI
4741RtlInitAnsiString(
4742 /*IN OUT*/ PANSI_STRING DestinationString,
4743 /*IN*/ PCSZ SourceString
4744);
4745
4746NTOSAPI VOID DDKAPI
4747RtlInitializeBitMap(
4748 /*IN*/ PRTL_BITMAP BitMapHeader,
4749 /*IN*/ PULONG BitMapBuffer,
4750 /*IN*/ ULONG SizeOfBitMap
4751);
4752
4753NTOSAPI VOID DDKAPI
4754RtlInitializeRangeList( /*IN OUT*/ PRTL_RANGE_LIST RangeList );
4755
4756NTOSAPI VOID DDKAPI
4757RtlInitString(
4758 /*IN OUT*/ PSTRING DestinationString,
4759 /*IN*/ PCSZ SourceString
4760);
4761
4762NTOSAPI VOID DDKAPI
4763RtlInitUnicodeString(
4764 /*IN OUT*/ PUNICODE_STRING DestinationString,
4765 /*IN*/ PCWSTR SourceString
4766);
4767
4768NTOSAPI NTSTATUS DDKAPI
4769RtlInt64ToUnicodeString(
4770 /*IN*/ ULONGLONG Value,
4771 /*IN*/ ULONG Base /*OPTIONAL*/,
4772 /*IN OUT*/ PUNICODE_STRING String
4773);
4774
4775NTOSAPI NTSTATUS DDKAPI
4776RtlIntegerToUnicodeString(
4777 /*IN*/ ULONG Value,
4778 /*IN*/ ULONG Base /*OPTIONAL*/,
4779 /*IN OUT*/ PUNICODE_STRING String
4780);
4781
4782NTOSAPI NTSTATUS DDKAPI
4783RtlIntPtrToUnicodeString(
4784 PLONG Value,
4785 ULONG Base /*OPTIONAL*/,
4786 PUNICODE_STRING String
4787);
4788
4789NTOSAPI NTSTATUS DDKAPI
4790RtlInvertRangeList(
4791 /*OUT*/ PRTL_RANGE_LIST InvertedRangeList,
4792 /*IN*/ PRTL_RANGE_LIST RangeList
4793);
4794
4795NTOSAPI NTSTATUS DDKAPI
4796RtlIsRangeAvailable(
4797 /*IN*/ PRTL_RANGE_LIST RangeList,
4798 /*IN*/ ULONGLONG Start,
4799 /*IN*/ ULONGLONG End,
4800 /*IN*/ ULONG Flags,
4801 /*IN*/ UCHAR AttributeAvailableMask,
4802 /*IN*/ PVOID Context /*OPTIONAL*/,
4803 /*IN*/ PRTL_CONFLICT_RANGE_CALLBACK Callback /*OPTIONAL*/,
4804 /*OUT*/ PBOOLEAN Available
4805);
4806
4807/* BOOLEAN RtlIsZeroLuid( IN PLUID L1 )
4808 */
4809#define RtlIsZeroLuid(_L1) \
4810 ((BOOLEAN) ((!(_L1)->LowPart) && (!(_L1)->HighPart)))
4811
4812NTOSAPI ULONG DDKAPI
4813RtlLengthSecurityDescriptor( /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor );
4814
4815NTOSAPI VOID DDKAPI
4816RtlMapGenericMask(
4817 /*IN OUT*/ PACCESS_MASK AccessMask,
4818 /*IN*/ PGENERIC_MAPPING GenericMapping
4819);
4820
4821NTOSAPI NTSTATUS DDKAPI
4822RtlMergeRangeLists(
4823 /*OUT*/ PRTL_RANGE_LIST MergedRangeList,
4824 /*IN*/ PRTL_RANGE_LIST RangeList1,
4825 /*IN*/ PRTL_RANGE_LIST RangeList2,
4826 /*IN*/ ULONG Flags
4827);
4828
4829/* VOID RtlMoveMemory(
4830 * IN VOID UNALIGNED *Destination,
4831 * IN CONST VOID UNALIGNED *Source,
4832 * IN SIZE_T Length
4833 * )
4834 */
4835#define RtlMoveMemory memmove
4836
4837NTOSAPI ULONG DDKAPI
4838RtlNumberOfClearBits( /*IN*/ PRTL_BITMAP BitMapHeader );
4839
4840NTOSAPI ULONG DDKAPI
4841RtlNumberOfSetBits( /*IN*/ PRTL_BITMAP BitMapHeader );
4842
4843NTOSAPI VOID DDKFASTAPI
4844RtlPrefetchMemoryNonTemporal( /*IN*/ PVOID Source, /*IN*/ SIZE_T Length );
4845
4846NTOSAPI BOOLEAN DDKAPI
4847RtlPrefixUnicodeString(
4848 /*IN*/ PUNICODE_STRING String1,
4849 /*IN*/ PUNICODE_STRING String2,
4850 /*IN*/ BOOLEAN CaseInSensitive
4851);
4852
4853NTOSAPI NTSTATUS DDKAPI
4854RtlQueryRegistryValues(
4855 /*IN*/ ULONG RelativeTo,
4856 /*IN*/ PCWSTR Path,
4857 /*IN*/ PRTL_QUERY_REGISTRY_TABLE QueryTable,
4858 /*IN*/ PVOID Context,
4859 /*IN*/ PVOID Environment /*OPTIONAL*/
4860);
4861
4862NTOSAPI VOID DDKAPI
4863RtlRetrieveUlong(
4864 /*IN OUT*/ PULONG DestinationAddress,
4865 /*IN*/ PULONG SourceAddress
4866);
4867
4868NTOSAPI VOID DDKAPI
4869RtlRetrieveUshort(
4870 /*IN OUT*/ PUSHORT DestinationAddress,
4871 /*IN*/ PUSHORT SourceAddress
4872);
4873
4874NTOSAPI VOID DDKAPI
4875RtlSetAllBits( /*IN*/ PRTL_BITMAP BitMapHeader );
4876
4877NTOSAPI VOID DDKAPI
4878RtlSetBit( PRTL_BITMAP BitMapHeader, ULONG BitNumber );
4879
4880NTOSAPI VOID DDKAPI
4881RtlSetBits(
4882 /*IN*/ PRTL_BITMAP BitMapHeader,
4883 /*IN*/ ULONG StartingIndex,
4884 /*IN*/ ULONG NumberToSet
4885);
4886
4887NTOSAPI NTSTATUS DDKAPI
4888RtlSetDaclSecurityDescriptor(
4889 /*IN OUT*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
4890 /*IN*/ BOOLEAN DaclPresent,
4891 /*IN*/ PACL Dacl /*OPTIONAL*/,
4892 /*IN*/ BOOLEAN DaclDefaulted /*OPTIONAL*/
4893);
4894
4895NTOSAPI VOID DDKAPI
4896RtlStoreUlong( /*IN*/ PULONG Address, /*IN*/ ULONG Value );
4897
4898NTOSAPI VOID DDKAPI
4899RtlStoreUlonglong( /*IN OUT*/ PULONGLONG Address, ULONGLONG Value );
4900
4901NTOSAPI VOID DDKAPI
4902RtlStoreUlongPtr( /*IN OUT*/ PULONG_PTR Address, /*IN*/ ULONG_PTR Value );
4903
4904NTOSAPI VOID DDKAPI
4905RtlStoreUshort( /*IN*/ PUSHORT Address, /*IN*/ USHORT Value );
4906
4907NTOSAPI NTSTATUS DDKAPI
4908RtlStringFromGUID( /*IN*/ REFGUID Guid, /*OUT*/ PUNICODE_STRING GuidString );
4909
4910#define RtlStringCbCopyA(dst, dst_len, src) strncpy(dst, src, dst_len)
4911#define RtlStringCbPrintfA(args...) snprintf(args)
4912#define RtlStringCbVPrintfA(args...) vsnprintf(args)
4913
4914NTOSAPI BOOLEAN DDKAPI
4915RtlTestBit( /*IN*/ PRTL_BITMAP BitMapHeader, /*IN*/ ULONG BitNumber );
4916
4917NTOSAPI BOOLEAN DDKAPI
4918RtlTimeFieldsToTime(
4919 /*IN*/ PTIME_FIELDS TimeFields,
4920 /*IN*/ PLARGE_INTEGER Time
4921);
4922
4923NTOSAPI VOID DDKAPI
4924RtlTimeToTimeFields(
4925 /*IN*/ PLARGE_INTEGER Time,
4926 /*IN*/ PTIME_FIELDS TimeFields
4927);
4928
4929NTOSAPI ULONG DDKFASTAPI
4930RtlUlongByteSwap( /*IN*/ ULONG Source );
4931
4932NTOSAPI ULONGLONG DDKFASTAPI
4933RtlUlonglongByteSwap( /*IN*/ ULONGLONG Source );
4934
4935NTOSAPI ULONG DDKAPI
4936RtlUnicodeStringToAnsiSize( /*IN*/ PUNICODE_STRING UnicodeString );
4937
4938NTOSAPI NTSTATUS DDKAPI
4939RtlUnicodeStringToAnsiString(
4940 /*IN OUT*/ PANSI_STRING DestinationString,
4941 /*IN*/ PUNICODE_STRING SourceString,
4942 /*IN*/ BOOLEAN AllocateDestinationString
4943);
4944
4945NTOSAPI NTSTATUS DDKAPI
4946RtlUnicodeStringToInteger(
4947 /*IN*/ PUNICODE_STRING String,
4948 /*IN*/ ULONG Base /*OPTIONAL*/,
4949 /*OUT*/ PULONG Value
4950);
4951
4952NTOSAPI WCHAR DDKAPI
4953RtlUpcaseUnicodeChar( /*IN*/ WCHAR SourceCharacter );
4954
4955NTOSAPI NTSTATUS DDKAPI
4956RtlUpcaseUnicodeString(
4957 /*IN OUT*/ PUNICODE_STRING DestinationString /*OPTIONAL*/,
4958 /*IN*/ PCUNICODE_STRING SourceString,
4959 /*IN*/ BOOLEAN AllocateDestinationString
4960);
4961
4962NTOSAPI CHAR DDKAPI
4963RtlUpperChar( /*IN*/ CHAR Character );
4964
4965NTOSAPI VOID DDKAPI
4966RtlUpperString(
4967 /*IN OUT*/ PSTRING DestinationString,
4968 /*IN*/ PSTRING SourceString
4969);
4970
4971NTOSAPI USHORT DDKFASTAPI
4972RtlUshortByteSwap( /*IN*/ USHORT Source );
4973
4974NTOSAPI BOOLEAN DDKAPI
4975RtlValidRelativeSecurityDescriptor(
4976 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptorInput,
4977 /*IN*/ ULONG SecurityDescriptorLength,
4978 /*IN*/ SECURITY_INFORMATION RequiredInformation
4979);
4980
4981NTOSAPI BOOLEAN DDKAPI
4982RtlValidSecurityDescriptor( /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor );
4983
4984NTOSAPI NTSTATUS DDKAPI
4985RtlVerifyVersionInfo(
4986 /*IN*/ PRTL_OSVERSIONINFOEXW VersionInfo,
4987 /*IN*/ ULONG TypeMask,
4988 /*IN*/ ULONGLONG ConditionMask
4989);
4990
4991NTOSAPI NTSTATUS DDKAPI
4992RtlVolumeDeviceToDosName(
4993 /*IN*/ PVOID VolumeDeviceObject,
4994 /*OUT*/ PUNICODE_STRING DosName
4995);
4996
4997NTOSAPI ULONG DDKAPI
4998RtlWalkFrameChain(
4999 /*OUT*/ PVOID *Callers,
5000 /*IN*/ ULONG Count,
5001 /*IN*/ ULONG Flags
5002);
5003
5004NTOSAPI NTSTATUS DDKAPI
5005RtlWriteRegistryValue(
5006 /*IN*/ ULONG RelativeTo,
5007 /*IN*/ PCWSTR Path,
5008 /*IN*/ PCWSTR ValueName,
5009 /*IN*/ ULONG ValueType,
5010 /*IN*/ PVOID ValueData,
5011 /*IN*/ ULONG ValueLength
5012);
5013
5014NTOSAPI ULONG DDKAPI
5015RtlxUnicodeStringToAnsiSize( /*IN*/ PUNICODE_STRING UnicodeString );
5016
5017#ifndef RtlZeroMemory
5018/* VOID RtlZeroMemory(
5019 * IN VOID UNALIGNED *Destination,
5020 * IN SIZE_T Length
5021 * )
5022 */
5023#define RtlZeroMemory(Destination, Length) \
5024 memset(Destination, 0, Length)
5025#endif
5026
5027#ifndef RtlZeroBytes
5028#define RtlZeroBytes RtlZeroMemory
5029#endif
5030
5031
5032/** Executive support routines **/
5033
5034NTOSAPI VOID DDKFASTAPI
5035ExAcquireFastMutex( /*IN*/ PFAST_MUTEX FastMutex );
5036
5037NTOSAPI VOID DDKFASTAPI
5038ExAcquireFastMutexUnsafe( /*IN*/ PFAST_MUTEX FastMutex );
5039
5040NTOSAPI BOOLEAN DDKAPI
5041ExAcquireResourceExclusiveLite(
5042 /*IN*/ PERESOURCE Resource,
5043 /*IN*/ BOOLEAN Wait
5044);
5045
5046NTOSAPI BOOLEAN DDKAPI
5047ExAcquireResourceSharedLite( /*IN*/ PERESOURCE Resource, /*IN*/ BOOLEAN Wait );
5048
5049NTOSAPI BOOLEAN DDKAPI
5050ExAcquireSharedStarveExclusive(
5051 /*IN*/ PERESOURCE Resource,
5052 /*IN*/ BOOLEAN Wait
5053);
5054
5055NTOSAPI BOOLEAN DDKAPI
5056ExAcquireSharedWaitForExclusive(
5057 /*IN*/ PERESOURCE Resource,
5058 /*IN*/ BOOLEAN Wait
5059);
5060
5061NTOSAPI PSINGLE_LIST_ENTRY DDKFASTAPI
5062ExInterlockedPopEntrySList(
5063 /*IN*/ PSLIST_HEADER ListHead,
5064 /*IN*/ PKSPIN_LOCK Lock
5065);
5066
5067NTOSAPI PSINGLE_LIST_ENTRY DDKFASTAPI
5068ExInterlockedPushEntrySList(
5069 /*IN*/ PSLIST_HEADER ListHead,
5070 /*IN*/ PSINGLE_LIST_ENTRY ListEntry,
5071 /*IN*/ PKSPIN_LOCK Lock
5072);
5073
5074#if (__USE_NTOSKRNL__) && (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
5075#define ExInterlockedPopEntrySList(_ListHead, _Lock) \
5076 InterlockedPopEntrySList(_ListHead)
5077
5078#define ExInterlockedPushEntrySList(_ListHead, _ListEntry, _Lock) \
5079 InterlockedPushEntrySList(_ListHead, _ListEntry)
5080#endif /* __USE_NTOSKRNL__ */
5081
5082#define ExQueryDepthSList(ListHead) QueryDepthSList(ListHead)
5083
5084static __inline__ PVOID
5085ExAllocateFromNPagedLookasideList( /*IN*/ PNPAGED_LOOKASIDE_LIST Lookaside )
5086{
5087 PVOID Entry;
5088
5089 Lookaside->TotalAllocates++;
5090 Entry = ExInterlockedPopEntrySList (&Lookaside->ListHead, &Lookaside->Obsoleted);
5091 if (Entry == NULL)
5092 { Lookaside->_DDK_DUMMYUNION_MEMBER(AllocateMisses)++;
5093 Entry = (Lookaside->Allocate)(Lookaside->Type, Lookaside->Size, Lookaside->Tag);
5094 }
5095 return Entry;
5096}
5097
5098static __inline__ VOID
5099ExFreeToNPagedLookasideList(
5100 /*IN*/ PNPAGED_LOOKASIDE_LIST Lookaside,
5101 /*IN*/ PVOID Entry)
5102{
5103 Lookaside->TotalFrees++;
5104 if (ExQueryDepthSList(&Lookaside->ListHead) >= Lookaside->Depth)
5105 { Lookaside->_DDK_DUMMYUNION_N_MEMBER(2,FreeMisses)++;
5106 (Lookaside->Free)(Entry);
5107 }
5108 else
5109 { ExInterlockedPushEntrySList(
5110 &Lookaside->ListHead, (PSLIST_ENTRY)Entry, &Lookaside->Obsoleted
5111 );
5112 }
5113}
5114
5115#if (__USE_NTOSKRNL__) && (_WIN32_WINNT >= _WIN32_WINNT_WINXP)
5116
5117static __inline__ PVOID
5118ExAllocateFromPagedLookasideList(
5119 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside)
5120{
5121 PVOID Entry;
5122
5123 Lookaside->TotalAllocates++;
5124 Entry = InterlockedPopEntrySList(&Lookaside->ListHead);
5125 if (Entry == NULL)
5126 { Lookaside->_DDK_DUMMYUNION_MEMBER(AllocateMisses)++;
5127 Entry = (Lookaside->Allocate)(Lookaside->Type, Lookaside->Size, Lookaside->Tag);
5128 }
5129 return Entry;
5130}
5131
5132static __inline__ VOID
5133ExFreeToPagedLookasideList(
5134 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside,
5135 /*IN*/ PVOID Entry)
5136{
5137 Lookaside->TotalFrees++;
5138 if (ExQueryDepthSList(&Lookaside->ListHead) >= Lookaside->Depth)
5139 { Lookaside->_DDK_DUMMYUNION_N_MEMBER(2,FreeMisses)++;
5140 (Lookaside->Free)(Entry);
5141 }
5142 else
5143 { InterlockedPushEntrySList(&Lookaside->ListHead, (PSLIST_ENTRY)Entry);
5144 }
5145}
5146
5147#else /* (__USE_NTOSKRNL__) && (_WIN32_WINNT >= _WIN32_WINNT_WINXP) */
5148
5149NTOSAPI PVOID DDKAPI
5150ExAllocateFromPagedLookasideList( /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside );
5151
5152NTOSAPI VOID DDKAPI
5153ExFreeToPagedLookasideList(
5154 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside,
5155 /*IN*/ PVOID Entry
5156);
5157
5158#endif /* (__USE_NTOSKRNL__) && (_WIN32_WINNT >= _WIN32_WINNT_WINXP) */
5159
5160NTOSAPI PVOID DDKAPI
5161ExAllocatePoolWithQuotaTag(
5162 /*IN*/ POOL_TYPE PoolType,
5163 /*IN*/ SIZE_T NumberOfBytes,
5164 /*IN*/ ULONG Tag
5165);
5166
5167NTOSAPI PVOID DDKAPI
5168ExAllocatePoolWithTag(
5169 /*IN*/ POOL_TYPE PoolType,
5170 /*IN*/ SIZE_T NumberOfBytes,
5171 /*IN*/ ULONG Tag
5172);
5173
5174#ifdef POOL_TAGGING
5175
5176#define ExAllocatePoolWithQuota(p,n) ExAllocatePoolWithQuotaTag(p,n,' kdD')
5177#define ExAllocatePool(p,n) ExAllocatePoolWithTag(p,n,' kdD')
5178
5179#else /* !POOL_TAGGING */
5180
5181NTOSAPI PVOID DDKAPI
5182ExAllocatePool( /*IN*/ POOL_TYPE PoolType, /*IN*/ SIZE_T NumberOfBytes );
5183
5184NTOSAPI PVOID DDKAPI
5185ExAllocatePoolWithQuota( /*IN*/ POOL_TYPE PoolType, /*IN*/ SIZE_T NumberOfBytes );
5186
5187#endif /* POOL_TAGGING */
5188
5189NTOSAPI PVOID DDKAPI
5190ExAllocatePoolWithTagPriority(
5191 /*IN*/ POOL_TYPE PoolType,
5192 /*IN*/ SIZE_T NumberOfBytes,
5193 /*IN*/ ULONG Tag,
5194 /*IN*/ EX_POOL_PRIORITY Priority
5195);
5196
5197NTOSAPI VOID DDKAPI
5198ExConvertExclusiveToSharedLite( /*IN*/ PERESOURCE Resource );
5199
5200NTOSAPI NTSTATUS DDKAPI
5201ExCreateCallback(
5202 /*OUT*/ PCALLBACK_OBJECT *CallbackObject,
5203 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
5204 /*IN*/ BOOLEAN Create,
5205 /*IN*/ BOOLEAN AllowMultipleCallbacks
5206);
5207
5208NTOSAPI VOID DDKAPI
5209ExDeleteNPagedLookasideList( /*IN*/ PNPAGED_LOOKASIDE_LIST Lookaside );
5210
5211NTOSAPI VOID DDKAPI
5212ExDeletePagedLookasideList( /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside );
5213
5214NTOSAPI NTSTATUS DDKAPI
5215ExDeleteResourceLite( /*IN*/ PERESOURCE Resource );
5216
5217NTOSAPI VOID DDKAPI
5218ExFreePool( /*IN*/ PVOID P );
5219
5220#define PROTECTED_POOL 0x80000000
5221
5222#ifdef POOL_TAGGING
5223#define ExFreePool(P) ExFreePoolWithTag(P, 0)
5224#endif
5225
5226NTOSAPI VOID DDKAPI
5227ExFreePoolWithTag( /*IN*/ PVOID P, /*IN*/ ULONG Tag );
5228
5229/* ERESOURCE_THREAD ExGetCurrentResourceThread( VOID );
5230 */
5231#define ExGetCurrentResourceThread() ((ERESOURCE_THREAD) PsGetCurrentThread())
5232
5233NTOSAPI ULONG DDKAPI
5234ExGetExclusiveWaiterCount( /*IN*/ PERESOURCE Resource );
5235
5236NTOSAPI KPROCESSOR_MODE DDKAPI
5237ExGetPreviousMode( VOID );
5238
5239NTOSAPI ULONG DDKAPI
5240ExGetSharedWaiterCount( /*IN*/ PERESOURCE Resource );
5241
5242NTOSAPI VOID DDKAPI
5243KeInitializeEvent(
5244 /*IN*/ PRKEVENT Event,
5245 /*IN*/ EVENT_TYPE Type,
5246 /*IN*/ BOOLEAN State);
5247
5248/* VOID DDKAPI ExInitializeFastMutex( IN PFAST_MUTEX FastMutex )
5249 */
5250#define ExInitializeFastMutex(_FastMutex) \
5251 { (_FastMutex)->Count = 1; \
5252 (_FastMutex)->Owner = NULL; \
5253 (_FastMutex)->Contention = 0; \
5254 KeInitializeEvent(&(_FastMutex)->Event, SynchronizationEvent, FALSE); \
5255 }
5256
5257NTOSAPI VOID DDKAPI
5258ExInitializeNPagedLookasideList(
5259 /*IN*/ PNPAGED_LOOKASIDE_LIST Lookaside,
5260 /*IN*/ PALLOCATE_FUNCTION Allocate /*OPTIONAL*/,
5261 /*IN*/ PFREE_FUNCTION Free /*OPTIONAL*/,
5262 /*IN*/ ULONG Flags,
5263 /*IN*/ SIZE_T Size,
5264 /*IN*/ ULONG Tag,
5265 /*IN*/ USHORT Depth
5266);
5267
5268NTOSAPI VOID DDKAPI
5269ExInitializePagedLookasideList(
5270 /*IN*/ PPAGED_LOOKASIDE_LIST Lookaside,
5271 /*IN*/ PALLOCATE_FUNCTION Allocate /*OPTIONAL*/,
5272 /*IN*/ PFREE_FUNCTION Free /*OPTIONAL*/,
5273 /*IN*/ ULONG Flags,
5274 /*IN*/ SIZE_T Size,
5275 /*IN*/ ULONG Tag,
5276 /*IN*/ USHORT Depth
5277);
5278
5279NTOSAPI NTSTATUS DDKAPI
5280ExInitializeResourceLite( /*IN*/ PERESOURCE Resource );
5281
5282/* VOID InitializeSListHead( IN PSLIST_HEADER SListHead )
5283 */
5284#define InitializeSListHead(_SListHead) \
5285 (_SListHead)->Alignment = 0
5286
5287#define ExInitializeSListHead InitializeSListHead
5288
5289NTOSAPI LARGE_INTEGER DDKAPI
5290ExInterlockedAddLargeInteger(
5291 /*IN*/ PLARGE_INTEGER Addend,
5292 /*IN*/ LARGE_INTEGER Increment,
5293 /*IN*/ PKSPIN_LOCK Lock
5294);
5295
5296NTOSAPI VOID DDKFASTAPI
5297ExInterlockedAddLargeStatistic(
5298 /*IN*/ PLARGE_INTEGER Addend,
5299 /*IN*/ ULONG Increment
5300);
5301
5302NTOSAPI ULONG DDKAPI
5303ExInterlockedAddUlong(
5304 /*IN*/ PULONG Addend,
5305 /*IN*/ ULONG Increment,
5306 PKSPIN_LOCK Lock
5307);
5308
5309NTOSAPI ULONG DDKFASTAPI
5310ExfInterlockedAddUlong(
5311 /*IN*/ PULONG Addend,
5312 /*IN*/ ULONG Increment,
5313 PKSPIN_LOCK Lock
5314);
5315
5316NTOSAPI LONGLONG DDKFASTAPI
5317ExInterlockedCompareExchange64(
5318 /*IN OUT*/ PLONGLONG Destination,
5319 /*IN*/ PLONGLONG Exchange,
5320 /*IN*/ PLONGLONG Comparand,
5321 /*IN*/ PKSPIN_LOCK Lock
5322);
5323
5324NTOSAPI PSINGLE_LIST_ENTRY DDKFASTAPI
5325ExInterlockedFlushSList( /*IN*/ PSLIST_HEADER ListHead );
5326
5327NTOSAPI PLIST_ENTRY DDKAPI
5328ExInterlockedInsertHeadList(
5329 /*IN*/ PLIST_ENTRY ListHead,
5330 /*IN*/ PLIST_ENTRY ListEntry,
5331 /*IN*/ PKSPIN_LOCK Lock
5332);
5333
5334NTOSAPI PLIST_ENTRY DDKFASTAPI
5335ExfInterlockedInsertHeadList(
5336 /*IN*/ PLIST_ENTRY ListHead,
5337 /*IN*/ PLIST_ENTRY ListEntry,
5338 /*IN*/ PKSPIN_LOCK Lock
5339);
5340
5341NTOSAPI PLIST_ENTRY DDKAPI
5342ExInterlockedInsertTailList(
5343 /*IN*/ PLIST_ENTRY ListHead,
5344 /*IN*/ PLIST_ENTRY ListEntry,
5345 /*IN*/ PKSPIN_LOCK Lock
5346);
5347
5348NTOSAPI PLIST_ENTRY DDKFASTAPI
5349ExfInterlockedInsertTailList(
5350 /*IN*/ PLIST_ENTRY ListHead,
5351 /*IN*/ PLIST_ENTRY ListEntry,
5352 /*IN*/ PKSPIN_LOCK Lock
5353);
5354
5355NTOSAPI PSINGLE_LIST_ENTRY DDKAPI
5356ExInterlockedPopEntryList(
5357 /*IN*/ PSINGLE_LIST_ENTRY ListHead,
5358 /*IN*/ PKSPIN_LOCK Lock
5359);
5360
5361NTOSAPI PSINGLE_LIST_ENTRY DDKFASTAPI
5362ExfInterlockedPopEntryList(
5363 /*IN*/ PSINGLE_LIST_ENTRY ListHead,
5364 /*IN*/ PKSPIN_LOCK Lock
5365);
5366
5367NTOSAPI PSINGLE_LIST_ENTRY DDKAPI
5368ExInterlockedPushEntryList(
5369 /*IN*/ PSINGLE_LIST_ENTRY ListHead,
5370 /*IN*/ PSINGLE_LIST_ENTRY ListEntry,
5371 /*IN*/ PKSPIN_LOCK Lock
5372);
5373
5374NTOSAPI PSINGLE_LIST_ENTRY DDKFASTAPI
5375ExfInterlockedPushEntryList(
5376 /*IN*/ PSINGLE_LIST_ENTRY ListHead,
5377 /*IN*/ PSINGLE_LIST_ENTRY ListEntry,
5378 /*IN*/ PKSPIN_LOCK Lock
5379);
5380
5381NTOSAPI PLIST_ENTRY DDKAPI
5382ExInterlockedRemoveHeadList(
5383 /*IN*/ PLIST_ENTRY ListHead,
5384 /*IN*/ PKSPIN_LOCK Lock
5385);
5386
5387NTOSAPI PLIST_ENTRY DDKFASTAPI
5388ExfInterlockedRemoveHeadList(
5389 /*IN*/ PLIST_ENTRY ListHead,
5390 /*IN*/ PKSPIN_LOCK Lock
5391);
5392
5393NTOSAPI BOOLEAN DDKAPI
5394ExIsProcessorFeaturePresent( /*IN*/ ULONG ProcessorFeature );
5395
5396NTOSAPI BOOLEAN DDKAPI
5397ExIsResourceAcquiredExclusiveLite( /*IN*/ PERESOURCE Resource );
5398
5399NTOSAPI USHORT DDKAPI
5400ExIsResourceAcquiredLite( /*IN*/ PERESOURCE Resource );
5401
5402NTOSAPI USHORT DDKAPI
5403ExIsResourceAcquiredSharedLite( /*IN*/ PERESOURCE Resource );
5404
5405NTOSAPI VOID DDKAPI
5406ExLocalTimeToSystemTime(
5407 /*IN*/ PLARGE_INTEGER LocalTime,
5408 /*OUT*/ PLARGE_INTEGER SystemTime
5409);
5410
5411NTOSAPI VOID DDKAPI
5412ExNotifyCallback(
5413 /*IN*/ PCALLBACK_OBJECT CallbackObject,
5414 /*IN*/ PVOID Argument1,
5415 /*IN*/ PVOID Argument2
5416);
5417
5418NTOSAPI VOID DDKAPI
5419ExRaiseAccessViolation( VOID );
5420
5421NTOSAPI VOID DDKAPI
5422ExRaiseDatatypeMisalignment( VOID );
5423
5424NTOSAPI VOID DDKAPI
5425ExRaiseStatus( /*IN*/ NTSTATUS Status );
5426
5427NTOSAPI PVOID DDKAPI
5428ExRegisterCallback(
5429 /*IN*/ PCALLBACK_OBJECT CallbackObject,
5430 /*IN*/ PCALLBACK_FUNCTION CallbackFunction,
5431 /*IN*/ PVOID CallbackContext
5432);
5433
5434NTOSAPI VOID DDKAPI
5435ExReinitializeResourceLite( /*IN*/ PERESOURCE Resource );
5436
5437NTOSAPI VOID DDKFASTAPI
5438ExReleaseFastMutex( /*IN*/ PFAST_MUTEX FastMutex );
5439
5440NTOSAPI VOID DDKFASTAPI
5441ExReleaseFastMutexUnsafe( /*IN*/ PFAST_MUTEX FastMutex );
5442
5443NTOSAPI VOID DDKAPI
5444ExReleaseResourceForThreadLite(
5445 /*IN*/ PERESOURCE Resource,
5446 /*IN*/ ERESOURCE_THREAD ResourceThreadId
5447);
5448
5449NTOSAPI VOID DDKFASTAPI
5450ExReleaseResourceLite( /*IN*/ PERESOURCE Resource );
5451
5452NTOSAPI VOID DDKAPI
5453ExSetResourceOwnerPointer( /*IN*/ PERESOURCE Resource,
5454 /*IN*/ PVOID OwnerPointer
5455);
5456
5457NTOSAPI ULONG DDKAPI
5458ExSetTimerResolution( /*IN*/ ULONG DesiredTime, /*IN*/ BOOLEAN SetResolution );
5459
5460NTOSAPI VOID DDKAPI
5461ExSystemTimeToLocalTime(
5462 /*IN*/ PLARGE_INTEGER SystemTime,
5463 /*OUT*/ PLARGE_INTEGER LocalTime
5464);
5465
5466NTOSAPI BOOLEAN DDKFASTAPI
5467ExTryToAcquireFastMutex( /*IN*/ PFAST_MUTEX FastMutex );
5468
5469NTOSAPI BOOLEAN DDKAPI
5470ExTryToAcquireResourceExclusiveLite( /*IN*/ PERESOURCE Resource );
5471
5472NTOSAPI VOID DDKAPI
5473ExUnregisterCallback( /*IN*/ PVOID CbRegistration );
5474
5475NTOSAPI NTSTATUS DDKAPI
5476ExUuidCreate( /*OUT*/ UUID *Uuid );
5477
5478NTOSAPI BOOLEAN DDKAPI
5479ExVerifySuite( /*IN*/ SUITE_TYPE SuiteType );
5480
5481#ifdef DBG
5482# define PAGED_CODE() \
5483 { if (KeGetCurrentIrql() > APC_LEVEL) \
5484 { KdPrint( ("NTDDK: Pageable code called at IRQL > APC_LEVEL (%d)\n", KeGetCurrentIrql() )); \
5485 ASSERT(FALSE); \
5486 } \
5487 }
5488#else
5489# define PAGED_CODE()
5490#endif
5491
5492NTOSAPI VOID DDKAPI
5493ProbeForRead(
5494 /*IN*/ CONST VOID *Address,
5495 /*IN*/ ULONG Length,
5496 /*IN*/ ULONG Alignment
5497);
5498
5499NTOSAPI VOID DDKAPI
5500ProbeForWrite(
5501 /*IN*/ CONST VOID *Address,
5502 /*IN*/ ULONG Length,
5503 /*IN*/ ULONG Alignment
5504);
5505
5506
5507/** Configuration manager routines **/
5508
5509NTOSAPI NTSTATUS DDKAPI
5510CmRegisterCallback(
5511 /*IN*/ PEX_CALLBACK_FUNCTION Function,
5512 /*IN*/ PVOID Context,
5513 /*IN OUT*/ PLARGE_INTEGER Cookie
5514);
5515
5516NTOSAPI NTSTATUS DDKAPI
5517CmUnRegisterCallback( /*IN*/ LARGE_INTEGER Cookie );
5518
5519
5520/** Filesystem runtime library routines **/
5521
5522NTOSAPI BOOLEAN DDKAPI
5523FsRtlIsTotalDeviceFailure( /*IN*/ NTSTATUS Status );
5524
5525
5526
5527/** Hardware abstraction layer routines **/
5528
5529NTOSAPI VOID DDKFASTAPI
5530HalExamineMBR(
5531 /*IN*/ PDEVICE_OBJECT DeviceObject,
5532 /*IN*/ ULONG SectorSize,
5533 /*IN*/ ULONG MBRTypeIdentifier,
5534 /*OUT*/ PVOID Buffer
5535);
5536
5537NTOSAPI VOID DDKAPI
5538READ_PORT_BUFFER_UCHAR(
5539 /*IN*/ PUCHAR Port,
5540 /*IN*/ PUCHAR Buffer,
5541 /*IN*/ ULONG Count
5542);
5543
5544NTOSAPI VOID DDKAPI
5545READ_PORT_BUFFER_ULONG(
5546 /*IN*/ PULONG Port,
5547 /*IN*/ PULONG Buffer,
5548 /*IN*/ ULONG Count
5549);
5550
5551NTOSAPI VOID DDKAPI
5552READ_PORT_BUFFER_USHORT(
5553 /*IN*/ PUSHORT Port,
5554 /*IN*/ PUSHORT Buffer,
5555 /*IN*/ ULONG Count
5556);
5557
5558NTOSAPI UCHAR DDKAPI
5559READ_PORT_UCHAR( /*IN*/ PUCHAR Port );
5560
5561NTOSAPI ULONG DDKAPI
5562READ_PORT_ULONG( /*IN*/ PULONG Port );
5563
5564NTOSAPI USHORT DDKAPI
5565READ_PORT_USHORT( /*IN*/ PUSHORT Port );
5566
5567NTOSAPI VOID DDKAPI
5568READ_REGISTER_BUFFER_UCHAR(
5569 /*IN*/ PUCHAR Register,
5570 /*IN*/ PUCHAR Buffer,
5571 /*IN*/ ULONG Count
5572);
5573
5574NTOSAPI VOID DDKAPI
5575READ_REGISTER_BUFFER_ULONG(
5576 /*IN*/ PULONG Register,
5577 /*IN*/ PULONG Buffer,
5578 /*IN*/ ULONG Count
5579);
5580
5581NTOSAPI VOID DDKAPI
5582READ_REGISTER_BUFFER_USHORT(
5583 /*IN*/ PUSHORT Register,
5584 /*IN*/ PUSHORT Buffer,
5585 /*IN*/ ULONG Count
5586);
5587
5588NTOSAPI UCHAR DDKAPI
5589READ_REGISTER_UCHAR( /*IN*/ PUCHAR Register );
5590
5591NTOSAPI ULONG DDKAPI
5592READ_REGISTER_ULONG( /*IN*/ PULONG Register );
5593
5594NTOSAPI USHORT DDKAPI
5595READ_REGISTER_USHORT( /*IN*/ PUSHORT Register );
5596
5597NTOSAPI VOID DDKAPI
5598WRITE_PORT_BUFFER_UCHAR(
5599 /*IN*/ PUCHAR Port,
5600 /*IN*/ PUCHAR Buffer,
5601 /*IN*/ ULONG Count
5602);
5603
5604NTOSAPI VOID DDKAPI
5605WRITE_PORT_BUFFER_ULONG(
5606 /*IN*/ PULONG Port,
5607 /*IN*/ PULONG Buffer,
5608 /*IN*/ ULONG Count
5609);
5610
5611NTOSAPI VOID DDKAPI
5612WRITE_PORT_BUFFER_USHORT(
5613 /*IN*/ PUSHORT Port,
5614 /*IN*/ PUSHORT Buffer,
5615 /*IN*/ ULONG Count
5616);
5617
5618NTOSAPI VOID DDKAPI
5619WRITE_PORT_UCHAR( /*IN*/ PUCHAR Port, /*IN*/ UCHAR Value );
5620
5621NTOSAPI VOID DDKAPI
5622WRITE_PORT_ULONG( /*IN*/ PULONG Port, /*IN*/ ULONG Value );
5623
5624NTOSAPI VOID DDKAPI
5625WRITE_PORT_USHORT( /*IN*/ PUSHORT Port, /*IN*/ USHORT Value );
5626
5627NTOSAPI VOID DDKAPI
5628WRITE_REGISTER_BUFFER_UCHAR(
5629 /*IN*/ PUCHAR Register,
5630 /*IN*/ PUCHAR Buffer,
5631 /*IN*/ ULONG Count
5632);
5633
5634NTOSAPI VOID DDKAPI
5635WRITE_REGISTER_BUFFER_ULONG(
5636 /*IN*/ PULONG Register,
5637 /*IN*/ PULONG Buffer,
5638 /*IN*/ ULONG Count
5639);
5640
5641NTOSAPI VOID DDKAPI
5642WRITE_REGISTER_BUFFER_USHORT(
5643 /*IN*/ PUSHORT Register,
5644 /*IN*/ PUSHORT Buffer,
5645 /*IN*/ ULONG Count
5646);
5647
5648NTOSAPI VOID DDKAPI
5649WRITE_REGISTER_UCHAR( /*IN*/ PUCHAR Register, /*IN*/ UCHAR Value );
5650
5651NTOSAPI VOID DDKAPI
5652WRITE_REGISTER_ULONG( /*IN*/ PULONG Register, /*IN*/ ULONG Value );
5653
5654NTOSAPI VOID DDKAPI
5655WRITE_REGISTER_USHORT( /*IN*/ PUSHORT Register, /*IN*/ USHORT Value );
5656
5657/** I/O manager routines **/
5658
5659NTOSAPI VOID DDKAPI
5660IoAcquireCancelSpinLock( /*OUT*/ PKIRQL Irql );
5661
5662NTOSAPI NTSTATUS DDKAPI
5663IoAcquireRemoveLockEx(
5664 /*IN*/ PIO_REMOVE_LOCK RemoveLock,
5665 /*IN*/ PVOID Tag /*OPTIONAL*/,
5666 /*IN*/ PCSTR File,
5667 /*IN*/ ULONG Line,
5668 /*IN*/ ULONG RemlockSize
5669);
5670
5671/* NTSTATUS IoAcquireRemoveLock(
5672 * IN PIO_REMOVE_LOCK RemoveLock,
5673 * IN PVOID Tag OPTIONAL
5674 * )
5675 */
5676#define IoAcquireRemoveLock(_RemoveLock, _Tag) \
5677 IoAcquireRemoveLockEx(_RemoveLock, _Tag, __FILE__, __LINE__, sizeof(IO_REMOVE_LOCK))
5678
5679/* VOID IoAdjustPagingPathCount( IN PLONG Count, IN BOOLEAN Increment )
5680 */
5681#define IoAdjustPagingPathCount(_Count, _Increment) \
5682 { if (_Increment) \
5683 { InterlockedIncrement(_Count); \
5684 } \
5685 else \
5686 { InterlockedDecrement(_Count); \
5687 } \
5688 }
5689
5690NTOSAPI VOID DDKAPI
5691IoAllocateController(
5692 /*IN*/ PCONTROLLER_OBJECT ControllerObject,
5693 /*IN*/ PDEVICE_OBJECT DeviceObject,
5694 /*IN*/ PDRIVER_CONTROL ExecutionRoutine,
5695 /*IN*/ PVOID Context
5696);
5697
5698NTOSAPI NTSTATUS DDKAPI
5699IoAllocateDriverObjectExtension(
5700 /*IN*/ PDRIVER_OBJECT DriverObject,
5701 /*IN*/ PVOID ClientIdentificationAddress,
5702 /*IN*/ ULONG DriverObjectExtensionSize,
5703 /*OUT*/ PVOID *DriverObjectExtension
5704);
5705
5706typedef
5707struct _IO_ERROR_LOG_PACKET
5708{ UCHAR MajorFunctionCode;
5709 UCHAR RetryCount;
5710 USHORT DumpDataSize;
5711 USHORT NumberOfStrings;
5712 USHORT StringOffset;
5713 USHORT EventCategory;
5714 NTSTATUS ErrorCode;
5715 ULONG UniqueErrorValue;
5716 NTSTATUS FinalStatus;
5717 ULONG SequenceNumber;
5718 ULONG IoControlCode;
5719 LARGE_INTEGER DeviceOffset;
5720 ULONG DumpData[1];
5721} IO_ERROR_LOG_PACKET, *PIO_ERROR_LOG_PACKET;
5722
5723NTOSAPI PVOID DDKAPI
5724IoAllocateErrorLogEntry( /*IN*/ PVOID IoObject, /*IN*/ UCHAR EntrySize );
5725
5726NTOSAPI PIRP DDKAPI
5727IoAllocateIrp( /*IN*/ CCHAR StackSize, /*IN*/ BOOLEAN ChargeQuota );
5728
5729NTOSAPI PMDL DDKAPI
5730IoAllocateMdl(
5731 /*IN*/ PVOID VirtualAddress,
5732 /*IN*/ ULONG Length,
5733 /*IN*/ BOOLEAN SecondaryBuffer,
5734 /*IN*/ BOOLEAN ChargeQuota,
5735 /*IN OUT*/ PIRP Irp /*OPTIONAL*/
5736);
5737
5738NTOSAPI PIO_WORKITEM DDKAPI
5739IoAllocateWorkItem( /*IN*/ PDEVICE_OBJECT DeviceObject );
5740
5741/* VOID IoAssignArcName(
5742 * IN PUNICODE_STRING ArcName,
5743 * IN PUNICODE_STRING DeviceName
5744 * )
5745 */
5746#define IoAssignArcName(_ArcName, _DeviceName) \
5747 (IoCreateSymbolicLink((_ArcName), (_DeviceName)))
5748
5749NTOSAPI NTSTATUS DDKAPI
5750IoAttachDevice(
5751 /*IN*/ PDEVICE_OBJECT SourceDevice,
5752 /*IN*/ PUNICODE_STRING TargetDevice,
5753 /*OUT*/ PDEVICE_OBJECT *AttachedDevice
5754);
5755
5756NTOSAPI PDEVICE_OBJECT DDKAPI
5757IoAttachDeviceToDeviceStack(
5758 /*IN*/ PDEVICE_OBJECT SourceDevice,
5759 /*IN*/ PDEVICE_OBJECT TargetDevice
5760);
5761
5762NTOSAPI PIRP DDKAPI
5763IoBuildAsynchronousFsdRequest(
5764 /*IN*/ ULONG MajorFunction,
5765 /*IN*/ PDEVICE_OBJECT DeviceObject,
5766 /*IN OUT*/ PVOID Buffer /*OPTIONAL*/,
5767 /*IN*/ ULONG Length /*OPTIONAL*/,
5768 /*IN*/ PLARGE_INTEGER StartingOffset /*OPTIONAL*/,
5769 /*IN*/ PIO_STATUS_BLOCK IoStatusBlock /*OPTIONAL*/
5770);
5771
5772NTOSAPI PIRP DDKAPI
5773IoBuildDeviceIoControlRequest(
5774 /*IN*/ ULONG IoControlCode,
5775 /*IN*/ PDEVICE_OBJECT DeviceObject,
5776 /*IN*/ PVOID InputBuffer /*OPTIONAL*/,
5777 /*IN*/ ULONG InputBufferLength,
5778 /*OUT*/ PVOID OutputBuffer /*OPTIONAL*/,
5779 /*IN*/ ULONG OutputBufferLength,
5780 /*IN*/ BOOLEAN InternalDeviceIoControl,
5781 /*IN*/ PKEVENT Event,
5782 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock
5783);
5784
5785NTOSAPI VOID DDKAPI
5786IoBuildPartialMdl(
5787 /*IN*/ PMDL SourceMdl,
5788 /*IN OUT*/ PMDL TargetMdl,
5789 /*IN*/ PVOID VirtualAddress,
5790 /*IN*/ ULONG Length
5791);
5792
5793NTOSAPI PIRP DDKAPI
5794IoBuildSynchronousFsdRequest(
5795 /*IN*/ ULONG MajorFunction,
5796 /*IN*/ PDEVICE_OBJECT DeviceObject,
5797 /*IN OUT*/ PVOID Buffer /*OPTIONAL*/,
5798 /*IN*/ ULONG Length /*OPTIONAL*/,
5799 /*IN*/ PLARGE_INTEGER StartingOffset /*OPTIONAL*/,
5800 /*IN*/ PKEVENT Event,
5801 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock
5802);
5803
5804NTOSAPI NTSTATUS DDKFASTAPI
5805IofCallDriver( /*IN*/ PDEVICE_OBJECT DeviceObject, /*IN OUT*/ PIRP Irp );
5806
5807/* NTSTATUS IoCallDriver(
5808 * IN PDEVICE_OBJECT DeviceObject,
5809 * IN OUT PIRP Irp)
5810 */
5811#define IoCallDriver IofCallDriver
5812
5813NTOSAPI VOID DDKAPI
5814IoCancelFileOpen(
5815 /*IN*/ PDEVICE_OBJECT DeviceObject,
5816 /*IN*/ PFILE_OBJECT FileObject
5817);
5818
5819NTOSAPI BOOLEAN DDKAPI
5820IoCancelIrp( /*IN*/ PIRP Irp );
5821
5822NTOSAPI NTSTATUS DDKAPI
5823IoCheckShareAccess(
5824 /*IN*/ ACCESS_MASK DesiredAccess,
5825 /*IN*/ ULONG DesiredShareAccess,
5826 /*IN OUT*/ PFILE_OBJECT FileObject,
5827 /*IN OUT*/ PSHARE_ACCESS ShareAccess,
5828 /*IN*/ BOOLEAN Update
5829);
5830
5831NTOSAPI VOID DDKFASTAPI
5832IofCompleteRequest( /*IN*/ PIRP Irp, /*IN*/ CCHAR PriorityBoost );
5833
5834/* VOID IoCompleteRequest( IN PIRP Irp, IN CCHAR PriorityBoost )
5835 */
5836#define IoCompleteRequest IofCompleteRequest
5837
5838NTOSAPI NTSTATUS DDKAPI
5839IoConnectInterrupt(
5840 /*OUT*/ PKINTERRUPT *InterruptObject,
5841 /*IN*/ PKSERVICE_ROUTINE ServiceRoutine,
5842 /*IN*/ PVOID ServiceContext,
5843 /*IN*/ PKSPIN_LOCK SpinLock /*OPTIONAL*/,
5844 /*IN*/ ULONG Vector,
5845 /*IN*/ KIRQL Irql,
5846 /*IN*/ KIRQL SynchronizeIrql,
5847 /*IN*/ KINTERRUPT_MODE InterruptMode,
5848 /*IN*/ BOOLEAN ShareVector,
5849 /*IN*/ KAFFINITY ProcessorEnableMask,
5850 /*IN*/ BOOLEAN FloatingSave
5851);
5852
5853/* PIO_STACK_LOCATION IoGetCurrentIrpStackLocation( IN PIRP Irp )
5854 */
5855#define IoGetCurrentIrpStackLocation(_Irp) \
5856 ((_Irp)->Tail.Overlay.CurrentStackLocation)
5857
5858/* PIO_STACK_LOCATION IoGetNextIrpStackLocation( IN PIRP Irp )
5859 */
5860#define IoGetNextIrpStackLocation(_Irp) \
5861 ((_Irp)->Tail.Overlay.CurrentStackLocation - 1)
5862
5863/* VOID IoCopyCurrentIrpStackLocationToNext( IN PIRP Irp )
5864 */
5865#define IoCopyCurrentIrpStackLocationToNext(_Irp) \
5866 { PIO_STACK_LOCATION _IrpSp; \
5867 PIO_STACK_LOCATION _NextIrpSp; \
5868 _IrpSp = IoGetCurrentIrpStackLocation(_Irp); \
5869 _NextIrpSp = IoGetNextIrpStackLocation(_Irp); \
5870 RtlCopyMemory(_NextIrpSp, _IrpSp, \
5871 FIELD_OFFSET(IO_STACK_LOCATION, CompletionRoutine)); \
5872 _NextIrpSp->Control = 0; \
5873}
5874
5875NTOSAPI PCONTROLLER_OBJECT DDKAPI
5876IoCreateController( /*IN*/ ULONG Size );
5877
5878NTOSAPI NTSTATUS DDKAPI
5879IoCreateDevice(
5880 /*IN*/ PDRIVER_OBJECT DriverObject,
5881 /*IN*/ ULONG DeviceExtensionSize,
5882 /*IN*/ PUNICODE_STRING DeviceName /*OPTIONAL*/,
5883 /*IN*/ DEVICE_TYPE DeviceType,
5884 /*IN*/ ULONG DeviceCharacteristics,
5885 /*IN*/ BOOLEAN Exclusive,
5886 /*OUT*/ PDEVICE_OBJECT *DeviceObject
5887);
5888
5889NTOSAPI NTSTATUS DDKAPI
5890IoCreateDisk( /*IN*/ PDEVICE_OBJECT DeviceObject, /*IN*/ PCREATE_DISK Disk );
5891
5892NTOSAPI NTSTATUS DDKAPI
5893IoCreateFile(
5894 /*OUT*/ PHANDLE FileHandle,
5895 /*IN*/ ACCESS_MASK DesiredAccess,
5896 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
5897 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
5898 /*IN*/ PLARGE_INTEGER AllocationSize /*OPTIONAL*/,
5899 /*IN*/ ULONG FileAttributes,
5900 /*IN*/ ULONG ShareAccess,
5901 /*IN*/ ULONG Disposition,
5902 /*IN*/ ULONG CreateOptions,
5903 /*IN*/ PVOID EaBuffer /*OPTIONAL*/,
5904 /*IN*/ ULONG EaLength,
5905 /*IN*/ CREATE_FILE_TYPE CreateFileType,
5906 /*IN*/ PVOID ExtraCreateParameters /*OPTIONAL*/,
5907 /*IN*/ ULONG Options
5908);
5909
5910NTOSAPI PKEVENT DDKAPI
5911IoCreateNotificationEvent(
5912 /*IN*/ PUNICODE_STRING EventName,
5913 /*OUT*/ PHANDLE EventHandle
5914);
5915
5916NTOSAPI NTSTATUS DDKAPI
5917IoCreateSymbolicLink(
5918 /*IN*/ PUNICODE_STRING SymbolicLinkName,
5919 /*IN*/ PUNICODE_STRING DeviceName
5920);
5921
5922NTOSAPI PKEVENT DDKAPI
5923IoCreateSynchronizationEvent(
5924 /*IN*/ PUNICODE_STRING EventName,
5925 /*OUT*/ PHANDLE EventHandle
5926);
5927
5928NTOSAPI NTSTATUS DDKAPI
5929IoCreateUnprotectedSymbolicLink(
5930 /*IN*/ PUNICODE_STRING SymbolicLinkName,
5931 /*IN*/ PUNICODE_STRING DeviceName
5932);
5933
5934NTOSAPI VOID DDKAPI
5935IoCsqInitialize(
5936 PIO_CSQ Csq,
5937 /*IN*/ PIO_CSQ_INSERT_IRP CsqInsertIrp,
5938 /*IN*/ PIO_CSQ_REMOVE_IRP CsqRemoveIrp,
5939 /*IN*/ PIO_CSQ_PEEK_NEXT_IRP CsqPeekNextIrp,
5940 /*IN*/ PIO_CSQ_ACQUIRE_LOCK CsqAcquireLock,
5941 /*IN*/ PIO_CSQ_RELEASE_LOCK CsqReleaseLock,
5942 /*IN*/ PIO_CSQ_COMPLETE_CANCELED_IRP CsqCompleteCanceledIrp
5943);
5944
5945NTOSAPI VOID DDKAPI
5946IoCsqInsertIrp(
5947 /*IN*/ PIO_CSQ Csq,
5948 /*IN*/ PIRP Irp,
5949 /*IN*/ PIO_CSQ_IRP_CONTEXT Context
5950);
5951
5952NTOSAPI PIRP DDKAPI
5953IoCsqRemoveIrp( /*IN*/ PIO_CSQ Csq, /*IN*/ PIO_CSQ_IRP_CONTEXT Context );
5954
5955NTOSAPI PIRP DDKAPI
5956IoCsqRemoveNextIrp( /*IN*/ PIO_CSQ Csq, /*IN*/ PVOID PeekContext );
5957
5958NTOSAPI VOID DDKAPI
5959IoDeleteController( /*IN*/ PCONTROLLER_OBJECT ControllerObject );
5960
5961NTOSAPI VOID DDKAPI
5962IoDeleteDevice( /*IN*/ PDEVICE_OBJECT DeviceObject );
5963
5964NTOSAPI NTSTATUS DDKAPI
5965IoDeleteSymbolicLink( /*IN*/ PUNICODE_STRING SymbolicLinkName );
5966
5967/* VOID IoDeassignArcName( IN PUNICODE_STRING ArcName )
5968 */
5969#define IoDeassignArcName IoDeleteSymbolicLink
5970
5971NTOSAPI VOID DDKAPI
5972IoDetachDevice( /*IN OUT*/ PDEVICE_OBJECT TargetDevice );
5973
5974NTOSAPI VOID DDKAPI
5975IoDisconnectInterrupt( /*IN*/ PKINTERRUPT InterruptObject );
5976
5977NTOSAPI BOOLEAN DDKAPI
5978IoForwardIrpSynchronously( /*IN*/ PDEVICE_OBJECT DeviceObject, /*IN*/ PIRP Irp );
5979
5980#define IoForwardAndCatchIrp IoForwardIrpSynchronously
5981
5982NTOSAPI VOID DDKAPI
5983IoFreeController( /*IN*/ PCONTROLLER_OBJECT ControllerObject );
5984
5985NTOSAPI VOID DDKAPI
5986IoFreeErrorLogEntry( PVOID ElEntry );
5987
5988NTOSAPI VOID DDKAPI
5989IoFreeIrp( /*IN*/ PIRP Irp );
5990
5991NTOSAPI VOID DDKAPI
5992IoFreeMdl( /*IN*/ PMDL Mdl );
5993
5994NTOSAPI VOID DDKAPI
5995IoFreeWorkItem( /*IN*/ PIO_WORKITEM pIOWorkItem );
5996
5997NTOSAPI PDEVICE_OBJECT DDKAPI
5998IoGetAttachedDevice( /*IN*/ PDEVICE_OBJECT DeviceObject );
5999
6000NTOSAPI PDEVICE_OBJECT DDKAPI
6001IoGetAttachedDeviceReference( /*IN*/ PDEVICE_OBJECT DeviceObject );
6002
6003NTOSAPI NTSTATUS DDKAPI
6004IoGetBootDiskInformation(
6005 /*IN OUT*/ PBOOTDISK_INFORMATION BootDiskInformation,
6006 /*IN*/ ULONG Size
6007);
6008
6009NTOSAPI PCONFIGURATION_INFORMATION DDKAPI
6010IoGetConfigurationInformation( VOID );
6011
6012NTOSAPI PEPROCESS DDKAPI
6013IoGetCurrentProcess( VOID );
6014
6015NTOSAPI NTSTATUS DDKAPI
6016IoGetDeviceInterfaceAlias(
6017 /*IN*/ PUNICODE_STRING SymbolicLinkName,
6018 /*IN*/ CONST GUID *AliasInterfaceClassGuid,
6019 /*OUT*/ PUNICODE_STRING AliasSymbolicLinkName
6020);
6021
6022NTOSAPI NTSTATUS DDKAPI
6023IoGetDeviceInterfaces(
6024 /*IN*/ CONST GUID *InterfaceClassGuid,
6025 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject /*OPTIONAL*/,
6026 /*IN*/ ULONG Flags,
6027 /*OUT*/ PWSTR *SymbolicLinkList
6028);
6029
6030NTOSAPI NTSTATUS DDKAPI
6031IoGetDeviceObjectPointer(
6032 /*IN*/ PUNICODE_STRING ObjectName,
6033 /*IN*/ ACCESS_MASK DesiredAccess,
6034 /*OUT*/ PFILE_OBJECT *FileObject,
6035 /*OUT*/ PDEVICE_OBJECT *DeviceObject
6036);
6037
6038NTOSAPI NTSTATUS DDKAPI
6039IoGetDeviceProperty(
6040 /*IN*/ PDEVICE_OBJECT DeviceObject,
6041 /*IN*/ DEVICE_REGISTRY_PROPERTY DeviceProperty,
6042 /*IN*/ ULONG BufferLength,
6043 /*OUT*/ PVOID PropertyBuffer,
6044 /*OUT*/ PULONG ResultLength
6045);
6046
6047NTOSAPI PDEVICE_OBJECT DDKAPI
6048IoGetDeviceToVerify( /*IN*/ PETHREAD Thread );
6049
6050NTOSAPI PDMA_ADAPTER DDKAPI
6051IoGetDmaAdapter(
6052 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject,
6053 /*IN*/ PDEVICE_DESCRIPTION DeviceDescription,
6054 /*IN OUT*/ PULONG NumberOfMapRegisters
6055);
6056
6057NTOSAPI PVOID DDKAPI
6058IoGetDriverObjectExtension(
6059 /*IN*/ PDRIVER_OBJECT DriverObject,
6060 /*IN*/ PVOID ClientIdentificationAddress
6061);
6062
6063NTOSAPI PGENERIC_MAPPING DDKAPI
6064IoGetFileObjectGenericMapping( VOID );
6065
6066/* ULONG IoGetFunctionCodeFromCtlCode( IN ULONG ControlCode )
6067 */
6068#define IoGetFunctionCodeFromCtlCode(_ControlCode) \
6069 (((_ControlCode) >> 2) & 0x00000FFF)
6070
6071NTOSAPI PVOID DDKAPI
6072IoGetInitialStack( VOID );
6073
6074NTOSAPI PDEVICE_OBJECT DDKAPI
6075IoGetRelatedDeviceObject( /*IN*/ PFILE_OBJECT FileObject );
6076
6077NTOSAPI ULONG DDKAPI
6078IoGetRemainingStackSize( VOID );
6079
6080NTOSAPI VOID DDKAPI
6081IoGetStackLimits( /*OUT*/ PULONG_PTR LowLimit, /*OUT*/ PULONG_PTR HighLimit );
6082
6083NTOSAPI VOID DDKAPI
6084KeInitializeDpc(
6085 /*IN*/ PRKDPC Dpc,
6086 /*IN*/ PKDEFERRED_ROUTINE DeferredRoutine,
6087 /*IN*/ PVOID DeferredContext
6088);
6089
6090/* VOID IoInitializeDpcRequest(
6091 * IN PDEVICE_OBJECT DeviceObject,
6092 * IN PIO_DPC_ROUTINE DpcRoutine
6093 * )
6094 */
6095#define IoInitializeDpcRequest(_DeviceObject, _DpcRoutine) \
6096 KeInitializeDpc(&(_DeviceObject)->Dpc, \
6097 (PKDEFERRED_ROUTINE) (_DpcRoutine), _DeviceObject \
6098 )
6099
6100NTOSAPI VOID DDKAPI
6101IoInitializeIrp(
6102 /*IN OUT*/ PIRP Irp,
6103 /*IN*/ USHORT PacketSize,
6104 /*IN*/ CCHAR StackSize
6105);
6106
6107NTOSAPI VOID DDKAPI
6108IoInitializeRemoveLockEx(
6109 /*IN*/ PIO_REMOVE_LOCK Lock,
6110 /*IN*/ ULONG AllocateTag,
6111 /*IN*/ ULONG MaxLockedMinutes,
6112 /*IN*/ ULONG HighWatermark,
6113 /*IN*/ ULONG RemlockSize
6114);
6115
6116/* VOID IoInitializeRemoveLock(
6117 * IN PIO_REMOVE_LOCK Lock,
6118 * IN ULONG AllocateTag,
6119 * IN ULONG MaxLockedMinutes,
6120 * IN ULONG HighWatermark
6121 * )
6122 */
6123#define IoInitializeRemoveLock(Lock, AllocateTag, MaxLockedMinutes, HighWatermark) \
6124 IoInitializeRemoveLockEx(Lock, AllocateTag, MaxLockedMinutes, \
6125 HighWatermark, sizeof(IO_REMOVE_LOCK) \
6126 )
6127
6128NTOSAPI NTSTATUS DDKAPI
6129IoInitializeTimer(
6130 /*IN*/ PDEVICE_OBJECT DeviceObject,
6131 /*IN*/ PIO_TIMER_ROUTINE TimerRoutine,
6132 /*IN*/ PVOID Context
6133);
6134
6135NTOSAPI VOID DDKAPI
6136IoInvalidateDeviceRelations(
6137 /*IN*/ PDEVICE_OBJECT DeviceObject,
6138 /*IN*/ DEVICE_RELATION_TYPE Type
6139);
6140
6141NTOSAPI VOID DDKAPI
6142IoInvalidateDeviceState( /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject );
6143
6144NTOSAPI BOOLEAN DDKAPI
6145IoIs32bitProcess( /*IN*/ PIRP Irp /*OPTIONAL*/ );
6146
6147/* BOOLEAN IoIsErrorUserInduced( IN NTSTATUS Status )
6148 */
6149#define IoIsErrorUserInduced( Status ) \
6150 ((BOOLEAN)(((Status) == STATUS_DEVICE_NOT_READY) \
6151 || ((Status) == STATUS_IO_TIMEOUT) \
6152 || ((Status) == STATUS_MEDIA_WRITE_PROTECTED) \
6153 || ((Status) == STATUS_NO_MEDIA_IN_DEVICE) \
6154 || ((Status) == STATUS_VERIFY_REQUIRED) \
6155 || ((Status) == STATUS_UNRECOGNIZED_MEDIA) \
6156 || ((Status) == STATUS_WRONG_VOLUME)))
6157
6158NTOSAPI BOOLEAN DDKAPI
6159IoIsWdmVersionAvailable( /*IN*/ UCHAR MajorVersion, /*IN*/ UCHAR MinorVersion );
6160
6161NTOSAPI PIRP DDKAPI
6162IoMakeAssociatedIrp( /*IN*/ PIRP Irp, /*IN*/ CCHAR StackSize );
6163
6164/* VOID IoMarkIrpPending( IN OUT PIRP Irp )
6165 */
6166#define IoMarkIrpPending(_Irp) \
6167 (IoGetCurrentIrpStackLocation(_Irp)->Control |= SL_PENDING_RETURNED)
6168
6169NTOSAPI NTSTATUS DDKAPI
6170IoOpenDeviceInterfaceRegistryKey(
6171 /*IN*/ PUNICODE_STRING SymbolicLinkName,
6172 /*IN*/ ACCESS_MASK DesiredAccess,
6173 /*OUT*/ PHANDLE DeviceInterfaceKey
6174);
6175
6176NTOSAPI NTSTATUS DDKAPI
6177IoOpenDeviceRegistryKey(
6178 /*IN*/ PDEVICE_OBJECT DeviceObject,
6179 /*IN*/ ULONG DevInstKeyType,
6180 /*IN*/ ACCESS_MASK DesiredAccess,
6181 /*OUT*/ PHANDLE DevInstRegKey
6182);
6183
6184NTOSAPI NTSTATUS DDKAPI
6185IoQueryDeviceDescription(
6186 /*IN*/ PINTERFACE_TYPE BusType /*OPTIONAL*/,
6187 /*IN*/ PULONG BusNumber /*OPTIONAL*/,
6188 /*IN*/ PCONFIGURATION_TYPE ControllerType /*OPTIONAL*/,
6189 /*IN*/ PULONG ControllerNumber /*OPTIONAL*/,
6190 /*IN*/ PCONFIGURATION_TYPE PeripheralType /*OPTIONAL*/,
6191 /*IN*/ PULONG PeripheralNumber /*OPTIONAL*/,
6192 /*IN*/ PIO_QUERY_DEVICE_ROUTINE CalloutRoutine,
6193 /*IN*/ PVOID Context
6194);
6195
6196NTOSAPI VOID DDKAPI
6197IoQueueWorkItem(
6198 /*IN*/ PIO_WORKITEM pIOWorkItem,
6199 /*IN*/ PIO_WORKITEM_ROUTINE Routine,
6200 /*IN*/ WORK_QUEUE_TYPE QueueType,
6201 /*IN*/ PVOID Context
6202);
6203
6204NTOSAPI VOID DDKAPI
6205IoRaiseHardError(
6206 /*IN*/ PIRP Irp,
6207 /*IN*/ PVPB Vpb /*OPTIONAL*/,
6208 /*IN*/ PDEVICE_OBJECT RealDeviceObject
6209);
6210
6211NTOSAPI BOOLEAN DDKAPI
6212IoRaiseInformationalHardError(
6213 /*IN*/ NTSTATUS ErrorStatus,
6214 /*IN*/ PUNICODE_STRING String /*OPTIONAL*/,
6215 /*IN*/ PKTHREAD Thread /*OPTIONAL*/
6216);
6217
6218NTOSAPI NTSTATUS DDKAPI
6219IoReadDiskSignature(
6220 /*IN*/ PDEVICE_OBJECT DeviceObject,
6221 /*IN*/ ULONG BytesPerSector,
6222 /*OUT*/ PDISK_SIGNATURE Signature
6223);
6224
6225NTOSAPI NTSTATUS DDKAPI
6226IoReadPartitionTableEx(
6227 /*IN*/ PDEVICE_OBJECT DeviceObject,
6228 /*IN*/ struct _DRIVE_LAYOUT_INFORMATION_EX **PartitionBuffer
6229);
6230
6231NTOSAPI VOID DDKAPI
6232IoRegisterBootDriverReinitialization(
6233 /*IN*/ PDRIVER_OBJECT DriverObject,
6234 /*IN*/ PDRIVER_REINITIALIZE DriverReinitializationRoutine,
6235 /*IN*/ PVOID Context
6236);
6237
6238NTOSAPI VOID DDKAPI
6239IoRegisterBootDriverReinitialization(
6240 /*IN*/ PDRIVER_OBJECT DriverObject,
6241 /*IN*/ PDRIVER_REINITIALIZE DriverReinitializationRoutine,
6242 /*IN*/ PVOID Context
6243);
6244
6245NTOSAPI NTSTATUS DDKAPI
6246IoRegisterDeviceInterface(
6247 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject,
6248 /*IN*/ CONST GUID *InterfaceClassGuid,
6249 /*IN*/ PUNICODE_STRING ReferenceString /*OPTIONAL*/,
6250 /*OUT*/ PUNICODE_STRING SymbolicLinkName
6251);
6252
6253NTOSAPI VOID DDKAPI
6254IoRegisterDriverReinitialization(
6255 /*IN*/ PDRIVER_OBJECT DriverObject,
6256 /*IN*/ PDRIVER_REINITIALIZE DriverReinitializationRoutine,
6257 /*IN*/ PVOID Context
6258);
6259
6260NTOSAPI NTSTATUS DDKAPI
6261IoRegisterPlugPlayNotification(
6262 /*IN*/ IO_NOTIFICATION_EVENT_CATEGORY EventCategory,
6263 /*IN*/ ULONG EventCategoryFlags,
6264 /*IN*/ PVOID EventCategoryData /*OPTIONAL*/,
6265 /*IN*/ PDRIVER_OBJECT DriverObject,
6266 /*IN*/ PDRIVER_NOTIFICATION_CALLBACK_ROUTINE CallbackRoutine,
6267 /*IN*/ PVOID Context,
6268 /*OUT*/ PVOID *NotificationEntry
6269);
6270
6271NTOSAPI NTSTATUS DDKAPI
6272IoRegisterShutdownNotification( /*IN*/ PDEVICE_OBJECT DeviceObject );
6273
6274NTOSAPI VOID DDKAPI
6275IoReleaseCancelSpinLock( /*IN*/ KIRQL Irql );
6276
6277NTOSAPI VOID DDKAPI
6278IoReleaseRemoveLockAndWaitEx(
6279 /*IN*/ PIO_REMOVE_LOCK RemoveLock,
6280 /*IN*/ PVOID Tag,
6281 /*IN*/ ULONG RemlockSize
6282);
6283
6284/* VOID IoReleaseRemoveLockAndWait(
6285 * IN PIO_REMOVE_LOCK RemoveLock,
6286 * IN PVOID Tag
6287 * )
6288 */
6289#define IoReleaseRemoveLockAndWait(_RemoveLock, _Tag) \
6290 IoReleaseRemoveLockAndWaitEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK))
6291
6292NTOSAPI VOID DDKAPI
6293IoReleaseRemoveLockEx(
6294 /*IN*/ PIO_REMOVE_LOCK RemoveLock,
6295 /*IN*/ PVOID Tag,
6296 /*IN*/ ULONG RemlockSize
6297);
6298
6299/* VOID IoReleaseRemoveLock(
6300 * IN PIO_REMOVE_LOCK RemoveLock,
6301 * IN PVOID Tag
6302 * )
6303 */
6304#define IoReleaseRemoveLock(_RemoveLock, _Tag) \
6305 IoReleaseRemoveLockEx(_RemoveLock, _Tag, sizeof(IO_REMOVE_LOCK))
6306
6307NTOSAPI VOID DDKAPI
6308IoRemoveShareAccess(
6309 /*IN*/ PFILE_OBJECT FileObject,
6310 /*IN OUT*/ PSHARE_ACCESS ShareAccess
6311);
6312
6313NTOSAPI NTSTATUS DDKAPI
6314IoReportDetectedDevice(
6315 /*IN*/ PDRIVER_OBJECT DriverObject,
6316 /*IN*/ INTERFACE_TYPE LegacyBusType,
6317 /*IN*/ ULONG BusNumber,
6318 /*IN*/ ULONG SlotNumber,
6319 /*IN*/ PCM_RESOURCE_LIST ResourceList,
6320 /*IN*/ PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements /*OPTIONAL*/,
6321 /*IN*/ BOOLEAN ResourceAssigned,
6322 /*IN OUT*/ PDEVICE_OBJECT *DeviceObject
6323);
6324
6325NTOSAPI NTSTATUS DDKAPI
6326IoReportResourceForDetection(
6327 /*IN*/ PDRIVER_OBJECT DriverObject,
6328 /*IN*/ PCM_RESOURCE_LIST DriverList /*OPTIONAL*/,
6329 /*IN*/ ULONG DriverListSize /*OPTIONAL*/,
6330 /*IN*/ PDEVICE_OBJECT DeviceObject /*OPTIONAL*/,
6331 /*IN*/ PCM_RESOURCE_LIST DeviceList /*OPTIONAL*/,
6332 /*IN*/ ULONG DeviceListSize /*OPTIONAL*/,
6333 /*OUT*/ PBOOLEAN ConflictDetected
6334);
6335
6336NTOSAPI NTSTATUS DDKAPI
6337IoReportResourceUsage(
6338 /*IN*/ PUNICODE_STRING DriverClassName /*OPTIONAL*/,
6339 /*IN*/ PDRIVER_OBJECT DriverObject,
6340 /*IN*/ PCM_RESOURCE_LIST DriverList /*OPTIONAL*/,
6341 /*IN*/ ULONG DriverListSize /*OPTIONAL*/,
6342 /*IN*/ PDEVICE_OBJECT DeviceObject,
6343 /*IN*/ PCM_RESOURCE_LIST DeviceList /*OPTIONAL*/,
6344 /*IN*/ ULONG DeviceListSize /*OPTIONAL*/,
6345 /*IN*/ BOOLEAN OverrideConflict,
6346 /*OUT*/ PBOOLEAN ConflictDetected
6347);
6348
6349NTOSAPI NTSTATUS DDKAPI
6350IoReportTargetDeviceChange(
6351 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject,
6352 /*IN*/ PVOID NotificationStructure
6353);
6354
6355NTOSAPI NTSTATUS DDKAPI
6356IoReportTargetDeviceChangeAsynchronous(
6357 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject,
6358 /*IN*/ PVOID NotificationStructure,
6359 /*IN*/ PDEVICE_CHANGE_COMPLETE_CALLBACK Callback /*OPTIONAL*/,
6360 /*IN*/ PVOID Context /*OPTIONAL*/
6361);
6362
6363NTOSAPI VOID DDKAPI
6364IoRequestDeviceEject( /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject );
6365
6366/* VOID IoRequestDpc(
6367 * IN PDEVICE_OBJECT DeviceObject,
6368 * IN PIRP Irp,
6369 * IN PVOID Context
6370 * )
6371 */
6372#define IoRequestDpc(DeviceObject, Irp, Context) \
6373 (KeInsertQueueDpc(&(DeviceObject)->Dpc, (Irp), (Context)))
6374
6375NTOSAPI VOID DDKAPI
6376IoReuseIrp( /*IN OUT*/ PIRP Irp, /*IN*/ NTSTATUS Status );
6377
6378/* PDRIVER_CANCEL IoSetCancelRoutine(
6379 * IN PIRP Irp,
6380 * IN PDRIVER_CANCEL CancelRoutine
6381 * )
6382 */
6383#define IoSetCancelRoutine(_Irp, _CancelRoutine) \
6384 ((PDRIVER_CANCEL)(InterlockedExchangePointer( \
6385 (PVOID *)(&(_Irp)->CancelRoutine), (PVOID)(_CancelRoutine)) \
6386 ))
6387
6388/* VOID IoSetCompletionRoutine(
6389 * IN PIRP Irp,
6390 * IN PIO_COMPLETION_ROUTINE CompletionRoutine,
6391 * IN PVOID Context,
6392 * IN BOOLEAN InvokeOnSuccess,
6393 * IN BOOLEAN InvokeOnError,
6394 * IN BOOLEAN InvokeOnCancel
6395 * )
6396 */
6397#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, \
6398 _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel \
6399 ) \
6400 { PIO_STACK_LOCATION _IrpSp; \
6401 ASSERT(_InvokeOnSuccess || _InvokeOnError || _InvokeOnCancel ? \
6402 _CompletionRoutine != NULL : TRUE); \
6403 _IrpSp = IoGetNextIrpStackLocation(_Irp); \
6404 _IrpSp->CompletionRoutine = (PIO_COMPLETION_ROUTINE)(_CompletionRoutine); \
6405 _IrpSp->Context = (_Context); \
6406 _IrpSp->Control = 0; \
6407 if (_InvokeOnSuccess) _IrpSp->Control = SL_INVOKE_ON_SUCCESS; \
6408 if (_InvokeOnError) _IrpSp->Control |= SL_INVOKE_ON_ERROR; \
6409 if (_InvokeOnCancel) _IrpSp->Control |= SL_INVOKE_ON_CANCEL; \
6410 }
6411
6412NTOSAPI VOID DDKAPI
6413IoSetCompletionRoutineEx(
6414 /*IN*/ PDEVICE_OBJECT DeviceObject,
6415 /*IN*/ PIRP Irp,
6416 /*IN*/ PIO_COMPLETION_ROUTINE CompletionRoutine,
6417 /*IN*/ PVOID Context,
6418 /*IN*/ BOOLEAN InvokeOnSuccess,
6419 /*IN*/ BOOLEAN InvokeOnError,
6420 /*IN*/ BOOLEAN InvokeOnCancel
6421);
6422
6423NTOSAPI NTSTATUS DDKAPI
6424IoSetDeviceInterfaceState(
6425 /*IN*/ PUNICODE_STRING SymbolicLinkName,
6426 /*IN*/ BOOLEAN Enable
6427);
6428
6429NTOSAPI VOID DDKAPI
6430IoSetHardErrorOrVerifyDevice(
6431 /*IN*/ PIRP Irp,
6432 /*IN*/ PDEVICE_OBJECT DeviceObject
6433);
6434
6435/* VOID IoSetNextIrpStackLocation( IN OUT PIRP Irp )
6436 */
6437#define IoSetNextIrpStackLocation(_Irp) \
6438 { (_Irp)->CurrentLocation--; \
6439 (_Irp)->Tail.Overlay.CurrentStackLocation--; \
6440 }
6441
6442NTOSAPI NTSTATUS DDKAPI
6443IoSetPartitionInformationEx(
6444 /*IN*/ PDEVICE_OBJECT DeviceObject,
6445 /*IN*/ ULONG PartitionNumber,
6446 /*IN*/ struct _SET_PARTITION_INFORMATION_EX *PartitionInfo
6447);
6448
6449NTOSAPI VOID DDKAPI
6450IoSetShareAccess(
6451 /*IN*/ ACCESS_MASK DesiredAccess,
6452 /*IN*/ ULONG DesiredShareAccess,
6453 /*IN OUT*/ PFILE_OBJECT FileObject,
6454 /*OUT*/ PSHARE_ACCESS ShareAccess
6455);
6456
6457NTOSAPI VOID DDKAPI
6458IoSetStartIoAttributes(
6459 /*IN*/ PDEVICE_OBJECT DeviceObject,
6460 /*IN*/ BOOLEAN DeferredStartIo,
6461 /*IN*/ BOOLEAN NonCancelable
6462);
6463
6464NTOSAPI NTSTATUS DDKAPI
6465IoSetSystemPartition( /*IN*/ PUNICODE_STRING VolumeNameString );
6466
6467NTOSAPI BOOLEAN DDKAPI
6468IoSetThreadHardErrorMode( /*IN*/ BOOLEAN EnableHardErrors );
6469
6470/* USHORT IoSizeOfIrp( IN CCHAR StackSize )
6471 */
6472#define IoSizeOfIrp(_StackSize) \
6473 ((USHORT) (sizeof(IRP) + ((_StackSize) * (sizeof(IO_STACK_LOCATION)))))
6474
6475/* VOID IoSkipCurrentIrpStackLocation( IN PIRP Irp )
6476 */
6477#define IoSkipCurrentIrpStackLocation(_Irp) \
6478 { (_Irp)->CurrentLocation++; \
6479 (_Irp)->Tail.Overlay.CurrentStackLocation++; \
6480 }
6481
6482NTOSAPI VOID DDKAPI
6483IoStartNextPacket(
6484 /*IN*/ PDEVICE_OBJECT DeviceObject,
6485 /*IN*/ BOOLEAN Cancelable
6486);
6487
6488NTOSAPI VOID DDKAPI
6489IoStartNextPacketByKey(
6490 /*IN*/ PDEVICE_OBJECT DeviceObject,
6491 /*IN*/ BOOLEAN Cancelable,
6492 /*IN*/ ULONG Key
6493);
6494
6495NTOSAPI VOID DDKAPI
6496IoStartPacket(
6497 /*IN*/ PDEVICE_OBJECT DeviceObject,
6498 /*IN*/ PIRP Irp,
6499 /*IN*/ PULONG Key /*OPTIONAL*/,
6500 /*IN*/ PDRIVER_CANCEL CancelFunction /*OPTIONAL*/
6501);
6502
6503NTOSAPI VOID DDKAPI
6504IoStartTimer( /*IN*/ PDEVICE_OBJECT DeviceObject );
6505
6506NTOSAPI VOID DDKAPI
6507IoStopTimer( /*IN*/ PDEVICE_OBJECT DeviceObject );
6508
6509NTOSAPI NTSTATUS DDKAPI
6510IoUnregisterPlugPlayNotification( /*IN*/ PVOID NotificationEntry );
6511
6512NTOSAPI VOID DDKAPI
6513IoUnregisterShutdownNotification( /*IN*/ PDEVICE_OBJECT DeviceObject );
6514
6515NTOSAPI VOID DDKAPI
6516IoUpdateShareAccess(
6517 /*IN*/ PFILE_OBJECT FileObject,
6518 /*IN OUT*/ PSHARE_ACCESS ShareAccess
6519);
6520
6521NTOSAPI NTSTATUS DDKAPI
6522IoVerifyPartitionTable(
6523 /*IN*/ PDEVICE_OBJECT DeviceObject,
6524 /*IN*/ BOOLEAN FixErrors
6525);
6526
6527NTOSAPI NTSTATUS DDKAPI
6528IoVolumeDeviceToDosName(
6529 /*IN*/ PVOID VolumeDeviceObject,
6530 /*OUT*/ PUNICODE_STRING DosName
6531);
6532
6533NTOSAPI NTSTATUS DDKAPI
6534IoWMIAllocateInstanceIds(
6535 /*IN*/ GUID *Guid,
6536 /*IN*/ ULONG InstanceCount,
6537 /*OUT*/ ULONG *FirstInstanceId
6538);
6539
6540NTOSAPI ULONG DDKAPI
6541IoWMIDeviceObjectToProviderId( /*IN*/ PDEVICE_OBJECT DeviceObject );
6542
6543NTOSAPI NTSTATUS DDKAPI
6544IoWMIDeviceObjectToInstanceName(
6545 /*IN*/ PVOID DataBlockObject,
6546 /*IN*/ PDEVICE_OBJECT DeviceObject,
6547 /*OUT*/ PUNICODE_STRING InstanceName
6548);
6549
6550NTOSAPI NTSTATUS DDKAPI
6551IoWMIExecuteMethod(
6552 /*IN*/ PVOID DataBlockObject,
6553 /*IN*/ PUNICODE_STRING InstanceName,
6554 /*IN*/ ULONG MethodId,
6555 /*IN*/ ULONG InBufferSize,
6556 /*IN OUT*/ PULONG OutBufferSize,
6557 /*IN OUT*/ PUCHAR InOutBuffer
6558);
6559
6560NTOSAPI NTSTATUS DDKAPI
6561IoWMIHandleToInstanceName(
6562 /*IN*/ PVOID DataBlockObject,
6563 /*IN*/ HANDLE FileHandle,
6564 /*OUT*/ PUNICODE_STRING InstanceName
6565);
6566
6567NTOSAPI NTSTATUS DDKAPI
6568IoWMIOpenBlock(
6569 /*IN*/ GUID *DataBlockGuid,
6570 /*IN*/ ULONG DesiredAccess,
6571 /*OUT*/ PVOID *DataBlockObject
6572);
6573
6574NTOSAPI NTSTATUS DDKAPI
6575IoWMIQueryAllData(
6576 /*IN*/ PVOID DataBlockObject,
6577 /*IN OUT*/ ULONG *InOutBufferSize,
6578 /*OUT*/ PVOID OutBuffer
6579);
6580
6581NTOSAPI NTSTATUS DDKAPI
6582IoWMIQueryAllDataMultiple(
6583 /*IN*/ PVOID *DataBlockObjectList,
6584 /*IN*/ ULONG ObjectCount,
6585 /*IN OUT*/ ULONG *InOutBufferSize,
6586 /*OUT*/ PVOID OutBuffer
6587);
6588
6589NTOSAPI NTSTATUS DDKAPI
6590IoWMIQuerySingleInstance(
6591 /*IN*/ PVOID DataBlockObject,
6592 /*IN*/ PUNICODE_STRING InstanceName,
6593 /*IN OUT*/ ULONG *InOutBufferSize,
6594 /*OUT*/ PVOID OutBuffer
6595);
6596
6597NTOSAPI NTSTATUS DDKAPI
6598IoWMIQuerySingleInstanceMultiple(
6599 /*IN*/ PVOID *DataBlockObjectList,
6600 /*IN*/ PUNICODE_STRING InstanceNames,
6601 /*IN*/ ULONG ObjectCount,
6602 /*IN OUT*/ ULONG *InOutBufferSize,
6603 /*OUT*/ PVOID OutBuffer
6604);
6605
6606NTOSAPI NTSTATUS DDKAPI
6607IoWMIRegistrationControl(
6608 /*IN*/ PDEVICE_OBJECT DeviceObject,
6609 /*IN*/ ULONG Action
6610);
6611
6612NTOSAPI NTSTATUS DDKAPI
6613IoWMISetNotificationCallback(
6614 /*IN*/ PVOID Object,
6615 /*IN*/ WMI_NOTIFICATION_CALLBACK Callback,
6616 /*IN*/ PVOID Context
6617);
6618
6619NTOSAPI NTSTATUS DDKAPI
6620IoWMISetSingleInstance(
6621 /*IN*/ PVOID DataBlockObject,
6622 /*IN*/ PUNICODE_STRING InstanceName,
6623 /*IN*/ ULONG Version,
6624 /*IN*/ ULONG ValueBufferSize,
6625 /*IN*/ PVOID ValueBuffer
6626);
6627
6628NTOSAPI NTSTATUS DDKAPI
6629IoWMISetSingleItem(
6630 /*IN*/ PVOID DataBlockObject,
6631 /*IN*/ PUNICODE_STRING InstanceName,
6632 /*IN*/ ULONG DataItemId,
6633 /*IN*/ ULONG Version,
6634 /*IN*/ ULONG ValueBufferSize,
6635 /*IN*/ PVOID ValueBuffer
6636);
6637
6638NTOSAPI NTSTATUS DDKAPI
6639IoWMISuggestInstanceName(
6640 /*IN*/ PDEVICE_OBJECT PhysicalDeviceObject /*OPTIONAL*/,
6641 /*IN*/ PUNICODE_STRING SymbolicLinkName /*OPTIONAL*/,
6642 /*IN*/ BOOLEAN CombineNames,
6643 /*OUT*/ PUNICODE_STRING SuggestedInstanceName
6644);
6645
6646NTOSAPI NTSTATUS DDKAPI
6647IoWMIWriteEvent( /*IN*/ PVOID WnodeEventItem );
6648
6649NTOSAPI VOID DDKAPI
6650IoWriteErrorLogEntry( /*IN*/ PVOID ElEntry );
6651
6652NTOSAPI NTSTATUS DDKAPI
6653IoWritePartitionTableEx(
6654 /*IN*/ PDEVICE_OBJECT DeviceObject,
6655 /*IN*/ struct _DRIVE_LAYOUT_INFORMATION_EX *PartitionBuffer
6656);
6657
6658
6659
6660/** Kernel routines **/
6661
6662NTOSAPI VOID DDKFASTAPI
6663KeAcquireInStackQueuedSpinLock(
6664 /*IN*/ PKSPIN_LOCK SpinLock,
6665 /*IN*/ PKLOCK_QUEUE_HANDLE LockHandle
6666);
6667
6668NTOSAPI VOID DDKFASTAPI
6669KeAcquireInStackQueuedSpinLockAtDpcLevel(
6670 /*IN*/ PKSPIN_LOCK SpinLock,
6671 /*IN*/ PKLOCK_QUEUE_HANDLE LockHandle
6672);
6673
6674NTOSAPI KIRQL DDKAPI
6675KeAcquireInterruptSpinLock( /*IN*/ PKINTERRUPT Interrupt );
6676
6677NTOSAPI VOID DDKAPI
6678KeAcquireSpinLock( /*IN*/ PKSPIN_LOCK SpinLock, /*OUT*/ PKIRQL OldIrql );
6679
6680/* System Service Dispatch Table */
6681typedef PVOID (NTAPI * SSDT)(VOID);
6682typedef SSDT * PSSDT;
6683
6684/* System Service Parameters Table */
6685typedef UCHAR SSPT, * PSSPT;
6686
6687typedef
6688struct _SSDT_ENTRY
6689{ PSSDT SSDT;
6690 PULONG ServiceCounterTable;
6691 ULONG NumberOfServices;
6692 PSSPT SSPT;
6693} SSDT_ENTRY, *PSSDT_ENTRY;
6694
6695NTOSAPI BOOLEAN DDKAPI
6696KeAddSystemServiceTable(
6697 /*IN*/ PSSDT SSDT,
6698 /*IN*/ PULONG ServiceCounterTable,
6699 /*IN*/ ULONG NumberOfServices,
6700 /*IN*/ PSSPT SSPT,
6701 /*IN*/ ULONG TableIndex
6702);
6703
6704NTOSAPI BOOLEAN DDKAPI
6705KeAreApcsDisabled( VOID );
6706
6707NTOSAPI VOID DDKAPI
6708KeAttachProcess( /*IN*/ PEPROCESS Process );
6709
6710NTOSAPI VOID DDKAPI
6711KeBugCheck( /*IN*/ ULONG BugCheckCode );
6712
6713NTOSAPI VOID DDKAPI
6714KeBugCheckEx(
6715 /*IN*/ ULONG BugCheckCode,
6716 /*IN*/ ULONG_PTR BugCheckParameter1,
6717 /*IN*/ ULONG_PTR BugCheckParameter2,
6718 /*IN*/ ULONG_PTR BugCheckParameter3,
6719 /*IN*/ ULONG_PTR BugCheckParameter4
6720);
6721
6722NTOSAPI BOOLEAN DDKAPI
6723KeCancelTimer( /*IN*/ PKTIMER Timer );
6724
6725NTOSAPI VOID DDKAPI
6726KeClearEvent( /*IN*/ PRKEVENT Event );
6727
6728NTOSAPI NTSTATUS DDKAPI
6729KeDelayExecutionThread(
6730 /*IN*/ KPROCESSOR_MODE WaitMode,
6731 /*IN*/ BOOLEAN Alertable,
6732 /*IN*/ PLARGE_INTEGER Interval
6733);
6734
6735NTOSAPI BOOLEAN DDKAPI
6736KeDeregisterBugCheckCallback( /*IN*/ PKBUGCHECK_CALLBACK_RECORD CallbackRecord );
6737
6738NTOSAPI VOID DDKAPI
6739KeDetachProcess( VOID );
6740
6741NTOSAPI VOID DDKAPI
6742KeEnterCriticalRegion( VOID );
6743
6744/* VOID KeFlushIoBuffers(
6745 * IN PMDL Mdl,
6746 * IN BOOLEAN ReadOperation,
6747 * IN BOOLEAN DmaOperation
6748 * )
6749 */
6750#define KeFlushIoBuffers(_Mdl, _ReadOperation, _DmaOperation)
6751
6752NTOSAPI VOID DDKAPI
6753KeFlushQueuedDpcs( VOID );
6754
6755NTOSAPI PRKTHREAD DDKAPI
6756KeGetCurrentThread( VOID );
6757
6758NTOSAPI KPROCESSOR_MODE DDKAPI
6759KeGetPreviousMode( VOID );
6760
6761NTOSAPI ULONG DDKAPI
6762KeGetRecommendedSharedDataAlignment( VOID );
6763
6764NTOSAPI VOID DDKAPI
6765KeInitializeApc(
6766 /*IN*/ PKAPC Apc,
6767 /*IN*/ PKTHREAD Thread,
6768 /*IN*/ UCHAR StateIndex,
6769 /*IN*/ PKKERNEL_ROUTINE KernelRoutine,
6770 /*IN*/ PKRUNDOWN_ROUTINE RundownRoutine,
6771 /*IN*/ PKNORMAL_ROUTINE NormalRoutine,
6772 /*IN*/ UCHAR Mode,
6773 /*IN*/ PVOID Context
6774);
6775
6776NTOSAPI VOID DDKAPI
6777KeInitializeDeviceQueue( /*IN*/ PKDEVICE_QUEUE DeviceQueue );
6778
6779NTOSAPI VOID DDKAPI
6780KeInitializeMutex( /*IN*/ PRKMUTEX Mutex, /*IN*/ ULONG Level );
6781
6782NTOSAPI VOID DDKAPI
6783KeInitializeSemaphore(
6784 /*IN*/ PRKSEMAPHORE Semaphore,
6785 /*IN*/ LONG Count,
6786 /*IN*/ LONG Limit
6787);
6788
6789NTOSAPI VOID DDKAPI
6790KeInitializeSpinLock( /*IN*/ PKSPIN_LOCK SpinLock );
6791
6792NTOSAPI VOID DDKAPI
6793KeInitializeTimer( /*IN*/ PKTIMER Timer );
6794
6795NTOSAPI VOID DDKAPI
6796KeInitializeTimerEx( /*IN*/ PKTIMER Timer, /*IN*/ TIMER_TYPE Type );
6797
6798NTOSAPI BOOLEAN DDKAPI
6799KeInsertByKeyDeviceQueue(
6800 /*IN*/ PKDEVICE_QUEUE DeviceQueue,
6801 /*IN*/ PKDEVICE_QUEUE_ENTRY DeviceQueueEntry,
6802 /*IN*/ ULONG SortKey
6803);
6804
6805NTOSAPI BOOLEAN DDKAPI
6806KeInsertDeviceQueue(
6807 /*IN*/ PKDEVICE_QUEUE DeviceQueue,
6808 /*IN*/ PKDEVICE_QUEUE_ENTRY DeviceQueueEntry
6809);
6810
6811NTOSAPI BOOLEAN DDKAPI
6812KeInsertQueueDpc(
6813 /*IN*/ PRKDPC Dpc,
6814 /*IN*/ PVOID SystemArgument1,
6815 /*IN*/ PVOID SystemArgument2
6816);
6817
6818NTOSAPI VOID DDKAPI
6819KeLeaveCriticalRegion( VOID );
6820
6821static FORCEINLINE
6822void KeMemoryBarrier (void) { MemoryBarrier(); }
6823
6824NTOSAPI NTSTATUS DDKAPI
6825KePulseEvent(
6826 /*IN*/ PRKEVENT Event,
6827 /*IN*/ KPRIORITY Increment,
6828 /*IN*/ BOOLEAN Wait
6829);
6830
6831NTOSAPI ULONGLONG DDKAPI
6832KeQueryInterruptTime( VOID );
6833
6834NTOSAPI LARGE_INTEGER DDKAPI
6835KeQueryPerformanceCounter(
6836 /*OUT*/ PLARGE_INTEGER PerformanceFrequency /*OPTIONAL*/
6837);
6838
6839NTOSAPI KPRIORITY DDKAPI
6840KeQueryPriorityThread( /*IN*/ PRKTHREAD Thread );
6841
6842NTOSAPI VOID DDKAPI
6843KeQuerySystemTime( /*OUT*/ PLARGE_INTEGER CurrentTime );
6844
6845NTOSAPI VOID DDKAPI
6846KeQueryTickCount( /*OUT*/ PLARGE_INTEGER TickCount );
6847
6848NTOSAPI ULONG DDKAPI
6849KeQueryTimeIncrement( VOID );
6850
6851NTOSAPI LONG DDKAPI
6852KeReadStateEvent( /*IN*/ PRKEVENT Event );
6853
6854NTOSAPI LONG DDKAPI
6855KeReadStateMutex( /*IN*/ PRKMUTEX Mutex );
6856
6857NTOSAPI LONG DDKAPI
6858KeReadStateSemaphore( /*IN*/ PRKSEMAPHORE Semaphore );
6859
6860NTOSAPI BOOLEAN DDKAPI
6861KeReadStateTimer( /*IN*/ PKTIMER Timer );
6862
6863NTOSAPI BOOLEAN DDKAPI
6864KeRegisterBugCheckCallback(
6865 /*IN*/ PKBUGCHECK_CALLBACK_RECORD CallbackRecord,
6866 /*IN*/ PKBUGCHECK_CALLBACK_ROUTINE CallbackRoutine,
6867 /*IN*/ PVOID Buffer,
6868 /*IN*/ ULONG Length,
6869 /*IN*/ PUCHAR Component
6870);
6871
6872NTOSAPI VOID DDKFASTAPI
6873KeReleaseInStackQueuedSpinLock( /*IN*/ PKLOCK_QUEUE_HANDLE LockHandle );
6874
6875NTOSAPI VOID DDKFASTAPI
6876KeReleaseInStackQueuedSpinLockFromDpcLevel(
6877 /*IN*/ PKLOCK_QUEUE_HANDLE LockHandle
6878);
6879
6880NTOSAPI VOID DDKAPI
6881KeReleaseInterruptSpinLock( /*IN*/ PKINTERRUPT Interrupt, /*IN*/ KIRQL OldIrql );
6882
6883NTOSAPI LONG DDKAPI
6884KeReleaseMutex( /*IN*/ PRKMUTEX Mutex, /*IN*/ BOOLEAN Wait );
6885
6886NTOSAPI LONG DDKAPI
6887KeReleaseSemaphore(
6888 /*IN*/ PRKSEMAPHORE Semaphore,
6889 /*IN*/ KPRIORITY Increment,
6890 /*IN*/ LONG Adjustment,
6891 /*IN*/ BOOLEAN Wait
6892);
6893
6894NTOSAPI VOID DDKAPI
6895KeReleaseSpinLock( /*IN*/ PKSPIN_LOCK SpinLock, /*IN*/ KIRQL NewIrql );
6896
6897NTOSAPI PKDEVICE_QUEUE_ENTRY DDKAPI
6898KeRemoveByKeyDeviceQueue(
6899 /*IN*/ PKDEVICE_QUEUE DeviceQueue,
6900 /*IN*/ ULONG SortKey
6901);
6902
6903NTOSAPI PKDEVICE_QUEUE_ENTRY DDKAPI
6904KeRemoveDeviceQueue( /*IN*/ PKDEVICE_QUEUE DeviceQueue );
6905
6906NTOSAPI BOOLEAN DDKAPI
6907KeRemoveEntryDeviceQueue(
6908 /*IN*/ PKDEVICE_QUEUE DeviceQueue,
6909 /*IN*/ PKDEVICE_QUEUE_ENTRY DeviceQueueEntry
6910);
6911
6912NTOSAPI BOOLEAN DDKAPI
6913KeRemoveQueueDpc( /*IN*/ PRKDPC Dpc );
6914
6915NTOSAPI LONG DDKAPI
6916KeResetEvent( /*IN*/ PRKEVENT Event );
6917
6918NTOSAPI NTSTATUS DDKAPI
6919KeRestoreFloatingPointState( /*IN*/ PKFLOATING_SAVE FloatSave );
6920
6921NTOSAPI NTSTATUS DDKAPI
6922KeSaveFloatingPointState( /*OUT*/ PKFLOATING_SAVE FloatSave );
6923
6924NTOSAPI LONG DDKAPI
6925KeSetBasePriorityThread( /*IN*/ PRKTHREAD Thread, /*IN*/ LONG Increment );
6926
6927NTOSAPI LONG DDKAPI
6928KeSetEvent(
6929 /*IN*/ PRKEVENT Event,
6930 /*IN*/ KPRIORITY Increment,
6931 /*IN*/ BOOLEAN Wait
6932);
6933
6934NTOSAPI VOID DDKAPI
6935KeSetImportanceDpc( /*IN*/ PRKDPC Dpc, /*IN*/ KDPC_IMPORTANCE Importance );
6936
6937NTOSAPI KPRIORITY DDKAPI
6938KeSetPriorityThread( /*IN*/ PKTHREAD Thread, /*IN*/ KPRIORITY Priority );
6939
6940NTOSAPI VOID DDKAPI
6941KeSetTargetProcessorDpc( /*IN*/ PRKDPC Dpc, /*IN*/ CCHAR Number );
6942
6943NTOSAPI BOOLEAN DDKAPI
6944KeSetTimer(
6945 /*IN*/ PKTIMER Timer,
6946 /*IN*/ LARGE_INTEGER DueTime,
6947 /*IN*/ PKDPC Dpc /*OPTIONAL*/
6948);
6949
6950NTOSAPI BOOLEAN DDKAPI
6951KeSetTimerEx(
6952 /*IN*/ PKTIMER Timer,
6953 /*IN*/ LARGE_INTEGER DueTime,
6954 /*IN*/ LONG Period /*OPTIONAL*/,
6955 /*IN*/ PKDPC Dpc /*OPTIONAL*/
6956);
6957
6958NTOSAPI VOID DDKFASTAPI
6959KeSetTimeUpdateNotifyRoutine( /*IN*/ PTIME_UPDATE_NOTIFY_ROUTINE NotifyRoutine );
6960
6961NTOSAPI VOID DDKAPI
6962KeStallExecutionProcessor( /*IN*/ ULONG MicroSeconds );
6963
6964NTOSAPI BOOLEAN DDKAPI
6965KeSynchronizeExecution(
6966 /*IN*/ PKINTERRUPT Interrupt,
6967 /*IN*/ PKSYNCHRONIZE_ROUTINE SynchronizeRoutine,
6968 /*IN*/ PVOID SynchronizeContext
6969);
6970
6971NTOSAPI NTSTATUS DDKAPI
6972KeWaitForMultipleObjects(
6973 /*IN*/ ULONG Count,
6974 /*IN*/ PVOID Object[],
6975 /*IN*/ WAIT_TYPE WaitType,
6976 /*IN*/ KWAIT_REASON WaitReason,
6977 /*IN*/ KPROCESSOR_MODE WaitMode,
6978 /*IN*/ BOOLEAN Alertable,
6979 /*IN*/ PLARGE_INTEGER Timeout /*OPTIONAL */,
6980 /*IN*/ PKWAIT_BLOCK WaitBlockArray /*OPTIONAL*/
6981);
6982
6983NTOSAPI NTSTATUS DDKAPI
6984KeWaitForMutexObject(
6985 /*IN*/ PRKMUTEX Mutex,
6986 /*IN*/ KWAIT_REASON WaitReason,
6987 /*IN*/ KPROCESSOR_MODE WaitMode,
6988 /*IN*/ BOOLEAN Alertable,
6989 /*IN*/ PLARGE_INTEGER Timeout /*OPTIONAL*/
6990);
6991
6992NTOSAPI NTSTATUS DDKAPI
6993KeWaitForSingleObject(
6994 /*IN*/ PVOID Object,
6995 /*IN*/ KWAIT_REASON WaitReason,
6996 /*IN*/ KPROCESSOR_MODE WaitMode,
6997 /*IN*/ BOOLEAN Alertable,
6998 /*IN*/ PLARGE_INTEGER Timeout /*OPTIONAL*/
6999);
7000
7001NTOSAPI VOID DDKAPI
7002KeRaiseIrql( /*IN*/ KIRQL new_irql, /*OUT*/ PKIRQL old_irql );
7003
7004NTOSAPI VOID DDKAPI
7005KeLowerIrql( /*IN*/ KIRQL irql );
7006
7007NTOSAPI KIRQL DDKAPI
7008KeRaiseIrqlToDpcLevel( VOID );
7009
7010/** Memory manager routines **/
7011
7012NTOSAPI NTSTATUS DDKAPI
7013MmAdvanceMdl( /*IN*/ PMDL Mdl, /*IN*/ ULONG NumberOfBytes );
7014
7015NTOSAPI PVOID DDKAPI
7016MmAllocateContiguousMemory(
7017 /*IN*/ ULONG NumberOfBytes,
7018 /*IN*/ PHYSICAL_ADDRESS HighestAcceptableAddress
7019);
7020
7021NTOSAPI PVOID DDKAPI
7022MmAllocateContiguousMemorySpecifyCache(
7023 /*IN*/ SIZE_T NumberOfBytes,
7024 /*IN*/ PHYSICAL_ADDRESS LowestAcceptableAddress,
7025 /*IN*/ PHYSICAL_ADDRESS HighestAcceptableAddress,
7026 /*IN*/ PHYSICAL_ADDRESS BoundaryAddressMultiple /*OPTIONAL*/,
7027 /*IN*/ MEMORY_CACHING_TYPE CacheType
7028);
7029
7030NTOSAPI PVOID DDKAPI
7031MmAllocateMappingAddress( /*IN*/ SIZE_T NumberOfBytes, /*IN*/ ULONG PoolTag );
7032
7033NTOSAPI PVOID DDKAPI
7034MmAllocateNonCachedMemory( /*IN*/ ULONG NumberOfBytes );
7035
7036NTOSAPI PMDL DDKAPI
7037MmAllocatePagesForMdl(
7038 /*IN*/ PHYSICAL_ADDRESS LowAddress,
7039 /*IN*/ PHYSICAL_ADDRESS HighAddress,
7040 /*IN*/ PHYSICAL_ADDRESS SkipBytes,
7041 /*IN*/ SIZE_T TotalBytes
7042);
7043
7044NTOSAPI VOID DDKAPI
7045MmBuildMdlForNonPagedPool( /*IN OUT*/ PMDL MemoryDescriptorList );
7046
7047NTOSAPI NTSTATUS DDKAPI
7048MmCreateSection(
7049 /*OUT*/ PSECTION_OBJECT *SectionObject,
7050 /*IN*/ ACCESS_MASK DesiredAccess,
7051 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes /*OPTIONAL*/,
7052 /*IN*/ PLARGE_INTEGER MaximumSize,
7053 /*IN*/ ULONG SectionPageProtection,
7054 /*IN*/ ULONG AllocationAttributes,
7055 /*IN*/ HANDLE FileHandle /*OPTIONAL*/,
7056 /*IN*/ PFILE_OBJECT File /*OPTIONAL*/
7057);
7058
7059typedef
7060enum _MMFLUSH_TYPE
7061{ MmFlushForDelete,
7062 MmFlushForWrite
7063} MMFLUSH_TYPE;
7064
7065NTOSAPI BOOLEAN DDKAPI
7066MmFlushImageSection(
7067 /*IN*/ PSECTION_OBJECT_POINTERS SectionObjectPointer,
7068 /*IN*/ MMFLUSH_TYPE FlushType
7069);
7070
7071NTOSAPI VOID DDKAPI
7072MmFreeContiguousMemory( /*IN*/ PVOID BaseAddress );
7073
7074NTOSAPI VOID DDKAPI
7075MmFreeContiguousMemorySpecifyCache(
7076 /*IN*/ PVOID BaseAddress,
7077 /*IN*/ SIZE_T NumberOfBytes,
7078 /*IN*/ MEMORY_CACHING_TYPE CacheType
7079);
7080
7081NTOSAPI VOID DDKAPI
7082MmFreeMappingAddress( /*IN*/ PVOID BaseAddress, /*IN*/ ULONG PoolTag );
7083
7084NTOSAPI VOID DDKAPI
7085MmFreeNonCachedMemory( /*IN*/ PVOID BaseAddress, /*IN*/ SIZE_T NumberOfBytes );
7086
7087NTOSAPI VOID DDKAPI
7088MmFreePagesFromMdl( /*IN*/ PMDL MemoryDescriptorList );
7089
7090/* ULONG MmGetMdlByteCount( IN PMDL Mdl )
7091 */
7092#define MmGetMdlByteCount(_Mdl) ((_Mdl)->ByteCount)
7093
7094/* ULONG MmGetMdlByteOffset( IN PMDL Mdl )
7095 */
7096#define MmGetMdlByteOffset(_Mdl) ((_Mdl)->ByteOffset)
7097
7098/* PPFN_NUMBER MmGetMdlPfnArray( IN PMDL Mdl )
7099 */
7100#define MmGetMdlPfnArray(_Mdl) ((PPFN_NUMBER)((_Mdl) + 1))
7101
7102/* PVOID MmGetMdlVirtualAddress( IN PMDL Mdl )
7103 */
7104#define MmGetMdlVirtualAddress(_Mdl) \
7105 ((PVOID) ((PCHAR) ((_Mdl)->StartVa) + (_Mdl)->ByteOffset))
7106
7107NTOSAPI PHYSICAL_ADDRESS DDKAPI
7108MmGetPhysicalAddress( /*IN*/ PVOID BaseAddress );
7109
7110NTOSAPI PPHYSICAL_MEMORY_RANGE DDKAPI
7111MmGetPhysicalMemoryRanges( VOID );
7112
7113NTOSAPI PVOID DDKAPI
7114MmGetVirtualForPhysical( /*IN*/ PHYSICAL_ADDRESS PhysicalAddress );
7115
7116NTOSAPI PVOID DDKAPI
7117MmMapLockedPagesSpecifyCache(
7118 /*IN*/ PMDL MemoryDescriptorList,
7119 /*IN*/ KPROCESSOR_MODE AccessMode,
7120 /*IN*/ MEMORY_CACHING_TYPE CacheType,
7121 /*IN*/ PVOID BaseAddress,
7122 /*IN*/ ULONG BugCheckOnFailure,
7123 /*IN*/ MM_PAGE_PRIORITY Priority
7124);
7125
7126NTOSAPI PVOID DDKAPI
7127MmMapLockedPagesWithReservedMapping(
7128 /*IN*/ PVOID MappingAddress,
7129 /*IN*/ ULONG PoolTag,
7130 /*IN*/ PMDL MemoryDescriptorList,
7131 /*IN*/ MEMORY_CACHING_TYPE CacheType
7132);
7133
7134NTOSAPI NTSTATUS DDKAPI
7135MmMapUserAddressesToPage(
7136 /*IN*/ PVOID BaseAddress,
7137 /*IN*/ SIZE_T NumberOfBytes,
7138 /*IN*/ PVOID PageAddress
7139);
7140
7141NTOSAPI PVOID DDKAPI
7142MmMapVideoDisplay(
7143 /*IN*/ PHYSICAL_ADDRESS PhysicalAddress,
7144 /*IN*/ SIZE_T NumberOfBytes,
7145 /*IN*/ MEMORY_CACHING_TYPE CacheType
7146);
7147
7148NTOSAPI NTSTATUS DDKAPI
7149MmMapViewInSessionSpace(
7150 /*IN*/ PVOID Section,
7151 /*OUT*/ PVOID *MappedBase,
7152 /*IN OUT*/ PSIZE_T ViewSize
7153);
7154
7155NTOSAPI NTSTATUS DDKAPI
7156MmMapViewInSystemSpace(
7157 /*IN*/ PVOID Section,
7158 /*OUT*/ PVOID *MappedBase,
7159 /*IN*/ PSIZE_T ViewSize
7160);
7161
7162NTOSAPI NTSTATUS DDKAPI
7163MmMarkPhysicalMemoryAsBad(
7164 /*IN*/ PPHYSICAL_ADDRESS StartAddress,
7165 /*IN OUT*/ PLARGE_INTEGER NumberOfBytes
7166);
7167
7168NTOSAPI NTSTATUS DDKAPI
7169MmMarkPhysicalMemoryAsGood(
7170 /*IN*/ PPHYSICAL_ADDRESS StartAddress,
7171 /*IN OUT*/ PLARGE_INTEGER NumberOfBytes
7172);
7173
7174/* PVOID MmGetSystemAddressForMdlSafe(
7175 * IN PMDL Mdl,
7176 * IN MM_PAGE_PRIORITY Priority
7177 * )
7178 */
7179#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority) \
7180 ((_Mdl)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA \
7181 | MDL_SOURCE_IS_NONPAGED_POOL)) \
7182 ? (_Mdl)->MappedSystemVa \
7183 : (PVOID)(MmMapLockedPagesSpecifyCache((_Mdl), \
7184 KernelMode, MmCached, NULL, FALSE, _Priority))
7185
7186NTOSAPI PVOID DDKAPI
7187MmGetSystemRoutineAddress( /*IN*/ PUNICODE_STRING SystemRoutineName );
7188
7189/* ULONG ADDRESS_AND_SIZE_TO_SPAN_PAGES( IN PVOID Va, IN ULONG Size )
7190 */
7191#define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, _Size) \
7192 ((ULONG) ((((ULONG_PTR) (_Va) & (PAGE_SIZE - 1)) \
7193 + (_Size) + (PAGE_SIZE - 1)) >> PAGE_SHIFT))
7194
7195/* VOID MmInitializeMdl(
7196 * IN PMDL MemoryDescriptorList,
7197 * IN PVOID BaseVa,
7198 * IN SIZE_T Length
7199 * )
7200 */
7201#define MmInitializeMdl(_MemoryDescriptorList, _BaseVa, _Length) \
7202 { (_MemoryDescriptorList)->Next = (PMDL) NULL; \
7203 (_MemoryDescriptorList)->Size = (CSHORT) (sizeof(MDL) + \
7204 (sizeof(PFN_NUMBER) * ADDRESS_AND_SIZE_TO_SPAN_PAGES(_BaseVa, _Length))); \
7205 (_MemoryDescriptorList)->MdlFlags = 0; \
7206 (_MemoryDescriptorList)->StartVa = (PVOID) PAGE_ALIGN(_BaseVa); \
7207 (_MemoryDescriptorList)->ByteOffset = BYTE_OFFSET(_BaseVa); \
7208 (_MemoryDescriptorList)->ByteCount = (ULONG) _Length; \
7209 }
7210
7211NTOSAPI BOOLEAN DDKAPI
7212MmIsAddressValid( /*IN*/ PVOID VirtualAddress );
7213
7214NTOSAPI LOGICAL DDKAPI
7215MmIsDriverVerifying( /*IN*/ PDRIVER_OBJECT DriverObject );
7216
7217NTOSAPI BOOLEAN DDKAPI
7218MmIsThisAnNtAsSystem( VOID );
7219
7220NTOSAPI NTSTATUS DDKAPI
7221MmIsVerifierEnabled( /*OUT*/ PULONG VerifierFlags );
7222
7223NTOSAPI PVOID DDKAPI
7224MmLockPagableDataSection( /*IN*/ PVOID AddressWithinSection );
7225
7226NTOSAPI PVOID DDKAPI
7227MmLockPagableImageSection( /*IN*/ PVOID AddressWithinSection );
7228
7229/* PVOID MmLockPagableCodeSection( IN PVOID AddressWithinSection )
7230 */
7231#define MmLockPagableCodeSection MmLockPagableDataSection
7232
7233NTOSAPI VOID DDKAPI
7234MmLockPagableSectionByHandle( /*IN*/ PVOID ImageSectionHandle );
7235
7236NTOSAPI PVOID DDKAPI
7237MmMapIoSpace(
7238 /*IN*/ PHYSICAL_ADDRESS PhysicalAddress,
7239 /*IN*/ ULONG NumberOfBytes,
7240 /*IN*/ MEMORY_CACHING_TYPE CacheEnable
7241);
7242
7243NTOSAPI PVOID DDKAPI
7244MmMapLockedPages(
7245 /*IN*/ PMDL MemoryDescriptorList,
7246 /*IN*/ KPROCESSOR_MODE AccessMode
7247);
7248
7249NTOSAPI VOID DDKAPI
7250MmPageEntireDriver( /*IN*/ PVOID AddressWithinSection );
7251
7252NTOSAPI VOID DDKAPI
7253MmProbeAndLockProcessPages(
7254 /*IN OUT*/ PMDL MemoryDescriptorList,
7255 /*IN*/ PEPROCESS Process,
7256 /*IN*/ KPROCESSOR_MODE AccessMode,
7257 /*IN*/ LOCK_OPERATION Operation
7258);
7259
7260NTOSAPI NTSTATUS DDKAPI
7261MmProtectMdlSystemAddress(
7262 /*IN*/ PMDL MemoryDescriptorList,
7263 /*IN*/ ULONG NewProtect
7264);
7265
7266NTOSAPI VOID DDKAPI
7267MmUnmapLockedPages( /*IN*/ PVOID BaseAddress, /*IN*/ PMDL MemoryDescriptorList );
7268
7269NTOSAPI NTSTATUS DDKAPI
7270MmUnmapViewInSessionSpace( /*IN*/ PVOID MappedBase );
7271
7272NTOSAPI NTSTATUS DDKAPI
7273MmUnmapViewInSystemSpace( /*IN*/ PVOID MappedBase );
7274
7275NTOSAPI VOID DDKAPI
7276MmUnsecureVirtualMemory( /*IN*/ HANDLE SecureHandle );
7277
7278/* VOID MmPrepareMdlForReuse( IN PMDL Mdl )
7279 */
7280#define MmPrepareMdlForReuse(_Mdl) \
7281 { if (((_Mdl)->MdlFlags & MDL_PARTIAL_HAS_BEEN_MAPPED) != 0) \
7282 { ASSERT(((_Mdl)->MdlFlags & MDL_PARTIAL) != 0); \
7283 MmUnmapLockedPages((_Mdl)->MappedSystemVa, (_Mdl)); \
7284 } \
7285 else if (((_Mdl)->MdlFlags & MDL_PARTIAL) == 0) \
7286 { ASSERT(((_Mdl)->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA) == 0); \
7287 } \
7288 }
7289
7290NTOSAPI VOID DDKAPI
7291MmProbeAndLockPages(
7292 /*IN OUT*/ PMDL MemoryDescriptorList,
7293 /*IN*/ KPROCESSOR_MODE AccessMode,
7294 /*IN*/ LOCK_OPERATION Operation
7295);
7296
7297NTOSAPI MM_SYSTEM_SIZE DDKAPI
7298MmQuerySystemSize( VOID );
7299
7300NTOSAPI NTSTATUS DDKAPI
7301MmRemovePhysicalMemory(
7302 /*IN*/ PPHYSICAL_ADDRESS StartAddress,
7303 /*IN OUT*/ PLARGE_INTEGER NumberOfBytes
7304);
7305
7306NTOSAPI VOID DDKAPI
7307MmResetDriverPaging( /*IN*/ PVOID AddressWithinSection );
7308
7309NTOSAPI HANDLE DDKAPI
7310MmSecureVirtualMemory(
7311 /*IN*/ PVOID Address,
7312 /*IN*/ SIZE_T Size,
7313 /*IN*/ ULONG ProbeMode
7314);
7315
7316NTOSAPI ULONG DDKAPI
7317MmSizeOfMdl( /*IN*/ PVOID Base, /*IN*/ SIZE_T Length );
7318
7319NTOSAPI VOID DDKAPI
7320MmUnlockPagableImageSection( /*IN*/ PVOID ImageSectionHandle );
7321
7322NTOSAPI VOID DDKAPI
7323MmUnlockPages( /*IN*/ PMDL MemoryDescriptorList );
7324
7325NTOSAPI VOID DDKAPI
7326MmUnmapIoSpace( /*IN*/ PVOID BaseAddress, /*IN*/ SIZE_T NumberOfBytes );
7327
7328NTOSAPI VOID DDKAPI
7329MmUnmapReservedMapping(
7330 /*IN*/ PVOID BaseAddress,
7331 /*IN*/ ULONG PoolTag,
7332 /*IN*/ PMDL MemoryDescriptorList
7333);
7334
7335NTOSAPI VOID DDKAPI
7336MmUnmapVideoDisplay( /*IN*/ PVOID BaseAddress, /*IN*/ SIZE_T NumberOfBytes );
7337
7338
7339/** Object manager routines **/
7340
7341NTOSAPI NTSTATUS DDKAPI
7342ObAssignSecurity(
7343 /*IN*/ PACCESS_STATE AccessState,
7344 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
7345 /*IN*/ PVOID Object,
7346 /*IN*/ POBJECT_TYPE Type
7347);
7348
7349NTOSAPI VOID DDKAPI
7350ObDereferenceSecurityDescriptor(
7351 PSECURITY_DESCRIPTOR SecurityDescriptor,
7352 ULONG Count
7353);
7354
7355NTOSAPI VOID DDKFASTAPI
7356ObfDereferenceObject( /*IN*/ PVOID Object );
7357
7358/* VOID ObDereferenceObject( IN PVOID Object )
7359 */
7360#define ObDereferenceObject ObfDereferenceObject
7361
7362NTOSAPI NTSTATUS DDKAPI
7363ObGetObjectSecurity(
7364 /*IN*/ PVOID Object,
7365 /*OUT*/ PSECURITY_DESCRIPTOR *SecurityDescriptor,
7366 /*OUT*/ PBOOLEAN MemoryAllocated
7367);
7368
7369NTOSAPI NTSTATUS DDKAPI
7370ObInsertObject(
7371 /*IN*/ PVOID Object,
7372 /*IN*/ PACCESS_STATE PassedAccessState /*OPTIONAL*/,
7373 /*IN*/ ACCESS_MASK DesiredAccess,
7374 /*IN*/ ULONG AdditionalReferences,
7375 /*OUT*/ PVOID* ReferencedObject /*OPTIONAL*/,
7376 /*OUT*/ PHANDLE Handle
7377);
7378
7379NTOSAPI VOID DDKFASTAPI
7380ObfReferenceObject( /*IN*/ PVOID Object );
7381
7382NTOSAPI NTSTATUS DDKAPI
7383ObLogSecurityDescriptor(
7384 /*IN*/ PSECURITY_DESCRIPTOR InputSecurityDescriptor,
7385 /*OUT*/ PSECURITY_DESCRIPTOR *OutputSecurityDescriptor,
7386 /*IN*/ ULONG RefBias
7387);
7388
7389/* VOID ObReferenceObject( IN PVOID Object )
7390 */
7391#define ObReferenceObject ObfReferenceObject
7392
7393NTOSAPI VOID DDKAPI
7394ObMakeTemporaryObject( /*IN*/ PVOID Object );
7395
7396NTOSAPI NTSTATUS DDKAPI
7397ObOpenObjectByName(
7398 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
7399 /*IN*/ POBJECT_TYPE ObjectType,
7400 /*IN OUT*/ PVOID ParseContext /*OPTIONAL*/,
7401 /*IN*/ KPROCESSOR_MODE AccessMode,
7402 /*IN*/ ACCESS_MASK DesiredAccess,
7403 /*IN*/ PACCESS_STATE PassedAccessState,
7404 /*OUT*/ PHANDLE Handle
7405);
7406
7407NTOSAPI NTSTATUS DDKAPI
7408ObOpenObjectByPointer(
7409 /*IN*/ PVOID Object,
7410 /*IN*/ ULONG HandleAttributes,
7411 /*IN*/ PACCESS_STATE PassedAccessState /*OPTIONAL*/,
7412 /*IN*/ ACCESS_MASK DesiredAccess /*OPTIONAL*/,
7413 /*IN*/ POBJECT_TYPE ObjectType /*OPTIONAL*/,
7414 /*IN*/ KPROCESSOR_MODE AccessMode,
7415 /*OUT*/ PHANDLE Handle
7416);
7417
7418NTOSAPI NTSTATUS DDKAPI
7419ObQueryObjectAuditingByHandle(
7420 /*IN*/ HANDLE Handle,
7421 /*OUT*/ PBOOLEAN GenerateOnClose
7422);
7423
7424NTOSAPI NTSTATUS DDKAPI
7425ObReferenceObjectByHandle(
7426 /*IN*/ HANDLE Handle,
7427 /*IN*/ ACCESS_MASK DesiredAccess,
7428 /*IN*/ POBJECT_TYPE ObjectType /*OPTIONAL*/,
7429 /*IN*/ KPROCESSOR_MODE AccessMode,
7430 /*OUT*/ PVOID *Object,
7431 /*OUT*/ POBJECT_HANDLE_INFORMATION HandleInformation /*OPTIONAL*/
7432);
7433
7434NTOSAPI NTSTATUS DDKAPI
7435ObReferenceObjectByName(
7436 /*IN*/ PUNICODE_STRING ObjectPath,
7437 /*IN*/ ULONG Attributes,
7438 /*IN*/ PACCESS_STATE PassedAccessState /*OPTIONAL*/,
7439 /*IN*/ ACCESS_MASK DesiredAccess /*OPTIONAL*/,
7440 /*IN*/ POBJECT_TYPE ObjectType,
7441 /*IN*/ KPROCESSOR_MODE AccessMode,
7442 /*IN OUT*/ PVOID ParseContext /*OPTIONAL*/,
7443 /*OUT*/ PVOID *Object
7444);
7445
7446NTOSAPI NTSTATUS DDKAPI
7447ObReferenceObjectByPointer(
7448 /*IN*/ PVOID Object,
7449 /*IN*/ ACCESS_MASK DesiredAccess,
7450 /*IN*/ POBJECT_TYPE ObjectType,
7451 /*IN*/ KPROCESSOR_MODE AccessMode
7452);
7453
7454NTOSAPI VOID DDKAPI
7455ObReferenceSecurityDescriptor(
7456 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
7457 /*IN*/ ULONG Count
7458);
7459
7460NTOSAPI VOID DDKAPI
7461ObReleaseObjectSecurity(
7462 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
7463 /*IN*/ BOOLEAN MemoryAllocated
7464);
7465
7466
7467/** Process manager routines **/
7468
7469NTOSAPI NTSTATUS DDKAPI
7470PsCreateSystemProcess(
7471 /*IN*/ PHANDLE ProcessHandle,
7472 /*IN*/ ACCESS_MASK DesiredAccess,
7473 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
7474);
7475
7476NTOSAPI NTSTATUS DDKAPI
7477PsCreateSystemThread(
7478 /*OUT*/ PHANDLE ThreadHandle,
7479 /*IN*/ ULONG DesiredAccess,
7480 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes /*OPTIONAL*/,
7481 /*IN*/ HANDLE ProcessHandle /*OPTIONAL*/,
7482 /*OUT*/ PCLIENT_ID ClientId /*OPTIONAL*/,
7483 /*IN*/ PKSTART_ROUTINE StartRoutine,
7484 /*IN*/ PVOID StartContext
7485);
7486
7487/* PEPROCESS PsGetCurrentProcess( VOID )
7488 */
7489#define PsGetCurrentProcess IoGetCurrentProcess
7490
7491NTOSAPI HANDLE DDKAPI
7492PsGetCurrentProcessId( VOID );
7493
7494/* PETHREAD PsGetCurrentThread( VOID )
7495 */
7496#define PsGetCurrentThread() \
7497 ((PETHREAD) KeGetCurrentThread())
7498
7499NTOSAPI HANDLE DDKAPI
7500PsGetCurrentThreadId( VOID );
7501
7502NTOSAPI BOOLEAN DDKAPI
7503PsGetVersion(
7504 PULONG MajorVersion /*OPTIONAL*/,
7505 PULONG MinorVersion /*OPTIONAL*/,
7506 PULONG BuildNumber /*OPTIONAL*/,
7507 PUNICODE_STRING CSDVersion /*OPTIONAL*/
7508);
7509
7510NTOSAPI NTSTATUS DDKAPI
7511PsRemoveCreateThreadNotifyRoutine(
7512 /*IN*/ PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine
7513);
7514
7515NTOSAPI NTSTATUS DDKAPI
7516PsRemoveLoadImageNotifyRoutine(
7517 /*IN*/ PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine
7518);
7519
7520NTOSAPI NTSTATUS DDKAPI
7521PsSetCreateProcessNotifyRoutine(
7522 /*IN*/ PCREATE_PROCESS_NOTIFY_ROUTINE NotifyRoutine,
7523 /*IN*/ BOOLEAN Remove
7524);
7525
7526NTOSAPI NTSTATUS DDKAPI
7527PsSetCreateThreadNotifyRoutine(
7528 /*IN*/ PCREATE_THREAD_NOTIFY_ROUTINE NotifyRoutine
7529);
7530
7531NTOSAPI NTSTATUS DDKAPI
7532PsSetLoadImageNotifyRoutine( /*IN*/ PLOAD_IMAGE_NOTIFY_ROUTINE NotifyRoutine );
7533
7534NTOSAPI NTSTATUS DDKAPI
7535PsTerminateSystemThread( /*IN*/ NTSTATUS ExitStatus );
7536
7537
7538/** Security reference monitor routines **/
7539
7540NTOSAPI BOOLEAN DDKAPI
7541SeAccessCheck(
7542 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor,
7543 /*IN*/ PSECURITY_SUBJECT_CONTEXT SubjectSecurityContext,
7544 /*IN*/ BOOLEAN SubjectContextLocked,
7545 /*IN*/ ACCESS_MASK DesiredAccess,
7546 /*IN*/ ACCESS_MASK PreviouslyGrantedAccess,
7547 /*OUT*/ PPRIVILEGE_SET *Privileges /*OPTIONAL*/,
7548 /*IN*/ PGENERIC_MAPPING GenericMapping,
7549 /*IN*/ KPROCESSOR_MODE AccessMode,
7550 /*OUT*/ PACCESS_MASK GrantedAccess,
7551 /*OUT*/ PNTSTATUS AccessStatus
7552);
7553
7554NTOSAPI NTSTATUS DDKAPI
7555SeAssignSecurity(
7556 /*IN*/ PSECURITY_DESCRIPTOR ParentDescriptor /*OPTIONAL*/,
7557 /*IN*/ PSECURITY_DESCRIPTOR ExplicitDescriptor /*OPTIONAL*/,
7558 /*OUT*/ PSECURITY_DESCRIPTOR *NewDescriptor,
7559 /*IN*/ BOOLEAN IsDirectoryObject,
7560 /*IN*/ PSECURITY_SUBJECT_CONTEXT SubjectContext,
7561 /*IN*/ PGENERIC_MAPPING GenericMapping,
7562 /*IN*/ POOL_TYPE PoolType
7563);
7564
7565NTOSAPI NTSTATUS DDKAPI
7566SeAssignSecurityEx(
7567 /*IN*/ PSECURITY_DESCRIPTOR ParentDescriptor /*OPTIONAL*/,
7568 /*IN*/ PSECURITY_DESCRIPTOR ExplicitDescriptor /*OPTIONAL*/,
7569 /*OUT*/ PSECURITY_DESCRIPTOR *NewDescriptor,
7570 /*IN*/ GUID *ObjectType /*OPTIONAL*/,
7571 /*IN*/ BOOLEAN IsDirectoryObject,
7572 /*IN*/ ULONG AutoInheritFlags,
7573 /*IN*/ PSECURITY_SUBJECT_CONTEXT SubjectContext,
7574 /*IN*/ PGENERIC_MAPPING GenericMapping,
7575 /*IN*/ POOL_TYPE PoolType
7576);
7577
7578NTOSAPI NTSTATUS DDKAPI
7579SeDeassignSecurity( /*IN OUT*/ PSECURITY_DESCRIPTOR *SecurityDescriptor );
7580
7581NTOSAPI BOOLEAN DDKAPI
7582SeSinglePrivilegeCheck( LUID PrivilegeValue, KPROCESSOR_MODE PreviousMode );
7583
7584NTOSAPI BOOLEAN DDKAPI
7585SeValidSecurityDescriptor(
7586 /*IN*/ ULONG Length,
7587 /*IN*/ PSECURITY_DESCRIPTOR SecurityDescriptor
7588);
7589
7590
7591/** NtXxx routines **/
7592
7593NTOSAPI NTSTATUS DDKAPI
7594NtOpenProcess(
7595 /*OUT*/ PHANDLE ProcessHandle,
7596 /*IN*/ ACCESS_MASK DesiredAccess,
7597 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
7598 /*IN*/ PCLIENT_ID ClientId /*OPTIONAL*/
7599);
7600
7601NTOSAPI NTSTATUS DDKAPI
7602NtQueryInformationProcess(
7603 /*IN*/ HANDLE ProcessHandle,
7604 /*IN*/ PROCESSINFOCLASS ProcessInformationClass,
7605 /*OUT*/ PVOID ProcessInformation,
7606 /*IN*/ ULONG ProcessInformationLength,
7607 /*OUT*/ PULONG ReturnLength /*OPTIONAL*/
7608);
7609
7610
7611/** NtXxx and ZwXxx routines **/
7612
7613NTOSAPI NTSTATUS DDKAPI
7614NtCancelTimer(
7615 /*IN*/ HANDLE TimerHandle,
7616 /*OUT*/ PBOOLEAN CurrentState /*OPTIONAL*/
7617);
7618
7619NTOSAPI NTSTATUS DDKAPI
7620ZwCancelTimer(
7621 /*IN*/ HANDLE TimerHandle,
7622 /*OUT*/ PBOOLEAN CurrentState /*OPTIONAL*/
7623);
7624
7625NTOSAPI NTSTATUS DDKAPI
7626NtClose( /*IN*/ HANDLE Handle );
7627
7628NTOSAPI NTSTATUS DDKAPI
7629ZwClose( /*IN*/ HANDLE Handle );
7630
7631NTOSAPI NTSTATUS DDKAPI
7632NtCreateDirectoryObject(
7633 /*OUT*/ PHANDLE DirectoryHandle,
7634 /*IN*/ ACCESS_MASK DesiredAccess,
7635 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
7636);
7637
7638NTOSAPI NTSTATUS DDKAPI
7639ZwCreateDirectoryObject(
7640 /*OUT*/ PHANDLE DirectoryHandle,
7641 /*IN*/ ACCESS_MASK DesiredAccess,
7642 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
7643);
7644
7645NTOSAPI NTSTATUS DDKAPI
7646NtCreateEvent(
7647 /*OUT*/ PHANDLE EventHandle,
7648 /*IN*/ ACCESS_MASK DesiredAccess,
7649 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
7650 /*IN*/ BOOLEAN ManualReset,
7651 /*IN*/ BOOLEAN InitialState
7652);
7653
7654NTOSAPI NTSTATUS DDKAPI
7655ZwCreateEvent(
7656 /*OUT*/ PHANDLE EventHandle,
7657 /*IN*/ ACCESS_MASK DesiredAccess,
7658 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
7659 /*IN*/ BOOLEAN ManualReset,
7660 /*IN*/ BOOLEAN InitialState
7661);
7662
7663NTOSAPI NTSTATUS DDKAPI
7664NtCreateFile(
7665 /*OUT*/ PHANDLE FileHandle,
7666 /*IN*/ ACCESS_MASK DesiredAccess,
7667 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
7668 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
7669 /*IN*/ PLARGE_INTEGER AllocationSize /*OPTIONAL*/,
7670 /*IN*/ ULONG FileAttributes,
7671 /*IN*/ ULONG ShareAccess,
7672 /*IN*/ ULONG CreateDisposition,
7673 /*IN*/ ULONG CreateOptions,
7674 /*IN*/ PVOID EaBuffer /*OPTIONAL*/,
7675 /*IN*/ ULONG EaLength
7676);
7677
7678NTOSAPI NTSTATUS DDKAPI
7679ZwCreateFile(
7680 /*OUT*/ PHANDLE FileHandle,
7681 /*IN*/ ACCESS_MASK DesiredAccess,
7682 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
7683 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
7684 /*IN*/ PLARGE_INTEGER AllocationSize /*OPTIONAL*/,
7685 /*IN*/ ULONG FileAttributes,
7686 /*IN*/ ULONG ShareAccess,
7687 /*IN*/ ULONG CreateDisposition,
7688 /*IN*/ ULONG CreateOptions,
7689 /*IN*/ PVOID EaBuffer /*OPTIONAL*/,
7690 /*IN*/ ULONG EaLength
7691);
7692
7693NTOSAPI NTSTATUS DDKAPI
7694NtCreateKey(
7695 /*OUT*/ PHANDLE KeyHandle,
7696 /*IN*/ ACCESS_MASK DesiredAccess,
7697 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
7698 /*IN*/ ULONG TitleIndex,
7699 /*IN*/ PUNICODE_STRING Class /*OPTIONAL*/,
7700 /*IN*/ ULONG CreateOptions,
7701 /*OUT*/ PULONG Disposition /*OPTIONAL*/
7702);
7703
7704NTOSAPI NTSTATUS DDKAPI
7705ZwCreateKey(
7706 /*OUT*/ PHANDLE KeyHandle,
7707 /*IN*/ ACCESS_MASK DesiredAccess,
7708 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
7709 /*IN*/ ULONG TitleIndex,
7710 /*IN*/ PUNICODE_STRING Class /*OPTIONAL*/,
7711 /*IN*/ ULONG CreateOptions,
7712 /*OUT*/ PULONG Disposition /*OPTIONAL*/
7713);
7714
7715NTOSAPI NTSTATUS DDKAPI
7716NtCreateTimer(
7717 /*OUT*/ PHANDLE TimerHandle,
7718 /*IN*/ ACCESS_MASK DesiredAccess,
7719 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes /*OPTIONAL*/,
7720 /*IN*/ TIMER_TYPE TimerType
7721);
7722
7723NTOSAPI NTSTATUS DDKAPI
7724ZwCreateTimer(
7725 /*OUT*/ PHANDLE TimerHandle,
7726 /*IN*/ ACCESS_MASK DesiredAccess,
7727 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes /*OPTIONAL*/,
7728 /*IN*/ TIMER_TYPE TimerType
7729);
7730
7731NTOSAPI NTSTATUS DDKAPI
7732NtDeleteKey( /*IN*/ HANDLE KeyHandle );
7733
7734NTOSAPI NTSTATUS DDKAPI
7735ZwDeleteKey( /*IN*/ HANDLE KeyHandle );
7736
7737NTOSAPI NTSTATUS DDKAPI
7738NtDeleteValueKey( /*IN*/ HANDLE KeyHandle, /*IN*/ PUNICODE_STRING ValueName );
7739
7740NTOSAPI NTSTATUS DDKAPI
7741ZwDeleteValueKey( /*IN*/ HANDLE KeyHandle, /*IN*/ PUNICODE_STRING ValueName );
7742
7743NTOSAPI NTSTATUS DDKAPI
7744NtDeviceIoControlFile(
7745 /*IN*/ HANDLE DeviceHandle,
7746 /*IN*/ HANDLE Event /*OPTIONAL*/,
7747 /*IN*/ PIO_APC_ROUTINE UserApcRoutine /*OPTIONAL*/,
7748 /*IN*/ PVOID UserApcContext /*OPTIONAL*/,
7749 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
7750 /*IN*/ ULONG IoControlCode,
7751 /*IN*/ PVOID InputBuffer,
7752 /*IN*/ ULONG InputBufferSize,
7753 /*OUT*/ PVOID OutputBuffer,
7754 /*IN*/ ULONG OutputBufferSize
7755);
7756
7757NTOSAPI NTSTATUS DDKAPI
7758ZwDeviceIoControlFile(
7759 /*IN*/ HANDLE DeviceHandle,
7760 /*IN*/ HANDLE Event /*OPTIONAL*/,
7761 /*IN*/ PIO_APC_ROUTINE UserApcRoutine /*OPTIONAL*/,
7762 /*IN*/ PVOID UserApcContext /*OPTIONAL*/,
7763 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
7764 /*IN*/ ULONG IoControlCode,
7765 /*IN*/ PVOID InputBuffer,
7766 /*IN*/ ULONG InputBufferSize,
7767 /*OUT*/ PVOID OutputBuffer,
7768 /*IN*/ ULONG OutputBufferSize
7769);
7770
7771NTOSAPI NTSTATUS DDKAPI
7772NtEnumerateKey(
7773 /*IN*/ HANDLE KeyHandle,
7774 /*IN*/ ULONG Index,
7775 /*IN*/ KEY_INFORMATION_CLASS KeyInformationClass,
7776 /*OUT*/ PVOID KeyInformation,
7777 /*IN*/ ULONG Length,
7778 /*OUT*/ PULONG ResultLength
7779);
7780
7781NTOSAPI NTSTATUS DDKAPI
7782ZwEnumerateKey(
7783 /*IN*/ HANDLE KeyHandle,
7784 /*IN*/ ULONG Index,
7785 /*IN*/ KEY_INFORMATION_CLASS KeyInformationClass,
7786 /*OUT*/ PVOID KeyInformation,
7787 /*IN*/ ULONG Length,
7788 /*OUT*/ PULONG ResultLength
7789);
7790
7791NTOSAPI NTSTATUS DDKAPI
7792NtEnumerateValueKey(
7793 /*IN*/ HANDLE KeyHandle,
7794 /*IN*/ ULONG Index,
7795 /*IN*/ KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
7796 /*OUT*/ PVOID KeyValueInformation,
7797 /*IN*/ ULONG Length,
7798 /*OUT*/ PULONG ResultLength
7799);
7800
7801NTOSAPI NTSTATUS DDKAPI
7802ZwEnumerateValueKey(
7803 /*IN*/ HANDLE KeyHandle,
7804 /*IN*/ ULONG Index,
7805 /*IN*/ KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
7806 /*OUT*/ PVOID KeyValueInformation,
7807 /*IN*/ ULONG Length,
7808 /*OUT*/ PULONG ResultLength
7809);
7810
7811NTOSAPI NTSTATUS DDKAPI
7812NtFlushKey( /*IN*/ HANDLE KeyHandle );
7813
7814NTOSAPI NTSTATUS DDKAPI
7815ZwFlushKey( /*IN*/ HANDLE KeyHandle );
7816
7817NTOSAPI NTSTATUS DDKAPI
7818NtMakeTemporaryObject( /*IN*/ HANDLE Handle );
7819
7820NTOSAPI NTSTATUS DDKAPI
7821ZwMakeTemporaryObject( /*IN*/ HANDLE Handle );
7822
7823NTOSAPI NTSTATUS DDKAPI
7824NtMapViewOfSection(
7825 /*IN*/ HANDLE SectionHandle,
7826 /*IN*/ HANDLE ProcessHandle,
7827 /*IN OUT*/ PVOID *BaseAddress,
7828 /*IN*/ ULONG ZeroBits,
7829 /*IN*/ ULONG CommitSize,
7830 /*IN OUT*/ PLARGE_INTEGER SectionOffset /*OPTIONAL*/,
7831 /*IN OUT*/ PSIZE_T ViewSize,
7832 /*IN*/ SECTION_INHERIT InheritDisposition,
7833 /*IN*/ ULONG AllocationType,
7834 /*IN*/ ULONG Protect
7835);
7836
7837NTOSAPI NTSTATUS DDKAPI
7838ZwMapViewOfSection(
7839 /*IN*/ HANDLE SectionHandle,
7840 /*IN*/ HANDLE ProcessHandle,
7841 /*IN OUT*/ PVOID *BaseAddress,
7842 /*IN*/ ULONG ZeroBits,
7843 /*IN*/ ULONG CommitSize,
7844 /*IN OUT*/ PLARGE_INTEGER SectionOffset /*OPTIONAL*/,
7845 /*IN OUT*/ PSIZE_T ViewSize,
7846 /*IN*/ SECTION_INHERIT InheritDisposition,
7847 /*IN*/ ULONG AllocationType,
7848 /*IN*/ ULONG Protect
7849);
7850
7851NTOSAPI NTSTATUS DDKAPI
7852NtOpenFile(
7853 /*OUT*/ PHANDLE FileHandle,
7854 /*IN*/ ACCESS_MASK DesiredAccess,
7855 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
7856 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
7857 /*IN*/ ULONG ShareAccess,
7858 /*IN*/ ULONG OpenOptions
7859);
7860
7861NTOSAPI NTSTATUS DDKAPI
7862ZwOpenFile(
7863 /*OUT*/ PHANDLE FileHandle,
7864 /*IN*/ ACCESS_MASK DesiredAccess,
7865 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes,
7866 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
7867 /*IN*/ ULONG ShareAccess,
7868 /*IN*/ ULONG OpenOptions
7869);
7870
7871NTOSAPI NTSTATUS DDKAPI
7872NtOpenKey(
7873 /*OUT*/ PHANDLE KeyHandle,
7874 /*IN*/ ACCESS_MASK DesiredAccess,
7875 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
7876);
7877
7878NTOSAPI NTSTATUS DDKAPI
7879ZwOpenKey(
7880 /*OUT*/ PHANDLE KeyHandle,
7881 /*IN*/ ACCESS_MASK DesiredAccess,
7882 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
7883);
7884
7885NTOSAPI NTSTATUS DDKAPI
7886NtOpenSection(
7887 /*OUT*/ PHANDLE SectionHandle,
7888 /*IN*/ ACCESS_MASK DesiredAccess,
7889 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
7890);
7891
7892NTOSAPI NTSTATUS DDKAPI
7893ZwOpenSection(
7894 /*OUT*/ PHANDLE SectionHandle,
7895 /*IN*/ ACCESS_MASK DesiredAccess,
7896 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
7897);
7898
7899NTOSAPI NTSTATUS DDKAPI
7900NtOpenSymbolicLinkObject(
7901 /*OUT*/ PHANDLE LinkHandle,
7902 /*IN*/ ACCESS_MASK DesiredAccess,
7903 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
7904);
7905
7906NTOSAPI NTSTATUS DDKAPI
7907ZwOpenSymbolicLinkObject(
7908 /*OUT*/ PHANDLE LinkHandle,
7909 /*IN*/ ACCESS_MASK DesiredAccess,
7910 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
7911);
7912
7913NTOSAPI NTSTATUS DDKAPI
7914NtOpenTimer(
7915 /*OUT*/ PHANDLE TimerHandle,
7916 /*IN*/ ACCESS_MASK DesiredAccess,
7917 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
7918);
7919
7920NTOSAPI NTSTATUS DDKAPI
7921ZwOpenTimer(
7922 /*OUT*/ PHANDLE TimerHandle,
7923 /*IN*/ ACCESS_MASK DesiredAccess,
7924 /*IN*/ POBJECT_ATTRIBUTES ObjectAttributes
7925);
7926
7927NTOSAPI NTSTATUS DDKAPI
7928NtQueryInformationFile(
7929 /*IN*/ HANDLE FileHandle,
7930 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
7931 /*OUT*/ PVOID FileInformation,
7932 /*IN*/ ULONG Length,
7933 /*IN*/ FILE_INFORMATION_CLASS FileInformationClass
7934);
7935
7936NTOSAPI NTSTATUS DDKAPI
7937ZwQueryInformationFile(
7938 /*IN*/ HANDLE FileHandle,
7939 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
7940 /*OUT*/ PVOID FileInformation,
7941 /*IN*/ ULONG Length,
7942 /*IN*/ FILE_INFORMATION_CLASS FileInformationClass
7943);
7944
7945NTOSAPI NTSTATUS DDKAPI
7946NtQueryKey(
7947 /*IN*/ HANDLE KeyHandle,
7948 /*IN*/ KEY_INFORMATION_CLASS KeyInformationClass,
7949 /*OUT*/ PVOID KeyInformation,
7950 /*IN*/ ULONG Length,
7951 /*OUT*/ PULONG ResultLength
7952);
7953
7954NTOSAPI NTSTATUS DDKAPI
7955ZwQueryKey(
7956 /*IN*/ HANDLE KeyHandle,
7957 /*IN*/ KEY_INFORMATION_CLASS KeyInformationClass,
7958 /*OUT*/ PVOID KeyInformation,
7959 /*IN*/ ULONG Length,
7960 /*OUT*/ PULONG ResultLength
7961);
7962
7963NTOSAPI NTSTATUS DDKAPI
7964NtQuerySymbolicLinkObject(
7965 /*IN*/ HANDLE LinkHandle,
7966 /*IN OUT*/ PUNICODE_STRING LinkTarget,
7967 /*OUT*/ PULONG ReturnedLength /*OPTIONAL*/
7968);
7969
7970NTOSAPI NTSTATUS DDKAPI
7971ZwQuerySymbolicLinkObject(
7972 /*IN*/ HANDLE LinkHandle,
7973 /*IN OUT*/ PUNICODE_STRING LinkTarget,
7974 /*OUT*/ PULONG ReturnedLength /*OPTIONAL*/
7975);
7976
7977NTOSAPI NTSTATUS DDKAPI
7978NtQueryTimer(
7979 /*IN*/ HANDLE TimerHandle,
7980 /*IN*/ TIMER_INFORMATION_CLASS TimerInformationClass,
7981 /*OUT*/ PVOID TimerInformation,
7982 /*IN*/ ULONG TimerInformationLength,
7983 /*OUT*/ PULONG ReturnedLength /*OPTIONAL*/
7984);
7985
7986NTOSAPI NTSTATUS DDKAPI
7987ZwQueryTimer(
7988 /*IN*/ HANDLE TimerHandle,
7989 /*IN*/ TIMER_INFORMATION_CLASS TimerInformationClass,
7990 /*OUT*/ PVOID TimerInformation,
7991 /*IN*/ ULONG TimerInformationLength,
7992 /*OUT*/ PULONG ReturnedLength /*OPTIONAL*/
7993);
7994
7995NTOSAPI NTSTATUS DDKAPI
7996NtQueryValueKey(
7997 /*IN*/ HANDLE KeyHandle,
7998 /*IN*/ PUNICODE_STRING ValueName,
7999 /*IN*/ KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
8000 /*OUT*/ PVOID KeyValueInformation,
8001 /*IN*/ ULONG Length,
8002 /*OUT*/ PULONG ResultLength
8003);
8004
8005NTOSAPI NTSTATUS DDKAPI
8006ZwQueryValueKey(
8007 /*IN*/ HANDLE KeyHandle,
8008 /*IN*/ PUNICODE_STRING ValueName,
8009 /*IN*/ KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
8010 /*OUT*/ PVOID KeyValueInformation,
8011 /*IN*/ ULONG Length,
8012 /*OUT*/ PULONG ResultLength
8013);
8014
8015NTOSAPI NTSTATUS DDKAPI
8016NtReadFile(
8017 /*IN*/ HANDLE FileHandle,
8018 /*IN*/ HANDLE Event /*OPTIONAL*/,
8019 /*IN*/ PIO_APC_ROUTINE ApcRoutine /*OPTIONAL*/,
8020 /*IN*/ PVOID ApcContext /*OPTIONAL*/,
8021 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8022 /*OUT*/ PVOID Buffer,
8023 /*IN*/ ULONG Length,
8024 /*IN*/ PLARGE_INTEGER ByteOffset /*OPTIONAL*/,
8025 /*IN*/ PULONG Key /*OPTIONAL*/
8026);
8027
8028NTOSAPI NTSTATUS DDKAPI
8029ZwReadFile(
8030 /*IN*/ HANDLE FileHandle,
8031 /*IN*/ HANDLE Event /*OPTIONAL*/,
8032 /*IN*/ PIO_APC_ROUTINE ApcRoutine /*OPTIONAL*/,
8033 /*IN*/ PVOID ApcContext /*OPTIONAL*/,
8034 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8035 /*OUT*/ PVOID Buffer,
8036 /*IN*/ ULONG Length,
8037 /*IN*/ PLARGE_INTEGER ByteOffset /*OPTIONAL*/,
8038 /*IN*/ PULONG Key /*OPTIONAL*/
8039);
8040
8041NTOSAPI NTSTATUS DDKAPI
8042NtSetEvent( /*IN*/ HANDLE EventHandle, /*IN*/ PULONG NumberOfThreadsReleased );
8043
8044NTOSAPI NTSTATUS DDKAPI
8045ZwSetEvent( /*IN*/ HANDLE EventHandle, /*IN*/ PULONG NumberOfThreadsReleased );
8046
8047NTOSAPI NTSTATUS DDKAPI
8048NtSetInformationFile(
8049 /*IN*/ HANDLE FileHandle,
8050 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8051 /*IN*/ PVOID FileInformation,
8052 /*IN*/ ULONG Length,
8053 /*IN*/ FILE_INFORMATION_CLASS FileInformationClass
8054);
8055
8056NTOSAPI NTSTATUS DDKAPI
8057ZwSetInformationFile(
8058 /*IN*/ HANDLE FileHandle,
8059 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8060 /*IN*/ PVOID FileInformation,
8061 /*IN*/ ULONG Length,
8062 /*IN*/ FILE_INFORMATION_CLASS FileInformationClass
8063);
8064
8065NTOSAPI NTSTATUS DDKAPI
8066NtSetInformationThread(
8067 /*IN*/ HANDLE ThreadHandle,
8068 /*IN*/ THREADINFOCLASS ThreadInformationClass,
8069 /*IN*/ PVOID ThreadInformation,
8070 /*IN*/ ULONG ThreadInformationLength
8071);
8072
8073NTOSAPI NTSTATUS DDKAPI
8074ZwSetInformationThread(
8075 /*IN*/ HANDLE ThreadHandle,
8076 /*IN*/ THREADINFOCLASS ThreadInformationClass,
8077 /*IN*/ PVOID ThreadInformation,
8078 /*IN*/ ULONG ThreadInformationLength
8079);
8080
8081NTOSAPI NTSTATUS DDKAPI
8082NtSetTimer(
8083 /*IN*/ HANDLE TimerHandle,
8084 /*IN*/ PLARGE_INTEGER DueTime,
8085 /*IN*/ PTIMER_APC_ROUTINE TimerApcRoutine /*OPTIONAL*/,
8086 /*IN*/ PVOID TimerContext /*OPTIONAL*/,
8087 /*IN*/ BOOLEAN WakeTimer,
8088 /*IN*/ LONG Period /*OPTIONAL*/,
8089 /*OUT*/ PBOOLEAN PreviousState /*OPTIONAL*/
8090);
8091
8092NTOSAPI NTSTATUS DDKAPI
8093ZwSetTimer(
8094 /*IN*/ HANDLE TimerHandle,
8095 /*IN*/ PLARGE_INTEGER DueTime,
8096 /*IN*/ PTIMER_APC_ROUTINE TimerApcRoutine /*OPTIONAL*/,
8097 /*IN*/ PVOID TimerContext /*OPTIONAL*/,
8098 /*IN*/ BOOLEAN WakeTimer,
8099 /*IN*/ LONG Period /*OPTIONAL*/,
8100 /*OUT*/ PBOOLEAN PreviousState /*OPTIONAL*/
8101);
8102
8103NTOSAPI NTSTATUS DDKAPI
8104NtSetValueKey(
8105 /*IN*/ HANDLE KeyHandle,
8106 /*IN*/ PUNICODE_STRING ValueName,
8107 /*IN*/ ULONG TitleIndex /*OPTIONAL*/,
8108 /*IN*/ ULONG Type,
8109 /*IN*/ PVOID Data,
8110 /*IN*/ ULONG DataSize
8111);
8112
8113NTOSAPI NTSTATUS DDKAPI
8114ZwSetValueKey(
8115 /*IN*/ HANDLE KeyHandle,
8116 /*IN*/ PUNICODE_STRING ValueName,
8117 /*IN*/ ULONG TitleIndex /*OPTIONAL*/,
8118 /*IN*/ ULONG Type,
8119 /*IN*/ PVOID Data,
8120 /*IN*/ ULONG DataSize
8121);
8122
8123/* [Nt|Zw]MapViewOfSection.InheritDisposition constants
8124 */
8125#define AT_EXTENDABLE_FILE 0x00002000
8126#define SEC_NO_CHANGE 0x00400000
8127#define AT_RESERVED 0x20000000
8128#define AT_ROUND_TO_PAGE 0x40000000
8129
8130NTOSAPI NTSTATUS DDKAPI
8131NtUnmapViewOfSection( /*IN*/ HANDLE ProcessHandle, /*IN*/ PVOID BaseAddress );
8132
8133NTOSAPI NTSTATUS DDKAPI
8134ZwUnmapViewOfSection( /*IN*/ HANDLE ProcessHandle, /*IN*/ PVOID BaseAddress );
8135
8136NTOSAPI NTSTATUS DDKAPI
8137NtWaitForSingleObject(
8138 /*IN*/ HANDLE Object,
8139 /*IN*/ BOOLEAN Alertable,
8140 /*IN*/ PLARGE_INTEGER Time
8141);
8142
8143NTOSAPI NTSTATUS DDKAPI
8144ZwWaitForSingleObject(
8145 /*IN*/ HANDLE Object,
8146 /*IN*/ BOOLEAN Alertable,
8147 /*IN*/ PLARGE_INTEGER Time
8148);
8149
8150NTOSAPI NTSTATUS DDKAPI
8151NtWriteFile(
8152 /*IN*/ HANDLE FileHandle,
8153 /*IN*/ HANDLE Event /*OPTIONAL*/,
8154 /*IN*/ PIO_APC_ROUTINE ApcRoutine /*OPTIONAL*/,
8155 /*IN*/ PVOID ApcContext /*OPTIONAL*/,
8156 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8157 /*IN*/ PVOID Buffer,
8158 /*IN*/ ULONG Length,
8159 /*IN*/ PLARGE_INTEGER ByteOffset /*OPTIONAL*/,
8160 /*IN*/ PULONG Key /*OPTIONAL*/
8161);
8162
8163NTOSAPI NTSTATUS DDKAPI
8164ZwWriteFile(
8165 /*IN*/ HANDLE FileHandle,
8166 /*IN*/ HANDLE Event /*OPTIONAL*/,
8167 /*IN*/ PIO_APC_ROUTINE ApcRoutine /*OPTIONAL*/,
8168 /*IN*/ PVOID ApcContext /*OPTIONAL*/,
8169 /*OUT*/ PIO_STATUS_BLOCK IoStatusBlock,
8170 /*IN*/ PVOID Buffer,
8171 /*IN*/ ULONG Length,
8172 /*IN*/ PLARGE_INTEGER ByteOffset /*OPTIONAL*/,
8173 /*IN*/ PULONG Key /*OPTIONAL*/
8174);
8175
8176
8177/** Power management support routines **/
8178
8179NTOSAPI NTSTATUS DDKAPI
8180PoCallDriver( /*IN*/ PDEVICE_OBJECT DeviceObject, /*IN OUT*/ PIRP Irp );
8181
8182NTOSAPI PULONG DDKAPI
8183PoRegisterDeviceForIdleDetection(
8184 /*IN*/ PDEVICE_OBJECT DeviceObject,
8185 /*IN*/ ULONG ConservationIdleTime,
8186 /*IN*/ ULONG PerformanceIdleTime,
8187 /*IN*/ DEVICE_POWER_STATE State
8188);
8189
8190NTOSAPI PVOID DDKAPI
8191PoRegisterSystemState( /*IN*/ PVOID StateHandle, /*IN*/ EXECUTION_STATE Flags );
8192
8193NTOSAPI NTSTATUS DDKAPI
8194PoRequestPowerIrp(
8195 /*IN*/ PDEVICE_OBJECT DeviceObject,
8196 /*IN*/ UCHAR MinorFunction,
8197 /*IN*/ POWER_STATE PowerState,
8198 /*IN*/ PREQUEST_POWER_COMPLETE CompletionFunction,
8199 /*IN*/ PVOID Context,
8200 /*OUT*/ PIRP *Irp /*OPTIONAL*/
8201);
8202
8203NTOSAPI NTSTATUS DDKAPI
8204PoRequestShutdownEvent( /*OUT*/ PVOID *Event );
8205
8206NTOSAPI VOID DDKAPI
8207PoSetDeviceBusy( PULONG IdlePointer );
8208
8209NTOSAPI POWER_STATE DDKAPI
8210PoSetPowerState(
8211 /*IN*/ PDEVICE_OBJECT DeviceObject,
8212 /*IN*/ POWER_STATE_TYPE Type,
8213 /*IN*/ POWER_STATE State
8214);
8215
8216NTOSAPI VOID DDKAPI
8217PoSetSystemState( /*IN*/ EXECUTION_STATE Flags );
8218
8219NTOSAPI VOID DDKAPI
8220PoStartNextPowerIrp( /*IN*/ PIRP Irp );
8221
8222NTOSAPI VOID DDKAPI
8223PoUnregisterSystemState( /*IN*/ PVOID StateHandle );
8224
8225
8226/** WMI library support routines **/
8227
8228NTOSAPI NTSTATUS DDKAPI
8229WmiCompleteRequest(
8230 /*IN*/ PDEVICE_OBJECT DeviceObject,
8231 /*IN*/ PIRP Irp,
8232 /*IN*/ NTSTATUS Status,
8233 /*IN*/ ULONG BufferUsed,
8234 /*IN*/ CCHAR PriorityBoost
8235);
8236
8237NTOSAPI NTSTATUS DDKAPI
8238WmiFireEvent(
8239 /*IN*/ PDEVICE_OBJECT DeviceObject,
8240 /*IN*/ LPGUID Guid,
8241 /*IN*/ ULONG InstanceIndex,
8242 /*IN*/ ULONG EventDataSize,
8243 /*IN*/ PVOID EventData
8244);
8245
8246NTOSAPI NTSTATUS DDKAPI
8247WmiQueryTraceInformation(
8248 /*IN*/ TRACE_INFORMATION_CLASS TraceInformationClass,
8249 /*OUT*/ PVOID TraceInformation,
8250 /*IN*/ ULONG TraceInformationLength,
8251 /*OUT*/ PULONG RequiredLength /*OPTIONAL*/,
8252 /*IN*/ PVOID Buffer /*OPTIONAL*/
8253);
8254
8255NTOSAPI NTSTATUS DDKAPI
8256WmiSystemControl(
8257 /*IN*/ PWMILIB_CONTEXT WmiLibInfo,
8258 /*IN*/ PDEVICE_OBJECT DeviceObject,
8259 /*IN*/ PIRP Irp,
8260 /*OUT*/ PSYSCTL_IRP_DISPOSITION IrpDisposition
8261);
8262
8263NTOSAPI NTSTATUS DDKCDECLAPI
8264WmiTraceMessage(
8265 /*IN*/ TRACEHANDLE LoggerHandle,
8266 /*IN*/ ULONG MessageFlags,
8267 /*IN*/ LPGUID MessageGuid,
8268 /*IN*/ USHORT MessageNumber,
8269 /*IN*/ ...
8270);
8271
8272#if 0
8273/* FIXME: Get va_list from where? */
8274NTOSAPI NTSTATUS DDKCDECLAPI
8275WmiTraceMessageVa(
8276 /*IN*/ TRACEHANDLE LoggerHandle,
8277 /*IN*/ ULONG MessageFlags,
8278 /*IN*/ LPGUID MessageGuid,
8279 /*IN*/ USHORT MessageNumber,
8280 /*IN*/ va_list MessageArgList
8281);
8282#endif
8283
8284
8285/** Kernel debugger routines **/
8286
8287NTOSAPI VOID DDKAPI
8288KdDisableDebugger( VOID );
8289
8290NTOSAPI VOID DDKAPI
8291KdEnableDebugger( VOID );
8292
8293NTOSAPI VOID DDKAPI
8294DbgBreakPoint( VOID );
8295
8296NTOSAPI VOID DDKAPI
8297DbgBreakPointWithStatus( /*IN*/ ULONG Status );
8298
8299NTOSAPI ULONG DDKCDECLAPI
8300DbgPrint( /*IN*/ PCH Format, /*IN*/ ... );
8301
8302NTOSAPI ULONG DDKCDECLAPI
8303DbgPrintEx(
8304 /*IN*/ ULONG ComponentId,
8305 /*IN*/ ULONG Level,
8306 /*IN*/ PCH Format,
8307 /*IN*/ ...
8308);
8309
8310NTOSAPI ULONG DDKCDECLAPI
8311DbgPrintReturnControlC( /*IN*/ PCH Format, /*IN*/ ... );
8312
8313NTOSAPI NTSTATUS DDKAPI
8314DbgQueryDebugFilterState( /*IN*/ ULONG ComponentId, /*IN*/ ULONG Level );
8315
8316NTOSAPI NTSTATUS DDKAPI
8317DbgSetDebugFilterState(
8318 /*IN*/ ULONG ComponentId,
8319 /*IN*/ ULONG Level,
8320 /*IN*/ BOOLEAN State
8321);
8322
8323#ifdef DBG
8324
8325#define KdPrint(_x_) DbgPrint _x_
8326#define KdPrintEx(_x_) DbgPrintEx _x_
8327#define KdBreakPoint() DbgBreakPoint()
8328#define KdBreakPointWithStatus(s) DbgBreakPointWithStatus(s)
8329
8330#else /* !DBG */
8331
8332#define KdPrint(_x_)
8333#define KdPrintEx(_x_)
8334#define KdBreakPoint()
8335#define KdBreakPointWithStatus(s)
8336
8337#endif /* !DBG */
8338
8339extern NTOSAPI PBOOLEAN KdDebuggerNotPresent;
8340extern NTOSAPI PBOOLEAN KdDebuggerEnabled;
8341#define KD_DEBUGGER_ENABLED *KdDebuggerEnabled
8342#define KD_DEBUGGER_NOT_PRESENT *KdDebuggerNotPresent
8343
8344_END_C_DECLS
8345
8346#endif /* _DDK_WINDDK_H */
8347#endif /* _DDK_NTDDK_H || __WINIOCTL_H_SOURCED__ */
8348#endif /* !_DDK_WINDDK_H: $RCSfile: winddk.h,v $: end of file */
Note: See TracBrowser for help on using the repository browser.