I'm trying to list available drives.
These functions show 3 letters, C, D, Z.
It can't ChDir to drive D:\ but C:\ and Z:\ work fine.
I don't think drive D: should be listed.
I am not a Windows programmer so I cobbled this code together.
function GetBit(Value: QWord; Index: Byte): Boolean;
begin
Result := ((Value shr Index) and 1) = 1;
end;
function GetDriveLetters(): TStringList;
{$ifdef Windows}
var dword : QWord;
letter : Char;
i : Byte = 0;
shortname : String;
{$endif}
begin
Result:=TStringList.Create();
{$ifdef Windows}
dword:=GetLogicalDrives();
for letter:='A' to 'Z' do
begin
if GetBit(dword,i)=True then
begin
shortname:='(DRIVE) '+letter+':\';
Result.Add( shortname );
end;
i:=i+1;
end;
{$endif}
end;