problem with DeleteVolumeMountPoint()

Hi all,
I have written a program to unmount the CDROM using
DeleteVolumeMountPoint()
api. it works fine…it deletes the drive but i am not getting it back
after reboot. Evenif I reboot the system i cant get back CD drive…Can
any body pl tell me where is the problem???

what OS are you running, and what output do you get from mountvol (is the mount point still there)?

do you see something like:

C:\Users\xxxxxxxx>mountvol
Creates, deletes, or lists a volume mount point.

MOUNTVOL [drive:]path VolumeName
MOUNTVOL [drive:]path /D
MOUNTVOL [drive:]path /L
MOUNTVOL [drive:]path /P
MOUNTVOL /R
MOUNTVOL /N
MOUNTVOL /E

path Specifies the existing NTFS directory where the mount
point will reside.
VolumeName Specifies the volume name that is the target of the mount
point.
/D Removes the volume mount point from the specified directory.
/L Lists the mounted volume name for the specified directory.
/P Removes the volume mount point from the specified directory,
dismounts the volume, and makes the volume not mountable.
You can make the volume mountable again by creating a volume
mount point.
/R Removes volume mount point directories and registry settings
for volumes that are no longer in the system.
/N Disables automatic mounting of new volumes.
/E Re-enables automatic mounting of new volumes.

Possible values for VolumeName along with current mount points are:

\?\Volume{a8483b82-bd71-11db-baaa-00188b74af5c}\
F:\

\?\Volume{086c8e41-a124-11db-8f82-806e6f6e6963}\
C:\

\?\Volume{086c8e44-a124-11db-8f82-806e6f6e6963}\
*** NO MOUNT POINTS ***

----- Original Message -----
From: Himanshu
To: Windows System Software Devs Interest List
Sent: Wednesday, June 06, 2007 5:14 AM
Subject: [ntdev] problem with DeleteVolumeMountPoint()

Hi all,
I have written a program to unmount the CDROM using DeleteVolumeMountPoint() api. it works fine…it deletes the drive but i am not getting it back after reboot. Evenif I reboot the system i cant get back CD drive…Can any body pl tell me where is the problem???
— Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Note that when you delete a mount point it persists this across in reboots.
----- Original Message -----
From: Himanshu
To: Windows System Software Devs Interest List
Sent: Wednesday, June 06, 2007 5:14 AM
Subject: [ntdev] problem with DeleteVolumeMountPoint()

Hi all,
I have written a program to unmount the CDROM using DeleteVolumeMountPoint() api. it works fine…it deletes the drive but i am not getting it back after reboot. Evenif I reboot the system i cant get back CD drive…Can any body pl tell me where is the problem???
— Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

I am using XP, Win2000 and Vista…
actually my problem is something like this :
i want to block USB drive to system for that i have Windows Service which detects any usb device and unmounts it using DeleteVolumeMountPoint()…
now if i i stop Windows Service and reboot machine and insert usb drive it should be detected …but its not mounted…
is there any work around ???
or is there any API using which i can get the list of NOT MOUNTED volumes ???

What about using IOCTL_MOUNTMGR_DELETEPOINTS_DBONLY to unmount voulumes.???

I’m not sure what you mean by mounted. are you referring to the drive
letter? If you check with the mountvol tool I’m sure you will see a
mountpoint there (in GUID form) but the loss of the drive letter will be
persisted.

-Greg

----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Wednesday, June 06, 2007 9:49 PM
Subject: RE:[ntdev] problem with DeleteVolumeMountPoint()

>I am using XP, Win2000 and Vista…
> actually my problem is something like this :
> i want to block USB drive to system for that i have Windows Service which
> detects any usb device and unmounts it using DeleteVolumeMountPoint()…
> now if i i stop Windows Service and reboot machine and insert usb drive
> it should be detected …but its not mounted…
> is there any work around ???
> or is there any API using which i can get the list of NOT MOUNTED volumes
> ???
>
> What about using IOCTL_MOUNTMGR_DELETEPOINTS_DBONLY to unmount
> voulumes.???
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

You are correct gj I am not getting the drive letter…so can u tell me how
to get that drive letter…is there any api to get that drive letter…

On 6/7/07, gj wrote:
>
> I’m not sure what you mean by mounted. are you referring to the drive
> letter? If you check with the mountvol tool I’m sure you will see a
> mountpoint there (in GUID form) but the loss of the drive letter will be
> persisted.
>
> -Greg
>
>
>
> ----- Original Message -----
> From:
> To: “Windows System Software Devs Interest List”
> Sent: Wednesday, June 06, 2007 9:49 PM
> Subject: RE:[ntdev] problem with DeleteVolumeMountPoint()
>
> >I am using XP, Win2000 and Vista…
> > actually my problem is something like this :
> > i want to block USB drive to system for that i have Windows Service
> which
> > detects any usb device and unmounts it using DeleteVolumeMountPoint()…
> > now if i i stop Windows Service and reboot machine and insert usb drive
> > it should be detected …but its not mounted…
> > is there any work around ???
> > or is there any API using which i can get the list of NOT MOUNTED
> volumes
> > ???
> >
> > What about using IOCTL_MOUNTMGR_DELETEPOINTS_DBONLY to unmount
> > voulumes.???
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > To unsubscribe, visit the List Server section of OSR Online at
> > http://www.osronline.com/page.cfm?name=ListServer
> >
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

well if you are a service you can register for PnP notifications and restore the mount point - drive letter association yourself. To view the list of mount points use mountvol. I’ll look around and see if I can find an API for you. You can create a mount point with SetVolumeMountPointW.

-greg

