Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

To create a device driver that recognizes the power states of a target device, you must first create a driver that advertises a non-COM-related device interface. This non-COM-related device interface, in turn, specifies that the device is power-managed.

You can advertise a device interface in the following ways:

  • Define the interface in the IClassvalue of the registry key used to activate the device.

  • Define the IClassvalue in the Activeregistry key, using the Initfunction of the device driver.

  • Define the IClassvalue, using the REGINI parameter of the ActivateDeviceExfunction.

  • Explicitly call the AdvertiseInterfacefunction in the device driver.

For additional information on advertising a non-COM-related interface for power management, see Device Interface Notifications.

You can register a device driver for power management notifications by calling the RequestPowerNotificationsfunction and passing a handle to a message queue created exclusively for power management notifications. Do this only if your driver must respond to a power notification and can afford to incur the associated overhead. Typically, once a driver has been advertised as a power-aware driver, the driver need only process DeviceIoControlcalls from Power Manager.

Power Manager communicates to a device with I/O control codes. The following table shows the I/O control codes that Power Manager uses.

Function Description

IOCTL_POWER_CAPABILITIES

Requests that the device inform Power Manager of supported power states, along with any associated characteristics.

IOCTL_POWER_SET

Requests that the device update the power state information.

IOCTL_POWER_QUERY

Checks whether the device is ready to enter a new device power state.

IOCTL_POWER_GET

Requests that the device inform Power Manager of the current device power state.

IOCTL_REGISTER_POWER_RELATIONSHIP

Notifies the parent device to register all controlled devices.

You can implement and use the optional IOCTL_POWER_QUERYcontrol code to delay power state transitions until a driver has completed preparation for a change in power state. Do this by modifying the MDD layer to support IOCTL_POWER_QUERY, although this modification may make the MDD layer incompatible with future versions of Power Manager.

See Also