The DriverEntry routine of an NT device driver should initialize in the following stages:
Otherwise, free any objects and system resources it allocated, including the memory it used to hold configuration information, and return an appropriate NTSTATUS error.
Every NT device driver must call IoAssignResources, IoReportResourceUsage, or HalAssignSlotResources and attempt to claim the bus-relative hardware resources for a device before the driver attempts to initialize that device. If there is no conflicting claim on the given hardware resources, the driver’s claims are written in the \Registry\Machine\Hardware\ResourceMap tree.
Claiming hardware resources in the registry prevents resource conflicts between NT drivers and between devices in the machine. In other words, a successful claim on a set of hardware resources prevents a subsequently loaded driver from “stealing” an already loaded driver’s hardware resources and from resetting that driver’s already initialized device.