----- Original Message -----
From: Himanshu
To: Windows System Software Devs Interest List
Sent: Thursday, June 07, 2007 9:48 PM
Subject: Re: RE:[ntdev] problem with DeleteVolumeMountPoint()

You are correct gj I am not getting the drive letter…so can u tell me how to get that drive letter…is there any api to get that drive letter…

On 6/7/07, gj wrote:
I’m not sure what you mean by mounted. are you referring to the drive
letter? If you check with the mountvol tool I’m sure you will see a
mountpoint there (in GUID form) but the loss of the drive letter will be
persisted.

-Greg

----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Wednesday, June 06, 2007 9:49 PM
Subject: RE:[ntdev] problem with DeleteVolumeMountPoint()

>I am using XP, Win2000 and Vista…
> actually my problem is something like this :
> i want to block USB drive to system for that i have Windows Service which
> detects any usb device and unmounts it using DeleteVolumeMountPoint()…
> now if i i stop Windows Service and reboot machine and insert usb drive
> it should be detected …but its not mounted…
> is there any work around ???
> or is there any API using which i can get the list of NOT MOUNTED volumes
> ???
>
> What about using IOCTL_MOUNTMGR_DELETEPOINTS_DBONLY to unmount
> voulumes.???
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

— Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Thnx a lot gj…I added code to create mountpoint with SetVolumeMountPoint
when DBT_DEVNODES_CHANGED message arrives…

On 6/9/07, gj wrote:
>
> well if you are a service you can register for PnP notifications and
> restore the mount point - drive letter association yourself. To view the
> list of mount points use mountvol. I’ll look around and see if I can find
> an API for you. You can create a mount point with SetVolumeMountPointW.
>
> -greg
>
>
>
>
> ----- Original Message -----
> From: Himanshu
> To: Windows System Software Devs Interest List
> Sent: Thursday, June 07, 2007 9:48 PM
> Subject: Re: RE:[ntdev] problem with DeleteVolumeMountPoint()
>
>
> You are correct gj I am not getting the drive letter…so can u tell me
> how to get that drive letter…is there any api to get that drive letter…
>
>
>
> On 6/7/07, gj wrote:
> >
> > I’m not sure what you mean by mounted. are you referring to the drive
> > letter? If you check with the mountvol tool I’m sure you will see a
> > mountpoint there (in GUID form) but the loss of the drive letter will be
> > persisted.
> >
> > -Greg
> >
> >
> >
> > ----- Original Message -----
> > From:
> > To: “Windows System Software Devs Interest List”
> > Sent: Wednesday, June 06, 2007 9:49 PM
> > Subject: RE:[ntdev] problem with DeleteVolumeMountPoint()
> >
> > >I am using XP, Win2000 and Vista…
> > > actually my problem is something like this :
> > > i want to block USB drive to system for that i have Windows Service
> > which
> > > detects any usb device and unmounts it using
> > DeleteVolumeMountPoint()…
> > > now if i i stop Windows Service and reboot machine and insert usb
> > drive
> > > it should be detected …but its not mounted…
> > > is there any work around ???
> > > or is there any API using which i can get the list of NOT MOUNTED
> > volumes
> > > ???
> > >
> > > What about using IOCTL_MOUNTMGR_DELETEPOINTS_DBONLY to unmount
> > > voulumes.???
> > >
> > > —
> > > Questions? First check the Kernel Driver FAQ at
> > > http://www.osronline.com/article.cfm?id=256
> > >
> > > To unsubscribe, visit the List Server section of OSR Online at
> > > http://www.osronline.com/page.cfm?name=ListServer
> > >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > To unsubscribe, visit the List Server section of OSR Online at
> > http://www.osronline.com/page.cfm?name=ListServer
> >
>
> — Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the List
> Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

You can also delete the registry key which blocks the drive letter creation
during the next boot. This key is located at:

L"\Registry\Machine\System\MountedDevices" (HKLM)

It looks like a # followed by a guid. ie:

“#{94487c81-1883-11dc-9459-00188b74af5c}” REG_BINARY
5c 00 3f 00 3f 00 5c 00 \ ? ? \
49 00 44 00 45 00 23 00 I D E #

The binary data is the MOUNTDEV_UNIQUE_ID data. You can determine that by
sending IOCTL_MOUNTDEV_QUERY_UNIQUE_ID to the drive.

----- Original Message -----
From: “gj”
To: “Windows System Software Devs Interest List”
Sent: Thursday, June 07, 2007 11:04 AM
Subject: Re: RE:[ntdev] problem with DeleteVolumeMountPoint()

> I’m not sure what you mean by mounted. are you referring to the drive
> letter? If you check with the mountvol tool I’m sure you will see a
> mountpoint there (in GUID form) but the loss of the drive letter will be
> persisted.
>
> -Greg
>
>
>
> ----- Original Message -----
> From:
> To: “Windows System Software Devs Interest List”
> Sent: Wednesday, June 06, 2007 9:49 PM
> Subject: RE:[ntdev] problem with DeleteVolumeMountPoint()
>
>>I am using XP, Win2000 and Vista…
>> actually my problem is something like this :
>> i want to block USB drive to system for that i have Windows Service which
>> detects any usb device and unmounts it using DeleteVolumeMountPoint()…
>> now if i i stop Windows Service and reboot machine and insert usb drive
>> it should be detected …but its not mounted…
>> is there any work around ???
>> or is there any API using which i can get the list of NOT MOUNTED volumes
>> ???
>>
>> What about using IOCTL_MOUNTMGR_DELETEPOINTS_DBONLY to unmount
>> voulumes.???
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
>> http://www.osronline.com/article.cfm?id=256
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>