GetVolumeNameForVolumeMountPoint and unique volume name

Hi, I have a trouble with my driver. I’m writting a disk driver and a file system driver connected to it. The disk driver creates a virtual drive and I can browse this drive through MyComputer and everything is ok, but when I call user-mode win32 function “GetVolumeNameForVolumeMountPoint” on my drive, it fails with error 87 (ERROR_INVALID_PARAMETER), returned by GetLastError(), but the parameters I’m passing to it are absolutely correct (it succeeds on local hard drives). I’m handling
IOCTL_MOUNTDEV_QUERY_DEVICE_NAME
IOCTL_MOUNTDEV_QUERY_UNIQUE_ID
IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME
routines (I think correctly), but it still doesn’t work. I need to obtain unique volume name returned by “GetVolumeNameForVolumeMountPoint”, because this driver is used to collaborate with other kernel-mode software. Please help!

You must also do IoRegisterDeviceInterfac (MOUNTDEV_MOUNTED_DEVICE_GUID) in
AddDevice and then IoSetDeviceInterfaceState(TRUE) of it in MN_START_DEVICE.

MountMgr.sys is waiting for instances of this interface to arrive, and then
sends IOCTL_MOUNTDEV_xxx down to the device exposing this interface.

Then MountMgr updates the HKLM\SYSTEM\MountedDevices database and creates
the drive letter symlinks for the device.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntfsd…
> Hi, I have a trouble with my driver. I’m writting a disk driver and a file
system driver connected to it. The disk driver creates a virtual drive and I
can browse this drive through MyComputer and everything is ok, but when I call
user-mode win32 function “GetVolumeNameForVolumeMountPoint” on my drive, it
fails with error 87 (ERROR_INVALID_PARAMETER), returned by GetLastError(), but
the parameters I’m passing to it are absolutely correct (it succeeds on local
hard drives). I’m handling
> IOCTL_MOUNTDEV_QUERY_DEVICE_NAME
> IOCTL_MOUNTDEV_QUERY_UNIQUE_ID
> IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME
> routines (I think correctly), but it still doesn’t work. I need to obtain
unique volume name returned by “GetVolumeNameForVolumeMountPoint”, because this
driver is used to collaborate with other kernel-mode software. Please help!
>

Maxim, thank you for the answer,
My disk is virtual and I don’t have any physical device connected to it, so AddDevice and MN_START_DEVICE routines are never invoked. Where should I call IoRegisterDeviceInterface and IoSetDeviceInterfaceState. I tried to created PDO with IoReportDetectedDevice and when creating my virtual drive I’m calling IoRegisterDeviceInterface , but “GetVolumeNameForVolumeMountPoint” still fails with the same error (ERROR_INVALID_PARAMETER). Is there any relation between the symbolic link I’m creating for my virtual disk device and unique volume name (because that is the string I want to be shown for unique volume name)?