GetVolumesFromDrive Function

[Removable Storage Manager is no longer available as of Windows 7 and Windows Server 2008 R2.]

The GetVolumesFromDrive function retrieves the volume and drive letter for a given removable storage media drive.

Syntax

DWORD GetVolumesFromDrive(
  __in   LPWSTR  pszDriveName,
  __out  LPWSTR * VolumeNameBufferPtr,
  __out  LPWSTR * DriveLetterBufferPtr
);

Parameters

  • pszDriveName [in]
    The name of the removable storage media drive.

  • VolumeNameBufferPtr [out]
    The volume that represents the removable storage media drive.

  • DriveLetterBufferPtr [out]
    The drive letter that represents the removable storage media drive.

Return Value

If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value is one of the system error codes.

Remarks

This function assumes there will be only zero or one partitions on a removable disk, so there is at most one drive letter and one volume name.

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

End of client support

Windows Vista

End of server support

Windows Server 2008

Header

Ntmsapi.h

Library

Ntmsapi.lib

DLL

Ntmsapi.dll

Unicode and ANSI names

GetVolumesFromDriveW (Unicode) and GetVolumesFromDriveA (ANSI)

See Also

Library Control Functions

GetNtmsObjectInformation

 

 

Send comments about this topic to Microsoft

Build date: 6/9/2011