mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 00:19:25 +02:00
+ Implementation of functions by Gertjan Schouten
This commit is contained in:
parent
daecc1a750
commit
5433dea58d
@ -4,7 +4,7 @@
|
|||||||
Copyright (c) 1998 by the Free Pascal development team
|
Copyright (c) 1998 by the Free Pascal development team
|
||||||
|
|
||||||
Disk functions from Delphi's sysutils.pas
|
Disk functions from Delphi's sysutils.pas
|
||||||
|
|
||||||
See the file COPYING.FPC, included in this distribution,
|
See the file COPYING.FPC, included in this distribution,
|
||||||
for details about the copyright.
|
for details about the copyright.
|
||||||
|
|
||||||
@ -15,45 +15,75 @@
|
|||||||
**********************************************************************}
|
**********************************************************************}
|
||||||
|
|
||||||
Function DiskFree (Drive : Byte) : Longint;
|
Function DiskFree (Drive : Byte) : Longint;
|
||||||
|
var Regs: Registers;
|
||||||
begin
|
begin
|
||||||
|
Regs.Dl := Drive;
|
||||||
|
Regs.Ah := $36;
|
||||||
|
intr($21, Regs);
|
||||||
|
if Regs.Ax <> $FFFF then
|
||||||
|
result := Regs.Ax * Regs.Bx * Regs.Cx
|
||||||
|
else
|
||||||
|
result := -1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
Function DiskSize (Drive : Byte) : Longint;
|
Function DiskSize (Drive : Byte) : Longint;
|
||||||
|
var Regs: Registers;
|
||||||
begin
|
begin
|
||||||
|
Regs.Dl := Drive;
|
||||||
|
Regs.Ah := $36;
|
||||||
|
Intr($21, Regs);
|
||||||
|
if Regs.Ax <> $FFFF then
|
||||||
|
result := Regs.Ax * Regs.Cx * Regs.Dx
|
||||||
|
else
|
||||||
|
result := -1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
Function GetCurrentDir : String;
|
Function GetCurrentDir : String;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
GetDir(0, result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
Function SetCurrentDir (Const NewDir : String) : Boolean;
|
Function SetCurrentDir(Const NewDir : String) : Boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
{$I-}
|
||||||
|
ChDir(NewDir);
|
||||||
|
result := (IOResult = 0);
|
||||||
|
{$I+}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
Function CreateDir (Const NewDir : String) : Boolean;
|
Function CreateDir (Const NewDir : String) : Boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
{$I-}
|
||||||
|
MkDir(NewDir);
|
||||||
|
result := (IOResult = 0);
|
||||||
|
{$I+}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
Function RemoveDir (Const Dir : String) : Boolean;
|
Function RemoveDir (Const Dir : String) : Boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
{$I-}
|
||||||
|
RmDir(Dir);
|
||||||
|
result := (IOResult = 0);
|
||||||
|
{$I+}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.1 1998-10-11 13:42:55 michael
|
Revision 1.2 1998-10-30 14:13:13 michael
|
||||||
|
+ Implementation of functions by Gertjan Schouten
|
||||||
|
|
||||||
|
Revision 1.1 1998/10/11 13:42:55 michael
|
||||||
Added disk functions
|
Added disk functions
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user