abc13271552
驱动小牛
驱动小牛
  • 注册日期2007-08-13
  • 最后登录2023-12-05
  • 粉丝0
  • 关注0
  • 积分34分
  • 威望552点
  • 贡献值0点
  • 好评度160点
  • 原创分0分
  • 专家分0分
  • 社区居民
阅读:1197回复:2

devia大牛来看下.使用FileObject写文件的问题.

楼主#
更多 发布于:2008-01-17 14:55

我在IRP_MJ_SETINFORMATION中,先把Irp下发执行完毕.
然后自己build一个MJ_WRITE的IRP向原文件尾部写4个字节.
在IoCallDriver(DeviceObject, Irp);时蓝...何解呢?

IRP_MJ_SETINFORMATION中不能使用FileObject写数据?
驱网无线,快乐无限
devia
论坛版主
论坛版主
  • 注册日期2005-05-14
  • 最后登录2016-04-05
  • 粉丝3
  • 关注0
  • 积分1029分
  • 威望712点
  • 贡献值1点
  • 好评度555点
  • 原创分8分
  • 专家分4分
沙发#
发布于:2008-01-17 16:34
1。如果你要在文件尾进行追加的话就无须特意移动文件读写指针了,解释如下:

If the following condition is true, this indicates that the current end of file should be used instead of an explicit file offset value:
IrpSp->Parameters.Write.ByteOffset.LowPart == FILE_WRITE_TO_END_OF_FILE and IrpSp->Parameters.Write.ByteOffset.HighPart == -1

If the file object was opened for synchronous I/O, and one of the following conditions is true, this indicates that the current file position should be used instead of an explicit file offset value:
IrpSp->Parameters.Write.ByteOffset == NULL

IrpSp->Parameters.Write.ByteOffset.LowPart == FILE_USE_FILE_POINTER_POSITION and IrpSp->Parameters.Write.ByteOffset.HighPart == -1

2。如何自己发IRP来完成IO,你在论坛找找我以前发的OSR上的Demo
http://bbs.driverdevelop.com/htm_data/39/0704/101220.html
人总在矛盾中徘徊。。。
abc13271552
驱动小牛
驱动小牛
  • 注册日期2007-08-13
  • 最后登录2023-12-05
  • 粉丝0
  • 关注0
  • 积分34分
  • 威望552点
  • 贡献值0点
  • 好评度160点
  • 原创分0分
  • 专家分0分
  • 社区居民
板凳#
发布于:2008-01-18 09:20
历害,果然是好大牛.顶个~
驱网无线,快乐无限
游客

返回顶部