When a CD removed/inserted

Hi all,

My driver is based on sfilter of 2KIFS Kit and filtering some IRPs to a
CD-ROM drive in Win 2K.

I found that when a CD is removed from the drive, the volume DO is not
deleted, so my filter is also in the system. But, when the CD is inserted
again, a new volume DO is created and my filter creates a new DO. Then, when
does that old volume DO deleted by OS?

I need to know when I can delete my filter DO safely when the new one is
created, because there are some resources in the device extension which must
be freed.

Any ideas?

Regards,
Ray Yang
xxxxx@ybwork.com

You detach/delete in response to IRP_MJ_PNP/IRP_MN_REMOVE_DEVICE, and
nowhere else. See the filter directory in the toaster sample for
details.

  • Nicholas Ryan

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Ray Yang
Sent: Monday, December 02, 2002 10:55 PM
To: File Systems Developers
Subject: [ntfsd] When a CD removed/inserted

Hi all,

My driver is based on sfilter of 2KIFS Kit and filtering some
IRPs to a CD-ROM drive in Win 2K.

I found that when a CD is removed from the drive, the volume
DO is not deleted, so my filter is also in the system. But,
when the CD is inserted again, a new volume DO is created and
my filter creates a new DO. Then, when does that old volume
DO deleted by OS?

I need to know when I can delete my filter DO safely when the
new one is created, because there are some resources in the
device extension which must be freed.

Any ideas?

Regards,
Ray Yang
xxxxx@ybwork.com


You are currently subscribed to ntfsd as: xxxxx@nryan.com
To unsubscribe send a blank email to %%email.unsub%%

But my filter doesn’t receive these IRPs. Without my filter, the system
volume DO doesn’t reveive either. :frowning:

But, I found, on a clean machine - without my filter, the volume DO is not
deleted when the CD is inserted and a new volume DO is created. Why Windows
does this?

Regards,
Ray Yang
xxxxx@ybwork.com
----- Original Message -----
From: “Nicholas Ryan”
To: “File Systems Developers”
Sent: Tuesday, December 03, 2002 3:28 PM
Subject: [ntfsd] RE: When a CD removed/inserted

> You detach/delete in response to IRP_MJ_PNP/IRP_MN_REMOVE_DEVICE, and
> nowhere else. See the filter directory in the toaster sample for
> details.
>
> - Nicholas Ryan
>
>
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Ray Yang
> > Sent: Monday, December 02, 2002 10:55 PM
> > To: File Systems Developers
> > Subject: [ntfsd] When a CD removed/inserted
> >
> >
> > Hi all,
> >
> > My driver is based on sfilter of 2KIFS Kit and filtering some
> > IRPs to a CD-ROM drive in Win 2K.
> >
> > I found that when a CD is removed from the drive, the volume
> > DO is not deleted, so my filter is also in the system. But,
> > when the CD is inserted again, a new volume DO is created and
> > my filter creates a new DO. Then, when does that old volume
> > DO deleted by OS?
> >
> > I need to know when I can delete my filter DO safely when the
> > new one is created, because there are some resources in the
> > device extension which must be freed.
> >
> > Any ideas?
> >
> > Regards,
> > Ray Yang
> > xxxxx@ybwork.com
> >
> >
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@nryan.com
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@ybwork.com
> To unsubscribe send a blank email to %%email.unsub%%
>

The best way to see this is to look in the CDFS source code, which is
included in the IFS Kit.

Basically, the file systems do not work the same as WDM drivers. Their
model for managing media insertion/removal pre-dates the WDM model.

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

-----Original Message-----
From: Ray Yang [mailto:xxxxx@ybwork.com]
Sent: Tuesday, December 03, 2002 3:06 AM
To: File Systems Developers
Subject: [ntfsd] RE: When a CD removed/inserted

But my filter doesn’t receive these IRPs. Without my filter, the system
volume DO doesn’t reveive either. :frowning:

But, I found, on a clean machine - without my filter, the volume DO is not
deleted when the CD is inserted and a new volume DO is created. Why Windows
does this?

Regards,
Ray Yang
xxxxx@ybwork.com
----- Original Message -----
From: “Nicholas Ryan”
To: “File Systems Developers”
Sent: Tuesday, December 03, 2002 3:28 PM
Subject: [ntfsd] RE: When a CD removed/inserted

> You detach/delete in response to IRP_MJ_PNP/IRP_MN_REMOVE_DEVICE, and
> nowhere else. See the filter directory in the toaster sample for
> details.
>
> - Nicholas Ryan
>
>
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Ray Yang
> > Sent: Monday, December 02, 2002 10:55 PM
> > To: File Systems Developers
> > Subject: [ntfsd] When a CD removed/inserted
> >
> >
> > Hi all,
> >
> > My driver is based on sfilter of 2KIFS Kit and filtering some
> > IRPs to a CD-ROM drive in Win 2K.
> >
> > I found that when a CD is removed from the drive, the volume
> > DO is not deleted, so my filter is also in the system. But,
> > when the CD is inserted again, a new volume DO is created and
> > my filter creates a new DO. Then, when does that old volume
> > DO deleted by OS?
> >
> > I need to know when I can delete my filter DO safely when the
> > new one is created, because there are some resources in the
> > device extension which must be freed.
> >
> > Any ideas?
> >
> > Regards,
> > Ray Yang
> > xxxxx@ybwork.com
> >
> >
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@nryan.com
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@ybwork.com
> To unsubscribe send a blank email to %%email.unsub%%
>


