1 /* IO MANAGER ***************************************************************/
4 IoRaiseInformationalHardError (
6 PUNICODE_STRING String
,
12 * FUNCTION: Registers the driver with WMI
14 * DeviceObject = Device to register
15 * Action = Action to take
18 //NTSTATUS IoWMIRegistrationControl(DeviceObject, WMIREGACTION Action);
21 * FUNCTION: Synchronizes cancelable-state transistions for IRPs in a
22 * multiprocessor-safe way
24 * Irpl = Variable to store the current IRQ level
27 IoAcquireCancelSpinLock (
34 PDEVICE_OBJECT DeviceObject
,
36 PVOID MapRegisterBase
,
41 * FUNCTION: Allocates an adaptor object for a DMA operation on the target
44 * Adaptor = Adapter channel or busmaster adapter to be allocated
45 * DeviceObject = Target device for DMA
46 * NumberOfMapRegisters = Number of map registers
47 * ExecutionRoutine = Routine to be called when the adaptor is
49 * Context = driver defined contex that will be passed to the
51 * RETURNS: Success or failure code
54 IoAllocateAdapterChannel (
55 PADAPTER_OBJECT AdaperObject
,
56 PDEVICE_OBJECT DeviceObject
,
57 ULONG NumberOfMapRegisters
,
58 PDRIVER_CONTROL ExecutionRoutine
,
63 * FUNCTION: Sets up a call to a driver supplied controller object as
64 * soon as it is available
66 * ControllerObject = Driver created controller object
67 * DeviceObject = target device
68 * ExecutionObject = Routine to be called
69 * Context = Driver determined context to be based to the routine
72 IoAllocateController (
73 PCONTROLLER_OBJECT ControllerObject
,
74 PDEVICE_OBJECT DeviceObject
,
75 PDRIVER_CONTROL ExecutionRoutine
,
80 * FUNCTION: Allocates an error log packet
82 * IoObject = Object which found the error
83 * EntrySize = Size in bytes of the packet to be allocated
84 * RETURNS: On success a pointer to the allocated packet
85 * On failure returns NULL
88 IoAllocateErrorLogEntry (
94 * FUNCTION: Allocates an IRP
96 * StackSize = number of stack locations to allocate
97 * ChargeQuota = Who knows
98 * RETURNS: On success the allocated IRP
108 * FUNCTION: Allocates an MDL large enough to map the supplied buffer
110 * VirtualAddress = base virtual address of the buffer to be mapped
111 * Length = length of the buffer to be mapped
112 * SecondaryBuffer = Whether the buffer is primary or secondary
113 * ChargeQuota = Charge non-paged pool quota to current thread
114 * Irp = Optional irp to be associated with the MDL
115 * RETURNS: On the success the allocated MDL
120 PVOID VirtualAddress
,
122 BOOLEAN SecondaryBuffer
,
128 * FUNCTION: Creates a symbolic link between the ARC name of a physical
129 * device and the name of the corresponding device object
131 * ArcName = ARC name of the device
132 * DeviceName = Name of the device object
136 PUNICODE_STRING ArcName
,
137 PUNICODE_STRING DeviceName
146 * FUNCTION: Takes a list of requested hardware resources and allocates them
150 * DriverObject = Driver object passed to the DriverEntry routine
152 * RequestedResources = List of resources
157 PUNICODE_STRING RegistryPath
,
158 PUNICODE_STRING DriverClassName
,
159 PDRIVER_OBJECT DriverObject
,
160 PDEVICE_OBJECT DeviceObject
,
161 PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources
,
162 PCM_RESOURCE_LIST
* AllocatedResources
166 * FUNCTION: Attaches the callers device object to a named target device
168 * SourceDevice = caller's device
169 * TargetDevice = Name of the target device
170 * AttachedDevice = Caller allocated storage. On return contains
171 * a pointer to the target device
172 * RETURNS: Success or failure code
176 PDEVICE_OBJECT SourceDevice
,
177 PUNICODE_STRING TargetDevice
,
178 PDEVICE_OBJECT
* AttachedDevice
184 * SourceDevice = device to attach
185 * TargetDevice = device to be attached to
186 * RETURNS: Success or failure code
189 IoAttachDeviceByPointer (
190 PDEVICE_OBJECT SourceDevice
,
191 PDEVICE_OBJECT TargetDevice
195 * FUNCTION: Attaches the callers device to the highest device in the chain
197 * SourceDevice = caller's device
198 * TargetDevice = Device to attach
199 * RETURNS: On success the previously highest device
203 IoAttachDeviceToDeviceStack (
204 PDEVICE_OBJECT SourceDevice
,
205 PDEVICE_OBJECT TargetDevice
209 * FUNCTION: Builds a irp to be sent to lower level drivers
211 * MajorFunction = Major function code to be set in the IRP
212 * DeviceObject = Next lower device object
213 * Buffer = Buffer (only required for some major function codes)
214 * Length = Length in bytes of the buffer
215 * StartingOffset = Starting offset on the target device
216 * IoStatusBlock = Storage for status about the operation (optional)
217 * RETURNS: On success the IRP allocated
221 IoBuildAsynchronousFsdRequest (
223 PDEVICE_OBJECT DeviceObject
,
226 PLARGE_INTEGER StartingOffset
,
227 PIO_STATUS_BLOCK IoStatusBlock
231 * FUNCTION: Allocates and sets up an IRP for a device control request
233 * IoControlCode = Type of request
234 * DeviceObject = Target device
235 * InputBuffer = Optional input buffer to the driver
236 * InputBufferLength = Length of the input buffer
237 * OutputBuffer = Optional output buffer
238 * OutputBufferLength = Length of the output buffer
239 * InternalDeviceIoControl = TRUE if the request is internal
240 * Event = Initialized event for the caller to wait for the request
242 * IoStatusBlock = I/O status block to be set when the request is
244 * RETURNS: Returns the IRP created
247 IoBuildDeviceIoControlRequest (
249 PDEVICE_OBJECT DeviceObject
,
251 ULONG InputBufferLength
,
253 ULONG OutputBufferLength
,
254 BOOLEAN InternalDeviceIoControl
,
256 PIO_STATUS_BLOCK IoStatusBlock
264 PVOID VirtualAddress
,
269 IoBuildSynchronousFsdRequest (
271 PDEVICE_OBJECT DeviceObject
,
274 PLARGE_INTEGER StartingOffset
,
276 PIO_STATUS_BLOCK IoStatusBlock
280 * FUNCTION: Sends an irp to the next lower driver
284 PDEVICE_OBJECT DeviceObject
,
295 ACCESS_MASK DesiredAccess
,
296 ULONG DesiredShareAccess
,
297 PFILE_OBJECT FileObject
,
298 PSHARE_ACCESS ShareAccess
,
303 * FUNCTION: Indicates the caller has finished all processing for a given
304 * I/O request and is returning the given IRP to the I/O manager
306 * Irp = Irp to be cancelled
307 * PriorityBoost = Increment by which to boost the priority of the
308 * thread making the request
318 PKINTERRUPT
* InterruptObject
,
319 PKSERVICE_ROUTINE ServiceRoutine
,
320 PVOID ServiceContext
,
321 PKSPIN_LOCK SpinLock
,
324 KIRQL SynchronizeIrql
,
325 KINTERRUPT_MODE InterruptMode
,
327 KAFFINITY ProcessorEnableMask
,
337 * FUNCTION: Allocates memory for and intializes a device object for use for
340 * DriverObject : Driver object passed by iomgr when the driver was
342 * DeviceExtensionSize : Number of bytes for the device extension
343 * DeviceName : Unicode name of device
344 * DeviceType : Device type
345 * DeviceCharacteristics : Bit mask of device characteristics
346 * Exclusive : True if only one thread can access the device at a
350 * DeviceObject : Contains a pointer to allocated device object
351 * if the call succeeded
352 * NOTES: See the DDK documentation for more information
356 PDRIVER_OBJECT DriverObject
,
357 ULONG DeviceExtensionSize
,
358 PUNICODE_STRING DeviceName
,
359 DEVICE_TYPE DeviceType
,
360 ULONG DeviceCharacteristics
,
362 PDEVICE_OBJECT
* DeviceObject
367 IoCreateNotificationEvent (
368 PUNICODE_STRING EventName
,
374 IoCreateSymbolicLink (
375 PUNICODE_STRING SymbolicLinkName
,
376 PUNICODE_STRING DeviceName
380 IoCreateSynchronizationEvent (
381 PUNICODE_STRING EventName
,
387 IoCreateUnprotectedSymbolicLink (
388 PUNICODE_STRING SymbolicLinkName
,
389 PUNICODE_STRING DeviceName
395 PUNICODE_STRING ArcName
400 PCONTROLLER_OBJECT ControllerObject
405 PDEVICE_OBJECT DeviceObject
410 IoDeleteSymbolicLink (
411 PUNICODE_STRING SymbolicLinkName
416 PDEVICE_OBJECT TargetDevice
420 IoDisconnectInterrupt (
421 PKINTERRUPT InterruptObject
425 IoFlushAdapterBuffers (
426 PADAPTER_OBJECT AdapterObject
,
428 PVOID MapRegisterBase
,
431 BOOLEAN WriteToDevice
435 IoFreeAdapterChannel (
436 PADAPTER_OBJECT AdapterObject
441 PCONTROLLER_OBJECT ControllerObject
451 PADAPTER_OBJECT AdapterObject
,
452 PVOID MapRegisterBase
,
453 ULONG NumberOfMapRegisters
461 PCONFIGURATION_INFORMATION
462 IoGetConfigurationInformation (VOID
);
466 * FUNCTION: Returns a pointer to the callers stack location in the irp
469 IoGetCurrentIrpStackLocation (
474 IoGetCurrentProcess (VOID
);
477 IoGetDeviceObjectPointer (
478 PUNICODE_STRING ObjectName
,
479 ACCESS_MASK DesiredAccess
,
480 PFILE_OBJECT
* FileObject
,
481 PDEVICE_OBJECT
* DeviceObject
485 IoGetDeviceToVerify (
490 IoGetFileObjectGenericMapping (VOID
);
493 IoGetFunctionCodeFromCtlCode (
498 IoGetInitialStack (VOID
);
504 IoGetNextIrpStackLocation (
509 IoGetRelatedDeviceObject (
510 PFILE_OBJECT FileObject
514 IoInitializeDpcRequest (
515 PDEVICE_OBJECT DeviceObject
,
516 PIO_DPC_ROUTINE DpcRoutine
520 * FUNCTION: Initalizes an irp allocated by the caller
522 * Irp = IRP to initalize
523 * PacketSize = Size in bytes of the IRP
524 * StackSize = Number of stack locations in the IRP
535 PDEVICE_OBJECT DeviceObject
,
536 PIO_TIMER_ROUTINE TimerRoutine
,
541 IoIsErrorUserInduced (
546 IoIsTotalDeviceFailure (
551 IoMakeAssociatedIrp (
558 PADAPTER_OBJECT AdapterObject
,
560 PVOID MapRegisterBase
,
563 BOOLEAN WriteToDevice
567 * FUNCTION: Marks an IRP as pending
570 * NOTE: If a driver doesn't complete the irp in its dispatch routine it
571 * must mark it pending otherwise the I/O manager will complete it on
572 * return from the dispatch routine.
580 IoQueryDeviceDescription (
581 PINTERFACE_TYPE BusType
,
583 PCONFIGURATION_TYPE ControllerType
,
584 PULONG ControllerNumber
,
585 PCONFIGURATION_TYPE PeripheralType
,
586 PULONG PeripheralNumber
,
587 PIO_QUERY_DEVICE_ROUTINE CalloutRoutine
,
595 PDEVICE_OBJECT RealDeviceObject
599 IoRaiseHardInformationalError (
600 NTSTATUS ErrorStatus
,
601 PUNICODE_STRING String
,
606 IoReadPartitionTable (
607 PDEVICE_OBJECT DeviceObject
,
609 BOOLEAN ReturnedRecognizedPartitions
,
610 struct _DRIVE_LAYOUT_INFORMATION
** PBuffer
614 IoRegisterDriverReinitialization (
615 PDRIVER_OBJECT DriverObject
,
616 PDRIVER_REINITIALIZE ReinitRoutine
,
621 IoRegisterShutdownNotification (
622 PDEVICE_OBJECT DeviceObject
626 IoReleaseCancelSpinLock (
631 IoRemoveShareAccess (
632 PFILE_OBJECT FileObject
,
633 PSHARE_ACCESS ShareAccess
637 IoReportResourceUsage (
638 PUNICODE_STRING DriverClassName
,
639 PDRIVER_OBJECT DriverObject
,
640 PCM_RESOURCE_LIST DriverList
,
641 ULONG DriverListSize
,
642 PDEVICE_OBJECT DeviceObject
,
643 PCM_RESOURCE_LIST DeviceList
,
644 ULONG DeviceListSize
,
645 BOOLEAN OverrideConflict
,
646 PBOOLEAN ConflictDetected
651 PDEVICE_OBJECT DeviceObject
,
659 PDRIVER_CANCEL CancelRoutine
663 IoSetCompletionRoutine (
665 PIO_COMPLETION_ROUTINE CompletionRoutine
,
667 BOOLEAN InvokeOnSuccess
,
668 BOOLEAN InvokeOnError
,
669 BOOLEAN InvokeOnCancel
673 IoSetHardErrorOrVerifyDevice (
675 PDEVICE_OBJECT DeviceObject
679 IoSetNextIrpStackLocation (
684 IoSetPartitionInformation (
685 PDEVICE_OBJECT DeviceObject
,
687 ULONG PartitionNumber
,
693 ACCESS_MASK DesiredAccess
,
694 ULONG DesiredShareAccess
,
695 PFILE_OBJECT FileObject
,
696 PSHARE_ACCESS ShareAccess
700 * FUNCTION: Determines the size of an IRP
702 * StackSize = number of stack locations in the IRP
703 * RETURNS: The size of the IRP in bytes
711 * FUNCTION: Dequeues the next IRP from the device's associated queue and
712 * calls its StartIo routine
714 * DeviceObject = Device object
715 * Cancelable = True if IRPs in the queue can be cancelled
719 PDEVICE_OBJECT DeviceObject
,
724 IoStartNextPacketByKey (
725 PDEVICE_OBJECT DeviceObject
,
731 * FUNCTION: Calls the drivers StartIO routine with the IRP or queues it if
734 * DeviceObject = Device to pass the IRP to
735 * Irp = Irp to be processed
736 * Key = Optional value for where to insert the IRP
737 * CancelFunction = Entry point for a driver supplied cancel function
741 PDEVICE_OBJECT DeviceObject
,
744 PDRIVER_CANCEL CancelFunction
749 PDEVICE_OBJECT DeviceObject
754 PDEVICE_OBJECT DeviceObject
758 IoUnregisterShutdownNotification (
759 PDEVICE_OBJECT DeviceObject
763 IoUpdateShareAccess (
764 PFILE_OBJECT FileObject
,
765 PSHARE_ACCESS ShareAccess
769 IoWriteErrorLogEntry (
774 IoWritePartitionTable (
775 PDEVICE_OBJECT DeviceObject
,
777 ULONG SectorsPerTrack
,
779 struct _DRIVE_LAYOUT_INFORMATION
* PBuffer
786 IoQueryFileVolumeInformation (
787 IN PFILE_OBJECT FileObject
,
788 IN FS_INFORMATION_CLASS FsInformationClass
,
790 OUT PVOID FsInformation
,
791 OUT PULONG ReturnedLength
794 NTKERNELAPI
// confirmed - Undocumented because it does not require a valid file handle
796 IoQueryFileInformation (
797 IN PFILE_OBJECT FileObject
,
798 IN FILE_INFORMATION_CLASS FileInformationClass
,
800 OUT PVOID FileInformation
,
801 OUT PULONG ReturnedLength
805 IoRegisterFileSystem (
806 PDEVICE_OBJECT DeviceObject
810 IoGetAttachedDevice (
811 PDEVICE_OBJECT DeviceObject
815 IoCreateStreamFileObject (
816 PFILE_OBJECT FileObject
,
817 PDEVICE_OBJECT DeviceObject