Run-Time Dynamic Device Loading

Plug and Play permits devices to be loaded dynamically after the system is already running. The following list shows how this process occurs:

1. An enumerator detects the addition of a device to the system and calls Configuration Manger to reenumerate its own device node, using CONFIGMG_Reenumerate_DevNode as follows:


CM_Reenumerate_DevNode(DevNode, 0);

2 CONFIGMG_Reenumerate_DevNode causes Configuration Manager to call back the enumerator at application time. When called back, the enumerator detects the new hardware and constructs a device ID (for example, PCMCIA\3C08AF\0). The enumerator creates a new child device node with this ID and returns from the enumeration function.

3 Configuration Manager uses the device ID to determine which key in the registry to inspect. In this example, Configuration Manager will look in HARDWARE\ENUM\PCMCIA\3C08AF\0\DRV\, where it will find DEVLOADER=NetWrap.386. If this VxD is not already loaded, Configuration Manager dynamically loads NetWrap.386.

4 Once the device loader is available, Configuration Manager sends a system control call to the network wrapper, passing it the device node for which it is the device loader, as follows:


DirectedSysCtrl("NetWrap", PNP_NEW_DEVNODE, DEVLOADER, pdnNew)

5 NetWrap registers as the enumerator for this node, and then examines the registry to find the appropriate NDIS driver to load. In our example, NetWrap would find


SYSTEM\CurrentControlSet\Services\Class\PCMCIA
< NdisDriver=XYZ.VXD

6 Once loaded, XYZ.VXD registers as the device driver for the device node, forcing Configuration Manager to assign resources to it. Configuration Manager informs the NDIS driver of the assigned configuration, thus enabling the network adapter.