GetVolumesFromDriveA function (ntmsapi.h)

[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 GetVolumesFromDriveA(
  [in]  LPSTR pszDriveName,
  [out] LPSTR *VolumeNameBufferPtr,
  [out] LPSTR *DriveLetterBufferPtr
);

Parameters

[in] pszDriveName

The name of the removable storage media drive.

[out] VolumeNameBufferPtr

The volume that represents the removable storage media drive.

[out] DriveLetterBufferPtr

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.

Note

The ntmsapi.h header defines GetVolumesFromDrive as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header ntmsapi.h
Library Ntmsapi.lib
DLL Ntmsapi.dll

See also

GetNtmsObjectInformation

Library Control Functions