You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to %%email.unsub%%

Doh, I didn’t see that he was referring to a filesystem filter and not a
volume filter. Yes, for filesystem filters the volume DO created by CDFS
is kept around even after the media is ejected, and is only deleted when
a different CD is inserted (the same CD will simply cause the same DO to
be re-used).

  • Nicholas Ryan

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tony Mason
Sent: Tuesday, December 03, 2002 4:19 AM
To: File Systems Developers
Subject: [ntfsd] RE: When a CD removed/inserted

The best way to see this is to look in the CDFS source code,
which is included in the IFS Kit.

Basically, the file systems do not work the same as WDM
drivers. Their model for managing media insertion/removal
pre-dates the WDM model.

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

-----Original Message-----
From: Ray Yang [mailto:xxxxx@ybwork.com]
Sent: Tuesday, December 03, 2002 3:06 AM
To: File Systems Developers
Subject: [ntfsd] RE: When a CD removed/inserted

But my filter doesn’t receive these IRPs. Without my filter,
the system volume DO doesn’t reveive either. :frowning:

But, I found, on a clean machine - without my filter, the
volume DO is not deleted when the CD is inserted and a new
volume DO is created. Why Windows does this?

Regards,
Ray Yang
xxxxx@ybwork.com
----- Original Message -----
From: “Nicholas Ryan”
> To: “File Systems Developers”
> Sent: Tuesday, December 03, 2002 3:28 PM
> Subject: [ntfsd] RE: When a CD removed/inserted
>
>
> > You detach/delete in response to
> IRP_MJ_PNP/IRP_MN_REMOVE_DEVICE, and
> > nowhere else. See the filter directory in the toaster sample for
> > details.
> >
> > - Nicholas Ryan
> >
> >
> >
> > > -----Original Message-----
> > > From: xxxxx@lists.osr.com
> > > [mailto:xxxxx@lists.osr.com] On Behalf Of Ray Yang
> > > Sent: Monday, December 02, 2002 10:55 PM
> > > To: File Systems Developers
> > > Subject: [ntfsd] When a CD removed/inserted
> > >
> > >
> > > Hi all,
> > >
> > > My driver is based on sfilter of 2KIFS Kit and filtering
> some IRPs
> > > to a CD-ROM drive in Win 2K.
> > >
> > > I found that when a CD is removed from the drive, the
> volume DO is
> > > not deleted, so my filter is also in the system. But,
> when the CD is
> > > inserted again, a new volume DO is created and my filter
> creates a
> > > new DO. Then, when does that old volume DO deleted by OS?
> > >
> > > I need to know when I can delete my filter DO safely when the new
> > > one is created, because there are some resources in the device
> > > extension which must be freed.
> > >
> > > Any ideas?
> > >
> > > Regards,
> > > Ray Yang
> > > xxxxx@ybwork.com
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntfsd as: xxxxx@nryan.com To
> > > unsubscribe send a blank email to %%email.unsub%%
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@ybwork.com To
> > unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@osr.com
> To unsubscribe send a blank email to %%email.unsub%%
>
> —
> You are currently subscribed to ntfsd as: xxxxx@nryan.com
> To unsubscribe send a blank email to %%email.unsub%%
>

> again, a new volume DO is created and my filter creates a new DO.
Then, when

does that old volume DO deleted by OS?

When Cc will release all file objects it holds, which can take hours.
See the CDFS source.

I need to know when I can delete my filter DO safely

In FastIoDetachDevice only.

Max

This is for PnP device filters. For FSFs, the only safe place is
FastIoDetachDevice.

Max

----- Original Message -----
From: “Nicholas Ryan”
To: “File Systems Developers”
Sent: Tuesday, December 03, 2002 10:28 AM
Subject: [ntfsd] RE: When a CD removed/inserted

> You detach/delete in response to IRP_MJ_PNP/IRP_MN_REMOVE_DEVICE,
and
> nowhere else. See the filter directory in the toaster sample for
> details.
>
> - Nicholas Ryan
>
>
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Ray Yang
> > Sent: Monday, December 02, 2002 10:55 PM
> > To: File Systems Developers
> > Subject: [ntfsd] When a CD removed/inserted
> >
> >
> > Hi all,
> >
> > My driver is based on sfilter of 2KIFS Kit and filtering some
> > IRPs to a CD-ROM drive in Win 2K.
> >
> > I found that when a CD is removed from the drive, the volume
> > DO is not deleted, so my filter is also in the system. But,
> > when the CD is inserted again, a new volume DO is created and
> > my filter creates a new DO. Then, when does that old volume
> > DO deleted by OS?
> >
> > I need to know when I can delete my filter DO safely when the
> > new one is created, because there are some resources in the
> > device extension which must be freed.
> >
> > Any ideas?
> >
> > Regards,
> > Ray Yang
> > xxxxx@ybwork.com
> >
> >
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@nryan.com
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to %%email.unsub%%
>

