Condividi tramite


PnP Device Installation

1. Plug the device into the computer.
2. The device is enumerated. the bus driver notifies the kernel-mode PnP manager that the list of devices on the bus has changed. The Kernel-mode PnP manager sends IRPs(IRP_MN_QUERY_ID, IRP_MN_QUERY_CAPABILITIES) to bus driver to gather information about the new device, such as HadwardID, CompatibleIDs and device capabilities.
3. The kernel_mode PnP manager notifies user-mode PnP manager that there is a device to be installed. The user-mode PnP manager tries to perform a server-side installation(quiet intallation)
4. The user-mode PnP manager creates a new process using rundll32.exe and launches newdev.dll to install the device.
5. newdev.dll calls SteupAPI(device installation functions) and CfgMgr API(PnP configuration manager functions) to carry out its installation tasks. If a device without "in box" drivers is plugged in before the operating system is installed, Device Manager will display the device as "unknown".
6. The class installer and co-installer, if any, can participate in the installation by handling DIF requests.
7. Setup transfers control to kernel mode to load drivers and start the device.
Once Setup has selected the best driver for the device, copied the appropriate driver files, registered any device-specific co-installers, and registered any device interfaces, it transfer control to kernel mode to load the drivers ans start the device.
8. The (Kernel mode?) PnP manager loads appropriate function driver and any optional filter drivers for the device. ...
a. The PnP manager calls DriverEntry routine for any required driver that is not yet loaded.
b. Then the PnP manager calls the AddDevice routine for earch driver, starting with lower-filter drivers, then the function driver, and, lastly, any upper filter driver.
c. The PnP manager assigns resources to the device, if required, and sends IRP_MN_START_DEVICE to the device's drivers.
9. Installer can change device settings or install application SW, in finish-install wizard pages( or finish-install actions in Vista above)

I suppose in step 7, Setup has done the  select-copy-register driver thing,  device manager could refresh automatically once. (deivice will display "Unknown" to a named device).
and then in step8, PnP manger to load driver in stack and start device, device manger could refresh automatically the 2nd time.