How the system Finds and Loads Drivers
It has an electronic signature that bus driver can detect the new hardware
Initiate the detection by invoking Add New Hardware Wizard.
In the end, in both PnP and Legacy Device situation, system uses the same automatic registry and INF file process to load the right driver.
It understands the details about how to make the HW work.
It's responsible for initiating IO operations, for handling interrupts, and for providing a way for end user to exercise control over the device.
It's responsible for managing the connection between the Hardware and the computer.
is to Modify the behavior of an existing function driver in some way. Upper filter driver sees IRPs before function driver. Lower filter can modify the stream of bus operations that the function driver is trying to perform.
PDO stands for Physical Device Object. The bus driver uses it to represent the connection between the device and the bus.
FDO stands for Function Device Object. The function driver uses it to manage the functionality of the device.
Installing a PnP Device
- Bus driver detects the insertion or removal of hardware.
- Bus driver calls IoInvalidateDeviceRelations to notify PnP manager that the bus's population of child devices has changed.
- PnP manager sends IRP_MN_QUERY_DEVICE_RELATIONS to bus driver, to obtain an updated list of the PDOs for the child devices.
- PnP manager sends IRP_MN_QUERY_ID to bus driver, to obtain Device ID
- PnP manager locates INF install section and initialize driver. Memory Manager then calls DriverEntry routine.
- PnP manager calls AddDevice, to inform driver that a new instance of the device has been discovered
- PnP manager sends IRP_MN_QUERY_RESOURCE_REQUIREMENTS to bus driver, to ask bus driver report resource requirements.
- PnP manager configuire the hardware with as set of resource arbitrators to assign resources to the device.
- PnP manager sends IRP_MN_START_DEVICE to your driver (the driver stack). Function driver handles the IRP by configuring and connecting various kernel resources.
Order of AddDevice Calls (Driver Loading)
- 5. Class upper filters
- 4. Device upper filters
- 3. Function driver
- 2. Class lower filters
- 1. Device lower filters
System sends an IRP to the topmost filter dirver in the stack, that driver can decide to process the IRP, to pass the IRP down to the next level, or to do both. Each driver that sees the IRP makes the same decision.