IRP_MN_WRITE_CONFIG

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.

Major Code

IRP_MJ_PNP

When Sent

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.

Input Parameters

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:

WhichSpace
Specifies the configuration space. For information about values that can be specified for WhichSpace, see IRP_MN_READ_CONFIG.

Buffer
Points to a buffer that contains the data to be written. The format of the buffer is bus-specific.

Offset
Specifies an offset into the configuration space.

Length
Specifies the number of bytes to be written.

Output Parameters

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.

Operation

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.

See Plug and Play for the general rules for handling Plug and Play minor IRPs.

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.

Requirements

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

See also

IRP_MN_QUERY_INTERFACE

IRP_MN_READ_CONFIG


Send comments about this topic to Microsoft