>And you know this to be true with minifilters?
The purpose of name lookup functions is to get the name. The purpose of the
name cache is to improve name lookup performance. Using existence in the
name cache as heuristic to guess about the state of the file will bite you
eventually. A patent application is not IFS kit documentation, and you
cannot depend on implementation details remaining the same.
That is one thing I don’t understand fully, the doc’s are confusing
me… The flag FLT_FILE_NAME_OPENED
states “Returns the name that was used when the file was opened.” - and
it is stated this can be used in Pre- create(FltGetFileNameInfo). It sounds
like an open can be associated
with a previous open…
No, that is not what that means. The name used to open the file is
available in pre-create only because it’s right there in the file object.
This form of name simply means that you get the particular “length” that was
used to open the file (long and short name combinations), rather than a
“normalized” name (all long names).
Has anyone else here tried anything like this and had it work? Sure
someone has, seems like a basic idea…
Did you try something like this Dan?
Certainly. If you always create/retrieve a stream context in post-create,
then if the file is already open, you’ll get back your existing stream
context. If it is not, a new stream context will be created. If your
stream context already exists, you can return at that point. If not, you
can continue with your “molestation”.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of MM
Sent: Monday, May 01, 2006 8:14 AM
To: Windows File Systems Devs Interest List
Subject: Re: [ntfsd] Minifilter cache
Dan Kyler wrote:
Using name lookup functions to determine whether a file is already open
is just plain broken.
And you know this to be true with minifilters?
There could be a filter above you that queries the name
in its precreate, which would cause the name to be cached,
From the patent info I read, if a filter above me/or below me queries
the name, this shouldn’t matter.
Once a file is fully opened, the fltmgr’s cache count is incremented,
and every time a file is closed, it
is decremented. The cache is shared between all mini’s. Once the ref
count hits zero, the cache is deleted.
Querying for the file shouldn’t affect this unless the filter
above/below me was broken.
At least that is my take on it…
Also, it is
difficult to associate an incoming create with existing open files. Do
not expect fltmgr to make that association (and provide the cached
name) until after the create has gone to the file system.
That is one thing I don’t understand fully, the doc’s are confusing
me… The flag FLT_FILE_NAME_OPENED
states “Returns the name that was used when the file was opened.” - and
it is stated this can be used in Pre- create(FltGetFileNameInfo). It sounds
like an open can be associated
with a previous open…
You should make your decision in the post-create callback, and depend
on your stream context, not on whether a name is in cache, to determine
what processing you need to do.
I’ll give that a try after I get some sleep.
Has anyone else here tried anything like this and had it work? Sure
someone has, seems like a basic idea…
Did you try something like this Dan?
m
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of MM
Sent: Monday, May 01, 2006 3:52 AM
To: Windows File Systems Devs Interest List
Subject: Re: [ntfsd] Minifilter cache
ok, managed to get rid of the bugcheck (kinda, still haven’t got it to
release the nameinfo without bugchecking so far, thus leaking memory
right now)… Now I’m getting cache misses on everything just about,
there are a few exceptions…
What I’m trying to do Dejan is avoid a hash table… In the pre-create
callback, I want query the cache to see if the file is open (or has been
opened).
If the name is in the cache, I simply want to return
FLT_PREOP_SUCCESS_NO_CALLBACK.
If there is a cache miss (file is closed or was never opened), then I
want to return FLT_PREOP_SUCCESS_WITH_CALLBACK
and molest the file in my Post-create callback.
m
Dejan Maksimovic wrote:
> Why would it be available in pre-create? The file-object has just
>been created, and no cache is yet available - the name is only
>generated once you call the FltGetFileNameInformation.
> I don’t understand why you get a bugcheck, it should return an
>error code only - checked build maybe?
>
> Regards, Dejan.
>
>MM wrote:
>
>
>
>
>
>>Hi all,
>>
>>When does file info get added to fltmgr’s cache? Does this happen
>>once
>>the FileObject is created, pre-create or post-create - where?
>>
>>Trying to query the cache in Pre-create using
>>FltGetFileNameInformation with FLT_FILE_NAME_QUERY_CACHE_ONLY, but
>>keep bugchecking…
>>
>>The fltmgr’s cache should be avaliable in pre-create, shouldn’t it?
>>
>>m
>>
>>—
>>Questions? First check the IFS FAQ at
>>https://www.osronline.com/article.cfm?id=17
>>
>>You are currently subscribed to ntfsd as: xxxxx@alfasp.com To
>>unsubscribe send a blank email to xxxxx@lists.osr.com
>>
>>
>>
>>
>–
>Kind regards, Dejan M.
>http://www.alfasp.com E-mail: xxxxx@alfasp.com
>Alfa Transparent File Encryptor - Transparent file encryption
>services.
>Alfa File Protector - File protection and hiding library for Win32
>developers. Alfa File Monitor - File monitoring library for Win32
>developers.
>
>
>
>—
>Questions? First check the IFS FAQ at
>https://www.osronline.com/article.cfm?id=17
>
>You are currently subscribed to ntfsd as: xxxxx@comcast.net To
>unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
>
>
>
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as: xxxxx@privtek.com To
unsubscribe send a blank email to xxxxx@lists.osr.com
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as: xxxxx@comcast.net To
unsubscribe send a blank email to xxxxx@lists.osr.com
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as: xxxxx@privtek.com
To unsubscribe send a blank email to xxxxx@lists.osr.com