Page Fault in PagingIoWrite

I am having a Encryption minifilter driver and it is working fine.but sometimes bsod in the following scenario:
Suppose i am performing a copy operation of 4gb file form plain folder to encrypted folder before that i am successfully able to handle set/get file information callbacks.my fcb is updated properly as per the operation but after some time the size of my file getting set to ZERO i checked in my FCB since lower fcb’s filesize is not zero.due to that all the further operation failing and resulted in a bsod.

query:1. is it possible that filesize sets to zero? if yes how?
as per my understanding in pagingio size of a file can’t be chaged.
2.is there any way to resolve this behavior.

any help much appreciated.

Thanks.

I’m not sure that I fully follow…

query:1. is it possible that filesize sets to zero?

You mean in a way which you didn’t notice? And when you say filesize you
mean what NTFS thinks of as the length. The answer is yes. For example

  • Destructive create on the stream
  • Destructive create on the file
  • Destructive rename
  • *Any* thing involving transactions (well not anything, but lots of things)
  • (Obviously) a SetInfo.

as per my understanding in pagingio size of a file can’t be chaged.

Not true. It is quite possible to get a paging Set information (even on a
file object which has seen Cleanup) This happens if someone resizes a
section.

OTOH a paging write will *not* extend the Eof and not write will truncate
the eof.