Kernel32GetLogicalDriveStrings Method

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

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Kernel32.dll", CharSet = CharSet.Auto, BestFitMapping = false, 
	ThrowOnUnmappableChar = true, SetLastError = true)]
public static uint GetLogicalDriveStrings(
	uint bufferLength,
	StringBuilder buffer
)

Parameters

bufferLength  UInt32
The maximum size of the buffer pointed to by buffer, in characters. This size does not include the terminating null character.

If this parameter is zero, buffer is not used.

buffer  StringBuilder
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

UInt32
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 bufferLength. It is the size of the buffer required to hold the drive strings.

If the function fails, the return value is zero.

Remarks

See Also