sysutils.pp 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. {
  2. Sysutils unit for UEFI
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2014 by Olivier Coursière
  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. unit sysutils;
  12. interface
  13. {$MODE objfpc}
  14. {$MODESWITCH OUT}
  15. { force ansistrings }
  16. {$H+}
  17. {$modeswitch typehelpers}
  18. {$modeswitch advancedrecords}
  19. {$DEFINE HAS_SLEEP}
  20. { TODO : check this for UEFI }
  21. { used OS file system APIs use ansistring }
  22. {$define SYSUTILS_HAS_UNICODESTR_FILEUTIL_IMPL}
  23. { OS has an ansistring/single byte environment variable API (actually it's
  24. unicodestring, but that's not yet implemented) }
  25. {$define SYSUTILS_HAS_ANSISTR_ENVVAR_IMPL}
  26. { Include platform independent interface part }
  27. {$i sysutilh.inc}
  28. implementation
  29. uses
  30. sysconst;
  31. {$DEFINE FPC_NOGENERICANSIROUTINES}
  32. { Include platform independent implementation part }
  33. {$i sysutils.inc}
  34. {****************************************************************************
  35. File Functions
  36. ****************************************************************************}
  37. function FileOpen(const FileName : UnicodeString; Mode : Integer) : THandle;
  38. begin
  39. end;
  40. function FileCreate(const FileName : UnicodeString) : THandle;
  41. begin
  42. end;
  43. function FileCreate(const FileName : UnicodeString; Rights: longint) : THandle;
  44. begin
  45. end;
  46. function FileCreate(const FileName : UnicodeString; ShareMode : longint; Rights: longint) : THandle;
  47. begin
  48. end;
  49. function FileRead(Handle : THandle; out Buffer; Count : longint) : Longint;
  50. begin
  51. end;
  52. function FileWrite(Handle : THandle; const Buffer; Count : Longint) : Longint;
  53. begin
  54. end;
  55. function FileSeek(Handle : THandle;FOffset,Origin : Longint) : Longint;
  56. begin
  57. end;
  58. function FileSeek(Handle : THandle; FOffset: Int64; Origin: Longint) : Int64;
  59. begin
  60. end;
  61. procedure FileClose(Handle : THandle);
  62. begin
  63. end;
  64. function FileTruncate(Handle : THandle;Size: Int64) : boolean;
  65. begin
  66. end;
  67. function FileAge(const FileName: UnicodeString): Longint;
  68. begin
  69. { TODO }
  70. Result := -1;
  71. end;
  72. function FileExists(const FileName: UnicodeString): Boolean;
  73. begin
  74. end;
  75. Procedure InternalFindClose(var Handle: THandle);
  76. begin
  77. end;
  78. Function InternalFindNext (Var Rslt : TAbstractSearchRec; var Name: UnicodeString) : Longint;
  79. begin
  80. end;
  81. Function InternalFindFirst (Const Path : UnicodeString; Attr : Longint; out Rslt : TAbstractSearchRec; var Name : UnicodeString) : Longint;
  82. begin
  83. end;
  84. function DirectoryExists(const Directory : UnicodeString) : Boolean;
  85. begin
  86. end;
  87. function FileGetDate(Handle: THandle): Longint;
  88. begin
  89. end;
  90. function FileSetDate(Handle: THandle;Age: Longint): Longint;
  91. begin
  92. end;
  93. function FileGetAttr(const FileName: UnicodeString): Longint;
  94. begin
  95. end;
  96. function FileSetAttr(const Filename: UnicodeString; Attr: LongInt): Longint;
  97. begin
  98. end;
  99. function DeleteFile(const FileName: UnicodeString): Boolean;
  100. begin
  101. end;
  102. function RenameFile(const OldName, NewName: UnicodeString): Boolean;
  103. begin
  104. end;
  105. {****************************************************************************
  106. Disk Functions
  107. ****************************************************************************}
  108. function diskfree(drive: byte): int64;
  109. begin
  110. { here the mount manager needs to be queried }
  111. Result := -1;
  112. end;
  113. function disksize(drive: byte): int64;
  114. begin
  115. { here the mount manager needs to be queried }
  116. Result := -1;
  117. end;
  118. {****************************************************************************
  119. Time Functions
  120. ****************************************************************************}
  121. procedure GetLocalTime(var SystemTime: TSystemTime);
  122. begin
  123. end;
  124. {****************************************************************************
  125. Misc Functions
  126. ****************************************************************************}
  127. procedure sysbeep;
  128. begin
  129. { empty }
  130. end;
  131. procedure InitInternational;
  132. begin
  133. InitInternationalGeneric;
  134. end;
  135. {****************************************************************************
  136. Target Dependent
  137. ****************************************************************************}
  138. function SysErrorMessage(ErrorCode: Integer): String;
  139. begin
  140. Result := 'UEFI error code: 0x' + IntToHex(ErrorCode, 8);
  141. end;
  142. {****************************************************************************
  143. Initialization code
  144. ****************************************************************************}
  145. function GetEnvironmentVariable(const EnvVar: String): String;
  146. begin
  147. Result := '';
  148. end;
  149. function GetEnvironmentVariableCount: Integer;
  150. begin
  151. Result := 0;
  152. end;
  153. function GetEnvironmentString(Index: Integer): {$ifdef FPC_RTL_UNICODE}UnicodeString{$else}AnsiString{$endif};
  154. begin
  155. Result := '';
  156. end;
  157. function ExecuteProcess(const Path: AnsiString; const ComLine: AnsiString;
  158. Flags: TExecuteFlags = []): Integer;
  159. begin
  160. { TODO : implement }
  161. Result := 0;
  162. end;
  163. function ExecuteProcess(const Path: AnsiString;
  164. const ComLine: Array of AnsiString; Flags:TExecuteFlags = []): Integer;
  165. begin
  166. Result := 0;
  167. end;
  168. function ExecuteProcess(const Path: RawByteString; const ComLine: RawByteString;
  169. Flags: TExecuteFlags = []): Integer;
  170. begin
  171. { TODO : implement }
  172. Result := 0;
  173. end;
  174. function ExecuteProcess(const Path: RawByteString;
  175. const ComLine: Array of RawByteString; Flags:TExecuteFlags = []): Integer;
  176. var
  177. CommandLine: RawByteString;
  178. I: integer;
  179. begin
  180. Commandline := '';
  181. for I := 0 to High (ComLine) do
  182. if Pos (' ', ComLine [I]) <> 0 then
  183. CommandLine := CommandLine + ' ' + '"' + ComLine [I] + '"'
  184. else
  185. CommandLine := CommandLine + ' ' + Comline [I];
  186. ExecuteProcess := ExecuteProcess (Path, CommandLine,Flags);
  187. end;
  188. function ExecuteProcess(const Path: UnicodeString; const ComLine: UnicodeString;
  189. Flags: TExecuteFlags = []): Integer;
  190. begin
  191. { TODO : implement }
  192. Result := 0;
  193. end;
  194. function ExecuteProcess(const Path: UnicodeString;
  195. const ComLine: Array of UnicodeString; Flags:TExecuteFlags = []): Integer;
  196. var
  197. CommandLine: UnicodeString;
  198. I: integer;
  199. begin
  200. Commandline := '';
  201. for I := 0 to High (ComLine) do
  202. if Pos (' ', ComLine [I]) <> 0 then
  203. CommandLine := CommandLine + ' ' + '"' + ComLine [I] + '"'
  204. else
  205. CommandLine := CommandLine + ' ' + Comline [I];
  206. ExecuteProcess := ExecuteProcess (Path, CommandLine,Flags);
  207. end;
  208. procedure Sleep(Milliseconds: Cardinal);
  209. begin
  210. end;
  211. {****************************************************************************
  212. Initialization code
  213. ****************************************************************************}
  214. initialization
  215. InitExceptions; { Initialize exceptions. OS independent }
  216. InitInternational; { Initialize internationalization settings }
  217. OnBeep := @SysBeep;
  218. finalization
  219. DoneExceptions;
  220. end.