驱动对象DRIVER_OBJECT
+ -

驱动对象DRIVER_OBJECT结构体定义

2023-09-15 18 0

DRIVER_OBJECT结构体在Windows内核中代表着一个驱动对象。
WDK中其结构体定义如下:

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_STRING DriverName;

    //
    // The following section is for registry support.  This is a pointer
    // to the path to the hardware information in the registry
    //

    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.
    //

    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.
    //

    PDRIVER_INITIALIZE DriverInit;
    PDRIVER_STARTIO DriverStartIo;
    PDRIVER_UNLOAD DriverUnload;
    PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION + 1];

} DRIVER_OBJECT;
typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT;

0 篇笔记 写笔记

驱动入口与驱动对象
驱动开发程序员所编写的驱动程序对应有一个结构。这个结构名为DRIVER_OBJECT。对应一个“驱动程序”。下面的代码展示的是一个最简单的驱动程序。 #include NTSTATUS DriverEntry ( ......
WDM 驱动中创建的设备链表
一个驱动加载后,可以根据需要创建多个设备,这些设备会以链表的形式连接起来,并且第一个设备的指针存放在DRIVER_OJECT的DeviceObject成员中。后续的设备会依次按DEVICE_OJBECT的NextDevice进行链表连接,直到最后一个为NULL.3: kd> dt _DEVI......
驱动入口函数DriverEntry
DriverEntry是Windows内核驱动的入口函数,其函数原型如下:NTSTATUS DriverEntry(__in PDRIVER_OBJECT drvobj, __in PUNICODE_STRING RegistryPath);其包括两个参数,一个为该驱动的对象结构体指针,另一个是......
驱动对象DRIVER_OBJECT结构体定义
DRIVER_OBJECT结构体在Windows内核中代表着一个驱动对象。WDK中其结构体定义如下:typedef struct _DRIVER_OBJECT { CSHORT Type; CSHORT Size; // // The following link......
驱动对象成员之DRIVER_EXTENSION DriverExtension
驱动对象DRIVER_OBJECT有一成员变量DriverExtension,其用于保存驱动对象的扩展数据。这和设备对象DEVICE_OBJECT的DeviceExtension的含义一致,但又有所不同。typedef struct _DRIVER_OBJECT {... PDRIVER......
作者信息
我爱内核
Windows驱动开发,网站开发
好好学习,天天向上。
取消
感谢您的支持,我会继续努力的!
扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

您的支持,是我们前进的动力!