概述
驱动对象(DRIVER_OBJECT)
每个驱动程序会有唯一一个驱动对象与之对应,并且该驱动对象是在驱动加载时被内核中的对象管理程序
创建的。
typedef struct _DRIVER_OBJECT {
CSHORT Type;
CSHORT Size;
//
// The following links all of the devices created by a single driver
// together on a list, and the Flags word provides an extensible flag
// location for driver objects.
//一个指向设备对象的指针
//设备对象可能为一个或者多个,所以指向设备对象的第一个指针,也是指向这个设别链的指针
//
PDEVICE_OBJECT DeviceObject;
ULONG Flags;
//
// The following section describes where the driver is loaded. The count
// field is used to count the number of times the driver has had its
// registered reinitialization routine invoked.
//
//
PVOID DriverStart;
ULONG DriverSize;
PVOID DriverSection;
PDRIVER_EXTENSION DriverExtension;
//
// The driver name field is used by the error log thread
// determine the name of the driver that an I/O request is/was bound.
//记录程序的名字,用UNICODE字符串记录
//一般形式Driver[驱动程序名称]
//
UNICODE_STRING DriverName;
//
// The following section is for registry support. Thise is a pointer
// to the path to the hardware information in the registry
//记录设备的硬件数据库键名 也是用UNICODE字符串记录
//一般形式:REGISTRYMACHINEHARDWAREDESCRIPTIONSYSTEM
PUNICODE_STRING HardwareDatabase;
//
// The following section contains the optional pointer to an array of
// alternate entry points to a driver for "fast I/O" support. Fast I/O
// is performed by invoking the driver routine directly with separate
// parameters, rather than using the standard IRP call mechanism. Note
// that these functions may only be used for synchronous I/O, and when
// the file is cached.
//文件驱动的派遣函数,指向这个驱动程序的FastIO入口点定义的一个结构。这个成员只能通过FSDs和网络传输驱动来使用
PFAST_IO_DISPATCH FastIoDispatch;
//
// The following section describes the entry points to this particular
// driver. Note that the major function dispatch table must be the last
// field in the object so that it remains extensible.
//指向DriverEntry函数的,这是通过IO管理器来建立的
PDRIVER_INITIALIZE DriverInit;
//记录StartIO例程的函数地址用于串行化操作,如果一个驱动程序没有StartIo函数,这个成员将是NULL
PDRIVER_STARTIO DriverStartIo;
//制定驱动卸载时所用的回调函数地址
PDRIVER_UNLOAD DriverUnload;
//指向驱动程序的DispatchXXX函数指针的数组。每个驱动程序至少要设置一个DispatchXXX函数指
//针在这个数组里来处理这个驱动程序IRP请求包。任何一个驱动程序可以设置和IRP_MJ_XXX代码一
//样多的DispatchXXX来处理IRP请求包.每个DispatchXXX结构如下:
//NTSTATUS DispatchXXX(IN PDEVICE_OBJECT DeviceObjec, IN PIRP Irp);
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
} DRIVER_OBJECT;
typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT;
每个驱动程序会有唯一一个驱动对象与之对应,并且该驱动对象是在驱动加载时被内核中的对象管理程序
创建的。
typedef struct _DRIVER_OBJECT {
CSHORT Type;
CSHORT Size;
//
// The following links all of the devices created by a single driver
// together on a list, and the Flags word provides an extensible flag
// location for driver objects.
//一个指向设备对象的指针
//设备对象可能为一个或者多个,所以指向设备对象的第一个指针,也是指向这个设别链的指针
//
PDEVICE_OBJECT DeviceObject;
ULONG Flags;
//
// The following section describes where the driver is loaded. The count
// field is used to count the number of times the driver has had its
// registered reinitialization routine invoked.
//
//
PVOID DriverStart;
ULONG DriverSize;
PVOID DriverSection;
PDRIVER_EXTENSION DriverExtension;
//
// The driver name field is used by the error log thread
// determine the name of the driver that an I/O request is/was bound.
//记录程序的名字,用UNICODE字符串记录
//一般形式Driver[驱动程序名称]
//
UNICODE_STRING DriverName;
//
// The following section is for registry support. Thise is a pointer
// to the path to the hardware information in the registry
//记录设备的硬件数据库键名 也是用UNICODE字符串记录
//一般形式:REGISTRYMACHINEHARDWAREDESCRIPTIONSYSTEM
PUNICODE_STRING HardwareDatabase;
//
// The following section contains the optional pointer to an array of
// alternate entry points to a driver for "fast I/O" support. Fast I/O
// is performed by invoking the driver routine directly with separate
// parameters, rather than using the standard IRP call mechanism. Note
// that these functions may only be used for synchronous I/O, and when
// the file is cached.
//文件驱动的派遣函数,指向这个驱动程序的FastIO入口点定义的一个结构。这个成员只能通过FSDs和网络传输驱动来使用
PFAST_IO_DISPATCH FastIoDispatch;
//
// The following section describes the entry points to this particular
// driver. Note that the major function dispatch table must be the last
// field in the object so that it remains extensible.
//指向DriverEntry函数的,这是通过IO管理器来建立的
PDRIVER_INITIALIZE DriverInit;
//记录StartIO例程的函数地址用于串行化操作,如果一个驱动程序没有StartIo函数,这个成员将是NULL
PDRIVER_STARTIO DriverStartIo;
//制定驱动卸载时所用的回调函数地址
PDRIVER_UNLOAD DriverUnload;
//指向驱动程序的DispatchXXX函数指针的数组。每个驱动程序至少要设置一个DispatchXXX函数指
//针在这个数组里来处理这个驱动程序IRP请求包。任何一个驱动程序可以设置和IRP_MJ_XXX代码一
//样多的DispatchXXX来处理IRP请求包.每个DispatchXXX结构如下:
//NTSTATUS DispatchXXX(IN PDEVICE_OBJECT DeviceObjec, IN PIRP Irp);
PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];
} DRIVER_OBJECT;
typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/518171/viewspace-711629/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/518171/viewspace-711629/
最后
以上就是甜甜钢铁侠为你收集整理的驱动对象(DRIVER_OBJECT)的全部内容,希望文章能够帮你解决驱动对象(DRIVER_OBJECT)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复