Export (0) Print
Expand All

FindFirstVolume function

Retrieves the name of a volume on a computer. FindFirstVolume is used to begin scanning the volumes of a computer.

Syntax


HANDLE WINAPI FindFirstVolume(
  _Out_  LPTSTR lpszVolumeName,
  _In_   DWORD cchBufferLength
);

Parameters

lpszVolumeName [out]

A pointer to a buffer that receives a null-terminated string that specifies a volume GUID path for the first volume that is found.

cchBufferLength [in]

The length of the buffer to receive the volume GUID path, in TCHARs.

Return value

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 the volumes that are returned by these functions and the order of the volumes that are 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.

In Windows 8 and Windows Server 2012, this function is supported by the following technologies.

TechnologySupported

Server Message Block (SMB) 3.0 protocol

No

SMB 3.0 Transparent Failover (TFO)

No

SMB 3.0 with Scale-out File Shares (SO)

No

Cluster Shared Volume File System (CsvFS)

Yes

Resilient File System (ReFS)

Yes

 

SMB does not support volume management functions.

Examples

For an example, see Displaying Volume Paths.

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

FileAPI.h (include Windows.h);
WinBase.h on Windows Server 2008 R2, Windows 7, Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

Unicode and ANSI names

FindFirstVolumeW (Unicode) and FindFirstVolumeA (ANSI)

See also

FindNextVolume
FindVolumeClose
Volume Management Functions
Mounted Folders

 

 

Community Additions

ADD
Show:
© 2014 Microsoft