共用方式為


MiniportDevicePnPEventNotify (Compact 2013)

3/26/2014

NDIS calls a miniport driver's MiniportDevicePnPEventNotify function to notify the driver of Plug and Play (PnP) events.

Syntax

VOID MiniportDevicePnPEventNotify(
    NDIS_HANDLE MiniportAdapterContext,
    PNET_DEVICE_PNP_EVENT NetDevicePnPEvent
); 

Parameters

  • MiniportAdapterContext
    [in] A handle to a context area that the miniport driver allocated in its MiniportInitializeEx function. The miniport driver uses this context area to maintain state information for an miniport adapter.
  • NetDevicePnPEvent
    [in] A pointer to a NET_DEVICE_PNP_EVENT structure that describes a device Plug and Play event.

Return Value

None.

Remarks

A driver specifies the MiniportDevicePnPEventNotify entry point when it calls the NdisMRegisterMiniportDriver function.

NDIS calls the driver's MiniportDevicePnPEventNotify function by using the DevicePnPEvent member of the NetDevicePnPEvent parameter set to NdisDevicePnPEventPowerProfileChanged after one of the following events:

  • Driver initialization is complete.
  • The driver received an OID_PNP_SET_POWER notification that specifies the powered-on state (NdisDeviceStateD0).

In the second case, the value at InformationBuffer indicates whether the system is running on battery power (NdisPowerProfileBattery) or AC power (NdisPowerProfileAcOnline). A driver can use this information to adjust the power consumption of the specified miniport adapter. For example, the driver for a wireless LAN device could reduce power consumption if the system is running on battery power or increase power consumption if the system is running on AC power.

When a driver receives a surprise removal notification (the DevicePnPEvent member of the NetDevicePnPEvent parameter is NdisDevicePnPEventSurpriseRemoved), it should:

  • Note internally that the device has been removed.
  • Cancel any pending IRPs that it sent down to the underlying bus driver.

After NDIS calls the MiniportDevicePnPEventNotify function to indicate a surprise removal, NDIS calls the driver's MiniportHaltEx function. If the driver receives any send requests or OID requests before NDIS calls MiniportHaltEx, it should immediately complete such requests with a status value of NDIS_STATUS_NOT_ACCEPTED.

NDIS calls MiniportDevicePnPEventNotify at IRQL = PASSIVE_LEVEL.

See Also

Reference

NDIS Miniport Driver Functions
MiniportHaltEx
MiniportInitializeEx
NdisMRegisterMiniportDriver
NET_DEVICE_PNP_EVENT
OID_PNP_SET_POWER