[Previous] [
The Plug and Play (PnP) Manager communicates information and
Plug and Play requests play two roles in the WDM. In their first role, these requests instruct the driver when and how to configure or deconfigure itself and the hardware. Table 6-1 lists the
Table 6-1. Minor function codes for IRP_MJ_PNP. (* indicates handled only by bus drivers.)
| IRP Minor Function Code | Description |
|---|---|
| IRP_MN_START_DEVICE | Configures and initializes device |
| IRP_MN_QUERY_REMOVE_DEVICE | Can device be removed safely? |
| IRP_MN_REMOVE_DEVICE |
Shuts down and
|
| IRP_MN_CANCEL_REMOVE_DEVICE | Ignores previous QUERY_REMOVE |
| IRP_MN_STOP_DEVICE | Shuts down device |
| IRP_MN_QUERY_STOP_DEVICE | Can device be shut down safely? |
| IRP_MN_CANCEL_STOP_DEVICE | Ignores previous QUERY_STOP |
| IRP_MN_QUERY_DEVICE_RELATIONS |
Gets list of devices which are
|
| IRP_MN_QUERY_INTERFACE | Obtains direct-call function addresses |
| IRP_MN_QUERY_CAPABILITIES | Determines capabilities of device |
| IRP_MN_QUERY_RESOURCES* | Determines boot configuration |
| IRP_MN_QUERY_RESOURCE_REQUIREMENTS* | Determines I/O resource requirements |
| IRP_MN_QUERY_DEVICE_TEXT* | Obtains description or location string |
| IRP_MN_FILTER_RESOURCE_REQUIREMENTS | Modifies I/O resource requirements list |
| IRP_MN_READ_CONFIG* | Reads configuration space |
| IRP_MN_WRITE_CONFIG* | Writes configuration space |
| IRP_MN_EJECT* | Ejects the device |
| IRP_MN_SET_LOCK* | Locks/unlocks device against ejection |
| IRP_MN_QUERY_ID* | Determines hardware ID of device |
| IRP_MN_QUERY_PNP_DEVICE_STATE | Determines state of device |
| IRP_MN_QUERY_BUS_INFORMATION* | Determines parent bus type |
| IRP_MN_DEVICE_USAGE_NOTIFICATION | Notes creation or deletion of paging, dump, or hibernate file |
| IRP_MN_SURPRISE_REMOVAL | Notes fact that device has been removed |
A second and more complicated purpose of PnP requests is to guide the driver through a series of state transitions, as
Figure 6-1. State diagram for a device.
When I described the standard model for IRP processing in the previous chapter, I indicated that Plug and Play would impose additional requirements on IRP queuing and cancellation. I'll describe a DEVQUEUE object in this chapter that satisfies those requirements and helps you manage the state transitions.

The Windows 2000 Device Driver Book: A Guide for Programmers (2nd Edition)

Windows System Programming (4th Edition) (Addison-Wesley Microsoft Technology Series)

Developing Drivers with the Windows Driver Foundation (Pro Developer)

Windowsu00ae Internals: Including Windows Server 2008 and Windows Vista, Fifth Edition (Pro Developer)