disk.inc 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by the Free Pascal development team
  5. Disk functions from Delphi's sysutils.pas
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. Function DiskFree (Drive : Byte) : Longint;
  13. var
  14. Regs: Registers;
  15. begin
  16. Regs.Dl := Drive;
  17. Regs.Ah := $36;
  18. intr($21, Regs);
  19. if Regs.Ax <> $FFFF then
  20. result := Regs.Ax * Regs.Bx * Regs.Cx
  21. else
  22. result := -1;
  23. end;
  24. Function DiskSize (Drive : Byte) : Longint;
  25. var
  26. Regs: Registers;
  27. begin
  28. Regs.Dl := Drive;
  29. Regs.Ah := $36;
  30. Intr($21, Regs);
  31. if Regs.Ax <> $FFFF then
  32. result := Regs.Ax * Regs.Cx * Regs.Dx
  33. else
  34. result := -1;
  35. end;
  36. Function GetCurrentDir : String;
  37. begin
  38. GetDir(0, result);
  39. end;
  40. Function SetCurrentDir (Const NewDir : String) : Boolean;
  41. begin
  42. {$I-}
  43. ChDir(NewDir);
  44. result := (IOResult = 0);
  45. {$I+}
  46. end;
  47. Function CreateDir (Const NewDir : String) : Boolean;
  48. begin
  49. {$I-}
  50. MkDir(NewDir);
  51. result := (IOResult = 0);
  52. {$I+}
  53. end;
  54. Function RemoveDir (Const Dir : String) : Boolean;
  55. begin
  56. {$I-}
  57. RmDir(Dir);
  58. result := (IOResult = 0);
  59. {$I+}
  60. end;
  61. {
  62. $Log$
  63. Revision 1.4 2000-02-09 16:59:28 peter
  64. * truncated log
  65. Revision 1.3 2000/01/07 16:41:30 daniel
  66. * copyright 2000
  67. }