Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTFSD
Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


When filesystems are dismounted?

OSR_Community_UserOSR_Community_User Member Posts: 110,217
Hi!

I'm writting disk driver for NT4 based on RamDisk sample . At ShutdownDispatch I want delete all device objects
I create that represent logical drives. I know that if I delete device while filesystem is still mounted on it
will lead to bad things. How can I be sure that filesystems are dismounted from my devices?
If they are not dismounted on ShutdownDispatch, how can I dismount them, or I need to delay
deletion of device objects?

Regards, Dennis


__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

Comments

  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    It's even worse than that. If you delete your physicaldiskx, nt4 disk admin
    will choke on any physicaldiskx+1. When disk admin runs it stops scanning
    for devices (remember, no plug-n-play) when it finds a physicaldiskx missing
    in sequence. Because of this little problem, you really can't allow disk
    drivers to be unloaded. W2K is different because of the plug-n-play stuff.

    > -----Original Message-----
    > From: [email protected]
    > [mailto:[email protected]]On Behalf Of Dennis
    > Sent: Sunday, April 23, 2000 9:22 AM
    > To: File Systems Developers
    > Subject: [ntfsd] When filesystems are dismounted?
    >
    >
    > Hi!
    >
    > I'm writting disk driver for NT4 based on RamDisk sample . At
    > ShutdownDispatch I want delete all device objects
    > I create that represent logical drives. I know that if I delete
    > device while filesystem is still mounted on it
    > will lead to bad things. How can I be sure that filesystems are
    > dismounted from my devices?
    > If they are not dismounted on ShutdownDispatch, how can I
    > dismount them, or I need to delay
    > deletion of device objects?
    >
    > Regards, Dennis
    >
    >
    >
    > __________________________________________________
    >
    > Do You Yahoo!?
    >
    > Talk to your friends online with Yahoo! Messenger.
    >
    > http://im.yahoo.com
    >
    >
    > ---
    > You are currently subscribed to ntfsd as: [email protected]
    > To unsubscribe send a blank email to $subst('Email.Unsub')
    >
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    Hi, Mike!

    Thanks for your answer. Is that mean that I dont need to implement
    ShutdownDispatch in my driver? Will it ever be unloaded?

    Regards, Dennis

    > -----Original Message-----
    > From: [email protected]
    > [mailto:[email protected]]On Behalf Of Mike Pittelkow
    > Sent: Monday, April 24, 2000 3:42 PM
    > To: File Systems Developers
    > Subject: [ntfsd] RE: When filesystems are dismounted?
    >
    >
    > It's even worse than that. If you delete your physicaldiskx, nt4
    > disk admin
    > will choke on any physicaldiskx+1. When disk admin runs it stops scanning
    > for devices (remember, no plug-n-play) when it finds a
    > physicaldiskx missing
    > in sequence. Because of this little problem, you really can't allow disk
    > drivers to be unloaded. W2K is different because of the
    > plug-n-play stuff.
    >
    > > -----Original Message-----
    > > From: [email protected]
    > > [mailto:[email protected]]On Behalf Of Dennis
    > > Sent: Sunday, April 23, 2000 9:22 AM
    > > To: File Systems Developers
    > > Subject: [ntfsd] When filesystems are dismounted?
    > >
    > >
    > > Hi!
    > >
    > > I'm writting disk driver for NT4 based on RamDisk sample . At
    > > ShutdownDispatch I want delete all device objects
    > > I create that represent logical drives. I know that if I delete
    > > device while filesystem is still mounted on it
    > > will lead to bad things. How can I be sure that filesystems are
    > > dismounted from my devices?
    > > If they are not dismounted on ShutdownDispatch, how can I
    > > dismount them, or I need to delay
    > > deletion of device objects?
    > >
    > > Regards, Dennis
    > >
    > >
    > >
    > > __________________________________________________
    > >
    > > Do You Yahoo!?
    > >
    > > Talk to your friends online with Yahoo! Messenger.
    > >
    > > http://im.yahoo.com
    > >
    > >
    > > ---
    > > You are currently subscribed to ntfsd as: [email protected]
    > > To unsubscribe send a blank email to $subst('Email.Unsub')
    > >
    >
    >
    > ---
    > You are currently subscribed to ntfsd as: [email protected]
    > To unsubscribe send a blank email to $subst('Email.Unsub')
    >


    __________________________________________________
    Do You Yahoo!?
    Talk to your friends online with Yahoo! Messenger.
    http://im.yahoo.com
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    You -cannot- allow unloading. Shutdown dispatch can close the backing file,
    but it then needs to return failure on read/write/create/close, etc for that
    volume. It must not delete the phsycaialdiskx devices. Additionally don't
    fill in the "unload" entry in the dispatch table. NT4 will not allow "boot
    start" drivers to be unloaded, even if this entry is there, but you never
    know what someone's going to try, so just don't put the entry in there.

    > -----Original Message-----
    > From: [email protected]
    > [mailto:[email protected]]On Behalf Of Dennis
    > Sent: Monday, April 24, 2000 9:54 AM
    > To: File Systems Developers
    > Subject: [ntfsd] RE: When filesystems are dismounted?
    >
    >
    > Hi, Mike!
    >
    > Thanks for your answer. Is that mean that I dont need to implement
    > ShutdownDispatch in my driver? Will it ever be unloaded?
    >
    > Regards, Dennis
    >
    > > -----Original Message-----
    > > From: [email protected]
    > > [mailto:[email protected]]On Behalf Of Mike Pittelkow
    > > Sent: Monday, April 24, 2000 3:42 PM
    > > To: File Systems Developers
    > > Subject: [ntfsd] RE: When filesystems are dismounted?
    > >
    > >
    > > It's even worse than that. If you delete your physicaldiskx, nt4
    > > disk admin
    > > will choke on any physicaldiskx+1. When disk admin runs it
    > stops scanning
    > > for devices (remember, no plug-n-play) when it finds a
    > > physicaldiskx missing
    > > in sequence. Because of this little problem, you really can't
    > allow disk
    > > drivers to be unloaded. W2K is different because of the
    > > plug-n-play stuff.
    > >
    > > > -----Original Message-----
    > > > From: [email protected]
    > > > [mailto:[email protected]]On Behalf Of Dennis
    > > > Sent: Sunday, April 23, 2000 9:22 AM
    > > > To: File Systems Developers
    > > > Subject: [ntfsd] When filesystems are dismounted?
    > > >
    > > >
    > > > Hi!
    > > >
    > > > I'm writting disk driver for NT4 based on RamDisk sample . At
    > > > ShutdownDispatch I want delete all device objects
    > > > I create that represent logical drives. I know that if I delete
    > > > device while filesystem is still mounted on it
    > > > will lead to bad things. How can I be sure that filesystems are
    > > > dismounted from my devices?
    > > > If they are not dismounted on ShutdownDispatch, how can I
    > > > dismount them, or I need to delay
    > > > deletion of device objects?
    > > >
    > > > Regards, Dennis
    > > >
    > > >
    > > >
    > > > __________________________________________________
    > > >
    > > > Do You Yahoo!?
    > > >
    > > > Talk to your friends online with Yahoo! Messenger.
    > > >
    > > > http://im.yahoo.com
    > > >
    > > >
    > > > ---
    > > > You are currently subscribed to ntfsd as: [email protected]
    > > > To unsubscribe send a blank email to $subst('Email.Unsub')
    > > >
    > >
    > >
    > > ---
    > > You are currently subscribed to ntfsd as: [email protected].com
    > > To unsubscribe send a blank email to $subst('Email.Unsub')
    > >
    >
    >
    >
    > __________________________________________________
    >
    > Do You Yahoo!?
    >
    > Talk to your friends online with Yahoo! Messenger.
    >
    > http://im.yahoo.com
    >
    >
    > ---
    > You are currently subscribed to ntfsd as: [email protected]
    > To unsubscribe send a blank email to $subst('Email.Unsub')
    >
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    This assumes that your disk is interested in being accessed via WinDisk. If
    you use your own partition mechanism; something more robust than the MS
    method, you can remove your disk. In fact, a RAMDISK is the perfect disk
    driver that can unload. I have done it myself in numerous disk drivers.

    > -----Original Message-----
    > From: [email protected]
    > [mailto:[email protected]]On Behalf Of Mike Pittelkow
    > Sent: Monday, April 24, 2000 6:42 AM
    > To: File Systems Developers
    > Subject: [ntfsd] RE: When filesystems are dismounted?
    >
    >
    > It's even worse than that. If you delete your physicaldiskx, nt4
    > disk admin
    > will choke on any physicaldiskx+1. When disk admin runs it stops scanning
    > for devices (remember, no plug-n-play) when it finds a
    > physicaldiskx missing
    > in sequence. Because of this little problem, you really can't allow disk
    > drivers to be unloaded. W2K is different because of the
    > plug-n-play stuff.
    >
    > > -----Original Message-----
    > > From: [email protected]
    > > [mailto:[email protected]]On Behalf Of Dennis
    > > Sent: Sunday, April 23, 2000 9:22 AM
    > > To: File Systems Developers
    > > Subject: [ntfsd] When filesystems are dismounted?
    > >
    > >
    > > Hi!
    > >
    > > I'm writting disk driver for NT4 based on RamDisk sample . At
    > > ShutdownDispatch I want delete all device objects
    > > I create that represent logical drives. I know that if I delete
    > > device while filesystem is still mounted on it
    > > will lead to bad things. How can I be sure that filesystems are
    > > dismounted from my devices?
    > > If they are not dismounted on ShutdownDispatch, how can I
    > > dismount them, or I need to delay
    > > deletion of device objects?
    > >
    > > Regards, Dennis
    > >
    > >
    > >
    > > __________________________________________________
    > >
    > > Do You Yahoo!?
    > >
    > > Talk to your friends online with Yahoo! Messenger.
    > >
    > > http://im.yahoo.com
    > >
    > >
    > > ---
    > > You are currently subscribed to ntfsd as: [email protected]
    > > To unsubscribe send a blank email to $subst('Email.Unsub')
    > >
    >
    >
    > ---
    > You are currently subscribed to ntfsd as: [email protected]
    > To unsubscribe send a blank email to $subst('Email.Unsub')
    >
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    Again, this assumes you care about NT partitioning semantics. If you do not,
    Uload is OK.

    > -----Original Message-----
    > From: [email protected]
    > [mailto:[email protected]]On Behalf Of Mike Pittelkow
    > Sent: Monday, April 24, 2000 7:23 AM
    > To: File Systems Developers
    > Subject: [ntfsd] RE: When filesystems are dismounted?
    >
    >
    > You -cannot- allow unloading. Shutdown dispatch can close the
    > backing file,
    > but it then needs to return failure on read/write/create/close,
    > etc for that
    > volume. It must not delete the phsycaialdiskx devices.
    > Additionally don't
    > fill in the "unload" entry in the dispatch table. NT4 will not
    > allow "boot
    > start" drivers to be unloaded, even if this entry is there, but you never
    > know what someone's going to try, so just don't put the entry in there.
    >
    > > -----Original Message-----
    > > From: [email protected]
    > > [mailto:[email protected]]On Behalf Of Dennis
    > > Sent: Monday, April 24, 2000 9:54 AM
    > > To: File Systems Developers
    > > Subject: [ntfsd] RE: When filesystems are dismounted?
    > >
    > >
    > > Hi, Mike!
    > >
    > > Thanks for your answer. Is that mean that I dont need to implement
    > > ShutdownDispatch in my driver? Will it ever be unloaded?
    > >
    > > Regards, Dennis
    > >
    > > > -----Original Message-----
    > > > From: [email protected]
    > > > [mailto:[email protected]]On Behalf Of Mike Pittelkow
    > > > Sent: Monday, April 24, 2000 3:42 PM
    > > > To: File Systems Developers
    > > > Subject: [ntfsd] RE: When filesystems are dismounted?
    > > >
    > > >
    > > > It's even worse than that. If you delete your physicaldiskx, nt4
    > > > disk admin
    > > > will choke on any physicaldiskx+1. When disk admin runs it
    > > stops scanning
    > > > for devices (remember, no plug-n-play) when it finds a
    > > > physicaldiskx missing
    > > > in sequence. Because of this little problem, you really can't
    > > allow disk
    > > > drivers to be unloaded. W2K is different because of the
    > > > plug-n-play stuff.
    > > >
    > > > > -----Original Message-----
    > > > > From: [email protected]
    > > > > [mailto:[email protected]]On Behalf Of Dennis
    > > > > Sent: Sunday, April 23, 2000 9:22 AM
    > > > > To: File Systems Developers
    > > > > Subject: [ntfsd] When filesystems are dismounted?
    > > > >
    > > > >
    > > > > Hi!
    > > > >
    > > > > I'm writting disk driver for NT4 based on RamDisk sample . At
    > > > > ShutdownDispatch I want delete all device objects
    > > > > I create that represent logical drives. I know that if I delete
    > > > > device while filesystem is still mounted on it
    > > > > will lead to bad things. How can I be sure that filesystems are
    > > > > dismounted from my devices?
    > > > > If they are not dismounted on ShutdownDispatch, how can I
    > > > > dismount them, or I need to delay
    > > > > deletion of device objects?
    > > > >
    > > > > Regards, Dennis
    > > > >
    > > > >
    > > > >
    > > > > __________________________________________________
    > > > >
    > > > > Do You Yahoo!?
    > > > >
    > > > > Talk to your friends online with Yahoo! Messenger.
    > > > >
    > > > > http://im.yahoo.com
    > > > >
    > > > >
    > > > > ---
    > > > > You are currently subscribed to ntfsd as: [email protected]
    > > > > To unsubscribe send a blank email to $subst('Email.Unsub')
    > > > >
    > > >
    > > >
    > > > ---
    > > > You are currently subscribed to ntfsd as: [email protected]
    > > > To unsubscribe send a blank email to $subst('Email.Unsub')
    > > >
    > >
    > >
    > >
    > > __________________________________________________
    > >
    > > Do You Yahoo!?
    > >
    > > Talk to your friends online with Yahoo! Messenger.
    > >
    > > http://im.yahoo.com
    > >
    > >
    > > ---
    > > You are currently subscribed to ntfsd as: [email protected]
    > > To unsubscribe send a blank email to $subst('Email.Unsub')
    > >
    >
    >
    > ---
    > You are currently subscribed to ntfsd as: [email protected]
    > To unsubscribe send a blank email to $subst('Email.Unsub')
    >
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    Unfortunately, it breaks disks that aren't yours when you do this. WinDisk
    (it's pretty brain damaged) stops scanning for devices when it finds a gap
    in the namespace. If your driver loads before another storage driver, after
    your driver unloads and deletes it's disk objects, the disks that belong to
    that other driver will no longer be accessible to windisk. They'll still
    work, but you can do anything complicated with them (ft sets can't be
    managed , volumes can't be extended, drive letters can't be assigned, etc)
    unless you use a complete third party volume manager, because windisk can't
    see them. Seems kind of unfriendly to break devices that aren't yours.

    That's my piont.

    Drivers are actually very small. There is no reason you can't make a driver
    that is always loaded, but only when a ramdisk exists does it respond to
    irps. Your memory penalty is fairly small in a running system (should be
    <75k or so). You can then use your driver specific tool to tell the driver
    to create and delete ramdisks, you just reuse disused or create new
    physicaldiskx objects as necessary. In this way you won't break other disks
    belonging to other drivers.

    > -----Original Message-----
    > From: [email protected]
    > [mailto:[email protected]]On Behalf Of Jamey Kirby
    > Sent: Monday, April 24, 2000 11:16 AM
    > To: File Systems Developers
    > Subject: [ntfsd] RE: When filesystems are dismounted?
    >
    >
    > This assumes that your disk is interested in being accessed via
    > WinDisk. If
    > you use your own partition mechanism; something more robust than the MS
    > method, you can remove your disk. In fact, a RAMDISK is the perfect disk
    > driver that can unload. I have done it myself in numerous disk drivers.
    >
    > > -----Original Message-----
    > > From: [email protected]
    > > [mailto:[email protected]]On Behalf Of Mike Pittelkow
    > > Sent: Monday, April 24, 2000 6:42 AM
    > > To: File Systems Developers
    > > Subject: [ntfsd] RE: When filesystems are dismounted?
    > >
    > >
    > > It's even worse than that. If you delete your physicaldiskx, nt4
    > > disk admin
    > > will choke on any physicaldiskx+1. When disk admin runs it
    > stops scanning
    > > for devices (remember, no plug-n-play) when it finds a
    > > physicaldiskx missing
    > > in sequence. Because of this little problem, you really can't
    > allow disk
    > > drivers to be unloaded. W2K is different because of the
    > > plug-n-play stuff.
    > >
    > > > -----Original Message-----
    > > > From: [email protected]
    > > > [mailto:[email protected]]On Behalf Of Dennis
    > > > Sent: Sunday, April 23, 2000 9:22 AM
    > > > To: File Systems Developers
    > > > Subject: [ntfsd] When filesystems are dismounted?
    > > >
    > > >
    > > > Hi!
    > > >
    > > > I'm writting disk driver for NT4 based on RamDisk sample . At
    > > > ShutdownDispatch I want delete all device objects
    > > > I create that represent logical drives. I know that if I delete
    > > > device while filesystem is still mounted on it
    > > > will lead to bad things. How can I be sure that filesystems are
    > > > dismounted from my devices?
    > > > If they are not dismounted on ShutdownDispatch, how can I
    > > > dismount them, or I need to delay
    > > > deletion of device objects?
    > > >
    > > > Regards, Dennis
    > > >
    > > >
    > > >
    > > > __________________________________________________
    > > >
    > > > Do You Yahoo!?
    > > >
    > > > Talk to your friends online with Yahoo! Messenger.
    > > >
    > > > http://im.yahoo.com
    > > >
    > > >
    > > > ---
    > > > You are currently subscribed to ntfsd as: [email protected]
    > > > To unsubscribe send a blank email to $subst('Email.Unsub')
    > > >
    > >
    > >
    > > ---
    > > You are currently subscribed to ntfsd as: [email protected]
    > > To unsubscribe send a blank email to $subst('Email.Unsub')
    > >
    >
    >
    > ---
    > You are currently subscribed to ntfsd as: [email protected]
    > To unsubscribe send a blank email to $subst('Email.Unsub')
    >
  • OSR_Community_User-35OSR_Community_User-35 Member Posts: 154
    He may not be creating HarddiskN directory objects or PhysicalDriveN:
    symbolic
    links. If he creates disk and partition device objects, and drive-letter
    links to them,
    and is willing to be absent from the disk list in WinDisk, the rest isn't
    necessary.

    -----------------------------------------------------------------------
    Dave Cox
    Hewlett-Packard Co.
    HPSO/SSMO (Santa Barbara)
    https://ecardfile.com/id/Dave+Cox


    -----Original Message-----
    From: Mike Pittelkow [mailto:[email protected]]
    Sent: Monday, April 24, 2000 12:48 PM
    To: File Systems Developers
    Subject: [ntfsd] RE: When filesystems are dismounted?


    Unfortunately, it breaks disks that aren't yours when you do this. WinDisk
    (it's pretty brain damaged) stops scanning for devices when it finds a gap
    in the namespace. If your driver loads before another storage driver, after
    your driver unloads and deletes it's disk objects, the disks that belong to
    that other driver will no longer be accessible to windisk. They'll still
    work, but you can do anything complicated with them (ft sets can't be
    managed , volumes can't be extended, drive letters can't be assigned, etc)
    unless you use a complete third party volume manager, because windisk can't
    see them. Seems kind of unfriendly to break devices that aren't yours.

    That's my piont.

    Drivers are actually very small. There is no reason you can't make a driver
    that is always loaded, but only when a ramdisk exists does it respond to
    irps. Your memory penalty is fairly small in a running system (should be
    <75k or so). You can then use your driver specific tool to tell the driver
    to create and delete ramdisks, you just reuse disused or create new
    physicaldiskx objects as necessary. In this way you won't break other disks
    belonging to other drivers.

    > -----Original Message-----
    > From: [email protected]
    > [mailto:[email protected]r.com]On Behalf Of Jamey Kirby
    > Sent: Monday, April 24, 2000 11:16 AM
    > To: File Systems Developers
    > Subject: [ntfsd] RE: When filesystems are dismounted?
    >
    >
    > This assumes that your disk is interested in being accessed via
    > WinDisk. If
    > you use your own partition mechanism; something more robust than the MS
    > method, you can remove your disk. In fact, a RAMDISK is the perfect disk
    > driver that can unload. I have done it myself in numerous disk drivers.
    >
    > > -----Original Message-----
    > > From: [email protected]
    > > [mailto:[email protected]]On Behalf Of Mike Pittelkow
    > > Sent: Monday, April 24, 2000 6:42 AM
    > > To: File Systems Developers
    > > Subject: [ntfsd] RE: When filesystems are dismounted?
    > >
    > >
    > > It's even worse than that. If you delete your physicaldiskx, nt4
    > > disk admin
    > > will choke on any physicaldiskx+1. When disk admin runs it
    > stops scanning
    > > for devices (remember, no plug-n-play) when it finds a
    > > physicaldiskx missing
    > > in sequence. Because of this little problem, you really can't
    > allow disk
    > > drivers to be unloaded. W2K is different because of the
    > > plug-n-play stuff.
    > >
    > > > -----Original Message-----
    > > > From: [email protected]
    > > > [mailto:[email protected]]On Behalf Of Dennis
    > > > Sent: Sunday, April 23, 2000 9:22 AM
    > > > To: File Systems Developers
    > > > Subject: [ntfsd] When filesystems are dismounted?
    > > >
    > > >
    > > > Hi!
    > > >
    > > > I'm writting disk driver for NT4 based on RamDisk sample . At
    > > > ShutdownDispatch I want delete all device objects
    > > > I create that represent logical drives. I know that if I delete
    > > > device while filesystem is still mounted on it
    > > > will lead to bad things. How can I be sure that filesystems are
    > > > dismounted from my devices?
    > > > If they are not dismounted on ShutdownDispatch, how can I
    > > > dismount them, or I need to delay
    > > > deletion of device objects?
    > > >
    > > > Regards, Dennis
    > > >
    > > >
    > > >
    > > > __________________________________________________
    > > >
    > > > Do You Yahoo!?
    > > >
    > > > Talk to your friends online with Yahoo! Messenger.
    > > >
    > > > http://im.yahoo.com
    > > >
    > > >
    > > > ---
    > > > You are currently subscribed to ntfsd as: [email protected]
    > > > To unsubscribe send a blank email to $subst('Email.Unsub')
    > > >
    > >
    > >
    > > ---
    > > You are currently subscribed to ntfsd as: [email protected]
    > > To unsubscribe send a blank email to $subst('Email.Unsub')
    > >
    >
    >
    > ---
    > You are currently subscribed to ntfsd as: [email protected]
    > To unsubscribe send a blank email to $subst('Email.Unsub')
    >


    ---
    You are currently subscribed to ntfsd as: [email protected]
    To unsubscribe send a blank email to $subst('Email.Unsub')
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Writing WDF Drivers 7 Dec 2020 LIVE ONLINE
Internals & Software Drivers 25 Jan 2021 LIVE ONLINE
Developing Minifilters 8 March 2021 LIVE ONLINE