> Should we write samples that are complete and that
work well in all possible cases (which are basically products) or
samples that just showcase some particular feature or behavior of
the system, but do not handle all the possible cases ?
I’d say write samples that are easy (as it is now), but if there’s a
place which can be problematic, put a few comments there.
Wouldn’t that also fail since the thread doesn’t have traverse privileges still?
Would it be possible to query the name in postCreate for files opened by ID ? Not sure what the architecture of the application is but from a performance perspective this would be slightly better.
This particular case would be good in sample for all I think. By this, I mean handling different errors that can arise during name query. It is not any technical secret and I am sure a lot of us have spent more time on figuring all the FltGetFileNameInformation problems than rest of the code. (I seriously did - and I’m not even done with it yet)
It is clear to me that either choice will upset someone. We receive mails that complain either that fastfat is too complicated and it isn’t clear from it which things are important or that the samples are too simple and they never show any of the really hard stuff.
I have one more question regarding open by ID. Is it possible to supersede or overwrite a file when opening by ID? If this is not allowed then I should be able to handle most of what I need in post-create.
The new WIN32 api OpenFileById does not give you the option to overwrite or supersede the file so I am hoping that it is not allowed via NT functions either.
Well, it’s complicated :). Normally traverse privileges might be needed for both preCreate and postCreate path generation so yeah, if that privilege is not held then name generation in perCreate or postCreate is pretty much the same (i.e. if it fails because of it in preCreate, it would fail in postCreate as well).
However, as far as I know the traverse privilege needs to be held for an open-by-ID to succeed, so moving the name query in postCreate will ensure that the privilege is always held (in a successful postCreate, that is).
One more thing I’d like to point out is that the quote from my previous answer was all about performance, it didn’t say anything about the privilege not held issue (though as I said above, it might make a difference for open-by-ID).
Regards,
Alex.
This posting is provided “AS IS” with no warranties, and confers no rights.
Yup, it is possible. FileTest is what I use to quickly check for this sort of things…
Regards,
Alex.
This posting is provided “AS IS” with no warranties, and confers no rights.
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.com
Sent: Wednesday, September 30, 2009 08:22
To: Windows File Systems Devs Interest List
Subject: RE:[ntfsd] Cannot get the filename in pre-create on Win7 if the file is opened by ID
I have one more question regarding open by ID. Is it possible to supersede or overwrite a file when opening by ID? If this is not allowed then I should be able to handle most of what I need in post-create.
The new WIN32 api OpenFileById does not give you the option to overwrite or supersede the file so I am hoping that it is not allowed via NT functions either.
NTFSD is sponsored by OSR
For our schedule of debugging and file system seminars (including our new fs mini-filter seminar) visit: http://www.osr.com/seminars
I will pass this information along. You can always send sample requests (or comments, issues and so on) to FSFComm at the usual Microsoft.com.
Regards,
Alex.
This posting is provided “AS IS” with no warranties, and confers no rights.
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Dejan Maksimovic
Sent: Wednesday, September 30, 2009 02:26
To: Windows File Systems Devs Interest List
Subject: Re: [ntfsd] Cannot get the filename in pre-create on Win7 if the file is opened by ID
This particular case would be good in sample for all I think. By this, I mean handling different errors that can arise during name query. It is not any technical secret and I am sure a lot of us have spent more time on figuring all the FltGetFileNameInformation problems than rest of the code. (I seriously did - and I’m not even done with it yet)
It is clear to me that either choice will upset someone. We receive mails that complain either that fastfat is too complicated and it isn’t clear from it which things are important or that the samples are too simple and they never show any of the really hard stuff.
One more thing I’d like to point out is that the quote from my previous answer was all about performance, it didn’t say anything about the privilege not held issue (though as I said above, it might make a difference for open-by-ID).
So I tried to get the name in the post create callback and that was not working either. I investigated more and it turns out that the open by ID create failed also (STATUS_INVALID_PARAMETER).
Could this simply be a case where the file it is looking for has changed or was deleted and cannot be opened? It looks like the only time I fail to get the name in precreate is when the create is destined to fail, either because of the traverse privilege or some other error (like the ID is no longer valid)
For open-by-IDs filter manager needs to open the file itself so if the original create will fail then filter manager’s create might fail as well, which is what we’re seeing here. When I said query the name in postCreate, I meant in a successful postCreate. If an IRP_MJ_CREATE failed in the file system there isn’t usually any reason to try to get the name of the file… So you can simply ignore this case.
There are some cases where creates fail with STATUS_INVALID_PARAMETER. Take a look at this blog post : http://www.alex-ionescu.com/?p=15
Regards,
Alex.
This posting is provided “AS IS” with no warranties, and confers no rights.