While not clear in the WDK documentation, there are two types of PnP IRPs: state changing and non-state changing. Does this distinction matter? Absolutely. State changing PnP IRPs have a contract associated with them while non-state changing IRPs have no contract whatsoever. Before I get into the gory details, I want to list the members of each type
IRP_MN_QUERY_DEVICE_RELATIONS (0x07), or QDR, is notably missing from my list. Why? Because the QDR IRP's contract depends on the DEVICE_RELATION_TYPE specifiedin the query. Note that PowerRelations is not currently implemented by any released OS and that SingleBusRelations is undocumented, so they are unqualified.
So what does it mean to be a state changing PnP IRP? It means that...
A very good hint as to if the PnP IRP is state changing or not is if a driver may send the IRP. If a driver is allowed to send the IRP, then it is deifnitively not a state changing power IRP. This is why IRP_MN_QUERY_CAPABILITIES is a non state changing IRP and IRP_MN_QUERY_DEVICE_STATE is. The former can be sent by any driver at any time, the later is sent to the device stack by the manager (either by its own decision or someone called IoInvalidateDeviceState with the stack's PDO).