Platform SDK: Files and I/O

FindFirstVolume

The FindFirstVolume function returns the name of a volume on a computer. FindFirstVolume is used to begin scanning the volumes of a computer.

HANDLE FindFirstVolume(
  LPTSTR lpszVolumeName,   // output buffer
  DWORD cchBufferLength    // size of output buffer
);

Parameters

lpszVolumeName
[out] Pointer to a buffer that receives the unique volume name of the first volume found.
cchBufferLength
[in] Length, in TCHARs, of the buffer to receive the name.

Return Values

If the function succeeds, the return value is a search handle used in a subsequent call to the FindNextVolume and FindVolumeClose functions.

If the function fails to find any volumes, the return value is the INVALID_HANDLE_VALUE error code. To get extended error information, call GetLastError.

Remarks

The FindFirstVolume function opens a volume search handle and returns information about the first volume found on a computer. After the search handle is established, you can use the FindNextVolume function to search for other volumes. When the search handle is no longer needed, close it by using the FindVolumeClose function.

You should not assume any correlation between the order of volumes returned with these functions and the order of volumes on the computer. In particular, do not assume any correlation between volume order and drive letters as assigned by the BIOS (if any) or the Disk Administrator.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Unsupported.
  Header: Declared in Winbase.h; include Windows.h.
  Library: Use Kernel32.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows 2000.

See Also

File Systems Overview, File System Functions, FindNextVolume, FindVolumeClose