Click to Rate and Give Feedback
MSDN
MSDN Library
Windows Driver Kit
Reference
Kernel Data Types
Kernel Structures
 PNP_DEVICE_STATE
Windows Driver Kit: Kernel-Mode Driver Architecture
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 request.

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 is when the computer starts. Such a 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 request.

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 root-enumerated 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.

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.

Requirements

Headers: Defined in Wdm.h. Include Wdm.h, Ntddk.h, or Ntifs.h.

See Also

IoInvalidateDeviceState, IRP_MN_QUERY_PNP_DEVICE_STATE

APIScan Requirements

Header: Wdm.h, Ntddk.h, Ntifs.h
Function: PNP_DEVICE_STATE
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker