Subversion Repositories Kolibri OS

Rev

Rev 643 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 643 Rev 790
-
 
1
{utf8}
1
unit sysutils;
2
unit sysutils;
2
 
3
 
3
{$i _defines.inc}
4
{$i _defines.inc}
-
 
5
{$mode objfpc}
-
 
6
{$h+}
4
 
7
 
5
interface
8
interface
6
 
-
 
7
{$mode objfpc}
9
 
8
{ force ansistrings }
-
 
9
{$h+}
10
{ force ansistrings }
10
 
11
 
11
{$DEFINE HAS_SLEEP}
12
{$DEFINE HAS_SLEEP}
12
{-$DEFINE HAS_OSERROR}
13
{-$DEFINE HAS_OSERROR}
13
{-$DEFINE HAS_OSCONFIG}
14
{-$DEFINE HAS_OSCONFIG}
14
{-$DEFINE HAS_CREATEGUID}
15
{-$DEFINE HAS_CREATEGUID}
15
 
16
 
16
 
17
 
17
{ Include platform independent interface part }
18
{ Include platform independent interface part }
18
{$i sysutilh.inc}
19
{$i sysutilh.inc}
19
 
20
 
20
implementation
21
implementation
21
 
22
 
22
 
23
 
23
uses
24
uses
24
  SysConst;
25
  SysConst;
25
 
26
 
26
 
27
 
27
{-$define HASCREATEGUID}
28
{-$define HASCREATEGUID}
28
{-$define HASEXPANDUNCFILENAME}
29
{-$define HASEXPANDUNCFILENAME}
29
{-$DEFINE FPC_NOGENERICANSIROUTINES}
30
{-$DEFINE FPC_NOGENERICANSIROUTINES}
30
{-$DEFINE FPC_FEXPAND_UNC} (* UNC paths are supported *)
31
{-$DEFINE FPC_FEXPAND_UNC} (* UNC paths are supported *)
31
{-$DEFINE FPC_FEXPAND_DRIVES} (* Full paths begin with drive specification *)
32
{-$DEFINE FPC_FEXPAND_DRIVES} (* Full paths begin with drive specification *)
32
 
33
 
33
{ Include platform independent implementation part }
34
{ Include platform independent implementation part }
34
{$i sysutils.inc}
35
{$i sysutils.inc}
35
 
36
 
36
 
37
 
37
{****************************************************************************
38
{****************************************************************************
38
                              File Functions
39
                              File Functions
39
****************************************************************************}
40
****************************************************************************}
40
 
41
 
41
const
42
const
42
  FILEHANDLEPREFIX = $4000;
43
  FILEHANDLEPREFIX = $4000;
43
type
44
type
44
  PFileRecord = ^TFileRecord;
45
  PFileRecord = ^TFileRecord;
45
  TFileRecord = record
46
  TFileRecord = record
46
    Filled: Boolean;
47
    Filled: Boolean;
47
    F: File;
48
    F: File;
48
  end;
49
  end;
49
var
50
var
50
  FileHandles: array of TFileRecord;
51
  FileHandles: array of TFileRecord;
51
 
52
 
52
function FileRecordByHandle(Handle: THandle): PFileRecord;
53
function FileRecordByHandle(Handle: THandle): PFileRecord;
53
begin
54
begin
54
  Dec(Handle, FILEHANDLEPREFIX);
55
  Dec(Handle, FILEHANDLEPREFIX);
55
  Result := @FileHandles[Handle];
56
  Result := @FileHandles[Handle];
56
end;
57
end;
57
 
58
 
58
function CreateFileRecord(): THandle;
59
function CreateFileRecord(): THandle;
59
var
60
var
60
  I, C: Longword;
61
  I, C: Longword;
61
begin
62
begin
62
  Result := -1;
63
  Result := -1;
63
  C := Length(FileHandles);
64
  C := Length(FileHandles);
64
  for I := 0 to C - 1 do
65
  for I := 0 to C - 1 do
65
  if not FileHandles[I].Filled then
66
  if not FileHandles[I].Filled then
66
  begin
67
  begin
67
    Result := I;
68
    Result := I;
68
    Break;
69
    Break;
69
  end;
70
  end;
70
  if Result < 0 then
71
  if Result < 0 then
71
  begin
72
  begin
72
    SetLength(FileHandles, C + 1);
73
    SetLength(FileHandles, C + 1);
73
    Result := C;
74
    Result := C;
74
  end;
75
  end;
75
  FileHandles[Result].Filled := True;
76
  FileHandles[Result].Filled := True;
76
  FillChar(FileHandles[Result].F, SizeOf(FileRec), 0);
77
  FillChar(FileHandles[Result].F, SizeOf(FileRec), 0);
77
  Inc(Result, FILEHANDLEPREFIX);
78
  Inc(Result, FILEHANDLEPREFIX);
78
end;
79
end;
79
 
80
 
80
procedure ReleaseFileRecord(Handle: THandle);
81
procedure ReleaseFileRecord(Handle: THandle);
81
begin
82
begin
82
  FileRecordByHandle(Handle)^.Filled := False;
83
  FileRecordByHandle(Handle)^.Filled := False;
83
end;
84
end;
84
 
85
 
85
function FileOpen(const FileName: String; Mode: Integer): THandle;
86
function FileOpen(const FileName: String; Mode: Integer): THandle;
86
var
87
var
87
  F: File;
88
  F: File;
88
begin
89
begin
89
  Filemode := Mode;
90
  Filemode := Mode;
90
  Assign(F, FileName);
91
  Assign(F, FileName);
91
  Reset(F, 1);
92
  Reset(F, 1);
92
  if InOutRes = 0 then
93
  if InOutRes = 0 then
93
  begin
94
  begin
94
    Result := CreateFileRecord();
95
    Result := CreateFileRecord();
95
    FileRecordByHandle(Result)^.F := F;
96
    FileRecordByHandle(Result)^.F := F;
96
  end else
97
  end else
97
    Result := feInvalidHandle;
98
    Result := feInvalidHandle;
98
end;
99
end;
99
 
100
 
100
function FileCreate(const FileName: String): THandle;
101
function FileCreate(const FileName: String): THandle;
101
var
102
var
102
  F: File;
103
  F: File;
103
begin
104
begin
104
  Assign(F, FileName);
105
  Assign(F, FileName);
105
  Rewrite(F, 1);
106
  Rewrite(F, 1);
106
  if InOutRes = 0 then
107
  if InOutRes = 0 then
107
  begin
108
  begin
108
    Result := CreateFileRecord();
109
    Result := CreateFileRecord();
109
    FileRecordByHandle(Result)^.F := F;
110
    FileRecordByHandle(Result)^.F := F;
110
  end else
111
  end else
111
    Result := feInvalidHandle;
112
    Result := feInvalidHandle;
112
end;
113
end;
113
 
114
 
114
function FileCreate(const FileName: String; Mode: Integer): THandle;
115
function FileCreate(const FileName: String; Mode: Integer): THandle;
115
var
116
var
116
  F: File;
117
  F: File;
117
begin
118
begin
118
  Filemode := Mode;
119
  Filemode := Mode;
119
  Assign(F, FileName);
120
  Assign(F, FileName);
120
  Rewrite(F, 1);
121
  Rewrite(F, 1);
121
  if InOutRes = 0 then
122
  if InOutRes = 0 then
122
  begin
123
  begin
123
    Result := CreateFileRecord();
124
    Result := CreateFileRecord();
124
    FileRecordByHandle(Result)^.F := F;
125
    FileRecordByHandle(Result)^.F := F;
125
  end else
126
  end else
126
    Result := feInvalidHandle;
127
    Result := feInvalidHandle;
127
end;
128
end;
128
 
129
 
129
function FileRead(Handle: THandle; var Buffer; Count: Longint): Longint;
130
function FileRead(Handle: THandle; var Buffer; Count: Longint): Longint;
130
begin
131
begin
131
  BlockRead(FileRecordByHandle(Handle)^.F, Buffer, Count, Result);
132
  BlockRead(FileRecordByHandle(Handle)^.F, Buffer, Count, Result);
132
end;
133
end;
133
 
134
 
134
function FileWrite(Handle: THandle; const Buffer; Count: Longint): Longint;
135
function FileWrite(Handle: THandle; const Buffer; Count: Longint): Longint;
135
begin
136
begin
136
  BlockWrite(FileRecordByHandle(Handle)^.F, Buffer, Count, Result);
137
  BlockWrite(FileRecordByHandle(Handle)^.F, Buffer, Count, Result);
137
end;
138
end;
138
 
139
 
139
function FileSeek(Handle: THandle; FOffset, Origin: Longint): Longint;
140
function FileSeek(Handle: THandle; FOffset, Origin: Longint): Longint;
140
begin
141
begin
141
  Result := FileSeek(Handle, Int64(FOffset), Origin);
142
  Result := FileSeek(Handle, Int64(FOffset), Origin);
142
end;
143
end;
143
 
144
 
144
function FileSeek(Handle: THandle; FOffset: Int64; Origin: Longint): Int64;
145
function FileSeek(Handle: THandle; FOffset: Int64; Origin: Longint): Int64;
145
var
146
var
146
  Position: Int64;
147
  Position: Int64;
147
begin
148
begin
148
  case Origin of
149
  case Origin of
149
    fsFromBeginning: Position := FOffset;
150
    fsFromBeginning: Position := FOffset;
150
    fsFromCurrent: Position := FilePos(FileRecordByHandle(Handle)^.F) + FOffset;
151
    fsFromCurrent: Position := FilePos(FileRecordByHandle(Handle)^.F) + FOffset;
151
    fsFromEnd: Position := FileSize(FileRecordByHandle(Handle)^.F) + FOffset;
152
    fsFromEnd: Position := FileSize(FileRecordByHandle(Handle)^.F) + FOffset;
152
  end;
153
  end;
153
  {TODO: ¯à®¢¥àª  ᮮ⢥âá⢨ï [0..filesize]}
154
  {TODO: проверка соответствия [0..filesize]}
154
  Seek(FileRecordByHandle(Handle)^.F, Position);
155
  Seek(FileRecordByHandle(Handle)^.F, Position);
155
  Result := Position;
156
  Result := Position;
156
end;
157
end;
157
 
158
 
158
procedure FileClose(Handle: THandle);
159
procedure FileClose(Handle: THandle);
159
begin
160
begin
160
  Close(FileRecordByHandle(Handle)^.F);
161
  Close(FileRecordByHandle(Handle)^.F);
161
  ReleaseFileRecord(Handle);
162
  ReleaseFileRecord(Handle);
162
end;
163
end;
163
 
164
 
164
function FileTruncate(Handle: THandle; Size: Longint): Boolean;
165
function FileTruncate(Handle: THandle; Size: Longint): Boolean;
165
begin
166
begin
166
  Result := False;
167
  Result := False;
167
end;
168
end;
168
 
169
 
169
function FileAge(const FileName: String): Longint;
170
function FileAge(const FileName: String): Longint;
170
begin
171
begin
171
  Result := 0;
172
  Result := 0;
172
end;
173
end;
173
 
174
 
174
function FileExists(const FileName: String): Boolean;
175
function FileExists(const FileName: String): Boolean;
175
var
176
var
176
  F: File;
177
  F: File;
177
begin
178
begin
-
 
179
  {$i-}
178
  Assign(F, FileName);
180
  Assign(F, FileName);
179
  try
-
 
180
    Reset(F);
181
  Reset(F);
181
    FileSize(F);
182
  if IOResult = 0 then
-
 
183
  begin
182
    Result := True;
184
    Result := True;
183
  except
-
 
184
    Result := False;
-
 
185
  end;
-
 
186
  Close(F);
185
    Close(F);
-
 
186
  end else
-
 
187
    Result := False;
-
 
188
  {$i+}
187
end;
189
end;
188
 
190
 
189
function DirectoryExists(const Directory: String): Boolean;
191
function DirectoryExists(const Directory: String): Boolean;
190
begin
192
begin
191
  Result := False;
193
  Result := False;
192
end;
194
end;
193
 
195
 
194
function FindMatch(var f: TSearchRec): Longint;
196
function FindMatch(var f: TSearchRec): Longint;
195
begin
197
begin
196
  Result := feInvalidHandle;
198
  Result := feInvalidHandle;
197
end;
199
end;
198
 
200
 
199
function FindFirst(const Path: String; Attr: Longint; out Rslt: TSearchRec): Longint;
201
function FindFirst(const Path: String; Attr: Longint; out Rslt: TSearchRec): Longint;
200
begin
202
begin
201
  Result := feInvalidHandle;
203
  Result := feInvalidHandle;
202
end;
204
end;
203
 
205
 
204
function FindNext(var Rslt: TSearchRec): Longint;
206
function FindNext(var Rslt: TSearchRec): Longint;
205
begin
207
begin
206
  Result := feInvalidHandle;
208
  Result := feInvalidHandle;
207
end;
209
end;
208
 
210
 
209
procedure FindClose(var F: TSearchrec);
211
procedure FindClose(var F: TSearchrec);
210
begin
212
begin
211
end;
213
end;
212
 
214
 
213
function FileGetDate(Handle: THandle): Longint;
215
function FileGetDate(Handle: THandle): Longint;
214
begin
216
begin
215
  Result := feInvalidHandle;
217
  Result := feInvalidHandle;
216
end;
218
end;
217
 
219
 
218
function FileSetDate(Handle: THandle; Age: Longint): Longint;
220
function FileSetDate(Handle: THandle; Age: Longint): Longint;
219
begin
221
begin
220
  Result := feInvalidHandle;
222
  Result := feInvalidHandle;
221
end;
223
end;
222
 
224
 
223
function FileGetAttr(const FileName: String): Longint;
225
function FileGetAttr(const FileName: String): Longint;
224
begin
226
begin
225
  Result := feInvalidHandle;
227
  Result := feInvalidHandle;
226
end;
228
end;
227
 
229
 
228
function FileSetAttr(const Filename: String; Attr: longint): Longint;
230
function FileSetAttr(const Filename: String; Attr: longint): Longint;
229
begin
231
begin
230
  Result := feInvalidHandle;
232
  Result := feInvalidHandle;
231
end;
233
end;
232
 
234
 
233
function DeleteFile(const FileName: String): Boolean;
235
function DeleteFile(const FileName: String): Boolean;
234
begin
236
begin
235
  Result := False;
237
  Result := False;
236
end;
238
end;
237
 
239
 
238
function RenameFile(const OldName, NewName: String): Boolean;
240
function RenameFile(const OldName, NewName: String): Boolean;
239
begin
241
begin
240
  Result := False;
242
  Result := False;
241
end;
243
end;
242
 
244
 
243
 
245
 
244
{****************************************************************************
246
{****************************************************************************
245
                              Disk Functions
247
                              Disk Functions
246
****************************************************************************}
248
****************************************************************************}
247
 
249
 
248
function DiskFree(drive: Byte): Int64;
250
function DiskFree(drive: Byte): Int64;
249
begin
251
begin
250
  Result := 0;
252
  Result := 0;
251
end;
253
end;
252
 
254
 
253
function DiskSize(drive: Byte): Int64;
255
function DiskSize(drive: Byte): Int64;
254
begin
256
begin
255
  Result := 0;
257
  Result := 0;
256
end;
258
end;
257
 
259
 
258
function GetCurrentDir: String;
260
function GetCurrentDir: String;
259
begin
261
begin
260
  GetDir(0, Result);
262
  GetDir(0, Result);
261
end;
263
end;
262
 
264
 
263
function SetCurrentDir(const NewDir: String): Boolean;
265
function SetCurrentDir(const NewDir: String): Boolean;
264
var
266
var
265
  Path: String;
267
  Path: String;
266
begin
268
begin
267
  ChDir(NewDir);
269
  ChDir(NewDir);
268
  GetDir(0, Path);
270
  GetDir(0, Path);
269
  Result := Path = NewDir;
271
  Result := Path = NewDir;
270
end;
272
end;
271
 
273
 
272
function CreateDir(const NewDir: String): Boolean;
274
function CreateDir(const NewDir: String): Boolean;
273
begin
275
begin
274
  Result := False;
276
  Result := False;
275
end;
277
end;
276
 
278
 
277
function RemoveDir(const Dir: String): Boolean;
279
function RemoveDir(const Dir: String): Boolean;
278
begin
280
begin
279
  Result := False;
281
  Result := False;
280
end;
282
end;
281
 
283
 
282
 
284
 
283
{****************************************************************************
285
{****************************************************************************
284
                              Time Functions
286
                              Time Functions
285
****************************************************************************}
287
****************************************************************************}
286
 
288
 
287
procedure GetLocalTime(var SystemTime: TSystemTime);
289
procedure GetLocalTime(var SystemTime: TSystemTime);
288
begin
290
begin
289
end;
291
end;
290
 
292
 
291
 
293
 
292
{****************************************************************************
294
{****************************************************************************
293
                              Misc Functions
295
                              Misc Functions
294
****************************************************************************}
296
****************************************************************************}
295
 
297
 
296
procedure Beep;
298
procedure Beep;
297
begin
299
begin
298
end;
300
end;
299
 
301
 
300
 
302
 
301
{****************************************************************************
303
{****************************************************************************
302
                              Locale Functions
304
                              Locale Functions
303
****************************************************************************}
305
****************************************************************************}
304
 
306
 
305
procedure GetFormatSettings;
307
procedure GetFormatSettings;
306
var
308
var
307
  HF: String;
309
  HF: String;
308
begin
310
begin
309
  ShortMonthNames[1] := SShortMonthNameJan;
311
  ShortMonthNames[1] := SShortMonthNameJan;
310
  ShortMonthNames[2] := SShortMonthNameFeb;
312
  ShortMonthNames[2] := SShortMonthNameFeb;
311
  ShortMonthNames[3] := SShortMonthNameMar;
313
  ShortMonthNames[3] := SShortMonthNameMar;
312
  ShortMonthNames[4] := SShortMonthNameApr;
314
  ShortMonthNames[4] := SShortMonthNameApr;
313
  ShortMonthNames[5] := SShortMonthNameMay;
315
  ShortMonthNames[5] := SShortMonthNameMay;
314
  ShortMonthNames[6] := SShortMonthNameJun;
316
  ShortMonthNames[6] := SShortMonthNameJun;
315
  ShortMonthNames[7] := SShortMonthNameJul;
317
  ShortMonthNames[7] := SShortMonthNameJul;
316
  ShortMonthNames[8] := SShortMonthNameAug;
318
  ShortMonthNames[8] := SShortMonthNameAug;
317
  ShortMonthNames[9] := SShortMonthNameSep;
319
  ShortMonthNames[9] := SShortMonthNameSep;
318
  ShortMonthNames[10] := SShortMonthNameOct;
320
  ShortMonthNames[10] := SShortMonthNameOct;
319
  ShortMonthNames[11] := SShortMonthNameNov;
321
  ShortMonthNames[11] := SShortMonthNameNov;
320
  ShortMonthNames[12] := SShortMonthNameDec;
322
  ShortMonthNames[12] := SShortMonthNameDec;
321
 
323
 
322
  LongMonthNames[1] := SLongMonthNameJan;
324
  LongMonthNames[1] := SLongMonthNameJan;
323
  LongMonthNames[2] := SLongMonthNameFeb;
325
  LongMonthNames[2] := SLongMonthNameFeb;
324
  LongMonthNames[3] := SLongMonthNameMar;
326
  LongMonthNames[3] := SLongMonthNameMar;
325
  LongMonthNames[4] := SLongMonthNameApr;
327
  LongMonthNames[4] := SLongMonthNameApr;
326
  LongMonthNames[5] := SLongMonthNameMay;
328
  LongMonthNames[5] := SLongMonthNameMay;
327
  LongMonthNames[6] := SLongMonthNameJun;
329
  LongMonthNames[6] := SLongMonthNameJun;
328
  LongMonthNames[7] := SLongMonthNameJul;
330
  LongMonthNames[7] := SLongMonthNameJul;
329
  LongMonthNames[8] := SLongMonthNameAug;
331
  LongMonthNames[8] := SLongMonthNameAug;
330
  LongMonthNames[9] := SLongMonthNameSep;
332
  LongMonthNames[9] := SLongMonthNameSep;
331
  LongMonthNames[10] := SLongMonthNameOct;
333
  LongMonthNames[10] := SLongMonthNameOct;
332
  LongMonthNames[11] := SLongMonthNameNov;
334
  LongMonthNames[11] := SLongMonthNameNov;
333
  LongMonthNames[12] := SLongMonthNameDec;
335
  LongMonthNames[12] := SLongMonthNameDec;
334
 
336
 
335
  ShortDayNames[1] := SShortDayNameMon;
337
  ShortDayNames[1] := SShortDayNameMon;
336
  ShortDayNames[2] := SShortDayNameTue;
338
  ShortDayNames[2] := SShortDayNameTue;
337
  ShortDayNames[3] := SShortDayNameWed;
339
  ShortDayNames[3] := SShortDayNameWed;
338
  ShortDayNames[4] := SShortDayNameThu;
340
  ShortDayNames[4] := SShortDayNameThu;
339
  ShortDayNames[5] := SShortDayNameFri;
341
  ShortDayNames[5] := SShortDayNameFri;
340
  ShortDayNames[6] := SShortDayNameSat;
342
  ShortDayNames[6] := SShortDayNameSat;
341
  ShortDayNames[7] := SShortDayNameSun;
343
  ShortDayNames[7] := SShortDayNameSun;
342
 
344
 
343
  LongDayNames[1] := SLongDayNameMon;
345
  LongDayNames[1] := SLongDayNameMon;
344
  LongDayNames[2] := SLongDayNameTue;
346
  LongDayNames[2] := SLongDayNameTue;
345
  LongDayNames[3] := SLongDayNameWed;
347
  LongDayNames[3] := SLongDayNameWed;
346
  LongDayNames[4] := SLongDayNameThu;
348
  LongDayNames[4] := SLongDayNameThu;
347
  LongDayNames[5] := SLongDayNameFri;
349
  LongDayNames[5] := SLongDayNameFri;
348
  LongDayNames[6] := SLongDayNameSat;
350
  LongDayNames[6] := SLongDayNameSat;
349
  LongDayNames[7] := SShortDayNameSun;
351
  LongDayNames[7] := SShortDayNameSun;
350
 
352
 
351
  DateSeparator := '/';
353
  DateSeparator := '/';
352
  ShortDateFormat := 'd/mm/yy';
354
  ShortDateFormat := 'd/mm/yy';
353
  LongDateFormat := 'd mmmm yyyy';
355
  LongDateFormat := 'd mmmm yyyy';
354
  { Time stuff }
356
  { Time stuff }
355
  TimeSeparator := ':';
357
  TimeSeparator := ':';
356
  TimeAMString := 'AM';
358
  TimeAMString := 'AM';
357
  TimePMString := 'PM';
359
  TimePMString := 'PM';
358
  HF := 'hh';
360
  HF := 'hh';
359
  // No support for 12 hour stuff at the moment...
361
  // No support for 12 hour stuff at the moment...
360
  ShortTimeFormat := HF + ':nn';
362
  ShortTimeFormat := HF + ':nn';
361
  LongTimeFormat := HF + ':nn:ss';
363
  LongTimeFormat := HF + ':nn:ss';
362
  { Currency stuff }
364
  { Currency stuff }
363
  CurrencyString := '';
365
  CurrencyString := '';
364
  CurrencyFormat := 0;
366
  CurrencyFormat := 0;
365
  NegCurrFormat := 0;
367
  NegCurrFormat := 0;
366
  { Number stuff }
368
  { Number stuff }
367
  ThousandSeparator := ',';
369
  ThousandSeparator := ',';
368
  DecimalSeparator := '.';
370
  DecimalSeparator := '.';
369
  CurrencyDecimals := 2;
371
  CurrencyDecimals := 2;
370
end;
372
end;
371
 
373
 
372
Procedure InitInternational;
374
Procedure InitInternational;
373
begin
375
begin
374
  InitInternationalGeneric;
376
  InitInternationalGeneric;
375
  GetFormatSettings;
377
  GetFormatSettings;
376
end;
378
end;
377
 
379
 
378
 
380
 
379
{****************************************************************************
381
{****************************************************************************
380
                           Target Dependent
382
                           Target Dependent
381
****************************************************************************}
383
****************************************************************************}
382
 
384
 
383
function SysErrorMessage(ErrorCode: Integer): String;
385
function SysErrorMessage(ErrorCode: Integer): String;
384
const
386
const
385
  MaxMsgSize = 255;
387
  MaxMsgSize = 255;
386
var
388
var
387
  MsgBuffer: PChar;
389
  MsgBuffer: PChar;
388
begin
390
begin
389
  GetMem(MsgBuffer, MaxMsgSize);
391
  GetMem(MsgBuffer, MaxMsgSize);
390
  FillChar(MsgBuffer^, MaxMsgSize, #0);
392
  FillChar(MsgBuffer^, MaxMsgSize, #0);
391
  {TODO}
393
  {TODO}
392
  Result := StrPas(MsgBuffer);
394
  Result := StrPas(MsgBuffer);
393
  FreeMem(MsgBuffer, MaxMsgSize);
395
  FreeMem(MsgBuffer, MaxMsgSize);
394
end;
396
end;
395
 
397
 
396
{****************************************************************************
398
{****************************************************************************
397
                              Initialization code
399
                              Initialization code
398
****************************************************************************}
400
****************************************************************************}
399
 
401
 
400
Function GetEnvironmentVariable(Const EnvVar: String): String;
402
Function GetEnvironmentVariable(Const EnvVar: String): String;
401
begin
403
begin
402
  Result := '';
404
  Result := '';
403
end;
405
end;
404
 
406
 
405
Function GetEnvironmentVariableCount: Integer;
407
Function GetEnvironmentVariableCount: Integer;
406
begin
408
begin
407
  Result := 0;
409
  Result := 0;
408
end;
410
end;
409
 
411
 
410
Function GetEnvironmentString(Index : Integer) : String;
412
Function GetEnvironmentString(Index : Integer) : String;
411
begin
413
begin
412
  Result := '';
414
  Result := '';
413
end;
415
end;
414
 
416
 
415
function ExecuteProcess(Const Path: AnsiString; Const ComLine: AnsiString): Integer;
417
function ExecuteProcess(Const Path: AnsiString; Const ComLine: AnsiString): Integer;
416
begin
418
begin
417
  Result := 0;
419
  Result := 0;
418
end;
420
end;
419
 
421
 
420
function ExecuteProcess(Const Path: AnsiString; Const ComLine: Array of AnsiString): Integer;
422
function ExecuteProcess(Const Path: AnsiString; Const ComLine: Array of AnsiString): Integer;
421
var
423
var
422
  CommandLine: AnsiString;
424
  CommandLine: AnsiString;
423
  i: Integer;
425
  i: Integer;
424
begin
426
begin
425
  Commandline:='';
427
  Commandline:='';
426
  For i:=0 to high(ComLine) Do
428
  For i:=0 to high(ComLine) Do
427
   Commandline:=CommandLine+' '+Comline[i];
429
   Commandline:=CommandLine+' '+Comline[i];
428
  ExecuteProcess:=ExecuteProcess(Path,CommandLine);
430
  ExecuteProcess:=ExecuteProcess(Path,CommandLine);
429
end;
431
end;
430
 
432
 
431
procedure Sleep(Milliseconds: Cardinal);
433
procedure Sleep(Milliseconds: Cardinal);
432
begin
434
begin
433
  kos_delay(Milliseconds div 10);
435
  kos_delay(Milliseconds div 10);
434
end;
436
end;
435
 
437
 
436
function GetLastOSError: Integer;
438
function GetLastOSError: Integer;
437
begin
439
begin
438
  Result := -1;
440
  Result := -1;
439
end;
441
end;
440
 
442
 
441
 
443
 
442
 
444
 
443
initialization
445
initialization
444
  InitExceptions;
446
  InitExceptions;
445
  InitInternational;
447
  InitInternational;
446
finalization
448
finalization
447
  DoneExceptions;
449
  DoneExceptions;
448
end.
450
end.