dosh.inc 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 1999-2000 by the Free Pascal development team.
  4. Dos unit for BP7 compatible RTL - Interface declarations
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. {$IFNDEF HAS_FILENAMELEN}
  12. Const
  13. FileNameLen = 255;
  14. {$ENDIF HAS_FILENAMELEN}
  15. {$IFDEF CPUI386}
  16. {$IFNDEF HAS_REGISTERS}
  17. type
  18. Registers = packed record
  19. case i : integer of
  20. 0 : (ax,f1,bx,f2,cx,f3,dx,f4,bp,f5,si,f51,di,f6,ds,f7,es,f8,flags,fs,gs : word);
  21. 1 : (al,ah,f9,f10,bl,bh,f11,f12,cl,ch,f13,f14,dl,dh : byte);
  22. 2 : (eax, ebx, ecx, edx, ebp, esi, edi : longint);
  23. End;
  24. {$ENDIF HAS_REGISTERS}
  25. {$ENDIF CPUI386}
  26. Const
  27. {Bitmasks for CPU Flags}
  28. fcarry = $0001;
  29. fparity = $0004;
  30. fauxiliary = $0010;
  31. fzero = $0040;
  32. fsign = $0080;
  33. foverflow = $0800;
  34. {Bitmasks for file attribute}
  35. readonly = $01;
  36. hidden = $02;
  37. sysfile = $04;
  38. volumeid = $08;
  39. directory = $10;
  40. archive = $20;
  41. anyfile = $3F;
  42. {File Status}
  43. fmclosed = $D7B0;
  44. fminput = $D7B1;
  45. fmoutput = $D7B2;
  46. fminout = $D7B3;
  47. Type
  48. { Needed for LFN Support }
  49. ComStr = String[FileNameLen];
  50. PathStr = String[FileNameLen];
  51. DirStr = String[FileNameLen];
  52. NameStr = String[FileNameLen];
  53. ExtStr = String[FileNameLen];
  54. {
  55. filerec.inc contains the definition of the filerec.
  56. textrec.inc contains the definition of the textrec.
  57. It is in a separate file to make it available in other units without
  58. having to use the DOS unit for it.
  59. }
  60. {$i filerec.inc}
  61. {$i textrec.inc}
  62. DateTime = packed record
  63. Year,
  64. Month,
  65. Day,
  66. Hour,
  67. Min,
  68. Sec : word;
  69. End;
  70. threadvar
  71. DosError : integer;
  72. {$ifdef cpui386}
  73. {Interrupt}
  74. Procedure Intr(intno: byte; var regs: registers);
  75. Procedure MSDos(var regs: registers);
  76. {$endif cpui386}
  77. {Info/Date/Time}
  78. Function DosVersion: Word;
  79. Procedure GetDate(var year, month, mday, wday: word);
  80. Procedure GetTime(var hour, minute, second, sec100: word);
  81. procedure SetDate(year,month,day: word);
  82. Procedure SetTime(hour,minute,second,sec100: word);
  83. Procedure UnpackTime(p: longint; var t: datetime);
  84. Procedure PackTime(var t: datetime; var p: longint);
  85. {Exec}
  86. Procedure Exec(const path: pathstr; const comline: comstr);
  87. Function DosExitCode: word;
  88. {Disk}
  89. Function DiskFree(drive: byte) : int64;
  90. Function DiskSize(drive: byte) : int64;
  91. Procedure FindFirst(const path: pathstr; attr: word; var f: searchRec);
  92. Procedure FindNext(var f: searchRec);
  93. Procedure FindClose(Var f: SearchRec);
  94. {File}
  95. Procedure GetFAttr(var f; var attr: word);
  96. Procedure GetFTime(var f; var time: longint);
  97. Function FSearch(path: pathstr; dirlist: string): pathstr;
  98. Function FExpand(const path: pathstr): pathstr;
  99. Procedure FSplit(path: pathstr; var dir: dirstr; var name: namestr; var ext: extstr);
  100. function GetShortName(var p : String) : boolean;
  101. function GetLongName(var p : String) : boolean;
  102. {Environment}
  103. Function EnvCount: longint;
  104. Function EnvStr (Index: longint): string;
  105. Function GetEnv(envvar: string): string;
  106. {Misc}
  107. Procedure SetFAttr(var f; attr: word);
  108. Procedure SetFTime(var f; time: longint);
  109. Procedure GetCBreak(var breakvalue: boolean);
  110. Procedure SetCBreak(breakvalue: boolean);
  111. Procedure GetVerify(var verify: boolean);
  112. Procedure SetVerify(verify: boolean);
  113. {Do Nothing Functions}
  114. Procedure SwapVectors;
  115. Procedure GetIntVec(intno: byte; var vector: pointer);
  116. Procedure SetIntVec(intno: byte; vector: pointer);
  117. Procedure Keep(exitcode: word);
  118. {Additional (non-TP) function for quick access to system timer - for FV etc.}
  119. Function GetMsCount: int64;
  120. {Offset between two return values corresponds to amount of milliseconds
  121. between the two calls, however the exact value is not guaranteed to have
  122. particular meaning - it can be e.g. amount of milliseconds since computer
  123. startup on DOS-like x86 platforms, derived from Unix time on Unix etc.}