0% found this document useful (0 votes)
184 views3 pages

GetLogicalDriveStringsA Function (Winbase.h) - Win32 Apps - Microsoft Learn

The GetLogicalDriveStringsA function fills a buffer with strings specifying valid drives in the system. It returns a concatenation of drives in the Global and Local MS-DOS Device namespaces. If the buffer is not large enough to hold all the drive strings, the return value indicates the required buffer size. The function returns the number of characters copied to the buffer on success or zero on failure.

Uploaded by

Juan Riz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
184 views3 pages

GetLogicalDriveStringsA Function (Winbase.h) - Win32 Apps - Microsoft Learn

The GetLogicalDriveStringsA function fills a buffer with strings specifying valid drives in the system. It returns a concatenation of drives in the Global and Local MS-DOS Device namespaces. If the buffer is not large enough to hold all the drive strings, the return value indicates the required buffer size. The function returns the number of characters copied to the buffer on success or zero on failure.

Uploaded by

Juan Riz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

17/10/22, 15:49 GetLogicalDriveStringsA function (winbase.

h) - Win32 apps | Microsoft Learn

GetLogicalDriveStringsA function
(winbase.h)
Article • 07/28/20222 minutes to read

Fills a buffer with strings that specify valid drives in the system.

Syntax

C++

DWORD GetLogicalDriveStringsA(

[in] DWORD nBufferLength,

[out] LPSTR lpBuffer

);

Parameters
[in] nBufferLength

The maximum size of the buffer pointed to by lpBuffer, in


TCHARs. This size does not
include the terminating null character. If this
parameter is zero, lpBuffer is not used.

[out] lpBuffer

A pointer to a buffer that receives a series of null-terminated strings, one for each valid
drive in the
system, plus with an additional null character. Each string is a device name.

Return value
If the function succeeds, the return value is the length, in characters, of the strings
copied to the buffer,
not including the terminating null character. Note that an ANSI-
ASCII null character uses one byte, but a
Unicode (UTF-16) null character uses two
bytes.

If the buffer is not large enough, the return value is greater than nBufferLength.
It is the
size of the buffer required to hold the drive strings.

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

https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getlogicaldrivestringsa 1/3
17/10/22, 15:49 GetLogicalDriveStringsA function (winbase.h) - Win32 apps | Microsoft Learn

Remarks
Each string in the buffer may be used wherever a root directory is required, such as for
the
GetDriveType and
GetDiskFreeSpace functions.

This function returns a concatenation of the drives in the Global and Local MS-DOS
Device namespaces. If a
drive exists in both namespaces, this function will return the
entry in the Local MS-DOS Device namespace. For
more information, see
Defining an
MS DOS Device Name.

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


technologies.

Technology Supported

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


Obtaining a File Name From a File Handle.

Requirements
   

Minimum supported client Windows XP [desktop apps only]

Minimum supported server Windows Server 2003 [desktop apps only]

Target Platform Windows

Header winbase.h (include Windows.h)

Library Kernel32.lib

https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getlogicaldrivestringsa 2/3
17/10/22, 15:49 GetLogicalDriveStringsA function (winbase.h) - Win32 apps | Microsoft Learn

   

DLL Kernel32.dll

See also
GetDiskFreeSpace

GetDriveType

GetLogicalDrives

Volume Management Functions

https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getlogicaldrivestringsa 3/3

You might also like