Obtaining volume name with DeviceObject

From an earlier post of mine discussing RtlVolumeDeviceToDosName that
may be relevant:

“Internally, the system sends a IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH
request (which is undocumented but defined in mountmgr.h) to the mount
manager to return ONE of the MS-DOS paths for the volume (apparently
this will work with both persistent and non-persistent assignments,
unlike IOCTL_MOUNTMGR_QUERY_POINTS). Since a volume can of course have
multiple mount points, it may be a better idea to send an
IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATHS request yourself if you need to
track all of them (this IOCTL is also undocumented, but note the ‘S’ at
the end of ‘PATHS’ - apparently this flavor will return more than one
path).”

This may save a trip to user-mode.

  • Nick Ryan

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Richard
Cartwright
Sent: Thursday, June 05, 2003 8:47 PM
To: File Systems Developers
Subject: [ntfsd] RE: Obtaining volume name with DeviceObject

RtlVolumeDeviceToDosName() to obtain a drive letter for a
volume device object.
ObQueryNameString() to obtain the device name of a file
system device object.

There was a posting to the group a while back from Neal
Christiansen explaining that RtlVolumeDeviceToDosName() will
only give a drive letter for a volume but that in certain
circumstances (from memory, when the user messes around with
mount points, maps multiple drive letters, remaps drives
etc) the user may see a different drive letter. The right way
to do it was to pass the native name back up to your user
mode component and use the Mount Manager’s user mode APIs to
turn it back into a drive letter. Or something like that. You
might want to search the list archives for this (extremely
helpful) explanation.

Richard

> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of Myk Willis
> Sent: Wednesday, 4 June 2003 1:58 PM
> To: File Systems Developers
> Subject: [ntfsd] Obtaining volume name with DeviceObject
>
>
> Hello.
>
> I’m trying to obtain the volume name for the file
> system volume to which my file system filter driver
> has attached. I thought this was as simple as rolling
> an IRP_MJ_QUERY_VOLUME_INFORMATION and sending it to
> the target device, but the FS seems to choke since I
> have a NULL FileObject. (I obtain the file system
> device object pointer during the FsRegistrationChange callback, but
> pass the IRP down in a work item since doing it within the callback
> appears to cause a deadlock).
>
> I also tried digging into the VPB of the target device
> object directly, but it appears to always be NULL, at
> least during the callback.
>
> Can anyone tell me how to get the volume name when all
> I have is the file system device object pointer?
> (Win2k & WinXP)
>
> Thanks in advance.
> Myk
>
>
> —
> You are currently subscribed to ntfsd as:
xxxxx@spherical.com.au To
> unsubscribe send a blank email to xxxxx@lists.osr.com
>


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