Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

io.h

Go to the documentation of this file.
00001 /*++ BUILD Version: 0013 // Increment this if a change has global effects 00002 00003 Copyright (c) 1989 Microsoft Corporation 00004 00005 Module Name: 00006 00007 io.h 00008 00009 Abstract: 00010 00011 This module contains the internal structure definitions and APIs used by 00012 the NT I/O system. 00013 00014 Author: 00015 00016 Darryl E. Havens (darrylh) 12-Apr-1989 00017 00018 00019 Revision History: 00020 00021 00022 --*/ 00023 00024 #ifndef _IO_ 00025 #define _IO_ 00026 00027 // begin_ntddk begin_wdm begin_nthal begin_ntifs begin_ntndis 00028 // 00029 // Define I/O system data structure type codes. Each major data structure in 00030 // the I/O system has a type code The type field in each structure is at the 00031 // same offset. The following values can be used to determine which type of 00032 // data structure a pointer refers to. 00033 // 00034 00035 #define IO_TYPE_ADAPTER 0x00000001 00036 #define IO_TYPE_CONTROLLER 0x00000002 00037 #define IO_TYPE_DEVICE 0x00000003 00038 #define IO_TYPE_DRIVER 0x00000004 00039 #define IO_TYPE_FILE 0x00000005 00040 #define IO_TYPE_IRP 0x00000006 00041 #define IO_TYPE_MASTER_ADAPTER 0x00000007 00042 #define IO_TYPE_OPEN_PACKET 0x00000008 00043 #define IO_TYPE_TIMER 0x00000009 00044 #define IO_TYPE_VPB 0x0000000a 00045 #define IO_TYPE_ERROR_LOG 0x0000000b 00046 #define IO_TYPE_ERROR_MESSAGE 0x0000000c 00047 #define IO_TYPE_DEVICE_OBJECT_EXTENSION 0x0000000d 00048 00049 00050 // 00051 // Define the major function codes for IRPs. 00052 // 00053 00054 00055 #define IRP_MJ_CREATE 0x00 00056 #define IRP_MJ_CREATE_NAMED_PIPE 0x01 00057 #define IRP_MJ_CLOSE 0x02 00058 #define IRP_MJ_READ 0x03 00059 #define IRP_MJ_WRITE 0x04 00060 #define IRP_MJ_QUERY_INFORMATION 0x05 00061 #define IRP_MJ_SET_INFORMATION 0x06 00062 #define IRP_MJ_QUERY_EA 0x07 00063 #define IRP_MJ_SET_EA 0x08 00064 #define IRP_MJ_FLUSH_BUFFERS 0x09 00065 #define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a 00066 #define IRP_MJ_SET_VOLUME_INFORMATION 0x0b 00067 #define IRP_MJ_DIRECTORY_CONTROL 0x0c 00068 #define IRP_MJ_FILE_SYSTEM_CONTROL 0x0d 00069 #define IRP_MJ_DEVICE_CONTROL 0x0e 00070 #define IRP_MJ_INTERNAL_DEVICE_CONTROL 0x0f 00071 #define IRP_MJ_SHUTDOWN 0x10 00072 #define IRP_MJ_LOCK_CONTROL 0x11 00073 #define IRP_MJ_CLEANUP 0x12 00074 #define IRP_MJ_CREATE_MAILSLOT 0x13 00075 #define IRP_MJ_QUERY_SECURITY 0x14 00076 #define IRP_MJ_SET_SECURITY 0x15 00077 #define IRP_MJ_POWER 0x16 00078 #define IRP_MJ_SYSTEM_CONTROL 0x17 00079 #define IRP_MJ_DEVICE_CHANGE 0x18 00080 #define IRP_MJ_QUERY_QUOTA 0x19 00081 #define IRP_MJ_SET_QUOTA 0x1a 00082 #define IRP_MJ_PNP 0x1b 00083 #define IRP_MJ_PNP_POWER IRP_MJ_PNP // Obsolete.... 00084 #define IRP_MJ_MAXIMUM_FUNCTION 0x1b 00085 00086 // 00087 // Make the Scsi major code the same as internal device control. 00088 // 00089 00090 #define IRP_MJ_SCSI IRP_MJ_INTERNAL_DEVICE_CONTROL 00091 00092 // 00093 // Define the minor function codes for IRPs. The lower 128 codes, from 0x00 to 00094 // 0x7f are reserved to Microsoft. The upper 128 codes, from 0x80 to 0xff, are 00095 // reserved to customers of Microsoft. 00096 // 00097 00098 // end_wdm end_ntndis 00099 // 00100 // Directory control minor function codes 00101 // 00102 00103 #define IRP_MN_QUERY_DIRECTORY 0x01 00104 #define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02 00105 00106 // 00107 // File system control minor function codes. Note that "user request" is 00108 // assumed to be zero by both the I/O system and file systems. Do not change 00109 // this value. 00110 // 00111 00112 #define IRP_MN_USER_FS_REQUEST 0x00 00113 #define IRP_MN_MOUNT_VOLUME 0x01 00114 #define IRP_MN_VERIFY_VOLUME 0x02 00115 #define IRP_MN_LOAD_FILE_SYSTEM 0x03 00116 #define IRP_MN_TRACK_LINK 0x04 // To be obsoleted soon 00117 #define IRP_MN_KERNEL_CALL 0x04 00118 00119 // 00120 // Lock control minor function codes 00121 // 00122 00123 #define IRP_MN_LOCK 0x01 00124 #define IRP_MN_UNLOCK_SINGLE 0x02 00125 #define IRP_MN_UNLOCK_ALL 0x03 00126 #define IRP_MN_UNLOCK_ALL_BY_KEY 0x04 00127 00128 // 00129 // Read and Write minor function codes for file systems supporting Lan Manager 00130 // software. All of these subfunction codes are invalid if the file has been 00131 // opened with FO_NO_INTERMEDIATE_BUFFERING. They are also invalid in combi- 00132 // nation with synchronous calls (Irp Flag or file open option). 00133 // 00134 // Note that "normal" is assumed to be zero by both the I/O system and file 00135 // systems. Do not change this value. 00136 // 00137 00138 #define IRP_MN_NORMAL 0x00 00139 #define IRP_MN_DPC 0x01 00140 #define IRP_MN_MDL 0x02 00141 #define IRP_MN_COMPLETE 0x04 00142 #define IRP_MN_COMPRESSED 0x08 00143 00144 #define IRP_MN_MDL_DPC (IRP_MN_MDL | IRP_MN_DPC) 00145 #define IRP_MN_COMPLETE_MDL (IRP_MN_COMPLETE | IRP_MN_MDL) 00146 #define IRP_MN_COMPLETE_MDL_DPC (IRP_MN_COMPLETE_MDL | IRP_MN_DPC) 00147 00148 // begin_wdm 00149 // 00150 // Device Control Request minor function codes for SCSI support. Note that 00151 // user requests are assumed to be zero. 00152 // 00153 00154 #define IRP_MN_SCSI_CLASS 0x01 00155 00156 // 00157 // PNP minor function codes. 00158 // 00159 00160 #define IRP_MN_START_DEVICE 0x00 00161 #define IRP_MN_QUERY_REMOVE_DEVICE 0x01 00162 #define IRP_MN_REMOVE_DEVICE 0x02 00163 #define IRP_MN_CANCEL_REMOVE_DEVICE 0x03 00164 #define IRP_MN_STOP_DEVICE 0x04 00165 #define IRP_MN_QUERY_STOP_DEVICE 0x05 00166 #define IRP_MN_CANCEL_STOP_DEVICE 0x06 00167 00168 #define IRP_MN_QUERY_DEVICE_RELATIONS 0x07 00169 #define IRP_MN_QUERY_INTERFACE 0x08 00170 #define IRP_MN_QUERY_CAPABILITIES 0x09 00171 #define IRP_MN_QUERY_RESOURCES 0x0A 00172 #define IRP_MN_QUERY_RESOURCE_REQUIREMENTS 0x0B 00173 #define IRP_MN_QUERY_DEVICE_TEXT 0x0C 00174 #define IRP_MN_FILTER_RESOURCE_REQUIREMENTS 0x0D 00175 00176 #define IRP_MN_READ_CONFIG 0x0F 00177 #define IRP_MN_WRITE_CONFIG 0x10 00178 #define IRP_MN_EJECT 0x11 00179 #define IRP_MN_SET_LOCK 0x12 00180 #define IRP_MN_QUERY_ID 0x13 00181 #define IRP_MN_QUERY_PNP_DEVICE_STATE 0x14 00182 #define IRP_MN_QUERY_BUS_INFORMATION 0x15 00183 #define IRP_MN_DEVICE_USAGE_NOTIFICATION 0x16 00184 #define IRP_MN_SURPRISE_REMOVAL 0x17 00185 // end_wdm 00186 #define IRP_MN_QUERY_LEGACY_BUS_INFORMATION 0x18 00187 // begin_wdm 00188 00189 // 00190 // POWER minor function codes 00191 // 00192 #define IRP_MN_WAIT_WAKE 0x00 00193 #define IRP_MN_POWER_SEQUENCE 0x01 00194 #define IRP_MN_SET_POWER 0x02 00195 #define IRP_MN_QUERY_POWER 0x03 00196 00197 // begin_ntminiport 00198 // 00199 // WMI minor function codes under IRP_MJ_SYSTEM_CONTROL 00200 // 00201 00202 #define IRP_MN_QUERY_ALL_DATA 0x00 00203 #define IRP_MN_QUERY_SINGLE_INSTANCE 0x01 00204 #define IRP_MN_CHANGE_SINGLE_INSTANCE 0x02 00205 #define IRP_MN_CHANGE_SINGLE_ITEM 0x03 00206 #define IRP_MN_ENABLE_EVENTS 0x04 00207 #define IRP_MN_DISABLE_EVENTS 0x05 00208 #define IRP_MN_ENABLE_COLLECTION 0x06 00209 #define IRP_MN_DISABLE_COLLECTION 0x07 00210 #define IRP_MN_REGINFO 0x08 00211 #define IRP_MN_EXECUTE_METHOD 0x09 00212 00213 // end_ntminiport 00214 // end_wdm end_ntddk end_nthal end_ntifs 00215 00216 // begin_wmikm 00217 // The following minor code is reserved as a private WMI minor function 00218 // For drivers who cannot include io.h, please see wmiumkm.h 00219 // 00220 #define IRP_MN_SET_TRACE_NOTIFY 0x0A 00221 00222 // end_wmikm 00223 // begin_wdm begin_ntddk begin_nthal begin_ntifs 00224 00225 // 00226 // Define option flags for IoCreateFile. Note that these values must be 00227 // exactly the same as the SL_... flags for a create function. Note also 00228 // that there are flags that may be passed to IoCreateFile that are not 00229 // placed in the stack location for the create IRP. These flags start in 00230 // the next byte. 00231 // 00232 00233 #define IO_FORCE_ACCESS_CHECK 0x0001 00234 #define IO_OPEN_PAGING_FILE 0x0002 00235 #define IO_OPEN_TARGET_DIRECTORY 0x0004 00236 // end_ntddk end_wdm end_nthal 00237 00238 // 00239 // Flags not passed to driver 00240 // 00241 00242 // begin_ntddk begin_wdm 00243 #define IO_NO_PARAMETER_CHECKING 0x0100 00244 00245 // 00246 // Define Information fields for whether or not a REPARSE or a REMOUNT has 00247 // occurred in the file system. 00248 // 00249 00250 #define IO_REPARSE 0x0 00251 #define IO_REMOUNT 0x1 00252 00253 // end_ntddk end_wdm 00254 00255 #define IO_CHECK_CREATE_PARAMETERS 0x0200 00256 #define IO_ATTACH_DEVICE 0x0400 00257 00258 // 00259 // Define kernel-only, internal option flags 00260 // 00261 00262 #define IO_ATTACH_DEVICE_API 0x80000000 00263 00264 00265 // end_ntifs 00266 00267 // 00268 // Define the driver interfaces required to write memory dumps. 00269 // 00270 00271 // 00272 // Define stall routine type for the dump driver. 00273 // 00274 00275 typedef 00276 VOID 00277 (*PSTALL_ROUTINE) ( 00278 IN ULONG Delay 00279 ); 00280 00281 // 00282 // Define the interfaces for the dump driver's routines. 00283 // 00284 00285 typedef 00286 BOOLEAN 00287 (*PDUMP_DRIVER_OPEN) ( 00288 IN LARGE_INTEGER PartitionOffset 00289 ); 00290 00291 typedef 00292 NTSTATUS 00293 (*PDUMP_DRIVER_WRITE) ( 00294 IN PLARGE_INTEGER DiskByteOffset, 00295 IN PMDL Mdl 00296 ); 00297 00298 00299 typedef 00300 VOID 00301 (*PDUMP_DRIVER_FINISH) ( 00302 VOID 00303 ); 00304 00305 struct _ADAPTER_OBJECT; 00306 00307 // 00308 // This is the information passed from the system to the disk dump driver 00309 // during the driver's initialization. 00310 // 00311 00312 typedef struct _INITIALIZATION_CONTEXT { 00313 ULONG Length; 00314 ULONG DiskSignature; 00315 PVOID MemoryBlock; 00316 PVOID CommonBuffer[2]; 00317 PHYSICAL_ADDRESS PhysicalAddress[2]; 00318 PSTALL_ROUTINE StallRoutine; 00319 PDUMP_DRIVER_OPEN OpenRoutine; 00320 PDUMP_DRIVER_WRITE WriteRoutine; 00321 PDUMP_DRIVER_FINISH FinishRoutine; 00322 struct _ADAPTER_OBJECT *AdapterObject; 00323 PVOID MappedRegisterBase; 00324 PVOID PortConfiguration; 00325 BOOLEAN CrashDump; 00326 ULONG MaximumTransferSize; 00327 ULONG CommonBufferSize; 00328 PVOID TargetAddress; //Opaque pointer to target address structure 00329 } INITIALIZATION_CONTEXT, *PINITIALIZATION_CONTEXT; 00330 00331 // begin_ntddk 00332 // 00333 // Define callout routine type for use in IoQueryDeviceDescription(). 00334 // 00335 00336 typedef NTSTATUS (*PIO_QUERY_DEVICE_ROUTINE)( 00337 IN PVOID Context, 00338 IN PUNICODE_STRING PathName, 00339 IN INTERFACE_TYPE BusType, 00340 IN ULONG BusNumber, 00341 IN PKEY_VALUE_FULL_INFORMATION *BusInformation, 00342 IN CONFIGURATION_TYPE ControllerType, 00343 IN ULONG ControllerNumber, 00344 IN PKEY_VALUE_FULL_INFORMATION *ControllerInformation, 00345 IN CONFIGURATION_TYPE PeripheralType, 00346 IN ULONG PeripheralNumber, 00347 IN PKEY_VALUE_FULL_INFORMATION *PeripheralInformation 00348 ); 00349 00350 // 00351 // Defines the order of the information in the array of 00352 // PKEY_VALUE_FULL_INFORMATION. 00353 // 00354 00355 typedef enum _IO_QUERY_DEVICE_DATA_FORMAT { 00356 IoQueryDeviceIdentifier = 0, 00357 IoQueryDeviceConfigurationData, 00358 IoQueryDeviceComponentInformation, 00359 IoQueryDeviceMaxData 00360 } IO_QUERY_DEVICE_DATA_FORMAT, *PIO_QUERY_DEVICE_DATA_FORMAT; 00361 00362 // begin_wdm begin_ntifs 00363 // 00364 // Define the objects that can be created by IoCreateFile. 00365 // 00366 00367 typedef enum _CREATE_FILE_TYPE { 00368 CreateFileTypeNone, 00369 CreateFileTypeNamedPipe, 00370 CreateFileTypeMailslot 00371 } CREATE_FILE_TYPE; 00372 00373 // end_ntddk end_wdm end_ntifs 00374 00375 // 00376 // Define the named pipe create parameters structure used for internal calls 00377 // to IoCreateFile when a named pipe is being created. This structure allows 00378 // code invoking this routine to pass information specific to this function 00379 // when creating a named pipe. 00380 // 00381 00382 typedef struct _NAMED_PIPE_CREATE_PARAMETERS { 00383 ULONG NamedPipeType; 00384 ULONG ReadMode; 00385 ULONG CompletionMode; 00386 ULONG MaximumInstances; 00387 ULONG InboundQuota; 00388 ULONG OutboundQuota; 00389 LARGE_INTEGER DefaultTimeout; 00390 BOOLEAN TimeoutSpecified; 00391 } NAMED_PIPE_CREATE_PARAMETERS, *PNAMED_PIPE_CREATE_PARAMETERS; 00392 00393 // 00394 // Define the mailslot create parameters structure used for internal calls 00395 // to IoCreateFile when a mailslot is being created. This structure allows 00396 // code invoking this routine to pass information specific to this function 00397 // when creating a mailslot. 00398 // 00399 00400 typedef struct _MAILSLOT_CREATE_PARAMETERS { 00401 ULONG MailslotQuota; 00402 ULONG MaximumMessageSize; 00403 LARGE_INTEGER ReadTimeout; 00404 BOOLEAN TimeoutSpecified; 00405 } MAILSLOT_CREATE_PARAMETERS, *PMAILSLOT_CREATE_PARAMETERS; 00406 00407 // 00408 // Define the dump driver stack context structure 00409 // 00410 00411 typedef struct { 00412 LIST_ENTRY Link; 00413 PLDR_DATA_TABLE_ENTRY Image; 00414 PVOID ImageBase; 00415 ULONG SizeOfImage; 00416 } DUMP_STACK_IMAGE, *PDUMP_STACK_IMAGE; 00417 00418 typedef struct { 00419 INITIALIZATION_CONTEXT Init; 00420 LARGE_INTEGER PartitionOffset; 00421 PVOID DumpPointers; 00422 ULONG PointersLength; 00423 PWCHAR ModulePrefix; 00424 LIST_ENTRY DriverList; 00425 ANSI_STRING InitMsg; 00426 ANSI_STRING ProgMsg; 00427 ANSI_STRING DoneMsg; 00428 PVOID FileObject; 00429 enum _DEVICE_USAGE_NOTIFICATION_TYPE UsageType; 00430 } DUMP_STACK_CONTEXT, *PDUMP_STACK_CONTEXT; 00431 00432 #define IO_DUMP_MAX_MDL_PAGES 8 00433 #define IO_DUMP_MEMORY_BLOCK_PAGES 8 00434 #define IO_DUMP_COMMON_BUFFER_SIZE 0x2000 00435 00436 NTSTATUS 00437 IoGetDumpStack( 00438 IN PWCHAR ModulePrefix, 00439 OUT PDUMP_STACK_CONTEXT *DumpStack, 00440 IN enum _DEVICE_USAGE_NOTIFICATION_TYPE UsageType, 00441 IN ULONG IgnoreDeviceUsageFailure 00442 ); 00443 00444 NTSTATUS 00445 IoInitializeDumpStack( 00446 IN PDUMP_STACK_CONTEXT DumpStack, 00447 IN PUCHAR MessageBuffer OPTIONAL 00448 ); 00449 00450 VOID 00451 IoGetDumpHiberRanges ( 00452 IN PVOID HiberContext, 00453 IN PDUMP_STACK_CONTEXT DumpStack 00454 ); 00455 00456 NTKERNELAPI 00457 BOOLEAN 00458 IoWriteCrashDump( 00459 IN ULONG BugCheckCode, 00460 IN ULONG_PTR BugCheckParameter1, 00461 IN ULONG_PTR BugCheckParameter2, 00462 IN ULONG_PTR BugCheckParameter3, 00463 IN ULONG_PTR BugCheckParameter4, 00464 IN PVOID Context 00465 ); 00466 00467 VOID 00468 IoFreeDumpStack( 00469 IN PDUMP_STACK_CONTEXT DumpStack 00470 ); 00471 00472 // begin_ntddk begin_wdm begin_nthal begin_ntifs 00473 // 00474 // Define the structures used by the I/O system 00475 // 00476 00477 // 00478 // Define empty typedefs for the _IRP, _DEVICE_OBJECT, and _DRIVER_OBJECT 00479 // structures so they may be referenced by function types before they are 00480 // actually defined. 00481 // 00482 struct _DEVICE_DESCRIPTION; 00483 struct _DEVICE_OBJECT; 00484 struct _DMA_ADAPTER; 00485 struct _DRIVER_OBJECT; 00486 struct _DRIVE_LAYOUT_INFORMATION; 00487 struct _DISK_PARTITION; 00488 struct _FILE_OBJECT; 00489 struct _IRP; 00490 struct _SCSI_REQUEST_BLOCK; 00491 00492 // 00493 // Define the I/O version of a DPC routine. 00494 // 00495 00496 typedef 00497 VOID 00498 (*PIO_DPC_ROUTINE) ( 00499 IN PKDPC Dpc, 00500 IN struct _DEVICE_OBJECT *DeviceObject, 00501 IN struct _IRP *Irp, 00502 IN PVOID Context 00503 ); 00504 00505 // 00506 // Define driver timer routine type. 00507 // 00508 00509 typedef 00510 VOID 00511 (*PIO_TIMER_ROUTINE) ( 00512 IN struct _DEVICE_OBJECT *DeviceObject, 00513 IN PVOID Context 00514 ); 00515 00516 // 00517 // Define driver initialization routine type. 00518 // 00519 00520 typedef 00521 NTSTATUS 00522 (*PDRIVER_INITIALIZE) ( 00523 IN struct _DRIVER_OBJECT *DriverObject, 00524 IN PUNICODE_STRING RegistryPath 00525 ); 00526 00527 // end_wdm 00528 // 00529 // Define driver reinitialization routine type. 00530 // 00531 00532 typedef 00533 VOID 00534 (*PDRIVER_REINITIALIZE) ( 00535 IN struct _DRIVER_OBJECT *DriverObject, 00536 IN PVOID Context, 00537 IN ULONG Count 00538 ); 00539 00540 // begin_wdm begin_ntndis 00541 // 00542 // Define driver cancel routine type. 00543 // 00544 00545 typedef 00546 VOID 00547 (*PDRIVER_CANCEL) ( 00548 IN struct _DEVICE_OBJECT *DeviceObject, 00549 IN struct _IRP *Irp 00550 ); 00551 00552 // 00553 // Define driver dispatch routine type. 00554 // 00555 00556 typedef 00557 NTSTATUS 00558 (*PDRIVER_DISPATCH) ( 00559 IN struct _DEVICE_OBJECT *DeviceObject, 00560 IN struct _IRP *Irp 00561 ); 00562 00563 // 00564 // Define driver start I/O routine type. 00565 // 00566 00567 typedef 00568 VOID 00569 (*PDRIVER_STARTIO) ( 00570 IN struct _DEVICE_OBJECT *DeviceObject, 00571 IN struct _IRP *Irp 00572 ); 00573 00574 // 00575 // Define driver unload routine type. 00576 // 00577 00578 typedef 00579 VOID 00580 (*PDRIVER_UNLOAD) ( 00581 IN struct _DRIVER_OBJECT *DriverObject 00582 ); 00583 00584 // 00585 // Define driver AddDevice routine type. 00586 // 00587 00588 typedef 00589 NTSTATUS 00590 (*PDRIVER_ADD_DEVICE) ( 00591 IN struct _DRIVER_OBJECT *DriverObject, 00592 IN struct _DEVICE_OBJECT *PhysicalDeviceObject 00593 ); 00594 00595 // end_ntddk end_wdm end_nthal end_ntndis 00596 00597 // 00598 // Define driver FS notification change routine type. 00599 // 00600 00601 typedef 00602 VOID 00603 (*PDRIVER_FS_NOTIFICATION) ( 00604 IN struct _DEVICE_OBJECT *DeviceObject, 00605 IN BOOLEAN FsActive 00606 ); 00607 00608 // begin_ntddk begin_wdm 00609 00610 // 00611 // Define fast I/O procedure prototypes. 00612 // 00613 // Fast I/O read and write procedures. 00614 // 00615 00616 typedef 00617 BOOLEAN 00618 (*PFAST_IO_CHECK_IF_POSSIBLE) ( 00619 IN struct _FILE_OBJECT *FileObject, 00620 IN PLARGE_INTEGER FileOffset, 00621 IN ULONG Length, 00622 IN BOOLEAN Wait, 00623 IN ULONG LockKey, 00624 IN BOOLEAN CheckForReadOperation, 00625 OUT PIO_STATUS_BLOCK IoStatus, 00626 IN struct _DEVICE_OBJECT *DeviceObject 00627 ); 00628 00629 typedef 00630 BOOLEAN 00631 (*PFAST_IO_READ) ( 00632 IN struct _FILE_OBJECT *FileObject, 00633 IN PLARGE_INTEGER FileOffset, 00634 IN ULONG Length, 00635 IN BOOLEAN Wait, 00636 IN ULONG LockKey, 00637 OUT PVOID Buffer, 00638 OUT PIO_STATUS_BLOCK IoStatus, 00639 IN struct _DEVICE_OBJECT *DeviceObject 00640 ); 00641 00642 typedef 00643 BOOLEAN 00644 (*PFAST_IO_WRITE) ( 00645 IN struct _FILE_OBJECT *FileObject, 00646 IN PLARGE_INTEGER FileOffset, 00647 IN ULONG Length, 00648 IN BOOLEAN Wait, 00649 IN ULONG LockKey, 00650 IN PVOID Buffer, 00651 OUT PIO_STATUS_BLOCK IoStatus, 00652 IN struct _DEVICE_OBJECT *DeviceObject 00653 ); 00654 00655 // 00656 // Fast I/O query basic and standard information procedures. 00657 // 00658 00659 typedef 00660 BOOLEAN 00661 (*PFAST_IO_QUERY_BASIC_INFO) ( 00662 IN struct _FILE_OBJECT *FileObject, 00663 IN BOOLEAN Wait, 00664 OUT PFILE_BASIC_INFORMATION Buffer, 00665 OUT PIO_STATUS_BLOCK IoStatus, 00666 IN struct _DEVICE_OBJECT *DeviceObject 00667 ); 00668 00669 typedef 00670 BOOLEAN 00671 (*PFAST_IO_QUERY_STANDARD_INFO) ( 00672 IN struct _FILE_OBJECT *FileObject, 00673 IN BOOLEAN Wait, 00674 OUT PFILE_STANDARD_INFORMATION Buffer, 00675 OUT PIO_STATUS_BLOCK IoStatus, 00676 IN struct _DEVICE_OBJECT *DeviceObject 00677 ); 00678 00679 // 00680 // Fast I/O lock and unlock procedures. 00681 // 00682 00683 typedef 00684 BOOLEAN 00685 (*PFAST_IO_LOCK) ( 00686 IN struct _FILE_OBJECT *FileObject, 00687 IN PLARGE_INTEGER FileOffset, 00688 IN PLARGE_INTEGER Length, 00689 PEPROCESS ProcessId, 00690 ULONG Key, 00691 BOOLEAN FailImmediately, 00692 BOOLEAN ExclusiveLock, 00693 OUT PIO_STATUS_BLOCK IoStatus, 00694 IN struct _DEVICE_OBJECT *DeviceObject 00695 ); 00696 00697 typedef 00698 BOOLEAN 00699 (*PFAST_IO_UNLOCK_SINGLE) ( 00700 IN struct _FILE_OBJECT *FileObject, 00701 IN PLARGE_INTEGER FileOffset, 00702 IN PLARGE_INTEGER Length, 00703 PEPROCESS ProcessId, 00704 ULONG Key, 00705 OUT PIO_STATUS_BLOCK IoStatus, 00706 IN struct _DEVICE_OBJECT *DeviceObject 00707 ); 00708 00709 typedef 00710 BOOLEAN 00711 (*PFAST_IO_UNLOCK_ALL) ( 00712 IN struct _FILE_OBJECT *FileObject, 00713 PEPROCESS ProcessId, 00714 OUT PIO_STATUS_BLOCK IoStatus, 00715 IN struct _DEVICE_OBJECT *DeviceObject 00716 ); 00717 00718 typedef 00719 BOOLEAN 00720 (*PFAST_IO_UNLOCK_ALL_BY_KEY) ( 00721 IN struct _FILE_OBJECT *FileObject, 00722 PVOID ProcessId, 00723 ULONG Key, 00724 OUT PIO_STATUS_BLOCK IoStatus, 00725 IN struct _DEVICE_OBJECT *DeviceObject 00726 ); 00727 00728 // 00729 // Fast I/O device control procedure. 00730 // 00731 00732 typedef 00733 BOOLEAN 00734 (*PFAST_IO_DEVICE_CONTROL) ( 00735 IN struct _FILE_OBJECT *FileObject, 00736 IN BOOLEAN Wait, 00737 IN PVOID InputBuffer OPTIONAL, 00738 IN ULONG InputBufferLength, 00739 OUT PVOID OutputBuffer OPTIONAL, 00740 IN ULONG OutputBufferLength, 00741 IN ULONG IoControlCode, 00742 OUT PIO_STATUS_BLOCK IoStatus, 00743 IN struct _DEVICE_OBJECT *DeviceObject 00744 ); 00745 00746 // 00747 // Define callbacks for NtCreateSection to synchronize correctly with 00748 // the file system. It pre-acquires the resources that will be needed 00749 // when calling to query and set file/allocation size in the file system. 00750 // 00751 00752 typedef 00753 VOID 00754 (*PFAST_IO_ACQUIRE_FILE) ( 00755 IN struct _FILE_OBJECT *FileObject 00756 ); 00757 00758 typedef 00759 VOID 00760 (*PFAST_IO_RELEASE_FILE) ( 00761 IN struct _FILE_OBJECT *FileObject 00762 ); 00763 00764 // 00765 // Define callback for drivers that have device objects attached to lower- 00766 // level drivers' device objects. This callback is made when the lower-level 00767 // driver is deleting its device object. 00768 // 00769 00770 typedef 00771 VOID 00772 (*PFAST_IO_DETACH_DEVICE) ( 00773 IN struct _DEVICE_OBJECT *SourceDevice, 00774 IN struct _DEVICE_OBJECT *TargetDevice 00775 ); 00776 00777 // 00778 // This structure is used by the server to quickly get the information needed 00779 // to service a server open call. It is takes what would be two fast io calls 00780 // one for basic information and the other for standard information and makes 00781 // it into one call. 00782 // 00783 00784 typedef 00785 BOOLEAN 00786 (*PFAST_IO_QUERY_NETWORK_OPEN_INFO) ( 00787 IN struct _FILE_OBJECT *FileObject, 00788 IN BOOLEAN Wait, 00789 OUT struct _FILE_NETWORK_OPEN_INFORMATION *Buffer, 00790 OUT struct _IO_STATUS_BLOCK *IoStatus, 00791 IN struct _DEVICE_OBJECT *DeviceObject 00792 ); 00793 00794 // 00795 // Define Mdl-based routines for the server to call 00796 // 00797 00798 typedef 00799 BOOLEAN 00800 (*PFAST_IO_MDL_READ) ( 00801 IN struct _FILE_OBJECT *FileObject, 00802 IN PLARGE_INTEGER FileOffset, 00803 IN ULONG Length, 00804 IN ULONG LockKey, 00805 OUT PMDL *MdlChain, 00806 OUT PIO_STATUS_BLOCK IoStatus, 00807 IN struct _DEVICE_OBJECT *DeviceObject 00808 ); 00809 00810 typedef 00811 BOOLEAN 00812 (*PFAST_IO_MDL_READ_COMPLETE) ( 00813 IN struct _FILE_OBJECT *FileObject, 00814 IN PMDL MdlChain, 00815 IN struct _DEVICE_OBJECT *DeviceObject 00816 ); 00817 00818 typedef 00819 BOOLEAN 00820 (*PFAST_IO_PREPARE_MDL_WRITE) ( 00821 IN struct _FILE_OBJECT *FileObject, 00822 IN PLARGE_INTEGER FileOffset, 00823 IN ULONG Length, 00824 IN ULONG LockKey, 00825 OUT PMDL *MdlChain, 00826 OUT PIO_STATUS_BLOCK IoStatus, 00827 IN struct _DEVICE_OBJECT *DeviceObject 00828 ); 00829 00830 typedef 00831 BOOLEAN 00832 (*PFAST_IO_MDL_WRITE_COMPLETE) ( 00833 IN struct _FILE_OBJECT *FileObject, 00834 IN PLARGE_INTEGER FileOffset, 00835 IN PMDL MdlChain, 00836 IN struct _DEVICE_OBJECT *DeviceObject 00837 ); 00838 00839 // 00840 // If this routine is present, it will be called by FsRtl 00841 // to acquire the file for the mapped page writer. 00842 // 00843 00844 typedef 00845 NTSTATUS 00846 (*PFAST_IO_ACQUIRE_FOR_MOD_WRITE) ( 00847 IN struct _FILE_OBJECT *FileObject, 00848 IN PLARGE_INTEGER EndingOffset, 00849 OUT struct _ERESOURCE **ResourceToRelease, 00850 IN struct _DEVICE_OBJECT *DeviceObject 00851 ); 00852 00853 typedef 00854 NTSTATUS 00855 (*PFAST_IO_RELEASE_FOR_MOD_WRITE) ( 00856 IN struct _FILE_OBJECT *FileObject, 00857 IN struct _ERESOURCE *ResourceToRelease, 00858 IN struct _DEVICE_OBJECT *DeviceObject 00859 ); 00860 00861 // 00862 // If this routine is present, it will be called by FsRtl 00863 // to acquire the file for the mapped page writer. 00864 // 00865 00866 typedef 00867 NTSTATUS 00868 (*PFAST_IO_ACQUIRE_FOR_CCFLUSH) ( 00869 IN struct _FILE_OBJECT *FileObject, 00870 IN struct _DEVICE_OBJECT *DeviceObject 00871 ); 00872 00873 typedef 00874 NTSTATUS 00875 (*PFAST_IO_RELEASE_FOR_CCFLUSH) ( 00876 IN struct _FILE_OBJECT *FileObject, 00877 IN struct _DEVICE_OBJECT *DeviceObject 00878 ); 00879 00880 typedef 00881 BOOLEAN 00882 (*PFAST_IO_READ_COMPRESSED) ( 00883 IN struct _FILE_OBJECT *FileObject, 00884 IN PLARGE_INTEGER FileOffset, 00885 IN ULONG Length, 00886 IN ULONG LockKey, 00887 OUT PVOID Buffer, 00888 OUT PMDL *MdlChain, 00889 OUT PIO_STATUS_BLOCK IoStatus, 00890 OUT struct _COMPRESSED_DATA_INFO *CompressedDataInfo, 00891 IN ULONG CompressedDataInfoLength, 00892 IN struct _DEVICE_OBJECT *DeviceObject 00893 ); 00894 00895 typedef 00896 BOOLEAN 00897 (*PFAST_IO_WRITE_COMPRESSED) ( 00898 IN struct _FILE_OBJECT *FileObject, 00899 IN PLARGE_INTEGER FileOffset, 00900 IN ULONG Length, 00901 IN ULONG LockKey, 00902 IN PVOID Buffer, 00903 OUT PMDL *MdlChain, 00904 OUT PIO_STATUS_BLOCK IoStatus, 00905 IN struct _COMPRESSED_DATA_INFO *CompressedDataInfo, 00906 IN ULONG CompressedDataInfoLength, 00907 IN struct _DEVICE_OBJECT *DeviceObject 00908 ); 00909 00910 typedef 00911 BOOLEAN 00912 (*PFAST_IO_MDL_READ_COMPLETE_COMPRESSED) ( 00913 IN struct _FILE_OBJECT *FileObject, 00914 IN PMDL MdlChain, 00915 IN struct _DEVICE_OBJECT *DeviceObject 00916 ); 00917 00918 typedef 00919 BOOLEAN 00920 (*PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED) ( 00921 IN struct _FILE_OBJECT *FileObject, 00922 IN PLARGE_INTEGER FileOffset, 00923 IN PMDL MdlChain, 00924 IN struct _DEVICE_OBJECT *DeviceObject 00925 ); 00926 00927 typedef 00928 BOOLEAN 00929 (*PFAST_IO_QUERY_OPEN) ( 00930 IN struct _IRP *Irp, 00931 OUT PFILE_NETWORK_OPEN_INFORMATION NetworkInformation, 00932 IN struct _DEVICE_OBJECT *DeviceObject 00933 ); 00934 00935 // 00936 // Define the structure to describe the Fast I/O dispatch routines. Any 00937 // additions made to this structure MUST be added monotonically to the end 00938 // of the structure, and fields CANNOT be removed from the middle. 00939 // 00940 00941 typedef struct _FAST_IO_DISPATCH { 00942 ULONG SizeOfFastIoDispatch; 00943 PFAST_IO_CHECK_IF_POSSIBLE FastIoCheckIfPossible; 00944 PFAST_IO_READ FastIoRead; 00945 PFAST_IO_WRITE FastIoWrite; 00946 PFAST_IO_QUERY_BASIC_INFO FastIoQueryBasicInfo; 00947 PFAST_IO_QUERY_STANDARD_INFO FastIoQueryStandardInfo; 00948 PFAST_IO_LOCK FastIoLock; 00949 PFAST_IO_UNLOCK_SINGLE FastIoUnlockSingle; 00950 PFAST_IO_UNLOCK_ALL FastIoUnlockAll; 00951 PFAST_IO_UNLOCK_ALL_BY_KEY FastIoUnlockAllByKey; 00952 PFAST_IO_DEVICE_CONTROL FastIoDeviceControl; 00953 PFAST_IO_ACQUIRE_FILE AcquireFileForNtCreateSection; 00954 PFAST_IO_RELEASE_FILE ReleaseFileForNtCreateSection; 00955 PFAST_IO_DETACH_DEVICE FastIoDetachDevice; 00956 PFAST_IO_QUERY_NETWORK_OPEN_INFO FastIoQueryNetworkOpenInfo; 00957 PFAST_IO_ACQUIRE_FOR_MOD_WRITE AcquireForModWrite; 00958 PFAST_IO_MDL_READ MdlRead; 00959 PFAST_IO_MDL_READ_COMPLETE MdlReadComplete; 00960 PFAST_IO_PREPARE_MDL_WRITE PrepareMdlWrite; 00961 PFAST_IO_MDL_WRITE_COMPLETE MdlWriteComplete; 00962 PFAST_IO_READ_COMPRESSED FastIoReadCompressed; 00963 PFAST_IO_WRITE_COMPRESSED FastIoWriteCompressed; 00964 PFAST_IO_MDL_READ_COMPLETE_COMPRESSED MdlReadCompleteCompressed; 00965 PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED MdlWriteCompleteCompressed; 00966 PFAST_IO_QUERY_OPEN FastIoQueryOpen; 00967 PFAST_IO_RELEASE_FOR_MOD_WRITE ReleaseForModWrite; 00968 PFAST_IO_ACQUIRE_FOR_CCFLUSH AcquireForCcFlush; 00969 PFAST_IO_RELEASE_FOR_CCFLUSH ReleaseForCcFlush; 00970 } FAST_IO_DISPATCH, *PFAST_IO_DISPATCH; 00971 00972 // end_ntddk end_wdm 00973 00974 // begin_ntddk begin_wdm begin_nthal 00975 // 00976 // Define the actions that a driver execution routine may request of the 00977 // adapter/controller allocation routines upon return. 00978 // 00979 00980 typedef enum _IO_ALLOCATION_ACTION { 00981 KeepObject = 1, 00982 DeallocateObject, 00983 DeallocateObjectKeepRegisters 00984 } IO_ALLOCATION_ACTION, *PIO_ALLOCATION_ACTION; 00985 00986 // 00987 // Define device driver adapter/controller execution routine. 00988 // 00989 00990 typedef 00991 IO_ALLOCATION_ACTION 00992 (*PDRIVER_CONTROL) ( 00993 IN struct _DEVICE_OBJECT *DeviceObject, 00994 IN struct _IRP *Irp, 00995 IN PVOID MapRegisterBase, 00996 IN PVOID Context 00997 ); 00998 00999 // end_ntddk end_wdm end_nthal end_ntifs 01000 01001 // 01002 // Define the I/O system's structure for a connected interrupt. This is 01003 // useful for connecting an ISR to several different processors. 01004 // 01005 01006 typedef struct _IO_INTERRUPT_STRUCTURE { 01007 KINTERRUPT InterruptObject; 01008 PKINTERRUPT InterruptArray[MAXIMUM_PROCESSORS]; 01009 KSPIN_LOCK SpinLock; 01010 } IO_INTERRUPT_STRUCTURE, *PIO_INTERRUPT_STRUCTURE; 01011 01012 // begin_ntddk begin_wdm begin_ntifs 01013 // 01014 // Define the I/O system's security context type for use by file system's 01015 // when checking access to volumes, files, and directories. 01016 // 01017 01018 typedef struct _IO_SECURITY_CONTEXT { 01019 PSECURITY_QUALITY_OF_SERVICE SecurityQos; 01020 PACCESS_STATE AccessState; 01021 ACCESS_MASK DesiredAccess; 01022 ULONG FullCreateOptions; 01023 } IO_SECURITY_CONTEXT, *PIO_SECURITY_CONTEXT; 01024 01025 // end_ntddk end_wdm end_ntifs 01026 01027 // 01028 // Define the I/O system's version of a timer. 01029 // 01030 01031 typedef struct _IO_TIMER { 01032 CSHORT Type; 01033 CSHORT TimerFlag; 01034 LIST_ENTRY TimerList; 01035 PIO_TIMER_ROUTINE TimerRoutine; 01036 PVOID Context; 01037 struct _DEVICE_OBJECT *DeviceObject; 01038 } IO_TIMER, *PIO_TIMER; 01039 01040 // 01041 // Define the client driver object extension header. 01042 // 01043 01044 typedef struct _IO_CLIENT_EXTENSION { 01045 struct _IO_CLIENT_EXTENSION *NextExtension; 01046 PVOID ClientIdentificationAddress; 01047 } IO_CLIENT_EXTENSION, *PIO_CLIENT_EXTENSION; 01048 01049 // begin_ntddk begin_nthal begin_ntifs 01050 // 01051 // Define Volume Parameter Block (VPB) flags. 01052 // 01053 01054 #define VPB_MOUNTED 0x00000001 01055 #define VPB_LOCKED 0x00000002 01056 #define VPB_PERSISTENT 0x00000004 01057 #define VPB_REMOVE_PENDING 0x00000008 01058 #define VPB_RAW_MOUNT 0x00000010 01059 01060 01061 // 01062 // Volume Parameter Block (VPB) 01063 // 01064 01065 #define MAXIMUM_VOLUME_LABEL_LENGTH (32 * sizeof(WCHAR)) // 32 characters 01066 01067 typedef struct _VPB { 01068 CSHORT Type; 01069 CSHORT Size; 01070 USHORT Flags; 01071 USHORT VolumeLabelLength; // in bytes 01072 struct _DEVICE_OBJECT *DeviceObject; 01073 struct _DEVICE_OBJECT *RealDevice; 01074 ULONG SerialNumber; 01075 ULONG ReferenceCount; 01076 WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH / sizeof(WCHAR)]; 01077 } VPB, *PVPB; 01078 01079 01080 #if defined(_AXP64_) 01081 01082 // 01083 // Use __inline DMA macros (hal.h) 01084 // 01085 #ifndef USE_DMA_MACROS 01086 #define USE_DMA_MACROS 01087 #endif 01088 01089 // 01090 // Only PnP drivers! 01091 // 01092 #ifndef NO_LEGACY_DRIVERS 01093 #define NO_LEGACY_DRIVERS 01094 #endif 01095 01096 #endif // _AXP64_ 01097 01098 01099 #if defined(USE_DMA_MACROS) && (defined(_NTDDK_) || defined(_NTDRIVER_)) 01100 01101 // begin_wdm 01102 // 01103 // Define object type specific fields of various objects used by the I/O system 01104 // 01105 01106 typedef struct _DMA_ADAPTER *PADAPTER_OBJECT; 01107 01108 // end_wdm 01109 #else 01110 01111 // 01112 // Define object type specific fields of various objects used by the I/O system 01113 // 01114 01115 typedef struct _ADAPTER_OBJECT *PADAPTER_OBJECT; // ntndis 01116 01117 #endif // USE_DMA_MACROS && (_NTDDK_ || _NTDRIVER_) 01118 01119 // begin_wdm 01120 // 01121 // Define Wait Context Block (WCB) 01122 // 01123 01124 typedef struct _WAIT_CONTEXT_BLOCK { 01125 KDEVICE_QUEUE_ENTRY WaitQueueEntry; 01126 PDRIVER_CONTROL DeviceRoutine; 01127 PVOID DeviceContext; 01128 ULONG NumberOfMapRegisters; 01129 PVOID DeviceObject; 01130 PVOID CurrentIrp; 01131 PKDPC BufferChainingDpc; 01132 } WAIT_CONTEXT_BLOCK, *PWAIT_CONTEXT_BLOCK; 01133 01134 // end_wdm 01135 01136 typedef struct _CONTROLLER_OBJECT { 01137 CSHORT Type; 01138 CSHORT Size; 01139 PVOID ControllerExtension; 01140 KDEVICE_QUEUE DeviceWaitQueue; 01141 01142 ULONG Spare1; 01143 LARGE_INTEGER Spare2; 01144 01145 } CONTROLLER_OBJECT, *PCONTROLLER_OBJECT; 01146 01147 // begin_wdm 01148 // 01149 // Define Device Object (DO) flags 01150 // 01151 // end_wdm end_ntddk end_nthal end_ntifs 01152 01153 #define DO_VERIFY_VOLUME 0x00000002 // ntddk nthal ntifs 01154 #define DO_BUFFERED_IO 0x00000004 // ntddk nthal ntifs wdm 01155 #define DO_EXCLUSIVE 0x00000008 // ntddk nthal ntifs wdm 01156 #define DO_DIRECT_IO 0x00000010 // ntddk nthal ntifs wdm 01157 #define DO_MAP_IO_BUFFER 0x00000020 // ntddk nthal ntifs wdm 01158 #define DO_DEVICE_HAS_NAME 0x00000040 // ntddk nthal ntifs 01159 #define DO_DEVICE_INITIALIZING 0x00000080 // ntddk nthal ntifs wdm 01160 #define DO_SYSTEM_BOOT_PARTITION 0x00000100 // ntddk nthal ntifs 01161 #define DO_LONG_TERM_REQUESTS 0x00000200 // ntddk nthal ntifs 01162 #define DO_NEVER_LAST_DEVICE 0x00000400 // ntddk nthal ntifs 01163 #define DO_SHUTDOWN_REGISTERED 0x00000800 // ntddk nthal ntifs wdm 01164 #define DO_BUS_ENUMERATED_DEVICE 0x00001000 // ntddk nthal ntifs wdm 01165 #define DO_POWER_PAGABLE 0x00002000 // ntddk nthal ntifs wdm 01166 #define DO_POWER_INRUSH 0x00004000 // ntddk nthal ntifs wdm 01167 #define DO_POWER_NOOP 0x00008000 01168 #define DO_LOW_PRIORITY_FILESYSTEM 0x00010000 // ntddk nthal ntifs 01169 01170 // begin_wdm begin_ntddk begin_nthal begin_ntifs 01171 // 01172 // Device Object structure definition 01173 // 01174 01175 typedef struct _DEVICE_OBJECT { 01176 CSHORT Type; 01177 USHORT Size; 01178 LONG ReferenceCount; 01179 struct _DRIVER_OBJECT *DriverObject; 01180 struct _DEVICE_OBJECT *NextDevice; 01181 struct _DEVICE_OBJECT *AttachedDevice; 01182 struct _IRP *CurrentIrp; 01183 PIO_TIMER Timer; 01184 ULONG Flags; // See above: DO_... 01185 ULONG Characteristics; // See ntioapi: FILE_... 01186 PVPB Vpb; 01187 PVOID DeviceExtension; 01188 DEVICE_TYPE DeviceType; 01189 CCHAR StackSize; 01190 union { 01191 LIST_ENTRY ListEntry; 01192 WAIT_CONTEXT_BLOCK Wcb; 01193 } Queue; 01194 ULONG AlignmentRequirement; 01195 KDEVICE_QUEUE DeviceQueue; 01196 KDPC Dpc; 01197 01198 // 01199 // The following field is for exclusive use by the filesystem to keep 01200 // track of the number of Fsp threads currently using the device 01201 // 01202 01203 ULONG ActiveThreadCount; 01204 PSECURITY_DESCRIPTOR SecurityDescriptor; 01205 KEVENT DeviceLock; 01206 01207 USHORT SectorSize; 01208 USHORT Spare1; 01209 01210 struct _DEVOBJ_EXTENSION *DeviceObjectExtension; 01211 PVOID Reserved; 01212 } DEVICE_OBJECT; 01213 typedef struct _DEVICE_OBJECT *PDEVICE_OBJECT; // ntndis 01214 01215 // end_ntddk end_nthal end_ntifs end_wdm 01216 // 01217 // Define the Device Object Extension Flags 01218 // 01219 01220 #define DOE_UNLOAD_PENDING 0x00000001 01221 #define DOE_DELETE_PENDING 0x00000002 01222 #define DOE_REMOVE_PENDING 0x00000004 01223 #define DOE_REMOVE_PROCESSED 0x00000008 01224 #define DOE_START_PENDING 0x00000010 01225 01226 // begin_ntddk begin_nthal begin_ntifs begin_wdm 01227 01228 struct _DEVICE_OBJECT_POWER_EXTENSION; 01229 01230 typedef struct _DEVOBJ_EXTENSION { 01231 01232 CSHORT Type; 01233 USHORT Size; 01234 01235 // 01236 // Public part of the DeviceObjectExtension structure 01237 // 01238 01239 PDEVICE_OBJECT DeviceObject; // owning device object 01240 01241 // end_ntddk end_nthal end_ntifs end_wdm 01242 01243 // 01244 // Universal Power Data - all device objects must have this 01245 // 01246 01247 ULONG PowerFlags; // see ntos\po\pop.h 01248 // WARNING: Access via PO macros 01249 // and with PO locking rules ONLY. 01250 01251 // 01252 // Pointer to the non-universal power data 01253 // Power data that only some device objects need is stored in the 01254 // device object power extension -> DOPE 01255 // see po.h 01256 // 01257 01258 struct _DEVICE_OBJECT_POWER_EXTENSION *Dope; 01259 01260 // 01261 // power state information 01262 // 01263 01264 // 01265 // Device object extension flags. Protected by the IopDatabaseLock. 01266 // 01267 01268 ULONG ExtensionFlags; 01269 01270 // 01271 // PnP manager fields 01272 // 01273 01274 PVOID DeviceNode; 01275 01276 // 01277 // AttachedTo is a pointer to the device object that this device 01278 // object is attached to. The attachment chain is now doubly 01279 // linked: this pointer and DeviceObject->AttachedDevice provide the 01280 // linkage. 01281 // 01282 01283 PDEVICE_OBJECT AttachedTo; 01284 01285 // 01286 // Doubly-linked list of file objects 01287 // 01288 01289 LIST_ENTRY FileObjectList; 01290 01291 // begin_ntddk begin_wdm begin_nthal begin_ntifs 01292 01293 } DEVOBJ_EXTENSION, *PDEVOBJ_EXTENSION; 01294 01295 // 01296 // Define Driver Object (DRVO) flags 01297 // 01298 01299 #define DRVO_UNLOAD_INVOKED 0x00000001 01300 #define DRVO_LEGACY_DRIVER 0x00000002 01301 #define DRVO_BUILTIN_DRIVER 0x00000004 // Driver objects for Hal, PnP Mgr 01302 // end_wdm 01303 #define DRVO_REINIT_REGISTERED 0x00000008 01304 #define DRVO_INITIALIZED 0x00000010 01305 #define DRVO_BOOTREINIT_REGISTERED 0x00000020 01306 #define DRVO_LEGACY_RESOURCES 0x00000040 01307 // begin_wdm 01308 01309 typedef struct _DRIVER_EXTENSION { 01310 01311 // 01312 // Back pointer to Driver Object 01313 // 01314 01315 struct _DRIVER_OBJECT *DriverObject; 01316 01317 // 01318 // The AddDevice entry point is called by the Plug & Play manager 01319 // to inform the driver when a new device instance arrives that this 01320 // driver must control. 01321 // 01322 01323 PDRIVER_ADD_DEVICE AddDevice; 01324 01325 // 01326 // The count field is used to count the number of times the driver has 01327 // had its registered reinitialization routine invoked. 01328 // 01329 01330 ULONG Count; 01331 01332 // 01333 // The service name field is used by the pnp manager to determine 01334 // where the driver related info is stored in the registry. 01335 // 01336 01337 UNICODE_STRING ServiceKeyName; 01338 01339 // 01340 // Note: any new shared fields get added here. 01341 // 01342 01343 // end_ntddk end_wdm end_nthal end_ntifs 01344 01345 // 01346 // The client driver object extension field is used by class driver 01347 // to store per driver information. 01348 // 01349 01350 PIO_CLIENT_EXTENSION ClientDriverExtension; 01351 01352 // begin_ntddk begin_wdm begin_nthal begin_ntifs 01353 01354 } DRIVER_EXTENSION, *PDRIVER_EXTENSION; 01355 01356 typedef struct _DRIVER_OBJECT { 01357 CSHORT Type; 01358 CSHORT Size; 01359 01360 // 01361 // The following links all of the devices created by a single driver 01362 // together on a list, and the Flags word provides an extensible flag 01363 // location for driver objects. 01364 // 01365 01366 PDEVICE_OBJECT DeviceObject; 01367 ULONG Flags; 01368 01369 // 01370 // The following section describes where the driver is loaded. The count 01371 // field is used to count the number of times the driver has had its 01372 // registered reinitialization routine invoked. 01373 // 01374 01375 PVOID DriverStart; 01376 ULONG DriverSize; 01377 PVOID DriverSection; 01378 PDRIVER_EXTENSION DriverExtension; 01379 01380 // 01381 // The driver name field is used by the error log thread 01382 // determine the name of the driver that an I/O request is/was bound. 01383 // 01384 01385 UNICODE_STRING DriverName; 01386 01387 // 01388 // The following section is for registry support. Thise is a pointer 01389 // to the path to the hardware information in the registry 01390 // 01391 01392 PUNICODE_STRING HardwareDatabase; 01393 01394 // 01395 // The following section contains the optional pointer to an array of 01396 // alternate entry points to a driver for "fast I/O" support. Fast I/O 01397 // is performed by invoking the driver routine directly with separate 01398 // parameters, rather than using the standard IRP call mechanism. Note 01399 // that these functions may only be used for synchronous I/O, and when 01400 // the file is cached. 01401 // 01402 01403 PFAST_IO_DISPATCH FastIoDispatch; 01404 01405 // 01406 // The following section describes the entry points to this particular 01407 // driver. Note that the major function dispatch table must be the last 01408 // field in the object so that it remains extensible. 01409 // 01410 01411 PDRIVER_INITIALIZE DriverInit; 01412 PDRIVER_STARTIO DriverStartIo; 01413 PDRIVER_UNLOAD DriverUnload; 01414 PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1]; 01415 01416 } DRIVER_OBJECT; 01417 typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT; // ntndis 01418 01419 01420 // end_ntddk end_wdm end_ntifs 01421 01422 // 01423 // Device Handler Object. There is one of these objects per PnP 01424 // device. This object is given to the device driver as a PVOID 01425 // and is used by the driver to refer to a particular device. 01426 // 01427 01428 typedef struct _DEVICE_HANDLER_OBJECT { 01429 CSHORT Type; 01430 USHORT Size; 01431 01432 // 01433 // Indentifies which bus extender this device handler 01434 // object is associated with 01435 // 01436 01437 struct _BUS_HANDLER *BusHandler; 01438 01439 // 01440 // The associated SlotNumber for this device handler 01441 // 01442 01443 ULONG SlotNumber; 01444 01445 // end_nthal 01446 01447 // 01448 // System internal fields 01449 // 01450 01451 // 01452 // Pnp stuff 01453 // 01454 01455 UNICODE_STRING ServiceKeyName; 01456 ULONG InstanceOrdinal; 01457 01458 // begin_nthal 01459 01460 01461 } DEVICE_HANDLER_OBJECT, *PDEVICE_HANDLER_OBJECT; 01462 01463 // begin_ntddk begin_wdm begin_ntifs 01464 01465 // 01466 // The following structure is pointed to by the SectionObject pointer field 01467 // of a file object, and is allocated by the various NT file systems. 01468 // 01469 01470 typedef struct _SECTION_OBJECT_POINTERS { 01471 PVOID DataSectionObject; 01472 PVOID SharedCacheMap; 01473 PVOID ImageSectionObject; 01474 } SECTION_OBJECT_POINTERS; 01475 typedef SECTION_OBJECT_POINTERS *PSECTION_OBJECT_POINTERS; 01476 01477 // 01478 // Define the format of a completion message. 01479 // 01480 01481 typedef struct _IO_COMPLETION_CONTEXT { 01482 PVOID Port; 01483 PVOID Key; 01484 } IO_COMPLETION_CONTEXT, *PIO_COMPLETION_CONTEXT; 01485 01486 // 01487 // Define File Object (FO) flags 01488 // 01489 01490 #define FO_FILE_OPEN 0x00000001 01491 #define FO_SYNCHRONOUS_IO 0x00000002 01492 #define FO_ALERTABLE_IO 0x00000004 01493 #define FO_NO_INTERMEDIATE_BUFFERING 0x00000008 01494 #define FO_WRITE_THROUGH 0x00000010 01495 #define FO_SEQUENTIAL_ONLY 0x00000020 01496 #define FO_CACHE_SUPPORTED 0x00000040 01497 #define FO_NAMED_PIPE 0x00000080 01498 #define FO_STREAM_FILE 0x00000100 01499 #define FO_MAILSLOT 0x00000200 01500 #define FO_GENERATE_AUDIT_ON_CLOSE 0x00000400 01501 #define FO_DIRECT_DEVICE_OPEN 0x00000800 01502 #define FO_FILE_MODIFIED 0x00001000 01503 #define FO_FILE_SIZE_CHANGED 0x00002000 01504 #define FO_CLEANUP_COMPLETE 0x00004000 01505 #define FO_TEMPORARY_FILE 0x00008000 01506 #define FO_DELETE_ON_CLOSE 0x00010000 01507 #define FO_OPENED_CASE_SENSITIVE 0x00020000 01508 #define FO_HANDLE_CREATED 0x00040000 01509 #define FO_FILE_FAST_IO_READ 0x00080000 01510 #define FO_RANDOM_ACCESS 0x00100000 01511 #define FO_FILE_OPEN_CANCELLED 0x00200000 01512 #define FO_VOLUME_OPEN 0x00400000 01513 01514 typedef struct _FILE_OBJECT { 01515 CSHORT Type; 01516 CSHORT Size; 01517 PDEVICE_OBJECT DeviceObject; 01518 PVPB Vpb; 01519 PVOID FsContext; 01520 PVOID FsContext2; 01521 PSECTION_OBJECT_POINTERS SectionObjectPointer; 01522 PVOID PrivateCacheMap; 01523 NTSTATUS FinalStatus; 01524 struct _FILE_OBJECT *RelatedFileObject; 01525 BOOLEAN LockOperation; 01526 BOOLEAN DeletePending; 01527 BOOLEAN ReadAccess; 01528 BOOLEAN WriteAccess; 01529 BOOLEAN DeleteAccess; 01530 BOOLEAN SharedRead; 01531 BOOLEAN SharedWrite; 01532 BOOLEAN SharedDelete; 01533 ULONG Flags; 01534 UNICODE_STRING FileName; 01535 LARGE_INTEGER CurrentByteOffset; 01536 ULONG Waiters; 01537 ULONG Busy; 01538 PVOID LastLock; 01539 KEVENT Lock; 01540 KEVENT Event; 01541 PIO_COMPLETION_CONTEXT CompletionContext; 01542 } FILE_OBJECT; 01543 typedef struct _FILE_OBJECT *PFILE_OBJECT; // ntndis 01544 01545 // 01546 // Define I/O Request Packet (IRP) flags 01547 // 01548 01549 #define IRP_NOCACHE 0x00000001 01550 #define IRP_PAGING_IO 0x00000002 01551 #define IRP_MOUNT_COMPLETION 0x00000002 01552 #define IRP_SYNCHRONOUS_API 0x00000004 01553 #define IRP_ASSOCIATED_IRP 0x00000008 01554 #define IRP_BUFFERED_IO 0x00000010 01555 #define IRP_DEALLOCATE_BUFFER 0x00000020 01556 #define IRP_INPUT_OPERATION 0x00000040 01557 #define IRP_SYNCHRONOUS_PAGING_IO 0x00000040 01558 #define IRP_CREATE_OPERATION 0x00000080 01559 #define IRP_READ_OPERATION 0x00000100 01560 #define IRP_WRITE_OPERATION 0x00000200 01561 #define IRP_CLOSE_OPERATION 0x00000400 01562 // end_wdm 01563 01564 #define IRP_DEFER_IO_COMPLETION 0x00000800 01565 #define IRP_OB_QUERY_NAME 0x00001000 01566 #define IRP_HOLD_DEVICE_QUEUE 0x00002000 01567 #define IRP_RETRY_IO_COMPLETION 0x00004000 01568 01569 // begin_wdm 01570 // 01571 // Define I/O request packet (IRP) alternate flags for allocation control. 01572 // 01573 01574 #define IRP_QUOTA_CHARGED 0x01 01575 #define IRP_ALLOCATED_MUST_SUCCEED 0x02 01576 #define IRP_ALLOCATED_FIXED_SIZE 0x04 01577 #define IRP_LOOKASIDE_ALLOCATION 0x08 01578 01579 // 01580 // I/O Request Packet (IRP) definition 01581 // 01582 01583 typedef struct _IRP { 01584 CSHORT Type; 01585 USHORT Size; 01586 01587 // 01588 // Define the common fields used to control the IRP. 01589 // 01590 01591 // 01592 // Define a pointer to the Memory Descriptor List (MDL) for this I/O 01593 // request. This field is only used if the I/O is "direct I/O". 01594 // 01595 01596 PMDL MdlAddress; 01597 01598 // 01599 // Flags word - used to remember various flags. 01600 // 01601 01602 ULONG Flags; 01603 01604 // 01605 // The following union is used for one of three purposes: 01606 // 01607 // 1. This IRP is an associated IRP. The field is a pointer to a master 01608 // IRP. 01609 // 01610 // 2. This is the master IRP. The field is the count of the number of 01611 // IRPs which must complete (associated IRPs) before the master can 01612 // complete. 01613 // 01614 // 3. This operation is being buffered and the field is the address of 01615 // the system space buffer. 01616 // 01617 01618 union { 01619 struct _IRP *MasterIrp; 01620 LONG IrpCount; 01621 PVOID SystemBuffer; 01622 } AssociatedIrp; 01623 01624 // 01625 // Thread list entry - allows queueing the IRP to the thread pending I/O 01626 // request packet list. 01627 // 01628 01629 LIST_ENTRY ThreadListEntry; 01630 01631 // 01632 // I/O status - final status of operation. 01633 // 01634 01635 IO_STATUS_BLOCK IoStatus; 01636 01637 // 01638 // Requestor mode - mode of the original requestor of this operation. 01639 // 01640 01641 KPROCESSOR_MODE RequestorMode; 01642 01643 // 01644 // Pending returned - TRUE if pending was initially returned as the 01645 // status for this packet. 01646 // 01647 01648 BOOLEAN PendingReturned; 01649 01650 // 01651 // Stack state information. 01652 // 01653 01654 CHAR StackCount; 01655 CHAR CurrentLocation; 01656 01657 // 01658 // Cancel - packet has been canceled. 01659 // 01660 01661 BOOLEAN Cancel; 01662 01663 // 01664 // Cancel Irql - Irql at which the cancel spinlock was acquired. 01665 // 01666 01667 KIRQL CancelIrql; 01668 01669 // 01670 // ApcEnvironment - Used to save the APC environment at the time that the 01671 // packet was initialized. 01672 // 01673 01674 CCHAR ApcEnvironment; 01675 01676 // 01677 // Allocation control flags. 01678 // 01679 01680 UCHAR AllocationFlags; 01681 01682 // 01683 // User parameters. 01684 // 01685 01686 PIO_STATUS_BLOCK UserIosb; 01687 PKEVENT UserEvent; 01688 union { 01689 struct { 01690 PIO_APC_ROUTINE UserApcRoutine; 01691 PVOID UserApcContext; 01692 } AsynchronousParameters; 01693 LARGE_INTEGER AllocationSize; 01694 } Overlay; 01695 01696 // 01697 // CancelRoutine - Used to contain the address of a cancel routine supplied 01698 // by a device driver when the IRP is in a cancelable state. 01699 // 01700 01701 PDRIVER_CANCEL CancelRoutine; 01702 01703 // 01704 // Note that the UserBuffer parameter is outside of the stack so that I/O 01705 // completion can copy data back into the user's address space without 01706 // having to know exactly which service was being invoked. The length 01707 // of the copy is stored in the second half of the I/O status block. If 01708 // the UserBuffer field is NULL, then no copy is performed. 01709 // 01710 01711 PVOID UserBuffer; 01712 01713 // 01714 // Kernel structures 01715 // 01716 // The following section contains kernel structures which the IRP needs 01717 // in order to place various work information in kernel controller system 01718 // queues. Because the size and alignment cannot be controlled, they are 01719 // placed here at the end so they just hang off and do not affect the 01720 // alignment of other fields in the IRP. 01721 // 01722 01723 union { 01724 01725 struct { 01726 01727 union { 01728 01729 // 01730 // DeviceQueueEntry - The device queue entry field is used to 01731 // queue the IRP to the device driver device queue. 01732 // 01733 01734 KDEVICE_QUEUE_ENTRY DeviceQueueEntry; 01735 01736 struct { 01737 01738 // 01739 // The following are available to the driver to use in 01740 // whatever manner is desired, while the driver owns the 01741 // packet. 01742 // 01743 01744 PVOID DriverContext[4]; 01745 01746 } ; 01747 01748 } ; 01749 01750 // 01751 // Thread - pointer to caller's Thread Control Block. 01752 // 01753 01754 PETHREAD Thread; 01755 01756 // 01757 // Auxiliary buffer - pointer to any auxiliary buffer that is 01758 // required to pass information to a driver that is not contained 01759 // in a normal buffer. 01760 // 01761 01762 PCHAR AuxiliaryBuffer; 01763 01764 // 01765 // The following unnamed structure must be exactly identical 01766 // to the unnamed structure used in the minipacket header used 01767 // for completion queue entries. 01768 // 01769 01770 struct { 01771 01772 // 01773 // List entry - used to queue the packet to completion queue, among 01774 // others. 01775 // 01776 01777 LIST_ENTRY ListEntry; 01778 01779 union { 01780 01781 // 01782 // Current stack location - contains a pointer to the current 01783 // IO_STACK_LOCATION structure in the IRP stack. This field 01784 // should never be directly accessed by drivers. They should 01785 // use the standard functions. 01786 // 01787 01788 struct _IO_STACK_LOCATION *CurrentStackLocation; 01789 01790 // 01791 // Minipacket type. 01792 // 01793 01794 ULONG PacketType; 01795 }; 01796 }; 01797 01798 // 01799 // Original file object - pointer to the original file object 01800 // that was used to open the file. This field is owned by the 01801 // I/O system and should not be used by any other drivers. 01802 // 01803 01804 PFILE_OBJECT OriginalFileObject; 01805 01806 } Overlay; 01807 01808 // 01809 // APC - This APC control block is used for the special kernel APC as 01810 // well as for the caller's APC, if one was specified in the original 01811 // argument list. If so, then the APC is reused for the normal APC for 01812 // whatever mode the caller was in and the "special" routine that is 01813 // invoked before the APC gets control simply deallocates the IRP. 01814 // 01815 01816 KAPC Apc; 01817 01818 // 01819 // CompletionKey - This is the key that is used to distinguish 01820 // individual I/O operations initiated on a single file handle. 01821 // 01822 01823 PVOID CompletionKey; 01824 01825 } Tail; 01826 01827 } IRP, *PIRP; 01828 01829 // 01830 // Define completion routine types for use in stack locations in an IRP 01831 // 01832 01833 typedef 01834 NTSTATUS 01835 (*PIO_COMPLETION_ROUTINE) ( 01836 IN PDEVICE_OBJECT DeviceObject, 01837 IN PIRP Irp, 01838 IN PVOID Context 01839 ); 01840 01841 // 01842 // Define stack location control flags 01843 // 01844 01845 #define SL_PENDING_RETURNED 0x01 01846 #define SL_INVOKE_ON_CANCEL 0x20 01847 #define SL_INVOKE_ON_SUCCESS 0x40 01848 #define SL_INVOKE_ON_ERROR 0x80 01849 01850 // 01851 // Define flags for various functions 01852 // 01853 01854 // 01855 // Create / Create Named Pipe 01856 // 01857 // The following flags must exactly match those in the IoCreateFile call's 01858 // options. The case sensitive flag is added in later, by the parse routine, 01859 // and is not an actual option to open. Rather, it is part of the object 01860 // manager's attributes structure. 01861 // 01862 01863 #define SL_FORCE_ACCESS_CHECK 0x01 01864 #define SL_OPEN_PAGING_FILE 0x02 01865 #define SL_OPEN_TARGET_DIRECTORY 0x04 01866 01867 #define SL_CASE_SENSITIVE 0x80 01868 01869 // 01870 // Read / Write 01871 // 01872 01873 #define SL_KEY_SPECIFIED 0x01 01874 #define SL_OVERRIDE_VERIFY_VOLUME 0x02 01875 #define SL_WRITE_THROUGH 0x04 01876 #define SL_FT_SEQUENTIAL_WRITE 0x08 01877 01878 // 01879 // Device I/O Control 01880 // 01881 // 01882 // Same SL_OVERRIDE_VERIFY_VOLUME as for read/write above. 01883 // 01884 01885 // 01886 // Lock 01887 // 01888 01889 #define SL_FAIL_IMMEDIATELY 0x01 01890 #define SL_EXCLUSIVE_LOCK 0x02 01891 01892 // 01893 // QueryDirectory / QueryEa / QueryQuota 01894 // 01895 01896 #define SL_RESTART_SCAN 0x01 01897 #define SL_RETURN_SINGLE_ENTRY 0x02 01898 #define SL_INDEX_SPECIFIED 0x04 01899 01900 // 01901 // NotifyDirectory 01902 // 01903 01904 #define SL_WATCH_TREE 0x01 01905 01906 // 01907 // FileSystemControl 01908 // 01909 // minor: mount/verify volume 01910 // 01911 01912 #define SL_ALLOW_RAW_MOUNT 0x01 01913 01914 // 01915 // Define PNP/POWER types required by IRP_MJ_PNP/IRP_MJ_POWER. 01916 // 01917 01918 typedef enum _DEVICE_RELATION_TYPE { 01919 BusRelations, 01920 EjectionRelations, 01921 PowerRelations, 01922 RemovalRelations, 01923 TargetDeviceRelation 01924 } DEVICE_RELATION_TYPE, *PDEVICE_RELATION_TYPE; 01925 01926 typedef struct _DEVICE_RELATIONS { 01927 ULONG Count; 01928 PDEVICE_OBJECT Objects[1]; // variable length 01929 } DEVICE_RELATIONS, *PDEVICE_RELATIONS; 01930 01931 typedef enum _DEVICE_USAGE_NOTIFICATION_TYPE { 01932 DeviceUsageTypeUndefined, 01933 DeviceUsageTypePaging, 01934 DeviceUsageTypeHibernation, 01935 DeviceUsageTypeDumpFile 01936 } DEVICE_USAGE_NOTIFICATION_TYPE; 01937 01938 // begin_ntminiport 01939 01940 typedef struct _INTERFACE { 01941 USHORT Size; 01942 USHORT Version; 01943 PVOID Context; 01944 PINTERFACE_REFERENCE InterfaceReference; 01945 PINTERFACE_DEREFERENCE InterfaceDereference; 01946 // interface specific entries go here 01947 } INTERFACE, *PINTERFACE; 01948 01949 // end_ntminiport 01950 01951 typedef struct _DEVICE_CAPABILITIES { 01952 USHORT Size; 01953 USHORT Version; // the version documented here is version 1 01954 ULONG DeviceD1:1; 01955 ULONG DeviceD2:1; 01956 ULONG LockSupported:1; 01957 ULONG EjectSupported:1; // Ejectable in S0 01958 ULONG Removable:1; 01959 ULONG DockDevice:1; 01960 ULONG UniqueID:1; 01961 ULONG SilentInstall:1; 01962 ULONG RawDeviceOK:1; 01963 ULONG SurpriseRemovalOK:1; 01964 ULONG WakeFromD0:1; 01965 ULONG WakeFromD1:1; 01966 ULONG WakeFromD2:1; 01967 ULONG WakeFromD3:1; 01968 ULONG HardwareDisabled:1; 01969 ULONG NonDynamic:1; 01970 ULONG WarmEjectSupported:1; 01971 ULONG NoDisplayInUI:1; 01972 ULONG Reserved:14; 01973 01974 ULONG Address; 01975 ULONG UINumber; 01976 01977 DEVICE_POWER_STATE DeviceState[PowerSystemMaximum]; 01978 SYSTEM_POWER_STATE SystemWake; 01979 DEVICE_POWER_STATE DeviceWake; 01980 ULONG D1Latency; 01981 ULONG D2Latency; 01982 ULONG D3Latency; 01983 } DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES; 01984 01985 typedef struct _POWER_SEQUENCE { 01986 ULONG SequenceD1; 01987 ULONG SequenceD2; 01988 ULONG SequenceD3; 01989 } POWER_SEQUENCE, *PPOWER_SEQUENCE; 01990 01991 typedef enum { 01992 BusQueryDeviceID = 0, // <Enumerator><Enumerator-specific device id> 01993 BusQueryHardwareIDs = 1, // Hardware ids 01994 BusQueryCompatibleIDs = 2, // compatible device ids 01995 BusQueryInstanceID = 3, // persistent id for this instance of the device 01996 BusQueryDeviceSerialNumber = 4 // serial number for this device 01997 } BUS_QUERY_ID_TYPE, *PBUS_QUERY_ID_TYPE; 01998 01999 typedef ULONG PNP_DEVICE_STATE, *PPNP_DEVICE_STATE; 02000 02001 #define PNP_DEVICE_DISABLED 0x00000001 02002 #define PNP_DEVICE_DONT_DISPLAY_IN_UI 0x00000002 02003 #define PNP_DEVICE_FAILED 0x00000004 02004 #define PNP_DEVICE_REMOVED 0x00000008 02005 #define PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED 0x00000010 02006 #define PNP_DEVICE_NOT_DISABLEABLE 0x00000020 02007 02008 typedef enum { 02009 DeviceTextDescription = 0, // DeviceDesc property 02010 DeviceTextLocationInformation = 1 // DeviceLocation property 02011 } DEVICE_TEXT_TYPE, *PDEVICE_TEXT_TYPE; 02012 02013 // 02014 // Define I/O Request Packet (IRP) stack locations 02015 // 02016 02017 #if !defined(_ALPHA_) && !defined(_IA64_) 02018 #include "pshpack4.h" 02019 #endif 02020 02021 #if defined(_WIN64) 02022 #define POINTER_ALIGNMENT DECLSPEC_ALIGN(8) 02023 #else 02024 #define POINTER_ALIGNMENT 02025 #endif 02026 02027 typedef struct _IO_STACK_LOCATION { 02028 UCHAR MajorFunction; 02029 UCHAR MinorFunction; 02030 UCHAR Flags; 02031 UCHAR Control; 02032 02033 // 02034 // The following user parameters are based on the service that is being 02035 // invoked. Drivers and file systems can determine which set to use based 02036 // on the above major and minor function codes. 02037 // 02038 02039 union { 02040 02041 // 02042 // System service parameters for: NtCreateFile 02043 // 02044 02045 struct { 02046 PIO_SECURITY_CONTEXT SecurityContext; 02047 ULONG Options; 02048 USHORT POINTER_ALIGNMENT FileAttributes; 02049 USHORT ShareAccess; 02050 ULONG POINTER_ALIGNMENT EaLength; 02051 } Create; 02052 02053 // end_ntddk end_wdm end_nthal end_ntifs 02054 02055 // 02056 // System service parameters for: NtCreateNamedPipeFile 02057 // 02058 // Notice that the fields in the following parameter structure must 02059 // match those for the create structure other than the last longword. 02060 // This is so that no distinctions need be made by the I/O system's 02061 // parse routine other than for the last longword. 02062 // 02063 02064 struct { 02065 PIO_SECURITY_CONTEXT SecurityContext; 02066 ULONG Options; 02067 USHORT POINTER_ALIGNMENT Reserved; 02068 USHORT ShareAccess; 02069 PNAMED_PIPE_CREATE_PARAMETERS Parameters; 02070 } CreatePipe; 02071 02072 // 02073 // System service parameters for: NtCreateMailslotFile 02074 // 02075 // Notice that the fields in the following parameter structure must 02076 // match those for the create structure other than the last longword. 02077 // This is so that no distinctions need be made by the I/O system's 02078 // parse routine other than for the last longword. 02079 // 02080 02081 struct { 02082 PIO_SECURITY_CONTEXT SecurityContext; 02083 ULONG Options; 02084 USHORT POINTER_ALIGNMENT Reserved; 02085 USHORT ShareAccess; 02086 PMAILSLOT_CREATE_PARAMETERS Parameters; 02087 } CreateMailslot; 02088 02089 // begin_ntddk begin_wdm begin_nthal begin_ntifs 02090 02091 // 02092 // System service parameters for: NtReadFile 02093 // 02094 02095 struct { 02096 ULONG Length; 02097 ULONG POINTER_ALIGNMENT Key; 02098 LARGE_INTEGER ByteOffset; 02099 } Read; 02100 02101 // 02102 // System service parameters for: NtWriteFile 02103 // 02104 02105 struct { 02106 ULONG Length; 02107 ULONG POINTER_ALIGNMENT Key; 02108 LARGE_INTEGER ByteOffset; 02109 } Write; 02110 02111 // end_ntddk end_wdm end_nthal 02112 02113 // 02114 // System service parameters for: NtQueryDirectoryFile 02115 // 02116 02117 struct { 02118 ULONG Length; 02119 PSTRING FileName; 02120 FILE_INFORMATION_CLASS FileInformationClass; 02121 ULONG POINTER_ALIGNMENT FileIndex; 02122 } QueryDirectory; 02123 02124 // 02125 // System service parameters for: NtNotifyChangeDirectoryFile 02126 // 02127 02128 struct { 02129 ULONG Length; 02130 ULONG POINTER_ALIGNMENT CompletionFilter; 02131 } NotifyDirectory; 02132 02133 // begin_ntddk begin_wdm begin_nthal 02134 02135 // 02136 // System service parameters for: NtQueryInformationFile 02137 // 02138 02139 struct { 02140 ULONG Length; 02141 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass; 02142 } QueryFile; 02143 02144 // 02145 // System service parameters for: NtSetInformationFile 02146 // 02147 02148 struct { 02149 ULONG Length; 02150 FILE_INFORMATION_CLASS POINTER_ALIGNMENT FileInformationClass; 02151 PFILE_OBJECT FileObject; 02152 union { 02153 struct { 02154 BOOLEAN ReplaceIfExists; 02155 BOOLEAN AdvanceOnly; 02156 }; 02157 ULONG ClusterCount; 02158 HANDLE DeleteHandle; 02159 }; 02160 } SetFile; 02161 02162 // end_ntddk end_wdm end_nthal 02163 02164 // 02165 // System service parameters for: NtQueryEaFile 02166 // 02167 02168 struct { 02169 ULONG Length; 02170 PVOID EaList; 02171 ULONG EaListLength; 02172 ULONG POINTER_ALIGNMENT EaIndex; 02173 } QueryEa; 02174 02175 // 02176 // System service parameters for: NtSetEaFile 02177 // 02178 02179 struct { 02180 ULONG Length; 02181 } SetEa; 02182 02183 // begin_ntddk begin_wdm begin_nthal 02184 02185 // 02186 // System service parameters for: NtQueryVolumeInformationFile 02187 // 02188 02189 struct { 02190 ULONG Length; 02191 FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass; 02192 } QueryVolume; 02193 02194 // end_ntddk end_wdm end_nthal 02195 02196 // 02197 // System service parameters for: NtSetVolumeInformationFile 02198 // 02199 02200 struct { 02201 ULONG Length; 02202 FS_INFORMATION_CLASS POINTER_ALIGNMENT FsInformationClass; 02203 } SetVolume; 02204 02205 // 02206 // System service parameters for: NtFsControlFile 02207 // 02208 // Note that the user's output buffer is stored in the UserBuffer field 02209 // and the user's input buffer is stored in the SystemBuffer field. 02210 // 02211 02212 struct { 02213 ULONG OutputBufferLength; 02214 ULONG POINTER_ALIGNMENT InputBufferLength; 02215 ULONG POINTER_ALIGNMENT FsControlCode; 02216 PVOID Type3InputBuffer; 02217 } FileSystemControl; 02218 02219 // 02220 // System service parameters for: NtLockFile/NtUnlockFile 02221 // 02222 02223 struct { 02224 PLARGE_INTEGER Length; 02225 ULONG POINTER_ALIGNMENT Key; 02226 LARGE_INTEGER ByteOffset; 02227 } LockControl; 02228 02229 // begin_ntddk begin_wdm begin_nthal 02230 02231 // 02232 // System service parameters for: NtFlushBuffersFile 02233 // 02234 // No extra user-supplied parameters. 02235 // 02236 02237 // end_ntddk end_wdm end_nthal 02238 02239 // 02240 // System service parameters for: NtCancelIoFile 02241 // 02242 // No extra user-supplied parameters. 02243 // 02244 02245 // begin_ntddk begin_wdm begin_nthal 02246 02247 // 02248 // System service parameters for: NtDeviceIoControlFile 02249 // 02250 // Note that the user's output buffer is stored in the UserBuffer field 02251 // and the user's input buffer is stored in the SystemBuffer field. 02252 // 02253 02254 struct { 02255 ULONG OutputBufferLength; 02256 ULONG POINTER_ALIGNMENT InputBufferLength; 02257 ULONG POINTER_ALIGNMENT IoControlCode; 02258 PVOID Type3InputBuffer; 02259 } DeviceIoControl; 02260 02261 // end_wdm 02262 // 02263 // System service parameters for: NtQuerySecurityObject 02264 // 02265 02266 struct { 02267 SECURITY_INFORMATION SecurityInformation; 02268 ULONG POINTER_ALIGNMENT Length; 02269 } QuerySecurity; 02270 02271 // 02272 // System service parameters for: NtSetSecurityObject 02273 // 02274 02275 struct { 02276 SECURITY_INFORMATION SecurityInformation; 02277 PSECURITY_DESCRIPTOR SecurityDescriptor; 02278 } SetSecurity; 02279 02280 // begin_wdm 02281 // 02282 // Non-system service parameters. 02283 // 02284 // Parameters for MountVolume 02285 // 02286 02287 struct { 02288 PVPB Vpb; 02289 PDEVICE_OBJECT DeviceObject; 02290 } MountVolume; 02291 02292 // 02293 // Parameters for VerifyVolume 02294 // 02295 02296 struct { 02297 PVPB Vpb; 02298 PDEVICE_OBJECT DeviceObject; 02299 } VerifyVolume; 02300 02301 // 02302 // Parameters for Scsi with internal device contorl. 02303 // 02304 02305 struct { 02306 struct _SCSI_REQUEST_BLOCK *Srb; 02307 } Scsi; 02308 02309 // end_ntddk end_wdm end_nthal 02310 02311 // 02312 // System service parameters for: NtQueryQuotaInformationFile 02313 // 02314 02315 struct { 02316 ULONG Length; 02317 PSID StartSid; 02318 PFILE_GET_QUOTA_INFORMATION SidList; 02319 ULONG SidListLength; 02320 } QueryQuota; 02321 02322 // 02323 // System service parameters for: NtSetQuotaInformationFile 02324 // 02325 02326 struct { 02327 ULONG Length; 02328 } SetQuota; 02329 02330 // begin_ntddk begin_wdm begin_nthal 02331 02332 // 02333 // Parameters for IRP_MN_QUERY_DEVICE_RELATIONS 02334 // 02335 02336 struct { 02337 DEVICE_RELATION_TYPE Type; 02338 } QueryDeviceRelations; 02339 02340 // 02341 // Parameters for IRP_MN_QUERY_INTERFACE 02342 // 02343 02344 struct { 02345 CONST GUID *InterfaceType; 02346 USHORT Size; 02347 USHORT Version; 02348 PINTERFACE Interface; 02349 PVOID InterfaceSpecificData; 02350 } QueryInterface; 02351 02352 // end_ntifs 02353 02354 // 02355 // Parameters for IRP_MN_QUERY_CAPABILITIES 02356 // 02357 02358 struct { 02359 PDEVICE_CAPABILITIES Capabilities; 02360 } DeviceCapabilities; 02361 02362 // 02363 // Parameters for IRP_MN_FILTER_RESOURCE_REQUIREMENTS 02364 // 02365 02366 struct { 02367 PIO_RESOURCE_REQUIREMENTS_LIST IoResourceRequirementList; 02368 } FilterResourceRequirements; 02369 02370 // 02371 // Parameters for IRP_MN_READ_CONFIG and IRP_MN_WRITE_CONFIG 02372 // 02373 02374 struct { 02375 ULONG WhichSpace; 02376 PVOID Buffer; 02377 ULONG Offset; 02378 ULONG POINTER_ALIGNMENT Length; 02379 } ReadWriteConfig; 02380 02381 // 02382 // Parameters for IRP_MN_SET_LOCK 02383 // 02384 02385 struct { 02386 BOOLEAN Lock; 02387 } SetLock; 02388 02389 // 02390 // Parameters for IRP_MN_QUERY_ID 02391 // 02392 02393 struct { 02394 BUS_QUERY_ID_TYPE IdType; 02395 } QueryId; 02396 02397 // 02398 // Parameters for IRP_MN_QUERY_DEVICE_TEXT 02399 // 02400 02401 struct { 02402 DEVICE_TEXT_TYPE DeviceTextType; 02403 LCID POINTER_ALIGNMENT LocaleId; 02404 } QueryDeviceText; 02405 02406 // 02407 // Parameters for IRP_MN_DEVICE_USAGE_NOTIFICATION 02408 // 02409 02410 struct { 02411 BOOLEAN InPath; 02412 BOOLEAN Reserved[3]; 02413 DEVICE_USAGE_NOTIFICATION_TYPE POINTER_ALIGNMENT Type; 02414 } UsageNotification; 02415 02416 // 02417 // Parameters for IRP_MN_WAIT_WAKE 02418 // 02419 02420 struct { 02421 SYSTEM_POWER_STATE PowerState; 02422 } WaitWake; 02423 02424 // 02425 // Parameter for IRP_MN_POWER_SEQUENCE 02426 // 02427 02428 struct { 02429 PPOWER_SEQUENCE PowerSequence; 02430 } PowerSequence; 02431 02432 // 02433 // Parameters for IRP_MN_SET_POWER and IRP_MN_QUERY_POWER 02434 // 02435 02436 struct { 02437 ULONG SystemContext; 02438 POWER_STATE_TYPE POINTER_ALIGNMENT Type; 02439 POWER_STATE POINTER_ALIGNMENT State; 02440 POWER_ACTION POINTER_ALIGNMENT ShutdownType; 02441 } Power; 02442 02443 // 02444 // Parameters for StartDevice 02445 // 02446 02447 struct { 02448 PCM_RESOURCE_LIST AllocatedResources; 02449 PCM_RESOURCE_LIST AllocatedResourcesTranslated; 02450 } StartDevice; 02451 02452 // begin_ntifs 02453 // 02454 // Parameters for Cleanup 02455 // 02456 // No extra parameters supplied 02457 // 02458 02459 // 02460 // WMI Irps 02461 // 02462 02463 struct { 02464 ULONG_PTR ProviderId; 02465 PVOID DataPath; 02466 ULONG BufferSize; 02467 PVOID Buffer; 02468 } WMI; 02469 02470 // 02471 // Others - driver-specific 02472 // 02473 02474 struct { 02475 PVOID Argument1; 02476 PVOID Argument2; 02477 PVOID Argument3; 02478 PVOID Argument4; 02479 } Others; 02480 02481 } Parameters; 02482 02483 // 02484 // Save a pointer to this device driver's device object for this request 02485 // so it can be passed to the completion routine if needed. 02486 // 02487 02488 PDEVICE_OBJECT DeviceObject; 02489 02490 // 02491 // The following location contains a pointer to the file object for this 02492 // 02493 02494 PFILE_OBJECT FileObject; 02495 02496 // 02497 // The following routine is invoked depending on the flags in the above 02498 // flags field. 02499 // 02500 02501 PIO_COMPLETION_ROUTINE CompletionRoutine; 02502 02503 // 02504 // The following is used to store the address of the context parameter 02505 // that should be passed to the CompletionRoutine. 02506 // 02507 02508 PVOID Context; 02509 02510 } IO_STACK_LOCATION, *PIO_STACK_LOCATION; 02511 #if !defined(_ALPHA_) && !defined(_IA64_) 02512 #include "poppack.h" 02513 #endif 02514 02515 // 02516 // Define the share access structure used by file systems to determine 02517 // whether or not another accessor may open the file. 02518 // 02519 02520 typedef struct _SHARE_ACCESS { 02521 ULONG OpenCount; 02522 ULONG Readers; 02523 ULONG Writers; 02524 ULONG Deleters; 02525 ULONG SharedRead; 02526 ULONG SharedWrite; 02527 ULONG SharedDelete; 02528 } SHARE_ACCESS, *PSHARE_ACCESS; 02529 02530 // end_wdm 02531 02532 // 02533 // The following structure is used by drivers that are initializing to 02534 // determine the number of devices of a particular type that have already 02535 // been initialized. It is also used to track whether or not the AtDisk 02536 // address range has already been claimed. Finally, it is used by the 02537 // NtQuerySystemInformation system service to return device type counts. 02538 // 02539 02540 typedef struct _CONFIGURATION_INFORMATION { 02541 02542 // 02543 // This field indicates the total number of disks in the system. This 02544 // number should be used by the driver to determine the name of new 02545 // disks. This field should be updated by the driver as it finds new 02546 // disks. 02547 // 02548 02549 ULONG DiskCount; // Count of hard disks thus far 02550 ULONG FloppyCount; // Count of floppy disks thus far 02551 ULONG CdRomCount; // Count of CD-ROM drives thus far 02552 ULONG TapeCount; // Count of tape drives thus far 02553 ULONG ScsiPortCount; // Count of SCSI port adapters thus far 02554 ULONG SerialCount; // Count of serial devices thus far 02555 ULONG ParallelCount; // Count of parallel devices thus far 02556 02557 // 02558 // These next two fields indicate ownership of one of the two IO address 02559 // spaces that are used by WD1003-compatable disk controllers. 02560 // 02561 02562 BOOLEAN AtDiskPrimaryAddressClaimed; // 0x1F0 - 0x1FF 02563 BOOLEAN AtDiskSecondaryAddressClaimed; // 0x170 - 0x17F 02564 02565 // 02566 // Indicates the structure version, as anything value belong this will have been added. 02567 // Use the structure size as the version. 02568 // 02569 02570 ULONG Version; 02571 02572 // 02573 // Indicates the total number of medium changer devices in the system. 02574 // This field will be updated by the drivers as it determines that 02575 // new devices have been found and will be supported. 02576 // 02577 02578 ULONG MediumChangerCount; 02579 02580 } CONFIGURATION_INFORMATION, *PCONFIGURATION_INFORMATION; 02581 02582 // end_ntddk end_nthal 02583 02584 // 02585 // The following are global counters used by the I/O system to indicate the 02586 // amount of I/O being performed in the system. The first three counters 02587 // are just that, counts of operations that have been requested, while the 02588 // last three counters track the amount of data transferred for each type 02589 // of I/O request. 02590 // 02591 02592 extern KSPIN_LOCK IoStatisticsLock; 02593 extern ULONG IoReadOperationCount; 02594 extern ULONG IoWriteOperationCount; 02595 extern ULONG IoOtherOperationCount; 02596 extern LARGE_INTEGER IoReadTransferCount; 02597 extern LARGE_INTEGER IoWriteTransferCount; 02598 extern LARGE_INTEGER IoOtherTransferCount; 02599 02600 // 02601 // It is difficult for cached file systems to properly charge quota 02602 // for the storage that they allocate on behalf of user file handles, 02603 // so the following amount of additional quota is charged against each 02604 // handle as a "best guess" as to the amount of quota the file system 02605 // will allocate on behalf of this handle. 02606 // 02607 02608 // 02609 // These numbers are totally arbitrary, and can be changed if it turns out 02610 // that the file systems actually allocate more (or less) on behalf of 02611 // their file objects. The non-paged pool charge constant is added to the 02612 // size of a FILE_OBJECT to get the actual charge amount. 02613 // 02614 02615 #define IO_FILE_OBJECT_NON_PAGED_POOL_CHARGE 64 02616 #define IO_FILE_OBJECT_PAGED_POOL_CHARGE 1024 02617 02618 02619 // begin_ntddk begin_wdm begin_nthal 02620 // 02621 // Public I/O routine definitions 02622 // 02623 02624 NTKERNELAPI 02625 VOID 02626 IoAcquireCancelSpinLock( 02627 OUT PKIRQL Irql 02628 ); 02629 02630 // end_ntddk end_wdm end_nthal 02631 02632 NTKERNELAPI 02633 VOID 02634 IoAcquireVpbSpinLock( 02635 OUT PKIRQL Irql 02636 ); 02637 02638 // begin_ntddk begin_nthal end_ntifs 02639 02640 NTKERNELAPI 02641 NTSTATUS 02642 IoAllocateAdapterChannel( 02643 IN PADAPTER_OBJECT AdapterObject, 02644 IN PDEVICE_OBJECT DeviceObject, 02645 IN ULONG NumberOfMapRegisters, 02646 IN PDRIVER_CONTROL ExecutionRoutine, 02647 IN PVOID Context 02648 ); 02649 02650 NTKERNELAPI 02651 VOID 02652 IoAllocateController( 02653 IN PCONTROLLER_OBJECT ControllerObject, 02654 IN PDEVICE_OBJECT DeviceObject, 02655 IN PDRIVER_CONTROL ExecutionRoutine, 02656 IN PVOID Context 02657 ); 02658 02659 // begin_wdm 02660 02661 NTKERNELAPI 02662 NTSTATUS 02663 IoAllocateDriverObjectExtension( 02664 IN PDRIVER_OBJECT DriverObject, 02665 IN PVOID ClientIdentificationAddress, 02666 IN ULONG DriverObjectExtensionSize, 02667 OUT PVOID *DriverObjectExtension 02668 ); 02669 02670 // begin_ntifs 02671 02672 NTKERNELAPI 02673 PVOID 02674 IoAllocateErrorLogEntry( 02675 IN PVOID IoObject, 02676 IN UCHAR EntrySize 02677 ); 02678 02679 NTKERNELAPI 02680 PIRP 02681 IoAllocateIrp( 02682 IN CCHAR StackSize, 02683 IN BOOLEAN ChargeQuota 02684 ); 02685 02686 NTKERNELAPI 02687 PMDL 02688 IoAllocateMdl( 02689 IN PVOID VirtualAddress, 02690 IN ULONG Length, 02691 IN BOOLEAN SecondaryBuffer, 02692 IN BOOLEAN ChargeQuota, 02693 IN OUT PIRP Irp OPTIONAL 02694 ); 02695 02696 // end_wdm end_ntifs 02697 //++ 02698 // 02699 // VOID 02700 // IoAssignArcName( 02701 // IN PUNICODE_STRING ArcName, 02702 // IN PUNICODE_STRING DeviceName 02703 // ) 02704 // 02705 // Routine Description: 02706 // 02707 // This routine is invoked by drivers of bootable media to create a symbolic 02708 // link between the ARC name of their device and its NT name. This allows 02709 // the system to determine which device in the system was actually booted 02710 // from since the ARC firmware only deals in ARC names, and NT only deals 02711 // in NT names. 02712 // 02713 // Arguments: 02714 // 02715 // ArcName - Supplies the Unicode string representing the ARC name. 02716 // 02717 // DeviceName - Supplies the name to which the ARCname refers. 02718 // 02719 // Return Value: 02720 // 02721 // None. 02722 // 02723 //-- 02724 02725 #define IoAssignArcName( ArcName, DeviceName ) ( \ 02726 IoCreateSymbolicLink( (ArcName), (DeviceName) ) ) 02727 02728 NTKERNELAPI 02729 NTSTATUS 02730 IoAssignResources ( 02731 IN PUNICODE_STRING RegistryPath, 02732 IN PUNICODE_STRING DriverClassName OPTIONAL, 02733 IN PDRIVER_OBJECT DriverObject, 02734 IN PDEVICE_OBJECT DeviceObject OPTIONAL, 02735 IN PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources, 02736 IN OUT PCM_RESOURCE_LIST *AllocatedResources 02737 ); 02738 02739 // end_ntddk end_nthal 02740 02741 NTKERNELAPI 02742 NTSTATUS 02743 IoAsynchronousPageWrite( 02744 IN PFILE_OBJECT FileObject, 02745 IN PMDL MemoryDescriptorList, 02746 IN PLARGE_INTEGER StartingOffset, 02747 IN PIO_APC_ROUTINE ApcRoutine, 02748 IN PVOID ApcContext, 02749 OUT PIO_STATUS_BLOCK IoStatusBlock, 02750 OUT PIRP *Irp OPTIONAL 02751 ); 02752 02753 // begin_ntddk begin_wdm begin_nthal begin_ntifs 02754 02755 NTKERNELAPI 02756 NTSTATUS 02757 IoAttachDevice( 02758 IN PDEVICE_OBJECT SourceDevice, 02759 IN PUNICODE_STRING TargetDevice, 02760 OUT PDEVICE_OBJECT *AttachedDevice 02761 ); 02762 02763 // end_wdm 02764 02765 NTKERNELAPI 02766 NTSTATUS 02767 IoAttachDeviceByPointer( 02768 IN PDEVICE_OBJECT SourceDevice, 02769 IN PDEVICE_OBJECT TargetDevice 02770 ); 02771 02772 // begin_wdm 02773 02774 NTKERNELAPI 02775 PDEVICE_OBJECT 02776 IoAttachDeviceToDeviceStack( 02777 IN PDEVICE_OBJECT SourceDevice, 02778 IN PDEVICE_OBJECT TargetDevice 02779 ); 02780 02781 NTKERNELAPI 02782 PIRP 02783 IoBuildAsynchronousFsdRequest( 02784 IN ULONG MajorFunction, 02785 IN PDEVICE_OBJECT DeviceObject, 02786 IN OUT PVOID Buffer OPTIONAL, 02787 IN ULONG Length OPTIONAL, 02788 IN PLARGE_INTEGER StartingOffset OPTIONAL, 02789 IN PIO_STATUS_BLOCK IoStatusBlock OPTIONAL 02790 ); 02791 02792 NTKERNELAPI 02793 PIRP 02794 IoBuildDeviceIoControlRequest( 02795 IN ULONG IoControlCode, 02796 IN PDEVICE_OBJECT DeviceObject, 02797 IN PVOID InputBuffer OPTIONAL, 02798 IN ULONG InputBufferLength, 02799 OUT PVOID OutputBuffer OPTIONAL, 02800 IN ULONG OutputBufferLength, 02801 IN BOOLEAN InternalDeviceIoControl, 02802 IN PKEVENT Event, 02803 OUT PIO_STATUS_BLOCK IoStatusBlock 02804 ); 02805 02806 NTKERNELAPI 02807 VOID 02808 IoBuildPartialMdl( 02809 IN PMDL SourceMdl, 02810 IN OUT PMDL TargetMdl, 02811 IN PVOID VirtualAddress, 02812 IN ULONG Length 02813 ); 02814 02815 typedef struct _BOOTDISK_INFORMATION { 02816 LONGLONG BootPartitionOffset; 02817 LONGLONG SystemPartitionOffset; 02818 ULONG BootDeviceSignature; 02819 ULONG SystemDeviceSignature; 02820 } BOOTDISK_INFORMATION, *PBOOTDISK_INFORMATION; 02821 02822 NTKERNELAPI 02823 NTSTATUS 02824 IoGetBootDiskInformation( 02825 IN OUT PBOOTDISK_INFORMATION BootDiskInformation, 02826 IN ULONG Size 02827 ); 02828 02829 // end_ntddk end_nthal end_wdm end_ntifs 02830 02831 NTSTATUS 02832 IoBuildPoDeviceNotifyList ( 02833 IN OUT PVOID Order 02834 ); 02835 02836 NTSTATUS 02837 IoNotifyPowerOperationVetoed( 02838 IN POWER_ACTION VetoedPowerOperation, 02839 IN PDEVICE_OBJECT TargetedDeviceObject OPTIONAL, 02840 IN PDEVICE_OBJECT VetoingDeviceObject 02841 ); 02842 02843 // begin_ntddk begin_nthal begin_wdm begin_ntifs 02844 02845 NTKERNELAPI 02846 PIRP 02847 IoBuildSynchronousFsdRequest( 02848 IN ULONG MajorFunction, 02849 IN PDEVICE_OBJECT DeviceObject, 02850 IN OUT PVOID Buffer OPTIONAL, 02851 IN ULONG Length OPTIONAL, 02852 IN PLARGE_INTEGER StartingOffset OPTIONAL, 02853 IN PKEVENT Event, 02854 OUT PIO_STATUS_BLOCK IoStatusBlock 02855 ); 02856 02857 NTKERNELAPI 02858 NTSTATUS 02859 FASTCALL 02860 IofCallDriver( 02861 IN PDEVICE_OBJECT DeviceObject, 02862 IN OUT PIRP Irp 02863 ); 02864 02865 #define IoCallDriver(a,b) \ 02866 IofCallDriver(a,b) 02867 02868 NTKERNELAPI 02869 BOOLEAN 02870 IoCancelIrp( 02871 IN PIRP Irp 02872 ); 02873 02874 // end_ntddk end_wdm end_nthal end_ntifs 02875 02876 NTKERNELAPI 02877 VOID 02878 IoCancelThreadIo( 02879 IN PETHREAD Thread 02880 ); 02881 02882 // begin_ntifs 02883 02884 NTKERNELAPI 02885 NTSTATUS 02886 IoCheckDesiredAccess( 02887 IN OUT PACCESS_MASK DesiredAccess, 02888 IN ACCESS_MASK GrantedAccess 02889 ); 02890 02891 NTKERNELAPI 02892 NTSTATUS 02893 IoCheckEaBufferValidity( 02894 IN PFILE_FULL_EA_INFORMATION EaBuffer, 02895 IN ULONG EaLength, 02896 OUT PULONG ErrorOffset 02897 ); 02898 02899 NTKERNELAPI 02900 NTSTATUS 02901 IoCheckFunctionAccess( 02902 IN ACCESS_MASK GrantedAccess, 02903 IN UCHAR MajorFunction, 02904 IN UCHAR MinorFunction, 02905 IN ULONG IoControlCode, 02906 IN PVOID Arg1 OPTIONAL, 02907 IN PVOID Arg2 OPTIONAL 02908 ); 02909 02910 // end_ntifs 02911 // begin_ntsrv 02912 02913 NTKERNELAPI 02914 NTSTATUS 02915 IoCheckQuerySetFileInformation( 02916 IN FILE_INFORMATION_CLASS FileInformationClass, 02917 IN ULONG Length, 02918 IN BOOLEAN SetOperation 02919 ); 02920 02921 NTKERNELAPI 02922 NTSTATUS 02923 IoCheckQuerySetVolumeInformation( 02924 IN FS_INFORMATION_CLASS FsInformationClass, 02925 IN ULONG Length, 02926 IN BOOLEAN SetOperation 02927 ); 02928 02929 // begin_ntifs 02930 02931 NTKERNELAPI 02932 NTSTATUS 02933 IoCheckQuotaBufferValidity( 02934 IN PFILE_QUOTA_INFORMATION QuotaBuffer, 02935 IN ULONG QuotaLength, 02936 OUT PULONG ErrorOffset 02937 ); 02938 02939 // end_ntsrv 02940 // begin_ntddk begin_wdm begin_nthal 02941 02942 NTKERNELAPI 02943 NTSTATUS 02944 IoCheckShareAccess( 02945 IN ACCESS_MASK DesiredAccess, 02946 IN ULONG DesiredShareAccess, 02947 IN OUT PFILE_OBJECT FileObject, 02948 IN OUT PSHARE_ACCESS ShareAccess, 02949 IN BOOLEAN Update 02950 ); 02951 02952 NTKERNELAPI 02953 VOID 02954 FASTCALL 02955 IofCompleteRequest( 02956 IN PIRP Irp, 02957 IN CCHAR PriorityBoost 02958 ); 02959 02960 #define IoCompleteRequest(a,b) \ 02961 IofCompleteRequest(a,b) 02962 02963 // end_ntifs 02964 02965 NTKERNELAPI 02966 NTSTATUS 02967 IoConnectInterrupt( 02968 OUT PKINTERRUPT *InterruptObject, 02969 IN PKSERVICE_ROUTINE ServiceRoutine, 02970 IN PVOID ServiceContext, 02971 IN PKSPIN_LOCK SpinLock OPTIONAL, 02972 IN ULONG Vector, 02973 IN KIRQL Irql, 02974 IN KIRQL SynchronizeIrql, 02975 IN KINTERRUPT_MODE InterruptMode, 02976 IN BOOLEAN ShareVector, 02977 IN KAFFINITY ProcessorEnableMask, 02978 IN BOOLEAN FloatingSave 02979 ); 02980 02981 // end_wdm 02982 02983 NTKERNELAPI 02984 PCONTROLLER_OBJECT 02985 IoCreateController( 02986 IN ULONG Size 02987 ); 02988 02989 // begin_wdm begin_ntifs 02990 02991 NTKERNELAPI 02992 NTSTATUS 02993 IoCreateDevice( 02994 IN PDRIVER_OBJECT DriverObject, 02995 IN ULONG DeviceExtensionSize, 02996 IN PUNICODE_STRING DeviceName OPTIONAL, 02997 IN DEVICE_TYPE DeviceType, 02998 IN ULONG DeviceCharacteristics, 02999 IN BOOLEAN Exclusive, 03000 OUT PDEVICE_OBJECT *DeviceObject 03001 ); 03002 03003 #define WDM_MAJORVERSION 0x01 03004 #define WDM_MINORVERSION 0x10 03005 03006 NTKERNELAPI 03007 BOOLEAN 03008 IoIsWdmVersionAvailable( 03009 IN UCHAR MajorVersion, 03010 IN UCHAR MinorVersion 03011 ); 03012 03013 // end_nthal 03014 03015 NTKERNELAPI 03016 NTSTATUS 03017 IoCreateFile( 03018 OUT PHANDLE FileHandle, 03019 IN ACCESS_MASK DesiredAccess, 03020 IN POBJECT_ATTRIBUTES ObjectAttributes, 03021 OUT PIO_STATUS_BLOCK IoStatusBlock, 03022 IN PLARGE_INTEGER AllocationSize OPTIONAL, 03023 IN ULONG FileAttributes, 03024 IN ULONG ShareAccess, 03025 IN ULONG Disposition, 03026 IN ULONG CreateOptions, 03027 IN PVOID EaBuffer OPTIONAL, 03028 IN ULONG EaLength, 03029 IN CREATE_FILE_TYPE CreateFileType, 03030 IN PVOID ExtraCreateParameters OPTIONAL, 03031 IN ULONG Options 03032 ); 03033 03034 // end_ntddk end_wdm 03035 03036 NTKERNELAPI 03037 PFILE_OBJECT 03038 IoCreateStreamFileObject( 03039 IN PFILE_OBJECT FileObject OPTIONAL, 03040 IN PDEVICE_OBJECT DeviceObject OPTIONAL 03041 ); 03042 03043 NTKERNELAPI 03044 PFILE_OBJECT 03045 IoCreateStreamFileObjectLite( 03046 IN PFILE_OBJECT FileObject OPTIONAL, 03047 IN PDEVICE_OBJECT DeviceObject OPTIONAL 03048 ); 03049 03050 // begin_nthal begin_ntddk begin_wdm 03051 03052 NTKERNELAPI 03053 PKEVENT 03054 IoCreateNotificationEvent( 03055 IN PUNICODE_STRING EventName, 03056 OUT PHANDLE EventHandle 03057 ); 03058 03059 NTKERNELAPI 03060 NTSTATUS 03061 IoCreateSymbolicLink( 03062 IN PUNICODE_STRING SymbolicLinkName, 03063 IN PUNICODE_STRING DeviceName 03064 ); 03065 03066 // end_wdm 03067 03068 NTKERNELAPI 03069 PKEVENT 03070 IoCreateSynchronizationEvent( 03071 IN PUNICODE_STRING EventName, 03072 OUT PHANDLE EventHandle 03073 ); 03074 03075 // begin_wdm 03076 03077 NTKERNELAPI 03078 NTSTATUS 03079 IoCreateUnprotectedSymbolicLink( 03080 IN PUNICODE_STRING SymbolicLinkName, 03081 IN PUNICODE_STRING DeviceName 03082 ); 03083 03084 // end_wdm 03085 03086 //++ 03087 // 03088 // VOID 03089 // IoDeassignArcName( 03090 // IN PUNICODE_STRING ArcName 03091 // ) 03092 // 03093 // Routine Description: 03094 // 03095 // This routine is invoked by drivers to deassign an ARC name that they 03096 // created to a device. This is generally only called if the driver is 03097 // deleting the device object, which means that the driver is probably 03098 // unloading. 03099 // 03100 // Arguments: 03101 // 03102 // ArcName - Supplies the ARC name to be removed. 03103 // 03104 // Return Value: 03105 // 03106 // None. 03107 // 03108 //-- 03109 03110 #define IoDeassignArcName( ArcName ) ( \ 03111 IoDeleteSymbolicLink( (ArcName) ) ) 03112 03113 // end_ntifs 03114 03115 NTKERNELAPI 03116 VOID 03117 IoDeleteController( 03118 IN PCONTROLLER_OBJECT ControllerObject 03119 ); 03120 03121 // begin_wdm begin_ntifs 03122 03123 NTKERNELAPI 03124 VOID 03125 IoDeleteDevice( 03126 IN PDEVICE_OBJECT DeviceObject 03127 ); 03128 03129 NTKERNELAPI 03130 NTSTATUS 03131 IoDeleteSymbolicLink( 03132 IN PUNICODE_STRING SymbolicLinkName 03133 ); 03134 03135 NTKERNELAPI 03136 VOID 03137 IoDetachDevice( 03138 IN OUT PDEVICE_OBJECT TargetDevice 03139 ); 03140 03141 // end_ntifs 03142 03143 NTKERNELAPI 03144 VOID 03145 IoDisconnectInterrupt( 03146 IN PKINTERRUPT InterruptObject 03147 ); 03148 03149 // end_ntddk end_wdm end_nthal 03150 03151 NTKERNELAPI 03152 VOID 03153 IoEnqueueIrp( 03154 IN PIRP Irp 03155 ); 03156 03157 03158 NTKERNELAPI // ntifs 03159 BOOLEAN // ntifs 03160 IoFastQueryNetworkAttributes( // ntifs 03161 IN POBJECT_ATTRIBUTES ObjectAttributes, // ntifs 03162 IN ACCESS_MASK DesiredAccess, // ntifs 03163 IN ULONG OpenOptions, // ntifs 03164 OUT PIO_STATUS_BLOCK IoStatus, // ntifs 03165 OUT PFILE_NETWORK_OPEN_INFORMATION Buffer // ntifs 03166 ); // ntifs 03167 03168 // begin_ntddk begin_nthal 03169 03170 NTKERNELAPI 03171 VOID 03172 IoFreeController( 03173 IN PCONTROLLER_OBJECT ControllerObject 03174 ); 03175 03176 // begin_wdm begin_ntifs 03177 03178 NTKERNELAPI 03179 VOID 03180 IoFreeIrp( 03181 IN PIRP Irp 03182 ); 03183 03184 NTKERNELAPI 03185 VOID 03186 IoFreeMdl( 03187 IN PMDL Mdl 03188 ); 03189 03190 // end_ntddk end_wdm end_nthal end_ntifs 03191 03192 VOID 03193 IoFreePoDeviceNotifyList ( 03194 IN OUT PVOID Order 03195 ); 03196 03197 NTSTATUS 03198 IoGetLegacyVetoList( 03199 OUT PWSTR *VetoList OPTIONAL, 03200 OUT PPNP_VETO_TYPE VetoType 03201 ); 03202 03203 // begin_ntifs 03204 03205 NTKERNELAPI 03206 PDEVICE_OBJECT 03207 IoGetAttachedDevice( 03208 IN PDEVICE_OBJECT DeviceObject 03209 ); 03210 03211 NTKERNELAPI // ntddk wdm nthal 03212 PDEVICE_OBJECT // ntddk wdm nthal 03213 IoGetAttachedDeviceReference( // ntddk wdm nthal 03214 IN PDEVICE_OBJECT DeviceObject // ntddk wdm nthal 03215 ); // ntddk wdm nthal 03216 // ntddk wdm nthal 03217 NTKERNELAPI 03218 PDEVICE_OBJECT 03219 IoGetBaseFileSystemDeviceObject( 03220 IN PFILE_OBJECT FileObject 03221 ); 03222 03223 NTKERNELAPI // ntddk nthal 03224 PCONFIGURATION_INFORMATION // ntddk nthal 03225 IoGetConfigurationInformation( VOID ); // ntddk nthal 03226 03227 // begin_ntddk begin_wdm begin_nthal 03228 03229 //++ 03230 // 03231 // PIO_STACK_LOCATION 03232 // IoGetCurrentIrpStackLocation( 03233 // IN PIRP Irp 03234 // ) 03235 // 03236 // Routine Description: 03237 // 03238 // This routine is invoked to return a pointer to the current stack location 03239 // in an I/O Request Packet (IRP). 03240 // 03241 // Arguments: 03242 // 03243 // Irp - Pointer to the I/O Request Packet. 03244 // 03245 // Return Value: 03246 // 03247 // The function value is a pointer to the current stack location in the 03248 // packet. 03249 // 03250 //-- 03251 03252 #define IoGetCurrentIrpStackLocation( Irp ) ( (Irp)->Tail.Overlay.CurrentStackLocation ) 03253 03254 // end_nthal end_wdm 03255 03256 NTKERNELAPI 03257 PDEVICE_OBJECT 03258 IoGetDeviceToVerify( 03259 IN PETHREAD Thread 03260 ); 03261 03262 // begin_wdm 03263 03264 NTKERNELAPI 03265 PVOID 03266 IoGetDriverObjectExtension( 03267 IN PDRIVER_OBJECT DriverObject, 03268 IN PVOID ClientIdentificationAddress 03269 ); 03270 03271 NTKERNELAPI 03272 PEPROCESS 03273 IoGetCurrentProcess( 03274 VOID 03275 ); 03276 03277 // begin_nthal 03278 03279 NTKERNELAPI 03280 NTSTATUS 03281 IoGetDeviceObjectPointer( 03282 IN PUNICODE_STRING ObjectName, 03283 IN ACCESS_MASK DesiredAccess, 03284 OUT PFILE_OBJECT *FileObject, 03285 OUT PDEVICE_OBJECT *DeviceObject 03286 ); 03287 03288 NTKERNELAPI 03289 struct _DMA_ADAPTER * 03290 IoGetDmaAdapter( 03291 IN PDEVICE_OBJECT PhysicalDeviceObject, OPTIONAL // required for PnP drivers 03292 IN struct _DEVICE_DESCRIPTION *DeviceDescription, 03293 IN OUT PULONG NumberOfMapRegisters 03294 ); 03295 03296 // end_wdm 03297 03298 NTKERNELAPI 03299 PGENERIC_MAPPING 03300 IoGetFileObjectGenericMapping( 03301 VOID 03302 ); 03303 03304 // end_nthal 03305 03306 03307 // begin_wdm 03308 03309 //++ 03310 // 03311 // ULONG 03312 // IoGetFunctionCodeFromCtlCode( 03313 // IN ULONG ControlCode 03314 // ) 03315 // 03316 // Routine Description: 03317 // 03318 // This routine extracts the function code from IOCTL and FSCTL function 03319 // control codes. 03320 // This routine should only be used by kernel mode code. 03321 // 03322 // Arguments: 03323 // 03324 // ControlCode - A function control code (IOCTL or FSCTL) from which the 03325 // function code must be extracted. 03326 // 03327 // Return Value: 03328 // 03329 // The extracted function code. 03330 // 03331 // Note: 03332 // 03333 // The CTL_CODE macro, used to create IOCTL and FSCTL function control 03334 // codes, is defined in ntioapi.h 03335 // 03336 //-- 03337 03338 #define IoGetFunctionCodeFromCtlCode( ControlCode ) (\ 03339 ( ControlCode >> 2) & 0x00000FFF ) 03340 03341 // begin_nthal end_wdm 03342 03343 NTKERNELAPI 03344 PVOID 03345 IoGetInitialStack( 03346 VOID 03347 ); 03348 03349 NTKERNELAPI 03350 VOID 03351 IoGetStackLimits ( 03352 OUT PULONG_PTR LowLimit, 03353 OUT PULONG_PTR HighLimit 03354 ); 03355 03356 03357 // 03358 // The following function is used to tell the caller how much stack is available 03359 // 03360 03361 __inline 03362 ULONG_PTR 03363 IoGetRemainingStackSize ( 03364 VOID 03365 ) 03366 { 03367 ULONG_PTR Top; 03368 ULONG_PTR Bottom; 03369 03370 IoGetStackLimits( &Bottom, &Top ); 03371 return((ULONG_PTR)(&Top) - Bottom ); 03372 } 03373 03374 // begin_wdm 03375 03376 //++ 03377 // 03378 // PIO_STACK_LOCATION 03379 // IoGetNextIrpStackLocation( 03380 // IN PIRP Irp 03381 // ) 03382 // 03383 // Routine Description: 03384 // 03385 // This routine is invoked to return a pointer to the next stack location 03386 // in an I/O Request Packet (IRP). 03387 // 03388 // Arguments: 03389 // 03390 // Irp - Pointer to the I/O Request Packet. 03391 // 03392 // Return Value: 03393 // 03394 // The function value is a pointer to the next stack location in the packet. 03395 // 03396 //-- 03397 03398 #define IoGetNextIrpStackLocation( Irp ) (\ 03399 (Irp)->Tail.Overlay.CurrentStackLocation - 1 ) 03400 03401 NTKERNELAPI 03402 PDEVICE_OBJECT 03403 IoGetRelatedDeviceObject( 03404 IN PFILE_OBJECT FileObject 03405 ); 03406 03407 // end_ntddk end_wdm end_nthal 03408 03409 NTKERNELAPI 03410 ULONG 03411 IoGetRequestorProcessId( 03412 IN PIRP Irp 03413 ); 03414 03415 NTKERNELAPI 03416 PEPROCESS 03417 IoGetRequestorProcess( 03418 IN PIRP Irp 03419 ); 03420 03421 NTKERNELAPI 03422 PIRP 03423 IoGetTopLevelIrp( 03424 VOID 03425 ); 03426 03427 // begin_ntddk begin_wdm begin_nthal 03428 03429 //++ 03430 // 03431 // VOID 03432 // IoInitializeDpcRequest( 03433 // IN PDEVICE_OBJECT DeviceObject, 03434 // IN PIO_DPC_ROUTINE DpcRoutine 03435 // ) 03436 // 03437 // Routine Description: 03438 // 03439 // This routine is invoked to initialize the DPC in a device object for a 03440 // device driver during its initialization routine. The DPC is used later 03441 // when the driver interrupt service routine requests that a DPC routine 03442 // be queued for later execution. 03443 // 03444 // Arguments: 03445 // 03446 // DeviceObject - Pointer to the device object that the request is for. 03447 // 03448 // DpcRoutine - Address of the driver's DPC routine to be executed when 03449 // the DPC is dequeued for processing. 03450 // 03451 // Return Value: 03452 // 03453 // None. 03454 // 03455 //-- 03456 03457 #define IoInitializeDpcRequest( DeviceObject, DpcRoutine ) (\ 03458 KeInitializeDpc( &(DeviceObject)->Dpc, \ 03459 (PKDEFERRED_ROUTINE) (DpcRoutine), \ 03460 (DeviceObject) ) ) 03461 03462 NTKERNELAPI 03463 VOID 03464 IoInitializeIrp( 03465 IN OUT PIRP Irp, 03466 IN USHORT PacketSize, 03467 IN CCHAR StackSize 03468 ); 03469 03470 NTKERNELAPI 03471 NTSTATUS 03472 IoInitializeTimer( 03473 IN PDEVICE_OBJECT DeviceObject, 03474 IN PIO_TIMER_ROUTINE TimerRoutine, 03475 IN PVOID Context 03476 ); 03477 03478 // end_ntddk end_wdm end_nthal end_ntifs 03479 03480 // begin_ntddk begin_ntifs 03481 03482 NTKERNELAPI 03483 VOID 03484 IoReuseIrp( 03485 IN OUT PIRP Irp, 03486 IN NTSTATUS Iostatus 03487 ); 03488 03489 03490 NTKERNELAPI 03491 VOID 03492 IoCancelFileOpen( 03493 IN PDEVICE_OBJECT DeviceObject, 03494 IN PFILE_OBJECT FileObject 03495 ); 03496 // end_ntddk end_ntifs 03497 03498 NTKERNELAPI 03499 BOOLEAN 03500 IoInitSystem( 03501 PLOADER_PARAMETER_BLOCK LoaderBlock 03502 ); 03503 03504 // begin_ntddk begin_wdm begin_nthal begin_ntifs 03505 03506 //++ 03507 // 03508 // BOOLEAN 03509 // IoIsErrorUserInduced( 03510 // IN NTSTATUS Status 03511 // ) 03512 // 03513 // Routine Description: 03514 // 03515 // This routine is invoked to determine if an error was as a 03516 // result of user actions. Typically these error are related 03517 // to removable media and will result in a pop-up. 03518 // 03519 // Arguments: 03520 // 03521 // Status - The status value to check. 03522 // 03523 // Return Value: 03524 // The function value is TRUE if the user induced the error, 03525 // otherwise FALSE is returned. 03526 // 03527 //-- 03528 #define IoIsErrorUserInduced( Status ) ((BOOLEAN) \ 03529 (((Status) == STATUS_DEVICE_NOT_READY) || \ 03530 ((Status) == STATUS_IO_TIMEOUT) || \ 03531 ((Status) == STATUS_MEDIA_WRITE_PROTECTED) || \ 03532 ((Status) == STATUS_NO_MEDIA_IN_DEVICE) || \ 03533 ((Status) == STATUS_VERIFY_REQUIRED) || \ 03534 ((Status) == STATUS_UNRECOGNIZED_MEDIA) || \ 03535 ((Status) == STATUS_WRONG_VOLUME))) 03536 03537 // end_ntddk end_wdm end_nthal 03538 03539 //++ 03540 // 03541 // BOOLEAN 03542 // IoIsFileOpenedExclusively( 03543 // IN PFILE_OBJECT FileObject 03544 // ) 03545 // 03546 // Routine Description: 03547 // 03548 // This routine is invoked to determine whether the file open represented 03549 // by the specified file object is opened exclusively. 03550 // 03551 // Arguments: 03552 // 03553 // FileObject - Pointer to the file object that represents the open instance 03554 // of the target file to be tested for exclusive access. 03555 // 03556 // Return Value: 03557 // 03558 // The function value is TRUE if the open instance of the file is exclusive; 03559 // otherwise FALSE is returned. 03560 // 03561 //-- 03562 03563 #define IoIsFileOpenedExclusively( FileObject ) (\ 03564 (BOOLEAN) !((FileObject)->SharedRead || (FileObject)->SharedWrite || (FileObject)->SharedDelete)) 03565 03566 NTKERNELAPI 03567 BOOLEAN 03568 IoIsOperationSynchronous( 03569 IN PIRP Irp 03570 ); 03571 03572 NTKERNELAPI 03573 BOOLEAN 03574 IoIsSystemThread( 03575 IN PETHREAD Thread 03576 ); 03577 03578 NTKERNELAPI 03579 BOOLEAN 03580 IoIsValidNameGraftingBuffer( 03581 IN PIRP Irp, 03582 IN PREPARSE_DATA_BUFFER ReparseBuffer 03583 ); 03584 03585 // begin_ntddk begin_nthal 03586 03587 NTKERNELAPI 03588 PIRP 03589 IoMakeAssociatedIrp( 03590 IN PIRP Irp, 03591 IN CCHAR StackSize 03592 ); 03593 03594 // begin_wdm 03595 03596 //++ 03597 // 03598 // VOID 03599 // IoMarkIrpPending( 03600 // IN OUT PIRP Irp 03601 // ) 03602 // 03603 // Routine Description: 03604 // 03605 // This routine marks the specified I/O Request Packet (IRP) to indicate 03606 // that an initial status of STATUS_PENDING was returned to the caller. 03607 // This is used so that I/O completion can determine whether or not to 03608 // fully complete the I/O operation requested by the packet. 03609 // 03610 // Arguments: 03611 // 03612 // Irp - Pointer to the I/O Request Packet to be marked pending. 03613 // 03614 // Return Value: 03615 // 03616 // None. 03617 // 03618 //-- 03619 03620 #define IoMarkIrpPending( Irp ) ( \ 03621 IoGetCurrentIrpStackLocation( (Irp) )->Control |= SL_PENDING_RETURNED ) 03622 03623 // end_ntddk end_wdm end_nthal end_ntifs 03624 03625 NTKERNELAPI 03626 BOOLEAN 03627 IoPageFileCreated( 03628 IN HANDLE FileHandle 03629 ); 03630 03631 NTKERNELAPI // ntifs 03632 NTSTATUS // ntifs 03633 IoPageRead( // ntifs 03634 IN PFILE_OBJECT FileObject, // ntifs 03635 IN PMDL MemoryDescriptorList, // ntifs 03636 IN PLARGE_INTEGER StartingOffset, // ntifs 03637 IN PKEVENT Event, // ntifs 03638 OUT PIO_STATUS_BLOCK IoStatusBlock // ntifs 03639 ); // ntifs 03640 03641 NTKERNELAPI // ntddk 03642 NTSTATUS // ntddk 03643 IoQueryDeviceDescription( // ntddk 03644 IN PINTERFACE_TYPE BusType OPTIONAL, // ntddk 03645 IN PULONG BusNumber OPTIONAL, // ntddk 03646 IN PCONFIGURATION_TYPE ControllerType OPTIONAL, // ntddk 03647 IN PULONG ControllerNumber OPTIONAL, // ntddk 03648 IN PCONFIGURATION_TYPE PeripheralType OPTIONAL, // ntddk 03649 IN PULONG PeripheralNumber OPTIONAL, // ntddk 03650 IN PIO_QUERY_DEVICE_ROUTINE CalloutRoutine, // ntddk 03651 IN PVOID Context // ntddk 03652 ); // ntddk 03653 03654 // begin_ntifs 03655 03656 NTKERNELAPI 03657 NTSTATUS 03658 IoQueryFileInformation( 03659 IN PFILE_OBJECT FileObject, 03660 IN FILE_INFORMATION_CLASS FileInformationClass, 03661 IN ULONG Length, 03662 OUT PVOID FileInformation, 03663 OUT PULONG ReturnedLength 03664 ); 03665 03666 NTKERNELAPI 03667 NTSTATUS 03668 IoQueryVolumeInformation( 03669 IN PFILE_OBJECT FileObject, 03670 IN FS_INFORMATION_CLASS FsInformationClass, 03671 IN ULONG Length, 03672 OUT PVOID FsInformation, 03673 OUT PULONG ReturnedLength 03674 ); 03675 03676 // end_ntifs 03677 03678 NTKERNELAPI // ntsrv 03679 VOID // ntsrv 03680 IoQueueThreadIrp( // ntsrv 03681 IN PIRP Irp // ntsrv 03682 ); // ntsrv 03683 03684 // begin_ntddk begin_nthal begin_ntifs 03685 03686 NTKERNELAPI 03687 VOID 03688 IoRaiseHardError( 03689 IN PIRP Irp, 03690 IN PVPB Vpb OPTIONAL, 03691 IN PDEVICE_OBJECT RealDeviceObject 03692 ); 03693 03694 NTKERNELAPI 03695 BOOLEAN 03696 IoRaiseInformationalHardError( 03697 IN NTSTATUS ErrorStatus, 03698 IN PUNICODE_STRING String OPTIONAL, 03699 IN PKTHREAD Thread OPTIONAL 03700 ); 03701 03702 NTKERNELAPI 03703 BOOLEAN 03704 IoSetThreadHardErrorMode( 03705 IN BOOLEAN EnableHardErrors 03706 ); 03707 03708 NTKERNELAPI 03709 VOID 03710 IoRegisterBootDriverReinitialization( 03711 IN PDRIVER_OBJECT DriverObject, 03712 IN PDRIVER_REINITIALIZE DriverReinitializationRoutine, 03713 IN PVOID Context 03714 ); 03715 03716 NTKERNELAPI 03717 VOID 03718 IoRegisterDriverReinitialization( 03719 IN PDRIVER_OBJECT DriverObject, 03720 IN PDRIVER_REINITIALIZE DriverReinitializationRoutine, 03721 IN PVOID Context 03722 ); 03723 03724 // end_ntddk end_nthal 03725 03726 NTKERNELAPI 03727 VOID 03728 IoRegisterFileSystem( 03729 IN OUT PDEVICE_OBJECT DeviceObject 03730 ); 03731 03732 NTKERNELAPI 03733 NTSTATUS 03734 IoRegisterFsRegistrationChange( 03735 IN PDRIVER_OBJECT DriverObject, 03736 IN PDRIVER_FS_NOTIFICATION DriverNotificationRoutine 03737 ); 03738 03739 // begin_ntddk begin_nthal 03740 03741 NTKERNELAPI 03742 NTSTATUS 03743 IoRegisterShutdownNotification( 03744 IN PDEVICE_OBJECT DeviceObject 03745 ); 03746 03747 NTKERNELAPI 03748 NTSTATUS 03749 IoRegisterLastChanceShutdownNotification( 03750 IN PDEVICE_OBJECT DeviceObject 03751 ); 03752 03753 // begin_wdm 03754 03755 NTKERNELAPI 03756 VOID 03757 IoReleaseCancelSpinLock( 03758 IN KIRQL Irql 03759 ); 03760 03761 // end_ntddk end_nthal end_wdm 03762 03763 NTKERNELAPI 03764 VOID 03765 IoReleaseVpbSpinLock( 03766 IN KIRQL Irql 03767 ); 03768 03769 // begin_ntddk begin_nthal 03770 03771 NTKERNELAPI 03772 VOID 03773 IoRemoveShareAccess( 03774 IN PFILE_OBJECT FileObject, 03775 IN OUT PSHARE_ACCESS ShareAccess 03776 ); 03777 03778 // end_ntddk end_ntifs 03779 03780 NTKERNELAPI 03781 NTSTATUS 03782 IoReportHalResourceUsage( 03783 IN PUNICODE_STRING HalName, 03784 IN PCM_RESOURCE_LIST RawResourceList, 03785 IN PCM_RESOURCE_LIST TranslatedResourceList, 03786 IN ULONG ResourceListSize 03787 ); 03788 03789 // begin_ntddk begin_ntifs 03790 03791 NTKERNELAPI 03792 NTSTATUS 03793 IoReportResourceUsage( 03794 IN PUNICODE_STRING DriverClassName OPTIONAL, 03795 IN PDRIVER_OBJECT DriverObject, 03796 IN PCM_RESOURCE_LIST DriverList OPTIONAL, 03797 IN ULONG DriverListSize OPTIONAL, 03798 IN PDEVICE_OBJECT DeviceObject, 03799 IN PCM_RESOURCE_LIST DeviceList OPTIONAL, 03800 IN ULONG DeviceListSize OPTIONAL, 03801 IN BOOLEAN OverrideConflict, 03802 OUT PBOOLEAN ConflictDetected 03803 ); 03804 03805 // begin_wdm 03806 03807 //++ 03808 // 03809 // VOID 03810 // IoRequestDpc( 03811 // IN PDEVICE_OBJECT DeviceObject, 03812 // IN PIRP Irp, 03813 // IN PVOID Context 03814 // ) 03815 // 03816 // Routine Description: 03817 // 03818 // This routine is invoked by the device driver's interrupt service routine 03819 // to request that a DPC routine be queued for later execution at a lower 03820 // IRQL. 03821 // 03822 // Arguments: 03823 // 03824 // DeviceObject - Device object for which the request is being processed. 03825 // 03826 // Irp - Pointer to the current I/O Request Packet (IRP) for the specified 03827 // device. 03828 // 03829 // Context - Provides a general context parameter to be passed to the 03830 // DPC routine. 03831 // 03832 // Return Value: 03833 // 03834 // None. 03835 // 03836 //-- 03837 03838 #define IoRequestDpc( DeviceObject, Irp, Context ) ( \ 03839 KeInsertQueueDpc( &(DeviceObject)->Dpc, (Irp), (Context) ) ) 03840 03841 //++ 03842 // 03843 // PDRIVER_CANCEL 03844 // IoSetCancelRoutine( 03845 // IN PIRP Irp, 03846 // IN PDRIVER_CANCEL CancelRoutine 03847 // ) 03848 // 03849 // Routine Description: 03850 // 03851 // This routine is invoked to set the address of a cancel routine which 03852 // is to be invoked when an I/O packet has been canceled. 03853 // 03854 // Arguments: 03855 // 03856 // Irp - Pointer to the I/O Request Packet itself. 03857 // 03858 // CancelRoutine - Address of the cancel routine that is to be invoked 03859 // if the IRP is cancelled. 03860 // 03861 // Return Value: 03862 // 03863 // Previous value of CancelRoutine field in the IRP. 03864 // 03865 //-- 03866 03867 #define IoSetCancelRoutine( Irp, NewCancelRoutine ) ( \ 03868 (PDRIVER_CANCEL) InterlockedExchangePointer( (PVOID *) &(Irp)->CancelRoutine, (PVOID) (NewCancelRoutine) ) ) 03869 03870 //++ 03871 // 03872 // VOID 03873 // IoSetCompletionRoutine( 03874 // IN PIRP Irp, 03875 // IN PIO_COMPLETION_ROUTINE CompletionRoutine, 03876 // IN PVOID Context, 03877 // IN BOOLEAN InvokeOnSuccess, 03878 // IN BOOLEAN InvokeOnError, 03879 // IN BOOLEAN InvokeOnCancel 03880 // ) 03881 // 03882 // Routine Description: 03883 // 03884 // This routine is invoked to set the address of a completion routine which 03885 // is to be invoked when an I/O packet has been completed by a lower-level 03886 // driver. 03887 // 03888 // Arguments: 03889 // 03890 // Irp - Pointer to the I/O Request Packet itself. 03891 // 03892 // CompletionRoutine - Address of the completion routine that is to be 03893 // invoked once the next level driver completes the packet. 03894 // 03895 // Context - Specifies a context parameter to be passed to the completion 03896 // routine. 03897 // 03898 // InvokeOnSuccess - Specifies that the completion routine is invoked when the 03899 // operation is successfully completed. 03900 // 03901 // InvokeOnError - Specifies that the completion routine is invoked when the 03902 // operation completes with an error status. 03903 // 03904 // InvokeOnCancel - Specifies that the completion routine is invoked when the 03905 // operation is being canceled. 03906 // 03907 // Return Value: 03908 // 03909 // None. 03910 // 03911 //-- 03912 03913 #define IoSetCompletionRoutine( Irp, Routine, CompletionContext, Success, Error, Cancel ) { \ 03914 PIO_STACK_LOCATION irpSp; \ 03915 ASSERT( (Success) | (Error) | (Cancel) ? (Routine) != NULL : TRUE ); \ 03916 irpSp = IoGetNextIrpStackLocation( (Irp) ); \ 03917 irpSp->CompletionRoutine = (Routine); \ 03918 irpSp->Context = (CompletionContext); \ 03919 irpSp->Control = 0; \ 03920 if ((Success)) { irpSp->Control = SL_INVOKE_ON_SUCCESS; } \ 03921 if ((Error)) { irpSp->Control |= SL_INVOKE_ON_ERROR; } \ 03922 if ((Cancel)) { irpSp->Control |= SL_INVOKE_ON_CANCEL; } } 03923 03924 // end_ntddk end_wdm end_nthal 03925 03926 NTKERNELAPI 03927 VOID 03928 IoSetDeviceToVerify( 03929 IN PETHREAD Thread, 03930 IN PDEVICE_OBJECT DeviceObject 03931 ); 03932 03933 // begin_ntddk begin_nthal 03934 03935 NTKERNELAPI 03936 VOID 03937 IoSetHardErrorOrVerifyDevice( 03938 IN PIRP Irp, 03939 IN PDEVICE_OBJECT DeviceObject 03940 ); 03941 03942 // end_ntddk end_nthal 03943 03944 NTKERNELAPI 03945 NTSTATUS 03946 IoSetInformation( 03947 IN PFILE_OBJECT FileObject, 03948 IN FILE_INFORMATION_CLASS FileInformationClass, 03949 IN ULONG Length, 03950 IN PVOID FileInformation 03951 ); 03952 03953 // begin_ntddk begin_wdm begin_nthal 03954 03955 //++ 03956 // 03957 // VOID 03958 // IoSetNextIrpStackLocation ( 03959 // IN OUT PIRP Irp 03960 // ) 03961 // 03962 // Routine Description: 03963 // 03964 // This routine is invoked to set the current IRP stack location to 03965 // the next stack location, i.e. it "pushes" the stack. 03966 // 03967 // Arguments: 03968 // 03969 // Irp - Pointer to the I/O Request Packet (IRP). 03970 // 03971 // Return Value: 03972 // 03973 // None. 03974 // 03975 //-- 03976 03977 #define IoSetNextIrpStackLocation( Irp ) { \ 03978 (Irp)->CurrentLocation--; \ 03979 (Irp)->Tail.Overlay.CurrentStackLocation--; } 03980 03981 //++ 03982 // 03983 // VOID 03984 // IoCopyCurrentIrpStackLocationToNext( 03985 // IN PIRP Irp 03986 // ) 03987 // 03988 // Routine Description: 03989 // 03990 // This routine is invoked to copy the IRP stack arguments and file 03991 // pointer from the current IrpStackLocation to the next 03992 // in an I/O Request Packet (IRP). 03993 // 03994 // If the caller wants to call IoCallDriver with a completion routine 03995 // but does not wish to change the arguments otherwise, 03996 // the caller first calls IoCopyCurrentIrpStackLocationToNext, 03997 // then IoSetCompletionRoutine, then IoCallDriver. 03998 // 03999 // Arguments: 04000 // 04001 // Irp - Pointer to the I/O Request Packet. 04002 // 04003 // Return Value: 04004 // 04005 // None. 04006 // 04007 //-- 04008 04009 #define IoCopyCurrentIrpStackLocationToNext( Irp ) { \ 04010 PIO_STACK_LOCATION irpSp; \ 04011 PIO_STACK_LOCATION nextIrpSp; \ 04012 irpSp = IoGetCurrentIrpStackLocation( (Irp) ); \ 04013 nextIrpSp = IoGetNextIrpStackLocation( (Irp) ); \ 04014 RtlCopyMemory( nextIrpSp, irpSp, FIELD_OFFSET(IO_STACK_LOCATION, CompletionRoutine)); \ 04015 nextIrpSp->Control = 0; } 04016 04017 //++ 04018 // 04019 // VOID 04020 // IoSkipCurrentIrpStackLocation ( 04021 // IN PIRP Irp 04022 // ) 04023 // 04024 // Routine Description: 04025 // 04026 // This routine is invoked to increment the current stack location of 04027 // a given IRP. 04028 // 04029 // If the caller wishes to call the next driver in a stack, and does not 04030 // wish to change the arguments, nor does he wish to set a completion 04031 // routine, then the caller first calls IoSkipCurrentIrpStackLocation 04032 // and the calls IoCallDriver. 04033 // 04034 // Arguments: 04035 // 04036 // Irp - Pointer to the I/O Request Packet. 04037 // 04038 // Return Value: 04039 // 04040 // None 04041 // 04042 //-- 04043 04044 #define IoSkipCurrentIrpStackLocation( Irp ) \ 04045 (Irp)->CurrentLocation++; \ 04046 (Irp)->Tail.Overlay.CurrentStackLocation++; 04047 04048 04049 NTKERNELAPI 04050 VOID 04051 IoSetShareAccess( 04052 IN ACCESS_MASK DesiredAccess, 04053 IN ULONG DesiredShareAccess, 04054 IN OUT PFILE_OBJECT FileObject, 04055 OUT PSHARE_ACCESS ShareAccess 04056 ); 04057 04058 // end_ntddk end_wdm end_nthal 04059 04060 NTKERNELAPI 04061 VOID 04062 IoSetTopLevelIrp( 04063 IN PIRP Irp 04064 ); 04065 04066 // end_ntifs 04067 04068 // begin_ntddk begin_wdm 04069 04070 04071 typedef struct _IO_REMOVE_LOCK_TRACKING_BLOCK * PIO_REMOVE_LOCK_TRACKING_BLOCK; 04072 04073 typedef struct _IO_REMOVE_LOCK_COMMON_BLOCK { 04074 BOOLEAN Removed; 04075 BOOLEAN Reserved [3]; 04076 LONG IoCount; 04077 KEVENT RemoveEvent; 04078 04079 } IO_REMOVE_LOCK_COMMON_BLOCK; 04080 04081 typedef struct _IO_REMOVE_LOCK_DBG_BLOCK { 04082 LONG Signature; 04083 LONG HighWatermark; 04084 LONGLONG MaxLockedTicks; 04085 LONG AllocateTag; 04086 LIST_ENTRY LockList; 04087 KSPIN_LOCK Spin; 04088 LONG LowMemoryCount; 04089 ULONG Reserved1[4]; 04090 PVOID Reserved2; 04091 PIO_REMOVE_LOCK_TRACKING_BLOCK Blocks; 04092 } IO_REMOVE_LOCK_DBG_BLOCK; 04093 04094 typedef struct _IO_REMOVE_LOCK { 04095 IO_REMOVE_LOCK_COMMON_BLOCK Common; 04096 #if DBG 04097 IO_REMOVE_LOCK_DBG_BLOCK Dbg; 04098 #endif 04099 } IO_REMOVE_LOCK, *PIO_REMOVE_LOCK; 04100 04101 #define IoInitializeRemoveLock(Lock, Tag, Maxmin, HighWater) \ 04102 IoInitializeRemoveLockEx (Lock, Tag, Maxmin, HighWater, sizeof (IO_REMOVE_LOCK)) 04103 04104 NTSYSAPI 04105 VOID 04106 NTAPI 04107 IoInitializeRemoveLockEx( 04108 IN PIO_REMOVE_LOCK Lock, 04109 IN ULONG AllocateTag, // Used only on checked kernels 04110 IN ULONG MaxLockedMinutes, // Used only on checked kernels 04111 IN ULONG HighWatermark, // Used only on checked kernels 04112 IN ULONG RemlockSize // are we checked or free 04113 ); 04114 // 04115 // Initialize a remove lock. 04116 // 04117 // Note: Allocation for remove locks needs to be within the device extension, 04118 // so that the memory for this structure stays allocated until such time as the 04119 // device object itself is deallocated. 04120 // 04121 04122 #define IoAcquireRemoveLock(RemoveLock, Tag) \ 04123 IoAcquireRemoveLockEx(RemoveLock, Tag, __FILE__, __LINE__, sizeof (IO_REMOVE_LOCK)) 04124 04125 NTSYSAPI 04126 NTSTATUS 04127 NTAPI 04128 IoAcquireRemoveLockEx ( 04129 IN PIO_REMOVE_LOCK RemoveLock, 04130 IN OPTIONAL PVOID Tag, // Optional 04131 IN PCSTR File, 04132 IN ULONG Line, 04133 IN ULONG RemlockSize // are we checked or free 04134 ); 04135 04136 // 04137 // Routine Description: 04138 // 04139 // This routine is called to acquire the remove lock for a device object. 04140 // While the lock is held, the caller can assume that no pending pnp REMOVE 04141 // requests will be completed. 04142 // 04143 // The lock should be acquired immediately upon entering a dispatch routine. 04144 // It should also be acquired before creating any new reference to the 04145 // device object if there's a chance of releasing the reference before the 04146 // new one is done, in addition to references to the driver code itself, 04147 // which is removed from memory when the last device object goes. 04148 // 04149 // Arguments: 04150 // 04151 // RemoveLock - A pointer to an initialized REMOVE_LOCK structure. 04152 // 04153 // Tag - Used for tracking lock allocation and release. The same tag 04154 // specified when acquiring the lock must be used to release the lock. 04155 // Tags are only checked in checked versions of the driver. 04156 // 04157 // File - set to __FILE__ as the location in the code where the lock was taken. 04158 // 04159 // Line - set to __LINE__. 04160 // 04161 // Return Value: 04162 // 04163 // Returns whether or not the remove lock was obtained. 04164 // If successful the caller should continue with work calling 04165 // IoReleaseRemoveLock when finished. 04166 // 04167 // If not successful the lock was not obtained. The caller should abort the 04168 // work but not call IoReleaseRemoveLock. 04169 // 04170 04171 #define IoReleaseRemoveLock(RemoveLock, Tag) \ 04172 IoReleaseRemoveLockEx(RemoveLock, Tag, sizeof (IO_REMOVE_LOCK)) 04173 04174 NTSYSAPI 04175 VOID 04176 NTAPI 04177 IoReleaseRemoveLockEx( 04178 IN PIO_REMOVE_LOCK RemoveLock, 04179 IN PVOID Tag, // Optional 04180 IN ULONG RemlockSize // are we checked or free 04181 ); 04182 // 04183 // 04184 // Routine Description: 04185 // 04186 // This routine is called to release the remove lock on the device object. It 04187 // must be called when finished using a previously locked reference to the 04188 // device object. If an Tag was specified when acquiring the lock then the 04189 // same Tag must be specified when releasing the lock. 04190 // 04191 // When the lock count reduces to zero, this routine will signal the waiting 04192 // event to release the waiting thread deleting the device object protected 04193 // by this lock. 04194 // 04195 // Arguments: 04196 // 04197 // DeviceObject - the device object to lock 04198 // 04199 // Tag - The TAG (if any) specified when acquiring the lock. This is used 04200 // for lock tracking purposes 04201 // 04202 // Return Value: 04203 // 04204 // none 04205 // 04206 04207 #define IoReleaseRemoveLockAndWait(RemoveLock, Tag) \ 04208 IoReleaseRemoveLockAndWaitEx(RemoveLock, Tag, sizeof (IO_REMOVE_LOCK)) 04209 04210 NTSYSAPI 04211 VOID 04212 NTAPI 04213 IoReleaseRemoveLockAndWaitEx( 04214 IN PIO_REMOVE_LOCK RemoveLock, 04215 IN PVOID Tag, 04216 IN ULONG RemlockSize // are we checked or free 04217 ); 04218 // 04219 // 04220 // Routine Description: 04221 // 04222 // This routine is called when the client would like to delete the 04223 // remove-locked resource. This routine will block until all the remove 04224 // locks have released. 04225 // 04226 // This routine MUST be called after acquiring the lock. 04227 // 04228 // Arguments: 04229 // 04230 // RemoveLock 04231 // 04232 // Return Value: 04233 // 04234 // none 04235 // 04236 04237 // end_ntddk end_wdm 04238 04239 NTKERNELAPI 04240 VOID 04241 IoShutdownSystem( 04242 IN ULONG Phase 04243 ); 04244 04245 // begin_ntddk begin_wdm begin_nthal begin_ntifs 04246 04247 //++ 04248 // 04249 // USHORT 04250 // IoSizeOfIrp( 04251 // IN CCHAR StackSize 04252 // ) 04253 // 04254 // Routine Description: 04255 // 04256 // Determines the size of an IRP given the number of stack locations 04257 // the IRP will have. 04258 // 04259 // Arguments: 04260 // 04261 // StackSize - Number of stack locations for the IRP. 04262 // 04263 // Return Value: 04264 // 04265 // Size in bytes of the IRP. 04266 // 04267 //-- 04268 04269 #define IoSizeOfIrp( StackSize ) \ 04270 ((USHORT) (sizeof( IRP ) + ((StackSize) * (sizeof( IO_STACK_LOCATION ))))) 04271 04272 // end_ntifs 04273 04274 04275 NTKERNELAPI 04276 VOID 04277 IoStartNextPacket( 04278 IN PDEVICE_OBJECT DeviceObject, 04279 IN BOOLEAN Cancelable 04280 ); 04281 04282 NTKERNELAPI 04283 VOID 04284 IoStartNextPacketByKey( 04285 IN PDEVICE_OBJECT DeviceObject, 04286 IN BOOLEAN Cancelable, 04287 IN ULONG Key 04288 ); 04289 04290 NTKERNELAPI 04291 VOID 04292 IoStartPacket( 04293 IN PDEVICE_OBJECT DeviceObject, 04294 IN PIRP Irp, 04295 IN PULONG Key OPTIONAL, 04296 IN PDRIVER_CANCEL CancelFunction OPTIONAL 04297 ); 04298 04299 // begin_ntifs 04300 04301 NTKERNELAPI 04302 VOID 04303 IoStartTimer( 04304 IN PDEVICE_OBJECT DeviceObject 04305 ); 04306 04307 NTKERNELAPI 04308 VOID 04309 IoStopTimer( 04310 IN PDEVICE_OBJECT DeviceObject 04311 ); 04312 04313 // end_ntddk end_wdm end_nthal 04314 04315 NTKERNELAPI 04316 NTSTATUS 04317 IoSynchronousPageWrite( 04318 IN PFILE_OBJECT FileObject, 04319 IN PMDL MemoryDescriptorList, 04320 IN PLARGE_INTEGER StartingOffset, 04321 IN PKEVENT Event, 04322 OUT PIO_STATUS_BLOCK IoStatusBlock 04323 ); 04324 04325 NTKERNELAPI 04326 PEPROCESS 04327 IoThreadToProcess( 04328 IN PETHREAD Thread 04329 ); 04330 04331 NTKERNELAPI 04332 VOID 04333 IoUnregisterFileSystem( 04334 IN OUT PDEVICE_OBJECT DeviceObject 04335 ); 04336 04337 NTKERNELAPI 04338 VOID 04339 IoUnregisterFsRegistrationChange( 04340 IN PDRIVER_OBJECT DriverObject, 04341 IN PDRIVER_FS_NOTIFICATION DriverNotificationRoutine 04342 ); 04343 04344 // begin_ntddk begin_wdm begin_nthal 04345 04346 NTKERNELAPI 04347 VOID 04348 IoUnregisterShutdownNotification( 04349 IN PDEVICE_OBJECT DeviceObject 04350 ); 04351 04352 // end_wdm 04353 04354 NTKERNELAPI 04355 VOID 04356 IoUpdateShareAccess( 04357 IN PFILE_OBJECT FileObject, 04358 IN OUT PSHARE_ACCESS ShareAccess 04359 ); 04360 04361 // end_ntddk end_nthal 04362 04363 NTKERNELAPI 04364 NTSTATUS 04365 IoVerifyVolume( 04366 IN PDEVICE_OBJECT DeviceObject, 04367 IN BOOLEAN AllowRawMount 04368 ); 04369 04370 04371 NTKERNELAPI // ntddk wdm nthal 04372 VOID // ntddk wdm nthal 04373 IoWriteErrorLogEntry( // ntddk wdm nthal 04374 IN PVOID ElEntry // ntddk wdm nthal 04375 ); // ntddk wdm nthal 04376 04377 // end_ntifs 04378 04379 04380 typedef BOOLEAN (*PIO_TRAVERSE_WORKER)( 04381 IN ULONG Level, 04382 IN PVOID DeviceNode, 04383 IN PDEVICE_OBJECT DeviceObject, 04384 IN PVOID Context 04385 ); 04386 04387 typedef BOOLEAN (*PIO_LEVEL_END_WORKER)( 04388 IN ULONG Level, 04389 IN PVOID Context 04390 ); 04391 04392 // 04393 // Used by PO to traverse DevNode tree 04394 // 04395 04396 VOID 04397 IoTraverseDeviceTree( 04398 IN BOOLEAN Inverted, 04399 IN LONG CurrentLevel, 04400 IN PIO_TRAVERSE_WORKER WorkerFunction, 04401 IN PIO_LEVEL_END_WORKER LevelEndFunction, 04402 IN PVOID Context 04403 ); 04404 04405 // begin_nthal 04406 04407 NTKERNELAPI 04408 NTSTATUS 04409 IoCreateDriver ( 04410 IN PUNICODE_STRING DriverName, OPTIONAL 04411 IN PDRIVER_INITIALIZE InitializationFunction 04412 ); 04413 04414 NTKERNELAPI 04415 VOID 04416 IoDeleteDriver ( 04417 IN PDRIVER_OBJECT DriverObject 04418 ); 04419 04420 // end_nthal 04421 04422 #define _WMIKM_ 04423 04424 // 04425 // This defines the codes used to define what a request must do 04426 // 04427 04428 typedef enum tagWMIACTIONCODE 04429 { 04430 WmiGetAllData = IRP_MN_QUERY_ALL_DATA, 04431 WmiGetSingleInstance = IRP_MN_QUERY_SINGLE_INSTANCE, 04432 WmiChangeSingleInstance = IRP_MN_CHANGE_SINGLE_INSTANCE, 04433 WmiChangeSingleItem = IRP_MN_CHANGE_SINGLE_ITEM, 04434 WmiEnableEvents = IRP_MN_ENABLE_EVENTS, 04435 WmiDisableEvents = IRP_MN_DISABLE_EVENTS, 04436 WmiEnableCollection = IRP_MN_ENABLE_COLLECTION, 04437 WmiDisableCollection = IRP_MN_DISABLE_COLLECTION, 04438 WmiRegisterInfo = IRP_MN_REGINFO, 04439 WmiExecuteMethodCall = IRP_MN_EXECUTE_METHOD 04440 } WMIACTIONCODE; 04441 04442 04443 // 04444 // This is the prototype for the callback WMI will make to a data provider 04445 // 04446 04447 typedef NTSTATUS (*WMIENTRY)( 04448 IN WMIACTIONCODE ActionCode, 04449 IN PVOID DataPath, 04450 IN ULONG BufferSize, 04451 IN OUT PVOID Buffer 04452 ); 04453 04454 #define WMIREG_FLAG_CALLBACK 0x80000000 04455 // begin_wmikm 04456 // 04457 // The following is set for a KM provider who is considered private to 04458 // kernel tracing 04459 // 04460 #define WMIREG_FLAG_TRACE_PROVIDER 0x00010000 04461 04462 // 04463 // The following mask is to extract the trace callout class 04464 // 04465 #define WMIREG_FLAG_TRACE_NOTIFY_MASK 0x00F00000 04466 04467 // 04468 // We use 4 bits for the trace callout classes. 04469 // 04470 #define WMIREG_NOTIFY_DISK_IO 1 << 20 04471 #define WMIREG_NOTIFY_TDI_IO 2 << 20 04472 04473 // end_wmikm 04474 04475 // begin_ntddk begin_wdm begin_ntsrv 04476 04477 typedef struct _IO_WORKITEM *PIO_WORKITEM; 04478 04479 typedef 04480 VOID 04481 (*PIO_WORKITEM_ROUTINE) ( 04482 IN PDEVICE_OBJECT DeviceObject, 04483 IN PVOID Context 04484 ); 04485 04486 PIO_WORKITEM 04487 IoAllocateWorkItem( 04488 PDEVICE_OBJECT DeviceObject 04489 ); 04490 04491 VOID 04492 IoFreeWorkItem( 04493 PIO_WORKITEM IoWorkItem 04494 ); 04495 04496 VOID 04497 IoQueueWorkItem( 04498 IN PIO_WORKITEM IoWorkItem, 04499 IN PIO_WORKITEM_ROUTINE WorkerRoutine, 04500 IN WORK_QUEUE_TYPE QueueType, 04501 IN PVOID Context 04502 ); 04503 04504 // end_ntsrv 04505 04506 // begin_ntifs 04507 04508 NTKERNELAPI 04509 NTSTATUS 04510 IoWMIRegistrationControl( 04511 IN PDEVICE_OBJECT DeviceObject, 04512 IN ULONG Action 04513 ); 04514 04515 // 04516 // Action code for IoWMIRetgistrationControl api 04517 // 04518 04519 #define WMIREG_ACTION_REGISTER 1 04520 #define WMIREG_ACTION_DEREGISTER 2 04521 #define WMIREG_ACTION_REREGISTER 3 04522 #define WMIREG_ACTION_UPDATE_GUIDS 4 04523 #define WMIREG_ACTION_BLOCK_IRPS 5 04524 04525 // 04526 // Code passed in IRP_MN_REGINFO WMI irp 04527 // 04528 04529 #define WMIREGISTER 0 04530 #define WMIUPDATE 1 04531 04532 NTKERNELAPI 04533 NTSTATUS 04534 IoWMIAllocateInstanceIds( 04535 IN GUID *Guid, 04536 IN ULONG InstanceCount, 04537 OUT ULONG *FirstInstanceId 04538 ); 04539 04540 NTKERNELAPI 04541 NTSTATUS 04542 IoWMISuggestInstanceName( 04543 IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL, 04544 IN PUNICODE_STRING SymbolicLinkName OPTIONAL, 04545 IN BOOLEAN CombineNames, 04546 OUT PUNICODE_STRING SuggestedInstanceName 04547 ); 04548 04549 NTKERNELAPI 04550 NTSTATUS 04551 IoWMIWriteEvent( 04552 IN PVOID WnodeEventItem 04553 ); 04554 04555 #if defined(_WIN64) 04556 ULONG IoWMIDeviceObjectToProviderId( 04557 PDEVICE_OBJECT DeviceObject 04558 ); 04559 #else 04560 #define IoWMIDeviceObjectToProviderId(DeviceObject) ((ULONG)(DeviceObject)) 04561 #endif 04562 04563 // end_ntddk end_wdm end_ntifs 04564 04565 04566 04567 NTKERNELAPI 04568 BOOLEAN 04569 WMIInitialize( 04570 ); 04571 04572 // 04573 // IoRemoteBootClient indicates whether the system was booted as a remote 04574 // boot client. 04575 // 04576 04577 extern BOOLEAN IoRemoteBootClient; 04578 #if defined(REMOTE_BOOT) 04579 extern BOOLEAN IoCscInitializationFailed; 04580 #endif // defined(REMOTE_BOOT) 04581 04582 NTSTATUS 04583 IoSetCrashDumpState( 04584 IN SYSTEM_CRASH_STATE_INFORMATION *dumpState 04585 ); 04586 04587 // Used for obtaining fast dump information 04588 NTKERNELAPI 04589 NTSTATUS 04590 IoGetCrashDumpInformation( 04591 OUT PSYSTEM_CRASH_DUMP_INFORMATION pCrashDumpInfo 04592 ); 04593 04594 // Used for obtaining fast dump state 04595 NTKERNELAPI 04596 NTSTATUS 04597 IoGetCrashDumpStateInformation( 04598 OUT PSYSTEM_CRASH_STATE_INFORMATION pCrashDumpState 04599 ); 04600 04601 // Used to convert a handle to a device stack. 04602 NTSTATUS 04603 IoGetRelatedTargetDevice( 04604 IN PFILE_OBJECT FileObject, 04605 OUT PDEVICE_OBJECT *DeviceObject 04606 ); 04607 04608 // Used to include a range of memory in a summary dump 04609 NTKERNELAPI 04610 NTSTATUS 04611 IoSetDumpRange( 04612 IN PVOID DumpContext, 04613 IN PVOID StartVA, 04614 IN ULONG_PTR Pages, 04615 IN BOOLEAN IsPhysicalAddress 04616 ); 04617 04618 //Used to remove a range of memory from the summary dump 04619 NTKERNELAPI 04620 NTSTATUS 04621 IoFreeDumpRange( 04622 IN PVOID DumpContext, 04623 IN PVOID StartVA, 04624 IN ULONG_PTR Pages, 04625 IN BOOLEAN IsPhysicalAddress 04626 ); 04627 04628 NTKERNELAPI 04629 NTSTATUS 04630 IoSetIoCompletion ( 04631 IN PVOID IoCompletion, 04632 IN PVOID KeyContext, 04633 IN PVOID ApcContext, 04634 IN NTSTATUS IoStatus, 04635 IN ULONG_PTR IoStatusInformation, 04636 IN BOOLEAN Quota 04637 ); 04638 04639 // 04640 // Safeboot definitions - placeholder until a home can be found. 04641 // 04642 04643 typedef struct _BOOT_LOG_RECORD { 04644 UNICODE_STRING LoadedString; 04645 UNICODE_STRING NotLoadedString; 04646 UNICODE_STRING LogFileName; 04647 UNICODE_STRING HeaderString; 04648 ERESOURCE Resource; 04649 ULONG NextKey; 04650 BOOLEAN FileLogging; 04651 } BOOT_LOG_RECORD, *PBOOT_LOG_RECORD; 04652 04653 VOID 04654 IopCopyBootLogRegistryToFile( 04655 VOID 04656 ); 04657 04658 VOID 04659 IopInitializeBootLogging( 04660 PLOADER_PARAMETER_BLOCK LoaderBlock, 04661 PCHAR HeaderString 04662 ); 04663 04664 VOID 04665 IopBootLog( 04666 PUNICODE_STRING LogEntry, 04667 BOOLEAN Loaded 04668 ); 04669 04670 NTSTATUS 04671 IopSetRegistryStringValue( 04672 IN HANDLE KeyHandle, 04673 IN PUNICODE_STRING ValueName, 04674 IN PUNICODE_STRING ValueData 04675 ); 04676 04677 NTKERNELAPI 04678 NTSTATUS 04679 IoGetRequestorSessionId( 04680 IN PIRP Irp, 04681 OUT PULONG pSessionId 04682 ); 04683 04684 04685 VOID 04686 IovFreeIrp( 04687 IN PIRP Irp 04688 ); 04689 04690 PIRP 04691 IovAllocateIrp( 04692 IN CCHAR StackSize, 04693 IN BOOLEAN ChargeQuota 04694 ); 04695 04696 #define IOVERIFIERINIT_PHASE0 0x00000001 04697 #define IOVERIFIERINIT_EVERYTHING_TRACKED 0x00000002 04698 #define IOVERIFIERINIT_ASYNCHRONOUSINIT 0x00000004 04699 #define IOVERIFIERINIT_NO_REINIT 0x00000008 04700 #define IOVERIFIERINIT_VERIFIER_DRIVER_LIST 0x00000010 04701 #define IOVERIFIERINIT_RANDOMLY_CANCEL_IRPS 0x00000020 04702 04703 VOID 04704 IoVerifierInit( 04705 IN ULONG VerifierFlags, 04706 IN ULONG InitFlags 04707 ); 04708 04709 NTSTATUS 04710 FASTCALL 04711 IovCallDriver( 04712 IN PDEVICE_OBJECT DeviceObject, 04713 IN OUT PIRP Irp 04714 ); 04715 04716 VOID 04717 FASTCALL 04718 IovCompleteRequest( 04719 IN PIRP Irp, 04720 IN CCHAR PriorityBoost 04721 ); 04722 04723 PIRP 04724 IovBuildAsynchronousFsdRequest( 04725 IN ULONG MajorFunction, 04726 IN PDEVICE_OBJECT DeviceObject, 04727 IN OUT PVOID Buffer OPTIONAL, 04728 IN ULONG Length OPTIONAL, 04729 IN PLARGE_INTEGER StartingOffset OPTIONAL, 04730 IN PIO_STATUS_BLOCK IoStatusBlock OPTIONAL 04731 ); 04732 04733 04734 PIRP 04735 IovBuildDeviceIoControlRequest( 04736 IN ULONG IoControlCode, 04737 IN PDEVICE_OBJECT DeviceObject, 04738 IN PVOID InputBuffer OPTIONAL, 04739 IN ULONG InputBufferLength, 04740 OUT PVOID OutputBuffer OPTIONAL, 04741 IN ULONG OutputBufferLength, 04742 IN BOOLEAN InternalDeviceIoControl, 04743 IN PKEVENT Event, 04744 OUT PIO_STATUS_BLOCK IoStatusBlock 04745 ); 04746 04747 NTSTATUS 04748 IovInitializeTimer( 04749 IN PDEVICE_OBJECT DeviceObject, 04750 IN PIO_TIMER_ROUTINE TimerRoutine, 04751 IN PVOID Context 04752 ); 04753 04754 NTKERNELAPI 04755 PVOID 04756 IoAllocateGenericErrorLogEntry( 04757 IN UCHAR EntrySize 04758 ); 04759 04760 VOID 04761 IoRetryIrpCompletions( 04762 VOID 04763 ); 04764 04765 #endif // _IO_ 04766

Generated on Sat May 15 19:40:28 2004 for test by doxygen 1.3.7