pango99
驱动牛犊
驱动牛犊
  • 注册日期2001-08-21
  • 最后登录2018-05-29
  • 粉丝0
  • 关注0
  • 积分4分
  • 威望20点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1993回复:13

不调用IoCompleteRequest可以吗?

楼主#
更多 发布于:2001-12-02 11:17
在一个IRP处理例程,任务结束后不调用IoCompleteRequest可以吗?

最新喜欢:

flyfoxflyfox
jeosph
驱动中牛
驱动中牛
  • 注册日期2001-04-19
  • 最后登录2006-08-08
  • 粉丝0
  • 关注0
  • 积分96分
  • 威望11点
  • 贡献值0点
  • 好评度9点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2001-12-02 12:16
在一个IRP处理例程,任务结束后不调用IoCompleteRequest可以吗?


不可以!

任务结束时一定要调用IoCompleteRequest,否则APC过程还在傻傻地等待!。
而且这个irp所占用的非分页内存资源也得不到释放,非分页内存可是很宝贵的哦!
Nouk
驱动中牛
驱动中牛
  • 注册日期2001-08-22
  • 最后登录2006-10-22
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2001-12-03 09:59
IoCompleteRoutine?
Taiwan's Driver Developer
blue
驱动大牛
驱动大牛
  • 注册日期2001-04-25
  • 最后登录2010-10-15
  • 粉丝0
  • 关注0
  • 积分55分
  • 威望12点
  • 贡献值0点
  • 好评度4点
  • 原创分0分
  • 专家分0分
地板#
发布于:2001-12-03 15:46
不可以!
任务结束时一定要调用IoCompleteRequest,否则APC过程还在傻傻地等待!。
而且这个irp所占用的非分页内存资源也得不到释放,非分页内存可是很宝贵的哦!
 

jeosph,你的话不要说绝对了,你看一下DDK文档,关于IoBuildSynchronousFsdRequest 的文档:

The caller can determine when the I/O has completed by calling KeWaitForSingleObject with the Event. Performing this wait operation causes the current thread to wait. Therefore, this operation can be requested during the initialization of an intermediate driver or from an FSD in the context of a thread requesting a synchronous I/O operation. A driver cannot wait for a nonzero interval on the Event at raised IRQL in an arbitrary thread context.

Because the caller can wait on a given Event, the caller need not set an IoCompletion routine in the caller-allocated IRP before calling IoCallDriver. When the caller completes the IRP, the I/O Manager releases it.

只要你设置一个event, 然后wait它,就可以,不一定必须调用IoCompleteRequest. 而且我作的一个软驱动中就没调用IoCompleteRequest。
KungFu
驱动大牛
驱动大牛
  • 注册日期2001-09-27
  • 最后登录2008-04-08
  • 粉丝0
  • 关注0
  • 积分221分
  • 威望24点
  • 贡献值0点
  • 好评度19点
  • 原创分0分
  • 专家分0分
地下室#
发布于:2001-12-05 17:28
[quote]不可以!
任务结束时一定要调用IoCompleteRequest,否则APC过程还在傻傻地等待!。
而且这个irp所占用的非分页内存资源也得不到释放,非分页内存可是很宝贵的哦!
 

jeosph,你的话不要说绝对了,你看一下DDK文档,关于IoBuildSynchronousFsdRequest 的文档:

The caller can determine when the I/O has completed by calling KeWaitForSingleObject with the Event. Performing this wait operation causes the current thread to wait. Therefore, this operation can be requested during the initialization of an intermediate driver or from an FSD in the context of a thread requesting a synchronous I/O operation. A driver cannot wait for a nonzero interval on the Event at raised IRQL in an arbitrary thread context.

Because the caller can wait on a given Event, the caller need not set an IoCompletion routine in the caller-allocated IRP before calling IoCallDriver. When the caller completes the IRP, the I/O Manager releases it.

只要你设置一个event, 然后wait它,就可以,不一定必须调用IoCompleteRequest. 而且我作的一个软驱动中就没调用IoCompleteRequest。  [/quote]


