dosh.inc 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. Dos unit for BP7 compatible RTL - Interface declarations
  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. {$IFNDEF HAS_FILENAMELEN}
  13. Const
  14. FileNameLen = 255;
  15. {$ENDIF HAS_FILENAMELEN}
  16. {$IFDEF CPUI386}
  17. {$IFNDEF HAS_REGISTERS}
  18. type
  19. Registers = packed record
  20. case i : integer of
  21. 0 : (ax,f1,bx,f2,cx,f3,dx,f4,bp,f5,si,f51,di,f6,ds,f7,es,f8,flags,fs,gs : word);
  22. 1 : (al,ah,f9,f10,bl,bh,f11,f12,cl,ch,f13,f14,dl,dh : byte);
  23. 2 : (eax, ebx, ecx, edx, ebp, esi, edi : longint);
  24. End;
  25. {$ENDIF HAS_REGISTERS}
  26. {$ENDIF CPUI386}
  27. Const
  28. {Bitmasks for CPU Flags}
  29. fcarry = $0001;
  30. fparity = $0004;
  31. fauxiliary = $0010;
  32. fzero = $0040;
  33. fsign = $0080;
  34. foverflow = $0800;
  35. {Bitmasks for file attribute}
  36. readonly = $01;
  37. hidden = $02;
  38. sysfile = $04;
  39. volumeid = $08;
  40. directory = $10;
  41. archive = $20;
  42. anyfile = $3F;
  43. {File Status}
  44. fmclosed = $D7B0;
  45. fminput = $D7B1;
  46. fmoutput = $D7B2;
  47. fminout = $D7B3;
  48. Type
  49. { Needed for LFN Support }
  50. ComStr = String[FileNameLen];
  51. PathStr = String[FileNameLen];
  52. DirStr = String[FileNameLen];
  53. NameStr = String[FileNameLen];
  54. ExtStr = String[FileNameLen];
  55. {
  56. filerec.inc contains the definition of the filerec.
  57. textrec.inc contains the definition of the textrec.
  58. It is in a separate file to make it available in other units without
  59. having to use the DOS unit for it.
  60. }
  61. {$i filerec.inc}
  62. {$i textrec.inc}
  63. DateTime = packed record
  64. Year,
  65. Month,
  66. Day,
  67. Hour,
  68. Min,
  69. Sec : word;
  70. End;
  71. {$ifdef HASTHREADVAR}
  72. threadvar
  73. {$else HASTHREADVAR}
  74. var
  75. {$endif HASTHREADVAR}
  76. DosError : integer;
  77. {$ifdef cpui386}
  78. {Interrupt}
  79. Procedure Intr(intno: byte; var regs: registers);
  80. Procedure MSDos(var regs: registers);
  81. {$endif cpui386}
  82. {Info/Date/Time}
  83. Function DosVersion: Word;
  84. Procedure GetDate(var year, month, mday, wday: word);
  85. Procedure GetTime(var hour, minute, second, sec100: word);
  86. procedure SetDate(year,month,day: word);
  87. Procedure SetTime(hour,minute,second,sec100: word);
  88. Procedure UnpackTime(p: longint; var t: datetime);
  89. Procedure PackTime(var t: datetime; var p: longint);
  90. {Exec}
  91. Procedure Exec(const path: pathstr; const comline: comstr);
  92. Function DosExitCode: word;
  93. {Disk}
  94. Function DiskFree(drive: byte) : int64;
  95. Function DiskSize(drive: byte) : int64;
  96. Procedure FindFirst(const path: pathstr; attr: word; var f: searchRec);
  97. Procedure FindNext(var f: searchRec);
  98. Procedure FindClose(Var f: SearchRec);
  99. {File}
  100. Procedure GetFAttr(var f; var attr: word);
  101. Procedure GetFTime(var f; var time: longint);
  102. Function FSearch(path: pathstr; dirlist: string): pathstr;
  103. Function FExpand(const path: pathstr): pathstr;
  104. Procedure FSplit(path: pathstr; var dir: dirstr; var name: namestr; var ext: extstr);
  105. function GetShortName(var p : String) : boolean;
  106. function GetLongName(var p : String) : boolean;
  107. {Environment}
  108. Function EnvCount: longint;
  109. Function EnvStr (Index: longint): string;
  110. Function GetEnv(envvar: string): string;
  111. {Misc}
  112. Procedure SetFAttr(var f; attr: word);
  113. Procedure SetFTime(var f; time: longint);
  114. Procedure GetCBreak(var breakvalue: boolean);
  115. Procedure SetCBreak(breakvalue: boolean);
  116. Procedure GetVerify(var verify: boolean);
  117. Procedure SetVerify(verify: boolean);
  118. {Do Nothing Functions}
  119. Procedure SwapVectors;
  120. Procedure GetIntVec(intno: byte; var vector: pointer);
  121. Procedure SetIntVec(intno: byte; vector: pointer);
  122. Procedure Keep(exitcode: word);
  123. {Additional (non-TP) function for quick access to system timer - for FV etc.}
  124. Function GetMsCount: int64;
  125. {Offset between two return values corresponds to amount of milliseconds
  126. between the two calls, however the exact value is not guaranteed to have
  127. particular meaning - it can be e.g. amount of milliseconds since computer
  128. startup on DOS-like x86 platforms, derived from Unix time on Unix etc.}
  129. {
  130. $Log$
  131. Revision 1.5 2004-12-05 19:02:57 hajny
  132. * GetMsCount added, platform independent routines moved to single include file
  133. Revision 1.4 2004/05/03 18:00:24 hajny
  134. * another global var to threadvar change, plus CVS log added
  135. Revision 1.3 2004/02/15 21:34:06 hajny
  136. * overloaded ExecuteProcess added, EnvStr param changed to longint
  137. Revision 1.2 2004/02/09 18:33:26 florian
  138. * intr and msdos for non i386 targets disabled
  139. Revision 1.1 2004/02/09 12:03:16 michael
  140. + Switched to single interface in dosh.inc
  141. }