Bus drivers for buses with configuration space must handle this request for their child devices (child PDOs). Function and filter drivers do not handle this request.
A driver or other system component sends this IRP to write data to the configuration space of a device's parent bus.
A driver or other system component sends this IRP at IRQL < DISPATCH_LEVEL in an arbitrary thread context.
Parameters.ReadWriteConfig is a structure containing the following information:
ULONG WhichSpace; PVOID Buffer; ULONG Offset; ULONG Length
The members of the structure can be interpreted differently by different bus drivers, but the members are typically defined as follows:
Specifies the configuration space. For information about values that can be specified for WhichSpace, see IRP_MN_READ_CONFIG.
Returned in the I/O status block.
I/O Status Block
A bus driver sets Irp->IoStatus.Status to STATUS_SUCCESS or to an appropriate error status such as STATUS_INVALID_PARAMETER_n, STATUS_NO_SUCH_DEVICE, or STATUS_DEVICE_NOT_READY.
On success, a bus driver sets Irp->IoStatus.Information to the number of bytes written.
If a bus driver is unable to complete this request immediately, it can mark the IRP pending, return STATUS_PENDING, and complete the IRP at a later time.
A bus driver handles this IRP for its child devices (child PDOs).
Function and filter drivers do not handle this IRP; they pass it to the next lower driver with no changes to Irp->IoStatus.Status and do not set an IoCompletion routine.
Sending This IRP
Typically, a function driver sends this IRP to the device stack to which it is attached and the IRP is handled by the parent bus driver.
See Handling IRPs for information about sending IRPs. The following steps apply specifically to this IRP:
Allocate a buffer from paged pool and initialize it with the data to be written.
Set the values in the next I/O stack location of the IRP: set MajorFunction to IRP_MJ_PNP, set MinorFunction to IRP_MN_WRITE_CONFIG, and set the appropriate values in Parameters.ReadWriteConfig.
Initialize IoStatus.Status to STATUS_NOT_SUPPORTED.
Deallocate the IRP and the buffer when they are no longer needed.
Drivers must send this IRP from IRQL < DISPATCH_LEVEL.
A driver can access a bus's configuration space at DISPATCH_LEVEL through a bus interface routine, if the parent bus driver exports such an interface. To get a bus interface, a driver sends an IRP_MN_QUERY_INTERFACE request to its parent bus driver. The driver then calls the appropriate routine returned in the interface.
For example, to write configuration space from DISPATCH_LEVEL a driver can call IRP_MN_QUERY_INTERFACE during driver initialization to get the BUS_INTERFACE_STANDARD interface from the parent bus driver. The driver sends the query IRP from IRQL PASSIVE_LEVEL. Later, from code at IRQL DISPATCH_LEVEL, the driver calls the appropriate routine returned in the interface, such as the Interface.SetBusData routine.
|Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)|