Share via


Port Plug and Play Event Notification Handling to NDIS 6.0 (Compact 2013)

3/26/2014

In NDIS 6.0, the MiniportDevicePnPEventNotify function replaces the NDIS 5.xMiniportPnPEventNotify function.

The following table shows which API elements have been renamed and/or changed for NDIS 6.0.

NDIS 5.x

NDIS 6.0

MiniportPnPEventNotify

MiniportDevicePnPEventNotify

To port Plug and Play event notification handling to NDIS 6.0

  1. If you are porting miniport driver code that supports a MiniportPnPEventNotify function, remove the MiniportPnPEventNotify function.

  2. Implement MiniportDevicePnPEventNotify to handle Plug and Play event notifications. Note that MiniportDevicePnPEventNotify does not support the InformationBuffer and InformationBufferLength parameters of MinportPnPEventNotify.

In Windows Embedded Compact, you typically use Plug and Play event notifications to handle situations in which your network adapter has been removed or plugged in. The following code example shows how to implement a simple Plug and Play event handler that processes the notification for the removal of a device.

Important

For readability, the following code example does not contain security checking or error handling. Do not use the following code in a production environment.

VOID MyMiniportDevicePnPEventNotify
(
    IN NDIS_HANDLE            MiniportAdapterContext,
    IN PNET_DEVICE_PNP_EVENT  NetDevicePnPEvent
)
{
    NDIS_DEVICE_PNP_EVENT DevicePnPEvent = NetDevicePnPEvent->DevicePnPEvent;
    PVOID InformationBuffer = NetDevicePnPEvent->InformationBuffer;
    ULONG InformationBufferLength = NetDevicePnPEvent->InformationBufferLength;

    // Process the PnP event:
    switch (DevicePnPEvent)
    {
        case NdisDevicePnPEventSurpriseRemoved:
            // Handle surprise removal of device
            . . .
            break;
        default:
            // Handle or log other PnP events:
            . . .
            break;
    }
}

See Also

Concepts

Migrate Miniport Driver Functionality to NDIS 6.0