Detecting CD Mounts on Win2K

Hi,

Introduction:

********************

I have written a FSFD based on the sFilter sample, this filter doesn’t start during the boot sequence, rather, it is being started by a user application using CreateService and friends.

On WinXP I use ‘IoRegisterFsRegistrationChange’ to attach to all of the mounted FS & Volumes, on Win2K ‘IoRegisterFsRegistrationChange’ will NOT enumerate devices that were already mounted, rather, it will indicate new devices being mounted.

To enable manual enumeration of all of the ‘drives’ on Win2K I have implemented the following:

for each drive ( from ‘A’ to ‘Z’ )

{

  • Open the root directory of that drive using ‘ZwCreateFile’.

  • Get the fileObject related with the root directory using ‘ObReferenceObjectByHandle’.

  • Get the related file system device using ‘IoGetRelatedDeviceObject’.

  • Attach to the device stack.

}

The Problem:

********************

On Win2K, when starting with a mounted CD everything works fine, all of the CD IO is being reported, BUT, when ejecting the CD and re-inserting it I get no more notifications from that CD… Why does this happen? should I hook to the \FileSystem\FatCdromRecognizer so I will get MOUNT notifications? OR, should I rather hook to \Cdfs…

Aparently, the callback registered with ‘IoRegisterFsRegistrationChange’ isn’t being called upon CD insertion / ejection…

How can I support filtering a re-mounted CD on Win2K ?

How can I get CD mount indications on Win2K ?

Any help would be appreciated…

Nadav.


Yahoo! for Good
Click here to donate to the Hurricane Katrina relief effort.

From my reading of the IFS, this should not happen. W2k and XP with regards to your problem should operate the same. In the IFS, everytime IoRegisterFsRegistrationChange occurs, it changes the filter driver’s object count. I have no idea what’s wrong, but perhaps if the io manager or whatever sees an equal number of device objects vs fso’s so it assumes all is well… ??? Hell, I’m just making stuff up… :slight_smile: Maybe I’ll spark an idea in you…

Perhaps the way your deleting the FDO of the cd is wrong(this api I assume would only fire if it was release properly). From my understanding, a filter can only attach to a CD-ROM if there is a cd in it. If the old fdo wasn’t released or whatever, then I don’t see how it could create a new one…

Matt
----- Original Message -----
From: Nadav
To: Windows File Systems Devs Interest List
Sent: Monday, September 12, 2005 7:43 AM
Subject: [ntfsd] Detecting CD Mounts on Win2K

Hi,

Introduction:

********************

I have written a FSFD based on the sFilter sample, this filter doesn’t start during the boot sequence, rather, it is being started by a user application using CreateService and friends.

On WinXP I use ‘IoRegisterFsRegistrationChange’ to attach to all of the mounted FS & Volumes, on Win2K ‘IoRegisterFsRegistrationChange’ will NOT enumerate devices that were already mounted, rather, it will indicate new devices being mounted.

To enable manual enumeration of all of the ‘drives’ on Win2K I have implemented the following:

for each drive ( from ‘A’ to ‘Z’ )

{

  • Open the root directory of that drive using ‘ZwCreateFile’.

  • Get the fileObject related with the root directory using ‘ObReferenceObjectByHandle’.

  • Get the related file system device using ‘IoGetRelatedDeviceObject’.

  • Attach to the device stack.

}

The Problem:

********************

On Win2K, when starting with a mounted CD everything works fine, all of the CD IO is being reported, BUT, when ejecting the CD and re-inserting it I get no more notifications from that CD… Why does this happen? should I hook to the \FileSystem\FatCdromRecognizer so I will get MOUNT notifications? OR, should I rather hook to \Cdfs…

Aparently, the callback registered with ‘IoRegisterFsRegistrationChange’ isn’t being called upon CD insertion / ejection…

How can I support filtering a re-mounted CD on Win2K ?

How can I get CD mount indications on Win2K ?

Any help would be appreciated…

Nadav.


Yahoo! for Good
Click here to donate to the Hurricane Katrina relief effort. — 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

> On Win2K, when starting with a mounted CD everything works fine,

all of the CD IO is being reported, BUT, when ejecting the CD

and re-inserting it I get no more notifications from that CD…

Why does this happen?

The volume belonging to the CD has been dismounted.

Aparently, the callback registered with ‘IoRegisterFsRegistrationChange’

isn’t being called upon CD insertion / ejection…

The name of the function is “IoRegisterFsNotificationChange”,

not “IoRegisterVolumeNotificationChange”. It notifies you about

new file system being installed, not about new volume being

mounted.

L.