Kernal-Mode Driver Reference
Standard Driver Routines

This section describes the required and optional routines that you must implement in your driver to respond to calls from Windows or other drivers. When these routines are called, you must write code that responds to the call and returns the appropriate data in a timely manner.

The following routines are required for drivers:

* DriverEntry 程式進入點
DriverEntry is the first routine called after a driver is loaded, and is responsible for initializing the driver.

* AddDevice 建立裝置
The AddDevice routine is responsible for creating functional device objects (FDO) or filter device objects (filter DO) for devices enumerated by the Plug and Play (PnP) manager.

* DispatchXxx (routines beginning with "Dispatch" such as DispatchCreate) 處理IRP
Processing any I/O request packet (IRP) begins in a dispatch routine that the driver supplies to handle an IRP major function code (IRP_MJ_Xxx). The driver's DriverEntry routine exports entry points for dispatch routines in a dispatch table within the driver's DRIVER_OBJECT structure.

A driver can provide a separate dispatch routine for each major I/O function code that it handles. Alternatively, dispatch routines can be written to
handle multiple I/O function codes.

* Unload 釋放資源
The Unload routine performs any operations that are necessary before the system unloads the driver.

The other routines in this section are optional but you may need to implement them depending on your driver type and location of your driver in the .

For more information about standard driver routines, see Introduction to Standard Driver Routines.
arrow
arrow
    全站熱搜

    Graffine 發表在 痞客邦 留言(0) 人氣()