1. 提供各個driver的entry point
Supply entry points for the driver's standard routines.
The driver stores entry points for many of its standard routines in the driver object or driver extension. Such entry points include those for the driver's AddDevice routine, dispatch routines, StartIo routine, and Unload routine. For example, a driver would set the entry points for its AddDevice, DispatchPnP, and DispatchPower routines with statements like the following (Xxx is a placeholder for a vendor-supplied prefix identifying the driver):
:
DriverObject->DriverExtension->AddDevice = XxxAddDevice;
DriverObject->MajorFunction[IRP_MJ_PNP] = XxxDispatchPnp;
DriverObject->MajorFunction[IRP_MJ_POWER] = XxxDispatchPower;
:
Additional standard routines, such as ISRs or IoCompletion routines, are specified by calling system support routines. For more information, see the descriptions of individual standard driver routines.
2. 建立或者初始化driver所使用到的物件、資源
Create and/or initialize various driver-wide objects, types, or resources the driver uses. Note that most standard routines use objects on a per-device basis, so drivers should set up such objects in their AddDevice routines or after receiving an IRP_MN_START_DEVICE request.
If the driver has a device-dedicated thread or waits on any kernel-defined dispatcher objects, the DriverEntry routine might initialize kernel dispatcher objects. (Depending on how the driver uses the object(s), it might instead perform this task in its AddDevice routine or after receiving an IRP_MN_START_DEVICE request.)
3. 釋放資源及記憶體
Free any memory that it allocated and is no longer required.
4. 傳回NASTATUS
Return NTSTATUS indicating whether the driver successfully loaded and can accept and process requests from the PnP manager to configure, add, and start its devices. (See DriverEntry Return Values.)
- Jan 28 Mon 2008 17:06
DriverEntry's Required Responsibilities
close
全站熱搜
留言列表
發表留言