FltGetTopInstance() on Windows 2008 Server

Hello all,

It seems the behavior of FltGetTopInstance() is not correct in Windows 2008.

I am testing on Windows 2008 a minifilter that attaches to volumes on
demand, using FltAttachVolume.

To check if it really needs to attach to a given volume, I currently use
the following strategy (see pseudo code below) :
if( FltGetTopInstance(volume,&instance) == STATUS_SUCCESS ) {
Use returned instance
}
else {
Call FltAttachVolume( … ) to get a new instance.
}

When the above code is executed for the first time, on a Windows 2003
OS, whatever the service pack, FltGetTopInstance fails (as expected,
since there was no attach yet).
On Windows 2008 however, it returns STATUS_SUCCESS, and the “instance”
variable is set to some value, even though there never was a single
volume attach from my minifilter ???

To me this looks like a bug in the filter manager …
Any thoughts ?


Pascal

Are you sure you’re the only minifilter on the system? This scheme
seems doomed to failure if you’re not.

If you can, wouldn’t it be simpler to just FltAttachVolumeAtAltitude (),
and see if you get a collision with an existing instance of your driver
(provided it always attaches at the same altitude).

Or you could just iterate down the stack using FltGetLowerInstance
looking for your minifilter once you have the top instance.

~Eric

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Pascal Dameme
Sent: Tuesday, April 08, 2008 10:01 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] FltGetTopInstance() on Windows 2008 Server

Hello all,

It seems the behavior of FltGetTopInstance() is not correct in Windows
2008.

I am testing on Windows 2008 a minifilter that attaches to volumes on
demand, using FltAttachVolume.

To check if it really needs to attach to a given volume, I currently use
the following strategy (see pseudo code below) :
if( FltGetTopInstance(volume,&instance) == STATUS_SUCCESS ) {
Use returned instance
}
else {
Call FltAttachVolume( … ) to get a new instance.
}

When the above code is executed for the first time, on a Windows 2003
OS, whatever the service pack, FltGetTopInstance fails (as expected,
since there was no attach yet).
On Windows 2008 however, it returns STATUS_SUCCESS, and the “instance”
variable is set to some value, even though there never was a single
volume attach from my minifilter ???

To me this looks like a bug in the filter manager …
Any thoughts ?


Pascal


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@edsiohio.com To
unsubscribe send a blank email to xxxxx@lists.osr.com

Replying to myself …

Hello all,

It seems the behavior of FltGetTopInstance() is not correct in Windows
2008.

On a second thought, it is probably (as usual) a bug in our minifilter
implementation rather than in the framework:
The documentation of the FltGetTopInstance() function does not state
that the returned instance belongs to the caller minifilter …
Probably not so ! I imagine this is why FltGetVolumeInstanceFromName()
exists …
Maybe the doc could be more explicit ? Ah, nevermind.

Sorry for the noise.

Thanks for the reply, Eric. You are correct, this stuff is bound to fail
if any other minifilter attach.