> Yes I am aware of the different handles problem. I was hoping that
this would solve it:
DbgPrint( “\nI/O Paging PreCreate: FileObject: 0x%08X, PID:0x%08X
%wZ\n”, Data->Iopb->TargetFileObject, hCurrentProcessID, &FltObjects-
>FileObject->FileName );
giving me the associated filename via &FltObjects->FileObject-
>FileName ,but i guess I am totally wrong Never the less I still
observe strange behaviour like for an example create being done and
then cleanup on the file handle of the .txt with absolutely no reads
between neither standard nor paging. Another thing is that after i
delete the file restart the driver and try to open the virtual file
again , the second time there are absolutely no paging reads i/os
whatsoever (until I restart the machine). This made me think that I am
somehow filtering caching I/Os . I have this code:
[Edouard A.]
If this is paging IO, then this not cached IO… You can check the presence of IRP_NOCACHE to be sure.
AFAIK you cannot have IRP_PAGING_IO without IRP_NOCACHE.
Unless you have several VMM on your operating system I don’t think you want to cache a paging IO. 
if (IoGetTopLevelIrp())
return FLT_PREOP_SUCCESS_WITH_CALLBACK;
Now I know that sometimes this function returns PIRP, sometimes it
reterns a flag. I think that my problems is something around:
if(IoGetTopLevelIrp()==FSRTL_CACHE_TOP_LEVEL_IRP)
DbgPrint( “\nPreRead FSRTL_CACHE_TOP_LEVEL_IRP:
FileObject: 0x%08X, PID:0x%08X %wZ\n”, Data->Iopb->TargetFileObject,
hCurrentProcessID, &FltObjects->FileObject->FileName );
When I add this lines, there are no dumps either. It is really strange
for me. I think that once cached notepad always tries to read it from
the cache and I can’t recieve reads about that. I am lost help will be
appreciated.
[Edouard A.]
Your intuition is correct. Requests from the cache will not be apparent to you (unless you be specific about it), but you shouldn’t care. Again, back to my previous experience, I would get the first IRP_MJ_READ and then no more. This was not a problem as the decrypted data would be in the cache. The only problem is for testing.
In your case you only need to take action the first time (copy the file to the machine). When the cache is read, well, it’s not really your business as you cannot read data from the cache if the file wasn’t there in the first place, can you?
To test you can write an user program that does memory allocation until exhaustion and then exits. Make sure all buffers are written otherwise the VMM might not commit everything (the knave!).
This generally resets all caches and make your machine crawls for few minutes as well. Ultra violence at its finest.
You can also work on a different file at each test.
–
EA