1.2.1 Processing IRPs

IoGetCurrentIrpStackLocation

Returns a pointer to the caller's I/O stack location in a given IRP.

IoGetNextIrpStackLocation

Returns a pointer to the next-lower-level driver's I/O stack location in a given IRP.

IoGetRelatedDeviceObject

Returns a pointer to the device object represented by a given file object.

IoGetFunctionCodeFromCtlCode

Returns the value of the function field within a given IOCTL_XXX or FSCTL_XXX.

IoSetCompletionRoutine

Registers a driver-supplied IoCompletion routine with a given IRP, so the IoCompletion routine is called when the next-lower-level driver has completed the requested operation in one or more of the following ways: successfully, with an error, and/or by cancelling the IRP.

IoCallDriver

Sends an IRP to a lower-level driver.

IoMarkIrpPending

Marks a given IRP indicating that STATUS_PENDING was returned because further processing is required by another driver routine or by a lower-level driver.

IoStartPacket

Calls the driver's StartIo routine with the given IRP for the given device object or inserts the IRP into the device queue if the device is already busy, specifying whether the IRP is cancelable.

IoAcquireCancelSpinLock

Synchronizes cancelable-state transitions for IRPs in a multiprocessor-safe manner.

IoSetCancelRoutine

Sets or clears the Cancel routine in an IRP. Setting a Cancel routine makes an IRP cancelable.

IoReleaseCancelSpinLock

Releases the cancel spin lock when the driver has changed the cancelable state of an IRP or releases the cancel spin lock from the driver's Cancel routine.

IoCancelIrp

Marks an IRP as cancelled.

IoReadPartitionTable

Returns a list of partitions on a disk with a given sector size.

IoSetPartitionInformation

Sets the partition type and number for a (disk) partition.

IoWritePartitionTable

Writes partition tables for a disk, given the device object representing the disk, the sector size, and a pointer to a buffer containing the drive geometry.

IoAllocateErrorLogEntry

Allocates and initializes an error log packet; returns a pointer so the caller can supply error-log data and call IoWriteErrorLogEntry with the packet.

IoWriteErrorLogEntry

Queues a previously allocated error log packet, filled in by the driver, to the system error logging thread.

IoIsErrorUserInduced

Returns a Boolean indicating whether an I/O request failed due to one of the following conditions: STATUS_IO_TIMEOUT, STATUS_DEVICE_NOT_READY, STATUS_UNRECOGNIZED_MEDIA, STATUS_VERIFY_REQUIRED, STATUS_WRONG_VOLUME, STATUS_MEDIA_WRITE_PROTECTED, or STATUS_NO_MEDIA_IN_DEVICE. If the result is TRUE, a removable-media driver must call IoSetHardErrorOrVerifyDevice before completing the IRP.

IoSetHardErrorOrVerifyDevice

Supplies the device object for which the given IRP was failed due to a user-induced error, such as supplying the incorrect media for the requested operation or changing the media before the requested operation was completed. A file system driver uses the associated device object to send a popup to the user, who can then correct the error and/or retry the operation.

IoGetDeviceToVerify

Returns a pointer to the device object, representing a removable-media device, that is the target of the given thread's I/O request. (This routine is useful only to file systems or other highest-level drivers.)

IoRaiseHardError

Causes a popup to be sent to the user indicating that the given IRP was failed on the given device object for an optional VPB, so that the user can correct the error and/or can retry the operation.

IoRaiseInformationalHardError

Causes a popup to be sent to the user, showing an I/O error status and optional string supplying more information.

ExRaiseStatus

Raises an error status so that a caller-supplied structured exception handler is called. (This routine is useful only to highest-level drivers that supply exception handlers, in particular to file systems.)

IoStartNextPacket

Dequeues the next IRP for a given device object, specifying whether the IRP is cancelable, and calls the driver's StartIo routine.

IoStartNextPacketByKey

Dequeues the next IRP, according to the specified sort-key value, for a given device object, specifies whether the IRP is cancelable, and calls the driver's StartIo routine.

IoCompleteRequest

Completes an I/O request, giving a priority boost to the original caller and returning a given IRP to the I/O system for disposal: either to call any IoCompletion routines supplied by higher-level drivers, or to return status to the original requestor of the operation.

IoGetCurrentProcess

Returns a pointer to the current process. (This routine is useful only to highest-level drivers.)

IoGetInitialStack

Returns the initial base address of the current thread's stack. (This routine is useful only to highest-level drivers.)