GetLogicalDrives (kernel32)
Last changed: XPD-203.189.186.66

.
Summary

C# Signature:

[DllImport("kernel32.dll")]
static extern uint GetLogicalDrives();

User-Defined Types:

None.

Notes:

Returns a 32 bit value representing the availability of the drives of the computer.

If A: is present first bit is 1. If C: is present 3rd bit is 1. If not present zero is assigned.

Use GetDriveType to find the type of the drive.

Tips & Tricks:

Please add some!

Sample Code:

uint shift=1;

uint dr = GetLogicalDrives();

Console.WriteLine("Your drives are ...\n");

for(int i = 0; i<26 ; i++){

    if((shift & dr) == 1)
        Console.WriteLine("{0}:",'a'+i);
    shift <<=1;

}

Alternative Managed API:

Documentation