设备对象(DEVICE_OBJECT)
2012-05-23 12:59
417 查看
设备对象(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
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
相关文章推荐
- 设备对象(DEVICE_OBJECT)-----------------主要成员
- 设备对象(DEVICE_OBJECT)-----------------设备名称
- 设备对象(DEVICE_OBJECT)
- 设备对象(DEVICE_OBJECT)-----------------主要成员 .
- 设备对象DEVICE_OBJECT
- 设备对象(DEVICE_OBJECT)
- 设备对象(DEVICE_OBJECT)-----------------设备名称
- 设备对象(DEVICE_OBJECT)-----------------设备名称
- 设备对象(DEVICE_OBJECT)-----------------主要成员
- IoGetDeviceObjectPointer根据文件名称获取(打开)设备对象
- 设备对象(DEVICE_OBJECT)-----------------主要成员
- 设备对象(DEVICE_OBJECT)
- 设备对象(DEVICE_OBJECT)
- IoGetDeviceObjectPointer和ObReferenceObjectByName得到设备对象指针
- IoEnumerateDeviceObjectList 枚举驱动的所有设备 文件过滤驱动 windows内核开发
- 用device object viewer,查看系统中的硬件设备
- 0.driverbase-驱动对象、设备对象、DriverEntry、IoCreateDevice、符号链接、DriverUnLoad、WDM
- Direct3D11 Device(设备对象),Device Context(设备上下文)官方SDK翻译
- DEVICE_OBJECT ;struct _DEVICE_OBJECT *AttachedDevice; // 附载的设备,与AttachedTo域构成双链表关系
- 驱动开发学习笔记02:DEVICE_OBJECT对象数据结构