阅读:2395回复:1
手动在设备堆栈中插入过滤设备对象,还要注意什么吗,请看代码PDEVICE_OBJECT IoInsertDeviceToDeviceStack( IN PDEVICE_OBJECT SourceDevice, IN PDEVICE_OBJECT TargetDevice ) { PDEVICE_OBJECT DeviceObject= TargetDevice->AttachedDevice; SourceDevice->AttachedDevice = TargetDevice-> AttachedDevice; // ((PEXTENDED_DEVOBJ_EXTENSION) (SourceDevice-> DeviceObjectExtension)) ->AttachedTo= TargetDevice; //SourceDevice-> DeviceObjectExtension -> AttachedTo= TargetDevice; SourceDevice-> StackSize= TargetDevice->StackSize +1; SourceDevice-> AlignmentRequirement= TargetDevice-> AlignmentRequirement; TargetDevice->AttachedDevice = SourceDevice; //调整 ((PEXTENDED_DEVOBJ_EXTENSION) (DeviceObject-> DeviceObjectExtension)) ->AttachedTo = SourceDevice; while(DeviceObject->AttachedDevice) { DeviceObject->StackSize ++; DeviceObject = DeviceObject->AttachedDevice; } DeviceObject->StackSize ++; return TargetDevice; } 以上这段代码执行后,用devicetree观察可以发现设备对象插入到设备堆栈,但是为什么截获不到irp呢?还要做什么工作,也就是说IoAttachDeviceToDeviceStack这个函数除了调整 StackSize ,AttachedTo 和 AttachedDevice 指针外 另外做了什么格外的工作呢? |
|
沙发#
发布于:2010-07-02 00:18
这个时候插入太晚了,过滤驱动在发送至下层堆栈的时候都是从自己保持的设备扩展里取出目的地的。
|
|