[XDK]
[reactos.git] / include / ddk / ntddk.h
1 /*
2 * ntddk.h
3 *
4 * Windows NT Device Driver Kit
5 *
6 * This file is part of the ReactOS DDK package.
7 *
8 * Contributors:
9 * Amine Khaldi
10 * Timo Kreuzer (timo.kreuzer@reactos.org)
11 *
12 * THIS SOFTWARE IS NOT COPYRIGHTED
13 *
14 * This source code is offered for use in the public domain. You may
15 * use, modify or distribute it freely.
16 *
17 * This code is distributed in the hope that it will be useful but
18 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
19 * DISCLAIMED. This includes but is not limited to warranties of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 *
22 */
23
24 #pragma once
25
26 #define _NTDDK_
27
28 #if !defined(_NTHAL_) && !defined(_NTIFS_)
29 #define _NTDDK_INCLUDED_
30 #define _DDK_DRIVER_
31 #endif
32
33 /* Dependencies */
34
35 #define NT_INCLUDED
36 #define _CTYPE_DISABLE_MACROS
37
38 #include <wdm.h>
39 #include <excpt.h>
40 #include <ntdef.h>
41 #include <ntstatus.h>
42 #include <mce.h>
43
44 /* FIXME
45 #include <bugcodes.h>
46 #include <ntiologc.h>
47 */
48
49 #include <stdarg.h> // FIXME
50 #include <basetyps.h> // FIXME
51
52
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56
57 /* GUID and UUID */
58 #ifndef _NTLSA_IFS_
59 #ifndef _NTLSA_AUDIT_
60 #define _NTLSA_AUDIT_
61
62 #ifndef GUID_DEFINED
63 #include <guiddef.h>
64 #endif
65
66 #endif /* _NTLSA_AUDIT_ */
67 #endif /* _NTLSA_IFS_ */
68
69 typedef GUID UUID;
70
71 struct _LOADER_PARAMETER_BLOCK;
72 struct _CREATE_DISK;
73 struct _DRIVE_LAYOUT_INFORMATION_EX;
74 struct _SET_PARTITION_INFORMATION_EX;
75
76 typedef struct _BUS_HANDLER *PBUS_HANDLER;
77 typedef struct _DEVICE_HANDLER_OBJECT *PDEVICE_HANDLER_OBJECT;
78 #if defined(_NTHAL_INCLUDED_)
79 typedef struct _KAFFINITY_EX *PKAFFINITY_EX;
80 #endif
81 typedef struct _PEB *PPEB;
82
83 #ifndef _NTIMAGE_
84
85 typedef struct _IMAGE_NT_HEADERS *PIMAGE_NT_HEADERS32;
86 typedef struct _IMAGE_NT_HEADERS64 *PIMAGE_NT_HEADERS64;
87
88 #ifdef _WIN64
89 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS;
90 #else
91 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS;
92 #endif
93
94 #endif /* _NTIMAGE_ */
95
96 /******************************************************************************
97 * Executive Types *
98 ******************************************************************************/
99
100 typedef struct _ZONE_SEGMENT_HEADER {
101 SINGLE_LIST_ENTRY SegmentList;
102 PVOID Reserved;
103 } ZONE_SEGMENT_HEADER, *PZONE_SEGMENT_HEADER;
104
105 typedef struct _ZONE_HEADER {
106 SINGLE_LIST_ENTRY FreeList;
107 SINGLE_LIST_ENTRY SegmentList;
108 ULONG BlockSize;
109 ULONG TotalSegmentSize;
110 } ZONE_HEADER, *PZONE_HEADER;
111
112 #define PROTECTED_POOL 0x80000000
113
114
115 /******************************************************************************
116 * I/O Manager Types *
117 ******************************************************************************/
118
119 /* DEVICE_OBJECT.Flags */
120 #define DO_DEVICE_HAS_NAME 0x00000040
121 #define DO_SYSTEM_BOOT_PARTITION 0x00000100
122 #define DO_LONG_TERM_REQUESTS 0x00000200
123 #define DO_NEVER_LAST_DEVICE 0x00000400
124 #define DO_LOW_PRIORITY_FILESYSTEM 0x00010000
125 #define DO_SUPPORTS_TRANSACTIONS 0x00040000
126 #define DO_FORCE_NEITHER_IO 0x00080000
127 #define DO_VOLUME_DEVICE_OBJECT 0x00100000
128 #define DO_SYSTEM_SYSTEM_PARTITION 0x00200000
129 #define DO_SYSTEM_CRITICAL_PARTITION 0x00400000
130 #define DO_DISALLOW_EXECUTE 0x00800000
131
132 #ifndef _ARC_DDK_
133 #define _ARC_DDK_
134 typedef enum _CONFIGURATION_TYPE {
135 ArcSystem,
136 CentralProcessor,
137 FloatingPointProcessor,
138 PrimaryIcache,
139 PrimaryDcache,
140 SecondaryIcache,
141 SecondaryDcache,
142 SecondaryCache,
143 EisaAdapter,
144 TcAdapter,
145 ScsiAdapter,
146 DtiAdapter,
147 MultiFunctionAdapter,
148 DiskController,
149 TapeController,
150 CdromController,
151 WormController,
152 SerialController,
153 NetworkController,
154 DisplayController,
155 ParallelController,
156 PointerController,
157 KeyboardController,
158 AudioController,
159 OtherController,
160 DiskPeripheral,
161 FloppyDiskPeripheral,
162 TapePeripheral,
163 ModemPeripheral,
164 MonitorPeripheral,
165 PrinterPeripheral,
166 PointerPeripheral,
167 KeyboardPeripheral,
168 TerminalPeripheral,
169 OtherPeripheral,
170 LinePeripheral,
171 NetworkPeripheral,
172 SystemMemory,
173 DockingInformation,
174 RealModeIrqRoutingTable,
175 RealModePCIEnumeration,
176 MaximumType
177 } CONFIGURATION_TYPE, *PCONFIGURATION_TYPE;
178 #endif /* !_ARC_DDK_ */
179
180 /*
181 ** IRP function codes
182 */
183
184 #define IRP_MN_QUERY_DIRECTORY 0x01
185 #define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02
186
187 #define IRP_MN_USER_FS_REQUEST 0x00
188 #define IRP_MN_MOUNT_VOLUME 0x01
189 #define IRP_MN_VERIFY_VOLUME 0x02
190 #define IRP_MN_LOAD_FILE_SYSTEM 0x03
191 #define IRP_MN_TRACK_LINK 0x04
192 #define IRP_MN_KERNEL_CALL 0x04
193
194 #define IRP_MN_LOCK 0x01
195 #define IRP_MN_UNLOCK_SINGLE 0x02
196 #define IRP_MN_UNLOCK_ALL 0x03
197 #define IRP_MN_UNLOCK_ALL_BY_KEY 0x04
198
199 #define IRP_MN_FLUSH_AND_PURGE 0x01
200
201 #define IRP_MN_NORMAL 0x00
202 #define IRP_MN_DPC 0x01
203 #define IRP_MN_MDL 0x02
204 #define IRP_MN_COMPLETE 0x04
205 #define IRP_MN_COMPRESSED 0x08
206
207 #define IRP_MN_MDL_DPC (IRP_MN_MDL | IRP_MN_DPC)
208 #define IRP_MN_COMPLETE_MDL (IRP_MN_COMPLETE | IRP_MN_MDL)
209 #define IRP_MN_COMPLETE_MDL_DPC (IRP_MN_COMPLETE_MDL | IRP_MN_DPC)
210
211 #define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18
212
213 #define IO_CHECK_CREATE_PARAMETERS 0x0200
214 #define IO_ATTACH_DEVICE 0x0400
215 #define IO_IGNORE_SHARE_ACCESS_CHECK 0x0800
216
217 typedef
218 NTSTATUS
219 (NTAPI *PIO_QUERY_DEVICE_ROUTINE)(
220 IN PVOID Context,
221 IN PUNICODE_STRING PathName,
222 IN INTERFACE_TYPE BusType,
223 IN ULONG BusNumber,
224 IN PKEY_VALUE_FULL_INFORMATION *BusInformation,
225 IN CONFIGURATION_TYPE ControllerType,
226 IN ULONG ControllerNumber,
227 IN PKEY_VALUE_FULL_INFORMATION *ControllerInformation,
228 IN CONFIGURATION_TYPE PeripheralType,
229 IN ULONG PeripheralNumber,
230 IN PKEY_VALUE_FULL_INFORMATION *PeripheralInformation);
231
232 typedef enum _IO_QUERY_DEVICE_DATA_FORMAT {
233 IoQueryDeviceIdentifier = 0,
234 IoQueryDeviceConfigurationData,
235 IoQueryDeviceComponentInformation,
236 IoQueryDeviceMaxData
237 } IO_QUERY_DEVICE_DATA_FORMAT, *PIO_QUERY_DEVICE_DATA_FORMAT;
238
239 typedef VOID
240 (NTAPI *PDRIVER_REINITIALIZE)(
241 IN struct _DRIVER_OBJECT *DriverObject,
242 IN PVOID Context OPTIONAL,
243 IN ULONG Count);
244
245 typedef struct _CONTROLLER_OBJECT {
246 CSHORT Type;
247 CSHORT Size;
248 PVOID ControllerExtension;
249 KDEVICE_QUEUE DeviceWaitQueue;
250 ULONG Spare1;
251 LARGE_INTEGER Spare2;
252 } CONTROLLER_OBJECT, *PCONTROLLER_OBJECT;
253
254 #define DRVO_REINIT_REGISTERED 0x00000008
255 #define DRVO_INITIALIZED 0x00000010
256 #define DRVO_BOOTREINIT_REGISTERED 0x00000020
257 #define DRVO_LEGACY_RESOURCES 0x00000040
258
259 typedef struct _CONFIGURATION_INFORMATION {
260 ULONG DiskCount;
261 ULONG FloppyCount;
262 ULONG CdRomCount;
263 ULONG TapeCount;
264 ULONG ScsiPortCount;
265 ULONG SerialCount;
266 ULONG ParallelCount;
267 BOOLEAN AtDiskPrimaryAddressClaimed;
268 BOOLEAN AtDiskSecondaryAddressClaimed;
269 ULONG Version;
270 ULONG MediumChangerCount;
271 } CONFIGURATION_INFORMATION, *PCONFIGURATION_INFORMATION;
272
273 typedef struct _DISK_SIGNATURE {
274 ULONG PartitionStyle;
275 _ANONYMOUS_UNION union {
276 struct {
277 ULONG Signature;
278 ULONG CheckSum;
279 } Mbr;
280 struct {
281 GUID DiskId;
282 } Gpt;
283 } DUMMYUNIONNAME;
284 } DISK_SIGNATURE, *PDISK_SIGNATURE;
285
286 typedef struct _TXN_PARAMETER_BLOCK {
287 USHORT Length;
288 USHORT TxFsContext;
289 PVOID TransactionObject;
290 } TXN_PARAMETER_BLOCK, *PTXN_PARAMETER_BLOCK;
291
292 #define TXF_MINIVERSION_DEFAULT_VIEW (0xFFFE)
293
294 typedef struct _IO_DRIVER_CREATE_CONTEXT {
295 CSHORT Size;
296 struct _ECP_LIST *ExtraCreateParameter;
297 PVOID DeviceObjectHint;
298 PTXN_PARAMETER_BLOCK TxnParameters;
299 } IO_DRIVER_CREATE_CONTEXT, *PIO_DRIVER_CREATE_CONTEXT;
300
301 typedef struct _AGP_TARGET_BUS_INTERFACE_STANDARD {
302 USHORT Size;
303 USHORT Version;
304 PVOID Context;
305 PINTERFACE_REFERENCE InterfaceReference;
306 PINTERFACE_DEREFERENCE InterfaceDereference;
307 PGET_SET_DEVICE_DATA SetBusData;
308 PGET_SET_DEVICE_DATA GetBusData;
309 UCHAR CapabilityID;
310 } AGP_TARGET_BUS_INTERFACE_STANDARD, *PAGP_TARGET_BUS_INTERFACE_STANDARD;
311
312 typedef NTSTATUS
313 (NTAPI *PGET_LOCATION_STRING)(
314 IN OUT PVOID Context OPTIONAL,
315 OUT PWCHAR *LocationStrings);
316
317 typedef struct _PNP_LOCATION_INTERFACE {
318 USHORT Size;
319 USHORT Version;
320 PVOID Context;
321 PINTERFACE_REFERENCE InterfaceReference;
322 PINTERFACE_DEREFERENCE InterfaceDereference;
323 PGET_LOCATION_STRING GetLocationString;
324 } PNP_LOCATION_INTERFACE, *PPNP_LOCATION_INTERFACE;
325
326 typedef enum _ARBITER_ACTION {
327 ArbiterActionTestAllocation,
328 ArbiterActionRetestAllocation,
329 ArbiterActionCommitAllocation,
330 ArbiterActionRollbackAllocation,
331 ArbiterActionQueryAllocatedResources,
332 ArbiterActionWriteReservedResources,
333 ArbiterActionQueryConflict,
334 ArbiterActionQueryArbitrate,
335 ArbiterActionAddReserved,
336 ArbiterActionBootAllocation
337 } ARBITER_ACTION, *PARBITER_ACTION;
338
339 typedef struct _ARBITER_CONFLICT_INFO {
340 PDEVICE_OBJECT OwningObject;
341 ULONGLONG Start;
342 ULONGLONG End;
343 } ARBITER_CONFLICT_INFO, *PARBITER_CONFLICT_INFO;
344
345 typedef struct _ARBITER_TEST_ALLOCATION_PARAMETERS {
346 IN OUT PLIST_ENTRY ArbitrationList;
347 IN ULONG AllocateFromCount;
348 IN PCM_PARTIAL_RESOURCE_DESCRIPTOR AllocateFrom;
349 } ARBITER_TEST_ALLOCATION_PARAMETERS, *PARBITER_TEST_ALLOCATION_PARAMETERS;
350
351 typedef struct _ARBITER_RETEST_ALLOCATION_PARAMETERS {
352 IN OUT PLIST_ENTRY ArbitrationList;
353 IN ULONG AllocateFromCount;
354 IN PCM_PARTIAL_RESOURCE_DESCRIPTOR AllocateFrom;
355 } ARBITER_RETEST_ALLOCATION_PARAMETERS, *PARBITER_RETEST_ALLOCATION_PARAMETERS;
356
357 typedef struct _ARBITER_BOOT_ALLOCATION_PARAMETERS {
358 IN OUT PLIST_ENTRY ArbitrationList;
359 } ARBITER_BOOT_ALLOCATION_PARAMETERS, *PARBITER_BOOT_ALLOCATION_PARAMETERS;
360
361 typedef struct _ARBITER_QUERY_ALLOCATED_RESOURCES_PARAMETERS {
362 OUT PCM_PARTIAL_RESOURCE_LIST *AllocatedResources;
363 } ARBITER_QUERY_ALLOCATED_RESOURCES_PARAMETERS, *PARBITER_QUERY_ALLOCATED_RESOURCES_PARAMETERS;
364
365 typedef struct _ARBITER_QUERY_CONFLICT_PARAMETERS {
366 IN PDEVICE_OBJECT PhysicalDeviceObject;
367 IN PIO_RESOURCE_DESCRIPTOR ConflictingResource;
368 OUT PULONG ConflictCount;
369 OUT PARBITER_CONFLICT_INFO *Conflicts;
370 } ARBITER_QUERY_CONFLICT_PARAMETERS, *PARBITER_QUERY_CONFLICT_PARAMETERS;
371
372 typedef struct _ARBITER_QUERY_ARBITRATE_PARAMETERS {
373 IN PLIST_ENTRY ArbitrationList;
374 } ARBITER_QUERY_ARBITRATE_PARAMETERS, *PARBITER_QUERY_ARBITRATE_PARAMETERS;
375
376 typedef struct _ARBITER_ADD_RESERVED_PARAMETERS {
377 IN PDEVICE_OBJECT ReserveDevice;
378 } ARBITER_ADD_RESERVED_PARAMETERS, *PARBITER_ADD_RESERVED_PARAMETERS;
379
380 typedef struct _ARBITER_PARAMETERS {
381 union {
382 ARBITER_TEST_ALLOCATION_PARAMETERS TestAllocation;
383 ARBITER_RETEST_ALLOCATION_PARAMETERS RetestAllocation;
384 ARBITER_BOOT_ALLOCATION_PARAMETERS BootAllocation;
385 ARBITER_QUERY_ALLOCATED_RESOURCES_PARAMETERS QueryAllocatedResources;
386 ARBITER_QUERY_CONFLICT_PARAMETERS QueryConflict;
387 ARBITER_QUERY_ARBITRATE_PARAMETERS QueryArbitrate;
388 ARBITER_ADD_RESERVED_PARAMETERS AddReserved;
389 } Parameters;
390 } ARBITER_PARAMETERS, *PARBITER_PARAMETERS;
391
392 typedef enum _ARBITER_REQUEST_SOURCE {
393 ArbiterRequestUndefined = -1,
394 ArbiterRequestLegacyReported,
395 ArbiterRequestHalReported,
396 ArbiterRequestLegacyAssigned,
397 ArbiterRequestPnpDetected,
398 ArbiterRequestPnpEnumerated
399 } ARBITER_REQUEST_SOURCE;
400
401 typedef enum _ARBITER_RESULT {
402 ArbiterResultUndefined = -1,
403 ArbiterResultSuccess,
404 ArbiterResultExternalConflict,
405 ArbiterResultNullRequest
406 } ARBITER_RESULT;
407
408 #define ARBITER_FLAG_BOOT_CONFIG 0x00000001
409
410 typedef struct _ARBITER_LIST_ENTRY {
411 LIST_ENTRY ListEntry;
412 ULONG AlternativeCount;
413 PIO_RESOURCE_DESCRIPTOR Alternatives;
414 PDEVICE_OBJECT PhysicalDeviceObject;
415 ARBITER_REQUEST_SOURCE RequestSource;
416 ULONG Flags;
417 LONG_PTR WorkSpace;
418 INTERFACE_TYPE InterfaceType;
419 ULONG SlotNumber;
420 ULONG BusNumber;
421 PCM_PARTIAL_RESOURCE_DESCRIPTOR Assignment;
422 PIO_RESOURCE_DESCRIPTOR SelectedAlternative;
423 ARBITER_RESULT Result;
424 } ARBITER_LIST_ENTRY, *PARBITER_LIST_ENTRY;
425
426 typedef NTSTATUS
427 (NTAPI *PARBITER_HANDLER)(
428 IN OUT PVOID Context,
429 IN ARBITER_ACTION Action,
430 IN OUT PARBITER_PARAMETERS Parameters);
431
432 #define ARBITER_PARTIAL 0x00000001
433
434 typedef struct _ARBITER_INTERFACE {
435 USHORT Size;
436 USHORT Version;
437 PVOID Context;
438 PINTERFACE_REFERENCE InterfaceReference;
439 PINTERFACE_DEREFERENCE InterfaceDereference;
440 PARBITER_HANDLER ArbiterHandler;
441 ULONG Flags;
442 } ARBITER_INTERFACE, *PARBITER_INTERFACE;
443
444 typedef enum _RESOURCE_TRANSLATION_DIRECTION {
445 TranslateChildToParent,
446 TranslateParentToChild
447 } RESOURCE_TRANSLATION_DIRECTION;
448
449 typedef NTSTATUS
450 (NTAPI *PTRANSLATE_RESOURCE_HANDLER)(
451 IN OUT PVOID Context OPTIONAL,
452 IN PCM_PARTIAL_RESOURCE_DESCRIPTOR Source,
453 IN RESOURCE_TRANSLATION_DIRECTION Direction,
454 IN ULONG AlternativesCount OPTIONAL,
455 IN IO_RESOURCE_DESCRIPTOR Alternatives[],
456 IN PDEVICE_OBJECT PhysicalDeviceObject,
457 OUT PCM_PARTIAL_RESOURCE_DESCRIPTOR Target);
458
459 typedef NTSTATUS
460 (NTAPI *PTRANSLATE_RESOURCE_REQUIREMENTS_HANDLER)(
461 IN OUT PVOID Context OPTIONAL,
462 IN PIO_RESOURCE_DESCRIPTOR Source,
463 IN PDEVICE_OBJECT PhysicalDeviceObject,
464 OUT PULONG TargetCount,
465 OUT PIO_RESOURCE_DESCRIPTOR *Target);
466
467 typedef struct _TRANSLATOR_INTERFACE {
468 USHORT Size;
469 USHORT Version;
470 PVOID Context;
471 PINTERFACE_REFERENCE InterfaceReference;
472 PINTERFACE_DEREFERENCE InterfaceDereference;
473 PTRANSLATE_RESOURCE_HANDLER TranslateResources;
474 PTRANSLATE_RESOURCE_REQUIREMENTS_HANDLER TranslateResourceRequirements;
475 } TRANSLATOR_INTERFACE, *PTRANSLATOR_INTERFACE;
476
477 typedef struct _PCI_AGP_CAPABILITY {
478 PCI_CAPABILITIES_HEADER Header;
479 USHORT Minor:4;
480 USHORT Major:4;
481 USHORT Rsvd1:8;
482 struct _PCI_AGP_STATUS {
483 ULONG Rate:3;
484 ULONG Agp3Mode:1;
485 ULONG FastWrite:1;
486 ULONG FourGB:1;
487 ULONG HostTransDisable:1;
488 ULONG Gart64:1;
489 ULONG ITA_Coherent:1;
490 ULONG SideBandAddressing:1;
491 ULONG CalibrationCycle:3;
492 ULONG AsyncRequestSize:3;
493 ULONG Rsvd1:1;
494 ULONG Isoch:1;
495 ULONG Rsvd2:6;
496 ULONG RequestQueueDepthMaximum:8;
497 } AGPStatus;
498 struct _PCI_AGP_COMMAND {
499 ULONG Rate:3;
500 ULONG Rsvd1:1;
501 ULONG FastWriteEnable:1;
502 ULONG FourGBEnable:1;
503 ULONG Rsvd2:1;
504 ULONG Gart64:1;
505 ULONG AGPEnable:1;
506 ULONG SBAEnable:1;
507 ULONG CalibrationCycle:3;
508 ULONG AsyncReqSize:3;
509 ULONG Rsvd3:8;
510 ULONG RequestQueueDepth:8;
511 } AGPCommand;
512 } PCI_AGP_CAPABILITY, *PPCI_AGP_CAPABILITY;
513
514 typedef enum _EXTENDED_AGP_REGISTER {
515 IsochStatus,
516 AgpControl,
517 ApertureSize,
518 AperturePageSize,
519 GartLow,
520 GartHigh,
521 IsochCommand
522 } EXTENDED_AGP_REGISTER, *PEXTENDED_AGP_REGISTER;
523
524 typedef struct _PCI_AGP_ISOCH_STATUS {
525 ULONG ErrorCode:2;
526 ULONG Rsvd1:1;
527 ULONG Isoch_L:3;
528 ULONG Isoch_Y:2;
529 ULONG Isoch_N:8;
530 ULONG Rsvd2:16;
531 } PCI_AGP_ISOCH_STATUS, *PPCI_AGP_ISOCH_STATUS;
532
533 typedef struct _PCI_AGP_CONTROL {
534 ULONG Rsvd1:7;
535 ULONG GTLB_Enable:1;
536 ULONG AP_Enable:1;
537 ULONG CAL_Disable:1;
538 ULONG Rsvd2:22;
539 } PCI_AGP_CONTROL, *PPCI_AGP_CONTROL;
540
541 typedef struct _PCI_AGP_APERTURE_PAGE_SIZE {
542 USHORT PageSizeMask:11;
543 USHORT Rsvd1:1;
544 USHORT PageSizeSelect:4;
545 } PCI_AGP_APERTURE_PAGE_SIZE, *PPCI_AGP_APERTURE_PAGE_SIZE;
546
547 typedef struct _PCI_AGP_ISOCH_COMMAND {
548 USHORT Rsvd1:6;
549 USHORT Isoch_Y:2;
550 USHORT Isoch_N:8;
551 } PCI_AGP_ISOCH_COMMAND, *PPCI_AGP_ISOCH_COMMAND;
552
553 typedef struct PCI_AGP_EXTENDED_CAPABILITY {
554 PCI_AGP_ISOCH_STATUS IsochStatus;
555 PCI_AGP_CONTROL AgpControl;
556 USHORT ApertureSize;
557 PCI_AGP_APERTURE_PAGE_SIZE AperturePageSize;
558 ULONG GartLow;
559 ULONG GartHigh;
560 PCI_AGP_ISOCH_COMMAND IsochCommand;
561 } PCI_AGP_EXTENDED_CAPABILITY, *PPCI_AGP_EXTENDED_CAPABILITY;
562
563 #define PCI_AGP_RATE_1X 0x1
564 #define PCI_AGP_RATE_2X 0x2
565 #define PCI_AGP_RATE_4X 0x4
566
567 #define PCIX_MODE_CONVENTIONAL_PCI 0x0
568 #define PCIX_MODE1_66MHZ 0x1
569 #define PCIX_MODE1_100MHZ 0x2
570 #define PCIX_MODE1_133MHZ 0x3
571 #define PCIX_MODE2_266_66MHZ 0x9
572 #define PCIX_MODE2_266_100MHZ 0xA
573 #define PCIX_MODE2_266_133MHZ 0xB
574 #define PCIX_MODE2_533_66MHZ 0xD
575 #define PCIX_MODE2_533_100MHZ 0xE
576 #define PCIX_MODE2_533_133MHZ 0xF
577
578 #define PCIX_VERSION_MODE1_ONLY 0x0
579 #define PCIX_VERSION_MODE2_ECC 0x1
580 #define PCIX_VERSION_DUAL_MODE_ECC 0x2
581
582 typedef struct _PCIX_BRIDGE_CAPABILITY {
583 PCI_CAPABILITIES_HEADER Header;
584 union {
585 struct {
586 USHORT Bus64Bit:1;
587 USHORT Bus133MHzCapable:1;
588 USHORT SplitCompletionDiscarded:1;
589 USHORT UnexpectedSplitCompletion:1;
590 USHORT SplitCompletionOverrun:1;
591 USHORT SplitRequestDelayed:1;
592 USHORT BusModeFrequency:4;
593 USHORT Rsvd:2;
594 USHORT Version:2;
595 USHORT Bus266MHzCapable:1;
596 USHORT Bus533MHzCapable:1;
597 } DUMMYSTRUCTNAME;
598 USHORT AsUSHORT;
599 } SecondaryStatus;
600 union {
601 struct {
602 ULONG FunctionNumber:3;
603 ULONG DeviceNumber:5;
604 ULONG BusNumber:8;
605 ULONG Device64Bit:1;
606 ULONG Device133MHzCapable:1;
607 ULONG SplitCompletionDiscarded:1;
608 ULONG UnexpectedSplitCompletion:1;
609 ULONG SplitCompletionOverrun:1;
610 ULONG SplitRequestDelayed:1;
611 ULONG Rsvd:7;
612 ULONG DIMCapable:1;
613 ULONG Device266MHzCapable:1;
614 ULONG Device533MHzCapable:1;
615 } DUMMYSTRUCTNAME;
616 ULONG AsULONG;
617 } BridgeStatus;
618 USHORT UpstreamSplitTransactionCapacity;
619 USHORT UpstreamSplitTransactionLimit;
620 USHORT DownstreamSplitTransactionCapacity;
621 USHORT DownstreamSplitTransactionLimit;
622 union {
623 struct {
624 ULONG SelectSecondaryRegisters:1;
625 ULONG ErrorPresentInOtherBank:1;
626 ULONG AdditionalCorrectableError:1;
627 ULONG AdditionalUncorrectableError:1;
628 ULONG ErrorPhase:3;
629 ULONG ErrorCorrected:1;
630 ULONG Syndrome:8;
631 ULONG ErrorFirstCommand:4;
632 ULONG ErrorSecondCommand:4;
633 ULONG ErrorUpperAttributes:4;
634 ULONG ControlUpdateEnable:1;
635 ULONG Rsvd:1;
636 ULONG DisableSingleBitCorrection:1;
637 ULONG EccMode:1;
638 } DUMMYSTRUCTNAME;
639 ULONG AsULONG;
640 } EccControlStatus;
641 ULONG EccFirstAddress;
642 ULONG EccSecondAddress;
643 ULONG EccAttribute;
644 } PCIX_BRIDGE_CAPABILITY, *PPCIX_BRIDGE_CAPABILITY;
645
646 typedef struct _PCI_SUBSYSTEM_IDS_CAPABILITY {
647 PCI_CAPABILITIES_HEADER Header;
648 USHORT Reserved;
649 USHORT SubVendorID;
650 USHORT SubSystemID;
651 } PCI_SUBSYSTEM_IDS_CAPABILITY, *PPCI_SUBSYSTEM_IDS_CAPABILITY;
652
653 #define OSC_FIRMWARE_FAILURE 0x02
654 #define OSC_UNRECOGNIZED_UUID 0x04
655 #define OSC_UNRECOGNIZED_REVISION 0x08
656 #define OSC_CAPABILITIES_MASKED 0x10
657
658 #define PCI_ROOT_BUS_OSC_METHOD_CAPABILITY_REVISION 0x01
659
660 typedef struct _PCI_ROOT_BUS_OSC_SUPPORT_FIELD {
661 union {
662 struct {
663 ULONG ExtendedConfigOpRegions:1;
664 ULONG ActiveStatePowerManagement:1;
665 ULONG ClockPowerManagement:1;
666 ULONG SegmentGroups:1;
667 ULONG MessageSignaledInterrupts:1;
668 ULONG WindowsHardwareErrorArchitecture:1;
669 ULONG Reserved:26;
670 } DUMMYSTRUCTNAME;
671 ULONG AsULONG;
672 } u;
673 } PCI_ROOT_BUS_OSC_SUPPORT_FIELD, *PPCI_ROOT_BUS_OSC_SUPPORT_FIELD;
674
675 typedef struct _PCI_ROOT_BUS_OSC_CONTROL_FIELD {
676 union {
677 struct {
678 ULONG ExpressNativeHotPlug:1;
679 ULONG ShpcNativeHotPlug:1;
680 ULONG ExpressNativePME:1;
681 ULONG ExpressAdvancedErrorReporting:1;
682 ULONG ExpressCapabilityStructure:1;
683 ULONG Reserved:27;
684 } DUMMYSTRUCTNAME;
685 ULONG AsULONG;
686 } u;
687 } PCI_ROOT_BUS_OSC_CONTROL_FIELD, *PPCI_ROOT_BUS_OSC_CONTROL_FIELD;
688
689 typedef enum _PCI_HARDWARE_INTERFACE {
690 PciConventional,
691 PciXMode1,
692 PciXMode2,
693 PciExpress
694 } PCI_HARDWARE_INTERFACE, *PPCI_HARDWARE_INTERFACE;
695
696 typedef enum {
697 BusWidth32Bits,
698 BusWidth64Bits
699 } PCI_BUS_WIDTH;
700
701 typedef struct _PCI_ROOT_BUS_HARDWARE_CAPABILITY {
702 PCI_HARDWARE_INTERFACE SecondaryInterface;
703 struct {
704 BOOLEAN BusCapabilitiesFound;
705 ULONG CurrentSpeedAndMode;
706 ULONG SupportedSpeedsAndModes;
707 BOOLEAN DeviceIDMessagingCapable;
708 PCI_BUS_WIDTH SecondaryBusWidth;
709 } DUMMYSTRUCTNAME;
710 PCI_ROOT_BUS_OSC_SUPPORT_FIELD OscFeatureSupport;
711 PCI_ROOT_BUS_OSC_CONTROL_FIELD OscControlRequest;
712 PCI_ROOT_BUS_OSC_CONTROL_FIELD OscControlGranted;
713 } PCI_ROOT_BUS_HARDWARE_CAPABILITY, *PPCI_ROOT_BUS_HARDWARE_CAPABILITY;
714
715 typedef union _PCI_EXPRESS_CAPABILITIES_REGISTER {
716 struct {
717 USHORT CapabilityVersion:4;
718 USHORT DeviceType:4;
719 USHORT SlotImplemented:1;
720 USHORT InterruptMessageNumber:5;
721 USHORT Rsvd:2;
722 } DUMMYSTRUCTNAME;
723 USHORT AsUSHORT;
724 } PCI_EXPRESS_CAPABILITIES_REGISTER, *PPCI_EXPRESS_CAPABILITIES_REGISTER;
725
726 typedef union _PCI_EXPRESS_DEVICE_CAPABILITIES_REGISTER {
727 struct {
728 ULONG MaxPayloadSizeSupported:3;
729 ULONG PhantomFunctionsSupported:2;
730 ULONG ExtendedTagSupported:1;
731 ULONG L0sAcceptableLatency:3;
732 ULONG L1AcceptableLatency:3;
733 ULONG Undefined:3;
734 ULONG RoleBasedErrorReporting:1;
735 ULONG Rsvd1:2;
736 ULONG CapturedSlotPowerLimit:8;
737 ULONG CapturedSlotPowerLimitScale:2;
738 ULONG Rsvd2:4;
739 } DUMMYSTRUCTNAME;
740 ULONG AsULONG;
741 } PCI_EXPRESS_DEVICE_CAPABILITIES_REGISTER, *PPCI_EXPRESS_DEVICE_CAPABILITIES_REGISTER;
742
743 #define PCI_EXPRESS_AER_DEVICE_CONTROL_MASK 0x07;
744
745 typedef union _PCI_EXPRESS_DEVICE_CONTROL_REGISTER {
746 struct {
747 USHORT CorrectableErrorEnable:1;
748 USHORT NonFatalErrorEnable:1;
749 USHORT FatalErrorEnable:1;
750 USHORT UnsupportedRequestErrorEnable:1;
751 USHORT EnableRelaxedOrder:1;
752 USHORT MaxPayloadSize:3;
753 USHORT ExtendedTagEnable:1;
754 USHORT PhantomFunctionsEnable:1;
755 USHORT AuxPowerEnable:1;
756 USHORT NoSnoopEnable:1;
757 USHORT MaxReadRequestSize:3;
758 USHORT BridgeConfigRetryEnable:1;
759 } DUMMYSTRUCTNAME;
760 USHORT AsUSHORT;
761 } PCI_EXPRESS_DEVICE_CONTROL_REGISTER, *PPCI_EXPRESS_DEVICE_CONTROL_REGISTER;
762
763 #define PCI_EXPRESS_AER_DEVICE_STATUS_MASK 0x0F;
764
765 typedef union _PCI_EXPRESS_DEVICE_STATUS_REGISTER {
766 struct {
767 USHORT CorrectableErrorDetected:1;
768 USHORT NonFatalErrorDetected:1;
769 USHORT FatalErrorDetected:1;
770 USHORT UnsupportedRequestDetected:1;
771 USHORT AuxPowerDetected:1;
772 USHORT TransactionsPending:1;
773 USHORT Rsvd:10;
774 } DUMMYSTRUCTNAME;
775 USHORT AsUSHORT;
776 } PCI_EXPRESS_DEVICE_STATUS_REGISTER, *PPCI_EXPRESS_DEVICE_STATUS_REGISTER;
777
778 typedef union _PCI_EXPRESS_LINK_CAPABILITIES_REGISTER {
779 struct {
780 ULONG MaximumLinkSpeed:4;
781 ULONG MaximumLinkWidth:6;
782 ULONG ActiveStatePMSupport:2;
783 ULONG L0sExitLatency:3;
784 ULONG L1ExitLatency:3;
785 ULONG ClockPowerManagement:1;
786 ULONG SurpriseDownErrorReportingCapable:1;
787 ULONG DataLinkLayerActiveReportingCapable:1;
788 ULONG Rsvd:3;
789 ULONG PortNumber:8;
790 } DUMMYSTRUCTNAME;
791 ULONG AsULONG;
792 } PCI_EXPRESS_LINK_CAPABILITIES_REGISTER, *PPCI_EXPRESS_LINK_CAPABILITIES_REGISTER;
793
794 typedef union _PCI_EXPRESS_LINK_CONTROL_REGISTER {
795 struct {
796 USHORT ActiveStatePMControl:2;
797 USHORT Rsvd1:1;
798 USHORT ReadCompletionBoundary:1;
799 USHORT LinkDisable:1;
800 USHORT RetrainLink:1;
801 USHORT CommonClockConfig:1;
802 USHORT ExtendedSynch:1;
803 USHORT EnableClockPowerManagement:1;
804 USHORT Rsvd2:7;
805 } DUMMYSTRUCTNAME;
806 USHORT AsUSHORT;
807 } PCI_EXPRESS_LINK_CONTROL_REGISTER, *PPCI_EXPRESS_LINK_CONTROL_REGISTER;
808
809 typedef union _PCI_EXPRESS_LINK_STATUS_REGISTER {
810 struct {
811 USHORT LinkSpeed:4;
812 USHORT LinkWidth:6;
813 USHORT Undefined:1;
814 USHORT LinkTraining:1;
815 USHORT SlotClockConfig:1;
816 USHORT DataLinkLayerActive:1;
817 USHORT Rsvd:2;
818 } DUMMYSTRUCTNAME;
819 USHORT AsUSHORT;
820 } PCI_EXPRESS_LINK_STATUS_REGISTER, *PPCI_EXPRESS_LINK_STATUS_REGISTER;
821
822 typedef union _PCI_EXPRESS_SLOT_CAPABILITIES_REGISTER {
823 struct {
824 ULONG AttentionButtonPresent:1;
825 ULONG PowerControllerPresent:1;
826 ULONG MRLSensorPresent:1;
827 ULONG AttentionIndicatorPresent:1;
828 ULONG PowerIndicatorPresent:1;
829 ULONG HotPlugSurprise:1;
830 ULONG HotPlugCapable:1;
831 ULONG SlotPowerLimit:8;
832 ULONG SlotPowerLimitScale:2;
833 ULONG ElectromechanicalLockPresent:1;
834 ULONG NoCommandCompletedSupport:1;
835 ULONG PhysicalSlotNumber:13;
836 } DUMMYSTRUCTNAME;
837 ULONG AsULONG;
838 } PCI_EXPRESS_SLOT_CAPABILITIES_REGISTER, *PPCI_EXPRESS_SLOT_CAPABILITIES_REGISTER;
839
840 typedef union _PCI_EXPRESS_SLOT_CONTROL_REGISTER {
841 struct {
842 USHORT AttentionButtonEnable:1;
843 USHORT PowerFaultDetectEnable:1;
844 USHORT MRLSensorEnable:1;
845 USHORT PresenceDetectEnable:1;
846 USHORT CommandCompletedEnable:1;
847 USHORT HotPlugInterruptEnable:1;
848 USHORT AttentionIndicatorControl:2;
849 USHORT PowerIndicatorControl:2;
850 USHORT PowerControllerControl:1;
851 USHORT ElectromechanicalLockControl:1;
852 USHORT DataLinkStateChangeEnable:1;
853 USHORT Rsvd:3;
854 } DUMMYSTRUCTNAME;
855 USHORT AsUSHORT;
856 } PCI_EXPRESS_SLOT_CONTROL_REGISTER, *PPCI_EXPRESS_SLOT_CONTROL_REGISTER;
857
858 typedef union _PCI_EXPRESS_SLOT_STATUS_REGISTER {
859 struct {
860 USHORT AttentionButtonPressed:1;
861 USHORT PowerFaultDetected:1;
862 USHORT MRLSensorChanged:1;
863 USHORT PresenceDetectChanged:1;
864 USHORT CommandCompleted:1;
865 USHORT MRLSensorState:1;
866 USHORT PresenceDetectState:1;
867 USHORT ElectromechanicalLockEngaged:1;
868 USHORT DataLinkStateChanged:1;
869 USHORT Rsvd:7;
870 } DUMMYSTRUCTNAME;
871 USHORT AsUSHORT;
872 } PCI_EXPRESS_SLOT_STATUS_REGISTER, *PPCI_EXPRESS_SLOT_STATUS_REGISTER;
873
874 typedef union _PCI_EXPRESS_ROOT_CONTROL_REGISTER {
875 struct {
876 USHORT CorrectableSerrEnable:1;
877 USHORT NonFatalSerrEnable:1;
878 USHORT FatalSerrEnable:1;
879 USHORT PMEInterruptEnable:1;
880 USHORT CRSSoftwareVisibilityEnable:1;
881 USHORT Rsvd:11;
882 } DUMMYSTRUCTNAME;
883 USHORT AsUSHORT;
884 } PCI_EXPRESS_ROOT_CONTROL_REGISTER, *PPCI_EXPRESS_ROOT_CONTROL_REGISTER;
885
886 typedef union _PCI_EXPRESS_ROOT_CAPABILITIES_REGISTER {
887 struct {
888 USHORT CRSSoftwareVisibility:1;
889 USHORT Rsvd:15;
890 } DUMMYSTRUCTNAME;
891 USHORT AsUSHORT;
892 } PCI_EXPRESS_ROOT_CAPABILITIES_REGISTER, *PPCI_EXPRESS_ROOT_CAPABILITIES_REGISTER;
893
894 typedef union _PCI_EXPRESS_ROOT_STATUS_REGISTER {
895 struct {
896 ULONG PMERequestorId:16;
897 ULONG PMEStatus:1;
898 ULONG PMEPending:1;
899 ULONG Rsvd:14;
900 } DUMMYSTRUCTNAME;
901 ULONG AsULONG;
902 } PCI_EXPRESS_ROOT_STATUS_REGISTER, *PPCI_EXPRESS_ROOT_STATUS_REGISTER;
903
904 typedef struct _PCI_EXPRESS_CAPABILITY {
905 PCI_CAPABILITIES_HEADER Header;
906 PCI_EXPRESS_CAPABILITIES_REGISTER ExpressCapabilities;
907 PCI_EXPRESS_DEVICE_CAPABILITIES_REGISTER DeviceCapabilities;
908 PCI_EXPRESS_DEVICE_CONTROL_REGISTER DeviceControl;
909 PCI_EXPRESS_DEVICE_STATUS_REGISTER DeviceStatus;
910 PCI_EXPRESS_LINK_CAPABILITIES_REGISTER LinkCapabilities;
911 PCI_EXPRESS_LINK_CONTROL_REGISTER LinkControl;
912 PCI_EXPRESS_LINK_STATUS_REGISTER LinkStatus;
913 PCI_EXPRESS_SLOT_CAPABILITIES_REGISTER SlotCapabilities;
914 PCI_EXPRESS_SLOT_CONTROL_REGISTER SlotControl;
915 PCI_EXPRESS_SLOT_STATUS_REGISTER SlotStatus;
916 PCI_EXPRESS_ROOT_CONTROL_REGISTER RootControl;
917 PCI_EXPRESS_ROOT_CAPABILITIES_REGISTER RootCapabilities;
918 PCI_EXPRESS_ROOT_STATUS_REGISTER RootStatus;
919 } PCI_EXPRESS_CAPABILITY, *PPCI_EXPRESS_CAPABILITY;
920
921 typedef enum {
922 MRLClosed = 0,
923 MRLOpen
924 } PCI_EXPRESS_MRL_STATE;
925
926 typedef enum {
927 SlotEmpty = 0,
928 CardPresent
929 } PCI_EXPRESS_CARD_PRESENCE;
930
931 typedef enum {
932 IndicatorOn = 1,
933 IndicatorBlink,
934 IndicatorOff
935 } PCI_EXPRESS_INDICATOR_STATE;
936
937 typedef enum {
938 PowerOn = 0,
939 PowerOff
940 } PCI_EXPRESS_POWER_STATE;
941
942 typedef enum {
943 L0sEntrySupport = 1,
944 L0sAndL1EntrySupport = 3
945 } PCI_EXPRESS_ASPM_SUPPORT;
946
947 typedef enum {
948 L0sAndL1EntryDisabled,
949 L0sEntryEnabled,
950 L1EntryEnabled,
951 L0sAndL1EntryEnabled
952 } PCI_EXPRESS_ASPM_CONTROL;
953
954 typedef enum {
955 L0s_Below64ns = 0,
956 L0s_64ns_128ns,
957 L0s_128ns_256ns,
958 L0s_256ns_512ns,
959 L0s_512ns_1us,
960 L0s_1us_2us,
961 L0s_2us_4us,
962 L0s_Above4us
963 } PCI_EXPRESS_L0s_EXIT_LATENCY;
964
965 typedef enum {
966 L1_Below1us = 0,
967 L1_1us_2us,
968 L1_2us_4us,
969 L1_4us_8us,
970 L1_8us_16us,
971 L1_16us_32us,
972 L1_32us_64us,
973 L1_Above64us
974 } PCI_EXPRESS_L1_EXIT_LATENCY;
975
976 typedef enum {
977 PciExpressEndpoint = 0,
978 PciExpressLegacyEndpoint,
979 PciExpressRootPort = 4,
980 PciExpressUpstreamSwitchPort,
981 PciExpressDownstreamSwitchPort,
982 PciExpressToPciXBridge,
983 PciXToExpressBridge,
984 PciExpressRootComplexIntegratedEndpoint,
985 PciExpressRootComplexEventCollector
986 } PCI_EXPRESS_DEVICE_TYPE;
987
988 typedef enum {
989 MaxPayload128Bytes = 0,
990 MaxPayload256Bytes,
991 MaxPayload512Bytes,
992 MaxPayload1024Bytes,
993 MaxPayload2048Bytes,
994 MaxPayload4096Bytes
995 } PCI_EXPRESS_MAX_PAYLOAD_SIZE;
996
997 typedef union _PCI_EXPRESS_PME_REQUESTOR_ID {
998 struct {
999 USHORT FunctionNumber:3;
1000 USHORT DeviceNumber:5;
1001 USHORT BusNumber:8;
1002 } DUMMYSTRUCTNAME;
1003 USHORT AsUSHORT;
1004 } PCI_EXPRESS_PME_REQUESTOR_ID, *PPCI_EXPRESS_PME_REQUESTOR_ID;
1005
1006 #if defined(_WIN64)
1007
1008 #ifndef USE_DMA_MACROS
1009 #define USE_DMA_MACROS
1010 #endif
1011
1012 #ifndef NO_LEGACY_DRIVERS
1013 #define NO_LEGACY_DRIVERS
1014 #endif
1015
1016 #endif /* defined(_WIN64) */
1017
1018 typedef enum _PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR_TYPE {
1019 ResourceTypeSingle = 0,
1020 ResourceTypeRange,
1021 ResourceTypeExtendedCounterConfiguration,
1022 ResourceTypeOverflow,
1023 ResourceTypeMax
1024 } PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR_TYPE;
1025
1026 typedef struct _PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR {
1027 PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR_TYPE Type;
1028 ULONG Flags;
1029 union {
1030 ULONG CounterIndex;
1031 ULONG ExtendedRegisterAddress;
1032 struct {
1033 ULONG Begin;
1034 ULONG End;
1035 } Range;
1036 } u;
1037 } PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR, *PPHYSICAL_COUNTER_RESOURCE_DESCRIPTOR;
1038
1039 typedef struct _PHYSICAL_COUNTER_RESOURCE_LIST {
1040 ULONG Count;
1041 PHYSICAL_COUNTER_RESOURCE_DESCRIPTOR Descriptors[ANYSIZE_ARRAY];
1042 } PHYSICAL_COUNTER_RESOURCE_LIST, *PPHYSICAL_COUNTER_RESOURCE_LIST;
1043
1044 typedef VOID
1045 (NTAPI *PciPin2Line)(
1046 IN struct _BUS_HANDLER *BusHandler,
1047 IN struct _BUS_HANDLER *RootHandler,
1048 IN PCI_SLOT_NUMBER SlotNumber,
1049 IN PPCI_COMMON_CONFIG PciData);
1050
1051 typedef VOID
1052 (NTAPI *PciLine2Pin)(
1053 IN struct _BUS_HANDLER *BusHandler,
1054 IN struct _BUS_HANDLER *RootHandler,
1055 IN PCI_SLOT_NUMBER SlotNumber,
1056 IN PPCI_COMMON_CONFIG PciNewData,
1057 IN PPCI_COMMON_CONFIG PciOldData);
1058
1059 typedef VOID
1060 (NTAPI *PciReadWriteConfig)(
1061 IN struct _BUS_HANDLER *BusHandler,
1062 IN PCI_SLOT_NUMBER Slot,
1063 IN PVOID Buffer,
1064 IN ULONG Offset,
1065 IN ULONG Length);
1066
1067 #define PCI_DATA_TAG ' ICP'
1068 #define PCI_DATA_VERSION 1
1069
1070 typedef struct _PCIBUSDATA {
1071 ULONG Tag;
1072 ULONG Version;
1073 PciReadWriteConfig ReadConfig;
1074 PciReadWriteConfig WriteConfig;
1075 PciPin2Line Pin2Line;
1076 PciLine2Pin Line2Pin;
1077 PCI_SLOT_NUMBER ParentSlot;
1078 PVOID Reserved[4];
1079 } PCIBUSDATA, *PPCIBUSDATA;
1080
1081 #ifndef _PCIINTRF_X_
1082 #define _PCIINTRF_X_
1083
1084 typedef ULONG
1085 (NTAPI *PCI_READ_WRITE_CONFIG)(
1086 IN PVOID Context,
1087 IN ULONG BusOffset,
1088 IN ULONG Slot,
1089 IN PVOID Buffer,
1090 IN ULONG Offset,
1091 IN ULONG Length);
1092
1093 typedef VOID
1094 (NTAPI *PCI_PIN_TO_LINE)(
1095 IN PVOID Context,
1096 IN PPCI_COMMON_CONFIG PciData);
1097
1098 typedef VOID
1099 (NTAPI *PCI_LINE_TO_PIN)(
1100 IN PVOID Context,
1101 IN PPCI_COMMON_CONFIG PciNewData,
1102 IN PPCI_COMMON_CONFIG PciOldData);
1103
1104 typedef VOID
1105 (NTAPI *PCI_ROOT_BUS_CAPABILITY)(
1106 IN PVOID Context,
1107 OUT PPCI_ROOT_BUS_HARDWARE_CAPABILITY HardwareCapability);
1108
1109 typedef VOID
1110 (NTAPI *PCI_EXPRESS_WAKE_CONTROL)(
1111 IN PVOID Context,
1112 IN BOOLEAN EnableWake);
1113
1114 typedef struct _PCI_BUS_INTERFACE_STANDARD {
1115 USHORT Size;
1116 USHORT Version;
1117 PVOID Context;
1118 PINTERFACE_REFERENCE InterfaceReference;
1119 PINTERFACE_DEREFERENCE InterfaceDereference;
1120 PCI_READ_WRITE_CONFIG ReadConfig;
1121 PCI_READ_WRITE_CONFIG WriteConfig;
1122 PCI_PIN_TO_LINE PinToLine;
1123 PCI_LINE_TO_PIN LineToPin;
1124 PCI_ROOT_BUS_CAPABILITY RootBusCapability;
1125 PCI_EXPRESS_WAKE_CONTROL ExpressWakeControl;
1126 } PCI_BUS_INTERFACE_STANDARD, *PPCI_BUS_INTERFACE_STANDARD;
1127
1128 #define PCI_BUS_INTERFACE_STANDARD_VERSION 1
1129
1130 #endif /* _PCIINTRF_X_ */
1131
1132 #if (NTDDI_VERSION >= NTDDI_WIN7)
1133
1134 #define FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL_EX 0x00004000
1135 #define FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL_EX 0x00008000
1136 #define FILE_CHARACTERISTICS_REMOVAL_POLICY_MASK_EX \
1137 (FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL_EX | \
1138 FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL_EX)
1139
1140 #define FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL_DEPRECATED 0x00000200
1141 #define FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL_DEPRECATED 0x00000300
1142 #define FILE_CHARACTERISTICS_REMOVAL_POLICY_MASK_DEPRECATED 0x00000300
1143
1144 #else
1145
1146 #define FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL 0x00000200
1147 #define FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL 0x00000300
1148 #define FILE_CHARACTERISTICS_REMOVAL_POLICY_MASK 0x00000300
1149
1150 #define FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL_EX FILE_CHARACTERISTICS_EXPECT_ORDERLY_REMOVAL
1151 #define FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL_EX FILE_CHARACTERISTICS_EXPECT_SURPRISE_REMOVAL
1152 #define FILE_CHARACTERISTICS_REMOVAL_POLICY_MASK_EX FILE_CHARACTERISTICS_REMOVAL_POLICY_MASK
1153
1154 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
1155
1156 #define FILE_CHARACTERISTICS_PROPAGATED ( FILE_REMOVABLE_MEDIA | \
1157 FILE_READ_ONLY_DEVICE | \
1158 FILE_FLOPPY_DISKETTE | \
1159 FILE_WRITE_ONCE_MEDIA | \
1160 FILE_DEVICE_SECURE_OPEN )
1161
1162 typedef struct _FILE_ALIGNMENT_INFORMATION {
1163 ULONG AlignmentRequirement;
1164 } FILE_ALIGNMENT_INFORMATION, *PFILE_ALIGNMENT_INFORMATION;
1165
1166 typedef struct _FILE_NAME_INFORMATION {
1167 ULONG FileNameLength;
1168 WCHAR FileName[1];
1169 } FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION;
1170
1171
1172 typedef struct _FILE_ATTRIBUTE_TAG_INFORMATION {
1173 ULONG FileAttributes;
1174 ULONG ReparseTag;
1175 } FILE_ATTRIBUTE_TAG_INFORMATION, *PFILE_ATTRIBUTE_TAG_INFORMATION;
1176
1177 typedef struct _FILE_DISPOSITION_INFORMATION {
1178 BOOLEAN DeleteFile;
1179 } FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION;
1180
1181 typedef struct _FILE_END_OF_FILE_INFORMATION {
1182 LARGE_INTEGER EndOfFile;
1183 } FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION;
1184
1185 typedef struct _FILE_VALID_DATA_LENGTH_INFORMATION {
1186 LARGE_INTEGER ValidDataLength;
1187 } FILE_VALID_DATA_LENGTH_INFORMATION, *PFILE_VALID_DATA_LENGTH_INFORMATION;
1188
1189 typedef struct _FILE_FS_LABEL_INFORMATION {
1190 ULONG VolumeLabelLength;
1191 WCHAR VolumeLabel[1];
1192 } FILE_FS_LABEL_INFORMATION, *PFILE_FS_LABEL_INFORMATION;
1193
1194 typedef struct _FILE_FS_VOLUME_INFORMATION {
1195 LARGE_INTEGER VolumeCreationTime;
1196 ULONG VolumeSerialNumber;
1197 ULONG VolumeLabelLength;
1198 BOOLEAN SupportsObjects;
1199 WCHAR VolumeLabel[1];
1200 } FILE_FS_VOLUME_INFORMATION, *PFILE_FS_VOLUME_INFORMATION;
1201
1202 typedef struct _FILE_FS_SIZE_INFORMATION {
1203 LARGE_INTEGER TotalAllocationUnits;
1204 LARGE_INTEGER AvailableAllocationUnits;
1205 ULONG SectorsPerAllocationUnit;
1206 ULONG BytesPerSector;
1207 } FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION;
1208
1209 typedef struct _FILE_FS_FULL_SIZE_INFORMATION {
1210 LARGE_INTEGER TotalAllocationUnits;
1211 LARGE_INTEGER CallerAvailableAllocationUnits;
1212 LARGE_INTEGER ActualAvailableAllocationUnits;
1213 ULONG SectorsPerAllocationUnit;
1214 ULONG BytesPerSector;
1215 } FILE_FS_FULL_SIZE_INFORMATION, *PFILE_FS_FULL_SIZE_INFORMATION;
1216
1217 typedef struct _FILE_FS_OBJECTID_INFORMATION {
1218 UCHAR ObjectId[16];
1219 UCHAR ExtendedInfo[48];
1220 } FILE_FS_OBJECTID_INFORMATION, *PFILE_FS_OBJECTID_INFORMATION;
1221
1222 typedef union _FILE_SEGMENT_ELEMENT {
1223 PVOID64 Buffer;
1224 ULONGLONG Alignment;
1225 }FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT;
1226
1227 #define IOCTL_AVIO_ALLOCATE_STREAM CTL_CODE(FILE_DEVICE_AVIO, 1, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
1228 #define IOCTL_AVIO_FREE_STREAM CTL_CODE(FILE_DEVICE_AVIO, 2, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
1229 #define IOCTL_AVIO_MODIFY_STREAM CTL_CODE(FILE_DEVICE_AVIO, 3, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
1230
1231 typedef enum _BUS_DATA_TYPE {
1232 ConfigurationSpaceUndefined = -1,
1233 Cmos,
1234 EisaConfiguration,
1235 Pos,
1236 CbusConfiguration,
1237 PCIConfiguration,
1238 VMEConfiguration,
1239 NuBusConfiguration,
1240 PCMCIAConfiguration,
1241 MPIConfiguration,
1242 MPSAConfiguration,
1243 PNPISAConfiguration,
1244 SgiInternalConfiguration,
1245 MaximumBusDataType
1246 } BUS_DATA_TYPE, *PBUS_DATA_TYPE;
1247
1248 /* Hardware Abstraction Layer Types */
1249
1250 typedef BOOLEAN
1251 (NTAPI *PHAL_RESET_DISPLAY_PARAMETERS)(
1252 IN ULONG Columns,
1253 IN ULONG Rows);
1254
1255 typedef PBUS_HANDLER
1256 (FASTCALL *pHalHandlerForBus)(
1257 IN INTERFACE_TYPE InterfaceType,
1258 IN ULONG BusNumber);
1259
1260 typedef VOID
1261 (FASTCALL *pHalReferenceBusHandler)(
1262 IN PBUS_HANDLER BusHandler);
1263
1264 typedef enum _HAL_QUERY_INFORMATION_CLASS {
1265 HalInstalledBusInformation,
1266 HalProfileSourceInformation,
1267 HalInformationClassUnused1,
1268 HalPowerInformation,
1269 HalProcessorSpeedInformation,
1270 HalCallbackInformation,
1271 HalMapRegisterInformation,
1272 HalMcaLogInformation,
1273 HalFrameBufferCachingInformation,
1274 HalDisplayBiosInformation,
1275 HalProcessorFeatureInformation,
1276 HalNumaTopologyInterface,
1277 HalErrorInformation,
1278 HalCmcLogInformation,
1279 HalCpeLogInformation,
1280 HalQueryMcaInterface,
1281 HalQueryAMLIIllegalIOPortAddresses,
1282 HalQueryMaxHotPlugMemoryAddress,
1283 HalPartitionIpiInterface,
1284 HalPlatformInformation,
1285 HalQueryProfileSourceList,
1286 HalInitLogInformation,
1287 HalFrequencyInformation,
1288 HalProcessorBrandString,
1289 HalHypervisorInformation,
1290 HalPlatformTimerInformation,
1291 HalAcpiAuditInformation
1292 } HAL_QUERY_INFORMATION_CLASS, *PHAL_QUERY_INFORMATION_CLASS;
1293
1294 typedef enum _HAL_SET_INFORMATION_CLASS {
1295 HalProfileSourceInterval,
1296 HalProfileSourceInterruptHandler,
1297 HalMcaRegisterDriver,
1298 HalKernelErrorHandler,
1299 HalCmcRegisterDriver,
1300 HalCpeRegisterDriver,
1301 HalMcaLog,
1302 HalCmcLog,
1303 HalCpeLog,
1304 HalGenerateCmcInterrupt,
1305 HalProfileSourceTimerHandler,
1306 HalEnlightenment,
1307 HalProfileDpgoSourceInterruptHandler
1308 } HAL_SET_INFORMATION_CLASS, *PHAL_SET_INFORMATION_CLASS;
1309
1310 typedef NTSTATUS
1311 (NTAPI *pHalQuerySystemInformation)(
1312 IN HAL_QUERY_INFORMATION_CLASS InformationClass,
1313 IN ULONG BufferSize,
1314 IN OUT PVOID Buffer,
1315 OUT PULONG ReturnedLength);
1316
1317 typedef NTSTATUS
1318 (NTAPI *pHalSetSystemInformation)(
1319 IN HAL_SET_INFORMATION_CLASS InformationClass,
1320 IN ULONG BufferSize,
1321 IN PVOID Buffer);
1322
1323 typedef VOID
1324 (FASTCALL *pHalExamineMBR)(
1325 IN PDEVICE_OBJECT DeviceObject,
1326 IN ULONG SectorSize,
1327 IN ULONG MBRTypeIdentifier,
1328 OUT PVOID *Buffer);
1329
1330 typedef NTSTATUS
1331 (FASTCALL *pHalIoReadPartitionTable)(
1332 IN PDEVICE_OBJECT DeviceObject,
1333 IN ULONG SectorSize,
1334 IN BOOLEAN ReturnRecognizedPartitions,
1335 OUT struct _DRIVE_LAYOUT_INFORMATION **PartitionBuffer);
1336
1337 typedef NTSTATUS
1338 (FASTCALL *pHalIoSetPartitionInformation)(
1339 IN PDEVICE_OBJECT DeviceObject,
1340 IN ULONG SectorSize,
1341 IN ULONG PartitionNumber,
1342 IN ULONG PartitionType);
1343
1344 typedef NTSTATUS
1345 (FASTCALL *pHalIoWritePartitionTable)(
1346 IN PDEVICE_OBJECT DeviceObject,
1347 IN ULONG SectorSize,
1348 IN ULONG SectorsPerTrack,
1349 IN ULONG NumberOfHeads,
1350 IN struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer);
1351
1352 typedef NTSTATUS
1353 (NTAPI *pHalQueryBusSlots)(
1354 IN PBUS_HANDLER BusHandler,
1355 IN ULONG BufferSize,
1356 OUT PULONG SlotNumbers,
1357 OUT PULONG ReturnedLength);
1358
1359 typedef NTSTATUS
1360 (NTAPI *pHalInitPnpDriver)(
1361 VOID);
1362
1363 typedef struct _PM_DISPATCH_TABLE {
1364 ULONG Signature;
1365 ULONG Version;
1366 PVOID Function[1];
1367 } PM_DISPATCH_TABLE, *PPM_DISPATCH_TABLE;
1368
1369 typedef NTSTATUS
1370 (NTAPI *pHalInitPowerManagement)(
1371 IN PPM_DISPATCH_TABLE PmDriverDispatchTable,
1372 OUT PPM_DISPATCH_TABLE *PmHalDispatchTable);
1373
1374 typedef struct _DMA_ADAPTER*
1375 (NTAPI *pHalGetDmaAdapter)(
1376 IN PVOID Context,
1377 IN struct _DEVICE_DESCRIPTION *DeviceDescriptor,
1378 OUT PULONG NumberOfMapRegisters);
1379
1380 typedef NTSTATUS
1381 (NTAPI *pHalGetInterruptTranslator)(
1382 IN INTERFACE_TYPE ParentInterfaceType,
1383 IN ULONG ParentBusNumber,
1384 IN INTERFACE_TYPE BridgeInterfaceType,
1385 IN USHORT Size,
1386 IN USHORT Version,
1387 OUT PTRANSLATOR_INTERFACE Translator,
1388 OUT PULONG BridgeBusNumber);
1389
1390 typedef NTSTATUS
1391 (NTAPI *pHalStartMirroring)(
1392 VOID);
1393
1394 typedef NTSTATUS
1395 (NTAPI *pHalEndMirroring)(
1396 IN ULONG PassNumber);
1397
1398 typedef NTSTATUS
1399 (NTAPI *pHalMirrorPhysicalMemory)(
1400 IN PHYSICAL_ADDRESS PhysicalAddress,
1401 IN LARGE_INTEGER NumberOfBytes);
1402
1403 typedef NTSTATUS
1404 (NTAPI *pHalMirrorVerify)(
1405 IN PHYSICAL_ADDRESS PhysicalAddress,
1406 IN LARGE_INTEGER NumberOfBytes);
1407
1408 typedef BOOLEAN
1409 (NTAPI *pHalTranslateBusAddress)(
1410 IN INTERFACE_TYPE InterfaceType,
1411 IN ULONG BusNumber,
1412 IN PHYSICAL_ADDRESS BusAddress,
1413 IN OUT PULONG AddressSpace,
1414 OUT PPHYSICAL_ADDRESS TranslatedAddress);
1415
1416 typedef NTSTATUS
1417 (NTAPI *pHalAssignSlotResources)(
1418 IN PUNICODE_STRING RegistryPath,
1419 IN PUNICODE_STRING DriverClassName OPTIONAL,
1420 IN PDRIVER_OBJECT DriverObject,
1421 IN PDEVICE_OBJECT DeviceObject,
1422 IN INTERFACE_TYPE BusType,
1423 IN ULONG BusNumber,
1424 IN ULONG SlotNumber,
1425 IN OUT PCM_RESOURCE_LIST *AllocatedResources);
1426
1427 typedef VOID
1428 (NTAPI *pHalHaltSystem)(
1429 VOID);
1430
1431 typedef BOOLEAN
1432 (NTAPI *pHalResetDisplay)(
1433 VOID);
1434
1435 typedef struct _MAP_REGISTER_ENTRY {
1436 PVOID MapRegister;
1437 BOOLEAN WriteToDevice;
1438 } MAP_REGISTER_ENTRY, *PMAP_REGISTER_ENTRY;
1439
1440 typedef UCHAR
1441 (NTAPI *pHalVectorToIDTEntry)(
1442 ULONG Vector);
1443
1444 typedef BOOLEAN
1445 (NTAPI *pHalFindBusAddressTranslation)(
1446 IN PHYSICAL_ADDRESS BusAddress,
1447 IN OUT PULONG AddressSpace,
1448 OUT PPHYSICAL_ADDRESS TranslatedAddress,
1449 IN OUT PULONG_PTR Context,
1450 IN BOOLEAN NextBus);
1451
1452 typedef VOID
1453 (NTAPI *pHalEndOfBoot)(
1454 VOID);
1455
1456 typedef PVOID
1457 (NTAPI *pHalGetAcpiTable)(
1458 IN ULONG Signature,
1459 IN PCSTR OemId OPTIONAL,
1460 IN PCSTR OemTableId OPTIONAL);
1461
1462 #if defined(_IA64_)
1463 typedef NTSTATUS
1464 (*pHalGetErrorCapList)(
1465 IN OUT PULONG CapsListLength,
1466 IN OUT PUCHAR ErrorCapList);
1467
1468 typedef NTSTATUS
1469 (*pHalInjectError)(
1470 IN ULONG BufferLength,
1471 IN PUCHAR Buffer);
1472 #endif
1473
1474 typedef VOID
1475 (NTAPI *PCI_ERROR_HANDLER_CALLBACK)(
1476 VOID);
1477
1478 typedef VOID
1479 (NTAPI *pHalSetPciErrorHandlerCallback)(
1480 IN PCI_ERROR_HANDLER_CALLBACK Callback);
1481
1482 #if 1 /* Not present in WDK 7600 */
1483 typedef VOID
1484 (FASTCALL *pHalIoAssignDriveLetters)(
1485 IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock,
1486 IN PSTRING NtDeviceName,
1487 OUT PUCHAR NtSystemPath,
1488 OUT PSTRING NtSystemPathString);
1489 #endif
1490
1491 typedef struct {
1492 ULONG Version;
1493 pHalQuerySystemInformation HalQuerySystemInformation;
1494 pHalSetSystemInformation HalSetSystemInformation;
1495 pHalQueryBusSlots HalQueryBusSlots;
1496 ULONG Spare1;
1497 pHalExamineMBR HalExamineMBR;
1498 #if 1 /* Not present in WDK 7600 */
1499 pHalIoAssignDriveLetters HalIoAssignDriveLetters;
1500 #endif
1501 pHalIoReadPartitionTable HalIoReadPartitionTable;
1502 pHalIoSetPartitionInformation HalIoSetPartitionInformation;
1503 pHalIoWritePartitionTable HalIoWritePartitionTable;
1504 pHalHandlerForBus HalReferenceHandlerForBus;
1505 pHalReferenceBusHandler HalReferenceBusHandler;
1506 pHalReferenceBusHandler HalDereferenceBusHandler;
1507 pHalInitPnpDriver HalInitPnpDriver;
1508 pHalInitPowerManagement HalInitPowerManagement;
1509 pHalGetDmaAdapter HalGetDmaAdapter;
1510 pHalGetInterruptTranslator HalGetInterruptTranslator;
1511 pHalStartMirroring HalStartMirroring;
1512 pHalEndMirroring HalEndMirroring;
1513 pHalMirrorPhysicalMemory HalMirrorPhysicalMemory;
1514 pHalEndOfBoot HalEndOfBoot;
1515 pHalMirrorVerify HalMirrorVerify;
1516 pHalGetAcpiTable HalGetCachedAcpiTable;
1517 pHalSetPciErrorHandlerCallback HalSetPciErrorHandlerCallback;
1518 #if defined(_IA64_)
1519 pHalGetErrorCapList HalGetErrorCapList;
1520 pHalInjectError HalInjectError;
1521 #endif
1522 } HAL_DISPATCH, *PHAL_DISPATCH;
1523
1524 /* GCC/MSVC and WDK compatible declaration */
1525 extern NTKERNELAPI HAL_DISPATCH HalDispatchTable;
1526
1527 #if defined(_NTOSKRNL_) || defined(_BLDR_)
1528 #define HALDISPATCH (&HalDispatchTable)
1529 #else
1530 /* This is a WDK compatibility definition */
1531 #define HalDispatchTable (&HalDispatchTable)
1532 #define HALDISPATCH HalDispatchTable
1533 #endif
1534
1535 #define HAL_DISPATCH_VERSION 3 /* FIXME: when to use 4? */
1536 #define HalDispatchTableVersion HALDISPATCH->Version
1537 #define HalQuerySystemInformation HALDISPATCH->HalQuerySystemInformation
1538 #define HalSetSystemInformation HALDISPATCH->HalSetSystemInformation
1539 #define HalQueryBusSlots HALDISPATCH->HalQueryBusSlots
1540 #define HalReferenceHandlerForBus HALDISPATCH->HalReferenceHandlerForBus
1541 #define HalReferenceBusHandler HALDISPATCH->HalReferenceBusHandler
1542 #define HalDereferenceBusHandler HALDISPATCH->HalDereferenceBusHandler
1543 #define HalInitPnpDriver HALDISPATCH->HalInitPnpDriver
1544 #define HalInitPowerManagement HALDISPATCH->HalInitPowerManagement
1545 #define HalGetDmaAdapter HALDISPATCH->HalGetDmaAdapter
1546 #define HalGetInterruptTranslator HALDISPATCH->HalGetInterruptTranslator
1547 #define HalStartMirroring HALDISPATCH->HalStartMirroring
1548 #define HalEndMirroring HALDISPATCH->HalEndMirroring
1549 #define HalMirrorPhysicalMemory HALDISPATCH->HalMirrorPhysicalMemory
1550 #define HalEndOfBoot HALDISPATCH->HalEndOfBoot
1551 #define HalMirrorVerify HALDISPATCH->HalMirrorVerify
1552 #define HalGetCachedAcpiTable HALDISPATCH->HalGetCachedAcpiTable
1553 #define HalSetPciErrorHandlerCallback HALDISPATCH->HalSetPciErrorHandlerCallback
1554 #if defined(_IA64_)
1555 #define HalGetErrorCapList HALDISPATCH->HalGetErrorCapList
1556 #define HalInjectError HALDISPATCH->HalInjectError
1557 #endif
1558
1559 typedef struct _HAL_BUS_INFORMATION {
1560 INTERFACE_TYPE BusType;
1561 BUS_DATA_TYPE ConfigurationType;
1562 ULONG BusNumber;
1563 ULONG Reserved;
1564 } HAL_BUS_INFORMATION, *PHAL_BUS_INFORMATION;
1565
1566 typedef struct _HAL_PROFILE_SOURCE_INFORMATION {
1567 KPROFILE_SOURCE Source;
1568 BOOLEAN Supported;
1569 ULONG Interval;
1570 } HAL_PROFILE_SOURCE_INFORMATION, *PHAL_PROFILE_SOURCE_INFORMATION;
1571
1572 typedef struct _HAL_PROFILE_SOURCE_INFORMATION_EX {
1573 KPROFILE_SOURCE Source;
1574 BOOLEAN Supported;
1575 ULONG_PTR Interval;
1576 ULONG_PTR DefInterval;
1577 ULONG_PTR MaxInterval;
1578 ULONG_PTR MinInterval;
1579 } HAL_PROFILE_SOURCE_INFORMATION_EX, *PHAL_PROFILE_SOURCE_INFORMATION_EX;
1580
1581 typedef struct _HAL_PROFILE_SOURCE_INTERVAL {
1582 KPROFILE_SOURCE Source;
1583 ULONG_PTR Interval;
1584 } HAL_PROFILE_SOURCE_INTERVAL, *PHAL_PROFILE_SOURCE_INTERVAL;
1585
1586 typedef struct _HAL_PROFILE_SOURCE_LIST {
1587 KPROFILE_SOURCE Source;
1588 PWSTR Description;
1589 } HAL_PROFILE_SOURCE_LIST, *PHAL_PROFILE_SOURCE_LIST;
1590
1591 typedef enum _HAL_DISPLAY_BIOS_INFORMATION {
1592 HalDisplayInt10Bios,
1593 HalDisplayEmulatedBios,
1594 HalDisplayNoBios
1595 } HAL_DISPLAY_BIOS_INFORMATION, *PHAL_DISPLAY_BIOS_INFORMATION;
1596
1597 typedef struct _HAL_POWER_INFORMATION {
1598 ULONG TBD;
1599 } HAL_POWER_INFORMATION, *PHAL_POWER_INFORMATION;
1600
1601 typedef struct _HAL_PROCESSOR_SPEED_INFO {
1602 ULONG ProcessorSpeed;
1603 } HAL_PROCESSOR_SPEED_INFORMATION, *PHAL_PROCESSOR_SPEED_INFORMATION;
1604
1605 typedef struct _HAL_CALLBACKS {
1606 PCALLBACK_OBJECT SetSystemInformation;
1607 PCALLBACK_OBJECT BusCheck;
1608 } HAL_CALLBACKS, *PHAL_CALLBACKS;
1609
1610 typedef struct _HAL_PROCESSOR_FEATURE {
1611 ULONG UsableFeatureBits;
1612 } HAL_PROCESSOR_FEATURE;
1613
1614 typedef NTSTATUS
1615 (NTAPI *PHALIOREADWRITEHANDLER)(
1616 IN BOOLEAN fRead,
1617 IN ULONG dwAddr,
1618 IN ULONG dwSize,
1619 IN OUT PULONG pdwData);
1620
1621 typedef struct _HAL_AMLI_BAD_IO_ADDRESS_LIST {
1622 ULONG BadAddrBegin;
1623 ULONG BadAddrSize;
1624 ULONG OSVersionTrigger;
1625 PHALIOREADWRITEHANDLER IOHandler;
1626 } HAL_AMLI_BAD_IO_ADDRESS_LIST, *PHAL_AMLI_BAD_IO_ADDRESS_LIST;
1627
1628 #if defined(_X86_) || defined(_IA64_) || defined(_AMD64_)
1629
1630 typedef VOID
1631 (NTAPI *PHALMCAINTERFACELOCK)(
1632 VOID);
1633
1634 typedef VOID
1635 (NTAPI *PHALMCAINTERFACEUNLOCK)(
1636 VOID);
1637
1638 typedef NTSTATUS
1639 (NTAPI *PHALMCAINTERFACEREADREGISTER)(
1640 IN UCHAR BankNumber,
1641 IN OUT PVOID Exception);
1642
1643 typedef struct _HAL_MCA_INTERFACE {
1644 PHALMCAINTERFACELOCK Lock;
1645 PHALMCAINTERFACEUNLOCK Unlock;
1646 PHALMCAINTERFACEREADREGISTER ReadRegister;
1647 } HAL_MCA_INTERFACE;
1648
1649 typedef enum {
1650 ApicDestinationModePhysical = 1,
1651 ApicDestinationModeLogicalFlat,
1652 ApicDestinationModeLogicalClustered,
1653 ApicDestinationModeUnknown
1654 } HAL_APIC_DESTINATION_MODE, *PHAL_APIC_DESTINATION_MODE;
1655
1656 #if defined(_AMD64_)
1657
1658 struct _KTRAP_FRAME;
1659 struct _KEXCEPTION_FRAME;
1660
1661 typedef ERROR_SEVERITY
1662 (NTAPI *PDRIVER_EXCPTN_CALLBACK)(
1663 IN PVOID Context,
1664 IN struct _KTRAP_FRAME *TrapFrame,
1665 IN struct _KEXCEPTION_FRAME *ExceptionFrame,
1666 IN PMCA_EXCEPTION Exception);
1667
1668 #endif
1669
1670 #if defined(_X86_) || defined(_IA64_)
1671 typedef
1672 #if defined(_IA64_)
1673 ERROR_SEVERITY
1674 #else
1675 VOID
1676 #endif
1677 (NTAPI *PDRIVER_EXCPTN_CALLBACK)(
1678 IN PVOID Context,
1679 IN PMCA_EXCEPTION BankLog);
1680 #endif
1681
1682 typedef PDRIVER_EXCPTN_CALLBACK PDRIVER_MCA_EXCEPTION_CALLBACK;
1683
1684 typedef struct _MCA_DRIVER_INFO {
1685 PDRIVER_MCA_EXCEPTION_CALLBACK ExceptionCallback;
1686 PKDEFERRED_ROUTINE DpcCallback;
1687 PVOID DeviceContext;
1688 } MCA_DRIVER_INFO, *PMCA_DRIVER_INFO;
1689
1690 typedef struct _HAL_ERROR_INFO {
1691 ULONG Version;
1692 ULONG InitMaxSize;
1693 ULONG McaMaxSize;
1694 ULONG McaPreviousEventsCount;
1695 ULONG McaCorrectedEventsCount;
1696 ULONG McaKernelDeliveryFails;
1697 ULONG McaDriverDpcQueueFails;
1698 ULONG McaReserved;
1699 ULONG CmcMaxSize;
1700 ULONG CmcPollingInterval;
1701 ULONG CmcInterruptsCount;
1702 ULONG CmcKernelDeliveryFails;
1703 ULONG CmcDriverDpcQueueFails;
1704 ULONG CmcGetStateFails;
1705 ULONG CmcClearStateFails;
1706 ULONG CmcReserved;
1707 ULONGLONG CmcLogId;
1708 ULONG CpeMaxSize;
1709 ULONG CpePollingInterval;
1710 ULONG CpeInterruptsCount;
1711 ULONG CpeKernelDeliveryFails;
1712 ULONG CpeDriverDpcQueueFails;
1713 ULONG CpeGetStateFails;
1714 ULONG CpeClearStateFails;
1715 ULONG CpeInterruptSources;
1716 ULONGLONG CpeLogId;
1717 ULONGLONG KernelReserved[4];
1718 } HAL_ERROR_INFO, *PHAL_ERROR_INFO;
1719
1720 #define HAL_MCE_INTERRUPTS_BASED ((ULONG)-1)
1721 #define HAL_MCE_DISABLED ((ULONG)0)
1722
1723 #define HAL_CMC_INTERRUPTS_BASED HAL_MCE_INTERRUPTS_BASED
1724 #define HAL_CMC_DISABLED HAL_MCE_DISABLED
1725
1726 #define HAL_CPE_INTERRUPTS_BASED HAL_MCE_INTERRUPTS_BASED
1727 #define HAL_CPE_DISABLED HAL_MCE_DISABLED
1728
1729 #define HAL_MCA_INTERRUPTS_BASED HAL_MCE_INTERRUPTS_BASED
1730 #define HAL_MCA_DISABLED HAL_MCE_DISABLED
1731
1732 typedef VOID
1733 (NTAPI *PDRIVER_CMC_EXCEPTION_CALLBACK)(
1734 IN PVOID Context,
1735 IN PCMC_EXCEPTION CmcLog);
1736
1737 typedef VOID
1738 (NTAPI *PDRIVER_CPE_EXCEPTION_CALLBACK)(
1739 IN PVOID Context,
1740 IN PCPE_EXCEPTION CmcLog);
1741
1742 typedef struct _CMC_DRIVER_INFO {
1743 PDRIVER_CMC_EXCEPTION_CALLBACK ExceptionCallback;
1744 PKDEFERRED_ROUTINE DpcCallback;
1745 PVOID DeviceContext;
1746 } CMC_DRIVER_INFO, *PCMC_DRIVER_INFO;
1747
1748 typedef struct _CPE_DRIVER_INFO {
1749 PDRIVER_CPE_EXCEPTION_CALLBACK ExceptionCallback;
1750 PKDEFERRED_ROUTINE DpcCallback;
1751 PVOID DeviceContext;
1752 } CPE_DRIVER_INFO, *PCPE_DRIVER_INFO;
1753
1754 #endif // defined(_X86_) || defined(_IA64_) || defined(_AMD64_)
1755
1756 #if defined(_IA64_)
1757
1758 typedef NTSTATUS
1759 (*HALSENDCROSSPARTITIONIPI)(
1760 IN USHORT ProcessorID,
1761 IN UCHAR HardwareVector);
1762
1763 typedef NTSTATUS
1764 (*HALRESERVECROSSPARTITIONINTERRUPTVECTOR)(
1765 OUT PULONG Vector,
1766 OUT PKIRQL Irql,
1767 IN OUT PGROUP_AFFINITY Affinity,
1768 OUT PUCHAR HardwareVector);
1769
1770 typedef VOID
1771 (*HALFREECROSSPARTITIONINTERRUPTVECTOR)(
1772 IN ULONG Vector,
1773 IN PGROUP_AFFINITY Affinity);
1774
1775 typedef struct _HAL_CROSS_PARTITION_IPI_INTERFACE {
1776 HALSENDCROSSPARTITIONIPI HalSendCrossPartitionIpi;
1777 HALRESERVECROSSPARTITIONINTERRUPTVECTOR HalReserveCrossPartitionInterruptVector;
1778 HALFREECROSSPARTITIONINTERRUPTVECTOR HalFreeCrossPartitionInterruptVector;
1779 } HAL_CROSS_PARTITION_IPI_INTERFACE;
1780
1781 #define HAL_CROSS_PARTITION_IPI_INTERFACE_MINIMUM_SIZE \
1782 FIELD_OFFSET(HAL_CROSS_PARTITION_IPI_INTERFACE, \
1783 HalFreeCrossPartitionInterruptVector)
1784
1785 #endif /* defined(_IA64_) */
1786
1787 typedef struct _HAL_PLATFORM_INFORMATION {
1788 ULONG PlatformFlags;
1789 } HAL_PLATFORM_INFORMATION, *PHAL_PLATFORM_INFORMATION;
1790
1791 #define HAL_PLATFORM_DISABLE_WRITE_COMBINING 0x01L
1792 #define HAL_PLATFORM_DISABLE_PTCG 0x04L
1793 #define HAL_PLATFORM_DISABLE_UC_MAIN_MEMORY 0x08L
1794 #define HAL_PLATFORM_ENABLE_WRITE_COMBINING_MMIO 0x10L
1795 #define HAL_PLATFORM_ACPI_TABLES_CACHED 0x20L
1796
1797 /******************************************************************************
1798 * Kernel Types *
1799 ******************************************************************************/
1800
1801 #define NX_SUPPORT_POLICY_ALWAYSOFF 0
1802 #define NX_SUPPORT_POLICY_ALWAYSON 1
1803 #define NX_SUPPORT_POLICY_OPTIN 2
1804 #define NX_SUPPORT_POLICY_OPTOUT 3
1805
1806 typedef VOID
1807 (NTAPI *PEXPAND_STACK_CALLOUT)(
1808 IN PVOID Parameter OPTIONAL);
1809
1810 typedef VOID
1811 (NTAPI *PTIMER_APC_ROUTINE)(
1812 IN PVOID TimerContext,
1813 IN ULONG TimerLowValue,
1814 IN LONG TimerHighValue);
1815
1816 typedef enum _TIMER_SET_INFORMATION_CLASS {
1817 TimerSetCoalescableTimer,
1818 MaxTimerInfoClass
1819 } TIMER_SET_INFORMATION_CLASS;
1820
1821 #if (NTDDI_VERSION >= NTDDI_WIN7)
1822 typedef struct _TIMER_SET_COALESCABLE_TIMER_INFO {
1823 IN LARGE_INTEGER DueTime;
1824 IN PTIMER_APC_ROUTINE TimerApcRoutine OPTIONAL;
1825 IN PVOID TimerContext OPTIONAL;
1826 IN struct _COUNTED_REASON_CONTEXT *WakeContext OPTIONAL;
1827 IN ULONG Period OPTIONAL;
1828 IN ULONG TolerableDelay;
1829 OUT PBOOLEAN PreviousState OPTIONAL;
1830 } TIMER_SET_COALESCABLE_TIMER_INFO, *PTIMER_SET_COALESCABLE_TIMER_INFO;
1831 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
1832
1833 #define XSTATE_LEGACY_FLOATING_POINT 0
1834 #define XSTATE_LEGACY_SSE 1
1835 #define XSTATE_GSSE 2
1836
1837 #define XSTATE_MASK_LEGACY_FLOATING_POINT (1i64 << (XSTATE_LEGACY_FLOATING_POINT))
1838 #define XSTATE_MASK_LEGACY_SSE (1i64 << (XSTATE_LEGACY_SSE))
1839 #define XSTATE_MASK_LEGACY (XSTATE_MASK_LEGACY_FLOATING_POINT | XSTATE_MASK_LEGACY_SSE)
1840 #define XSTATE_MASK_GSSE (1i64 << (XSTATE_GSSE))
1841
1842 #define MAXIMUM_XSTATE_FEATURES 64
1843
1844 typedef struct _XSTATE_FEATURE {
1845 ULONG Offset;
1846 ULONG Size;
1847 } XSTATE_FEATURE, *PXSTATE_FEATURE;
1848
1849 typedef struct _XSTATE_CONFIGURATION {
1850 ULONG64 EnabledFeatures;
1851 ULONG Size;
1852 ULONG OptimizedSave:1;
1853 XSTATE_FEATURE Features[MAXIMUM_XSTATE_FEATURES];
1854 } XSTATE_CONFIGURATION, *PXSTATE_CONFIGURATION;
1855
1856 #define MAX_WOW64_SHARED_ENTRIES 16
1857
1858 typedef struct _KUSER_SHARED_DATA {
1859 ULONG TickCountLowDeprecated;
1860 ULONG TickCountMultiplier;
1861 volatile KSYSTEM_TIME InterruptTime;
1862 volatile KSYSTEM_TIME SystemTime;
1863 volatile KSYSTEM_TIME TimeZoneBias;
1864 USHORT ImageNumberLow;
1865 USHORT ImageNumberHigh;
1866 WCHAR NtSystemRoot[260];
1867 ULONG MaxStackTraceDepth;
1868 ULONG CryptoExponent;
1869 ULONG TimeZoneId;
1870 ULONG LargePageMinimum;
1871 ULONG Reserved2[7];
1872 NT_PRODUCT_TYPE NtProductType;
1873 BOOLEAN ProductTypeIsValid;
1874 ULONG NtMajorVersion;
1875 ULONG NtMinorVersion;
1876 BOOLEAN ProcessorFeatures[PROCESSOR_FEATURE_MAX];
1877 ULONG Reserved1;
1878 ULONG Reserved3;
1879 volatile ULONG TimeSlip;
1880 ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture;
1881 ULONG AltArchitecturePad[1];
1882 LARGE_INTEGER SystemExpirationDate;
1883 ULONG SuiteMask;
1884 BOOLEAN KdDebuggerEnabled;
1885 #if (NTDDI_VERSION >= NTDDI_WINXPSP2)
1886 UCHAR NXSupportPolicy;
1887 #endif
1888 volatile ULONG ActiveConsoleId;
1889 volatile ULONG DismountCount;
1890 ULONG ComPlusPackage;
1891 ULONG LastSystemRITEventTickCount;
1892 ULONG NumberOfPhysicalPages;
1893 BOOLEAN SafeBootMode;
1894 #if (NTDDI_VERSION >= NTDDI_WIN7)
1895 union {
1896 UCHAR TscQpcData;
1897 struct {
1898 UCHAR TscQpcEnabled:1;
1899 UCHAR TscQpcSpareFlag:1;
1900 UCHAR TscQpcShift:6;
1901 } DUMMYSTRUCTNAME;
1902 } DUMMYUNIONNAME;
1903 UCHAR TscQpcPad[2];
1904 #endif
1905 #if (NTDDI_VERSION >= NTDDI_VISTA)
1906 union {
1907 ULONG SharedDataFlags;
1908 struct {
1909 ULONG DbgErrorPortPresent:1;
1910 ULONG DbgElevationEnabled:1;
1911 ULONG DbgVirtEnabled:1;
1912 ULONG DbgInstallerDetectEnabled:1;
1913 ULONG DbgSystemDllRelocated:1;
1914 ULONG DbgDynProcessorEnabled:1;
1915 ULONG DbgSEHValidationEnabled:1;
1916 ULONG SpareBits:25;
1917 } DUMMYSTRUCTNAME2;
1918 } DUMMYUNIONNAME2;
1919 #else
1920 ULONG TraceLogging;
1921 #endif
1922 ULONG DataFlagsPad[1];
1923 ULONGLONG TestRetInstruction;
1924 ULONG SystemCall;
1925 ULONG SystemCallReturn;
1926 ULONGLONG SystemCallPad[3];
1927 _ANONYMOUS_UNION union {
1928 volatile KSYSTEM_TIME TickCount;
1929 volatile ULONG64 TickCountQuad;
1930 _ANONYMOUS_STRUCT struct {
1931 ULONG ReservedTickCountOverlay[3];
1932 ULONG TickCountPad[1];
1933 } DUMMYSTRUCTNAME;
1934 } DUMMYUNIONNAME3;
1935 ULONG Cookie;
1936 ULONG CookiePad[1];
1937 #if (NTDDI_VERSION >= NTDDI_WS03)
1938 LONGLONG ConsoleSessionForegroundProcessId;
1939 ULONG Wow64SharedInformation[MAX_WOW64_SHARED_ENTRIES];
1940 #endif
1941 #if (NTDDI_VERSION >= NTDDI_VISTA)
1942 #if (NTDDI_VERSION >= NTDDI_WIN7)
1943 USHORT UserModeGlobalLogger[16];
1944 #else
1945 USHORT UserModeGlobalLogger[8];
1946 ULONG HeapTracingPid[2];
1947 ULONG CritSecTracingPid[2];
1948 #endif
1949 ULONG ImageFileExecutionOptions;
1950 #if (NTDDI_VERSION >= NTDDI_VISTASP1)
1951 ULONG LangGenerationCount;
1952 #else
1953 /* 4 bytes padding */
1954 #endif
1955 ULONGLONG Reserved5;
1956 volatile ULONG64 InterruptTimeBias;
1957 #endif
1958 #if (NTDDI_VERSION >= NTDDI_WIN7)
1959 volatile ULONG64 TscQpcBias;
1960 volatile ULONG ActiveProcessorCount;
1961 volatile USHORT ActiveGroupCount;
1962 USHORT Reserved4;
1963 volatile ULONG AitSamplingValue;
1964 volatile ULONG AppCompatFlag;
1965 ULONGLONG SystemDllNativeRelocation;
1966 ULONG SystemDllWowRelocation;
1967 ULONG XStatePad[1];
1968 XSTATE_CONFIGURATION XState;
1969 #endif
1970 } KUSER_SHARED_DATA, *PKUSER_SHARED_DATA;
1971
1972 #if (NTDDI_VERSION >= NTDDI_VISTA)
1973 extern NTSYSAPI volatile CCHAR KeNumberProcessors;
1974 #elif (NTDDI_VERSION >= NTDDI_WINXP)
1975 extern NTSYSAPI CCHAR KeNumberProcessors;
1976 #else
1977 extern PCCHAR KeNumberProcessors;
1978 #endif
1979
1980
1981 /******************************************************************************
1982 * Kernel Debugger Types *
1983 ******************************************************************************/
1984 typedef struct _DEBUG_DEVICE_ADDRESS {
1985 UCHAR Type;
1986 BOOLEAN Valid;
1987 UCHAR Reserved[2];
1988 PUCHAR TranslatedAddress;
1989 ULONG Length;
1990 } DEBUG_DEVICE_ADDRESS, *PDEBUG_DEVICE_ADDRESS;
1991
1992 typedef struct _DEBUG_MEMORY_REQUIREMENTS {
1993 PHYSICAL_ADDRESS Start;
1994 PHYSICAL_ADDRESS MaxEnd;
1995 PVOID VirtualAddress;
1996 ULONG Length;
1997 BOOLEAN Cached;
1998 BOOLEAN Aligned;
1999 } DEBUG_MEMORY_REQUIREMENTS, *PDEBUG_MEMORY_REQUIREMENTS;
2000
2001 typedef struct _DEBUG_DEVICE_DESCRIPTOR {
2002 ULONG Bus;
2003 ULONG Slot;
2004 USHORT Segment;
2005 USHORT VendorID;
2006 USHORT DeviceID;
2007 UCHAR BaseClass;
2008 UCHAR SubClass;
2009 UCHAR ProgIf;
2010 BOOLEAN Initialized;
2011 BOOLEAN Configured;
2012 DEBUG_DEVICE_ADDRESS BaseAddress[6];
2013 DEBUG_MEMORY_REQUIREMENTS Memory;
2014 } DEBUG_DEVICE_DESCRIPTOR, *PDEBUG_DEVICE_DESCRIPTOR;
2015
2016 typedef NTSTATUS
2017 (NTAPI *pKdSetupPciDeviceForDebugging)(
2018 IN PVOID LoaderBlock OPTIONAL,
2019 IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice);
2020
2021 typedef NTSTATUS
2022 (NTAPI *pKdReleasePciDeviceForDebugging)(
2023 IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice);
2024
2025 typedef PVOID
2026 (NTAPI *pKdGetAcpiTablePhase0)(
2027 IN struct _LOADER_PARAMETER_BLOCK *LoaderBlock,
2028 IN ULONG Signature);
2029
2030 typedef VOID
2031 (NTAPI *pKdCheckPowerButton)(
2032 VOID);
2033
2034 #if (NTDDI_VERSION >= NTDDI_VISTA)
2035 typedef PVOID
2036 (NTAPI *pKdMapPhysicalMemory64)(
2037 IN PHYSICAL_ADDRESS PhysicalAddress,
2038 IN ULONG NumberPages,
2039 IN BOOLEAN FlushCurrentTLB);
2040
2041 typedef VOID
2042 (NTAPI *pKdUnmapVirtualAddress)(
2043 IN PVOID VirtualAddress,
2044 IN ULONG NumberPages,
2045 IN BOOLEAN FlushCurrentTLB);
2046 #else
2047 typedef PVOID
2048 (NTAPI *pKdMapPhysicalMemory64)(
2049 IN PHYSICAL_ADDRESS PhysicalAddress,
2050 IN ULONG NumberPages);
2051
2052 typedef VOID
2053 (NTAPI *pKdUnmapVirtualAddress)(
2054 IN PVOID VirtualAddress,
2055 IN ULONG NumberPages);
2056 #endif
2057
2058 typedef ULONG
2059 (NTAPI *pKdGetPciDataByOffset)(
2060 IN ULONG BusNumber,
2061 IN ULONG SlotNumber,
2062 OUT PVOID Buffer,
2063 IN ULONG Offset,
2064 IN ULONG Length);
2065
2066 typedef ULONG
2067 (NTAPI *pKdSetPciDataByOffset)(
2068 IN ULONG BusNumber,
2069 IN ULONG SlotNumber,
2070 IN PVOID Buffer,
2071 IN ULONG Offset,
2072 IN ULONG Length);
2073 /******************************************************************************
2074 * Memory manager Types *
2075 ******************************************************************************/
2076
2077 typedef struct _PHYSICAL_MEMORY_RANGE {
2078 PHYSICAL_ADDRESS BaseAddress;
2079 LARGE_INTEGER NumberOfBytes;
2080 } PHYSICAL_MEMORY_RANGE, *PPHYSICAL_MEMORY_RANGE;
2081
2082 typedef NTSTATUS
2083 (NTAPI *PMM_ROTATE_COPY_CALLBACK_FUNCTION)(
2084 IN PMDL DestinationMdl,
2085 IN PMDL SourceMdl,
2086 IN PVOID Context);
2087
2088 typedef enum _MM_ROTATE_DIRECTION {
2089 MmToFrameBuffer,
2090 MmToFrameBufferNoCopy,
2091 MmToRegularMemory,
2092 MmToRegularMemoryNoCopy,
2093 MmMaximumRotateDirection
2094 } MM_ROTATE_DIRECTION, *PMM_ROTATE_DIRECTION;
2095
2096
2097 /******************************************************************************
2098 * Process Manager Types *
2099 ******************************************************************************/
2100
2101 #define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001
2102 #define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002
2103 #define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004
2104 #define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008
2105 #define QUOTA_LIMITS_USE_DEFAULT_LIMITS 0x00000010
2106
2107 typedef struct _QUOTA_LIMITS {
2108 SIZE_T PagedPoolLimit;
2109 SIZE_T NonPagedPoolLimit;
2110 SIZE_T MinimumWorkingSetSize;
2111 SIZE_T MaximumWorkingSetSize;
2112 SIZE_T PagefileLimit;
2113 LARGE_INTEGER TimeLimit;
2114 } QUOTA_LIMITS, *PQUOTA_LIMITS;
2115
2116 typedef union _RATE_QUOTA_LIMIT {
2117 ULONG RateData;
2118 struct {
2119 ULONG RatePercent:7;
2120 ULONG Reserved0:25;
2121 } DUMMYSTRUCTNAME;
2122 } RATE_QUOTA_LIMIT, *PRATE_QUOTA_LIMIT;
2123
2124 typedef struct _QUOTA_LIMITS_EX {
2125 SIZE_T PagedPoolLimit;
2126 SIZE_T NonPagedPoolLimit;
2127 SIZE_T MinimumWorkingSetSize;
2128 SIZE_T MaximumWorkingSetSize;
2129 SIZE_T PagefileLimit;
2130 LARGE_INTEGER TimeLimit;
2131 SIZE_T WorkingSetLimit;
2132 SIZE_T Reserved2;
2133 SIZE_T Reserved3;
2134 SIZE_T Reserved4;
2135 ULONG Flags;
2136 RATE_QUOTA_LIMIT CpuRateLimit;
2137 } QUOTA_LIMITS_EX, *PQUOTA_LIMITS_EX;
2138
2139 typedef struct _IO_COUNTERS {
2140 ULONGLONG ReadOperationCount;
2141 ULONGLONG WriteOperationCount;
2142 ULONGLONG OtherOperationCount;
2143 ULONGLONG ReadTransferCount;
2144 ULONGLONG WriteTransferCount;
2145 ULONGLONG OtherTransferCount;
2146 } IO_COUNTERS, *PIO_COUNTERS;
2147
2148 typedef struct _VM_COUNTERS {
2149 SIZE_T PeakVirtualSize;
2150 SIZE_T VirtualSize;
2151 ULONG PageFaultCount;
2152 SIZE_T PeakWorkingSetSize;
2153 SIZE_T WorkingSetSize;
2154 SIZE_T QuotaPeakPagedPoolUsage;
2155 SIZE_T QuotaPagedPoolUsage;
2156 SIZE_T QuotaPeakNonPagedPoolUsage;
2157 SIZE_T QuotaNonPagedPoolUsage;
2158 SIZE_T PagefileUsage;
2159 SIZE_T PeakPagefileUsage;
2160 } VM_COUNTERS, *PVM_COUNTERS;
2161
2162 typedef struct _VM_COUNTERS_EX {
2163 SIZE_T PeakVirtualSize;
2164 SIZE_T VirtualSize;
2165 ULONG PageFaultCount;
2166 SIZE_T PeakWorkingSetSize;
2167 SIZE_T WorkingSetSize;
2168 SIZE_T QuotaPeakPagedPoolUsage;
2169 SIZE_T QuotaPagedPoolUsage;
2170 SIZE_T QuotaPeakNonPagedPoolUsage;
2171 SIZE_T QuotaNonPagedPoolUsage;
2172 SIZE_T PagefileUsage;
2173 SIZE_T PeakPagefileUsage;
2174 SIZE_T PrivateUsage;
2175 } VM_COUNTERS_EX, *PVM_COUNTERS_EX;
2176
2177 #define MAX_HW_COUNTERS 16
2178 #define THREAD_PROFILING_FLAG_DISPATCH 0x00000001
2179
2180 typedef enum _HARDWARE_COUNTER_TYPE {
2181 PMCCounter,
2182 MaxHardwareCounterType
2183 } HARDWARE_COUNTER_TYPE, *PHARDWARE_COUNTER_TYPE;
2184
2185 typedef struct _HARDWARE_COUNTER {
2186 HARDWARE_COUNTER_TYPE Type;
2187 ULONG Reserved;
2188 ULONG64 Index;
2189 } HARDWARE_COUNTER, *PHARDWARE_COUNTER;
2190
2191 typedef struct _POOLED_USAGE_AND_LIMITS {
2192 SIZE_T PeakPagedPoolUsage;
2193 SIZE_T PagedPoolUsage;
2194 SIZE_T PagedPoolLimit;
2195 SIZE_T PeakNonPagedPoolUsage;
2196 SIZE_T NonPagedPoolUsage;
2197 SIZE_T NonPagedPoolLimit;
2198 SIZE_T PeakPagefileUsage;
2199 SIZE_T PagefileUsage;
2200 SIZE_T PagefileLimit;
2201 } POOLED_USAGE_AND_LIMITS, *PPOOLED_USAGE_AND_LIMITS;
2202
2203 typedef struct _PROCESS_ACCESS_TOKEN {
2204 HANDLE Token;
2205 HANDLE Thread;
2206 } PROCESS_ACCESS_TOKEN, *PPROCESS_ACCESS_TOKEN;
2207
2208 #define PROCESS_EXCEPTION_PORT_ALL_STATE_BITS 0x00000003UL
2209 #define PROCESS_EXCEPTION_PORT_ALL_STATE_FLAGS ((ULONG_PTR)((1UL << PROCESS_EXCEPTION_PORT_ALL_STATE_BITS) - 1))
2210
2211 typedef struct _PROCESS_EXCEPTION_PORT {
2212 IN HANDLE ExceptionPortHandle;
2213 IN OUT ULONG StateFlags;
2214 } PROCESS_EXCEPTION_PORT, *PPROCESS_EXCEPTION_PORT;
2215
2216 typedef VOID
2217 (NTAPI *PCREATE_PROCESS_NOTIFY_ROUTINE)(
2218 IN HANDLE ParentId,
2219 IN HANDLE ProcessId,
2220 IN BOOLEAN Create);
2221
2222 typedef struct _PS_CREATE_NOTIFY_INFO {
2223 IN SIZE_T Size;
2224 union {
2225 IN ULONG Flags;
2226 struct {
2227 IN ULONG FileOpenNameAvailable:1;
2228 IN ULONG Reserved:31;
2229 };
2230 };
2231 IN HANDLE ParentProcessId;
2232 IN CLIENT_ID CreatingThreadId;
2233 IN OUT struct _FILE_OBJECT *FileObject;
2234 IN PCUNICODE_STRING ImageFileName;
2235 IN PCUNICODE_STRING CommandLine OPTIONAL;
2236 IN OUT NTSTATUS CreationStatus;
2237 } PS_CREATE_NOTIFY_INFO, *PPS_CREATE_NOTIFY_INFO;
2238
2239 typedef VOID
2240 (NTAPI *PCREATE_PROCESS_NOTIFY_ROUTINE_EX)(
2241 IN OUT PEPROCESS Process,
2242 IN HANDLE ProcessId,
2243 IN PPS_CREATE_NOTIFY_INFO CreateInfo OPTIONAL);
2244
2245 typedef VOID
2246 (NTAPI *PCREATE_THREAD_NOTIFY_ROUTINE)(
2247 IN HANDLE ProcessId,
2248 IN HANDLE ThreadId,
2249 IN BOOLEAN Create);
2250
2251 #define IMAGE_ADDRESSING_MODE_32BIT 3
2252
2253 typedef struct _IMAGE_INFO {
2254 _ANONYMOUS_UNION union {
2255 ULONG Properties;
2256 _ANONYMOUS_STRUCT struct {
2257 ULONG ImageAddressingMode:8;
2258 ULONG SystemModeImage:1;
2259 ULONG ImageMappedToAllPids:1;
2260 ULONG ExtendedInfoPresent:1;
2261 ULONG Reserved:21;
2262 } DUMMYSTRUCTNAME;
2263 } DUMMYUNIONNAME;
2264 PVOID ImageBase;
2265 ULONG ImageSelector;
2266 SIZE_T ImageSize;
2267 ULONG ImageSectionNumber;
2268 } IMAGE_INFO, *PIMAGE_INFO;
2269
2270 typedef struct _IMAGE_INFO_EX {
2271 SIZE_T Size;
2272 IMAGE_INFO ImageInfo;
2273 struct _FILE_OBJECT *FileObject;
2274 } IMAGE_INFO_EX, *PIMAGE_INFO_EX;
2275
2276 typedef VOID
2277 (NTAPI *PLOAD_IMAGE_NOTIFY_ROUTINE)(
2278 IN PUNICODE_STRING FullImageName,
2279 IN HANDLE ProcessId,
2280 IN PIMAGE_INFO ImageInfo);
2281
2282 #define THREAD_CSWITCH_PMU_DISABLE FALSE
2283 #define THREAD_CSWITCH_PMU_ENABLE TRUE
2284
2285 #define PROCESS_LUID_DOSDEVICES_ONLY 0x00000001
2286
2287 #define PROCESS_HANDLE_TRACING_MAX_STACKS 16
2288
2289 typedef struct _NT_TIB {
2290 struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
2291 PVOID StackBase;
2292 PVOID StackLimit;
2293 PVOID SubSystemTib;
2294 _ANONYMOUS_UNION union {
2295 PVOID FiberData;
2296 ULONG Version;
2297 } DUMMYUNIONNAME;
2298 PVOID ArbitraryUserPointer;
2299 struct _NT_TIB *Self;
2300 } NT_TIB, *PNT_TIB;
2301
2302 typedef struct _NT_TIB32 {
2303 ULONG ExceptionList;
2304 ULONG StackBase;
2305 ULONG StackLimit;
2306 ULONG SubSystemTib;
2307 __GNU_EXTENSION union {
2308 ULONG FiberData;
2309 ULONG Version;
2310 };
2311 ULONG ArbitraryUserPointer;
2312 ULONG Self;
2313 } NT_TIB32,*PNT_TIB32;
2314
2315 typedef struct _NT_TIB64 {
2316 ULONG64 ExceptionList;
2317 ULONG64 StackBase;
2318 ULONG64 StackLimit;
2319 ULONG64 SubSystemTib;
2320 __GNU_EXTENSION union {
2321 ULONG64 FiberData;
2322 ULONG Version;
2323 };
2324 ULONG64 ArbitraryUserPointer;
2325 ULONG64 Self;
2326 } NT_TIB64,*PNT_TIB64;
2327
2328 typedef enum _PROCESSINFOCLASS {
2329 ProcessBasicInformation,
2330 ProcessQuotaLimits,
2331 ProcessIoCounters,
2332 ProcessVmCounters,
2333 ProcessTimes,
2334 ProcessBasePriority,
2335 ProcessRaisePriority,
2336 ProcessDebugPort,
2337 ProcessExceptionPort,
2338 ProcessAccessToken,
2339 ProcessLdtInformation,
2340 ProcessLdtSize,
2341 ProcessDefaultHardErrorMode,
2342 ProcessIoPortHandlers,
2343 ProcessPooledUsageAndLimits,
2344 ProcessWorkingSetWatch,
2345 ProcessUserModeIOPL,
2346 ProcessEnableAlignmentFaultFixup,
2347 ProcessPriorityClass,
2348 ProcessWx86Information,
2349 ProcessHandleCount,
2350 ProcessAffinityMask,
2351 ProcessPriorityBoost,
2352 ProcessDeviceMap,
2353 ProcessSessionInformation,
2354 ProcessForegroundInformation,
2355 ProcessWow64Information,
2356 ProcessImageFileName,
2357 ProcessLUIDDeviceMapsEnabled,
2358 ProcessBreakOnTermination,
2359 ProcessDebugObjectHandle,
2360 ProcessDebugFlags,
2361 ProcessHandleTracing,
2362 ProcessIoPriority,
2363 ProcessExecuteFlags,
2364 ProcessTlsInformation,
2365 ProcessCookie,
2366 ProcessImageInformation,
2367 ProcessCycleTime,
2368 ProcessPagePriority,
2369 ProcessInstrumentationCallback,
2370 ProcessThreadStackAllocation,
2371 ProcessWorkingSetWatchEx,
2372 ProcessImageFileNameWin32,
2373 ProcessImageFileMapping,
2374 ProcessAffinityUpdateMode,
2375 ProcessMemoryAllocationMode,
2376 ProcessGroupInformation,
2377 ProcessTokenVirtualizationEnabled,
2378 ProcessConsoleHostProcess,
2379 ProcessWindowInformation,
2380 MaxProcessInfoClass
2381 } PROCESSINFOCLASS;
2382
2383 typedef enum _THREADINFOCLASS {
2384 ThreadBasicInformation,
2385 ThreadTimes,
2386 ThreadPriority,
2387 ThreadBasePriority,
2388 ThreadAffinityMask,
2389 ThreadImpersonationToken,
2390 ThreadDescriptorTableEntry,
2391 ThreadEnableAlignmentFaultFixup,
2392 ThreadEventPair_Reusable,
2393 ThreadQuerySetWin32StartAddress,
2394 ThreadZeroTlsCell,
2395 ThreadPerformanceCount,
2396 ThreadAmILastThread,
2397 ThreadIdealProcessor,
2398 ThreadPriorityBoost,
2399 ThreadSetTlsArrayAddress,
2400 ThreadIsIoPending,
2401 ThreadHideFromDebugger,
2402 ThreadBreakOnTermination,
2403 ThreadSwitchLegacyState,
2404 ThreadIsTerminated,
2405 ThreadLastSystemCall,
2406 ThreadIoPriority,
2407 ThreadCycleTime,
2408 ThreadPagePriority,
2409 ThreadActualBasePriority,
2410 ThreadTebInformation,
2411 ThreadCSwitchMon,
2412 ThreadCSwitchPmu,
2413 ThreadWow64Context,
2414 ThreadGroupInformation,
2415 ThreadUmsInformation,
2416 ThreadCounterProfiling,
2417 ThreadIdealProcessorEx,
2418 MaxThreadInfoClass
2419 } THREADINFOCLASS;
2420
2421 typedef struct _PAGE_PRIORITY_INFORMATION {
2422 ULONG PagePriority;
2423 } PAGE_PRIORITY_INFORMATION, *PPAGE_PRIORITY_INFORMATION;
2424
2425 typedef struct _PROCESS_WS_WATCH_INFORMATION {
2426 PVOID FaultingPc;
2427 PVOID FaultingVa;
2428 } PROCESS_WS_WATCH_INFORMATION, *PPROCESS_WS_WATCH_INFORMATION;
2429
2430 typedef struct _PROCESS_BASIC_INFORMATION {
2431 NTSTATUS ExitStatus;
2432 struct _PEB *PebBaseAddress;
2433 ULONG_PTR AffinityMask;
2434 KPRIORITY BasePriority;
2435 ULONG_PTR UniqueProcessId;
2436 ULONG_PTR InheritedFromUniqueProcessId;
2437 } PROCESS_BASIC_INFORMATION,*PPROCESS_BASIC_INFORMATION;
2438
2439 typedef struct _PROCESS_EXTENDED_BASIC_INFORMATION {
2440 SIZE_T Size;
2441 PROCESS_BASIC_INFORMATION BasicInfo;
2442 union {
2443 ULONG Flags;
2444 struct {
2445 ULONG IsProtectedProcess:1;
2446 ULONG IsWow64Process:1;
2447 ULONG IsProcessDeleting:1;
2448 ULONG IsCrossSessionCreate:1;
2449 ULONG SpareBits:28;
2450 } DUMMYSTRUCTNAME;
2451 } DUMMYUNIONNAME;
2452 } PROCESS_EXTENDED_BASIC_INFORMATION, *PPROCESS_EXTENDED_BASIC_INFORMATION;
2453
2454 typedef struct _PROCESS_DEVICEMAP_INFORMATION {
2455 __GNU_EXTENSION union {
2456 struct {
2457 HANDLE DirectoryHandle;
2458 } Set;
2459 struct {
2460 ULONG DriveMap;
2461 UCHAR DriveType[32];
2462 } Query;
2463 };
2464 } PROCESS_DEVICEMAP_INFORMATION, *PPROCESS_DEVICEMAP_INFORMATION;
2465
2466 typedef struct _PROCESS_DEVICEMAP_INFORMATION_EX {
2467 union {
2468 struct {
2469 HANDLE DirectoryHandle;
2470 } Set;
2471 struct {
2472 ULONG DriveMap;
2473 UCHAR DriveType[32];
2474 } Query;
2475 } DUMMYUNIONNAME;
2476 ULONG Flags;
2477 } PROCESS_DEVICEMAP_INFORMATION_EX, *PPROCESS_DEVICEMAP_INFORMATION_EX;
2478
2479 typedef struct _PROCESS_SESSION_INFORMATION {
2480 ULONG SessionId;
2481 } PROCESS_SESSION_INFORMATION, *PPROCESS_SESSION_INFORMATION;
2482
2483 typedef struct _PROCESS_HANDLE_TRACING_ENABLE {
2484 ULONG Flags;
2485 } PROCESS_HANDLE_TRACING_ENABLE, *PPROCESS_HANDLE_TRACING_ENABLE;
2486
2487 typedef struct _PROCESS_HANDLE_TRACING_ENABLE_EX {
2488 ULONG Flags;
2489 ULONG TotalSlots;
2490 } PROCESS_HANDLE_TRACING_ENABLE_EX, *PPROCESS_HANDLE_TRACING_ENABLE_EX;
2491
2492 typedef struct _PROCESS_HANDLE_TRACING_ENTRY {
2493 HANDLE Handle;
2494 CLIENT_ID ClientId;
2495 ULONG Type;
2496 PVOID Stacks[PROCESS_HANDLE_TRACING_MAX_STACKS];
2497 } PROCESS_HANDLE_TRACING_ENTRY, *PPROCESS_HANDLE_TRACING_ENTRY;
2498
2499 typedef struct _PROCESS_HANDLE_TRACING_QUERY {
2500 HANDLE Handle;
2501 ULONG TotalTraces;
2502 PROCESS_HANDLE_TRACING_ENTRY HandleTrace[1];
2503 } PROCESS_HANDLE_TRACING_QUERY, *PPROCESS_HANDLE_TRACING_QUERY;
2504
2505 extern NTKERNELAPI PEPROCESS PsInitialSystemProcess;
2506
2507
2508 /******************************************************************************
2509 * Runtime Library Types *
2510 ******************************************************************************/
2511
2512
2513
2514 #ifndef _RTL_RUN_ONCE_DEF
2515 #define _RTL_RUN_ONCE_DEF
2516
2517 #define RTL_RUN_ONCE_INIT {0}
2518
2519 #define RTL_RUN_ONCE_CHECK_ONLY 0x00000001UL
2520 #define RTL_RUN_ONCE_ASYNC 0x00000002UL
2521 #define RTL_RUN_ONCE_INIT_FAILED 0x00000004UL
2522
2523 #define RTL_RUN_ONCE_CTX_RESERVED_BITS 2
2524
2525 #define RTL_HASH_ALLOCATED_HEADER 0x00000001
2526
2527 #define RTL_HASH_RESERVED_SIGNATURE 0
2528
2529 /* RtlVerifyVersionInfo() ComparisonType */
2530
2531 #define VER_EQUAL 1
2532 #define VER_GREATER 2
2533 #define VER_GREATER_EQUAL 3
2534 #define VER_LESS 4
2535 #define VER_LESS_EQUAL 5
2536 #define VER_AND 6
2537 #define VER_OR 7
2538
2539 #define VER_CONDITION_MASK 7
2540 #define VER_NUM_BITS_PER_CONDITION_MASK 3
2541
2542 /* RtlVerifyVersionInfo() TypeMask */
2543
2544 #define VER_MINORVERSION 0x0000001
2545 #define VER_MAJORVERSION 0x0000002
2546 #define VER_BUILDNUMBER 0x0000004
2547 #define VER_PLATFORMID 0x0000008
2548 #define VER_SERVICEPACKMINOR 0x0000010
2549 #define VER_SERVICEPACKMAJOR 0x0000020
2550 #define VER_SUITENAME 0x0000040
2551 #define VER_PRODUCT_TYPE 0x0000080
2552
2553 #define VER_NT_WORKSTATION 0x0000001
2554 #define VER_NT_DOMAIN_CONTROLLER 0x0000002
2555 #define VER_NT_SERVER 0x0000003
2556
2557 #define VER_PLATFORM_WIN32s 0
2558 #define VER_PLATFORM_WIN32_WINDOWS 1
2559 #define VER_PLATFORM_WIN32_NT 2
2560
2561 typedef union _RTL_RUN_ONCE {
2562 PVOID Ptr;
2563 } RTL_RUN_ONCE, *PRTL_RUN_ONCE;
2564
2565 typedef ULONG /* LOGICAL */
2566 (NTAPI *PRTL_RUN_ONCE_INIT_FN) (
2567 IN OUT PRTL_RUN_ONCE RunOnce,
2568 IN OUT PVOID Parameter OPTIONAL,
2569 IN OUT PVOID *Context OPTIONAL);
2570
2571 #endif /* _RTL_RUN_ONCE_DEF */
2572
2573 typedef enum _TABLE_SEARCH_RESULT {
2574 TableEmptyTree,
2575 TableFoundNode,
2576 TableInsertAsLeft,
2577 TableInsertAsRight
2578 } TABLE_SEARCH_RESULT;
2579
2580 typedef enum _RTL_GENERIC_COMPARE_RESULTS {
2581 GenericLessThan,
2582 GenericGreaterThan,
2583 GenericEqual
2584 } RTL_GENERIC_COMPARE_RESULTS;
2585
2586 // Forwarder
2587 struct _RTL_AVL_TABLE;
2588
2589 typedef RTL_GENERIC_COMPARE_RESULTS
2590 (NTAPI *PRTL_AVL_COMPARE_ROUTINE) (
2591 IN struct _RTL_AVL_TABLE *Table,
2592 IN PVOID FirstStruct,
2593 IN PVOID SecondStruct);
2594
2595 typedef PVOID
2596 (NTAPI *PRTL_AVL_ALLOCATE_ROUTINE) (
2597 IN struct _RTL_AVL_TABLE *Table,
2598 IN CLONG ByteSize);
2599
2600 typedef VOID
2601 (NTAPI *PRTL_AVL_FREE_ROUTINE) (
2602 IN struct _RTL_AVL_TABLE *Table,
2603 IN PVOID Buffer);
2604
2605 typedef NTSTATUS
2606 (NTAPI *PRTL_AVL_MATCH_FUNCTION) (
2607 IN struct _RTL_AVL_TABLE *Table,
2608 IN PVOID UserData,
2609 IN PVOID MatchData);
2610
2611 typedef struct _RTL_BALANCED_LINKS {
2612 struct _RTL_BALANCED_LINKS *Parent;
2613 struct _RTL_BALANCED_LINKS *LeftChild;
2614 struct _RTL_BALANCED_LINKS *RightChild;
2615 CHAR Balance;
2616 UCHAR Reserved[3];
2617 } RTL_BALANCED_LINKS, *PRTL_BALANCED_LINKS;
2618
2619 typedef struct _RTL_AVL_TABLE {
2620 RTL_BALANCED_LINKS BalancedRoot;
2621 PVOID OrderedPointer;
2622 ULONG WhichOrderedElement;
2623 ULONG NumberGenericTableElements;
2624 ULONG DepthOfTree;
2625 PRTL_BALANCED_LINKS RestartKey;
2626 ULONG DeleteCount;
2627 PRTL_AVL_COMPARE_ROUTINE CompareRoutine;
2628 PRTL_AVL_ALLOCATE_ROUTINE AllocateRoutine;
2629 PRTL_AVL_FREE_ROUTINE FreeRoutine;
2630 PVOID TableContext;
2631 } RTL_AVL_TABLE, *PRTL_AVL_TABLE;
2632
2633 #ifndef RTL_USE_AVL_TABLES
2634
2635 struct _RTL_GENERIC_TABLE;
2636
2637 typedef RTL_GENERIC_COMPARE_RESULTS
2638 (NTAPI *PRTL_GENERIC_COMPARE_ROUTINE) (
2639 IN struct _RTL_GENERIC_TABLE *Table,
2640 IN PVOID FirstStruct,
2641 IN PVOID SecondStruct);
2642
2643 typedef PVOID
2644 (NTAPI *PRTL_GENERIC_ALLOCATE_ROUTINE) (
2645 IN struct _RTL_GENERIC_TABLE *Table,
2646 IN CLONG ByteSize);
2647
2648 typedef VOID
2649 (NTAPI *PRTL_GENERIC_FREE_ROUTINE) (
2650 IN struct _RTL_GENERIC_TABLE *Table,
2651 IN PVOID Buffer);
2652
2653 typedef struct _RTL_SPLAY_LINKS {
2654 struct _RTL_SPLAY_LINKS *Parent;
2655 struct _RTL_SPLAY_LINKS *LeftChild;
2656 struct _RTL_SPLAY_LINKS *RightChild;
2657 } RTL_SPLAY_LINKS, *PRTL_SPLAY_LINKS;
2658
2659 typedef struct _RTL_GENERIC_TABLE {
2660 PRTL_SPLAY_LINKS TableRoot;
2661 LIST_ENTRY InsertOrderList;
2662 PLIST_ENTRY OrderedPointer;
2663 ULONG WhichOrderedElement;
2664 ULONG NumberGenericTableElements;
2665 PRTL_GENERIC_COMPARE_ROUTINE CompareRoutine;
2666 PRTL_GENERIC_ALLOCATE_ROUTINE AllocateRoutine;
2667 PRTL_GENERIC_FREE_ROUTINE FreeRoutine;
2668 PVOID TableContext;
2669 } RTL_GENERIC_TABLE, *PRTL_GENERIC_TABLE;
2670
2671 #endif /* !RTL_USE_AVL_TABLES */
2672
2673 #ifdef RTL_USE_AVL_TABLES
2674
2675 #undef PRTL_GENERIC_COMPARE_ROUTINE
2676 #undef RTL_GENERIC_COMPARE_ROUTINE
2677 #undef PRTL_GENERIC_ALLOCATE_ROUTINE
2678 #undef RTL_GENERIC_ALLOCATE_ROUTINE
2679 #undef PRTL_GENERIC_FREE_ROUTINE
2680 #undef RTL_GENERIC_FREE_ROUTINE
2681 #undef RTL_GENERIC_TABLE
2682 #undef PRTL_GENERIC_TABLE
2683
2684 #define PRTL_GENERIC_COMPARE_ROUTINE PRTL_AVL_COMPARE_ROUTINE
2685 #define RTL_GENERIC_COMPARE_ROUTINE RTL_AVL_COMPARE_ROUTINE
2686 #define PRTL_GENERIC_ALLOCATE_ROUTINE PRTL_AVL_ALLOCATE_ROUTINE
2687 #define RTL_GENERIC_ALLOCATE_ROUTINE RTL_AVL_ALLOCATE_ROUTINE
2688 #define PRTL_GENERIC_FREE_ROUTINE PRTL_AVL_FREE_ROUTINE
2689 #define RTL_GENERIC_FREE_ROUTINE RTL_AVL_FREE_ROUTINE
2690 #define RTL_GENERIC_TABLE RTL_AVL_TABLE
2691 #define PRTL_GENERIC_TABLE PRTL_AVL_TABLE
2692
2693 #endif /* RTL_USE_AVL_TABLES */
2694
2695 typedef struct _RTL_DYNAMIC_HASH_TABLE_ENTRY {
2696 LIST_ENTRY Linkage;
2697 ULONG_PTR Signature;
2698 } RTL_DYNAMIC_HASH_TABLE_ENTRY, *PRTL_DYNAMIC_HASH_TABLE_ENTRY;
2699
2700 typedef struct _RTL_DYNAMIC_HASH_TABLE_CONTEXT {
2701 PLIST_ENTRY ChainHead;
2702 PLIST_ENTRY PrevLinkage;
2703 ULONG_PTR Signature;
2704 } RTL_DYNAMIC_HASH_TABLE_CONTEXT, *PRTL_DYNAMIC_HASH_TABLE_CONTEXT;
2705
2706 typedef struct _RTL_DYNAMIC_HASH_TABLE_ENUMERATOR {
2707 RTL_DYNAMIC_HASH_TABLE_ENTRY HashEntry;
2708 PLIST_ENTRY ChainHead;
2709 ULONG BucketIndex;
2710 } RTL_DYNAMIC_HASH_TABLE_ENUMERATOR, *PRTL_DYNAMIC_HASH_TABLE_ENUMERATOR;
2711
2712 typedef struct _RTL_DYNAMIC_HASH_TABLE {
2713 ULONG Flags;
2714 ULONG Shift;
2715 ULONG TableSize;
2716 ULONG Pivot;
2717 ULONG DivisorMask;
2718 ULONG NumEntries;
2719 ULONG NonEmptyBuckets;
2720 ULONG NumEnumerators;
2721 PVOID Directory;
2722 } RTL_DYNAMIC_HASH_TABLE, *PRTL_DYNAMIC_HASH_TABLE;
2723
2724 typedef struct _OSVERSIONINFOA {
2725 ULONG dwOSVersionInfoSize;
2726 ULONG dwMajorVersion;
2727 ULONG dwMinorVersion;
2728 ULONG dwBuildNumber;
2729 ULONG dwPlatformId;
2730 CHAR szCSDVersion[128];
2731 } OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA;
2732
2733 typedef struct _OSVERSIONINFOW {
2734 ULONG dwOSVersionInfoSize;
2735 ULONG dwMajorVersion;
2736 ULONG dwMinorVersion;
2737 ULONG dwBuildNumber;
2738 ULONG dwPlatformId;
2739 WCHAR szCSDVersion[128];
2740 } OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW, RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW;
2741
2742 typedef struct _OSVERSIONINFOEXA {
2743 ULONG dwOSVersionInfoSize;
2744 ULONG dwMajorVersion;
2745 ULONG dwMinorVersion;
2746 ULONG dwBuildNumber;
2747 ULONG dwPlatformId;
2748 CHAR szCSDVersion[128];
2749 USHORT wServicePackMajor;
2750 USHORT wServicePackMinor;
2751 USHORT wSuiteMask;
2752 UCHAR wProductType;
2753 UCHAR wReserved;
2754 } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA;
2755
2756 typedef struct _OSVERSIONINFOEXW {
2757 ULONG dwOSVersionInfoSize;
2758 ULONG dwMajorVersion;
2759 ULONG dwMinorVersion;
2760 ULONG dwBuildNumber;
2761 ULONG dwPlatformId;
2762 WCHAR szCSDVersion[128];
2763 USHORT wServicePackMajor;
2764 USHORT wServicePackMinor;
2765 USHORT wSuiteMask;
2766 UCHAR wProductType;
2767 UCHAR wReserved;
2768 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW, RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW;
2769
2770 #ifdef UNICODE
2771 typedef OSVERSIONINFOEXW OSVERSIONINFOEX;
2772 typedef POSVERSIONINFOEXW POSVERSIONINFOEX;
2773 typedef LPOSVERSIONINFOEXW LPOSVERSIONINFOEX;
2774 typedef OSVERSIONINFOW OSVERSIONINFO;
2775 typedef POSVERSIONINFOW POSVERSIONINFO;
2776 typedef LPOSVERSIONINFOW LPOSVERSIONINFO;
2777 #else
2778 typedef OSVERSIONINFOEXA OSVERSIONINFOEX;
2779 typedef POSVERSIONINFOEXA POSVERSIONINFOEX;
2780 typedef LPOSVERSIONINFOEXA LPOSVERSIONINFOEX;
2781 typedef OSVERSIONINFOA OSVERSIONINFO;
2782 typedef POSVERSIONINFOA POSVERSIONINFO;
2783 typedef LPOSVERSIONINFOA LPOSVERSIONINFO;
2784 #endif /* UNICODE */
2785
2786 #define HASH_ENTRY_KEY(x) ((x)->Signature)
2787
2788 /******************************************************************************
2789 * Security Manager Types *
2790 ******************************************************************************/
2791 #define SE_UNSOLICITED_INPUT_PRIVILEGE 6
2792
2793 typedef enum _WELL_KNOWN_SID_TYPE {
2794 WinNullSid = 0,
2795 WinWorldSid = 1,
2796 WinLocalSid = 2,
2797 WinCreatorOwnerSid = 3,
2798 WinCreatorGroupSid = 4,
2799 WinCreatorOwnerServerSid = 5,
2800 WinCreatorGroupServerSid = 6,
2801 WinNtAuthoritySid = 7,
2802 WinDialupSid = 8,
2803 WinNetworkSid = 9,
2804 WinBatchSid = 10,
2805 WinInteractiveSid = 11,
2806 WinServiceSid = 12,
2807 WinAnonymousSid = 13,
2808 WinProxySid = 14,
2809 WinEnterpriseControllersSid = 15,
2810 WinSelfSid = 16,
2811 WinAuthenticatedUserSid = 17,
2812 WinRestrictedCodeSid = 18,
2813 WinTerminalServerSid = 19,
2814 WinRemoteLogonIdSid = 20,
2815 WinLogonIdsSid = 21,
2816 WinLocalSystemSid = 22,
2817 WinLocalServiceSid = 23,
2818 WinNetworkServiceSid = 24,
2819 WinBuiltinDomainSid = 25,
2820 WinBuiltinAdministratorsSid = 26,
2821 WinBuiltinUsersSid = 27,
2822 WinBuiltinGuestsSid = 28,
2823 WinBuiltinPowerUsersSid = 29,
2824 WinBuiltinAccountOperatorsSid = 30,
2825 WinBuiltinSystemOperatorsSid = 31,
2826 WinBuiltinPrintOperatorsSid = 32,
2827 WinBuiltinBackupOperatorsSid = 33,
2828 WinBuiltinReplicatorSid = 34,
2829 WinBuiltinPreWindows2000CompatibleAccessSid = 35,
2830 WinBuiltinRemoteDesktopUsersSid = 36,
2831 WinBuiltinNetworkConfigurationOperatorsSid = 37,
2832 WinAccountAdministratorSid = 38,
2833 WinAccountGuestSid = 39,
2834 WinAccountKrbtgtSid = 40,
2835 WinAccountDomainAdminsSid = 41,
2836 WinAccountDomainUsersSid = 42,
2837 WinAccountDomainGuestsSid = 43,
2838 WinAccountComputersSid = 44,
2839 WinAccountControllersSid = 45,
2840 WinAccountCertAdminsSid = 46,
2841 WinAccountSchemaAdminsSid = 47,
2842 WinAccountEnterpriseAdminsSid = 48,
2843 WinAccountPolicyAdminsSid = 49,
2844 WinAccountRasAndIasServersSid = 50,
2845 WinNTLMAuthenticationSid = 51,
2846 WinDigestAuthenticationSid = 52,
2847 WinSChannelAuthenticationSid = 53,
2848 WinThisOrganizationSid = 54,
2849 WinOtherOrganizationSid = 55,
2850 WinBuiltinIncomingForestTrustBuildersSid = 56,
2851 WinBuiltinPerfMonitoringUsersSid = 57,
2852 WinBuiltinPerfLoggingUsersSid = 58,
2853 WinBuiltinAuthorizationAccessSid = 59,
2854 WinBuiltinTerminalServerLicenseServersSid = 60,
2855 WinBuiltinDCOMUsersSid = 61,
2856 WinBuiltinIUsersSid = 62,
2857 WinIUserSid = 63,
2858 WinBuiltinCryptoOperatorsSid = 64,
2859 WinUntrustedLabelSid = 65,
2860 WinLowLabelSid = 66,
2861 WinMediumLabelSid = 67,
2862 WinHighLabelSid = 68,
2863 WinSystemLabelSid = 69,
2864 WinWriteRestrictedCodeSid = 70,
2865 WinCreatorOwnerRightsSid = 71,
2866 WinCacheablePrincipalsGroupSid = 72,
2867 WinNonCacheablePrincipalsGroupSid = 73,
2868 WinEnterpriseReadonlyControllersSid = 74,
2869 WinAccountReadonlyControllersSid = 75,
2870 WinBuiltinEventLogReadersGroup = 76,
2871 WinNewEnterpriseReadonlyControllersSid = 77,
2872 WinBuiltinCertSvcDComAccessGroup = 78,
2873 WinMediumPlusLabelSid = 79,
2874 WinLocalLogonSid = 80,
2875 WinConsoleLogonSid = 81,
2876 WinThisOrganizationCertificateSid = 82,
2877 } WELL_KNOWN_SID_TYPE;
2878
2879
2880
2881 #if defined(_M_IX86)
2882
2883 #define PAUSE_PROCESSOR YieldProcessor();
2884
2885 #define KERNEL_STACK_SIZE 12288
2886 #define KERNEL_LARGE_STACK_SIZE 61440
2887 #define KERNEL_LARGE_STACK_COMMIT 12288
2888
2889 #define SIZE_OF_80387_REGISTERS 80
2890
2891 #if !defined(RC_INVOKED)
2892
2893 #define CONTEXT_i386 0x10000
2894 #define CONTEXT_i486 0x10000
2895 #define CONTEXT_CONTROL (CONTEXT_i386|0x00000001L)
2896 #define CONTEXT_INTEGER (CONTEXT_i386|0x00000002L)
2897 #define CONTEXT_SEGMENTS (CONTEXT_i386|0x00000004L)
2898 #define CONTEXT_FLOATING_POINT (CONTEXT_i386|0x00000008L)
2899 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386|0x00000010L)
2900 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386|0x00000020L)
2901
2902 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS)
2903 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | \
2904 CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | \
2905 CONTEXT_EXTENDED_REGISTERS)
2906
2907 #define CONTEXT_XSTATE (CONTEXT_i386 | 0x00000040L)
2908
2909 #endif /* !defined(RC_INVOKED) */
2910
2911 typedef struct _FLOATING_SAVE_AREA {
2912 ULONG ControlWord;
2913 ULONG StatusWord;
2914 ULONG TagWord;
2915 ULONG ErrorOffset;
2916 ULONG ErrorSelector;
2917 ULONG DataOffset;
2918 ULONG DataSelector;
2919 UCHAR RegisterArea[SIZE_OF_80387_REGISTERS];
2920 ULONG Cr0NpxState;
2921 } FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
2922
2923 #include "pshpack4.h"
2924 typedef struct _CONTEXT {
2925 ULONG ContextFlags;
2926 ULONG Dr0;
2927 ULONG Dr1;
2928 ULONG Dr2;
2929 ULONG Dr3;
2930 ULONG Dr6;
2931 ULONG Dr7;
2932 FLOATING_SAVE_AREA FloatSave;
2933 ULONG SegGs;
2934 ULONG SegFs;
2935 ULONG SegEs;
2936 ULONG SegDs;
2937 ULONG Edi;
2938 ULONG Esi;
2939 ULONG Ebx;
2940 ULONG Edx;
2941 ULONG Ecx;
2942 ULONG Eax;
2943 ULONG Ebp;
2944 ULONG Eip;
2945 ULONG SegCs;
2946 ULONG EFlags;
2947 ULONG Esp;
2948 ULONG SegSs;
2949 UCHAR ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
2950 } CONTEXT;
2951 #include "poppack.h"
2952
2953 #define KeGetPcr() PCR
2954
2955 #define PCR_MINOR_VERSION 1
2956 #define PCR_MAJOR_VERSION 1
2957
2958 typedef struct _KPCR {
2959 union {
2960 NT_TIB NtTib;
2961 struct {
2962 struct _EXCEPTION_REGISTRATION_RECORD *Used_ExceptionList;
2963 PVOID Used_StackBase;
2964 PVOID Spare2;
2965 PVOID TssCopy;
2966 ULONG ContextSwitches;
2967 KAFFINITY SetMemberCopy;
2968 PVOID Used_Self;
2969 };
2970 };
2971 struct _KPCR *SelfPcr;
2972 struct _KPRCB *Prcb;
2973 KIRQL Irql;
2974 ULONG IRR;
2975 ULONG IrrActive;
2976 ULONG IDR;
2977 PVOID KdVersionBlock;
2978 struct _KIDTENTRY *IDT;
2979 struct _KGDTENTRY *GDT;
2980 struct _KTSS *TSS;
2981 USHORT MajorVersion;
2982 USHORT MinorVersion;
2983 KAFFINITY SetMember;
2984 ULONG StallScaleFactor;
2985 UCHAR SpareUnused;
2986 UCHAR Number;
2987 UCHAR Spare0;
2988 UCHAR SecondLevelCacheAssociativity;
2989 ULONG VdmAlert;
2990 ULONG KernelReserved[14];
2991 ULONG SecondLevelCacheSize;
2992 ULONG HalReserved[16];
2993 } KPCR, *PKPCR;
2994
2995 FORCEINLINE
2996 ULONG
2997 KeGetCurrentProcessorNumber(VOID)
2998 {
2999 return (ULONG)__readfsbyte(FIELD_OFFSET(KPCR, Number));
3000 }
3001
3002
3003
3004
3005
3006
3007 extern NTKERNELAPI PVOID MmHighestUserAddress;
3008 extern NTKERNELAPI PVOID MmSystemRangeStart;
3009 extern NTKERNELAPI ULONG MmUserProbeAddress;
3010
3011 #define MM_HIGHEST_USER_ADDRESS MmHighestUserAddress
3012 #define MM_SYSTEM_RANGE_START MmSystemRangeStart
3013 #if defined(_LOCAL_COPY_USER_PROBE_ADDRESS_)
3014 #define MM_USER_PROBE_ADDRESS _LOCAL_COPY_USER_PROBE_ADDRESS_
3015 extern ULONG _LOCAL_COPY_USER_PROBE_ADDRESS_;
3016 #else
3017 #define MM_USER_PROBE_ADDRESS MmUserProbeAddress
3018 #endif
3019 #define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
3020 #define MM_KSEG0_BASE MM_SYSTEM_RANGE_START
3021 #define MM_SYSTEM_SPACE_END 0xFFFFFFFF
3022 #if !defined (_X86PAE_)
3023 #define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xC0800000
3024 #else
3025 #define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xC0C00000
3026 #endif
3027
3028 #elif defined(_M_AMD64)
3029
3030 #define PAUSE_PROCESSOR YieldProcessor();
3031
3032 #define KERNEL_STACK_SIZE 0x6000
3033 #define KERNEL_LARGE_STACK_SIZE 0x12000
3034 #define KERNEL_LARGE_STACK_COMMIT KERNEL_STACK_SIZE
3035
3036 #define KERNEL_MCA_EXCEPTION_STACK_SIZE 0x2000
3037
3038 #define EXCEPTION_READ_FAULT 0
3039 #define EXCEPTION_WRITE_FAULT 1
3040 #define EXCEPTION_EXECUTE_FAULT 8
3041
3042 #if !defined(RC_INVOKED)
3043
3044 #define CONTEXT_AMD64 0x100000
3045
3046 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x1L)
3047 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x2L)
3048 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x4L)
3049 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x8L)
3050 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x10L)
3051
3052 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
3053 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
3054
3055 #define CONTEXT_XSTATE (CONTEXT_AMD64 | 0x20L)
3056
3057 #define CONTEXT_EXCEPTION_ACTIVE 0x8000000
3058 #define CONTEXT_SERVICE_ACTIVE 0x10000000
3059 #define CONTEXT_EXCEPTION_REQUEST 0x40000000
3060 #define CONTEXT_EXCEPTION_REPORTING 0x80000000
3061
3062 #endif /* !defined(RC_INVOKED) */
3063
3064 #define INITIAL_MXCSR 0x1f80
3065 #define INITIAL_FPCSR 0x027f
3066
3067 typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
3068 ULONG64 P1Home;
3069 ULONG64 P2Home;
3070 ULONG64 P3Home;
3071 ULONG64 P4Home;
3072 ULONG64 P5Home;
3073 ULONG64 P6Home;
3074 ULONG ContextFlags;
3075 ULONG MxCsr;
3076 USHORT SegCs;
3077 USHORT SegDs;
3078 USHORT SegEs;
3079 USHORT SegFs;
3080 USHORT SegGs;
3081 USHORT SegSs;
3082 ULONG EFlags;
3083 ULONG64 Dr0;
3084 ULONG64 Dr1;
3085 ULONG64 Dr2;
3086 ULONG64 Dr3;
3087 ULONG64 Dr6;
3088 ULONG64 Dr7;
3089 ULONG64 Rax;
3090 ULONG64 Rcx;
3091 ULONG64 Rdx;
3092 ULONG64 Rbx;
3093 ULONG64 Rsp;
3094 ULONG64 Rbp;
3095 ULONG64 Rsi;
3096 ULONG64 Rdi;
3097 ULONG64 R8;
3098 ULONG64 R9;
3099 ULONG64 R10;
3100 ULONG64 R11;
3101 ULONG64 R12;
3102 ULONG64 R13;
3103 ULONG64 R14;
3104 ULONG64 R15;
3105 ULONG64 Rip;
3106 union {
3107 XMM_SAVE_AREA32 FltSave;
3108 struct {
3109 M128A Header[2];
3110 M128A Legacy[8];
3111 M128A Xmm0;
3112 M128A Xmm1;
3113 M128A Xmm2;
3114 M128A Xmm3;
3115 M128A Xmm4;
3116 M128A Xmm5;
3117 M128A Xmm6;
3118 M128A Xmm7;
3119 M128A Xmm8;
3120 M128A Xmm9;
3121 M128A Xmm10;
3122 M128A Xmm11;
3123 M128A Xmm12;
3124 M128A Xmm13;
3125 M128A Xmm14;
3126 M128A Xmm15;
3127 } DUMMYSTRUCTNAME;
3128 } DUMMYUNIONNAME;
3129 M128A VectorRegister[26];
3130 ULONG64 VectorControl;
3131 ULONG64 DebugControl;
3132 ULONG64 LastBranchToRip;
3133 ULONG64 LastBranchFromRip;
3134 ULONG64 LastExceptionToRip;
3135 ULONG64 LastExceptionFromRip;
3136 } CONTEXT;
3137
3138 typedef struct _KPCR
3139 {
3140 _ANONYMOUS_UNION union
3141 {
3142 NT_TIB NtTib;
3143 _ANONYMOUS_STRUCT struct
3144 {
3145 union _KGDTENTRY64 *GdtBase;
3146 struct _KTSS64 *TssBase;
3147 ULONG64 UserRsp;
3148 struct _KPCR *Self;
3149 struct _KPRCB *CurrentPrcb;
3150 PKSPIN_LOCK_QUEUE LockArray;
3151 PVOID Used_Self;
3152 };
3153 };
3154 union _KIDTENTRY64 *IdtBase;
3155 ULONG64 Unused[2];
3156 KIRQL Irql;
3157 UCHAR SecondLevelCacheAssociativity;
3158 UCHAR ObsoleteNumber;
3159 UCHAR Fill0;
3160 ULONG Unused0[3];
3161 USHORT MajorVersion;
3162 USHORT MinorVersion;
3163 ULONG StallScaleFactor;
3164 PVOID Unused1[3];
3165 ULONG KernelReserved[15];
3166 ULONG SecondLevelCacheSize;
3167 ULONG HalReserved[16];
3168 ULONG Unused2;
3169 PVOID KdVersionBlock;
3170 PVOID Unused3;
3171 ULONG PcrAlign1[24];
3172 } KPCR, *PKPCR;
3173
3174 FORCEINLINE
3175 PKPCR
3176 KeGetPcr(VOID)
3177 {
3178 return (PKPCR)__readgsqword(FIELD_OFFSET(KPCR, Self));
3179 }
3180
3181 FORCEINLINE
3182 ULONG
3183 KeGetCurrentProcessorNumber(VOID)
3184 {
3185 return (ULONG)__readgsword(0x184);
3186 }
3187
3188
3189 #define PTI_SHIFT 12L
3190 #define PDI_SHIFT 21L
3191 #define PPI_SHIFT 30L
3192 #define PXI_SHIFT 39L
3193 #define PTE_PER_PAGE 512
3194 #define PDE_PER_PAGE 512
3195 #define PPE_PER_PAGE 512
3196 #define PXE_PER_PAGE 512
3197 #define PTI_MASK_AMD64 (PTE_PER_PAGE - 1)
3198 #define PDI_MASK_AMD64 (PDE_PER_PAGE - 1)
3199 #define PPI_MASK (PPE_PER_PAGE - 1)
3200 #define PXI_MASK (PXE_PER_PAGE - 1)
3201
3202 #define PXE_BASE 0xFFFFF6FB7DBED000ULL
3203 #define PXE_SELFMAP 0xFFFFF6FB7DBEDF68ULL
3204 #define PPE_BASE 0xFFFFF6FB7DA00000ULL
3205 #define PDE_BASE 0xFFFFF6FB40000000ULL
3206 #define PTE_BASE 0xFFFFF68000000000ULL
3207 #define PXE_TOP 0xFFFFF6FB7DBEDFFFULL
3208 #define PPE_TOP 0xFFFFF6FB7DBFFFFFULL
3209 #define PDE_TOP 0xFFFFF6FB7FFFFFFFULL
3210 #define PTE_TOP 0xFFFFF6FFFFFFFFFFULL
3211
3212 #define MM_HIGHEST_USER_ADDRESS MmHighestUserAddress
3213 #define MM_SYSTEM_RANGE_START MmSystemRangeStart
3214 #define MM_USER_PROBE_ADDRESS MmUserProbeAddress
3215 #define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
3216 #define MM_LOWEST_SYSTEM_ADDRESS (PVOID)0xFFFF080000000000ULL
3217
3218
3219 #elif defined(_M_IA64)
3220
3221 #elif defined(_M_PPC)
3222
3223
3224 #elif defined(_M_MIPS)
3225
3226 #elif defined(_M_ARM)
3227 #else
3228 #error Unknown Architecture
3229 #endif
3230
3231 /******************************************************************************
3232 * Executive Functions *
3233 ******************************************************************************/
3234 static __inline PVOID
3235 ExAllocateFromZone(
3236 IN PZONE_HEADER Zone)
3237 {
3238 if (Zone->FreeList.Next)
3239 Zone->FreeList.Next = Zone->FreeList.Next->Next;
3240 return (PVOID) Zone->FreeList.Next;
3241 }
3242
3243 static __inline PVOID
3244 ExFreeToZone(
3245 IN PZONE_HEADER Zone,
3246 IN PVOID Block)
3247 {
3248 ((PSINGLE_LIST_ENTRY) Block)->Next = Zone->FreeList.Next;
3249 Zone->FreeList.Next = ((PSINGLE_LIST_ENTRY) Block);
3250 return ((PSINGLE_LIST_ENTRY) Block)->Next;
3251 }
3252
3253 /*
3254 * PVOID
3255 * ExInterlockedAllocateFromZone(
3256 * IN PZONE_HEADER Zone,
3257 * IN PKSPIN_LOCK Lock)
3258 */
3259 #define ExInterlockedAllocateFromZone(Zone, Lock) \
3260 ((PVOID) ExInterlockedPopEntryList(&Zone->FreeList, Lock))
3261
3262 /* PVOID
3263 * ExInterlockedFreeToZone(
3264 * IN PZONE_HEADER Zone,
3265 * IN PVOID Block,
3266 * IN PKSPIN_LOCK Lock);
3267 */
3268 #define ExInterlockedFreeToZone(Zone, Block, Lock) \
3269 ExInterlockedPushEntryList(&(Zone)->FreeList, (PSINGLE_LIST_ENTRY)(Block), Lock)
3270
3271 /*
3272 * BOOLEAN
3273 * ExIsFullZone(
3274 * IN PZONE_HEADER Zone)
3275 */
3276 #define ExIsFullZone(Zone) \
3277 ((Zone)->FreeList.Next == (PSINGLE_LIST_ENTRY) NULL)
3278
3279 /* BOOLEAN
3280 * ExIsObjectInFirstZoneSegment(
3281 * IN PZONE_HEADER Zone,
3282 * IN PVOID Object);
3283 */
3284 #define ExIsObjectInFirstZoneSegment(Zone,Object) \
3285 ((BOOLEAN)( ((PUCHAR)(Object) >= (PUCHAR)(Zone)->SegmentList.Next) && \
3286 ((PUCHAR)(Object) < (PUCHAR)(Zone)->SegmentList.Next + \
3287 (Zone)->TotalSegmentSize)) )
3288
3289 #define ExAcquireResourceExclusive ExAcquireResourceExclusiveLite
3290 #define ExAcquireResourceShared ExAcquireResourceSharedLite
3291 #define ExConvertExclusiveToShared ExConvertExclusiveToSharedLite
3292 #define ExDeleteResource ExDeleteResourceLite
3293 #define ExInitializeResource ExInitializeResourceLite
3294 #define ExIsResourceAcquiredExclusive ExIsResourceAcquiredExclusiveLite
3295 #define ExIsResourceAcquiredShared ExIsResourceAcquiredSharedLite
3296 #define ExIsResourceAcquired ExIsResourceAcquiredSharedLite
3297 #define ExReleaseResourceForThread ExReleaseResourceForThreadLite
3298
3299 typedef enum _INTERLOCKED_RESULT {
3300 ResultNegative = RESULT_NEGATIVE,
3301 ResultZero = RESULT_ZERO,
3302 ResultPositive = RESULT_POSITIVE
3303 } INTERLOCKED_RESULT;
3304
3305 #ifdef _X86_
3306 NTKERNELAPI
3307 INTERLOCKED_RESULT
3308 FASTCALL
3309 Exfi386InterlockedIncrementLong(
3310 IN OUT LONG volatile *Addend);
3311
3312 NTKERNELAPI
3313 INTERLOCKED_RESULT
3314 FASTCALL
3315 Exfi386InterlockedDecrementLong(
3316 IN PLONG Addend);
3317
3318 NTKERNELAPI
3319 ULONG
3320 FASTCALL
3321 Exfi386InterlockedExchangeUlong(
3322 IN PULONG Target,
3323 IN ULONG Value);
3324 #endif
3325
3326
3327
3328 #if (NTDDI_VERSION >= NTDDI_WIN2K)
3329 NTKERNELAPI
3330 NTSTATUS
3331 NTAPI
3332 ExExtendZone(
3333 IN OUT PZONE_HEADER Zone,
3334 IN OUT PVOID Segment,
3335 IN ULONG SegmentSize);
3336
3337 NTKERNELAPI
3338 NTSTATUS
3339 NTAPI
3340 ExInitializeZone(
3341 OUT PZONE_HEADER Zone,
3342 IN ULONG BlockSize,
3343 IN OUT PVOID InitialSegment,
3344 IN ULONG InitialSegmentSize);
3345
3346 NTKERNELAPI
3347 NTSTATUS
3348 NTAPI
3349 ExInterlockedExtendZone(
3350 IN OUT PZONE_HEADER Zone,
3351 IN OUT PVOID Segment,
3352 IN ULONG SegmentSize,
3353 IN OUT PKSPIN_LOCK Lock);
3354
3355 NTKERNELAPI
3356 NTSTATUS
3357 NTAPI
3358 ExUuidCreate(
3359 OUT UUID *Uuid);
3360
3361 NTKERNELAPI
3362 DECLSPEC_NORETURN
3363 VOID
3364 NTAPI
3365 ExRaiseAccessViolation(VOID);
3366
3367 NTKERNELAPI
3368 DECLSPEC_NORETURN
3369 VOID
3370 NTAPI
3371 ExRaiseDatatypeMisalignment(VOID);
3372
3373
3374 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
3375
3376
3377 /* Hardware Abstraction Layer Functions */
3378
3379 #if defined(USE_DMA_MACROS) && !defined(_NTHAL_) && (defined(_NTDDK_) || defined(_NTDRIVER_)) || defined(_WDM_INCLUDED_)
3380
3381
3382
3383 #else
3384
3385 #if (NTDDI_VERSION >= NTDDI_WIN2K)
3386 //DECLSPEC_DEPRECATED_DDK
3387 NTHALAPI
3388 VOID
3389 NTAPI
3390 IoFreeAdapterChannel(
3391 IN PADAPTER_OBJECT AdapterObject);
3392
3393 //DECLSPEC_DEPRECATED_DDK
3394 NTHALAPI
3395 BOOLEAN
3396 NTAPI
3397 IoFlushAdapterBuffers(
3398 IN PADAPTER_OBJECT AdapterObject,
3399 IN PMDL Mdl,
3400 IN PVOID MapRegisterBase,
3401 IN PVOID CurrentVa,
3402 IN ULONG Length,
3403 IN BOOLEAN WriteToDevice);
3404
3405 //DECLSPEC_DEPRECATED_DDK
3406 NTHALAPI
3407 VOID
3408 NTAPI
3409 IoFreeMapRegisters(
3410 IN PADAPTER_OBJECT AdapterObject,
3411 IN PVOID MapRegisterBase,
3412 IN ULONG NumberOfMapRegisters);
3413
3414 //DECLSPEC_DEPRECATED_DDK
3415 NTHALAPI
3416 PVOID
3417 NTAPI
3418 HalAllocateCommonBuffer(
3419 IN PADAPTER_OBJECT AdapterObject,
3420 IN ULONG Length,
3421 OUT PPHYSICAL_ADDRESS LogicalAddress,
3422 IN BOOLEAN CacheEnabled);
3423
3424 //DECLSPEC_DEPRECATED_DDK
3425 NTHALAPI
3426 VOID
3427 NTAPI
3428 HalFreeCommonBuffer(
3429 IN PADAPTER_OBJECT AdapterObject,
3430 IN ULONG Length,
3431 IN PHYSICAL_ADDRESS LogicalAddress,
3432 IN PVOID VirtualAddress,
3433 IN BOOLEAN CacheEnabled);
3434
3435 //DECLSPEC_DEPRECATED_DDK
3436 NTHALAPI
3437 ULONG
3438 NTAPI
3439 HalReadDmaCounter(
3440 IN PADAPTER_OBJECT AdapterObject);
3441
3442 NTHALAPI
3443 NTSTATUS
3444 NTAPI
3445 HalAllocateAdapterChannel(
3446 IN PADAPTER_OBJECT AdapterObject,
3447 IN PWAIT_CONTEXT_BLOCK Wcb,
3448 IN ULONG NumberOfMapRegisters,
3449 IN PDRIVER_CONTROL ExecutionRoutine);
3450
3451 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
3452
3453
3454 #endif
3455
3456
3457 #if !defined(NO_LEGACY_DRIVERS)
3458
3459 #if (NTDDI_VERSION >= NTDDI_WIN2K)
3460
3461 NTHALAPI
3462 NTSTATUS
3463 NTAPI
3464 HalAssignSlotResources(
3465 IN PUNICODE_STRING RegistryPath,
3466 IN PUNICODE_STRING DriverClassName,
3467 IN PDRIVER_OBJECT DriverObject,
3468 IN PDEVICE_OBJECT DeviceObject,
3469 IN INTERFACE_TYPE BusType,
3470 IN ULONG BusNumber,
3471 IN ULONG SlotNumber,
3472 IN OUT PCM_RESOURCE_LIST *AllocatedResources);
3473
3474 NTHALAPI
3475 ULONG
3476 NTAPI
3477 HalGetInterruptVector(
3478 IN INTERFACE_TYPE InterfaceType,
3479 IN ULONG BusNumber,
3480 IN ULONG BusInterruptLevel,
3481 IN ULONG BusInterruptVector,
3482 OUT PKIRQL Irql,
3483 OUT PKAFFINITY Affinity);
3484
3485 NTHALAPI
3486 ULONG
3487 NTAPI
3488 HalSetBusData(
3489 IN BUS_DATA_TYPE BusDataType,
3490 IN ULONG BusNumber,
3491 IN ULONG SlotNumber,
3492 IN PVOID Buffer,
3493 IN ULONG Length);
3494
3495 NTHALAPI
3496 ULONG
3497 NTAPI
3498 HalGetBusData(
3499 IN BUS_DATA_TYPE BusDataType,
3500 IN ULONG BusNumber,
3501 IN ULONG SlotNumber,
3502 OUT PVOID Buffer,
3503 IN ULONG Length);
3504
3505 NTHALAPI
3506 BOOLEAN
3507 NTAPI
3508 HalMakeBeep(
3509 IN ULONG Frequency);
3510
3511 #endif
3512
3513 #endif /* !defined(NO_LEGACY_DRIVERS) */
3514
3515 #if (NTDDI_VERSION >= NTDDI_WIN2K)
3516
3517 NTHALAPI
3518 PADAPTER_OBJECT
3519 NTAPI
3520 HalGetAdapter(
3521 IN PDEVICE_DESCRIPTION DeviceDescription,
3522 OUT PULONG NumberOfMapRegisters);
3523
3524 VOID
3525 NTAPI
3526 HalPutDmaAdapter(
3527 IN PADAPTER_OBJECT DmaAdapter);
3528
3529 NTHALAPI
3530 VOID
3531 NTAPI
3532 HalAcquireDisplayOwnership(
3533 IN PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters);
3534
3535 NTHALAPI
3536 ULONG
3537 NTAPI
3538 HalGetBusDataByOffset(
3539 IN BUS_DATA_TYPE BusDataType,
3540 IN ULONG BusNumber,
3541 IN ULONG SlotNumber,
3542 OUT PVOID Buffer,
3543 IN ULONG Offset,
3544 IN ULONG Length);
3545
3546 NTHALAPI
3547 ULONG
3548 NTAPI
3549 HalSetBusDataByOffset(
3550 IN BUS_DATA_TYPE BusDataType,
3551 IN ULONG BusNumber,
3552 IN ULONG SlotNumber,
3553 IN PVOID Buffer,
3554 IN ULONG Offset,
3555 IN ULONG Length);
3556
3557 NTHALAPI
3558 BOOLEAN
3559 NTAPI
3560 HalTranslateBusAddress(
3561 IN INTERFACE_TYPE InterfaceType,
3562 IN ULONG BusNumber,
3563 IN PHYSICAL_ADDRESS BusAddress,
3564 IN OUT PULONG AddressSpace,
3565 OUT PPHYSICAL_ADDRESS TranslatedAddress);
3566
3567 NTHALAPI
3568 PVOID
3569 NTAPI
3570 HalAllocateCrashDumpRegisters(
3571 IN PADAPTER_OBJECT AdapterObject,
3572 IN OUT PULONG NumberOfMapRegisters);
3573
3574 NTSTATUS
3575 NTAPI
3576 HalGetScatterGatherList(
3577 IN PADAPTER_OBJECT DmaAdapter,
3578 IN PDEVICE_OBJECT DeviceObject,
3579 IN PMDL Mdl,
3580 IN PVOID CurrentVa,
3581 IN ULONG Length,
3582 IN PDRIVER_LIST_CONTROL ExecutionRoutine,
3583 IN PVOID Context,
3584 IN BOOLEAN WriteToDevice);
3585
3586 VOID
3587 NTAPI
3588 HalPutScatterGatherList(
3589 IN PADAPTER_OBJECT DmaAdapter,
3590 IN PSCATTER_GATHER_LIST ScatterGather,
3591 IN BOOLEAN WriteToDevice);
3592
3593 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
3594
3595 #if (NTDDI_VERSION >= NTDDI_WINXP)
3596 NTKERNELAPI
3597 VOID
3598 FASTCALL
3599 HalExamineMBR(
3600 IN PDEVICE_OBJECT DeviceObject,
3601 IN ULONG SectorSize,
3602 IN ULONG MBRTypeIdentifier,
3603 OUT PVOID *Buffer);
3604 #endif
3605
3606 #if (NTDDI_VERSION >= NTDDI_WIN7)
3607
3608 NTSTATUS
3609 NTAPI
3610 HalAllocateHardwareCounters(
3611 IN PGROUP_AFFINITY GroupAffinty,
3612 IN ULONG GroupCount,
3613 IN PPHYSICAL_COUNTER_RESOURCE_LIST ResourceList,
3614 OUT PHANDLE CounterSetHandle);
3615
3616 NTSTATUS
3617 NTAPI
3618 HalFreeHardwareCounters(
3619 IN HANDLE CounterSetHandle);
3620
3621 #endif
3622
3623 #if defined(_IA64_)
3624 #if (NTDDI_VERSION >= NTDDI_WIN2K)
3625 NTHALAPI
3626 ULONG
3627 NTAPI
3628 HalGetDmaAlignmentRequirement(VOID);
3629 #endif
3630 #endif /* defined(_IA64_) */
3631
3632 #if defined(_M_IX86) || defined(_M_AMD64)
3633 #define HalGetDmaAlignmentRequirement() 1L
3634 #endif
3635
3636 #if (NTDDI_VERSION >= NTDDI_WIN7)
3637
3638 typedef struct _WHEA_ERROR_SOURCE_DESCRIPTOR *PWHEA_ERROR_SOURCE_DESCRIPTOR;
3639 typedef struct _WHEA_ERROR_RECORD *PWHEA_ERROR_RECORD;
3640
3641 NTHALAPI
3642 VOID
3643 NTAPI
3644 HalBugCheckSystem(
3645 IN PWHEA_ERROR_SOURCE_DESCRIPTOR ErrorSource,
3646 IN PWHEA_ERROR_RECORD ErrorRecord);
3647
3648 #else
3649
3650 typedef struct _WHEA_ERROR_RECORD *PWHEA_ERROR_RECORD;
3651
3652 NTHALAPI
3653 VOID
3654 NTAPI
3655 HalBugCheckSystem(
3656 IN PWHEA_ERROR_RECORD ErrorRecord);
3657
3658 #endif /* (NTDDI_VERSION >= NTDDI_WIN7) */
3659
3660
3661 /******************************************************************************
3662 * I/O Manager Functions *
3663 ******************************************************************************/
3664 /*
3665 * VOID IoAssignArcName(
3666 * IN PUNICODE_STRING ArcName,
3667 * IN PUNICODE_STRING DeviceName);
3668 */
3669 #define IoAssignArcName(_ArcName, _DeviceName) ( \
3670 IoCreateSymbolicLink((_ArcName), (_DeviceName)))
3671
3672 /*
3673 * VOID
3674 * IoDeassignArcName(
3675 * IN PUNICODE_STRING ArcName)
3676 */
3677 #define IoDeassignArcName IoDeleteSymbolicLink
3678
3679 VOID
3680 FORCEINLINE
3681 NTAPI
3682 IoInitializeDriverCreateContext(
3683 PIO_DRIVER_CREATE_CONTEXT DriverContext)
3684 {
3685 RtlZeroMemory(DriverContext, sizeof(IO_DRIVER_CREATE_CONTEXT));
3686 DriverContext->Size = sizeof(IO_DRIVER_CREATE_CONTEXT);
3687 }
3688
3689
3690
3691 #if (NTDDI_VERSION >= NTDDI_WIN2K)
3692 #if !(defined(USE_DMA_MACROS) && (defined(_NTDDK_) || defined(_NTDRIVER_)) || defined(_WDM_INCLUDED_))
3693 NTKERNELAPI
3694 NTSTATUS
3695 NTAPI
3696 IoAllocateAdapterChannel(
3697 IN PADAPTER_OBJECT AdapterObject,
3698 IN PDEVICE_OBJECT DeviceObject,
3699 IN ULONG NumberOfMapRegisters,
3700 IN PDRIVER_CONTROL ExecutionRoutine,
3701 IN PVOID Context);
3702 #endif
3703
3704 #if !defined(DMA_MACROS_DEFINED)
3705 //DECLSPEC_DEPRECATED_DDK
3706 NTHALAPI
3707 PHYSICAL_ADDRESS
3708 NTAPI
3709 IoMapTransfer(
3710 IN PADAPTER_OBJECT AdapterObject,
3711 IN PMDL Mdl,
3712 IN PVOID MapRegisterBase,
3713 IN PVOID CurrentVa,
3714 IN OUT PULONG Length,
3715 IN BOOLEAN WriteToDevice);
3716 #endif
3717
3718 NTKERNELAPI
3719 VOID
3720 NTAPI
3721 IoAllocateController(
3722 IN PCONTROLLER_OBJECT ControllerObject,
3723 IN PDEVICE_OBJECT DeviceObject,
3724 IN PDRIVER_CONTROL ExecutionRoutine,
3725 IN PVOID Context OPTIONAL);
3726
3727 NTKERNELAPI
3728 PCONTROLLER_OBJECT
3729 NTAPI
3730 IoCreateController(
3731 IN ULONG Size);
3732
3733 NTKERNELAPI
3734 VOID
3735 NTAPI
3736 IoDeleteController(
3737 IN PCONTROLLER_OBJECT ControllerObject);
3738
3739 NTKERNELAPI
3740 VOID
3741 NTAPI
3742 IoFreeController(
3743 IN PCONTROLLER_OBJECT ControllerObject);
3744
3745 NTKERNELAPI
3746 PCONFIGURATION_INFORMATION
3747 NTAPI
3748 IoGetConfigurationInformation(VOID);
3749
3750 NTKERNELAPI
3751 PDEVICE_OBJECT
3752 NTAPI
3753 IoGetDeviceToVerify(
3754 IN PETHREAD Thread);
3755
3756 NTKERNELAPI
3757 VOID
3758 NTAPI
3759 IoCancelFileOpen(
3760 IN PDEVICE_OBJECT DeviceObject,
3761 IN PFILE_OBJECT FileObject);
3762
3763 NTKERNELAPI
3764 PGENERIC_MAPPING
3765 NTAPI
3766 IoGetFileObjectGenericMapping(VOID);
3767
3768 NTKERNELAPI
3769 PIRP
3770 NTAPI
3771 IoMakeAssociatedIrp(
3772 IN PIRP Irp,
3773 IN CCHAR StackSize);
3774
3775 NTKERNELAPI
3776 NTSTATUS
3777 NTAPI
3778 IoQueryDeviceDescription(
3779 IN PINTERFACE_TYPE BusType OPTIONAL,
3780 IN PULONG BusNumber OPTIONAL,
3781 IN PCONFIGURATION_TYPE ControllerType OPTIONAL,
3782 IN PULONG ControllerNumber OPTIONAL,
3783 IN PCONFIGURATION_TYPE PeripheralType OPTIONAL,
3784 IN PULONG PeripheralNumber OPTIONAL,
3785 IN PIO_QUERY_DEVICE_ROUTINE CalloutRoutine,
3786 IN OUT PVOID Context OPTIONAL);
3787
3788 NTKERNELAPI
3789 VOID
3790 NTAPI
3791 IoRaiseHardError(
3792 IN PIRP Irp,
3793 IN PVPB Vpb OPTIONAL,
3794 IN PDEVICE_OBJECT RealDeviceObject);
3795
3796 NTKERNELAPI
3797 BOOLEAN
3798 NTAPI
3799 IoRaiseInformationalHardError(
3800 IN NTSTATUS ErrorStatus,
3801 IN PUNICODE_STRING String OPTIONAL,
3802 IN PKTHREAD Thread OPTIONAL);
3803
3804 NTKERNELAPI
3805 VOID
3806 NTAPI
3807 IoRegisterBootDriverReinitialization(
3808 IN PDRIVER_OBJECT DriverObject,
3809 IN PDRIVER_REINITIALIZE DriverReinitializationRoutine,
3810 IN PVOID Context OPTIONAL);
3811
3812 NTKERNELAPI
3813 VOID
3814 NTAPI
3815 IoRegisterDriverReinitialization(
3816 IN PDRIVER_OBJECT DriverObject,
3817 IN PDRIVER_REINITIALIZE DriverReinitializationRoutine,
3818 IN PVOID Context OPTIONAL);
3819
3820 NTKERNELAPI
3821 NTSTATUS
3822 NTAPI
3823 IoAttachDeviceByPointer(
3824 IN PDEVICE_OBJECT SourceDevice,
3825 IN PDEVICE_OBJECT TargetDevice);
3826
3827 NTKERNELAPI
3828 NTSTATUS
3829 NTAPI
3830 IoReportDetectedDevice(
3831 IN PDRIVER_OBJECT DriverObject,
3832 IN INTERFACE_TYPE LegacyBusType,
3833 IN ULONG BusNumber,
3834 IN ULONG SlotNumber,
3835 IN PCM_RESOURCE_LIST ResourceList OPTIONAL,
3836 IN PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements OPTIONAL,
3837 IN BOOLEAN ResourceAssigned,
3838 IN OUT PDEVICE_OBJECT *DeviceObject OPTIONAL);
3839
3840 NTKERNELAPI
3841 NTSTATUS
3842 NTAPI
3843 IoReportResourceForDetection(
3844 IN PDRIVER_OBJECT DriverObject,
3845 IN PCM_RESOURCE_LIST DriverList OPTIONAL,
3846 IN ULONG DriverListSize OPTIONAL,
3847 IN PDEVICE_OBJECT DeviceObject OPTIONAL,
3848 IN PCM_RESOURCE_LIST DeviceList OPTIONAL,
3849 IN ULONG DeviceListSize OPTIONAL,
3850 OUT PBOOLEAN ConflictDetected);
3851
3852 NTKERNELAPI
3853 NTSTATUS
3854 NTAPI
3855 IoReportResourceUsage(
3856 IN PUNICODE_STRING DriverClassName OPTIONAL,
3857 IN PDRIVER_OBJECT DriverObject,
3858 IN PCM_RESOURCE_LIST DriverList OPTIONAL,
3859 IN ULONG DriverListSize OPTIONAL,
3860 IN PDEVICE_OBJECT DeviceObject,
3861 IN PCM_RESOURCE_LIST DeviceList OPTIONAL,
3862 IN ULONG DeviceListSize OPTIONAL,
3863 IN BOOLEAN OverrideConflict,
3864 OUT PBOOLEAN ConflictDetected);
3865
3866 NTKERNELAPI
3867 VOID
3868 NTAPI
3869 IoSetHardErrorOrVerifyDevice(
3870 IN PIRP Irp,
3871 IN PDE