您的位置:首页 > 移动开发 > Objective-C

DeviceExtenson和DeviceObjectExtension关系猜测

2011-06-17 14:28 393 查看
用WinDbg顺便看了下_DEVICE_OBJECT结构,看到了之前疑惑的2个结构:

kd> dt _device_object 0x821899c8

nt!_DEVICE_OBJECT

+0x000 Type : 0n3

+0x002 Size : 0xd0

+0x004 ReferenceCount : 0n0

+0x008 DriverObject : 0x82339f38 _DRIVER_OBJECT

+0x00c NextDevice : (null)

+0x010 AttachedDevice : (null)

+0x014 CurrentIrp : (null)

+0x018 Timer : (null)

+0x01c Flags : 0x2044

+0x020 Characteristics : 0

+0x024 Vpb : (null)

+0x028 DeviceExtension : 0x82189a80 Void

+0x02c DeviceType : 0x22

+0x030 StackSize : 2 ''

+0x034 Queue : __unnamed

+0x05c AlignmentRequirement : 0

+0x060 DeviceQueue : _KDEVICE_QUEUE

+0x074 Dpc : _KDPC

+0x094 ActiveThreadCount : 0

+0x098 SecurityDescriptor : 0xe1333cf0 Void

+0x09c DeviceLock : _KEVENT

+0x0ac SectorSize : 0

+0x0ae Spare1 : 0

+0x0b0 DeviceObjectExtension : 0x82189a98 _DEVOBJ_EXTENSION

+0x0b4 Reserved : (null)

自己注册的DEVICE_EXTENSION结构如下,IoCreateDevice函数的第2个参数DeviceExtensionSize就是这个结构的大小,我的定义如下:

typedef struct _DEVICE_EXTENSION

{

PDEVICE_OBJECT fdo;

PDEVICE_OBJECT NextStackDevice;

UNICODE_STRING ustrDeviceName; // 设备名

UNICODE_STRING ustrSymLinkName; // 符号链接名

} DEVICE_EXTENSION, *PDEVICE_EXTENSION;

占用了0x18 bytes

结合上面WinDbg打印数据看,应该是DeviceObjectExtension直接跟在DeviceExtension后面,统一存在一块内存中组成完整的一块设备扩展。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: