GetLogicalDrives function
Applies to: desktop apps only
Retrieves a bitmask representing the currently available disk drives.
Syntax
DWORD WINAPI GetLogicalDrives(void);
Parameters
This function has no parameters.
Return value
If the function succeeds, the return value is a bitmask representing the currently available disk drives. Bit position 0 (the least-significant bit) is drive A, bit position 1 is drive B, bit position 2 is drive C, and so on.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Requirements
|
Minimum supported client | Windows XP |
|---|---|
|
Minimum supported server | Windows Server 2003 |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
Send comments about this topic to Microsoft
Build date: 4/17/2012
UAC Effects Access to Mapped Drives
If a network share is mapped to a drive letter from within an elevated process, GetLogicalDrives called from a non-elevated process will not see the mapped drive. That seems somewhat logical. Conversely, a network share mapped to a drive letter from within a non-elevated process will not be seen by an elevated process calling GetLogicalDrives. This is very unexpected. Other drive related functions like GetDriveType also exhibit this peculiar behavior.
- 2/22/2012
- cwindhausen2
vb.net syntax
[DllImport("kernel32.dll", CharSet:=CharSet.Unicode, SetLastError:=True)> _
Public Shared Function GetLogicalDrives() As Integer
End Function