The following figure shows the software components involved in installing a device.
The shaded boxes in the figure represent components that can be provided by independent hardware vendors (IHV) and original equipment manufacturers (OEM). The other device installation components are supplied by Microsoft.
The following list describes the roles that the various components play in device installation:
- Kernel-Mode PnP Manager
- The kernel-mode PnP Manager notifies the user-mode PnP Manager that a new device is present on the system and needs to be installed. The kernel-mode PnP Manager also calls the DriverEntry and AddDevice routines of a device's drivers and sends the IRP_MN_START_DEVICE request to start the device.
The PnP Manager has two parts: one runs in user-mode and the other runs in kernel mode. The kernel-mode PnP Manager reports PnP events to the user-mode PnP Manager, and the user-mode PnP Manager sends control requests to the kernel-mode PnP Manager.
- Drivers
- PnP drivers perform device-installation operations as directed by the PnP Manager. For example:
PnP drivers can also detect non-PnP devices and report them to the PnP Manager using IoReportDetectedDevice.
- User-Mode PnP Manager
- The user-mode PnP Manager receives device installation requests from the kernel-mode PnP Manager, calls other user-mode Setup components to initiate device-installation tasks, and sends control requests (such as "start the device") to the kernel-mode PnP Manager.
The user-mode PnP Manager and the kernel-mode PnP Manager together maintain the device tree.
The user-mode PnP Manager tries to install a device in a trusted process context without requiring user responses to dialog boxes (a server-side installation). This automatic installation provides a better user experience. If the PnP Manager is unable to complete a trusted installation because, for example, an installer supplies custom Finish pages, the PnP Manager terminates the trusted installation. In this case, when a user with administrative privileges logs in, the PnP Manager restarts the device installation by launching the Found New Hardware wizard in the New Device DLL (a client-side installation).
- Setup API
- The Setup API includes the general Setup functions (SetupXxx) and the device installation functions (SetupDiXxx). These functions perform many device installation tasks such as searching for INF files, building a potential list of drivers for a device, copying driver files, writing information to the registry, registering device co-installers, and so forth. Most other Setup components call these functions.
The SetupDiXxx functions are also sometimes referred to as the device installer. This term can be confusing, however, because more than one component is involved in installing a device.
For more information, see General Setup Functions and Device Installation Functions.
- CfgMgr API
- The Configuration Manager API provides basic installation and configuration operations that are not provided by Setup API. The Configuration Manager Functions perform low-level tasks such as getting the status of a devnode and managing resource descriptors. These functions are primarily called by Setup API but can also be called by other Setup components.
- Co-installers and Class Installers
- A class installer performs installation operations that apply to devices in a particular device setup class. For example, the ports class installer is responsible for assigning a COM port name to a device in the ports setup class. If the devices in a particular setup class do not require any special installation operations, a class installer is not required for that setup class.
Microsoft provides class installers for most of the system-defined device setup classes. For more information, see Writing a Class Installer. IHVs and OEMs can provide class installers, but they typically provide co-installers.
A co-installer performs installation operations that are specific to a particular device or to a setup class of devices. For more information, see Writing a Co-installer.
- INF Files and Catalog files
- INF files and catalog files provide information about devices and drivers to be installed. For more information, see Creating an INF File.
- Device Manager
- The Device Manager allows a user to view and manage the devices on a system. For example, a user can view device status and set device properties. If a user requests to update a driver, the Device Manager calls the Hardware Update wizard in the New Device DLL.
For more information, see Using the Device Manager. Also see the Device Manager's online help.
- Add Hardware Wizard
- The Add Hardware Wizard allows a user to add, remove, unplug, and troubleshoot devices.
- New Device DLL
- The New Device DLL contains the Found New Hardware wizard, the Hardware Update wizard, and the UpdateDriverForPlugAndPlayDevices function.
The user-mode PnP Manager calls the Found New Hardware wizard to initiate a client-side installation of a new device in the context of a user with the appropriate privileges. The Device Manager calls the Hardware Update wizard when a user clicks the Update Driver button on a device's Driver property page. The Found New Hardware and Hardware Update wizards call Setup APIs and Configuration Manager APIs to accomplish their tasks.
- Custom Device Installation Application
- An IHV or OEM can provide a custom device installation application. For more information, see Writing a Device Installation Application.