All pastes #294527 Raw Edit

Mine

public text v1 · immutable
#294527 ·published 2006-12-28 16:24 UTC
rendered paste body
procedure GetDrvs;
const
  DRIVE_UNKNOWN             = 0;
  DRIVE_NO_ROOT_DIR         = 1;
  DRIVE_REMOVABLE           = 2;
  DRIVE_FIXED               = 3;
  DRIVE_REMOTE              = 4;
  DRIVE_CDROM               = 5;
  DRIVE_RAMDISK             = 6;
var
  R                         : LongWord;
  Drives                    : Array[0..128] of Char;
  pDrive                    : PChar;
  I                         : Integer;
begin
  R := GetLogicalDriveStrings(SizeOf(Drives), Drives);
  If r = 0 then
    Exit;
  If R > SizeOf(Drives) then
    raise Exception.Create(SysErrorMessage(ERROR_OUTOFMEMORY));
  pDrive := Drives;
  while pDrive^ <> #0 do
  begin
    if GetDriveType(pDrive) <> DRIVE_UNKNOWN then
      WriteLn(pDrive);
    Inc(pDrive, 4);
    end;
  end;
end;