Hello,
When FltCreateFile is issued with FILE_OPEN flag, the FSD tries JUST to OPEN the file and NOT CREATE it if it does not exist.
The logic here is, when you receive a Pre-Callback for IRP_MJ_CREATE, issue a FltCreateFile with FILE_OPEN flag. If the file exists, it will return STATUS_SUCCESS, else a failure status will be returned.
If you check this thing till completion routine (post-callback) and if the original call was made with a flag to open a file and create if it does not exist, the FSD will create the file and in completion routine, you can do nothing about it.
Of course, you can do the stuff in an ugly way in the completion routine. Check the IoStatus.Status. If it is FILE_CREATED, a new file has been created. Now issue a FltSetInformationFile with FileDispositionInformation set to delete the file.
Now you decide: Which is a better and a cleaner and an optimum way of checking if a file is being created and then stopping it.
Obviously, the one in completion routine is VERY BAD.
Regards,
Ayush Gupta
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Friday, November 16, 2007 3:53 PM
To: Windows File Systems Devs Interest List
Subject: RE:[ntfsd] Catch creation of files and folders
Hello,
I don’t understand what you mean when you say issue a FltCreateFile call with the FILE_OPEN flag, can you explain what you mean?
Also, why can’t get the name of the file created in the Create IRP itself? It seems like I have everything for it there…
NTFSD is sponsored by OSR
For our schedule debugging and file system seminars
(including our new fs mini-filter seminar) visit:
http://www.osr.com/seminars
You are currently subscribed to ntfsd as: xxxxx@yahoo.co.in
To unsubscribe send a blank email to xxxxx@lists.osr.com