The behavior of volume DO is really strange. After 20 tests of
removing/inserting CD, I found there are 2 results:

  • Sometimes, OS deletes volume DO immediately after removing of CD, and
    create a new one for the insertion (even the CD is same)
  • And sometimes, the old one is *not* deleted till the new one is created
    for the insertion (also for the same CD)
    This is really difficult to understand…

Anyway, I have solved my problem in FastIoDetachDevice.

Thanks for replies to my question.

Regards,
Ray Yang
xxxxx@ybwork.com
----- Original Message -----
From: “Nicholas Ryan”
To: “File Systems Developers”
Sent: Wednesday, December 04, 2002 3:35 AM
Subject: [ntfsd] RE: When a CD removed/inserted

> Doh, I didn’t see that he was referring to a filesystem filter and not a
> volume filter. Yes, for filesystem filters the volume DO created by CDFS
> is kept around even after the media is ejected, and is only deleted when
> a different CD is inserted (the same CD will simply cause the same DO to
> be re-used).
>
> - Nicholas Ryan
>
>
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Tony Mason
> > Sent: Tuesday, December 03, 2002 4:19 AM
> > To: File Systems Developers
> > Subject: [ntfsd] RE: When a CD removed/inserted
> >
> >
> > The best way to see this is to look in the CDFS source code,
> > which is included in the IFS Kit.
> >
> > Basically, the file systems do not work the same as WDM
> > drivers. Their model for managing media insertion/removal
> > pre-dates the WDM model.
> >
> > Regards,
> >
> > Tony
> >
> > Tony Mason
> > Consulting Partner
> > OSR Open Systems Resources, Inc.
> > http://www.osr.com
> >
> >
> > -----Original Message-----
> > From: Ray Yang [mailto:xxxxx@ybwork.com]
> > Sent: Tuesday, December 03, 2002 3:06 AM
> > To: File Systems Developers
> > Subject: [ntfsd] RE: When a CD removed/inserted
> >
> > But my filter doesn’t receive these IRPs. Without my filter,
> > the system volume DO doesn’t reveive either. :frowning:
> >
> > But, I found, on a clean machine - without my filter, the
> > volume DO is not deleted when the CD is inserted and a new
> > volume DO is created. Why Windows does this?
> >
> > Regards,
> > Ray Yang
> > xxxxx@ybwork.com
> > ----- Original Message -----
> > From: “Nicholas Ryan”
> > To: “File Systems Developers”
> > Sent: Tuesday, December 03, 2002 3:28 PM
> > Subject: [ntfsd] RE: When a CD removed/inserted
> >
> >
> > > You detach/delete in response to
> > IRP_MJ_PNP/IRP_MN_REMOVE_DEVICE, and
> > > nowhere else. See the filter directory in the toaster sample for
> > > details.
> > >
> > > - Nicholas Ryan
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: xxxxx@lists.osr.com
> > > > [mailto:xxxxx@lists.osr.com] On Behalf Of Ray Yang
> > > > Sent: Monday, December 02, 2002 10:55 PM
> > > > To: File Systems Developers
> > > > Subject: [ntfsd] When a CD removed/inserted
> > > >
> > > >
> > > > Hi all,
> > > >
> > > > My driver is based on sfilter of 2KIFS Kit and filtering
> > some IRPs
> > > > to a CD-ROM drive in Win 2K.
> > > >
> > > > I found that when a CD is removed from the drive, the
> > volume DO is
> > > > not deleted, so my filter is also in the system. But,
> > when the CD is
> > > > inserted again, a new volume DO is created and my filter
> > creates a
> > > > new DO. Then, when does that old volume DO deleted by OS?
> > > >
> > > > I need to know when I can delete my filter DO safely when the new
> > > > one is created, because there are some resources in the device
> > > > extension which must be freed.
> > > >
> > > > Any ideas?
> > > >
> > > > Regards,
> > > > Ray Yang
> > > > xxxxx@ybwork.com
> > > >
> > > >
> > > >
> > > > —
> > > > You are currently subscribed to ntfsd as: xxxxx@nryan.com To
> > > > unsubscribe send a blank email to %%email.unsub%%
> > > >
> > >
> > >
> > >
> > > —
> > > You are currently subscribed to ntfsd as: xxxxx@ybwork.com To
> > > unsubscribe send a blank email to %%email.unsub%%
> > >
> >
> >
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@osr.com
> > To unsubscribe send a blank email to %%email.unsub%%
> >
> > —
> > You are currently subscribed to ntfsd as: xxxxx@nryan.com
> > To unsubscribe send a blank email to %%email.unsub%%
> >
>
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@ybwork.com
> To unsubscribe send a blank email to %%email.unsub%%
>