设备对象(DEVICE_OBJECT)

设备对象(DEVICE_OBJECT)

typedef struct DECLSPEC_ALIGN(MEMORY_ALLOCATION_ALIGNMENT) _DEVICE_OBJECT {

    CSHORT Type;

    USHORT Size;

    LONG ReferenceCount;

    struct _DRIVER_OBJECT *DriverObject;//指向驱动程序的驱动对象,同属一个驱动程序的驱动对象是指向的是统一的驱动对象

    struct _DEVICE_OBJECT *NextDevice;//指向下一个设备对象,同属于同一个驱动对象的设备

    struct _DEVICE_OBJECT *AttachedDevice;//指向下一个设备对象,指的是如果有更高一层的驱动附加到这个驱动,AttachedDevice指向更高一层的驱动。

    struct _IRP *CurrentIrp;//使用StartIO例程,此域指向当前IRP对象

    PIO_TIMER Timer;

    ULONG Flags;                                // See above:  DO_...

    ULONG Characteristics;                      // See ntioapi:  FILE_...

    __volatile PVPB Vpb;

    PVOID DeviceExtension;//指向设备扩展对象,每个设备都会指定一个设备扩展对象,设备扩展对象是
                          //设备自己特殊定义的结构体,由程序员自己定义,驱动程序中应避免全局变量
                          //的使用,因为全局变量涉及不易同步的问题。解决办法,将全局变量存在设备扩展里

    DEVICE_TYPE DeviceType;//指明设备的类型

    CCHAR StackSize;

    union {

        LIST_ENTRY ListEntry;

        WAIT_CONTEXT_BLOCK Wcb;

    } Queue;

    ULONG AlignmentRequirement;

    KDEVICE_QUEUE DeviceQueue;

    KDPC Dpc;

    //

    //  The following field is for exclusive use by the filesystem to keep

    //  track of the number of Fsp threads currently using the device

    //

    ULONG ActiveThreadCount;

    PSECURITY_DESCRIPTOR SecurityDescriptor;

    KEVENT DeviceLock;

    USHORT SectorSize;

    USHORT Spare1;

    struct _DEVOBJ_EXTENSION  *DeviceObjectExtension;

    PVOID  Reserved;

} DEVICE_OBJECT;

typedef struct _DEVICE_OBJECT *PDEVICE_OBJECT;


Flags
DO_BUFFERED_IO                                             读写操作使用缓冲方式(系统复制缓冲区)访问用户模式数据
DO_EXCLUSIVE                                                一次只允许一个线程打开设备句柄
DO_DIRECT_IO                                                 读写操作使用直接方式(内存描述符表)访问用户模式数据
DO_BUS_ENUMERATED_DEVICE                         Bus drivers set this flag in the PDO of each device they enumerate. This flag pertains only to the PDO; it must not be set in an FDO or filter DO. Therefore, higher-level drivers layered over a bus driver must not propagate this value up the device stack.
DO_DEVICE_INITIALIZING                             设备对象正在初始化
DO_POWER_INRUSH                                         Drivers of devices that require inrush current when powering on must set this flag. A driver cannot set both this flag and DO_POWER_PAGABLE.
DO_POWER_PAGABLE                                      Windows? 2000 and later drivers that are pageable, are not part of the paging path, and do not require inrush current must set this flag. The system calls such drivers at IRQL PASSIVE_LEVEL. Drivers cannot set both this flag and DO_POWER_INRUSH.
                                    All WDM, Windows 98, and Windows Me drivers must set DO_POWER_PAGABLE.  
DO_VERIFY_VOLUME                                         Removable-media drivers set this flag while processing transfer requests. Such drivers should also check for this flag in the target for a transfer request before transferring any data. See the Supporting Removable Media for details

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值