Previous Next

PNP_DEVICE_STATE

The PNP_DEVICE_STATE structure contains a bitmask of flags that describe the PnP state of a device. Drivers return this structure in response to an IRP_MN_QUERY_PNP_DEVICE_STATE IRP.

typedef ULONG PNP_DEVICE_STATE, *PPNP_DEVICE_STATE;

Flags

PNP_DEVICE_DISABLED
The device is physically present but is disabled in hardware.
PNP_DEVICE_DONT_DISPLAY_IN_UI
Don't display the device in the user interface. Set for a device that is physically present but not usable in the current configuration, such as a game port on a laptop that is not usable when the laptop is undocked. (Also see the NodisplayInUI flag in the DEVICE_CAPABILITIES structure.)
PNP_DEVICE_FAILED
The device is present but not functioning properly.

When both this flag and PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED are set, the device must be stopped before the PnP Manager assigns new hardware resources (nonstop rebalance is not supported for the device).

PNP_DEVICE_NOT_DISABLEABLE
The device must not be disabled.

A driver sets this bit for a device that is required for proper system operation. For example, if a driver receives notification that a device is in the paging path (IRP_MN_DEVICE_USAGE_NOTIFICATION for DeviceUsageTypePaging), the driver calls IoInvalidateDeviceState and sets this flag in the resulting IRP_MN_QUERY_PNP_DEVICE_STATE IRP.

If this bit is set for a device, the PnP Manager propagates this setting to the device's parent device, its parent's parent device, and so forth.

If this bit is set for a nonenumerable device, the device cannot be disabled or uninstalled.

PNP_DEVICE_REMOVED
The device has been physically removed.
PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED
The resource requirements for the device have changed.

Typically, a bus driver sets this flag when it has determined that it must expand its resource requirements in order to enumerate a new child device.

Headers

Defined in wdm.h and ntddk.h. Include wdm.h or ntddk.h.

Comments

The PnP Manager queries a device's PNP_DEVICE_STATE right after starting the device by sending an IRP_MN_QUERY_PNP_DEVICE_STATE request to the device stack. In response to this IRP, the drivers for the device set the appropriate flags in PNP_DEVICE_STATE.

If any of the state characteristics change after the initial query, a driver notifies the PnP Manager by calling IoInvalidateDeviceState. In response to a call to IoInvalidateDeviceState, the PnP Manager queries the device's PNP_DEVICE_STATE again.

If a device is marked PNP_DEVICE_NOT_DISABLEABLE, the debugger displays a DNUF_NOT_DISABLEABLE user flag for the devnode. The debugger also displays a DisableableDepends value that counts the number of reasons why the device cannot be disabled. This value is the sum of X+Y, where X is one if the device cannot be disabled and Y is the count of the device's child devices that cannot be disabled.

See Also

IoInvalidateDeviceState, IRP_MN_QUERY_PNP_DEVICE_STATE