拜托!我有一个相同的问题晕了3个礼拜了!
我在调用KeWaitForSingleObject时候,会跳出softice,而且会永远等待下去,是什么原因?????(急!!!)
我不写驱动好多年
mydrive
驱动牛犊
驱动牛犊
  • 注册日期2001-06-21
  • 最后登录2004-05-10
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
5楼#
发布于:2001-12-05 19:50
与blue探讨:
   关于IoBuildSynchronousFsdRequest文档中所说的need not set an IoCompletion routine,是否是指:不需要设置一个它所要调用的低层驱动程序的IRP的完成回调例程,而不是说不需要调用IoCompleteRequest来完成它自己的IRP。每个IRP在完成时都应该调用IoCompleteRequest来释放资源。
   如有不对,请大家多多指教!
gtdrive
驱动牛犊
驱动牛犊
  • 注册日期2001-09-11
  • 最后登录2002-01-07
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
6楼#
发布于:2001-12-10 14:57
I agree with mydrive .I think ,as explained in the ddk,an irp should be indicated as completed by calling IoCompleteRequest ( one to one),which routine can be supplied by you directly
or other system routine indirectly.
masmasm
驱动牛犊
驱动牛犊
  • 注册日期2001-05-09
  • 最后登录2018-04-15
  • 粉丝0
  • 关注0
  • 积分-16分
  • 威望10点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
7楼#
发布于:2001-12-11 12:20
如果下层driver不call IoCompleteRequest()
上层过滤driver的完成例程怎么能够获得调用呢?
blue
驱动大牛
驱动大牛
  • 注册日期2001-04-25
  • 最后登录2010-10-15
  • 粉丝0
  • 关注0
  • 积分55分
  • 威望12点
  • 贡献值0点
  • 好评度4点
  • 原创分0分
  • 专家分0分
8楼#
发布于:2001-12-11 14:22
sorry,是我理解有误。应该调用IoCompleteRequest。
如果不调用,是不是就不能将此IRP标记为已完成,就不能转交给
the I/O Manager,此IRP 也就没释放了呢?
guardee
驱动巨牛
驱动巨牛
  • 注册日期2002-11-08
  • 最后登录2010-05-29
  • 粉丝2
  • 关注1
  • 积分2分
  • 威望34点
  • 贡献值0点
  • 好评度6点
  • 原创分0分
  • 专家分0分
9楼#
发布于:2001-12-11 19:49
你用SOFTICE跟中一下这个函数就知道了,我记得这个函数只是把IRP中的一些标志致为位
KungFu
驱动大牛
驱动大牛
  • 注册日期2001-09-27
  • 最后登录2008-04-08
  • 粉丝0
  • 关注0
  • 积分221分
  • 威望24点
  • 贡献值0点
  • 好评度19点
  • 原创分0分
  • 专家分0分
10楼#
发布于:2001-12-12 10:01
sorry,是我理解有误。应该调用IoCompleteRequest。
如果不调用,是不是就不能将此IRP标记为已完成,就不能转交给
the I/O Manager,此IRP 也就没释放了呢?


也不一定,看irp的建立方式,可能的情况是不需要你的驱动调用IoCompleteRequest,而是由下层的驱动调用。所以,在本层驱动看来,是不需要调用IoCompleteRequest的。
我不写驱动好多年
mydrive
驱动牛犊
驱动牛犊
  • 注册日期2001-06-21
  • 最后登录2004-05-10
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
11楼#
发布于:2001-12-12 17:06
也可以由另外一个系统线程完成IoCompleteRequest。
engineer678
驱动牛犊
驱动牛犊
  • 注册日期2007-01-07
  • 最后登录2007-04-16
  • 粉丝0
  • 关注0
  • 积分210分
  • 威望22点
  • 贡献值0点
  • 好评度21点
  • 原创分0分
  • 专家分0分
12楼#
发布于:2007-03-21 15:11
当然要调用了,这样I/o manager 会把该irp释放掉。
engineer678
驱动牛犊
驱动牛犊
  • 注册日期2007-01-07
  • 最后登录2007-04-16
  • 粉丝0
  • 关注0
  • 积分210分
  • 威望22点
  • 贡献值0点
  • 好评度21点
  • 原创分0分
  • 专家分0分
13楼#
发布于:2007-03-21 15:22
而且,上层程序也许还在等你结束呢。
游客

返回顶部