Click to Rate and Give Feedback
MSDN
MSDN Library
System Services
File Services
File Systems
Volume Management
 GetVolumeNameForVolumeMountPoint Fu...

  Switch on low bandwidth view
GetVolumeNameForVolumeMountPoint Function

Retrieves a volume GUID path for the volume that is associated with the specified volume mount point (drive letter, volume GUID path, or mounted folder).

Syntax

C++
BOOL WINAPI GetVolumeNameForVolumeMountPoint(
  __in   LPCTSTR lpszVolumeMountPoint,
  __out  LPTSTR lpszVolumeName,
  __in   DWORD cchBufferLength
);

Parameters

lpszVolumeMountPoint [in]

A pointer to a string that contains the path of a mounted folder (for example, Y:\MountX\) or a drive letter (for example, X:\). The string must end with a trailing backslash ('\').

lpszVolumeName [out]

A pointer to a string that receives the volume GUID path. This path is of the form "\\?\Volume{GUID}\" where GUID is a GUID that identifies the volume. If there is more than one volume GUID path for the volume, only the first one in the mount manager's cache is returned.

cchBufferLength [in]

The length of the output buffer, in TCHARs. A reasonable size for the buffer to accommodate the largest possible volume GUID path is 50 characters.

Return Value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Use GetVolumeNameForVolumeMountPoint to obtain a volume GUID path for use with functions such as SetVolumeMountPoint and FindFirstVolumeMountPoint that require a volume GUID path as an input parameter. For more information about volume GUID paths, see Naming A Volume.

To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0500 or later. For more information, see Using the Windows Headers.

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinBase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode and ANSI namesGetVolumeNameForVolumeMountPointW (Unicode) and GetVolumeNameForVolumeMountPointA (ANSI)

See Also

DeleteVolumeMountPoint
GetVolumePathName
SetVolumeMountPoint
Volume Management Functions
Mounted Folders

Send comments about this topic to Microsoft

Build date: 7/9/2009

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Call it twice?      udassomewhere   |   Edit   |   Show History
May need to call it twice to get the unique name - see http://blogs.msdn.com/adioltean/archive/2005/04/16/408947.aspx
Tags What's this?: Add a tag
Flag as ContentBug
Passing device interface path instead of mount point      IKonst   |   Edit   |   Show History

An undocumented feature of this function is that it can be used to map a device interface path to a volume name. A device interface path takes the form of:
\\?\STORAGE#RemovableMedia#7&3226b304&0&RM#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}

To use this feature, pass the device interface path instead of the mount point (in lpszVolumeMountPoint).

This feature can be used to map a volume device node to its mount point(s):
1. Find the volume device by looking for devices implementing GUID_DEVINTERFACE_VOLUME with SetupDiGetClassDevs(..., DIGCF_DEVICEINTERFACE) or by receiving PnP notifications (see RegisterDeviceNotificationW).
2. With PnP notifications, you should already have the device interface path. With SetupDi..., you should get it through SetupDiGetDeviceInterfaceDetail or the CM API (CM_Get_Device_Interface_List_SizeW).
3. Pass it to GetVolumeNameForVolumeMountPoint.
4. Use GetVolumePathNamesForVolumeName.

Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker