- Move more stuff to wdm.h
[reactos.git] / include / ddk / wdm.h
1 #ifndef _WDMDDK_
2 #define _WDMDDK_
3
4 /* Helper macro to enable gcc's extension. */
5 #ifndef __GNU_EXTENSION
6 #ifdef __GNUC__
7 #define __GNU_EXTENSION __extension__
8 #else
9 #define __GNU_EXTENSION
10 #endif
11 #endif
12
13 //
14 // Dependencies
15 //
16 #define NT_INCLUDED
17 #include <excpt.h>
18 #include <ntdef.h>
19 #include <ntstatus.h>
20
21 #ifndef GUID_DEFINED
22 #include <guiddef.h>
23 #endif /* GUID_DEFINED */
24
25 #include "intrin.h"
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 #define NTKERNELAPI DECLSPEC_IMPORT
32
33 #ifdef _WIN64
34 #define PORT_MAXIMUM_MESSAGE_LENGTH 512
35 #else
36 #define PORT_MAXIMUM_MESSAGE_LENGTH 256
37 #endif
38
39
40 #if defined(_MSC_VER)
41
42 //
43 // Indicate if #pragma alloc_text() is supported
44 //
45 #if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_IA64)
46 #define ALLOC_PRAGMA 1
47 #endif
48
49 //
50 // Indicate if #pragma data_seg() is supported
51 //
52 #if defined(_M_IX86) || defined(_M_AMD64)
53 #define ALLOC_DATA_PRAGMA 1
54 #endif
55
56 #endif
57
58
59 /*
60 * Alignment Macros
61 */
62 #define ALIGN_DOWN(s, t) \
63 ((ULONG)(s) & ~(sizeof(t) - 1))
64
65 #define ALIGN_UP(s, t) \
66 (ALIGN_DOWN(((ULONG)(s) + sizeof(t) - 1), t))
67
68 #define ALIGN_DOWN_POINTER(p, t) \
69 ((PVOID)((ULONG_PTR)(p) & ~((ULONG_PTR)sizeof(t) - 1)))
70
71 #define ALIGN_UP_POINTER(p, t) \
72 (ALIGN_DOWN_POINTER(((ULONG_PTR)(p) + sizeof(t) - 1), t))
73
74 /*
75 * GUID Comparison
76 */
77
78 #ifndef __IID_ALIGNED__
79 #define __IID_ALIGNED__
80 #ifdef __cplusplus
81 inline int IsEqualGUIDAligned(REFGUID guid1, REFGUID guid2)
82 {
83 return ((*(PLONGLONG)(&guid1) == *(PLONGLONG)(&guid2)) && (*((PLONGLONG)(&guid1) + 1) == *((PLONGLONG)(&guid2) + 1)));
84 }
85 #else
86 #define IsEqualGUIDAligned(guid1, guid2) \
87 ((*(PLONGLONG)(guid1) == *(PLONGLONG)(guid2)) && (*((PLONGLONG)(guid1) + 1) == *((PLONGLONG)(guid2) + 1)))
88 #endif
89 #endif
90
91 #if defined(_WIN64)
92 #define POINTER_ALIGNMENT DECLSPEC_ALIGN(8)
93 #else
94 #define POINTER_ALIGNMENT
95 #endif
96
97 /*
98 ** Forward declarations
99 */
100
101 struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _IRP;
102 struct _MDL;
103 struct _KAPC;
104 struct _KDPC;
105 struct _FILE_OBJECT;
106 struct _DMA_ADAPTER;
107 struct _DEVICE_OBJECT;
108 struct _DRIVER_OBJECT;
109 struct _IO_STATUS_BLOCK;
110 struct _DEVICE_DESCRIPTION;
111 struct _SCATTER_GATHER_LIST;
112 struct _DRIVE_LAYOUT_INFORMATION;
113
114 typedef PVOID PSID;
115
116 /*
117 ** Simple structures
118 */
119
120 typedef UCHAR KIRQL, *PKIRQL;
121
122 typedef enum _MODE {
123 KernelMode,
124 UserMode,
125 MaximumMode
126 } MODE;
127
128 /* Constants */
129 #define NtCurrentProcess() ( (HANDLE)(LONG_PTR) -1 )
130 #define ZwCurrentProcess() NtCurrentProcess()
131 #define NtCurrentThread() ( (HANDLE)(LONG_PTR) -2 )
132 #define ZwCurrentThread() NtCurrentThread()
133
134 #if (_M_IX86)
135 #define KIP0PCRADDRESS 0xffdff000
136 #endif
137
138 #if defined(_WIN64)
139 #define MAXIMUM_PROCESSORS 64
140 #else
141 #define MAXIMUM_PROCESSORS 32
142 #endif
143
144 #define MAXIMUM_WAIT_OBJECTS 64
145
146 #define EX_RUNDOWN_ACTIVE 0x1
147 #define EX_RUNDOWN_COUNT_SHIFT 0x1
148 #define EX_RUNDOWN_COUNT_INC (1 << EX_RUNDOWN_COUNT_SHIFT)
149
150 #define METHOD_BUFFERED 0
151 #define METHOD_IN_DIRECT 1
152 #define METHOD_OUT_DIRECT 2
153 #define METHOD_NEITHER 3
154
155 #define LOW_PRIORITY 0
156 #define LOW_REALTIME_PRIORITY 16
157 #define HIGH_PRIORITY 31
158 #define MAXIMUM_PRIORITY 32
159
160 #define MAXIMUM_SUSPEND_COUNT MAXCHAR
161
162 #define MAXIMUM_FILENAME_LENGTH 256
163
164 #define FILE_SUPERSEDED 0x00000000
165 #define FILE_OPENED 0x00000001
166 #define FILE_CREATED 0x00000002
167 #define FILE_OVERWRITTEN 0x00000003
168 #define FILE_EXISTS 0x00000004
169 #define FILE_DOES_NOT_EXIST 0x00000005
170
171 #define FILE_USE_FILE_POINTER_POSITION 0xfffffffe
172 #define FILE_WRITE_TO_END_OF_FILE 0xffffffff
173
174 /* also in winnt.h */
175 #define FILE_LIST_DIRECTORY 0x00000001
176 #define FILE_READ_DATA 0x00000001
177 #define FILE_ADD_FILE 0x00000002
178 #define FILE_WRITE_DATA 0x00000002
179 #define FILE_ADD_SUBDIRECTORY 0x00000004
180 #define FILE_APPEND_DATA 0x00000004
181 #define FILE_CREATE_PIPE_INSTANCE 0x00000004
182 #define FILE_READ_EA 0x00000008
183 #define FILE_WRITE_EA 0x00000010
184 #define FILE_EXECUTE 0x00000020
185 #define FILE_TRAVERSE 0x00000020
186 #define FILE_DELETE_CHILD 0x00000040
187 #define FILE_READ_ATTRIBUTES 0x00000080
188 #define FILE_WRITE_ATTRIBUTES 0x00000100
189
190 #define FILE_SHARE_READ 0x00000001
191 #define FILE_SHARE_WRITE 0x00000002
192 #define FILE_SHARE_DELETE 0x00000004
193 #define FILE_SHARE_VALID_FLAGS 0x00000007
194
195 #define FILE_ATTRIBUTE_READONLY 0x00000001
196 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
197 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
198 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
199 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
200 #define FILE_ATTRIBUTE_DEVICE 0x00000040
201 #define FILE_ATTRIBUTE_NORMAL 0x00000080
202 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
203 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
204 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
205 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
206 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
207 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
208 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
209
210 #define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
211 #define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
212
213 #define FILE_VALID_OPTION_FLAGS 0x00ffffff
214 #define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032
215 #define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032
216 #define FILE_VALID_SET_FLAGS 0x00000036
217
218 #define FILE_SUPERSEDE 0x00000000
219 #define FILE_OPEN 0x00000001
220 #define FILE_CREATE 0x00000002
221 #define FILE_OPEN_IF 0x00000003
222 #define FILE_OVERWRITE 0x00000004
223 #define FILE_OVERWRITE_IF 0x00000005
224 #define FILE_MAXIMUM_DISPOSITION 0x00000005
225
226 #define FILE_DIRECTORY_FILE 0x00000001
227 #define FILE_WRITE_THROUGH 0x00000002
228 #define FILE_SEQUENTIAL_ONLY 0x00000004
229 #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
230 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
231 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
232 #define FILE_NON_DIRECTORY_FILE 0x00000040
233 #define FILE_CREATE_TREE_CONNECTION 0x00000080
234 #define FILE_COMPLETE_IF_OPLOCKED 0x00000100
235 #define FILE_NO_EA_KNOWLEDGE 0x00000200
236 #define FILE_OPEN_REMOTE_INSTANCE 0x00000400
237 #define FILE_RANDOM_ACCESS 0x00000800
238 #define FILE_DELETE_ON_CLOSE 0x00001000
239 #define FILE_OPEN_BY_FILE_ID 0x00002000
240 #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
241 #define FILE_NO_COMPRESSION 0x00008000
242 #define FILE_RESERVE_OPFILTER 0x00100000
243 #define FILE_OPEN_REPARSE_POINT 0x00200000
244 #define FILE_OPEN_NO_RECALL 0x00400000
245 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
246
247 #define FILE_ANY_ACCESS 0x00000000
248 #define FILE_SPECIAL_ACCESS FILE_ANY_ACCESS
249 #define FILE_READ_ACCESS 0x00000001
250 #define FILE_WRITE_ACCESS 0x00000002
251
252 #define FILE_ALL_ACCESS \
253 (STANDARD_RIGHTS_REQUIRED | \
254 SYNCHRONIZE | \
255 0x1FF)
256
257 #define FILE_GENERIC_EXECUTE \
258 (STANDARD_RIGHTS_EXECUTE | \
259 FILE_READ_ATTRIBUTES | \
260 FILE_EXECUTE | \
261 SYNCHRONIZE)
262
263 #define FILE_GENERIC_READ \
264 (STANDARD_RIGHTS_READ | \
265 FILE_READ_DATA | \
266 FILE_READ_ATTRIBUTES | \
267 FILE_READ_EA | \
268 SYNCHRONIZE)
269
270 #define FILE_GENERIC_WRITE \
271 (STANDARD_RIGHTS_WRITE | \
272 FILE_WRITE_DATA | \
273 FILE_WRITE_ATTRIBUTES | \
274 FILE_WRITE_EA | \
275 FILE_APPEND_DATA | \
276 SYNCHRONIZE)
277
278 /* end winnt.h */
279
280 #define OBJ_NAME_PATH_SEPARATOR ((WCHAR)L'\\')
281
282 #define OBJECT_TYPE_CREATE (0x0001)
283 #define OBJECT_TYPE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
284
285 #define DIRECTORY_QUERY (0x0001)
286 #define DIRECTORY_TRAVERSE (0x0002)
287 #define DIRECTORY_CREATE_OBJECT (0x0004)
288 #define DIRECTORY_CREATE_SUBDIRECTORY (0x0008)
289 #define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF)
290
291 #define EVENT_QUERY_STATE (0x0001)
292 #define EVENT_MODIFY_STATE (0x0002)
293 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3)
294
295 #define SEMAPHORE_QUERY_STATE (0x0001)
296 #define SEMAPHORE_MODIFY_STATE (0x0002)
297 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3)
298
299 #define FM_LOCK_BIT (0x1)
300 #define FM_LOCK_BIT_V (0x0)
301 #define FM_LOCK_WAITER_WOKEN (0x2)
302 #define FM_LOCK_WAITER_INC (0x4)
303
304 #define PROCESSOR_FEATURE_MAX 64
305
306 typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE
307 {
308 StandardDesign,
309 NEC98x86,
310 EndAlternatives
311 } ALTERNATIVE_ARCHITECTURE_TYPE;
312
313 typedef struct _KSYSTEM_TIME
314 {
315 ULONG LowPart;
316 LONG High1Time;
317 LONG High2Time;
318 } KSYSTEM_TIME, *PKSYSTEM_TIME;
319
320 /*
321 ** IRP function codes
322 */
323
324 #define IRP_MJ_CREATE 0x00
325 #define IRP_MJ_CREATE_NAMED_PIPE 0x01
326 #define IRP_MJ_CLOSE 0x02
327 #define IRP_MJ_READ 0x03
328 #define IRP_MJ_WRITE 0x04
329 #define IRP_MJ_QUERY_INFORMATION 0x05
330 #define IRP_MJ_SET_INFORMATION 0x06
331 #define IRP_MJ_QUERY_EA 0x07
332 #define IRP_MJ_SET_EA 0x08
333 #define IRP_MJ_FLUSH_BUFFERS 0x09
334 #define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a
335 #define IRP_MJ_SET_VOLUME_INFORMATION 0x0b
336 #define IRP_MJ_DIRECTORY_CONTROL 0x0c
337 #define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d
338 #define IRP_MJ_DEVICE_CONTROL 0x0e
339 #define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f
340 #define IRP_MJ_SCSI 0x0f
341 #define IRP_MJ_SHUTDOWN 0x10
342 #define IRP_MJ_LOCK_CONTROL 0x11
343 #define IRP_MJ_CLEANUP 0x12
344 #define IRP_MJ_CREATE_MAILSLOT 0x13
345 #define IRP_MJ_QUERY_SECURITY 0x14
346 #define IRP_MJ_SET_SECURITY 0x15
347 #define IRP_MJ_POWER 0x16
348 #define IRP_MJ_SYSTEM_CONTROL 0x17
349 #define IRP_MJ_DEVICE_CHANGE 0x18
350 #define IRP_MJ_QUERY_QUOTA 0x19
351 #define IRP_MJ_SET_QUOTA 0x1a
352 #define IRP_MJ_PNP 0x1b
353 #define IRP_MJ_PNP_POWER 0x1b
354 #define IRP_MJ_MAXIMUM_FUNCTION 0x1b
355
356 #define IRP_MN_SCSI_CLASS 0x01
357
358 #define IRP_MN_START_DEVICE 0x00
359 #define IRP_MN_QUERY_REMOVE_DEVICE 0x01
360 #define IRP_MN_REMOVE_DEVICE 0x02
361 #define IRP_MN_CANCEL_REMOVE_DEVICE 0x03
362 #define IRP_MN_STOP_DEVICE 0x04
363 #define IRP_MN_QUERY_STOP_DEVICE 0x05
364 #define IRP_MN_CANCEL_STOP_DEVICE 0x06
365
366 #define IRP_MN_QUERY_DEVICE_RELATIONS 0x07
367 #define IRP_MN_QUERY_INTERFACE 0x08
368 #define IRP_MN_QUERY_CAPABILITIES 0x09
369 #define IRP_MN_QUERY_RESOURCES 0x0A
370 #define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B
371 #define IRP_MN_QUERY_DEVICE_TEXT 0x0C
372 #define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D
373
374 #define IRP_MN_READ_CONFIG 0x0F
375 #define IRP_MN_WRITE_CONFIG 0x10
376 #define IRP_MN_EJECT 0x11
377 #define IRP_MN_SET_LOCK 0x12
378 #define IRP_MN_QUERY_ID 0x13
379 #define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14
380 #define IRP_MN_QUERY_BUS_INFORMATION 0x15
381 #define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16
382 #define IRP_MN_SURPRISE_REMOVAL 0x17
383
384 #define IRP_MN_WAIT_WAKE 0x00
385 #define IRP_MN_POWER_SEQUENCE 0x01
386 #define IRP_MN_SET_POWER 0x02
387 #define IRP_MN_QUERY_POWER 0x03
388
389 #define IRP_MN_QUERY_ALL_DATA 0x00
390 #define IRP_MN_QUERY_SINGLE_INSTANCE 0x01
391 #define IRP_MN_CHANGE_SINGLE_INSTANCE 0x02
392 #define IRP_MN_CHANGE_SINGLE_ITEM 0x03
393 #define IRP_MN_ENABLE_EVENTS 0x04
394 #define IRP_MN_DISABLE_EVENTS 0x05
395 #define IRP_MN_ENABLE_COLLECTION 0x06
396 #define IRP_MN_DISABLE_COLLECTION 0x07
397 #define IRP_MN_REGINFO 0x08
398 #define IRP_MN_EXECUTE_METHOD 0x09
399
400 #define IRP_MN_REGINFO_EX 0x0b
401
402 typedef enum _IO_PAGING_PRIORITY {
403 IoPagingPriorityInvalid,
404 IoPagingPriorityNormal,
405 IoPagingPriorityHigh,
406 IoPagingPriorityReserved1,
407 IoPagingPriorityReserved2
408 } IO_PAGING_PRIORITY;
409
410 typedef enum _IO_ALLOCATION_ACTION {
411 KeepObject = 1,
412 DeallocateObject,
413 DeallocateObjectKeepRegisters
414 } IO_ALLOCATION_ACTION, *PIO_ALLOCATION_ACTION;
415
416 typedef IO_ALLOCATION_ACTION
417 (DDKAPI *PDRIVER_CONTROL)(
418 IN struct _DEVICE_OBJECT *DeviceObject,
419 IN struct _IRP *Irp,
420 IN PVOID MapRegisterBase,
421 IN PVOID Context);
422
423 typedef VOID
424 (DDKAPI *PDRIVER_LIST_CONTROL)(
425 IN struct _DEVICE_OBJECT *DeviceObject,
426 IN struct _IRP *Irp,
427 IN struct _SCATTER_GATHER_LIST *ScatterGather,
428 IN PVOID Context);
429
430 typedef NTSTATUS
431 (DDKAPI DRIVER_ADD_DEVICE)(
432 IN struct _DRIVER_OBJECT *DriverObject,
433 IN struct _DEVICE_OBJECT *PhysicalDeviceObject);
434 typedef DRIVER_ADD_DEVICE *PDRIVER_ADD_DEVICE;
435
436 typedef NTSTATUS
437 (DDKAPI IO_COMPLETION_ROUTINE)(
438 IN struct _DEVICE_OBJECT *DeviceObject,
439 IN struct _IRP *Irp,
440 IN PVOID Context);
441 typedef IO_COMPLETION_ROUTINE *PIO_COMPLETION_ROUTINE;
442
443 typedef VOID
444 (DDKAPI DRIVER_CANCEL)(
445 IN struct _DEVICE_OBJECT *DeviceObject,
446 IN struct _IRP *Irp);
447 typedef DRIVER_CANCEL *PDRIVER_CANCEL;
448
449 typedef VOID
450 (DDKAPI *PKDEFERRED_ROUTINE)(
451 IN struct _KDPC *Dpc,
452 IN PVOID DeferredContext,
453 IN PVOID SystemArgument1,
454 IN PVOID SystemArgument2);
455
456 typedef NTSTATUS
457 (DDKAPI DRIVER_DISPATCH)(
458 IN struct _DEVICE_OBJECT *DeviceObject,
459 IN struct _IRP *Irp);
460 typedef DRIVER_DISPATCH *PDRIVER_DISPATCH;
461
462 typedef VOID
463 (DDKAPI *PIO_DPC_ROUTINE)(
464 IN struct _KDPC *Dpc,
465 IN struct _DEVICE_OBJECT *DeviceObject,
466 IN struct _IRP *Irp,
467 IN PVOID Context);
468
469 typedef NTSTATUS
470 (DDKAPI *PMM_DLL_INITIALIZE)(
471 IN PUNICODE_STRING RegistryPath);
472
473 typedef NTSTATUS
474 (DDKAPI *PMM_DLL_UNLOAD)(
475 VOID);
476
477 typedef NTSTATUS
478 (DDKAPI DRIVER_INITIALIZE)(
479 IN struct _DRIVER_OBJECT *DriverObject,
480 IN PUNICODE_STRING RegistryPath);
481 typedef DRIVER_INITIALIZE *PDRIVER_INITIALIZE;
482
483 typedef BOOLEAN
484 (DDKAPI KSERVICE_ROUTINE)(
485 IN struct _KINTERRUPT *Interrupt,
486 IN PVOID ServiceContext);
487 typedef KSERVICE_ROUTINE *PKSERVICE_ROUTINE;
488
489 typedef VOID
490 (DDKAPI *PIO_TIMER_ROUTINE)(
491 IN struct _DEVICE_OBJECT *DeviceObject,
492 IN PVOID Context);
493
494 typedef VOID
495 (DDKAPI DRIVER_STARTIO)(
496 IN struct _DEVICE_OBJECT *DeviceObject,
497 IN struct _IRP *Irp);
498 typedef DRIVER_STARTIO *PDRIVER_STARTIO;
499
500 typedef BOOLEAN
501 (DDKAPI *PKSYNCHRONIZE_ROUTINE)(
502 IN PVOID SynchronizeContext);
503
504 typedef VOID
505 (DDKAPI DRIVER_UNLOAD)(
506 IN struct _DRIVER_OBJECT *DriverObject);
507 typedef DRIVER_UNLOAD *PDRIVER_UNLOAD;
508
509 /*
510 ** Plug and Play structures
511 */
512
513 typedef VOID
514 (DDKAPI *PINTERFACE_REFERENCE)(
515 PVOID Context);
516
517 typedef VOID
518 (DDKAPI *PINTERFACE_DEREFERENCE)(
519 PVOID Context);
520
521 typedef BOOLEAN
522 (DDKAPI *PTRANSLATE_BUS_ADDRESS)(
523 IN PVOID Context,
524 IN PHYSICAL_ADDRESS BusAddress,
525 IN ULONG Length,
526 IN OUT PULONG AddressSpace,
527 OUT PPHYSICAL_ADDRESS TranslatedAddress);
528
529 typedef struct _DMA_ADAPTER*
530 (DDKAPI *PGET_DMA_ADAPTER)(
531 IN PVOID Context,
532 IN struct _DEVICE_DESCRIPTION *DeviceDescriptor,
533 OUT PULONG NumberOfMapRegisters);
534
535 typedef ULONG
536 (DDKAPI *PGET_SET_DEVICE_DATA)(
537 IN PVOID Context,
538 IN ULONG DataType,
539 IN PVOID Buffer,
540 IN ULONG Offset,
541 IN ULONG Length);
542
543 /* PCI_DEVICE_PRESENCE_PARAMETERS.Flags */
544 #define PCI_USE_SUBSYSTEM_IDS 0x00000001
545 #define PCI_USE_REVISION 0x00000002
546 #define PCI_USE_VENDEV_IDS 0x00000004
547 #define PCI_USE_CLASS_SUBCLASS 0x00000008
548 #define PCI_USE_PROGIF 0x00000010
549 #define PCI_USE_LOCAL_BUS 0x00000020
550 #define PCI_USE_LOCAL_DEVICE 0x00000040
551
552 typedef struct _PCI_DEVICE_PRESENCE_PARAMETERS {
553 ULONG Size;
554 ULONG Flags;
555 USHORT VendorID;
556 USHORT DeviceID;
557 UCHAR RevisionID;
558 USHORT SubVendorID;
559 USHORT SubSystemID;
560 UCHAR BaseClass;
561 UCHAR SubClass;
562 UCHAR ProgIf;
563 } PCI_DEVICE_PRESENCE_PARAMETERS, *PPCI_DEVICE_PRESENCE_PARAMETERS;
564
565 typedef BOOLEAN
566 (DDKAPI *PPCI_IS_DEVICE_PRESENT)(
567 IN USHORT VendorID,
568 IN USHORT DeviceID,
569 IN UCHAR RevisionID,
570 IN USHORT SubVendorID,
571 IN USHORT SubSystemID,
572 IN ULONG Flags);
573
574 typedef BOOLEAN
575 (DDKAPI *PPCI_IS_DEVICE_PRESENT_EX)(
576 IN PVOID Context,
577 IN PPCI_DEVICE_PRESENCE_PARAMETERS Parameters);
578
579 typedef union _POWER_STATE {
580 SYSTEM_POWER_STATE SystemState;
581 DEVICE_POWER_STATE DeviceState;
582 } POWER_STATE, *PPOWER_STATE;
583
584 typedef enum _POWER_STATE_TYPE {
585 SystemPowerState = 0,
586 DevicePowerState
587 } POWER_STATE_TYPE, *PPOWER_STATE_TYPE;
588
589 typedef struct _BUS_INTERFACE_STANDARD {
590 USHORT Size;
591 USHORT Version;
592 PVOID Context;
593 PINTERFACE_REFERENCE InterfaceReference;
594 PINTERFACE_DEREFERENCE InterfaceDereference;
595 PTRANSLATE_BUS_ADDRESS TranslateBusAddress;
596 PGET_DMA_ADAPTER GetDmaAdapter;
597 PGET_SET_DEVICE_DATA SetBusData;
598 PGET_SET_DEVICE_DATA GetBusData;
599 } BUS_INTERFACE_STANDARD, *PBUS_INTERFACE_STANDARD;
600
601 typedef struct _PCI_DEVICE_PRESENT_INTERFACE {
602 USHORT Size;
603 USHORT Version;
604 PVOID Context;
605 PINTERFACE_REFERENCE InterfaceReference;
606 PINTERFACE_DEREFERENCE InterfaceDereference;
607 PPCI_IS_DEVICE_PRESENT IsDevicePresent;
608 PPCI_IS_DEVICE_PRESENT_EX IsDevicePresentEx;
609 } PCI_DEVICE_PRESENT_INTERFACE, *PPCI_DEVICE_PRESENT_INTERFACE;
610
611 typedef struct _DEVICE_CAPABILITIES {
612 USHORT Size;
613 USHORT Version;
614 ULONG DeviceD1 : 1;
615 ULONG DeviceD2 : 1;
616 ULONG LockSupported : 1;
617 ULONG EjectSupported : 1;
618 ULONG Removable : 1;
619 ULONG DockDevice : 1;
620 ULONG UniqueID : 1;
621 ULONG SilentInstall : 1;
622 ULONG RawDeviceOK : 1;
623 ULONG SurpriseRemovalOK : 1;
624 ULONG WakeFromD0 : 1;
625 ULONG WakeFromD1 : 1;
626 ULONG WakeFromD2 : 1;
627 ULONG WakeFromD3 : 1;
628 ULONG HardwareDisabled : 1;
629 ULONG NonDynamic : 1;
630 ULONG WarmEjectSupported : 1;
631 ULONG NoDisplayInUI : 1;
632 ULONG Reserved : 14;
633 ULONG Address;
634 ULONG UINumber;
635 DEVICE_POWER_STATE DeviceState[PowerSystemMaximum];
636 SYSTEM_POWER_STATE SystemWake;
637 DEVICE_POWER_STATE DeviceWake;
638 ULONG D1Latency;
639 ULONG D2Latency;
640 ULONG D3Latency;
641 } DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;
642
643 typedef struct _DEVICE_INTERFACE_CHANGE_NOTIFICATION {
644 USHORT Version;
645 USHORT Size;
646 GUID Event;
647 GUID InterfaceClassGuid;
648 PUNICODE_STRING SymbolicLinkName;
649 } DEVICE_INTERFACE_CHANGE_NOTIFICATION, *PDEVICE_INTERFACE_CHANGE_NOTIFICATION;
650
651 typedef struct _HWPROFILE_CHANGE_NOTIFICATION {
652 USHORT Version;
653 USHORT Size;
654 GUID Event;
655 } HWPROFILE_CHANGE_NOTIFICATION, *PHWPROFILE_CHANGE_NOTIFICATION;
656
657 #undef INTERFACE
658
659 typedef struct _INTERFACE {
660 USHORT Size;
661 USHORT Version;
662 PVOID Context;
663 PINTERFACE_REFERENCE InterfaceReference;
664 PINTERFACE_DEREFERENCE InterfaceDereference;
665 } INTERFACE, *PINTERFACE;
666
667 typedef struct _PLUGPLAY_NOTIFICATION_HEADER {
668 USHORT Version;
669 USHORT Size;
670 GUID Event;
671 } PLUGPLAY_NOTIFICATION_HEADER, *PPLUGPLAY_NOTIFICATION_HEADER;
672
673 typedef ULONG PNP_DEVICE_STATE, *PPNP_DEVICE_STATE;
674
675 /* PNP_DEVICE_STATE */
676
677 #define PNP_DEVICE_DISABLED 0x00000001
678 #define PNP_DEVICE_DONT_DISPLAY_IN_UI 0x00000002
679 #define PNP_DEVICE_FAILED 0x00000004
680 #define PNP_DEVICE_REMOVED 0x00000008
681 #define PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED 0x00000010
682 #define PNP_DEVICE_NOT_DISABLEABLE 0x00000020
683
684 typedef struct _TARGET_DEVICE_CUSTOM_NOTIFICATION {
685 USHORT Version;
686 USHORT Size;
687 GUID Event;
688 struct _FILE_OBJECT *FileObject;
689 LONG NameBufferOffset;
690 UCHAR CustomDataBuffer[1];
691 } TARGET_DEVICE_CUSTOM_NOTIFICATION, *PTARGET_DEVICE_CUSTOM_NOTIFICATION;
692
693 typedef struct _TARGET_DEVICE_REMOVAL_NOTIFICATION {
694 USHORT Version;
695 USHORT Size;
696 GUID Event;
697 struct _FILE_OBJECT *FileObject;
698 } TARGET_DEVICE_REMOVAL_NOTIFICATION, *PTARGET_DEVICE_REMOVAL_NOTIFICATION;
699
700 typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE {
701 DeviceUsageTypeUndefined,
702 DeviceUsageTypePaging,
703 DeviceUsageTypeHibernation,
704 DeviceUsageTypeDumpFile
705 } DEVICE_USAGE_NOTIFICATION_TYPE;
706
707 typedef struct _POWER_SEQUENCE {
708 ULONG SequenceD1;
709 ULONG SequenceD2;
710 ULONG SequenceD3;
711 } POWER_SEQUENCE, *PPOWER_SEQUENCE;
712
713 typedef enum {
714 DevicePropertyDeviceDescription = 0x0 | __string_type,
715 DevicePropertyHardwareID = 0x1 | __multiString_type,
716 DevicePropertyCompatibleIDs = 0x2 | __multiString_type,
717 DevicePropertyBootConfiguration = 0x3,
718 DevicePropertyBootConfigurationTranslated = 0x4,
719 DevicePropertyClassName = 0x5 | __string_type,
720 DevicePropertyClassGuid = 0x6 | __string_type,
721 DevicePropertyDriverKeyName = 0x7 | __string_type,
722 DevicePropertyManufacturer = 0x8 | __string_type,
723 DevicePropertyFriendlyName = 0x9 | __string_type,
724 DevicePropertyLocationInformation = 0xa | __string_type,
725 DevicePropertyPhysicalDeviceObjectName = 0xb | __string_type,
726 DevicePropertyBusTypeGuid = 0xc | __guid_type,
727 DevicePropertyLegacyBusType = 0xd,
728 DevicePropertyBusNumber = 0xe,
729 DevicePropertyEnumeratorName = 0xf | __string_type,
730 DevicePropertyAddress = 0x10,
731 DevicePropertyUINumber = 0x11,
732 DevicePropertyInstallState = 0x12,
733 DevicePropertyRemovalPolicy = 0x13,
734 DevicePropertyResourceRequirements = 0x14,
735 DevicePropertyAllocatedResources = 0x15,
736 DevicePropertyContainerID = 0x16 | __string_type
737 } DEVICE_REGISTRY_PROPERTY;
738
739 typedef enum _IO_NOTIFICATION_EVENT_CATEGORY {
740 EventCategoryReserved,
741 EventCategoryHardwareProfileChange,
742 EventCategoryDeviceInterfaceChange,
743 EventCategoryTargetDeviceChange
744 } IO_NOTIFICATION_EVENT_CATEGORY;
745
746 #define PNPNOTIFY_DEVICE_INTERFACE_INCLUDE_EXISTING_INTERFACES 0x00000001
747
748 typedef NTSTATUS
749 (DDKAPI *PDRIVER_NOTIFICATION_CALLBACK_ROUTINE)(
750 IN PVOID NotificationStructure,
751 IN PVOID Context);
752
753 typedef VOID
754 (DDKAPI *PDEVICE_CHANGE_COMPLETE_CALLBACK)(
755 IN PVOID Context);
756
757 /*
758 ** System structures
759 */
760
761 #define SYMBOLIC_LINK_QUERY 0x0001
762 #define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
763
764 /* also in winnt,h */
765 #define DUPLICATE_CLOSE_SOURCE 0x00000001
766 #define DUPLICATE_SAME_ACCESS 0x00000002
767 #define DUPLICATE_SAME_ATTRIBUTES 0x00000004
768 /* end winnt.h */
769
770 typedef struct _OBJECT_NAME_INFORMATION {
771 UNICODE_STRING Name;
772 } OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION;
773
774 typedef struct _IO_STATUS_BLOCK {
775 _ANONYMOUS_UNION union {
776 NTSTATUS Status;
777 PVOID Pointer;
778 } DUMMYUNIONNAME;
779 ULONG_PTR Information;
780 } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
781
782 typedef VOID
783 (DDKAPI *PIO_APC_ROUTINE)(
784 IN PVOID ApcContext,
785 IN PIO_STATUS_BLOCK IoStatusBlock,
786 IN ULONG Reserved);
787
788 typedef VOID
789 (DDKAPI *PKNORMAL_ROUTINE)(
790 IN PVOID NormalContext,
791 IN PVOID SystemArgument1,
792 IN PVOID SystemArgument2);
793
794 typedef VOID
795 (DDKAPI *PKKERNEL_ROUTINE)(
796 IN struct _KAPC *Apc,
797 IN OUT PKNORMAL_ROUTINE *NormalRoutine,
798 IN OUT PVOID *NormalContext,
799 IN OUT PVOID *SystemArgument1,
800 IN OUT PVOID *SystemArgument2);
801
802 typedef VOID
803 (DDKAPI *PKRUNDOWN_ROUTINE)(
804 IN struct _KAPC *Apc);
805
806 typedef struct _KAPC
807 {
808 UCHAR Type;
809 UCHAR SpareByte0;
810 UCHAR Size;
811 UCHAR SpareByte1;
812 ULONG SpareLong0;
813 struct _KTHREAD *Thread;
814 LIST_ENTRY ApcListEntry;
815 PKKERNEL_ROUTINE KernelRoutine;
816 PKRUNDOWN_ROUTINE RundownRoutine;
817 PKNORMAL_ROUTINE NormalRoutine;
818 PVOID NormalContext;
819 PVOID SystemArgument1;
820 PVOID SystemArgument2;
821 CCHAR ApcStateIndex;
822 KPROCESSOR_MODE ApcMode;
823 BOOLEAN Inserted;
824 } KAPC, *PKAPC, *RESTRICTED_POINTER PRKAPC;
825
826 typedef struct _KDEVICE_QUEUE_ENTRY {
827 LIST_ENTRY DeviceListEntry;
828 ULONG SortKey;
829 BOOLEAN Inserted;
830 } KDEVICE_QUEUE_ENTRY, *PKDEVICE_QUEUE_ENTRY,
831 *RESTRICTED_POINTER PRKDEVICE_QUEUE_ENTRY;
832
833 #define LOCK_QUEUE_WAIT 1
834 #define LOCK_QUEUE_OWNER 2
835
836 #if defined(_AMD64_)
837
838 typedef ULONG64 KSPIN_LOCK_QUEUE_NUMBER;
839
840 #define LockQueueUnusedSpare0 0
841 #define LockQueueExpansionLock 1
842 #define LockQueueUnusedSpare2 2
843 #define LockQueueSystemSpaceLock 3
844 #define LockQueueVacbLock 4
845 #define LockQueueMasterLock 5
846 #define LockQueueNonPagedPoolLock 6
847 #define LockQueueIoCancelLock 7
848 #define LockQueueWorkQueueLock 8
849 #define LockQueueIoVpbLock 9
850 #define LockQueueIoDatabaseLock 10
851 #define LockQueueIoCompletionLock 11
852 #define LockQueueNtfsStructLock 12
853 #define LockQueueAfdWorkQueueLock 13
854 #define LockQueueBcbLock 14
855 #define LockQueueMmNonPagedPoolLock 15
856 #define LockQueueUnusedSpare16 16
857 #define LockQueueMaximumLock (LockQueueUnusedSpare16 + 1)
858
859 #else
860
861 typedef enum _KSPIN_LOCK_QUEUE_NUMBER {
862 LockQueueUnusedSpare0,
863 LockQueueExpansionLock,
864 LockQueueUnusedSpare2,
865 LockQueueSystemSpaceLock,
866 LockQueueVacbLock,
867 LockQueueMasterLock,
868 LockQueueNonPagedPoolLock,
869 LockQueueIoCancelLock,
870 LockQueueWorkQueueLock,
871 LockQueueIoVpbLock,
872 LockQueueIoDatabaseLock,
873 LockQueueIoCompletionLock,
874 LockQueueNtfsStructLock,
875 LockQueueAfdWorkQueueLock,
876 LockQueueBcbLock,
877 LockQueueMmNonPagedPoolLock,
878 LockQueueUnusedSpare16,
879 LockQueueMaximumLock = LockQueueUnusedSpare16 + 1
880 } KSPIN_LOCK_QUEUE_NUMBER, *PKSPIN_LOCK_QUEUE_NUMBER;
881
882 #endif
883
884 typedef struct _KSPIN_LOCK_QUEUE {
885 struct _KSPIN_LOCK_QUEUE *volatile Next;
886 PKSPIN_LOCK volatile Lock;
887 } KSPIN_LOCK_QUEUE, *PKSPIN_LOCK_QUEUE;
888
889 typedef struct _KLOCK_QUEUE_HANDLE {
890 KSPIN_LOCK_QUEUE LockQueue;
891 KIRQL OldIrql;
892 } KLOCK_QUEUE_HANDLE, *PKLOCK_QUEUE_HANDLE;
893
894 #define DPC_NORMAL 0
895 #define DPC_THREADED 1
896
897 #define ASSERT_APC(Object) \
898 ASSERT((Object)->Type == ApcObject)
899
900 #define ASSERT_DPC(Object) \
901 ASSERT(((Object)->Type == 0) || \
902 ((Object)->Type == DpcObject) || \
903 ((Object)->Type == ThreadedDpcObject))
904
905 #define ASSERT_DEVICE_QUEUE(Object) \
906 ASSERT((Object)->Type == DeviceQueueObject)
907
908 typedef PVOID PKIPI_CONTEXT;
909
910 typedef
911 VOID
912 (NTAPI *PKIPI_WORKER)(
913 IN PKIPI_CONTEXT PacketContext,
914 IN PVOID Parameter1,
915 IN PVOID Parameter2,
916 IN PVOID Parameter3
917 );
918
919 typedef struct _WAIT_CONTEXT_BLOCK {
920 KDEVICE_QUEUE_ENTRY WaitQueueEntry;
921 PDRIVER_CONTROL DeviceRoutine;
922 PVOID DeviceContext;
923 ULONG NumberOfMapRegisters;
924 PVOID DeviceObject;
925 PVOID CurrentIrp;
926 PKDPC BufferChainingDpc;
927 } WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK;
928
929 typedef struct _KDEVICE_QUEUE {
930 CSHORT Type;
931 CSHORT Size;
932 LIST_ENTRY DeviceListHead;
933 KSPIN_LOCK Lock;
934 #if defined(_AMD64_)
935 union {
936 BOOLEAN Busy;
937 struct {
938 LONG64 Reserved : 8;
939 LONG64 Hint : 56;
940 };
941 };
942 #else
943 BOOLEAN Busy;
944 #endif
945
946 } KDEVICE_QUEUE, *PKDEVICE_QUEUE, *RESTRICTED_POINTER PRKDEVICE_QUEUE;
947
948 typedef struct _KDPC
949 {
950 UCHAR Type;
951 UCHAR Importance;
952 volatile USHORT Number;
953 LIST_ENTRY DpcListEntry;
954 PKDEFERRED_ROUTINE DeferredRoutine;
955 PVOID DeferredContext;
956 PVOID SystemArgument1;
957 PVOID SystemArgument2;
958 volatile PVOID DpcData;
959 } KDPC, *PKDPC, *RESTRICTED_POINTER PRKDPC;
960
961 typedef struct _KGATE
962 {
963 DISPATCHER_HEADER Header;
964 } KGATE, *PKGATE, *RESTRICTED_POINTER PRKGATE;
965
966 #define GM_LOCK_BIT 0x1
967 #define GM_LOCK_BIT_V 0x0
968 #define GM_LOCK_WAITER_WOKEN 0x2
969 #define GM_LOCK_WAITER_INC 0x4
970
971 typedef struct _KGUARDED_MUTEX
972 {
973 volatile LONG Count;
974 PKTHREAD Owner;
975 ULONG Contention;
976 KGATE Gate;
977 __GNU_EXTENSION union
978 {
979 __GNU_EXTENSION struct
980 {
981 SHORT KernelApcDisable;
982 SHORT SpecialApcDisable;
983 };
984 ULONG CombinedApcDisable;
985 };
986 } KGUARDED_MUTEX, *PKGUARDED_MUTEX;
987
988 typedef struct _KMUTANT {
989 DISPATCHER_HEADER Header;
990 LIST_ENTRY MutantListEntry;
991 struct _KTHREAD *RESTRICTED_POINTER OwnerThread;
992 BOOLEAN Abandoned;
993 UCHAR ApcDisable;
994 } KMUTANT, *PKMUTANT, *RESTRICTED_POINTER PRKMUTANT, KMUTEX, *PKMUTEX, *RESTRICTED_POINTER PRKMUTEX;
995
996 typedef struct _KTIMER {
997 DISPATCHER_HEADER Header;
998 ULARGE_INTEGER DueTime;
999 LIST_ENTRY TimerListEntry;
1000 struct _KDPC *Dpc;
1001 #if !defined(_X86_)
1002 ULONG Processor;
1003 #endif
1004 ULONG Period;
1005 } KTIMER, *PKTIMER, *RESTRICTED_POINTER PRKTIMER;
1006
1007
1008 #define EVENT_INCREMENT 1
1009 #define IO_NO_INCREMENT 0
1010 #define IO_CD_ROM_INCREMENT 1
1011 #define IO_DISK_INCREMENT 1
1012 #define IO_KEYBOARD_INCREMENT 6
1013 #define IO_MAILSLOT_INCREMENT 2
1014 #define IO_MOUSE_INCREMENT 6
1015 #define IO_NAMED_PIPE_INCREMENT 2
1016 #define IO_NETWORK_INCREMENT 2
1017 #define IO_PARALLEL_INCREMENT 1
1018 #define IO_SERIAL_INCREMENT 2
1019 #define IO_SOUND_INCREMENT 8
1020 #define IO_VIDEO_INCREMENT 1
1021 #define SEMAPHORE_INCREMENT 1
1022
1023 #define MM_MAXIMUM_DISK_IO_SIZE (0x10000)
1024
1025 typedef struct _IRP {
1026 CSHORT Type;
1027 USHORT Size;
1028 struct _MDL *MdlAddress;
1029 ULONG Flags;
1030 union {
1031 struct _IRP *MasterIrp;
1032 volatile LONG IrpCount;
1033 PVOID SystemBuffer;
1034 } AssociatedIrp;
1035 LIST_ENTRY ThreadListEntry;
1036 IO_STATUS_BLOCK IoStatus;
1037 KPROCESSOR_MODE RequestorMode;
1038 BOOLEAN PendingReturned;
1039 CHAR StackCount;
1040 CHAR CurrentLocation;
1041 BOOLEAN Cancel;
1042 KIRQL CancelIrql;
1043 CCHAR ApcEnvironment;
1044 UCHAR AllocationFlags;
1045 PIO_STATUS_BLOCK UserIosb;
1046 PKEVENT UserEvent;
1047 union {
1048 struct {
1049 _ANONYMOUS_UNION union {
1050 PIO_APC_ROUTINE UserApcRoutine;
1051 PVOID IssuingProcess;
1052 } DUMMYUNIONNAME;
1053 PVOID UserApcContext;
1054 } AsynchronousParameters;
1055 LARGE_INTEGER AllocationSize;
1056 } Overlay;
1057 volatile PDRIVER_CANCEL CancelRoutine;
1058 PVOID UserBuffer;
1059 union {
1060 struct {
1061 _ANONYMOUS_UNION union {
1062 KDEVICE_QUEUE_ENTRY DeviceQueueEntry;
1063 _ANONYMOUS_STRUCT struct {
1064 PVOID DriverContext[4];
1065 } DUMMYSTRUCTNAME;
1066 } DUMMYUNIONNAME;
1067 PETHREAD Thread;
1068 PCHAR AuxiliaryBuffer;
1069 _ANONYMOUS_STRUCT struct {
1070 LIST_ENTRY ListEntry;
1071 _ANONYMOUS_UNION union {
1072 struct _IO_STACK_LOCATION *CurrentStackLocation;
1073 ULONG PacketType;
1074 } DUMMYUNIONNAME;
1075 } DUMMYSTRUCTNAME;
1076 struct _FILE_OBJECT *OriginalFileObject;
1077 } Overlay;
1078 KAPC Apc;
1079 PVOID CompletionKey;
1080 } Tail;
1081 } IRP;
1082 typedef struct _IRP *PIRP;
1083
1084 /* IRP.Flags */
1085
1086 #define SL_FORCE_ACCESS_CHECK 0x01
1087 #define SL_OPEN_PAGING_FILE 0x02
1088 #define SL_OPEN_TARGET_DIRECTORY 0x04
1089 #define SL_CASE_SENSITIVE 0x80
1090
1091 #define SL_KEY_SPECIFIED 0x01
1092 #define SL_OVERRIDE_VERIFY_VOLUME 0x02
1093 #define SL_WRITE_THROUGH 0x04
1094 #define SL_FT_SEQUENTIAL_WRITE 0x08
1095
1096 #define SL_FAIL_IMMEDIATELY 0x01
1097 #define SL_EXCLUSIVE_LOCK 0x02
1098
1099 #define SL_RESTART_SCAN 0x01
1100 #define SL_RETURN_SINGLE_ENTRY 0x02
1101 #define SL_INDEX_SPECIFIED 0x04
1102
1103 #define SL_WATCH_TREE 0x01
1104
1105 #define SL_ALLOW_RAW_MOUNT 0x01
1106
1107 #define CTL_CODE(DeviceType, Function, Method, Access)( \
1108 ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
1109
1110 #define DEVICE_TYPE_FROM_CTL_CODE(ctl) (((ULONG) (ctl & 0xffff0000)) >> 16)
1111
1112 #define IRP_NOCACHE 0x00000001
1113 #define IRP_PAGING_IO 0x00000002
1114 #define IRP_MOUNT_COMPLETION 0x00000002
1115 #define IRP_SYNCHRONOUS_API 0x00000004
1116 #define IRP_ASSOCIATED_IRP 0x00000008
1117 #define IRP_BUFFERED_IO 0x00000010
1118 #define IRP_DEALLOCATE_BUFFER 0x00000020
1119 #define IRP_INPUT_OPERATION 0x00000040
1120 #define IRP_SYNCHRONOUS_PAGING_IO 0x00000040
1121 #define IRP_CREATE_OPERATION 0x00000080
1122 #define IRP_READ_OPERATION 0x00000100
1123 #define IRP_WRITE_OPERATION 0x00000200
1124 #define IRP_CLOSE_OPERATION 0x00000400
1125 #define IRP_DEFER_IO_COMPLETION 0x00000800
1126 #define IRP_OB_QUERY_NAME 0x00001000
1127 #define IRP_HOLD_DEVICE_QUEUE 0x00002000
1128
1129 #define IRP_QUOTA_CHARGED 0x01
1130 #define IRP_ALLOCATED_MUST_SUCCEED 0x02
1131 #define IRP_ALLOCATED_FIXED_SIZE 0x04
1132 #define IRP_LOOKASIDE_ALLOCATION 0x08
1133
1134 typedef struct _BOOTDISK_INFORMATION {
1135 LONGLONG BootPartitionOffset;
1136 LONGLONG SystemPartitionOffset;
1137 ULONG BootDeviceSignature;
1138 ULONG SystemDeviceSignature;
1139 } BOOTDISK_INFORMATION, *PBOOTDISK_INFORMATION;
1140
1141 typedef struct _BOOTDISK_INFORMATION_EX {
1142 LONGLONG BootPartitionOffset;
1143 LONGLONG SystemPartitionOffset;
1144 ULONG BootDeviceSignature;
1145 ULONG SystemDeviceSignature;
1146 GUID BootDeviceGuid;
1147 GUID SystemDeviceGuid;
1148 BOOLEAN BootDeviceIsGpt;
1149 BOOLEAN SystemDeviceIsGpt;
1150 } BOOTDISK_INFORMATION_EX, *PBOOTDISK_INFORMATION_EX;
1151
1152 typedef struct _EISA_MEMORY_TYPE {
1153 UCHAR ReadWrite : 1;
1154 UCHAR Cached : 1;
1155 UCHAR Reserved0 : 1;
1156 UCHAR Type : 2;
1157 UCHAR Shared : 1;
1158 UCHAR Reserved1 : 1;
1159 UCHAR MoreEntries : 1;
1160 } EISA_MEMORY_TYPE, *PEISA_MEMORY_TYPE;
1161
1162 #include <pshpack1.h>
1163 typedef struct _EISA_MEMORY_CONFIGURATION {
1164 EISA_MEMORY_TYPE ConfigurationByte;
1165 UCHAR DataSize;
1166 USHORT AddressLowWord;
1167 UCHAR AddressHighByte;
1168 USHORT MemorySize;
1169 } EISA_MEMORY_CONFIGURATION, *PEISA_MEMORY_CONFIGURATION;
1170 #include <poppack.h>
1171
1172 typedef struct _EISA_IRQ_DESCRIPTOR {
1173 UCHAR Interrupt : 4;
1174 UCHAR Reserved : 1;
1175 UCHAR LevelTriggered : 1;
1176 UCHAR Shared : 1;
1177 UCHAR MoreEntries : 1;
1178 } EISA_IRQ_DESCRIPTOR, *PEISA_IRQ_DESCRIPTOR;
1179
1180 typedef struct _EISA_IRQ_CONFIGURATION {
1181 EISA_IRQ_DESCRIPTOR ConfigurationByte;
1182 UCHAR Reserved;
1183 } EISA_IRQ_CONFIGURATION, *PEISA_IRQ_CONFIGURATION;
1184
1185 typedef struct _DMA_CONFIGURATION_BYTE0 {
1186 UCHAR Channel : 3;
1187 UCHAR Reserved : 3;
1188 UCHAR Shared : 1;
1189 UCHAR MoreEntries : 1;
1190 } DMA_CONFIGURATION_BYTE0;
1191
1192 typedef struct _DMA_CONFIGURATION_BYTE1 {
1193 UCHAR Reserved0 : 2;
1194 UCHAR TransferSize : 2;
1195 UCHAR Timing : 2;
1196 UCHAR Reserved1 : 2;
1197 } DMA_CONFIGURATION_BYTE1;
1198
1199 typedef struct _EISA_DMA_CONFIGURATION {
1200 DMA_CONFIGURATION_BYTE0 ConfigurationByte0;
1201 DMA_CONFIGURATION_BYTE1 ConfigurationByte1;
1202 } EISA_DMA_CONFIGURATION, *PEISA_DMA_CONFIGURATION;
1203
1204 #include <pshpack1.h>
1205 typedef struct _EISA_PORT_DESCRIPTOR {
1206 UCHAR NumberPorts : 5;
1207 UCHAR Reserved : 1;
1208 UCHAR Shared : 1;
1209 UCHAR MoreEntries : 1;
1210 } EISA_PORT_DESCRIPTOR, *PEISA_PORT_DESCRIPTOR;
1211
1212 typedef struct _EISA_PORT_CONFIGURATION {
1213 EISA_PORT_DESCRIPTOR Configuration;
1214 USHORT PortAddress;
1215 } EISA_PORT_CONFIGURATION, *PEISA_PORT_CONFIGURATION;
1216 #include <poppack.h>
1217
1218 typedef struct _CM_EISA_FUNCTION_INFORMATION {
1219 ULONG CompressedId;
1220 UCHAR IdSlotFlags1;
1221 UCHAR IdSlotFlags2;
1222 UCHAR MinorRevision;
1223 UCHAR MajorRevision;
1224 UCHAR Selections[26];
1225 UCHAR FunctionFlags;
1226 UCHAR TypeString[80];
1227 EISA_MEMORY_CONFIGURATION EisaMemory[9];
1228 EISA_IRQ_CONFIGURATION EisaIrq[7];
1229 EISA_DMA_CONFIGURATION EisaDma[4];
1230 EISA_PORT_CONFIGURATION EisaPort[20];
1231 UCHAR InitializationData[60];
1232 } CM_EISA_FUNCTION_INFORMATION, *PCM_EISA_FUNCTION_INFORMATION;
1233
1234 /* CM_EISA_FUNCTION_INFORMATION.FunctionFlags */
1235
1236 #define EISA_FUNCTION_ENABLED 0x80
1237 #define EISA_FREE_FORM_DATA 0x40
1238 #define EISA_HAS_PORT_INIT_ENTRY 0x20
1239 #define EISA_HAS_PORT_RANGE 0x10
1240 #define EISA_HAS_DMA_ENTRY 0x08
1241 #define EISA_HAS_IRQ_ENTRY 0x04
1242 #define EISA_HAS_MEMORY_ENTRY 0x02
1243 #define EISA_HAS_TYPE_ENTRY 0x01
1244 #define EISA_HAS_INFORMATION \
1245 (EISA_HAS_PORT_RANGE + EISA_HAS_DMA_ENTRY + EISA_HAS_IRQ_ENTRY \
1246 + EISA_HAS_MEMORY_ENTRY + EISA_HAS_TYPE_ENTRY)
1247
1248 typedef struct _CM_EISA_SLOT_INFORMATION {
1249 UCHAR ReturnCode;
1250 UCHAR ReturnFlags;
1251 UCHAR MajorRevision;
1252 UCHAR MinorRevision;
1253 USHORT Checksum;
1254 UCHAR NumberFunctions;
1255 UCHAR FunctionInformation;
1256 ULONG CompressedId;
1257 } CM_EISA_SLOT_INFORMATION, *PCM_EISA_SLOT_INFORMATION;
1258
1259 /* CM_EISA_SLOT_INFORMATION.ReturnCode */
1260
1261 #define EISA_INVALID_SLOT 0x80
1262 #define EISA_INVALID_FUNCTION 0x81
1263 #define EISA_INVALID_CONFIGURATION 0x82
1264 #define EISA_EMPTY_SLOT 0x83
1265 #define EISA_INVALID_BIOS_CALL 0x86
1266
1267 typedef struct _CM_FLOPPY_DEVICE_DATA {
1268 USHORT Version;
1269 USHORT Revision;
1270 CHAR Size[8];
1271 ULONG MaxDensity;
1272 ULONG MountDensity;
1273 UCHAR StepRateHeadUnloadTime;
1274 UCHAR HeadLoadTime;
1275 UCHAR MotorOffTime;
1276 UCHAR SectorLengthCode;
1277 UCHAR SectorPerTrack;
1278 UCHAR ReadWriteGapLength;
1279 UCHAR DataTransferLength;
1280 UCHAR FormatGapLength;
1281 UCHAR FormatFillCharacter;
1282 UCHAR HeadSettleTime;
1283 UCHAR MotorSettleTime;
1284 UCHAR MaximumTrackValue;
1285 UCHAR DataTransferRate;
1286 } CM_FLOPPY_DEVICE_DATA, *PCM_FLOPPY_DEVICE_DATA;
1287
1288 typedef struct _PNP_BUS_INFORMATION {
1289 GUID BusTypeGuid;
1290 INTERFACE_TYPE LegacyBusType;
1291 ULONG BusNumber;
1292 } PNP_BUS_INFORMATION, *PPNP_BUS_INFORMATION;
1293
1294 #include <pshpack1.h>
1295 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.Type */
1296
1297 #define CmResourceTypeNull 0
1298 #define CmResourceTypePort 1
1299 #define CmResourceTypeInterrupt 2
1300 #define CmResourceTypeMemory 3
1301 #define CmResourceTypeDma 4
1302 #define CmResourceTypeDeviceSpecific 5
1303 #define CmResourceTypeBusNumber 6
1304 #define CmResourceTypeMemoryLarge 7
1305 #define CmResourceTypeNonArbitrated 128
1306 #define CmResourceTypeConfigData 128
1307 #define CmResourceTypeDevicePrivate 129
1308 #define CmResourceTypePcCardConfig 130
1309 #define CmResourceTypeMfCardConfig 131
1310
1311 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.ShareDisposition */
1312
1313 typedef enum _CM_SHARE_DISPOSITION {
1314 CmResourceShareUndetermined,
1315 CmResourceShareDeviceExclusive,
1316 CmResourceShareDriverExclusive,
1317 CmResourceShareShared
1318 } CM_SHARE_DISPOSITION;
1319
1320 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypePort */
1321
1322 #define CM_RESOURCE_PORT_MEMORY 0x0000
1323 #define CM_RESOURCE_PORT_IO 0x0001
1324 #define CM_RESOURCE_PORT_10_BIT_DECODE 0x0004
1325 #define CM_RESOURCE_PORT_12_BIT_DECODE 0x0008
1326 #define CM_RESOURCE_PORT_16_BIT_DECODE 0x0010
1327 #define CM_RESOURCE_PORT_POSITIVE_DECODE 0x0020
1328 #define CM_RESOURCE_PORT_PASSIVE_DECODE 0x0040
1329 #define CM_RESOURCE_PORT_WINDOW_DECODE 0x0080
1330 #define CM_RESOURCE_PORT_BAR 0x0100
1331
1332 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeInterrupt */
1333
1334 #define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0x0000
1335 #define CM_RESOURCE_INTERRUPT_LATCHED 0x0001
1336 #define CM_RESOURCE_INTERRUPT_MESSAGE 0x0002
1337 #define CM_RESOURCE_INTERRUPT_POLICY_INCLUDED 0x0004
1338
1339 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeMemory */
1340
1341 #define CM_RESOURCE_MEMORY_READ_WRITE 0x0000
1342 #define CM_RESOURCE_MEMORY_READ_ONLY 0x0001
1343 #define CM_RESOURCE_MEMORY_WRITE_ONLY 0x0002
1344 #define CM_RESOURCE_MEMORY_WRITEABILITY_MASK 0x0003
1345 #define CM_RESOURCE_MEMORY_PREFETCHABLE 0x0004
1346 #define CM_RESOURCE_MEMORY_COMBINEDWRITE 0x0008
1347 #define CM_RESOURCE_MEMORY_24 0x0010
1348 #define CM_RESOURCE_MEMORY_CACHEABLE 0x0020
1349 #define CM_RESOURCE_MEMORY_WINDOW_DECODE 0x0040
1350 #define CM_RESOURCE_MEMORY_BAR 0x0080
1351 #define CM_RESOURCE_MEMORY_COMPAT_FOR_INACCESSIBLE_RANGE 0x0100
1352
1353 /* CM_PARTIAL_RESOURCE_DESCRIPTOR.Flags if Type = CmResourceTypeDma */
1354
1355 #define CM_RESOURCE_DMA_8 0x0000
1356 #define CM_RESOURCE_DMA_16 0x0001
1357 #define CM_RESOURCE_DMA_32 0x0002
1358 #define CM_RESOURCE_DMA_8_AND_16 0x0004
1359 #define CM_RESOURCE_DMA_BUS_MASTER 0x0008
1360 #define CM_RESOURCE_DMA_TYPE_A 0x0010
1361 #define CM_RESOURCE_DMA_TYPE_B 0x0020
1362 #define CM_RESOURCE_DMA_TYPE_F 0x0040
1363
1364 typedef struct _CM_PARTIAL_RESOURCE_LIST {
1365 USHORT Version;
1366 USHORT Revision;
1367 ULONG Count;
1368 CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
1369 } CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
1370
1371 typedef struct _CM_FULL_RESOURCE_DESCRIPTOR {
1372 INTERFACE_TYPE InterfaceType;
1373 ULONG BusNumber;
1374 CM_PARTIAL_RESOURCE_LIST PartialResourceList;
1375 } CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
1376
1377 typedef struct _CM_RESOURCE_LIST {
1378 ULONG Count;
1379 CM_FULL_RESOURCE_DESCRIPTOR List[1];
1380 } CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
1381
1382 typedef struct _CM_INT13_DRIVE_PARAMETER {
1383 USHORT DriveSelect;
1384 ULONG MaxCylinders;
1385 USHORT SectorsPerTrack;
1386 USHORT MaxHeads;
1387 USHORT NumberDrives;
1388 } CM_INT13_DRIVE_PARAMETER, *PCM_INT13_DRIVE_PARAMETER;
1389
1390 typedef struct _CM_PNP_BIOS_DEVICE_NODE
1391 {
1392 USHORT Size;
1393 UCHAR Node;
1394 ULONG ProductId;
1395 UCHAR DeviceType[3];
1396 USHORT DeviceAttributes;
1397 } CM_PNP_BIOS_DEVICE_NODE,*PCM_PNP_BIOS_DEVICE_NODE;
1398
1399 typedef struct _CM_PNP_BIOS_INSTALLATION_CHECK
1400 {
1401 UCHAR Signature[4];
1402 UCHAR Revision;
1403 UCHAR Length;
1404 USHORT ControlField;
1405 UCHAR Checksum;
1406 ULONG EventFlagAddress;
1407 USHORT RealModeEntryOffset;
1408 USHORT RealModeEntrySegment;
1409 USHORT ProtectedModeEntryOffset;
1410 ULONG ProtectedModeCodeBaseAddress;
1411 ULONG OemDeviceId;
1412 USHORT RealModeDataBaseAddress;
1413 ULONG ProtectedModeDataBaseAddress;
1414 } CM_PNP_BIOS_INSTALLATION_CHECK, *PCM_PNP_BIOS_INSTALLATION_CHECK;
1415
1416 #include <poppack.h>
1417
1418 typedef struct _CM_DISK_GEOMETRY_DEVICE_DATA
1419 {
1420 ULONG BytesPerSector;
1421 ULONG NumberOfCylinders;
1422 ULONG SectorsPerTrack;
1423 ULONG NumberOfHeads;
1424 } CM_DISK_GEOMETRY_DEVICE_DATA, *PCM_DISK_GEOMETRY_DEVICE_DATA;
1425
1426 typedef struct _CM_KEYBOARD_DEVICE_DATA {
1427 USHORT Version;
1428 USHORT Revision;
1429 UCHAR Type;
1430 UCHAR Subtype;
1431 USHORT KeyboardFlags;
1432 } CM_KEYBOARD_DEVICE_DATA, *PCM_KEYBOARD_DEVICE_DATA;
1433
1434 typedef struct _CM_MCA_POS_DATA {
1435 USHORT AdapterId;
1436 UCHAR PosData1;
1437 UCHAR PosData2;
1438 UCHAR PosData3;
1439 UCHAR PosData4;
1440 } CM_MCA_POS_DATA, *PCM_MCA_POS_DATA;
1441
1442 #if (NTDDI_VERSION >= NTDDI_WINXP)
1443 typedef struct CM_Power_Data_s {
1444 ULONG PD_Size;
1445 DEVICE_POWER_STATE PD_MostRecentPowerState;
1446 ULONG PD_Capabilities;
1447 ULONG PD_D1Latency;
1448 ULONG PD_D2Latency;
1449 ULONG PD_D3Latency;
1450 DEVICE_POWER_STATE PD_PowerStateMapping[PowerSystemMaximum];
1451 SYSTEM_POWER_STATE PD_DeepestSystemWake;
1452 } CM_POWER_DATA, *PCM_POWER_DATA;
1453
1454 #define PDCAP_D0_SUPPORTED 0x00000001
1455 #define PDCAP_D1_SUPPORTED 0x00000002
1456 #define PDCAP_D2_SUPPORTED 0x00000004
1457 #define PDCAP_D3_SUPPORTED 0x00000008
1458 #define PDCAP_WAKE_FROM_D0_SUPPORTED 0x00000010
1459 #define PDCAP_WAKE_FROM_D1_SUPPORTED 0x00000020
1460 #define PDCAP_WAKE_FROM_D2_SUPPORTED 0x00000040
1461 #define PDCAP_WAKE_FROM_D3_SUPPORTED 0x00000080
1462 #define PDCAP_WARM_EJECT_SUPPORTED 0x00000100
1463
1464 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
1465
1466 typedef struct _CM_SCSI_DEVICE_DATA {
1467 USHORT Version;
1468 USHORT Revision;
1469 UCHAR HostIdentifier;
1470 } CM_SCSI_DEVICE_DATA, *PCM_SCSI_DEVICE_DATA;
1471
1472 typedef struct _CM_SERIAL_DEVICE_DATA {
1473 USHORT Version;
1474 USHORT Revision;
1475 ULONG BaudClock;
1476 } CM_SERIAL_DEVICE_DATA, *PCM_SERIAL_DEVICE_DATA;
1477
1478 typedef enum _KINTERRUPT_POLARITY {
1479 InterruptPolarityUnknown,
1480 InterruptActiveHigh,
1481 InterruptActiveLow
1482 } KINTERRUPT_POLARITY, *PKINTERRUPT_POLARITY;
1483
1484 typedef struct _IO_ERROR_LOG_PACKET {
1485 UCHAR MajorFunctionCode;
1486 UCHAR RetryCount;
1487 USHORT DumpDataSize;
1488 USHORT NumberOfStrings;
1489 USHORT StringOffset;
1490 USHORT EventCategory;
1491 NTSTATUS ErrorCode;
1492 ULONG UniqueErrorValue;
1493 NTSTATUS FinalStatus;
1494 ULONG SequenceNumber;
1495 ULONG IoControlCode;
1496 LARGE_INTEGER DeviceOffset;
1497 ULONG DumpData[1];
1498 } IO_ERROR_LOG_PACKET, *PIO_ERROR_LOG_PACKET;
1499
1500 typedef struct _IO_ERROR_LOG_MESSAGE {
1501 USHORT Type;
1502 USHORT Size;
1503 USHORT DriverNameLength;
1504 LARGE_INTEGER TimeStamp;
1505 ULONG DriverNameOffset;
1506 IO_ERROR_LOG_PACKET EntryData;
1507 } IO_ERROR_LOG_MESSAGE, *PIO_ERROR_LOG_MESSAGE;
1508
1509 #define ERROR_LOG_LIMIT_SIZE 240
1510 #define IO_ERROR_LOG_MESSAGE_HEADER_LENGTH (sizeof(IO_ERROR_LOG_MESSAGE) - \
1511 sizeof(IO_ERROR_LOG_PACKET) + \
1512 (sizeof(WCHAR) * 40))
1513 #define ERROR_LOG_MESSAGE_LIMIT_SIZE \
1514 (ERROR_LOG_LIMIT_SIZE + IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
1515 #define IO_ERROR_LOG_MESSAGE_LENGTH \
1516 ((PORT_MAXIMUM_MESSAGE_LENGTH > ERROR_LOG_MESSAGE_LIMIT_SIZE) ? \
1517 ERROR_LOG_MESSAGE_LIMIT_SIZE : \
1518 PORT_MAXIMUM_MESSAGE_LENGTH)
1519 #define ERROR_LOG_MAXIMUM_SIZE (IO_ERROR_LOG_MESSAGE_LENGTH - \
1520 IO_ERROR_LOG_MESSAGE_HEADER_LENGTH)
1521
1522 typedef enum _DMA_WIDTH {
1523 Width8Bits,
1524 Width16Bits,
1525 Width32Bits,
1526 MaximumDmaWidth
1527 } DMA_WIDTH, *PDMA_WIDTH;
1528
1529 typedef enum _DMA_SPEED {
1530 Compatible,
1531 TypeA,
1532 TypeB,
1533 TypeC,
1534 TypeF,
1535 MaximumDmaSpeed
1536 } DMA_SPEED, *PDMA_SPEED;
1537
1538 /* DEVICE_DESCRIPTION.Version */
1539
1540 #define DEVICE_DESCRIPTION_VERSION 0x0000
1541 #define DEVICE_DESCRIPTION_VERSION1 0x0001
1542 #define DEVICE_DESCRIPTION_VERSION2 0x0002
1543
1544 typedef struct _DEVICE_DESCRIPTION {
1545 ULONG Version;
1546 BOOLEAN Master;
1547 BOOLEAN ScatterGather;
1548 BOOLEAN DemandMode;
1549 BOOLEAN AutoInitialize;
1550 BOOLEAN Dma32BitAddresses;
1551 BOOLEAN IgnoreCount;
1552 BOOLEAN Reserved1;
1553 BOOLEAN Dma64BitAddresses;
1554 ULONG BusNumber;
1555 ULONG DmaChannel;
1556 INTERFACE_TYPE InterfaceType;
1557 DMA_WIDTH DmaWidth;
1558 DMA_SPEED DmaSpeed;
1559 ULONG MaximumLength;
1560 ULONG DmaPort;
1561 } DEVICE_DESCRIPTION, *PDEVICE_DESCRIPTION;
1562
1563 /* VPB.Flags */
1564 #define VPB_MOUNTED 0x0001
1565 #define VPB_LOCKED 0x0002
1566 #define VPB_PERSISTENT 0x0004
1567 #define VPB_REMOVE_PENDING 0x0008
1568 #define VPB_RAW_MOUNT 0x0010
1569 #define VPB_DIRECT_WRITES_ALLOWED 0x0020
1570
1571 #define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR))
1572
1573 typedef struct _VPB {
1574 CSHORT Type;
1575 CSHORT Size;
1576 USHORT Flags;
1577 USHORT VolumeLabelLength;
1578 struct _DEVICE_OBJECT *DeviceObject;
1579 struct _DEVICE_OBJECT *RealDevice;
1580 ULONG SerialNumber;
1581 ULONG ReferenceCount;
1582 WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH / sizeof(WCHAR)];
1583 } VPB, *PVPB;
1584
1585 /* DEVICE_OBJECT.Flags */
1586
1587 #define DO_VERIFY_VOLUME 0x00000002
1588 #define DO_BUFFERED_IO 0x00000004
1589 #define DO_EXCLUSIVE 0x00000008
1590 #define DO_DIRECT_IO 0x00000010
1591 #define DO_MAP_IO_BUFFER 0x00000020
1592 #define DO_DEVICE_INITIALIZING 0x00000080
1593 #define DO_SHUTDOWN_REGISTERED 0x00000800
1594 #define DO_BUS_ENUMERATED_DEVICE 0x00001000
1595 #define DO_POWER_PAGABLE 0x00002000
1596 #define DO_POWER_INRUSH 0x00004000
1597
1598 /* DEVICE_OBJECT.Characteristics */
1599
1600 #define FILE_REMOVABLE_MEDIA 0x00000001
1601 #define FILE_READ_ONLY_DEVICE 0x00000002
1602 #define FILE_FLOPPY_DISKETTE 0x00000004
1603 #define FILE_WRITE_ONCE_MEDIA 0x00000008
1604 #define FILE_REMOTE_DEVICE 0x00000010
1605 #define FILE_DEVICE_IS_MOUNTED 0x00000020
1606 #define FILE_VIRTUAL_VOLUME 0x00000040
1607 #define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080
1608 #define FILE_DEVICE_SECURE_OPEN 0x00000100
1609 #define FILE_CHARACTERISTIC_PNP_DEVICE 0x00000800
1610 #define FILE_CHARACTERISTIC_TS_DEVICE 0x00001000
1611 #define FILE_CHARACTERISTIC_WEBDAV_DEVICE 0x00002000
1612
1613 /* DEVICE_OBJECT.AlignmentRequirement */
1614
1615 #define FILE_BYTE_ALIGNMENT 0x00000000
1616 #define FILE_WORD_ALIGNMENT 0x00000001
1617 #define FILE_LONG_ALIGNMENT 0x00000003
1618 #define FILE_QUAD_ALIGNMENT 0x00000007
1619 #define FILE_OCTA_ALIGNMENT 0x0000000f
1620 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
1621 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
1622 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
1623 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
1624 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
1625
1626 /* DEVICE_OBJECT.DeviceType */
1627
1628 #define DEVICE_TYPE ULONG
1629
1630 #define FILE_DEVICE_BEEP 0x00000001
1631 #define FILE_DEVICE_CD_ROM 0x00000002
1632 #define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003
1633 #define FILE_DEVICE_CONTROLLER 0x00000004
1634 #define FILE_DEVICE_DATALINK 0x00000005
1635 #define FILE_DEVICE_DFS 0x00000006
1636 #define FILE_DEVICE_DISK 0x00000007
1637 #define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008
1638 #define FILE_DEVICE_FILE_SYSTEM 0x00000009
1639 #define FILE_DEVICE_INPORT_PORT 0x0000000a
1640 #define FILE_DEVICE_KEYBOARD 0x0000000b
1641 #define FILE_DEVICE_MAILSLOT 0x0000000c
1642 #define FILE_DEVICE_MIDI_IN 0x0000000d
1643 #define FILE_DEVICE_MIDI_OUT 0x0000000e
1644 #define FILE_DEVICE_MOUSE 0x0000000f
1645 #define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010
1646 #define FILE_DEVICE_NAMED_PIPE 0x00000011
1647 #define FILE_DEVICE_NETWORK 0x00000012
1648 #define FILE_DEVICE_NETWORK_BROWSER 0x00000013
1649 #define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014
1650 #define FILE_DEVICE_NULL 0x00000015
1651 #define FILE_DEVICE_PARALLEL_PORT 0x00000016
1652 #define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017
1653 #define FILE_DEVICE_PRINTER 0x00000018
1654 #define FILE_DEVICE_SCANNER 0x00000019
1655 #define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a
1656 #define FILE_DEVICE_SERIAL_PORT 0x0000001b
1657 #define FILE_DEVICE_SCREEN 0x0000001c
1658 #define FILE_DEVICE_SOUND 0x0000001d
1659 #define FILE_DEVICE_STREAMS 0x0000001e
1660 #define FILE_DEVICE_TAPE 0x0000001f
1661 #define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020
1662 #define FILE_DEVICE_TRANSPORT 0x00000021
1663 #define FILE_DEVICE_UNKNOWN 0x00000022
1664 #define FILE_DEVICE_VIDEO 0x00000023
1665 #define FILE_DEVICE_VIRTUAL_DISK 0x00000024
1666 #define FILE_DEVICE_WAVE_IN 0x00000025
1667 #define FILE_DEVICE_WAVE_OUT 0x00000026
1668 #define FILE_DEVICE_8042_PORT 0x00000027
1669 #define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028
1670 #define FILE_DEVICE_BATTERY 0x00000029
1671 #define FILE_DEVICE_BUS_EXTENDER 0x0000002a
1672 #define FILE_DEVICE_MODEM 0x0000002b
1673 #define FILE_DEVICE_VDM 0x0000002c
1674 #define FILE_DEVICE_MASS_STORAGE 0x0000002d
1675 #define FILE_DEVICE_SMB 0x0000002e
1676 #define FILE_DEVICE_KS 0x0000002f
1677 #define FILE_DEVICE_CHANGER 0x00000030
1678 #define FILE_DEVICE_SMARTCARD 0x00000031
1679 #define FILE_DEVICE_ACPI 0x00000032
1680 #define FILE_DEVICE_DVD 0x00000033
1681 #define FILE_DEVICE_FULLSCREEN_VIDEO 0x00000034
1682 #define FILE_DEVICE_DFS_FILE_SYSTEM 0x00000035
1683 #define FILE_DEVICE_DFS_VOLUME 0x00000036
1684 #define FILE_DEVICE_SERENUM 0x00000037
1685 #define FILE_DEVICE_TERMSRV 0x00000038
1686 #define FILE_DEVICE_KSEC 0x00000039
1687 #define FILE_DEVICE_FIPS 0x0000003a
1688 #define FILE_DEVICE_INFINIBAND 0x0000003b
1689 #define FILE_DEVICE_VMBUS 0x0000003e
1690 #define FILE_DEVICE_CRYPT_PROVIDER 0x0000003f
1691 #define FILE_DEVICE_WPD 0x00000040
1692 #define FILE_DEVICE_BLUETOOTH 0x00000041
1693 #define FILE_DEVICE_MT_COMPOSITE 0x00000042
1694 #define FILE_DEVICE_MT_TRANSPORT 0x00000043
1695 #define FILE_DEVICE_BIOMETRIC 0x00000044
1696 #define FILE_DEVICE_PMI 0x00000045
1697
1698 typedef struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _DEVICE_OBJECT {
1699 CSHORT Type;
1700 USHORT Size;
1701 LONG ReferenceCount;
1702 struct _DRIVER_OBJECT *DriverObject;
1703 struct _DEVICE_OBJECT *NextDevice;
1704 struct _DEVICE_OBJECT *AttachedDevice;
1705 struct _IRP *CurrentIrp;
1706 PIO_TIMER Timer;
1707 ULONG Flags;
1708 ULONG Characteristics;
1709 volatile PVPB Vpb;
1710 PVOID DeviceExtension;
1711 DEVICE_TYPE DeviceType;
1712 CCHAR StackSize;
1713 union {
1714 LIST_ENTRY ListEntry;
1715 WAIT_CONTEXT_BLOCK Wcb;
1716 } Queue;
1717 ULONG AlignmentRequirement;
1718 KDEVICE_QUEUE DeviceQueue;
1719 KDPC Dpc;
1720 ULONG ActiveThreadCount;
1721 PSECURITY_DESCRIPTOR SecurityDescriptor;
1722 KEVENT DeviceLock;
1723 USHORT SectorSize;
1724 USHORT Spare1;
1725 struct _DEVOBJ_EXTENSION *DeviceObjectExtension;
1726 PVOID Reserved;
1727 } DEVICE_OBJECT, *PDEVICE_OBJECT;
1728
1729 typedef enum _DEVICE_RELATION_TYPE {
1730 BusRelations,
1731 EjectionRelations,
1732 PowerRelations,
1733 RemovalRelations,
1734 TargetDeviceRelation,
1735 SingleBusRelations,
1736 TransportRelations
1737 } DEVICE_RELATION_TYPE, *PDEVICE_RELATION_TYPE;
1738
1739 typedef struct _DEVICE_RELATIONS {
1740 ULONG Count;
1741 PDEVICE_OBJECT Objects[1];
1742 } DEVICE_RELATIONS, *PDEVICE_RELATIONS;
1743
1744 typedef struct _SCATTER_GATHER_ELEMENT {
1745 PHYSICAL_ADDRESS Address;
1746 ULONG Length;
1747 ULONG_PTR Reserved;
1748 } SCATTER_GATHER_ELEMENT, *PSCATTER_GATHER_ELEMENT;
1749
1750 #if defined(_MSC_EXTENSIONS)
1751
1752 #if _MSC_VER >= 1200
1753 #pragma warning(push)
1754 #endif
1755 #pragma warning(disable:4200)
1756 typedef struct _SCATTER_GATHER_LIST {
1757 ULONG NumberOfElements;
1758 ULONG_PTR Reserved;
1759 SCATTER_GATHER_ELEMENT Elements[1];
1760 } SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
1761
1762 #if _MSC_VER >= 1200
1763 #pragma warning(pop)
1764 #else
1765 #pragma warning(default:4200)
1766 #endif
1767
1768 #else
1769
1770 struct _SCATTER_GATHER_LIST;
1771 typedef struct _SCATTER_GATHER_LIST SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
1772
1773 #endif
1774
1775 #define MDL_MAPPED_TO_SYSTEM_VA 0x0001
1776 #define MDL_PAGES_LOCKED 0x0002
1777 #define MDL_SOURCE_IS_NONPAGED_POOL 0x0004
1778 #define MDL_ALLOCATED_FIXED_SIZE 0x0008
1779 #define MDL_PARTIAL 0x0010
1780 #define MDL_PARTIAL_HAS_BEEN_MAPPED 0x0020
1781 #define MDL_IO_PAGE_READ 0x0040
1782 #define MDL_WRITE_OPERATION 0x0080
1783 #define MDL_PARENT_MAPPED_SYSTEM_VA 0x0100
1784 #define MDL_FREE_EXTRA_PTES 0x0200
1785 #define MDL_DESCRIBES_AWE 0x0400
1786 #define MDL_IO_SPACE 0x0800
1787 #define MDL_NETWORK_HEADER 0x1000
1788 #define MDL_MAPPING_CAN_FAIL 0x2000
1789 #define MDL_ALLOCATED_MUST_SUCCEED 0x4000
1790 #define MDL_INTERNAL 0x8000
1791
1792
1793 #define MDL_MAPPING_FLAGS ( \
1794 MDL_MAPPED_TO_SYSTEM_VA | \
1795 MDL_PAGES_LOCKED | \
1796 MDL_SOURCE_IS_NONPAGED_POOL | \
1797 MDL_PARTIAL_HAS_BEEN_MAPPED | \
1798 MDL_PARENT_MAPPED_SYSTEM_VA | \
1799 MDL_SYSTEM_VA | \
1800 MDL_IO_SPACE)
1801
1802 typedef struct _DRIVER_EXTENSION {
1803 struct _DRIVER_OBJECT *DriverObject;
1804 PDRIVER_ADD_DEVICE AddDevice;
1805 ULONG Count;
1806 UNICODE_STRING ServiceKeyName;
1807 } DRIVER_EXTENSION, *PDRIVER_EXTENSION;
1808
1809 #define DRVO_UNLOAD_INVOKED 0x00000001
1810 #define DRVO_LEGACY_DRIVER 0x00000002
1811 #define DRVO_BUILTIN_DRIVER 0x00000004
1812
1813 typedef struct _DRIVER_OBJECT {
1814 CSHORT Type;
1815 CSHORT Size;
1816 PDEVICE_OBJECT DeviceObject;
1817 ULONG Flags;
1818 PVOID DriverStart;
1819 ULONG DriverSize;
1820 PVOID DriverSection;
1821 PDRIVER_EXTENSION DriverExtension;
1822 UNICODE_STRING DriverName;
1823 PUNICODE_STRING HardwareDatabase;
1824 struct _FAST_IO_DISPATCH *FastIoDispatch;
1825 PDRIVER_INITIALIZE DriverInit;
1826 PDRIVER_STARTIO DriverStartIo;
1827 PDRIVER_UNLOAD DriverUnload;
1828 PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
1829 } DRIVER_OBJECT;
1830 typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT;
1831
1832 typedef struct _DMA_ADAPTER {
1833 USHORT Version;
1834 USHORT Size;
1835 struct _DMA_OPERATIONS* DmaOperations;
1836 } DMA_ADAPTER, *PDMA_ADAPTER;
1837
1838 typedef VOID
1839 (DDKAPI *PPUT_DMA_ADAPTER)(
1840 IN PDMA_ADAPTER DmaAdapter);
1841
1842 typedef PVOID
1843 (DDKAPI *PALLOCATE_COMMON_BUFFER)(
1844 IN PDMA_ADAPTER DmaAdapter,
1845 IN ULONG Length,
1846 OUT PPHYSICAL_ADDRESS LogicalAddress,
1847 IN BOOLEAN CacheEnabled);
1848
1849 typedef VOID
1850 (DDKAPI *PFREE_COMMON_BUFFER)(
1851 IN PDMA_ADAPTER DmaAdapter,
1852 IN ULONG Length,
1853 IN PHYSICAL_ADDRESS LogicalAddress,
1854 IN PVOID VirtualAddress,
1855 IN BOOLEAN CacheEnabled);
1856
1857 typedef NTSTATUS
1858 (DDKAPI *PALLOCATE_ADAPTER_CHANNEL)(
1859 IN PDMA_ADAPTER DmaAdapter,
1860 IN PDEVICE_OBJECT DeviceObject,
1861 IN ULONG NumberOfMapRegisters,
1862 IN PDRIVER_CONTROL ExecutionRoutine,
1863 IN PVOID Context);
1864
1865 typedef BOOLEAN
1866 (DDKAPI *PFLUSH_ADAPTER_BUFFERS)(
1867 IN PDMA_ADAPTER DmaAdapter,
1868 IN PMDL Mdl,
1869 IN PVOID MapRegisterBase,
1870 IN PVOID CurrentVa,
1871 IN ULONG Length,
1872 IN BOOLEAN WriteToDevice);
1873
1874 typedef VOID
1875 (DDKAPI *PFREE_ADAPTER_CHANNEL)(
1876 IN PDMA_ADAPTER DmaAdapter);
1877
1878 typedef VOID
1879 (DDKAPI *PFREE_MAP_REGISTERS)(
1880 IN PDMA_ADAPTER DmaAdapter,
1881 PVOID MapRegisterBase,
1882 ULONG NumberOfMapRegisters);
1883
1884 typedef PHYSICAL_ADDRESS
1885 (DDKAPI *PMAP_TRANSFER)(
1886 IN PDMA_ADAPTER DmaAdapter,
1887 IN PMDL Mdl,
1888 IN PVOID MapRegisterBase,
1889 IN PVOID CurrentVa,
1890 IN OUT PULONG Length,
1891 IN BOOLEAN WriteToDevice);
1892
1893 typedef ULONG
1894 (DDKAPI *PGET_DMA_ALIGNMENT)(
1895 IN PDMA_ADAPTER DmaAdapter);
1896
1897 typedef ULONG
1898 (DDKAPI *PREAD_DMA_COUNTER)(
1899 IN PDMA_ADAPTER DmaAdapter);
1900
1901 typedef NTSTATUS
1902 (DDKAPI *PGET_SCATTER_GATHER_LIST)(
1903 IN PDMA_ADAPTER DmaAdapter,
1904 IN PDEVICE_OBJECT DeviceObject,
1905 IN PMDL Mdl,
1906 IN PVOID CurrentVa,
1907 IN ULONG Length,
1908 IN PDRIVER_LIST_CONTROL ExecutionRoutine,
1909 IN PVOID Context,
1910 IN BOOLEAN WriteToDevice);
1911
1912 typedef VOID
1913 (DDKAPI *PPUT_SCATTER_GATHER_LIST)(
1914 IN PDMA_ADAPTER DmaAdapter,
1915 IN PSCATTER_GATHER_LIST ScatterGather,
1916 IN BOOLEAN WriteToDevice);
1917
1918 typedef NTSTATUS
1919 (DDKAPI *PCALCULATE_SCATTER_GATHER_LIST_SIZE)(
1920 IN PDMA_ADAPTER DmaAdapter,
1921 IN PMDL Mdl OPTIONAL,
1922 IN PVOID CurrentVa,
1923 IN ULONG Length,
1924 OUT PULONG ScatterGatherListSize,
1925 OUT PULONG pNumberOfMapRegisters OPTIONAL);
1926
1927 typedef NTSTATUS
1928 (DDKAPI *PBUILD_SCATTER_GATHER_LIST)(
1929 IN PDMA_ADAPTER DmaAdapter,
1930 IN PDEVICE_OBJECT DeviceObject,
1931 IN PMDL Mdl,
1932 IN PVOID CurrentVa,
1933 IN ULONG Length,
1934 IN PDRIVER_LIST_CONTROL ExecutionRoutine,
1935 IN PVOID Context,
1936 IN BOOLEAN WriteToDevice,
1937 IN PVOID ScatterGatherBuffer,
1938 IN ULONG ScatterGatherLength);
1939
1940 typedef NTSTATUS
1941 (DDKAPI *PBUILD_MDL_FROM_SCATTER_GATHER_LIST)(
1942 IN PDMA_ADAPTER DmaAdapter,
1943 IN PSCATTER_GATHER_LIST ScatterGather,
1944 IN PMDL OriginalMdl,
1945 OUT PMDL *TargetMdl);
1946
1947 typedef struct _DMA_OPERATIONS {
1948 ULONG Size;
1949 PPUT_DMA_ADAPTER PutDmaAdapter;
1950 PALLOCATE_COMMON_BUFFER AllocateCommonBuffer;
1951 PFREE_COMMON_BUFFER FreeCommonBuffer;
1952 PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel;
1953 PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers;
1954 PFREE_ADAPTER_CHANNEL FreeAdapterChannel;
1955 PFREE_MAP_REGISTERS FreeMapRegisters;
1956 PMAP_TRANSFER MapTransfer;
1957 PGET_DMA_ALIGNMENT GetDmaAlignment;
1958 PREAD_DMA_COUNTER ReadDmaCounter;
1959 PGET_SCATTER_GATHER_LIST GetScatterGatherList;
1960 PPUT_SCATTER_GATHER_LIST PutScatterGatherList;
1961 PCALCULATE_SCATTER_GATHER_LIST_SIZE CalculateScatterGatherList;
1962 PBUILD_SCATTER_GATHER_LIST BuildScatterGatherList;
1963 PBUILD_MDL_FROM_SCATTER_GATHER_LIST BuildMdlFromScatterGatherList;
1964 } DMA_OPERATIONS, *PDMA_OPERATIONS;
1965
1966 typedef enum _KPROFILE_SOURCE {
1967 ProfileTime,
1968 ProfileAlignmentFixup,
1969 ProfileTotalIssues,
1970 ProfilePipelineDry,
1971 ProfileLoadInstructions,
1972 ProfilePipelineFrozen,
1973 ProfileBranchInstructions,
1974 ProfileTotalNonissues,
1975 ProfileDcacheMisses,
1976 ProfileIcacheMisses,
1977 ProfileCacheMisses,
1978 ProfileBranchMispredictions,
1979 ProfileStoreInstructions,
1980 ProfileFpInstructions,
1981 ProfileIntegerInstructions,
1982 Profile2Issue,
1983 Profile3Issue,
1984 Profile4Issue,
1985 ProfileSpecialInstructions,
1986 ProfileTotalCycles,
1987 ProfileIcacheIssues,
1988 ProfileDcacheAccesses,
1989 ProfileMemoryBarrierCycles,
1990 ProfileLoadLinkedIssues,
1991 ProfileMaximum
1992 } KPROFILE_SOURCE;
1993
1994 typedef enum _KD_OPTION {
1995 KD_OPTION_SET_BLOCK_ENABLE,
1996 } KD_OPTION;
1997
1998 typedef enum _FILE_INFORMATION_CLASS {
1999 FileDirectoryInformation = 1,
2000 FileFullDirectoryInformation,
2001 FileBothDirectoryInformation,
2002 FileBasicInformation,
2003 FileStandardInformation,
2004 FileInternalInformation,
2005 FileEaInformation,
2006 FileAccessInformation,
2007 FileNameInformation,
2008 FileRenameInformation,
2009 FileLinkInformation,
2010 FileNamesInformation,
2011 FileDispositionInformation,
2012 FilePositionInformation,
2013 FileFullEaInformation,
2014 FileModeInformation,
2015 FileAlignmentInformation,
2016 FileAllInformation,
2017 FileAllocationInformation,
2018 FileEndOfFileInformation,
2019 FileAlternateNameInformation,
2020 FileStreamInformation,
2021 FilePipeInformation,
2022 FilePipeLocalInformation,
2023 FilePipeRemoteInformation,
2024 FileMailslotQueryInformation,
2025 FileMailslotSetInformation,
2026 FileCompressionInformation,
2027 FileObjectIdInformation,
2028 FileCompletionInformation,
2029 FileMoveClusterInformation,
2030 FileQuotaInformation,
2031 FileReparsePointInformation,
2032 FileNetworkOpenInformation,
2033 FileAttributeTagInformation,
2034 FileTrackingInformation,
2035 FileIdBothDirectoryInformation,
2036 FileIdFullDirectoryInformation,
2037 FileValidDataLengthInformation,
2038 FileShortNameInformation,
2039 FileIoCompletionNotificationInformation,
2040 FileIoStatusBlockRangeInformation,
2041 FileIoPriorityHintInformation,
2042 FileSfioReserveInformation,
2043 FileSfioVolumeInformation,
2044 FileHardLinkInformation,
2045 FileProcessIdsUsingFileInformation,
2046 FileNormalizedNameInformation,
2047 FileNetworkPhysicalNameInformation,
2048 FileIdGlobalTxDirectoryInformation,
2049 FileIsRemoteDeviceInformation,
2050 FileAttributeCacheInformation,
2051 FileNumaNodeInformation,
2052 FileStandardLinkInformation,
2053 FileRemoteProtocolInformation,
2054 FileMaximumInformation
2055 } FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
2056
2057 typedef struct _FILE_POSITION_INFORMATION {
2058 LARGE_INTEGER CurrentByteOffset;
2059 } FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION;
2060
2061 #include <pshpack8.h>
2062 typedef struct _FILE_BASIC_INFORMATION {
2063 LARGE_INTEGER CreationTime;
2064 LARGE_INTEGER LastAccessTime;
2065 LARGE_INTEGER LastWriteTime;
2066 LARGE_INTEGER ChangeTime;
2067 ULONG FileAttributes;
2068 } FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION;
2069 #include <poppack.h>
2070
2071 typedef struct _FILE_STANDARD_INFORMATION {
2072 LARGE_INTEGER AllocationSize;
2073 LARGE_INTEGER EndOfFile;
2074 ULONG NumberOfLinks;
2075 BOOLEAN DeletePending;
2076 BOOLEAN Directory;
2077 } FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION;
2078
2079 typedef struct _FILE_NETWORK_OPEN_INFORMATION {
2080 LARGE_INTEGER CreationTime;
2081 LARGE_INTEGER LastAccessTime;
2082 LARGE_INTEGER LastWriteTime;
2083 LARGE_INTEGER ChangeTime;
2084 LARGE_INTEGER AllocationSize;
2085 LARGE_INTEGER EndOfFile;
2086 ULONG FileAttributes;
2087 } FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION;
2088
2089 typedef enum _FSINFOCLASS {
2090 FileFsVolumeInformation = 1,
2091 FileFsLabelInformation,
2092 FileFsSizeInformation,
2093 FileFsDeviceInformation,
2094 FileFsAttributeInformation,
2095 FileFsControlInformation,
2096 FileFsFullSizeInformation,
2097 FileFsObjectIdInformation,
2098 FileFsDriverPathInformation,
2099 FileFsVolumeFlagsInformation,
2100 FileFsMaximumInformation
2101 } FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
2102
2103 typedef struct _FILE_FS_DEVICE_INFORMATION {
2104 DEVICE_TYPE DeviceType;
2105 ULONG Characteristics;
2106 } FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION;
2107
2108 typedef struct _FILE_FULL_EA_INFORMATION {
2109 ULONG NextEntryOffset;
2110 UCHAR Flags;
2111 UCHAR EaNameLength;
2112 USHORT EaValueLength;
2113 CHAR EaName[1];
2114 } FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
2115
2116 /* ERESOURCE.Flag */
2117
2118 #define ResourceNeverExclusive 0x0010
2119 #define ResourceReleaseByOtherThread 0x0020
2120 #define ResourceOwnedExclusive 0x0080
2121
2122 #define RESOURCE_HASH_TABLE_SIZE 64
2123
2124 typedef struct _DEVOBJ_EXTENSION
2125 {
2126 CSHORT Type;
2127 USHORT Size;
2128 PDEVICE_OBJECT DeviceObject;
2129 } DEVOBJ_EXTENSION, *PDEVOBJ_EXTENSION;
2130
2131 /* Simple types */
2132 typedef UCHAR KPROCESSOR_MODE;
2133 typedef LONG KPRIORITY;
2134 typedef PVOID PSECURITY_DESCRIPTOR;
2135 typedef ULONG SECURITY_INFORMATION, *PSECURITY_INFORMATION;
2136
2137 /* Structures not exposed to drivers */
2138 typedef struct _OBJECT_TYPE *POBJECT_TYPE;
2139 typedef struct _HAL_DISPATCH_TABLE *PHAL_DISPATCH_TABLE;
2140 typedef struct _HAL_PRIVATE_DISPATCH_TABLE *PHAL_PRIVATE_DISPATCH_TABLE;
2141 typedef struct _DEVICE_HANDLER_OBJECT *PDEVICE_HANDLER_OBJECT;
2142 typedef struct _BUS_HANDLER *PBUS_HANDLER;
2143
2144 typedef struct _ADAPTER_OBJECT *PADAPTER_OBJECT;
2145 typedef struct _CALLBACK_OBJECT *PCALLBACK_OBJECT;
2146 typedef struct _ETHREAD *PETHREAD;
2147 typedef struct _EPROCESS *PEPROCESS;
2148 typedef struct _IO_TIMER *PIO_TIMER;
2149 typedef struct _KINTERRUPT *PKINTERRUPT;
2150 typedef struct _KPROCESS *PKPROCESS;
2151 typedef struct _KTHREAD *PKTHREAD, *PRKTHREAD;
2152
2153
2154 typedef struct _CONTEXT *PCONTEXT;
2155
2156 //
2157 // Resource list definitions
2158 //
2159 typedef int CM_RESOURCE_TYPE;
2160
2161 #define CmResourceTypeNull 0
2162 #define CmResourceTypePort 1
2163 #define CmResourceTypeInterrupt 2
2164 #define CmResourceTypeMemory 3
2165 #define CmResourceTypeDma 4
2166 #define CmResourceTypeDeviceSpecific 5
2167 #define CmResourceTypeBusNumber 6
2168 #define CmResourceTypeNonArbitrated 128
2169 #define CmResourceTypeConfigData 128
2170 #define CmResourceTypeDevicePrivate 129
2171 #define CmResourceTypePcCardConfig 130
2172 #define CmResourceTypeMfCardConfig 131
2173
2174 typedef enum _INTERFACE_TYPE {
2175 InterfaceTypeUndefined = -1,
2176 Internal,
2177 Isa,
2178 Eisa,
2179 MicroChannel,
2180 TurboChannel,
2181 PCIBus,
2182 VMEBus,
2183 NuBus,
2184 PCMCIABus,
2185 CBus,
2186 MPIBus,
2187 MPSABus,
2188 ProcessorInternal,
2189 InternalPowerBus,
2190 PNPISABus,
2191 PNPBus,
2192 MaximumInterfaceType
2193 } INTERFACE_TYPE, *PINTERFACE_TYPE;
2194
2195 /* IO_RESOURCE_DESCRIPTOR.Option */
2196
2197 #define IO_RESOURCE_PREFERRED 0x01
2198 #define IO_RESOURCE_DEFAULT 0x02
2199 #define IO_RESOURCE_ALTERNATIVE 0x08
2200
2201 typedef struct _IO_RESOURCE_DESCRIPTOR {
2202 UCHAR Option;
2203 UCHAR Type;
2204 UCHAR ShareDisposition;
2205 UCHAR Spare1;
2206 USHORT Flags;
2207 USHORT Spare2;
2208 union {
2209 struct {
2210 ULONG Length;
2211 ULONG Alignment;
2212 PHYSICAL_ADDRESS MinimumAddress;
2213 PHYSICAL_ADDRESS MaximumAddress;
2214 } Port;
2215 struct {
2216 ULONG Length;
2217 ULONG Alignment;
2218 PHYSICAL_ADDRESS MinimumAddress;
2219 PHYSICAL_ADDRESS MaximumAddress;
2220 } Memory;
2221 struct {
2222 ULONG MinimumVector;
2223 ULONG MaximumVector;
2224 } Interrupt;
2225 struct {
2226 ULONG MinimumChannel;
2227 ULONG MaximumChannel;
2228 } Dma;
2229 struct {
2230 ULONG Length;
2231 ULONG Alignment;
2232 PHYSICAL_ADDRESS MinimumAddress;
2233 PHYSICAL_ADDRESS MaximumAddress;
2234 } Generic;
2235 struct {
2236 ULONG Data[3];
2237 } DevicePrivate;
2238 struct {
2239 ULONG Length;
2240 ULONG MinBusNumber;
2241 ULONG MaxBusNumber;
2242 ULONG Reserved;
2243 } BusNumber;
2244 struct {
2245 ULONG Priority;
2246 ULONG Reserved1;
2247 ULONG Reserved2;
2248 } ConfigData;
2249 } u;
2250 } IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
2251
2252 typedef struct _IO_RESOURCE_LIST {
2253 USHORT Version;
2254 USHORT Revision;
2255 ULONG Count;
2256 IO_RESOURCE_DESCRIPTOR Descriptors[1];
2257 } IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
2258
2259 typedef struct _IO_RESOURCE_REQUIREMENTS_LIST {
2260 ULONG ListSize;
2261 INTERFACE_TYPE InterfaceType;
2262 ULONG BusNumber;
2263 ULONG SlotNumber;
2264 ULONG Reserved[3];
2265 ULONG AlternativeLists;
2266 IO_RESOURCE_LIST List[1];
2267 } IO_RESOURCE_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
2268
2269 //
2270 // Global debug flag
2271 //
2272 extern ULONG NtGlobalFlag;
2273
2274
2275 #include <pshpack4.h>
2276 typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR {
2277 UCHAR Type;
2278 UCHAR ShareDisposition;
2279 USHORT Flags;
2280 union {
2281 struct {
2282 PHYSICAL_ADDRESS Start;
2283 ULONG Length;
2284 } Generic;
2285 struct {
2286 PHYSICAL_ADDRESS Start;
2287 ULONG Length;
2288 } Port;
2289 struct {
2290 ULONG Level;
2291 ULONG Vector;
2292 KAFFINITY Affinity;
2293 } Interrupt;
2294 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
2295 struct {
2296 __GNU_EXTENSION union {
2297 struct {
2298 USHORT Reserved;
2299 USHORT MessageCount;
2300 ULONG Vector;
2301 KAFFINITY Affinity;
2302 } Raw;
2303 struct {
2304 ULONG Level;
2305 ULONG Vector;
2306 KAFFINITY Affinity;
2307 } Translated;
2308 };
2309 } MessageInterrupt;
2310 #endif
2311 struct {
2312 PHYSICAL_ADDRESS Start;
2313 ULONG Length;
2314 } Memory;
2315 struct {
2316 ULONG Channel;
2317 ULONG Port;
2318 ULONG Reserved1;
2319 } Dma;
2320 struct {
2321 ULONG Data[3];
2322 } DevicePrivate;
2323 struct {
2324 ULONG Start;
2325 ULONG Length;
2326 ULONG Reserved;
2327 } BusNumber;
2328 struct {
2329 ULONG DataSize;
2330 ULONG Reserved1;
2331 ULONG Reserved2;
2332 } DeviceSpecificData;
2333 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
2334 struct {
2335 PHYSICAL_ADDRESS Start;
2336 ULONG Length40;
2337 } Memory40;
2338 struct {
2339 PHYSICAL_ADDRESS Start;
2340 ULONG Length48;
2341 } Memory48;
2342 struct {
2343 PHYSICAL_ADDRESS Start;
2344 ULONG Length64;
2345 } Memory64;
2346 #endif
2347 } u;
2348 } CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
2349 #include <poppack.h>
2350
2351 //
2352 // Section map options
2353 //
2354 typedef enum _SECTION_INHERIT {
2355 ViewShare = 1,
2356 ViewUnmap = 2
2357 } SECTION_INHERIT;
2358
2359 //
2360 // Section access rights
2361 //
2362 #define SECTION_QUERY 0x0001
2363 #define SECTION_MAP_WRITE 0x0002
2364 #define SECTION_MAP_READ 0x0004
2365 #define SECTION_MAP_EXECUTE 0x0008
2366 #define SECTION_EXTEND_SIZE 0x0010
2367 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
2368
2369 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SECTION_QUERY|\
2370 SECTION_MAP_WRITE | \
2371 SECTION_MAP_READ | \
2372 SECTION_MAP_EXECUTE | \
2373 SECTION_EXTEND_SIZE)
2374
2375 #define SESSION_QUERY_ACCESS 0x0001
2376 #define SESSION_MODIFY_ACCESS 0x0002
2377
2378 #define SESSION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
2379 SESSION_QUERY_ACCESS | \
2380 SESSION_MODIFY_ACCESS)
2381
2382
2383
2384 #define SEGMENT_ALL_ACCESS SECTION_ALL_ACCESS
2385
2386 #define PAGE_NOACCESS 0x01
2387 #define PAGE_READONLY 0x02
2388 #define PAGE_READWRITE 0x04
2389 #define PAGE_WRITECOPY 0x08
2390 #define PAGE_EXECUTE 0x10
2391 #define PAGE_EXECUTE_READ 0x20
2392 #define PAGE_EXECUTE_READWRITE 0x40
2393 #define PAGE_EXECUTE_WRITECOPY 0x80
2394 #define PAGE_GUARD 0x100
2395 #define PAGE_NOCACHE 0x200
2396 #define PAGE_WRITECOMBINE 0x400
2397
2398 #define MEM_COMMIT 0x1000
2399 #define MEM_RESERVE 0x2000
2400 #define MEM_DECOMMIT 0x4000
2401 #define MEM_RELEASE 0x8000
2402 #define MEM_FREE 0x10000
2403 #define MEM_PRIVATE 0x20000
2404 #define MEM_MAPPED 0x40000
2405 #define MEM_RESET 0x80000
2406 #define MEM_TOP_DOWN 0x100000
2407 #define MEM_LARGE_PAGES 0x20000000
2408 #define MEM_4MB_PAGES 0x80000000
2409
2410 #define SEC_RESERVE 0x4000000
2411 #define SEC_LARGE_PAGES 0x80000000
2412
2413 #define PROCESS_DUP_HANDLE (0x0040)
2414
2415 #if (NTDDI_VERSION >= NTDDI_VISTA)
2416 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \
2417 0xFFFF)
2418 #else
2419 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \
2420 0xFFF)
2421 #endif
2422
2423
2424
2425 //
2426 // Processor features
2427 //
2428 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
2429 #define PF_FLOATING_POINT_EMULATED 1
2430 #define PF_COMPARE_EXCHANGE_DOUBLE 2
2431 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
2432 #define PF_PPC_MOVEMEM_64BIT_OK 4
2433 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
2434 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
2435 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
2436 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
2437 #define PF_PAE_ENABLED 9
2438 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
2439 #define PF_SSE_DAZ_MODE_AVAILABLE 11
2440 #define PF_NX_ENABLED 12
2441 #define PF_SSE3_INSTRUCTIONS_AVAILABLE 13
2442 #define PF_COMPARE_EXCHANGE128 14
2443 #define PF_COMPARE64_EXCHANGE128 15
2444 #define PF_CHANNELS_ENABLED 16
2445
2446
2447
2448 //
2449 // Intrinsics (note: taken from our winnt.h)
2450 // FIXME: 64-bit
2451 //
2452 #if defined(__GNUC__)
2453
2454 static __inline__ BOOLEAN
2455 InterlockedBitTestAndSet(IN LONG volatile *Base,
2456 IN LONG Bit)
2457 {
2458 #if defined(_M_IX86)
2459 LONG OldBit;
2460 __asm__ __volatile__("lock "
2461 "btsl %2,%1\n\t"
2462 "sbbl %0,%0\n\t"
2463 :"=r" (OldBit),"+m" (*Base)
2464 :"Ir" (Bit)
2465 : "memory");
2466 return OldBit;
2467 #else
2468 return (_InterlockedOr(Base, 1 << Bit) >> Bit) & 1;
2469 #endif
2470 }
2471
2472 static __inline__ BOOLEAN
2473 InterlockedBitTestAndReset(IN LONG volatile *Base,
2474 IN LONG Bit)
2475 {
2476 #if defined(_M_IX86)
2477 LONG OldBit;
2478 __asm__ __volatile__("lock "
2479 "btrl %2,%1\n\t"
2480 "sbbl %0,%0\n\t"
2481 :"=r" (OldBit),"+m" (*Base)
2482 :"Ir" (Bit)
2483 : "memory");
2484 return OldBit;
2485 #else
2486 return (_InterlockedAnd(Base, ~(1 << Bit)) >> Bit) & 1;
2487 #endif
2488 }
2489
2490 #endif
2491
2492 #define BitScanForward _BitScanForward
2493 #define BitScanReverse _BitScanReverse
2494
2495 #define BitTest _bittest
2496 #define BitTestAndComplement _bittestandcomplement
2497 #define BitTestAndSet _bittestandset
2498 #define BitTestAndReset _bittestandreset
2499 #define InterlockedBitTestAndSet _interlockedbittestandset
2500 #define InterlockedBitTestAndReset _interlockedbittestandreset
2501
2502
2503 /** INTERLOCKED FUNCTIONS *****************************************************/
2504
2505 #if !defined(__INTERLOCKED_DECLARED)
2506 #define __INTERLOCKED_DECLARED
2507
2508 #if defined (_X86_)
2509 #if defined(NO_INTERLOCKED_INTRINSICS)
2510 NTKERNELAPI
2511 LONG
2512 FASTCALL
2513 InterlockedIncrement(
2514 IN OUT LONG volatile *Addend);
2515
2516 NTKERNELAPI
2517 LONG
2518 FASTCALL
2519 InterlockedDecrement(
2520 IN OUT LONG volatile *Addend);
2521
2522 NTKERNELAPI
2523 LONG
2524 FASTCALL
2525 InterlockedCompareExchange(
2526 IN OUT LONG volatile *Destination,
2527 IN LONG Exchange,
2528 IN LONG Comparand);
2529
2530 NTKERNELAPI
2531 LONG
2532 FASTCALL
2533 InterlockedExchange(
2534 IN OUT LONG volatile *Destination,
2535 IN LONG Value);
2536
2537 NTKERNELAPI
2538 LONG
2539 FASTCALL
2540 InterlockedExchangeAdd(
2541 IN OUT LONG volatile *Addend,
2542 IN LONG Value);
2543
2544 #else // !defined(NO_INTERLOCKED_INTRINSICS)
2545
2546 #define InterlockedExchange _InterlockedExchange
2547 #define InterlockedIncrement _InterlockedIncrement
2548 #define InterlockedDecrement _InterlockedDecrement
2549 #define InterlockedExchangeAdd _InterlockedExchangeAdd
2550 #define InterlockedCompareExchange _InterlockedCompareExchange
2551 #define InterlockedOr _InterlockedOr
2552 #define InterlockedAnd _InterlockedAnd
2553 #define InterlockedXor _InterlockedXor
2554
2555 #endif // !defined(NO_INTERLOCKED_INTRINSICS)
2556
2557 #endif // defined (_X86_)
2558
2559 #if !defined (_WIN64)
2560 /*
2561 * PVOID
2562 * InterlockedExchangePointer(
2563 * IN OUT PVOID volatile *Target,
2564 * IN PVOID Value)
2565 */
2566 #define InterlockedExchangePointer(Target, Value) \
2567 ((PVOID) InterlockedExchange((PLONG) Target, (LONG) Value))
2568
2569 /*
2570 * PVOID
2571 * InterlockedCompareExchangePointer(
2572 * IN OUT PVOID *Destination,
2573 * IN PVOID Exchange,
2574 * IN PVOID Comparand)
2575 */
2576 #define InterlockedCompareExchangePointer(Destination, Exchange, Comparand) \
2577 ((PVOID) InterlockedCompareExchange((PLONG) Destination, (LONG) Exchange, (LONG) Comparand))
2578
2579 #define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd((LONG *)a, b)
2580 #define InterlockedIncrementSizeT(a) InterlockedIncrement((LONG *)a)
2581 #define InterlockedDecrementSizeT(a) InterlockedDecrement((LONG *)a)
2582
2583 #endif // !defined (_WIN64)
2584
2585 #if defined (_M_AMD64)
2586
2587 #define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd64((LONGLONG *)a, (LONGLONG)b)
2588 #define InterlockedIncrementSizeT(a) InterlockedIncrement64((LONGLONG *)a)
2589 #define InterlockedDecrementSizeT(a) InterlockedDecrement64((LONGLONG *)a)
2590 #define InterlockedAnd _InterlockedAnd
2591 #define InterlockedOr _InterlockedOr
2592 #define InterlockedXor _InterlockedXor
2593 #define InterlockedIncrement _InterlockedIncrement
2594 #define InterlockedDecrement _InterlockedDecrement
2595 #define InterlockedAdd _InterlockedAdd
2596 #define InterlockedExchange _InterlockedExchange
2597 #define InterlockedExchangeAdd _InterlockedExchangeAdd
2598 #define InterlockedCompareExchange _InterlockedCompareExchange
2599 #define InterlockedAnd64 _InterlockedAnd64
2600 #define InterlockedOr64 _InterlockedOr64
2601 #define InterlockedXor64 _InterlockedXor64
2602 #define InterlockedIncrement64 _InterlockedIncrement64
2603 #define InterlockedDecrement64 _InterlockedDecrement64
2604 #define InterlockedAdd64 _InterlockedAdd64
2605 #define InterlockedExchange64 _InterlockedExchange64
2606 #define InterlockedExchangeAdd64 _InterlockedExchangeAdd64
2607 #define InterlockedCompareExchange64 _InterlockedCompareExchange64
2608 #define InterlockedCompareExchangePointer _InterlockedCompareExchangePointer
2609 #define InterlockedExchangePointer _InterlockedExchangePointer
2610 #define InterlockedBitTestAndSet64 _interlockedbittestandset64
2611 #define InterlockedBitTestAndReset64 _interlockedbittestandreset64
2612
2613 #endif // _M_AMD64
2614
2615 #if defined(_M_AMD64) && !defined(RC_INVOKED) && !defined(MIDL_PASS)
2616 //#if !defined(_X86AMD64_) // FIXME: what's _X86AMD64_ used for?
2617 FORCEINLINE
2618 LONG64
2619 InterlockedAdd64(
2620 IN OUT LONG64 volatile *Addend,
2621 IN LONG64 Value)
2622 {
2623 return InterlockedExchangeAdd64(Addend, Value) + Value;
2624 }
2625 //#endif
2626 #endif
2627
2628 #endif /* !__INTERLOCKED_DECLARED */
2629
2630 #if defined(_M_IX86)
2631 #define YieldProcessor _mm_pause
2632 #elif defined (_M_AMD64)
2633 #define YieldProcessor _mm_pause
2634 #elif defined(_M_PPC)
2635 #define YieldProcessor() __asm__ __volatile__("nop");
2636 #elif defined(_M_MIPS)
2637 #define YieldProcessor() __asm__ __volatile__("nop");
2638 #elif defined(_M_ARM)
2639 #define YieldProcessor()
2640 #else
2641 #error Unknown architecture
2642 #endif
2643
2644
2645
2646 //
2647 // Slist Header
2648 //
2649 #ifndef _SLIST_HEADER_
2650 #define _SLIST_HEADER_
2651
2652 #if defined(_WIN64)
2653 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY *PSLIST_ENTRY;
2654 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY {
2655 PSLIST_ENTRY Next;
2656 } SLIST_ENTRY;
2657 typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER {
2658 struct {
2659 ULONGLONG Alignment;
2660 ULONGLONG Region;
2661 } DUMMYSTRUCTNAME;
2662 struct {
2663 ULONGLONG Depth:16;
2664 ULONGLONG Sequence:9;
2665 ULONGLONG NextEntry:39;
2666 ULONGLONG HeaderType:1;
2667 ULONGLONG Init:1;
2668 ULONGLONG Reserved:59;
2669 ULONGLONG Region:3;
2670 } Header8;
2671 struct {
2672 ULONGLONG Depth:16;
2673 ULONGLONG Sequence:48;
2674 ULONGLONG HeaderType:1;
2675 ULONGLONG Init:1;
2676 ULONGLONG Reserved:2;
2677 ULONGLONG NextEntry:60;
2678 } Header16;
2679 } SLIST_HEADER, *PSLIST_HEADER;
2680 #else
2681 #define SLIST_ENTRY SINGLE_LIST_ENTRY
2682 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
2683 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
2684 typedef union _SLIST_HEADER {
2685 ULONGLONG Alignment;
2686 struct {
2687 SLIST_ENTRY Next;
2688 USHORT Depth;
2689 USHORT Sequence;
2690 } DUMMYSTRUCTNAME;
2691 } SLIST_HEADER, *PSLIST_HEADER;
2692 #endif
2693
2694 #endif /* _SLIST_HEADER_ */
2695
2696
2697
2698 //
2699 // Power States/Levels
2700 //
2701 typedef enum _SYSTEM_POWER_STATE {
2702 PowerSystemUnspecified,
2703 PowerSystemWorking,
2704 PowerSystemSleeping1,
2705 PowerSystemSleeping2,
2706 PowerSystemSleeping3,
2707 PowerSystemHibernate,
2708 PowerSystemShutdown,
2709 PowerSystemMaximum
2710 } SYSTEM_POWER_STATE, *PSYSTEM_POWER_STATE;
2711
2712 #define POWER_SYSTEM_MAXIMUM PowerSystemMaximum
2713
2714 typedef enum _POWER_INFORMATION_LEVEL {
2715 SystemPowerPolicyAc,
2716 SystemPowerPolicyDc,
2717 VerifySystemPolicyAc,
2718 VerifySystemPolicyDc,
2719 SystemPowerCapabilities,
2720 SystemBatteryState,
2721 SystemPowerStateHandler,
2722 ProcessorStateHandler,
2723 SystemPowerPolicyCurrent,
2724 AdministratorPowerPolicy,
2725 SystemReserveHiberFile,
2726 ProcessorInformation,
2727 SystemPowerInformation,
2728 ProcessorStateHandler2,
2729 LastWakeTime,
2730 LastSleepTime,
2731 SystemExecutionState,
2732 SystemPowerStateNotifyHandler,
2733 ProcessorPowerPolicyAc,
2734 ProcessorPowerPolicyDc,
2735 VerifyProcessorPowerPolicyAc,
2736 VerifyProcessorPowerPolicyDc,
2737 ProcessorPowerPolicyCurrent
2738 } POWER_INFORMATION_LEVEL;
2739
2740 typedef enum {
2741 PowerActionNone,
2742 PowerActionReserved,
2743 PowerActionSleep,
2744 PowerActionHibernate,
2745 PowerActionShutdown,
2746 PowerActionShutdownReset,
2747 PowerActionShutdownOff,
2748 PowerActionWarmEject
2749 } POWER_ACTION, *PPOWER_ACTION;
2750
2751 typedef enum _DEVICE_POWER_STATE {
2752 PowerDeviceUnspecified,
2753 PowerDeviceD0,
2754 PowerDeviceD1,
2755 PowerDeviceD2,
2756 PowerDeviceD3,
2757 PowerDeviceMaximum
2758 } DEVICE_POWER_STATE, *PDEVICE_POWER_STATE;
2759
2760 #define ES_SYSTEM_REQUIRED 0x00000001
2761 #define ES_DISPLAY_REQUIRED 0x00000002
2762 #define ES_USER_PRESENT 0x00000004
2763 #define ES_CONTINUOUS 0x80000000
2764
2765 typedef ULONG EXECUTION_STATE;
2766
2767 typedef enum {
2768 LT_DONT_CARE,
2769 LT_LOWEST_LATENCY
2770 } LATENCY_TIME;
2771
2772
2773
2774 //
2775 // Access/Security Stuff
2776 //
2777 typedef ULONG ACCESS_MASK, *PACCESS_MASK;
2778 typedef PVOID PACCESS_TOKEN;
2779
2780 #define DELETE 0x00010000L
2781 #define READ_CONTROL 0x00020000L
2782 #define WRITE_DAC 0x00040000L
2783 #define WRITE_OWNER 0x00080000L
2784 #define SYNCHRONIZE 0x00100000L
2785 #define STANDARD_RIGHTS_REQUIRED 0x000F0000L
2786 #define STANDARD_RIGHTS_READ READ_CONTROL
2787 #define STANDARD_RIGHTS_WRITE READ_CONTROL
2788 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
2789 #define STANDARD_RIGHTS_ALL 0x001F0000L
2790 #define SPECIFIC_RIGHTS_ALL 0x0000FFFFL
2791 #define ACCESS_SYSTEM_SECURITY 0x01000000L
2792 #define MAXIMUM_ALLOWED 0x02000000L
2793 #define GENERIC_READ 0x80000000L
2794 #define GENERIC_WRITE 0x40000000L
2795 #define GENERIC_EXECUTE 0x20000000L
2796 #define GENERIC_ALL 0x10000000L
2797
2798 typedef struct _GENERIC_MAPPING {
2799 ACCESS_MASK GenericRead;
2800 ACCESS_MASK GenericWrite;
2801 ACCESS_MASK GenericExecute;
2802 ACCESS_MASK GenericAll;
2803 } GENERIC_MAPPING, *PGENERIC_MAPPING;
2804
2805 #define ACL_REVISION 2
2806 #define ACL_REVISION_DS 4
2807
2808 #define ACL_REVISION1 1
2809 #define ACL_REVISION2 2
2810 #define ACL_REVISION3 3
2811 #define ACL_REVISION4 4
2812 #define MIN_ACL_REVISION ACL_REVISION2
2813 #define MAX_ACL_REVISION ACL_REVISION4
2814
2815 typedef struct _ACL {
2816 UCHAR AclRevision;
2817 UCHAR Sbz1;
2818 USHORT AclSize;
2819 USHORT AceCount;
2820 USHORT Sbz2;
2821 } ACL, *PACL;
2822
2823
2824
2825 //
2826 // Current security descriptor revision value
2827 //
2828 #define SECURITY_DESCRIPTOR_REVISION (1)
2829 #define SECURITY_DESCRIPTOR_REVISION1 (1)
2830
2831 //
2832 // Privilege attributes
2833 //
2834 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT (0x00000001L)
2835 #define SE_PRIVILEGE_ENABLED (0x00000002L)
2836 #define SE_PRIVILEGE_REMOVED (0X00000004L)
2837 #define SE_PRIVILEGE_USED_FOR_ACCESS (0x80000000L)
2838
2839 #define SE_PRIVILEGE_VALID_ATTRIBUTES (SE_PRIVILEGE_ENABLED_BY_DEFAULT | \
2840 SE_PRIVILEGE_ENABLED | \
2841 SE_PRIVILEGE_REMOVED | \
2842 SE_PRIVILEGE_USED_FOR_ACCESS)
2843
2844 #include <pshpack4.h>
2845 typedef struct _LUID_AND_ATTRIBUTES {
2846 LUID Luid;
2847 ULONG Attributes;
2848 } LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES;
2849 #include <poppack.h>
2850 typedef LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
2851 typedef LUID_AND_ATTRIBUTES_ARRAY *PLUID_AND_ATTRIBUTES_ARRAY;
2852
2853
2854
2855 //
2856 // Privilege sets
2857 //
2858 #define PRIVILEGE_SET_ALL_NECESSARY (1)
2859
2860 typedef struct _PRIVILEGE_SET {
2861 ULONG PrivilegeCount;
2862 ULONG Control;
2863 LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
2864 } PRIVILEGE_SET,*PPRIVILEGE_SET;
2865
2866 typedef enum _SECURITY_IMPERSONATION_LEVEL {
2867 SecurityAnonymous,
2868 SecurityIdentification,
2869 SecurityImpersonation,
2870 SecurityDelegation
2871 } SECURITY_IMPERSONATION_LEVEL, * PSECURITY_IMPERSONATION_LEVEL;
2872
2873 #define SECURITY_MAX_IMPERSONATION_LEVEL SecurityDelegation
2874 #define SECURITY_MIN_IMPERSONATION_LEVEL SecurityAnonymous
2875 #define DEFAULT_IMPERSONATION_LEVEL SecurityImpersonation
2876 #define VALID_IMPERSONATION_LEVEL(Level) (((Level) >= SECURITY_MIN_IMPERSONATION_LEVEL) && ((Level) <= SECURITY_MAX_IMPERSONATION_LEVEL))
2877
2878 #define SECURITY_DYNAMIC_TRACKING (TRUE)
2879 #define SECURITY_STATIC_TRACKING (FALSE)
2880
2881 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE, *PSECURITY_CONTEXT_TRACKING_MODE;
2882
2883 typedef struct _SECURITY_QUALITY_OF_SERVICE {
2884 ULONG Length;
2885 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
2886 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
2887 BOOLEAN EffectiveOnly;
2888 } SECURITY_QUALITY_OF_SERVICE, *PSECURITY_QUALITY_OF_SERVICE;
2889
2890 typedef struct _SE_IMPERSONATION_STATE {
2891 PACCESS_TOKEN Token;
2892 BOOLEAN CopyOnOpen;
2893 BOOLEAN EffectiveOnly;
2894 SECURITY_IMPERSONATION_LEVEL Level;
2895 } SE_IMPERSONATION_STATE, *PSE_IMPERSONATION_STATE;
2896
2897 #define OWNER_SECURITY_INFORMATION (0x00000001L)
2898 #define GROUP_SECURITY_INFORMATION (0x00000002L)
2899 #define DACL_SECURITY_INFORMATION (0x00000004L)
2900 #define SACL_SECURITY_INFORMATION (0x00000008L)
2901 #define LABEL_SECURITY_INFORMATION (0x00000010L)
2902
2903 #define PROTECTED_DACL_SECURITY_INFORMATION (0x80000000L)
2904 #define PROTECTED_SACL_SECURITY_INFORMATION (0x40000000L)
2905 #define UNPROTECTED_DACL_SECURITY_INFORMATION (0x20000000L)
2906 #define UNPROTECTED_SACL_SECURITY_INFORMATION (0x10000000L)
2907
2908
2909
2910 //
2911 // Registry Access Rights
2912 //
2913 #define KEY_QUERY_VALUE (0x0001)
2914 #define KEY_SET_VALUE (0x0002)
2915 #define KEY_CREATE_SUB_KEY (0x0004)
2916 #define KEY_ENUMERATE_SUB_KEYS (0x0008)
2917 #define KEY_NOTIFY (0x0010)
2918 #define KEY_CREATE_LINK (0x0020)
2919 #define KEY_WOW64_32KEY (0x0200)
2920 #define KEY_WOW64_64KEY (0x0100)
2921 #define KEY_WOW64_RES (0x0300)
2922
2923 #define KEY_READ ((STANDARD_RIGHTS_READ |\
2924 KEY_QUERY_VALUE |\
2925 KEY_ENUMERATE_SUB_KEYS |\
2926 KEY_NOTIFY) \
2927 & \
2928 (~SYNCHRONIZE))
2929
2930 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE |\
2931 KEY_SET_VALUE |\
2932 KEY_CREATE_SUB_KEY) \
2933 & \
2934 (~SYNCHRONIZE))
2935
2936 #define KEY_EXECUTE ((KEY_READ) \
2937 & \
2938 (~SYNCHRONIZE))
2939
2940 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL |\
2941 KEY_QUERY_VALUE |\
2942 KEY_SET_VALUE |\
2943 KEY_CREATE_SUB_KEY |\
2944 KEY_ENUMERATE_SUB_KEYS |\
2945 KEY_NOTIFY |\
2946 KEY_CREATE_LINK) \
2947 & \
2948 (~SYNCHRONIZE))
2949
2950 //
2951 // Registry Open/Create Options
2952 //
2953 #define REG_OPTION_RESERVED (0x00000000L)
2954 #define REG_OPTION_NON_VOLATILE (0x00000000L)
2955 #define REG_OPTION_VOLATILE (0x00000001L)
2956 #define REG_OPTION_CREATE_LINK (0x00000002L)
2957 #define REG_OPTION_BACKUP_RESTORE (0x00000004L)
2958 #define REG_OPTION_OPEN_LINK (0x00000008L)
2959
2960 #define REG_LEGAL_OPTION \
2961 (REG_OPTION_RESERVED |\
2962 REG_OPTION_NON_VOLATILE |\
2963 REG_OPTION_VOLATILE |\
2964 REG_OPTION_CREATE_LINK |\
2965 REG_OPTION_BACKUP_RESTORE |\
2966 REG_OPTION_OPEN_LINK)
2967
2968 //
2969 // Key creation/open disposition
2970 //
2971 #define REG_CREATED_NEW_KEY (0x00000001L)
2972 #define REG_OPENED_EXISTING_KEY (0x00000002L)
2973
2974 //
2975 // Key restore & hive load flags
2976 //
2977 #define REG_WHOLE_HIVE_VOLATILE (0x00000001L)
2978 #define REG_REFRESH_HIVE (0x00000002L)
2979 #define REG_NO_LAZY_FLUSH (0x00000004L)
2980 #define REG_FORCE_RESTORE (0x00000008L)
2981 #define REG_APP_HIVE (0x00000010L)
2982 #define REG_PROCESS_PRIVATE (0x00000020L)
2983 #define REG_START_JOURNAL (0x00000040L)
2984 #define REG_HIVE_EXACT_FILE_GROWTH (0x00000080L)
2985 #define REG_HIVE_NO_RM (0x00000100L)
2986 #define REG_HIVE_SINGLE_LOG (0x00000200L)
2987
2988 //
2989 // Unload Flags
2990 //
2991 #define REG_FORCE_UNLOAD 1
2992
2993 //
2994 // Notify Filter Values
2995 //
2996 #define REG_NOTIFY_CHANGE_NAME (0x00000001L)
2997 #define REG_NOTIFY_CHANGE_ATTRIBUTES (0x00000002L)
2998 #define REG_NOTIFY_CHANGE_LAST_SET (0x00000004L)
2999 #define REG_NOTIFY_CHANGE_SECURITY (0x00000008L)
3000
3001 #define REG_LEGAL_CHANGE_FILTER \
3002 (REG_NOTIFY_CHANGE_NAME |\
3003 REG_NOTIFY_CHANGE_ATTRIBUTES |\
3004 REG_NOTIFY_CHANGE_LAST_SET |\
3005 REG_NOTIFY_CHANGE_SECURITY)
3006
3007
3008
3009 //
3010 // Thread Access Rights
3011 //
3012 #define THREAD_TERMINATE (0x0001)
3013 #define THREAD_SUSPEND_RESUME (0x0002)
3014 #define THREAD_ALERT (0x0004)
3015 #define THREAD_GET_CONTEXT (0x0008)
3016 #define THREAD_SET_CONTEXT (0x0010)
3017 #define THREAD_SET_INFORMATION (0x0020)
3018 #define THREAD_SET_LIMITED_INFORMATION (0x0400)
3019 #define THREAD_QUERY_LIMITED_INFORMATION (0x0800)
3020 #if (NTDDI_VERSION >= NTDDI_VISTA)
3021 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \
3022 0xFFFF)
3023 #else
3024 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \
3025 0x3FF)
3026 #endif
3027
3028 //
3029 // Service Start Types
3030 //
3031 #define SERVICE_BOOT_START 0x00000000
3032 #define SERVICE_SYSTEM_START 0x00000001
3033 #define SERVICE_AUTO_START 0x00000002
3034 #define SERVICE_DEMAND_START 0x00000003
3035 #define SERVICE_DISABLED 0x00000004
3036
3037 //
3038 // Exception Records
3039 //
3040 #define EXCEPTION_NONCONTINUABLE 1
3041 #define EXCEPTION_MAXIMUM_PARAMETERS 15
3042
3043 typedef struct _EXCEPTION_RECORD {
3044 NTSTATUS ExceptionCode;
3045 ULONG ExceptionFlags;
3046 struct _EXCEPTION_RECORD *ExceptionRecord;
3047 PVOID ExceptionAddress;
3048 ULONG NumberParameters;
3049 ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
3050 } EXCEPTION_RECORD, *PEXCEPTION_RECORD;
3051
3052 typedef struct _EXCEPTION_RECORD32 {
3053 NTSTATUS ExceptionCode;
3054 ULONG ExceptionFlags;
3055 ULONG ExceptionRecord;
3056 ULONG ExceptionAddress;
3057 ULONG NumberParameters;
3058 ULONG ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
3059 } EXCEPTION_RECORD32, *PEXCEPTION_RECORD32;
3060
3061 typedef struct _EXCEPTION_RECORD64 {
3062 NTSTATUS ExceptionCode;
3063 ULONG ExceptionFlags;
3064 ULONG64 ExceptionRecord;
3065 ULONG64 ExceptionAddress;
3066 ULONG NumberParameters;
3067 ULONG __unusedAlignment;
3068 ULONG64 ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
3069 } EXCEPTION_RECORD64, *PEXCEPTION_RECORD64;
3070
3071 typedef struct _EXCEPTION_POINTERS {
3072 PEXCEPTION_RECORD ExceptionRecord;
3073 PCONTEXT ContextRecord;
3074 } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
3075
3076
3077
3078 //
3079 // Process Qoutas
3080 //
3081 typedef struct _QUOTA_LIMITS {
3082 SIZE_T PagedPoolLimit;
3083 SIZE_T NonPagedPoolLimit;
3084 SIZE_T MinimumWorkingSetSize;
3085 SIZE_T MaximumWorkingSetSize;
3086 SIZE_T PagefileLimit;
3087 LARGE_INTEGER TimeLimit;
3088 } QUOTA_LIMITS, *PQUOTA_LIMITS;
3089
3090 #define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001
3091 #define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002
3092 #define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004
3093 #define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008
3094 #define QUOTA_LIMITS_USE_DEFAULT_LIMITS 0x00000010
3095
3096
3097 /******************************************************************************
3098 * WINBASE Functions *
3099 ******************************************************************************/
3100 #if !defined(_WINBASE_)
3101
3102 #if defined(_WIN64)
3103
3104 #define InterlockedPopEntrySList(Head) \
3105 ExpInterlockedPopEntrySList(Head)
3106
3107 #define InterlockedPushEntrySList(Head, Entry) \
3108 ExpInterlockedPushEntrySList(Head, Entry)
3109
3110 #define InterlockedFlushSList(Head) \
3111 ExpInterlockedFlushSList(Head)
3112
3113 #define QueryDepthSList(Head) \
3114 ExQueryDepthSList(Head)
3115
3116 #else // !defined(_WIN64)
3117
3118 NTKERNELAPI
3119 PSLIST_ENTRY
3120 FASTCALL
3121 InterlockedPopEntrySList(
3122 IN PSLIST_HEADER ListHead);
3123
3124 NTKERNELAPI
3125 PSLIST_ENTRY
3126 FASTCALL
3127 InterlockedPushEntrySList(
3128 IN PSLIST_HEADER ListHead,
3129 IN PSLIST_ENTRY ListEntry);
3130
3131 #define InterlockedFlushSList(ListHead) \
3132 ExInterlockedFlushSList(ListHead)
3133
3134 #define QueryDepthSList(Head) \
3135 ExQueryDepthSList(Head)
3136
3137 #endif // !defined(_WIN64)
3138
3139 #endif // !defined(_WINBASE_)
3140
3141
3142 /******************************************************************************
3143 * Kernel Types *
3144 ******************************************************************************/
3145
3146 typedef struct _DISPATCHER_HEADER
3147 {
3148 __GNU_EXTENSION union
3149 {
3150 __GNU_EXTENSION struct
3151 {
3152 UCHAR Type;
3153 __GNU_EXTENSION union
3154 {
3155 UCHAR Absolute;
3156 UCHAR NpxIrql;
3157 };
3158 __GNU_EXTENSION union
3159 {
3160 UCHAR Size;
3161 UCHAR Hand;
3162 };
3163 __GNU_EXTENSION union
3164 {
3165 UCHAR Inserted;
3166 BOOLEAN DebugActive;
3167 };
3168 };
3169 volatile LONG Lock;
3170 };
3171 LONG SignalState;
3172 LIST_ENTRY WaitListHead;
3173 } DISPATCHER_HEADER, *PDISPATCHER_HEADER;
3174
3175 typedef ULONG_PTR KSPIN_LOCK, *PKSPIN_LOCK;
3176
3177 typedef struct _KEVENT {
3178 DISPATCHER_HEADER Header;
3179 } KEVENT, *PKEVENT, *RESTRICTED_POINTER PRKEVENT;
3180
3181 typedef struct _KSEMAPHORE {
3182 DISPATCHER_HEADER Header;
3183 LONG Limit;
3184 } KSEMAPHORE, *PKSEMAPHORE, *RESTRICTED_POINTER PRKSEMAPHORE;
3185
3186 /******************************************************************************
3187 * RTL Types *
3188 ******************************************************************************/
3189
3190 #define RTL_REGISTRY_ABSOLUTE 0
3191 #define RTL_REGISTRY_SERVICES 1
3192 #define RTL_REGISTRY_CONTROL 2
3193 #define RTL_REGISTRY_WINDOWS_NT 3
3194 #define RTL_REGISTRY_DEVICEMAP 4
3195 #define RTL_REGISTRY_USER 5
3196 #define RTL_REGISTRY_MAXIMUM 6
3197 #define RTL_REGISTRY_HANDLE 0x40000000
3198 #define RTL_REGISTRY_OPTIONAL 0x80000000
3199
3200 /* RTL_QUERY_REGISTRY_TABLE.Flags */
3201 #define RTL_QUERY_REGISTRY_SUBKEY 0x00000001
3202 #define RTL_QUERY_REGISTRY_TOPKEY 0x00000002
3203 #define RTL_QUERY_REGISTRY_REQUIRED 0x00000004
3204 #define RTL_QUERY_REGISTRY_NOVALUE 0x00000008
3205 #define RTL_QUERY_REGISTRY_NOEXPAND 0x00000010
3206 #define RTL_QUERY_REGISTRY_DIRECT 0x00000020
3207 #define RTL_QUERY_REGISTRY_DELETE 0x00000040
3208
3209 typedef struct _RTL_BITMAP {
3210 ULONG SizeOfBitMap;
3211 PULONG Buffer;
3212 } RTL_BITMAP, *PRTL_BITMAP;
3213
3214 typedef struct _RTL_BITMAP_RUN {
3215 ULONG StartingIndex;
3216 ULONG NumberOfBits;
3217 } RTL_BITMAP_RUN, *PRTL_BITMAP_RUN;
3218
3219 typedef NTSTATUS
3220 (DDKAPI *PRTL_QUERY_REGISTRY_ROUTINE)(
3221 IN PWSTR ValueName,
3222 IN ULONG ValueType,
3223 IN PVOID ValueData,
3224 IN ULONG ValueLength,
3225 IN PVOID Context,
3226 IN PVOID EntryContext);
3227
3228 typedef struct _RTL_QUERY_REGISTRY_TABLE {
3229 PRTL_QUERY_REGISTRY_ROUTINE QueryRoutine;
3230 ULONG Flags;
3231 PCWSTR Name;
3232 PVOID EntryContext;
3233 ULONG DefaultType;
3234 PVOID DefaultData;
3235 ULONG DefaultLength;
3236 } RTL_QUERY_REGISTRY_TABLE, *PRTL_QUERY_REGISTRY_TABLE;
3237
3238 typedef struct _TIME_FIELDS {
3239 CSHORT Year;
3240 CSHORT Month;
3241 CSHORT Day;
3242 CSHORT Hour;
3243 CSHORT Minute;
3244 CSHORT Second;
3245 CSHORT Milliseconds;
3246 CSHORT Weekday;
3247 } TIME_FIELDS, *PTIME_FIELDS;
3248
3249
3250 /******************************************************************************
3251 * RTL Functions *
3252 ******************************************************************************/
3253
3254 NTSYSAPI
3255 VOID
3256 NTAPI
3257 RtlAssert(
3258 IN PVOID FailedAssertion,
3259 IN PVOID FileName,
3260 IN ULONG LineNumber,
3261 IN PCHAR Message);
3262
3263 /* VOID
3264 * RtlCopyMemory(
3265 * IN VOID UNALIGNED *Destination,
3266 * IN CONST VOID UNALIGNED *Source,
3267 * IN SIZE_T Length)
3268 */
3269 #define RtlCopyMemory(Destination, Source, Length) \
3270 memcpy(Destination, Source, Length)
3271
3272 #define RtlCopyBytes RtlCopyMemory
3273
3274 #if defined(_M_AMD64)
3275 NTSYSAPI
3276 VOID
3277 NTAPI
3278 RtlCopyMemoryNonTemporal(
3279 VOID UNALIGNED *Destination,
3280 CONST VOID UNALIGNED *Source,
3281 SIZE_T Length);
3282 #else
3283 #define RtlCopyMemoryNonTemporal RtlCopyMemory
3284 #endif
3285
3286 /* BOOLEAN
3287 * RtlEqualLuid(
3288 * IN PLUID Luid1,
3289 * IN PLUID Luid2)
3290 */
3291 #define RtlEqualLuid(Luid1, Luid2) \
3292 (((Luid1)->LowPart == (Luid2)->LowPart) && ((Luid1)->HighPart == (Luid2)->HighPart))
3293
3294 /* ULONG
3295 * RtlEqualMemory(
3296 * IN VOID UNALIGNED *Destination,
3297 * IN CONST VOID UNALIGNED *Source,
3298 * IN SIZE_T Length)
3299 */
3300 #define RtlEqualMemory(Destination, Source, Length) \
3301 (!memcmp(Destination, Source, Length))
3302
3303 /* VOID
3304 * RtlFillMemory(
3305 * IN VOID UNALIGNED *Destination,
3306 * IN SIZE_T Length,
3307 * IN UCHAR Fill)
3308 */
3309 #define RtlFillMemory(Destination, Length, Fill) \
3310 memset(Destination, Fill, Length)
3311
3312 #define RtlFillBytes RtlFillMemory
3313
3314 NTSYSAPI
3315 VOID
3316 NTAPI
3317 RtlFreeUnicodeString(
3318 IN PUNICODE_STRING UnicodeString);
3319
3320 NTSYSAPI
3321 NTSTATUS
3322 NTAPI
3323 RtlGUIDFromString(
3324 IN PUNICODE_STRING GuidString,
3325 OUT GUID *Guid);
3326
3327 NTSYSAPI
3328 VOID
3329 NTAPI
3330 RtlInitUnicodeString(
3331 IN OUT PUNICODE_STRING DestinationString,
3332 IN PCWSTR SourceString);
3333
3334 /* VOID
3335 * RtlMoveMemory(
3336 * IN VOID UNALIGNED *Destination,
3337 * IN CONST VOID UNALIGNED *Source,
3338 * IN SIZE_T Length)
3339 */
3340 #define RtlMoveMemory(Destination, Source, Length) \
3341 memmove(Destination, Source, Length)
3342
3343 NTSYSAPI
3344 NTSTATUS
3345 NTAPI
3346 RtlStringFromGUID(
3347 IN REFGUID Guid,
3348 OUT PUNICODE_STRING GuidString);
3349
3350 /* VOID
3351 * RtlZeroMemory(
3352 * IN VOID UNALIGNED *Destination,
3353 * IN SIZE_T Length)
3354 */
3355 #define RtlZeroMemory(Destination, Length) \
3356 memset(Destination, 0, Length)
3357
3358 #define RtlZeroBytes RtlZeroMemory
3359
3360
3361 #if (NTDDI_VERSION >= NTDDI_WIN2K)
3362 NTSYSAPI
3363 BOOLEAN
3364 NTAPI
3365 RtlAreBitsClear(
3366 IN PRTL_BITMAP BitMapHeader,
3367 IN ULONG StartingIndex,
3368 IN ULONG Length);
3369
3370 NTSYSAPI
3371 BOOLEAN
3372 NTAPI
3373 RtlAreBitsSet(
3374 IN PRTL_BITMAP BitMapHeader,
3375 IN ULONG StartingIndex,
3376 IN ULONG Length);
3377
3378 NTSYSAPI
3379 NTSTATUS
3380 NTAPI
3381 RtlAnsiStringToUnicodeString(
3382 IN OUT PUNICODE_STRING DestinationString,
3383 IN PANSI_STRING SourceString,
3384 IN BOOLEAN AllocateDestinationString);
3385
3386 NTSYSAPI
3387 ULONG
3388 NTAPI
3389 RtlxAnsiStringToUnicodeSize(
3390 IN PCANSI_STRING AnsiString);
3391
3392 #define RtlAnsiStringToUnicodeSize(String) ( \
3393 NLS_MB_CODE_PAGE_TAG ? \
3394 RtlxAnsiStringToUnicodeSize(String) : \
3395 ((String)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
3396 )
3397
3398 NTSYSAPI
3399 NTSTATUS
3400 NTAPI
3401 RtlAppendUnicodeStringToString(
3402 IN OUT PUNICODE_STRING Destination,
3403 IN PCUNICODE_STRING Source);
3404
3405 NTSYSAPI
3406 NTSTATUS
3407 NTAPI
3408 RtlAppendUnicodeToString(
3409 IN OUT PUNICODE_STRING Destination,
3410 IN PCWSTR Source);
3411
3412 NTSYSAPI
3413 NTSTATUS
3414 NTAPI
3415 RtlCheckRegistryKey(
3416 IN ULONG RelativeTo,
3417 IN PWSTR Path);
3418
3419 NTSYSAPI
3420 VOID
3421 NTAPI
3422 RtlClearAllBits(
3423 IN PRTL_BITMAP BitMapHeader);
3424
3425 NTSYSAPI
3426 VOID
3427 NTAPI
3428 RtlClearBits(
3429 IN PRTL_BITMAP BitMapHeader,
3430 IN ULONG StartingIndex,
3431 IN ULONG NumberToClear);
3432
3433 NTSYSAPI
3434 SIZE_T
3435 NTAPI
3436 RtlCompareMemory(
3437 IN CONST VOID *Source1,
3438 IN CONST VOID *Source2,
3439 IN SIZE_T Length);
3440
3441 NTSYSAPI
3442 LONG
3443 NTAPI
3444 RtlCompareUnicodeString(
3445 IN PCUNICODE_STRING String1,
3446 IN PCUNICODE_STRING String2,
3447 IN BOOLEAN CaseInSensitive);
3448
3449 NTSYSAPI
3450 LONG
3451 NTAPI
3452 RtlCompareUnicodeStrings(
3453 IN PCWCH String1,
3454 IN SIZE_T String1Length,
3455 IN PCWCH String2,
3456 IN SIZE_T String2Length,
3457 IN BOOLEAN CaseInSensitive);
3458
3459 NTSYSAPI
3460 VOID
3461 NTAPI
3462 RtlCopyUnicodeString(
3463 IN OUT PUNICODE_STRING DestinationString,
3464 IN PCUNICODE_STRING SourceString);
3465
3466 NTSYSAPI
3467 NTSTATUS
3468 NTAPI
3469 RtlCreateRegistryKey(
3470 IN ULONG RelativeTo,
3471 IN PWSTR Path);
3472
3473 NTSYSAPI
3474 NTSTATUS
3475 NTAPI
3476 RtlCreateSecurityDescriptor(
3477 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
3478 IN ULONG Revision);
3479
3480 NTSYSAPI
3481 NTSTATUS
3482 NTAPI
3483 RtlDeleteRegistryValue(
3484 IN ULONG RelativeTo,
3485 IN PCWSTR Path,
3486 IN PCWSTR ValueName);
3487
3488 NTSYSAPI
3489 BOOLEAN
3490 NTAPI
3491 RtlEqualUnicodeString(
3492 IN CONST UNICODE_STRING *String1,
3493 IN CONST UNICODE_STRING *String2,
3494 IN BOOLEAN CaseInSensitive);
3495
3496 #if !defined(_AMD64_) && !defined(_IA64_)
3497 NTSYSAPI
3498 LARGE_INTEGER
3499 NTAPI
3500 RtlExtendedIntegerMultiply(
3501 IN LARGE_INTEGER Multiplicand,
3502 IN LONG Multiplier);
3503
3504 NTSYSAPI
3505 LARGE_INTEGER
3506 NTAPI
3507 RtlExtendedLargeIntegerDivide(
3508 IN LARGE_INTEGER Dividend,
3509 IN ULONG Divisor,
3510 IN OUT PULONG Remainder);
3511 #endif
3512
3513 #if defined(_X86_) || defined(_IA64_)
3514 NTSYSAPI
3515 LARGE_INTEGER
3516 NTAPI
3517 RtlExtendedMagicDivide(
3518 IN LARGE_INTEGER Dividend,
3519 IN LARGE_INTEGER MagicDivisor,
3520 IN CCHAR ShiftCount);
3521 #endif
3522
3523 NTSYSAPI
3524 VOID
3525 NTAPI
3526 RtlFreeAnsiString(
3527 IN PANSI_STRING AnsiString);
3528
3529 NTSYSAPI
3530 ULONG
3531 NTAPI
3532 RtlFindClearBits(
3533 IN PRTL_BITMAP BitMapHeader,
3534 IN ULONG NumberToFind,
3535 IN ULONG HintIndex);
3536
3537 NTSYSAPI
3538 ULONG
3539 NTAPI
3540 RtlFindClearBitsAndSet(
3541 IN PRTL_BITMAP BitMapHeader,
3542 IN ULONG NumberToFind,
3543 IN ULONG HintIndex);
3544
3545 NTSYSAPI
3546 ULONG
3547 NTAPI
3548 RtlFindFirstRunClear(
3549 IN PRTL_BITMAP BitMapHeader,
3550 OUT PULONG StartingIndex);
3551
3552 NTSYSAPI
3553 ULONG
3554 NTAPI
3555 RtlFindClearRuns(
3556 IN PRTL_BITMAP BitMapHeader,
3557 OUT PRTL_BITMAP_RUN RunArray,
3558 IN ULONG SizeOfRunArray,
3559 IN BOOLEAN LocateLongestRuns);
3560
3561 NTSYSAPI
3562 ULONG
3563 NTAPI
3564 RtlFindLastBackwardRunClear(
3565 IN PRTL_BITMAP BitMapHeader,
3566 IN ULONG FromIndex,
3567 OUT PULONG StartingRunIndex);
3568
3569 NTSYSAPI
3570 CCHAR
3571 NTAPI
3572 RtlFindLeastSignificantBit(
3573 IN ULONGLONG Set);
3574
3575 NTSYSAPI
3576 ULONG
3577 NTAPI
3578 RtlFindLongestRunClear(
3579 IN PRTL_BITMAP BitMapHeader,
3580 OUT PULONG StartingIndex);
3581
3582 NTSYSAPI
3583 CCHAR
3584 NTAPI
3585 RtlFindMostSignificantBit(
3586 IN ULONGLONG Set);
3587
3588 NTSYSAPI
3589 ULONG
3590 NTAPI
3591 RtlFindNextForwardRunClear(
3592 IN PRTL_BITMAP BitMapHeader,
3593 IN ULONG FromIndex,
3594 OUT PULONG StartingRunIndex);
3595
3596 NTSYSAPI
3597 ULONG
3598 NTAPI
3599 RtlFindSetBits(
3600 IN PRTL_BITMAP BitMapHeader,
3601 IN ULONG NumberToFind,
3602 IN ULONG HintIndex);
3603
3604 NTSYSAPI
3605 ULONG
3606 NTAPI
3607 RtlFindSetBitsAndClear(
3608 IN PRTL_BITMAP BitMapHeader,
3609 IN ULONG NumberToFind,
3610 IN ULONG HintIndex);
3611
3612 NTSYSAPI
3613 NTSTATUS
3614 NTAPI
3615 RtlHashUnicodeString(
3616 IN CONST UNICODE_STRING *String,
3617 IN BOOLEAN CaseInSensitive,
3618 IN ULONG HashAlgorithm,
3619 OUT PULONG HashValue);
3620
3621 NTSYSAPI
3622 VOID
3623 NTAPI
3624 RtlInitAnsiString(
3625 IN OUT PANSI_STRING DestinationString,
3626 IN PCSZ SourceString);
3627
3628 NTSYSAPI
3629 VOID
3630 NTAPI
3631 RtlInitializeBitMap(
3632 IN PRTL_BITMAP BitMapHeader,
3633 IN PULONG BitMapBuffer,
3634 IN ULONG SizeOfBitMap);
3635
3636 NTSYSAPI
3637 VOID
3638 NTAPI
3639 RtlInitString(
3640 IN OUT PSTRING DestinationString,
3641 IN PCSZ SourceString);
3642
3643 NTSYSAPI
3644 NTSTATUS
3645 NTAPI
3646 RtlIntegerToUnicodeString(
3647 IN ULONG Value,
3648 IN ULONG Base OPTIONAL,
3649 IN OUT PUNICODE_STRING String);
3650
3651 NTSYSAPI
3652 NTSTATUS
3653 NTAPI
3654 RtlInt64ToUnicodeString(
3655 IN ULONGLONG Value,
3656 IN ULONG Base OPTIONAL,
3657 IN OUT PUNICODE_STRING String);
3658
3659 #ifdef _WIN64
3660 #define RtlIntPtrToUnicodeString(Value, Base, String) \
3661 RtlInt64ToUnicodeString(Value, Base, String)
3662 #else
3663 #define RtlIntPtrToUnicodeString(Value, Base, String) \
3664 RtlIntegerToUnicodeString(Value, Base, String)
3665 #endif
3666
3667 /* BOOLEAN
3668 * RtlIsZeroLuid(
3669 * IN PLUID L1);
3670 */
3671 #define RtlIsZeroLuid(_L1) \
3672 ((BOOLEAN) ((!(_L1)->LowPart) && (!(_L1)->HighPart)))
3673
3674 NTSYSAPI
3675 ULONG
3676 NTAPI
3677 RtlLengthSecurityDescriptor(
3678 IN PSECURITY_DESCRIPTOR SecurityDescriptor);
3679
3680 NTSYSAPI
3681 ULONG
3682 NTAPI
3683 RtlNumberOfClearBits(
3684 IN PRTL_BITMAP BitMapHeader);
3685
3686 NTSYSAPI
3687 ULONG
3688 NTAPI
3689 RtlNumberOfSetBits(
3690 IN PRTL_BITMAP BitMapHeader);
3691
3692 NTSYSAPI
3693 NTSTATUS
3694 NTAPI
3695 RtlQueryRegistryValues(
3696 IN ULONG RelativeTo,
3697 IN PCWSTR Path,
3698 IN PRTL_QUERY_REGISTRY_TABLE QueryTable,
3699 IN PVOID Context,
3700 IN PVOID Environment OPTIONAL);
3701
3702 #define LONG_SIZE (sizeof(LONG))
3703 #define LONG_MASK (LONG_SIZE - 1)
3704
3705 /* VOID
3706 * RtlRetrieveUlong(
3707 * PULONG DestinationAddress,
3708 * PULONG SourceAddress);
3709 */
3710 #if defined(_AMD64_)
3711 #define RtlRetrieveUlong(DestAddress,SrcAddress) \
3712 *(ULONG UNALIGNED *)(DestAddress) = *(PULONG)(SrcAddress)
3713 #else
3714 #define RtlRetrieveUlong(DestAddress,SrcAddress) \
3715 if ((ULONG_PTR)(SrcAddress) & LONG_MASK) \
3716 { \
3717 ((PUCHAR)(DestAddress))[0]=((PUCHAR)(SrcAddress))[0]; \
3718 ((PUCHAR)(DestAddress))[1]=((PUCHAR)(SrcAddress))[1]; \
3719 ((PUCHAR)(DestAddress))[2]=((PUCHAR)(SrcAddress))[2]; \
3720 ((PUCHAR)(DestAddress))[3]=((PUCHAR)(SrcAddress))[3]; \
3721 } \
3722 else \
3723 { \
3724 *((PULONG)(DestAddress))=*((PULONG)(SrcAddress)); \
3725 }
3726 #endif
3727
3728 /* VOID
3729 * RtlRetrieveUshort(
3730 * PUSHORT DestinationAddress,
3731 * PUSHORT SourceAddress);
3732 */
3733 #if defined(_AMD64_)
3734 #define RtlRetrieveUshort(DestAddress,SrcAddress) \
3735 *(USHORT UNALIGNED *)(DestAddress) = *(USHORT)(SrcAddress)
3736 #else
3737 #define RtlRetrieveUshort(DestAddress,SrcAddress) \
3738 if ((ULONG_PTR)(SrcAddress) & LONG_MASK) \
3739 { \
3740 ((PUCHAR)(DestAddress))[0]=((PUCHAR)(SrcAddress))[0]; \
3741 ((PUCHAR)(DestAddress))[1]=((PUCHAR)(SrcAddress))[1]; \
3742 } \
3743 else \
3744 { \
3745 *((PUSHORT)(DestAddress))=*((PUSHORT)(SrcAddress)); \
3746 }
3747 #endif
3748
3749 NTSYSAPI
3750 VOID
3751 NTAPI
3752 RtlSetAllBits(
3753 IN PRTL_BITMAP BitMapHeader);
3754
3755 NTSYSAPI
3756 VOID
3757 NTAPI
3758 RtlSetBits(
3759 IN PRTL_BITMAP BitMapHeader,
3760 IN ULONG StartingIndex,
3761 IN ULONG NumberToSet);
3762
3763 NTSYSAPI
3764 NTSTATUS
3765 NTAPI
3766 RtlSetDaclSecurityDescriptor(
3767 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
3768 IN BOOLEAN DaclPresent,
3769 IN PACL Dacl OPTIONAL,
3770 IN BOOLEAN DaclDefaulted OPTIONAL);
3771
3772 /* VOID
3773 * RtlStoreUlong(
3774 * IN PULONG Address,
3775 * IN ULONG Value);
3776 */
3777 #if defined(_AMD64_)
3778 #define RtlStoreUlong(Address,Value) \
3779 *(ULONG UNALIGNED *)(Address) = (Value)
3780 #else
3781 #define RtlStoreUlong(Address,Value) \
3782 if ((ULONG_PTR)(Address) & LONG_MASK) { \
3783 ((PUCHAR) (Address))[LONG_LEAST_SIGNIFICANT_BIT] = (UCHAR)(FIRSTBYTE(Value)); \
3784 ((PUCHAR) (Address))[LONG_3RD_MOST_SIGNIFICANT_BIT] = (UCHAR)(SECONDBYTE(Value)); \
3785 ((PUCHAR) (Address))[LONG_2ND_MOST_SIGNIFICANT_BIT] = (UCHAR)(THIRDBYTE(Value)); \
3786 ((PUCHAR) (Address))[LONG_MOST_SIGNIFICANT_BIT] = (UCHAR)(FOURTHBYTE(Value)); \
3787 } \
3788 else { \
3789 *((PULONG)(Address)) = (ULONG) (Value); \
3790 }
3791 #endif
3792
3793 /* VOID
3794 * RtlStoreUlonglong(
3795 * IN OUT PULONGLONG Address,
3796 * ULONGLONG Value);
3797 */
3798 #if defined(_AMD64_)
3799 #define RtlStoreUlonglong(Address,Value) \
3800 *(ULONGLONG UNALIGNED *)(Address) = (Value)
3801 #else
3802 #define RtlStoreUlonglong(Address,Value) \
3803 if ((ULONG_PTR)(Address) & LONGLONG_MASK) { \
3804 RtlStoreUlong((ULONG_PTR)(Address), \
3805 (ULONGLONG)(Value) & 0xFFFFFFFF); \
3806 RtlStoreUlong((ULONG_PTR)(Address)+sizeof(ULONG), \
3807 (ULONGLONG)(Value) >> 32); \
3808 } else { \
3809 *((PULONGLONG)(Address)) = (ULONGLONG)(Value); \
3810 }
3811 #endif
3812
3813 /* VOID
3814 * RtlStoreUlongPtr(
3815 * IN OUT PULONG_PTR Address,
3816 * IN ULONG_PTR Value);
3817 */
3818 #ifdef _WIN64
3819 #define RtlStoreUlongPtr(Address,Value) \
3820 RtlStoreUlonglong(Address,Value)
3821 #else
3822 #define RtlStoreUlongPtr(Address,Value) \
3823 RtlStoreUlong(Address,Value)
3824 #endif
3825
3826 /* VOID
3827 * RtlStoreUshort(
3828 * IN PUSHORT Address,
3829 * IN USHORT Value);
3830 */
3831 #if defined(_AMD64_)
3832 #define RtlStoreUshort(Address,Value) \
3833 *(USHORT UNALIGNED *)(Address) = (Value)
3834 #else
3835 #define RtlStoreUshort(Address,Value) \
3836 if ((ULONG_PTR)(Address) & SHORT_MASK) { \
3837 ((PUCHAR) (Address))[SHORT_LEAST_SIGNIFICANT_BIT] = (UCHAR)(FIRSTBYTE(Value)); \
3838 ((PUCHAR) (Address))[SHORT_MOST_SIGNIFICANT_BIT ] = (UCHAR)(SECONDBYTE(Value)); \
3839 } \
3840 else { \
3841 *((PUSHORT) (Address)) = (USHORT)Value; \
3842 }
3843 #endif
3844
3845 NTSYSAPI
3846 BOOLEAN
3847 NTAPI
3848 RtlTimeFieldsToTime(
3849 IN PTIME_FIELDS TimeFields,
3850 IN PLARGE_INTEGER Time);
3851
3852 NTSYSAPI
3853 VOID
3854 NTAPI
3855 RtlTimeToTimeFields(
3856 IN PLARGE_INTEGER Time,
3857 IN PTIME_FIELDS TimeFields);
3858
3859 NTSYSAPI
3860 ULONG
3861 FASTCALL
3862 RtlUlongByteSwap(
3863 IN ULONG Source);
3864
3865 NTSYSAPI
3866 ULONGLONG
3867 FASTCALL
3868 RtlUlonglongByteSwap(
3869 IN ULONGLONG Source);
3870
3871 NTSYSAPI
3872 NTSTATUS
3873 NTAPI
3874 RtlUnicodeStringToAnsiString(
3875 IN OUT PANSI_STRING DestinationString,
3876 IN PCUNICODE_STRING SourceString,
3877 IN BOOLEAN AllocateDestinationString);
3878
3879 NTSYSAPI
3880 ULONG
3881 NTAPI
3882 RtlxUnicodeStringToAnsiSize(
3883 IN PCUNICODE_STRING UnicodeString);
3884
3885 #define RtlUnicodeStringToAnsiSize(String) ( \
3886 NLS_MB_CODE_PAGE_TAG ? \
3887 RtlxUnicodeStringToAnsiSize(String) : \
3888 ((String)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
3889 )
3890
3891 NTSYSAPI
3892 NTSTATUS
3893 NTAPI
3894 RtlUnicodeStringToInteger(
3895 IN PCUNICODE_STRING String,
3896 IN ULONG Base OPTIONAL,
3897 OUT PULONG Value);
3898
3899 NTSYSAPI
3900 WCHAR
3901 NTAPI
3902 RtlUpcaseUnicodeChar(
3903 IN WCHAR SourceCharacter);
3904
3905 NTSYSAPI
3906 USHORT
3907 FASTCALL
3908 RtlUshortByteSwap(
3909 IN USHORT Source);
3910
3911 NTSYSAPI
3912 BOOLEAN
3913 NTAPI
3914 RtlValidRelativeSecurityDescriptor(
3915 IN PSECURITY_DESCRIPTOR SecurityDescriptorInput,
3916 IN ULONG SecurityDescriptorLength,
3917 IN SECURITY_INFORMATION RequiredInformation);
3918
3919 NTSYSAPI
3920 BOOLEAN
3921 NTAPI
3922 RtlValidSecurityDescriptor(
3923 IN PSECURITY_DESCRIPTOR SecurityDescriptor);
3924
3925 NTSYSAPI
3926 NTSTATUS
3927 NTAPI
3928 RtlWriteRegistryValue(
3929 IN ULONG RelativeTo,
3930 IN PCWSTR Path,
3931 IN PCWSTR ValueName,
3932 IN ULONG ValueType,
3933 IN PVOID ValueData,
3934 IN ULONG ValueLength);
3935
3936 #endif // (NTDDI_VERSION >= NTDDI_WIN2K)
3937
3938 #if (NTDDI_VERSION >= NTDDI_WIN2KSP3)
3939 NTSYSAPI
3940 VOID
3941 FASTCALL
3942 RtlPrefetchMemoryNonTemporal(
3943 IN PVOID Source,
3944 IN SIZE_T Length);
3945 #endif
3946
3947 #if (NTDDI_VERSION >= NTDDI_WINXP)
3948 NTSYSAPI
3949 VOID
3950 NTAPI
3951 RtlClearBit(
3952 PRTL_BITMAP BitMapHeader,
3953 ULONG BitNumber);
3954
3955 NTSYSAPI
3956 WCHAR
3957 NTAPI
3958 RtlDowncaseUnicodeChar(
3959 IN WCHAR SourceCharacter);
3960
3961 NTSYSAPI
3962 VOID
3963 NTAPI