mscms: Move repetitive code to helper macros.
[wine.git] / include / ddk / wdm.h
blob49d5977ea19c43beb80bb54fa59642c494462763
1 /*
2 * Copyright 2004-2005 Ivan Leo Puoti
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef _WDMDDK_
20 #define _WDMDDK_
21 #define _NTDDK_
23 #include <ntstatus.h>
25 #ifdef _WIN64
26 #define POINTER_ALIGNMENT DECLSPEC_ALIGN(8)
27 #else
28 #define POINTER_ALIGNMENT
29 #endif
31 typedef ULONG_PTR KSPIN_LOCK, *PKSPIN_LOCK;
33 struct _KDPC;
34 struct _KAPC;
36 typedef VOID (WINAPI *PKDEFERRED_ROUTINE)(struct _KDPC *, PVOID, PVOID, PVOID);
38 typedef struct _DISPATCHER_HEADER {
39 UCHAR Type;
40 UCHAR Absolute;
41 UCHAR Size;
42 UCHAR Inserted;
43 LONG SignalState;
44 LIST_ENTRY WaitListHead;
45 } DISPATCHER_HEADER, *PDISPATCHER_HEADER;
47 typedef struct _KEVENT {
48 DISPATCHER_HEADER Header;
49 } KEVENT, *PKEVENT, *RESTRICTED_POINTER PRKEVENT;
51 typedef struct _KDPC {
52 CSHORT Type;
53 UCHAR Number;
54 UCHAR Importance;
55 LIST_ENTRY DpcListEntry;
56 PKDEFERRED_ROUTINE DeferredRoutine;
57 PVOID DeferredContext;
58 PVOID SystemArgument1;
59 PVOID SystemArgument2;
60 PULONG_PTR Lock;
61 } KDPC, *PKDPC, *RESTRICTED_POINTER PRKDPC;
63 typedef struct _KDEVICE_QUEUE_ENTRY {
64 LIST_ENTRY DeviceListEntry;
65 ULONG SortKey;
66 BOOLEAN Inserted;
67 } KDEVICE_QUEUE_ENTRY, *PKDEVICE_QUEUE_ENTRY,
68 *RESTRICTED_POINTER PRKDEVICE_QUEUE_ENTRY;
70 typedef struct _KDEVICE_QUEUE {
71 CSHORT Type;
72 CSHORT Size;
73 LIST_ENTRY DeviceListHead;
74 KSPIN_LOCK Lock;
75 BOOLEAN Busy;
76 } KDEVICE_QUEUE, *PKDEVICE_QUEUE, *RESTRICTED_POINTER PRKDEVICE_QUEUE;
78 typedef struct _IO_TIMER *PIO_TIMER;
79 typedef struct _ETHREAD *PETHREAD;
81 #define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR))
83 typedef struct _VPB {
84 CSHORT Type;
85 CSHORT Size;
86 USHORT Flags;
87 USHORT VolumeLabelLength;
88 struct _DEVICE_OBJECT *DeviceObject;
89 struct _DEVICE_OBJECT *RealDevice;
90 ULONG SerialNumber;
91 ULONG ReferenceCount;
92 WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH / sizeof(WCHAR)];
93 } VPB, *PVPB;
96 typedef struct _WAIT_CONTEXT_BLOCK {
97 KDEVICE_QUEUE_ENTRY WaitQueueEntry;
98 struct _DRIVER_CONTROL *DeviceRoutine;
99 PVOID DeviceContext;
100 ULONG NumberOfMapRegisters;
101 PVOID DeviceObject;
102 PVOID CurrentIrp;
103 PKDPC BufferChainingDpc;
104 } WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK;
106 #ifndef DEVICE_TYPE
107 #define DEVICE_TYPE ULONG
108 #endif
109 #define IRP_MJ_MAXIMUM_FUNCTION 0x1b
110 #define IRP_MJ_DEVICE_CONTROL 0x0e
112 typedef struct _DEVICE_OBJECT {
113 CSHORT Type;
114 USHORT Size;
115 LONG ReferenceCount;
116 struct _DRIVER_OBJECT *DriverObject;
117 struct _DEVICE_OBJECT *NextDevice;
118 struct _DEVICE_OBJECT *AttachedDevice;
119 struct _IRP *CurrentIrp;
120 PIO_TIMER Timer;
121 ULONG Flags;
122 ULONG Characteristics;
123 PVPB Vpb;
124 PVOID DeviceExtension;
125 DEVICE_TYPE DeviceType;
126 CCHAR StackSize;
127 union {
128 LIST_ENTRY ListEntry;
129 WAIT_CONTEXT_BLOCK Wcb;
130 } Queue;
131 ULONG AlignmentRequirement;
132 KDEVICE_QUEUE DeviceQueue;
133 KDPC Dpc;
134 ULONG ActiveThreadCount;
135 PSECURITY_DESCRIPTOR SecurityDescriptor;
136 KEVENT DeviceLock;
137 USHORT SectorSize;
138 USHORT Spare1;
139 struct _DEVOBJ_EXTENSION *DeviceObjectExtension;
140 PVOID Reserved;
141 } DEVICE_OBJECT;
142 typedef struct _DEVICE_OBJECT *PDEVICE_OBJECT;
144 typedef struct _DRIVER_EXTENSION {
145 struct _DRIVER_OBJECT *DriverObject;
146 PVOID AddDevice;
147 ULONG Count;
148 UNICODE_STRING ServiceKeyName;
149 } DRIVER_EXTENSION, *PDRIVER_EXTENSION;
151 typedef struct _DRIVER_OBJECT {
152 CSHORT Type;
153 CSHORT Size;
154 PDEVICE_OBJECT DeviceObject;
155 ULONG Flags;
156 PVOID DriverStart;
157 ULONG DriverSize;
158 PVOID DriverSection;
159 PDRIVER_EXTENSION DriverExtension;
160 UNICODE_STRING DriverName;
161 PUNICODE_STRING HardwareDatabase;
162 PVOID FastIoDispatch;
163 PVOID DriverInit;
164 PVOID DriverStartIo;
165 PVOID DriverUnload;
166 PVOID MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
167 } DRIVER_OBJECT;
168 typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT;
170 /* Irp definitions */
171 typedef UCHAR KIRQL, *PKIRQL;
172 typedef CCHAR KPROCESSOR_MODE;
174 typedef VOID (WINAPI *PDRIVER_CANCEL)(
175 IN struct _DEVICE_OBJECT *DeviceObject,
176 IN struct _IRP *Irp);
178 typedef VOID (WINAPI *PKNORMAL_ROUTINE)(
179 IN PVOID NormalContext,
180 IN PVOID SystemArgument1,
181 IN PVOID SystemArgument2);
183 typedef VOID (WINAPI *PKKERNEL_ROUTINE)(
184 IN struct _KAPC *Apc,
185 IN OUT PKNORMAL_ROUTINE *NormalRoutine,
186 IN OUT PVOID *NormalContext,
187 IN OUT PVOID *SystemArgument1,
188 IN OUT PVOID *SystemArgument2);
190 typedef VOID (WINAPI *PKRUNDOWN_ROUTINE)(
191 IN struct _KAPC *Apc);
193 typedef struct _KAPC {
194 CSHORT Type;
195 CSHORT Size;
196 ULONG Spare0;
197 struct _KTHREAD *Thread;
198 LIST_ENTRY ApcListEntry;
199 PKKERNEL_ROUTINE KernelRoutine;
200 PKRUNDOWN_ROUTINE RundownRoutine;
201 PKNORMAL_ROUTINE NormalRoutine;
202 PVOID NormalContext;
203 PVOID SystemArgument1;
204 PVOID SystemArgument2;
205 CCHAR ApcStateIndex;
206 KPROCESSOR_MODE ApcMode;
207 BOOLEAN Inserted;
208 } KAPC, *PKAPC, *RESTRICTED_POINTER PRKAPC;
210 #include <pshpack1.h>
211 typedef struct _IRP {
212 CSHORT Type;
213 USHORT Size;
214 struct _MDL *MdlAddress;
215 ULONG Flags;
216 union {
217 struct _IRP *MasterIrp;
218 LONG IrpCount;
219 PVOID SystemBuffer;
220 } AssociatedIrp;
221 LIST_ENTRY ThreadListEntry;
222 IO_STATUS_BLOCK IoStatus;
223 KPROCESSOR_MODE RequestorMode;
224 BOOLEAN PendingReturned;
225 CHAR StackCount;
226 CHAR CurrentLocation;
227 BOOLEAN Cancel;
228 KIRQL CancelIrql;
229 CCHAR ApcEnvironment;
230 UCHAR AllocationFlags;
231 PIO_STATUS_BLOCK UserIosb;
232 PKEVENT UserEvent;
233 union {
234 struct {
235 PIO_APC_ROUTINE UserApcRoutine;
236 PVOID UserApcContext;
237 } AsynchronousParameters;
238 LARGE_INTEGER AllocationSize;
239 } Overlay;
240 PDRIVER_CANCEL CancelRoutine;
241 PVOID UserBuffer;
242 union {
243 struct {
244 union {
245 KDEVICE_QUEUE_ENTRY DeviceQueueEntry;
246 struct {
247 PVOID DriverContext[4];
248 } DUMMYSTRUCTNAME;
249 } DUMMYUNIONNAME;
250 PETHREAD Thread;
251 PCHAR AuxiliaryBuffer;
252 struct {
253 LIST_ENTRY ListEntry;
254 union {
255 struct _IO_STACK_LOCATION *CurrentStackLocation;
256 ULONG PacketType;
257 } DUMMYUNIONNAME;
258 } DUMMYSTRUCTNAME;
259 struct _FILE_OBJECT *OriginalFileObject;
260 } Overlay;
261 KAPC Apc;
262 PVOID CompletionKey;
263 } Tail;
264 } IRP;
265 typedef struct _IRP *PIRP;
266 #include <poppack.h>
268 /* MDL definitions */
270 typedef VOID (WINAPI *PINTERFACE_REFERENCE)(
271 PVOID Context);
273 typedef VOID (WINAPI *PINTERFACE_DEREFERENCE)(
274 PVOID Context);
276 typedef struct _INTERFACE {
277 USHORT Size;
278 USHORT Version;
279 PVOID Context;
280 PINTERFACE_REFERENCE InterfaceReference;
281 PINTERFACE_DEREFERENCE InterfaceDereference;
282 } INTERFACE, *PINTERFACE;
284 typedef struct _SECTION_OBJECT_POINTERS {
285 PVOID DataSectionObject;
286 PVOID SharedCacheMap;
287 PVOID ImageSectionObject;
288 } SECTION_OBJECT_POINTERS, *PSECTION_OBJECT_POINTERS;
290 typedef struct _IO_COMPLETION_CONTEXT {
291 PVOID Port;
292 PVOID Key;
293 } IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT;
295 typedef enum _DEVICE_RELATION_TYPE {
296 BusRelations,
297 EjectionRelations,
298 PowerRelations,
299 RemovalRelations,
300 TargetDeviceRelation,
301 SingleBusRelations
302 } DEVICE_RELATION_TYPE, *PDEVICE_RELATION_TYPE;
304 typedef struct _FILE_OBJECT {
305 CSHORT Type;
306 CSHORT Size;
307 PDEVICE_OBJECT DeviceObject;
308 PVPB Vpb;
309 PVOID FsContext;
310 PVOID FsContext2;
311 PSECTION_OBJECT_POINTERS SectionObjectPointer;
312 PVOID PrivateCacheMap;
313 NTSTATUS FinalStatus;
314 struct _FILE_OBJECT *RelatedFileObject;
315 BOOLEAN LockOperation;
316 BOOLEAN DeletePending;
317 BOOLEAN ReadAccess;
318 BOOLEAN WriteAccess;
319 BOOLEAN DeleteAccess;
320 BOOLEAN SharedRead;
321 BOOLEAN SharedWrite;
322 BOOLEAN SharedDelete;
323 ULONG Flags;
324 UNICODE_STRING FileName;
325 LARGE_INTEGER CurrentByteOffset;
326 ULONG Waiters;
327 ULONG Busy;
328 PVOID LastLock;
329 KEVENT Lock;
330 KEVENT Event;
331 PIO_COMPLETION_CONTEXT CompletionContext;
332 } FILE_OBJECT;
333 typedef struct _FILE_OBJECT *PFILE_OBJECT;
335 #define INITIAL_PRIVILEGE_COUNT 3
337 typedef struct _INITIAL_PRIVILEGE_SET {
338 ULONG PrivilegeCount;
339 ULONG Control;
340 LUID_AND_ATTRIBUTES Privilege[INITIAL_PRIVILEGE_COUNT];
341 } INITIAL_PRIVILEGE_SET, * PINITIAL_PRIVILEGE_SET;
343 typedef struct _SECURITY_SUBJECT_CONTEXT {
344 PACCESS_TOKEN ClientToken;
345 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
346 PACCESS_TOKEN PrimaryToken;
347 PVOID ProcessAuditId;
348 } SECURITY_SUBJECT_CONTEXT, *PSECURITY_SUBJECT_CONTEXT;
350 typedef struct _ACCESS_STATE {
351 LUID OperationID;
352 BOOLEAN SecurityEvaluated;
353 BOOLEAN GenerateAudit;
354 BOOLEAN GenerateOnClose;
355 BOOLEAN PrivilegesAllocated;
356 ULONG Flags;
357 ACCESS_MASK RemainingDesiredAccess;
358 ACCESS_MASK PreviouslyGrantedAccess;
359 ACCESS_MASK OriginalDesiredAccess;
360 SECURITY_SUBJECT_CONTEXT SubjectSecurityContext;
361 PSECURITY_DESCRIPTOR SecurityDescriptor;
362 PVOID AuxData;
363 union {
364 INITIAL_PRIVILEGE_SET InitialPrivilegeSet;
365 PRIVILEGE_SET PrivilegeSet;
366 } Privileges;
368 BOOLEAN AuditPrivileges;
369 UNICODE_STRING ObjectName;
370 UNICODE_STRING ObjectTypeName;
371 } ACCESS_STATE, *PACCESS_STATE;
373 typedef struct _IO_SECURITY_CONTEXT {
374 PSECURITY_QUALITY_OF_SERVICE SecurityQos;
375 PACCESS_STATE AccessState;
376 ACCESS_MASK DesiredAccess;
377 ULONG FullCreateOptions;
378 } IO_SECURITY_CONTEXT, *PIO_SECURITY_CONTEXT;
380 typedef struct _DEVICE_CAPABILITIES {
381 USHORT Size;
382 USHORT Version;
383 ULONG DeviceD1 : 1;
384 ULONG DeviceD2 : 1;
385 ULONG LockSupported : 1;
386 ULONG EjectSupported : 1;
387 ULONG Removable : 1;
388 ULONG DockDevice : 1;
389 ULONG UniqueID : 1;
390 ULONG SilentInstall : 1;
391 ULONG RawDeviceOK : 1;
392 ULONG SurpriseRemovalOK : 1;
393 ULONG WakeFromD0 : 1;
394 ULONG WakeFromD1 : 1;
395 ULONG WakeFromD2 : 1;
396 ULONG WakeFromD3 : 1;
397 ULONG HardwareDisabled : 1;
398 ULONG NonDynamic : 1;
399 ULONG WarmEjectSupported : 1;
400 ULONG NoDisplayInUI : 1;
401 ULONG Reserved : 14;
402 ULONG Address;
403 ULONG UINumber;
404 DEVICE_POWER_STATE DeviceState[PowerSystemMaximum];
405 SYSTEM_POWER_STATE SystemWake;
406 DEVICE_POWER_STATE DeviceWake;
407 ULONG D1Latency;
408 ULONG D2Latency;
409 ULONG D3Latency;
410 } DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;
412 typedef enum _INTERFACE_TYPE {
413 InterfaceTypeUndefined = -1,
414 Internal,
415 Isa,
416 Eisa,
417 MicroChannel,
418 TurboChannel,
419 PCIBus,
420 VMEBus,
421 NuBus,
422 PCMCIABus,
423 CBus,
424 MPIBus,
425 MPSABus,
426 ProcessorInternal,
427 InternalPowerBus,
428 PNPISABus,
429 PNPBus,
430 MaximumInterfaceType
431 } INTERFACE_TYPE, *PINTERFACE_TYPE;
433 typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
435 #define IO_RESOURCE_PREFERRED 0x01
436 #define IO_RESOURCE_DEFAULT 0x02
437 #define IO_RESOURCE_ALTERNATIVE 0x08
439 typedef struct _IO_RESOURCE_DESCRIPTOR {
440 UCHAR Option;
441 UCHAR Type;
442 UCHAR ShareDisposition;
443 UCHAR Spare1;
444 USHORT Flags;
445 USHORT Spare2;
446 union {
447 struct {
448 ULONG Length;
449 ULONG Alignment;
450 PHYSICAL_ADDRESS MinimumAddress;
451 PHYSICAL_ADDRESS MaximumAddress;
452 } Port;
453 struct {
454 ULONG Length;
455 ULONG Alignment;
456 PHYSICAL_ADDRESS MinimumAddress;
457 PHYSICAL_ADDRESS MaximumAddress;
458 } Memory;
459 struct {
460 ULONG MinimumVector;
461 ULONG MaximumVector;
462 } Interrupt;
463 struct {
464 ULONG MinimumChannel;
465 ULONG MaximumChannel;
466 } Dma;
467 struct {
468 ULONG Length;
469 ULONG Alignment;
470 PHYSICAL_ADDRESS MinimumAddress;
471 PHYSICAL_ADDRESS MaximumAddress;
472 } Generic;
473 struct {
474 ULONG Data[3];
475 } DevicePrivate;
476 struct {
477 ULONG Length;
478 ULONG MinBusNumber;
479 ULONG MaxBusNumber;
480 ULONG Reserved;
481 } BusNumber;
482 struct {
483 ULONG Priority;
484 ULONG Reserved1;
485 ULONG Reserved2;
486 } ConfigData;
487 } u;
488 } IO_RESOURCE_DESCRIPTOR, *PIO_RESOURCE_DESCRIPTOR;
490 typedef struct _IO_RESOURCE_LIST {
491 USHORT Version;
492 USHORT Revision;
493 ULONG Count;
494 IO_RESOURCE_DESCRIPTOR Descriptors[1];
495 } IO_RESOURCE_LIST, *PIO_RESOURCE_LIST;
497 typedef struct _IO_RESOURCE_REQUIREMENTS_LIST {
498 ULONG ListSize;
499 INTERFACE_TYPE InterfaceType;
500 ULONG BusNumber;
501 ULONG SlotNumber;
502 ULONG Reserved[3];
503 ULONG AlternativeLists;
504 IO_RESOURCE_LIST List[1];
505 } IO_RESOURCE_REQUIREMENTS_LIST, *PIO_RESOURCE_REQUIREMENTS_LIST;
507 typedef enum _BUS_QUERY_ID_TYPE {
508 BusQueryDeviceID,
509 BusQueryHardwareIDs,
510 BusQueryCompatibleIDs,
511 BusQueryInstanceID,
512 BusQueryDeviceSerialNumber
513 } BUS_QUERY_ID_TYPE, *PBUS_QUERY_ID_TYPE;
515 typedef enum _DEVICE_TEXT_TYPE {
516 DeviceTextDescription,
517 DeviceTextLocationInformation
518 } DEVICE_TEXT_TYPE, *PDEVICE_TEXT_TYPE;
520 typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE {
521 DeviceUsageTypeUndefined,
522 DeviceUsageTypePaging,
523 DeviceUsageTypeHibernation,
524 DeviceUsageTypeDumpFile
525 } DEVICE_USAGE_NOTIFICATION_TYPE;
527 typedef struct _POWER_SEQUENCE {
528 ULONG SequenceD1;
529 ULONG SequenceD2;
530 ULONG SequenceD3;
531 } POWER_SEQUENCE, *PPOWER_SEQUENCE;
533 typedef enum _POWER_STATE_TYPE {
534 SystemPowerState,
535 DevicePowerState
536 } POWER_STATE_TYPE, *PPOWER_STATE_TYPE;
538 typedef union _POWER_STATE {
539 SYSTEM_POWER_STATE SystemState;
540 DEVICE_POWER_STATE DeviceState;
541 } POWER_STATE, *PPOWER_STATE;
543 typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR {
544 UCHAR Type;
545 UCHAR ShareDisposition;
546 USHORT Flags;
547 union {
548 struct {
549 PHYSICAL_ADDRESS Start;
550 ULONG Length;
551 } Generic;
552 struct {
553 PHYSICAL_ADDRESS Start;
554 ULONG Length;
555 } Port;
556 struct {
557 ULONG Level;
558 ULONG Vector;
559 ULONG Affinity;
560 } Interrupt;
561 struct {
562 PHYSICAL_ADDRESS Start;
563 ULONG Length;
564 } Memory;
565 struct {
566 ULONG Channel;
567 ULONG Port;
568 ULONG Reserved1;
569 } Dma;
570 struct {
571 ULONG Data[3];
572 } DevicePrivate;
573 struct {
574 ULONG Start;
575 ULONG Length;
576 ULONG Reserved;
577 } BusNumber;
578 struct {
579 ULONG DataSize;
580 ULONG Reserved1;
581 ULONG Reserved2;
582 } DeviceSpecificData;
583 } u;
584 } CM_PARTIAL_RESOURCE_DESCRIPTOR, *PCM_PARTIAL_RESOURCE_DESCRIPTOR;
586 typedef struct _CM_PARTIAL_RESOURCE_LIST {
587 USHORT Version;
588 USHORT Revision;
589 ULONG Count;
590 CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1];
591 } CM_PARTIAL_RESOURCE_LIST, *PCM_PARTIAL_RESOURCE_LIST;
593 typedef struct _CM_FULL_RESOURCE_DESCRIPTOR {
594 INTERFACE_TYPE InterfaceType;
595 ULONG BusNumber;
596 CM_PARTIAL_RESOURCE_LIST PartialResourceList;
597 } CM_FULL_RESOURCE_DESCRIPTOR, *PCM_FULL_RESOURCE_DESCRIPTOR;
599 typedef struct _CM_RESOURCE_LIST {
600 ULONG Count;
601 CM_FULL_RESOURCE_DESCRIPTOR List[1];
602 } CM_RESOURCE_LIST, *PCM_RESOURCE_LIST;
604 typedef NTSTATUS (WINAPI *PIO_COMPLETION_ROUTINE)(
605 IN struct _DEVICE_OBJECT *DeviceObject,
606 IN struct _IRP *Irp,
607 IN PVOID Context);
609 #include <pshpack1.h>
610 typedef struct _IO_STACK_LOCATION {
611 UCHAR MajorFunction;
612 UCHAR MinorFunction;
613 UCHAR Flags;
614 UCHAR Control;
615 union {
616 struct {
617 PIO_SECURITY_CONTEXT SecurityContext;
618 ULONG Options;
619 USHORT POINTER_ALIGNMENT FileAttributes;
620 USHORT ShareAccess;
621 ULONG POINTER_ALIGNMENT EaLength;
622 } Create;
623 struct {
624 ULONG Length;
625 ULONG POINTER_ALIGNMENT Key;
626 LARGE_INTEGER ByteOffset;
627 } Read;
628 struct {
629 ULONG Length;
630 ULONG POINTER_ALIGNMENT Key;
631 LARGE_INTEGER ByteOffset;
632 } Write;
633 struct {
634 ULONG Length;
635 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass;
636 } QueryFile;
637 struct {
638 ULONG Length;
639 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass;
640 PFILE_OBJECT FileObject;
641 union {
642 struct {
643 BOOLEAN ReplaceIfExists;
644 BOOLEAN AdvanceOnly;
645 } DUMMYSTRUCTNAME;
646 ULONG ClusterCount;
647 HANDLE DeleteHandle;
648 } DUMMYUNIONNAME;
649 } SetFile;
650 struct {
651 ULONG Length;
652 FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass;
653 } QueryVolume;
654 struct {
655 ULONG OutputBufferLength;
656 ULONG POINTER_ALIGNMENT InputBufferLength;
657 ULONG POINTER_ALIGNMENT IoControlCode;
658 PVOID Type3InputBuffer;
659 } DeviceIoControl;
660 struct {
661 SECURITY_INFORMATION SecurityInformation;
662 ULONG POINTER_ALIGNMENT Length;
663 } QuerySecurity;
664 struct {
665 SECURITY_INFORMATION SecurityInformation;
666 PSECURITY_DESCRIPTOR SecurityDescriptor;
667 } SetSecurity;
668 struct {
669 PVPB Vpb;
670 PDEVICE_OBJECT DeviceObject;
671 } MountVolume;
672 struct {
673 PVPB Vpb;
674 PDEVICE_OBJECT DeviceObject;
675 } VerifyVolume;
676 struct {
677 struct _SCSI_REQUEST_BLOCK *Srb;
678 } Scsi;
679 struct {
680 DEVICE_RELATION_TYPE Type;
681 } QueryDeviceRelations;
682 struct {
683 CONST GUID *InterfaceType;
684 USHORT Size;
685 USHORT Version;
686 PINTERFACE Interface;
687 PVOID InterfaceSpecificData;
688 } QueryInterface;
689 struct {
690 PDEVICE_CAPABILITIES Capabilities;
691 } DeviceCapabilities;
692 struct {
693 PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList;
694 } FilterResourceRequirements;
695 struct {
696 ULONG WhichSpace;
697 PVOID Buffer;
698 ULONG Offset;
699 ULONG POINTER_ALIGNMENT Length;
700 } ReadWriteConfig;
701 struct {
702 BOOLEAN Lock;
703 } SetLock;
704 struct {
705 BUS_QUERY_ID_TYPE IdType;
706 } QueryId;
707 struct {
708 DEVICE_TEXT_TYPE DeviceTextType;
709 LCID POINTER_ALIGNMENT LocaleId;
710 } QueryDeviceText;
711 struct {
712 BOOLEAN InPath;
713 BOOLEAN Reserved[3];
714 DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT Type;
715 } UsageNotification;
716 struct {
717 SYSTEM_POWER_STATE PowerState;
718 } WaitWake;
719 struct {
720 PPOWER_SEQUENCE PowerSequence;
721 } PowerSequence;
722 struct {
723 ULONG SystemContext;
724 POWER_STATE_TYPE POINTER_ALIGNMENT Type;
725 POWER_STATE POINTER_ALIGNMENT State;
726 POWER_ACTION POINTER_ALIGNMENT ShutdownType;
727 } Power;
728 struct {
729 PCM_RESOURCE_LIST AllocatedResources;
730 PCM_RESOURCE_LIST AllocatedResourcesTranslated;
731 } StartDevice;
732 struct {
733 ULONG_PTR ProviderId;
734 PVOID DataPath;
735 ULONG BufferSize;
736 PVOID Buffer;
737 } WMI;
738 struct {
739 PVOID Argument1;
740 PVOID Argument2;
741 PVOID Argument3;
742 PVOID Argument4;
743 } Others;
744 } Parameters;
745 PDEVICE_OBJECT DeviceObject;
746 PFILE_OBJECT FileObject;
747 PIO_COMPLETION_ROUTINE CompletionRoutine;
748 PVOID Context;
749 } IO_STACK_LOCATION, *PIO_STACK_LOCATION;
750 #include <poppack.h>
752 typedef struct _MDL {
753 struct _MDL *Next;
754 CSHORT Size;
755 CSHORT MdlFlags;
756 struct _EPROCESS *Process;
757 PVOID MappedSystemVa;
758 PVOID StartVa;
759 ULONG ByteCount;
760 ULONG ByteOffset;
761 } MDL, *PMDL;
763 typedef NTSTATUS (WINAPI *PDRIVER_DISPATCH)(
764 IN struct _DEVICE_OBJECT *DeviceObject,
765 IN struct _IRP *Irp);
767 typedef struct _KSYSTEM_TIME {
768 ULONG LowPart;
769 LONG High1Time;
770 LONG High2Time;
771 } KSYSTEM_TIME, *PKSYSTEM_TIME;
773 typedef enum _NT_PRODUCT_TYPE {
774 NtProductWinNt = 1,
775 NtProductLanManNt,
776 NtProductServer
777 } NT_PRODUCT_TYPE, *PNT_PRODUCT_TYPE;
779 #define PROCESSOR_FEATURE_MAX 64
781 typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE
783 StandardDesign,
784 NEC98x86,
785 EndAlternatives
786 } ALTERNATIVE_ARCHITECTURE_TYPE;
788 typedef struct _KUSER_SHARED_DATA {
789 ULONG TickCountLowDeprecated;
790 ULONG TickCountMultiplier;
791 volatile KSYSTEM_TIME InterruptTime;
792 volatile KSYSTEM_TIME SystemTime;
793 volatile KSYSTEM_TIME TimeZoneBias;
794 USHORT ImageNumberLow;
795 USHORT ImageNumberHigh;
796 WCHAR NtSystemRoot[260];
797 ULONG MaxStckTraceDepth;
798 ULONG CryptoExponent;
799 ULONG TimeZoneId;
800 ULONG LargePageMinimum;
801 ULONG Reserverd2[7];
802 NT_PRODUCT_TYPE NtProductType;
803 BOOLEAN ProductTypeIsValid;
804 ULONG MajorNtVersion;
805 ULONG MinorNtVersion;
806 BOOLEAN ProcessorFeatures[PROCESSOR_FEATURE_MAX];
807 ULONG Reserved1;
808 ULONG Reserved3;
809 volatile ULONG TimeSlip;
810 ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture;
811 LARGE_INTEGER SystemExpirationDate;
812 ULONG SuiteMask;
813 BOOLEAN KdDebuggerEnabled;
814 volatile ULONG ActiveConsoleId;
815 volatile ULONG DismountCount;
816 ULONG ComPlusPackage;
817 ULONG LastSystemRITEventTickCount;
818 ULONG NumberOfPhysicalPages;
819 BOOLEAN SafeBootMode;
820 ULONG TraceLogging;
821 ULONGLONG Fill0;
822 ULONGLONG SystemCall[4];
823 union {
824 volatile KSYSTEM_TIME TickCount;
825 volatile ULONG64 TickCountQuad;
827 } KSHARED_USER_DATA, *PKSHARED_USER_DATA;
829 #define IoGetCurrentIrpStackLocation(_Irp) ((_Irp)->Tail.Overlay.CurrentStackLocation)
831 #define KernelMode 0
832 #define UserMode 1
834 /* directory object access rights */
835 #define DIRECTORY_QUERY 0x0001
836 #define DIRECTORY_TRAVERSE 0x0002
837 #define DIRECTORY_CREATE_OBJECT 0x0004
838 #define DIRECTORY_CREATE_SUBDIRECTORY 0x0008
839 #define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0xF)
841 /* symbolic link access rights */
842 #define SYMBOLIC_LINK_QUERY 0x0001
843 #define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
845 #endif