|
[求助]IoCopyCurrentIrpStackLocationToNext等的疑问
问题提的非常好,说明你思考问题很深入: 1,完成例程本来就是设置在当前堆栈的下一层堆栈里,这相当于是一个规范,也可以用实际的IRP的返回来理解。在完成例程里,根据返回不同的状态值,IRP的控制流可能会发生相应的变化,比如:...STATUS_MORE_PROCESSING,这样,下层堆栈执行完成例程后,会将IRP的控制权交付给本层堆栈。从这个意义上讲,完成例程,只能放在下层堆栈,实际上,设计也是这样的。 2,拷贝当前堆栈的内容到下层堆栈,只是为了保证执行环境一样。 在一个设备栈中,高层设备只能访问自己的设备栈或者下层设备栈,这就要求这个驱动必须要为下层设置IO堆栈,但不是必须的。每个堆栈中,context字段的值是唯一的,会标识一些pending等状态位,表示不同的完成状态,所以这个字段不可以随意复制。 |
|
[求助]Attach 卷设备后出现IRP混乱的问题 求助
修改以后,就不会出现蓝屏了 |
|
[求助]Attach 卷设备后出现IRP混乱的问题 求助
你完成IRP的时候出现问题。 在你的FileSystemPassThrough例程里,原来的代码,不管怎样,你都返回STATUS_SUCCESS,这样IO管理器就帮你把这个IRP释放掉了;而事实上,一些IRP,调用IoCallDdriver后,返回的是pending或其他状态,你一味的返回STATUS_SUCCESS只会使IO管理器提前释放掉该IRP;最后,NT完成该IRP时,再次释放时,就蓝屏了。 虽然是个小问题,但是也反映了你对IRP的生命周期不熟悉。 修改后的代码如下: NTSTATUS FileSystemPassThrough(IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp) { NTSTATUS Status=STATUS_SUCCESS; IoSkipCurrentIrpStackLocation(Irp); Status = IoCallDriver(((PFileSystemFilterEx)DeviceObject->DeviceExtension)->nextDeviceObject,Irp); return Status; } 至于为什么会定位到这个函数,而不是FileSystemFilterCtrl下的IRP_MN_USER_FS_REQUEST请求,主要看蓝屏时的提示,简要贴个分析过程: 从出错IRP->定位到CurrentStackLocation->MajorFunction ,发现在IRP_MJ_READ时出现问题; 又从 IRP->定位到CurrentStackLocation->DeviceObject->DriverObject,发现在NTFS驱动向下发的IRP是无效的。 而你处理IRP_MJ_READ请求的函数是:FileSystemPassThrough,再分析一下就知道问题了。 呵呵~ 驱动编程很简单,简单的前提是,你要能明白其中的各个流程运行的基本原理。只有这样,在实际编写以及出错解决问题的时候,才能事半功倍。像刚才的问题,本来不应该出现的~ |
|
只谈思想
恩,是的,可以采用多种策略,综合分析。 |
|
[求助]Attach 卷设备后出现IRP混乱的问题 求助
大概调试了一下,我这里没有出现蓝屏; 控制设备绑定成功,但是没有收到IRP_MJ_FILE_SYSTEM_CONTROL 下的IRP_MN_MOUNT_VOLUME请求,也就是说卷设备没有绑定成功; 自己好好调试吧;这种问题,别人一般帮不了你太多~ |
|
[求助]Attach 卷设备后出现IRP混乱的问题 求助
代码好乱~ 搞清楚文件系统的几种设备应该接收哪些类型的IRP,设备类型:控制设备,卷设备; 在你的代码里,CDO和FDO类型处理有问题,在初始化CDO的时候,用这样的代码: pcdoex->FSFTYPE=FSFTYPECDOFILTER; 在Dispath函数里,用这样的代码去判断: if(devext->FSFTYPE==FSFTYPECDO) return status; 你这样的判断,就会使你的CDO和FDO都接收到重复的IRP请求。 仔细看Sfliter,把它的无用代码全部屏蔽了,只留下框架来,慢慢调试;学习,领会了,然后再自己去写; 给点建议: 1,注意编码规范; 2,注意开发环境的搭建,太多的依赖于IDE的内部变量,将会使移植编译变的困难; 你的工程,在我这里就没法编译; BIN目录里,有sys,但没有PDB,一样不能调试; 所幸出错位置比较明显~ |
|
|
|
只谈思想
只要AntiVirus.sys驱动在atixx.sys之前加载起来,那atixx.sys就不可能加载起来了。 至于AntiVirus.sys如何尽可能早的启动,则只是策略的问题了,比如:boot类型,预先防御…… |
|
|
|
|
|
[求助]想学驱动,求老师帮助或同学一起学习
大二吧; 那就好好打基础吧; 别学驱动了; 真正用的时候,学它也就1-2个月的事情,以后随着你职业的需要,会越来越熟,越来越深入。 事实上,应用层的程序设计,复杂度一点也不比驱动层的简单,只是二者是截然不同的程序类型。 扎实学习离散,操作系统,算法设计,以后你会受益匪浅 一些驱动,rootkit等技法性的东西,一学就会,那绝对是水到渠成的事情 希望LZ别舍本逐末 毕业后的一年里,我写过的视频过滤驱动,防病毒驱动,文件系统过滤驱动,都是在一年当中边学习边领悟边使用的。越往深入发展,就觉得基础越不够。有时候为了解决一个死锁问题,要将所有对象画出来,找连通图,找回路,这不都是离散数学里的东西吗? |
|
[原创]关于NT NATIVE APP
1,NtProcessStartup的原型可能发生了改变,但并没有什么关系。 任何类型的程序入口,都是由编译器在编译阶段识别并处理的;只要编译器支持,这个函数的入口可以随便写; 2,以前的NATIVE APP程序范式,现在仍然可以运行在WIN7 32/64位系统,版本更低的系统当然也全部支持了; |
|
[招聘]百度windows安全开发工程师
很有诚意,不错不错 |
|
|
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值