Subversion Repositories Kolibri OS

Rev

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

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