Battery miniclass driver: DriverEntry routine
The DriverEntry routine initializes the miniclass driver.
Driver-specific entry points
The miniclass driver's DriverEntry routine sets up the following driver-specific entry points:
- The Unload routine in DriverObject->DriverUnload
- The driver's AddDevice routine in DriverObject->DriverExtension->AddDevice
- The DRIVER_DISPATCH callback function in DriverObject->MajorFunction[IRP_MJ_POWER]
- The DRIVER_DISPATCH callback function in DriverObject->MajorFunction[IRP_MJ_PNP]
- The DRIVER_DISPATCH callback function in DriverObject->MajorFunction[IRP_MJ_CREATE]
- The DRIVER_DISPATCH callback function in DriverObject->MajorFunction[IRP_MJ_CLOSE]
- The DRIVER_DISPATCH callback function in DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL]
- The DRIVER_DISPATCH callback function in DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL].
Here's a sample code that initializes these entry points for a hypothetical NewBatt miniclass driver:
DriverObject->DriverUnload = NewBattUnload;
DriverObject->DriverExtension->AddDevice = NewBattAddDevice;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = NewBattDispatchDeviceControl;
DriverObject->MajorFunction[IRP_MJ_CREATE] = NewBattDispatchCreate;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = NewBattDispatchClose;
DriverObject->MajorFunction[IRP_MJ_PNP] = NewBattDispatchPnp;
DriverObject->MajorFunction[IRP_MJ_POWER] = NewBattDispatchPower;
DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = NewBattSystemControl;
Since battery-specific state information is unknown until the PnP Manager calls the miniclass driver's AddDevice routine, the DriverEntry routine doesn't initialize any such state. Device-specific initialization is performed in the AddDevice routine.
Additional routine-specific requirements
For more information on routine-specific requirements, see the following topics: