system.pp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  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. See the file COPYING.FPC, included in this distribution,
  5. for details about the copyright.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. **********************************************************************}
  10. unit system;
  11. interface
  12. { two debug conditionnals can be used
  13. - SYSTEMDEBUG
  14. -for STACK checks
  15. -for non closed files at exit (or at any time with GDB)
  16. - SYSTEM_DEBUG_STARTUP
  17. specifically for
  18. - proxy command line (DJGPP feature)
  19. - list of args
  20. - list of env variables (PM) }
  21. {$ifndef NO_EXCEPTIONS_IN_SYSTEM}
  22. {$define EXCEPTIONS_IN_SYSTEM}
  23. {$endif NO_EXCEPTIONS_IN_SYSTEM}
  24. {$define USE_NOTHREADMANAGER}
  25. { include system-independent routine headers }
  26. {$I systemh.inc}
  27. const
  28. LineEnding = #13#10;
  29. { LFNSupport is a variable here, defined below!!! }
  30. DirectorySeparator = '\';
  31. DriveSeparator = ':';
  32. ExtensionSeparator = '.';
  33. PathSeparator = ';';
  34. AllowDirectorySeparators : set of char = ['\','/'];
  35. AllowDriveSeparators : set of char = [':'];
  36. { FileNameCaseSensitive and FileNameCasePreserving are defined separately below!!! }
  37. maxExitCode = 255;
  38. MaxPathLen = 256;
  39. const
  40. { Default filehandles }
  41. UnusedHandle = -1;
  42. StdInputHandle = 0;
  43. StdOutputHandle = 1;
  44. StdErrorHandle = 2;
  45. FileNameCaseSensitive : boolean = false;
  46. FileNameCasePreserving: boolean = false;
  47. CtrlZMarksEOF: boolean = true; (* #26 is considered as end of file *)
  48. sLineBreak = LineEnding;
  49. DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF;
  50. { Default memory segments (Tp7 compatibility) }
  51. seg0040 = $0040;
  52. segA000 = $A000;
  53. segB000 = $B000;
  54. segB800 = $B800;
  55. var
  56. { Mem[] support }
  57. mem : array[0..$7fffffff-1] of byte absolute $0:$0;
  58. memw : array[0..($7fffffff div sizeof(word))-1] of word absolute $0:$0;
  59. meml : array[0..($7fffffff div sizeof(longint))-1] of longint absolute $0:$0;
  60. { C-compatible arguments and environment }
  61. argc:longint;public name 'operatingsystem_parameter_argc';
  62. argv:PPchar;public name 'operatingsystem_parameter_argv';
  63. envp:PPchar;public name 'operatingsystem_parameter_envp';
  64. dos_argv0 : pchar; public name 'dos_argv0';
  65. AllFilesMask: string [3];
  66. {$ifndef RTLLITE}
  67. { System info }
  68. LFNSupport : boolean;
  69. {$ELSE RTLLITE}
  70. const
  71. LFNSupport = false;
  72. {$endif RTLLITE}
  73. type
  74. { Dos Extender info }
  75. p_stub_info = ^t_stub_info;
  76. t_stub_info = packed record
  77. magic : array[0..15] of char;
  78. size : longint;
  79. minstack : longint;
  80. memory_handle : longint;
  81. initial_size : longint;
  82. minkeep : word;
  83. ds_selector : word;
  84. ds_segment : word;
  85. psp_selector : word;
  86. cs_selector : word;
  87. env_size : word;
  88. basename : array[0..7] of char;
  89. argv0 : array [0..15] of char;
  90. dpmi_server : array [0..15] of char;
  91. end;
  92. p_go32_info_block = ^t_go32_info_block;
  93. t_go32_info_block = packed record
  94. size_of_this_structure_in_bytes : longint; {offset 0}
  95. linear_address_of_primary_screen : longint; {offset 4}
  96. linear_address_of_secondary_screen : longint; {offset 8}
  97. linear_address_of_transfer_buffer : longint; {offset 12}
  98. size_of_transfer_buffer : longint; {offset 16}
  99. pid : longint; {offset 20}
  100. master_interrupt_controller_base : byte; {offset 24}
  101. slave_interrupt_controller_base : byte; {offset 25}
  102. selector_for_linear_memory : word; {offset 26}
  103. linear_address_of_stub_info_structure : longint; {offset 28}
  104. linear_address_of_original_psp : longint; {offset 32}
  105. run_mode : word; {offset 36}
  106. run_mode_info : word; {offset 38}
  107. end;
  108. var
  109. stub_info : p_stub_info; public name 'operatingsystem_stub_info';
  110. go32_info_block : t_go32_info_block; public name 'operatingsystem_go32_info_block';
  111. {$ifdef SYSTEMDEBUG}
  112. const
  113. accept_sbrk : boolean = true;
  114. {$endif}
  115. {
  116. necessary for objects.pas, should be removed (at least from the interface
  117. to the implementation)
  118. }
  119. type
  120. trealregs=record
  121. realedi,realesi,realebp,realres,
  122. realebx,realedx,realecx,realeax : longint;
  123. realflags,
  124. reales,realds,realfs,realgs,
  125. realip,realcs,realsp,realss : word;
  126. end;
  127. function do_write(h:longint;addr:pointer;len : longint) : longint;
  128. function do_read(h:longint;addr:pointer;len : longint) : longint;
  129. procedure syscopyfromdos(addr : longint; len : longint);
  130. procedure syscopytodos(addr : longint; len : longint);
  131. procedure sysrealintr(intnr : word;var regs : trealregs);
  132. function tb : longint;
  133. implementation
  134. { include system independent routines }
  135. {$I system.inc}
  136. var
  137. c_environ : ppchar;external name '__environ';
  138. _args : ppchar;external name '_args';
  139. __stubinfo : p_stub_info;external name '__stubinfo';
  140. ___dos_argv0 : pchar;external name '___dos_argv0';
  141. procedure setup_arguments;
  142. type
  143. arrayword = array [0..255] of word;
  144. var
  145. psp : word;
  146. proxy_s : string[50];
  147. proxy_argc,proxy_seg,proxy_ofs,lin : longint;
  148. rm_argv : ^arrayword;
  149. argv0len : longint;
  150. useproxy : boolean;
  151. hp : ppchar;
  152. doscmd : string[129]; { Dos commandline copied from PSP, max is 128 chars +1 for terminating zero }
  153. arglen,cmdlen,
  154. count : longint;
  155. argstart,
  156. pc,arg : pchar;
  157. quote : char;
  158. argvlen : longint;
  159. function atohex(s : pchar) : longint;
  160. var
  161. rv : longint;
  162. v : byte;
  163. begin
  164. rv:=0;
  165. while (s^<>#0) do
  166. begin
  167. v:=byte(s^)-byte('0');
  168. if (v > 9) then
  169. dec(v,7);
  170. v:=v and 15; { in case it's lower case }
  171. rv:=(rv shl 4) or v;
  172. inc(longint(s));
  173. end;
  174. atohex:=rv;
  175. end;
  176. procedure allocarg(idx,len:longint);
  177. var
  178. oldargvlen : longint;
  179. begin
  180. if idx>=argvlen then
  181. begin
  182. oldargvlen:=argvlen;
  183. argvlen:=(idx+8) and (not 7);
  184. sysreallocmem(argv,argvlen*sizeof(pointer));
  185. fillchar(argv[oldargvlen],(argvlen-oldargvlen)*sizeof(pointer),0);
  186. end;
  187. { use realloc to reuse already existing memory }
  188. { always allocate, even if length is zero, since }
  189. { the arg. is still present! }
  190. sysreallocmem(argv[idx],len+1);
  191. end;
  192. begin
  193. count:=0;
  194. argc:=1;
  195. argv:=nil;
  196. argvlen:=0;
  197. { load commandline from psp }
  198. psp:=stub_info^.psp_selector;
  199. sysseg_move(psp, 128, get_ds, longint(@doscmd), 128);
  200. doscmd[length(doscmd)+1]:=#0;
  201. {$IfDef SYSTEM_DEBUG_STARTUP}
  202. Writeln(stderr,'Dos command line is #',doscmd,'# size = ',length(doscmd));
  203. {$EndIf }
  204. { create argv[0] }
  205. argv0len:=strlen(dos_argv0);
  206. allocarg(count,argv0len+1);
  207. move(dos_argv0^,argv[count]^,argv0len+1);
  208. inc(count);
  209. { setup cmdline variable }
  210. cmdlen:=argv0len+length(doscmd)+2;
  211. cmdline:=Getmem(cmdlen);
  212. move(dos_argv0^,cmdline^,argv0len);
  213. cmdline[argv0len]:=' ';
  214. inc(argv0len);
  215. move(doscmd[1],cmdline[argv0len],length(doscmd));
  216. cmdline[cmdlen-1]:=#0;
  217. { parse dos commandline }
  218. pc:=@doscmd[1];
  219. while pc^<>#0 do
  220. begin
  221. { skip leading spaces }
  222. while pc^ in [#1..#32] do
  223. inc(pc);
  224. if pc^=#0 then
  225. break;
  226. { calc argument length }
  227. quote:=' ';
  228. argstart:=pc;
  229. arglen:=0;
  230. while (pc^<>#0) do
  231. begin
  232. case pc^ of
  233. #1..#32 :
  234. begin
  235. if quote<>' ' then
  236. inc(arglen)
  237. else
  238. break;
  239. end;
  240. '"' :
  241. begin
  242. if quote<>'''' then
  243. begin
  244. if pchar(pc+1)^<>'"' then
  245. begin
  246. if quote='"' then
  247. quote:=' '
  248. else
  249. quote:='"';
  250. end
  251. else
  252. inc(pc);
  253. end
  254. else
  255. inc(arglen);
  256. end;
  257. '''' :
  258. begin
  259. if quote<>'"' then
  260. begin
  261. if pchar(pc+1)^<>'''' then
  262. begin
  263. if quote='''' then
  264. quote:=' '
  265. else
  266. quote:='''';
  267. end
  268. else
  269. inc(pc);
  270. end
  271. else
  272. inc(arglen);
  273. end;
  274. else
  275. inc(arglen);
  276. end;
  277. inc(pc);
  278. end;
  279. { copy argument }
  280. allocarg(count,arglen);
  281. quote:=' ';
  282. pc:=argstart;
  283. arg:=argv[count];
  284. while (pc^<>#0) do
  285. begin
  286. case pc^ of
  287. #1..#32 :
  288. begin
  289. if quote<>' ' then
  290. begin
  291. arg^:=pc^;
  292. inc(arg);
  293. end
  294. else
  295. break;
  296. end;
  297. '"' :
  298. begin
  299. if quote<>'''' then
  300. begin
  301. if pchar(pc+1)^<>'"' then
  302. begin
  303. if quote='"' then
  304. quote:=' '
  305. else
  306. quote:='"';
  307. end
  308. else
  309. inc(pc);
  310. end
  311. else
  312. begin
  313. arg^:=pc^;
  314. inc(arg);
  315. end;
  316. end;
  317. '''' :
  318. begin
  319. if quote<>'"' then
  320. begin
  321. if pchar(pc+1)^<>'''' then
  322. begin
  323. if quote='''' then
  324. quote:=' '
  325. else
  326. quote:='''';
  327. end
  328. else
  329. inc(pc);
  330. end
  331. else
  332. begin
  333. arg^:=pc^;
  334. inc(arg);
  335. end;
  336. end;
  337. else
  338. begin
  339. arg^:=pc^;
  340. inc(arg);
  341. end;
  342. end;
  343. inc(pc);
  344. end;
  345. arg^:=#0;
  346. {$IfDef SYSTEM_DEBUG_STARTUP}
  347. Writeln(stderr,'dos arg ',count,' #',arglen,'#',argv[count],'#');
  348. {$EndIf SYSTEM_DEBUG_STARTUP}
  349. inc(count);
  350. end;
  351. argc:=count;
  352. { check for !proxy for long commandlines passed using environment }
  353. hp:=envp;
  354. useproxy:=false;
  355. while assigned(hp^) do
  356. begin
  357. if (hp^[0]=' ') then
  358. begin
  359. proxy_s:=strpas(hp^);
  360. if Copy(proxy_s,1,7)=' !proxy' then
  361. begin
  362. proxy_s[13]:=#0;
  363. proxy_s[18]:=#0;
  364. proxy_s[23]:=#0;
  365. { Do not set argv[2..4] to PROXY_S
  366. values, because PROXY_S is on stack,
  367. while ARGV[2..4] need to be on heap.
  368. PM 2011-06-08
  369. argv[2]:=@proxy_s[9];
  370. argv[3]:=@proxy_s[14];
  371. argv[4]:=@proxy_s[19];}
  372. allocarg(2,4);
  373. strcopy(argv[2], @proxy_s[9]);
  374. allocarg(3,4);
  375. strcopy(argv[3], @proxy_s[14]);
  376. allocarg(4,4);
  377. strcopy(argv[4], @proxy_s[19]);
  378. { We need to change this variable env name
  379. otherwise it will be used by other DJGPP variables
  380. if we call them. PM 2011-07-04
  381. Hide it as '_!proxy' instead of ' !proxy' }
  382. hp^[0]:='_';
  383. useproxy:=true;
  384. break;
  385. end;
  386. end;
  387. inc(hp);
  388. end;
  389. { check for !proxy for long commandlines passed using commandline }
  390. if (not useproxy) and
  391. (argc > 1) and (far_strlen(get_ds,longint(argv[1])) = 6) then
  392. begin
  393. move(argv[1]^,proxy_s[1],6);
  394. proxy_s[0] := #6;
  395. if (proxy_s = '!proxy') then
  396. useproxy:=true;
  397. end;
  398. { use proxy when found }
  399. if useproxy then
  400. begin
  401. proxy_argc:=atohex(argv[2]);
  402. proxy_seg:=atohex(argv[3]);
  403. proxy_ofs:=atohex(argv[4]);
  404. {$IfDef SYSTEM_DEBUG_STARTUP}
  405. Writeln(stderr,'proxy command line found');
  406. writeln(stderr,'argc: ',proxy_argc,' seg: ',proxy_seg,' ofs: ',proxy_ofs);
  407. {$EndIf SYSTEM_DEBUG_STARTUP}
  408. rm_argv:=SysGetmem(proxy_argc*sizeof(word));
  409. sysseg_move(dos_selector,proxy_seg*16+proxy_ofs, get_ds,longint(rm_argv),proxy_argc*sizeof(word));
  410. for count:=0 to proxy_argc - 1 do
  411. begin
  412. lin:=proxy_seg*16+rm_argv^[count];
  413. arglen:=far_strlen(dos_selector,lin);
  414. allocarg(count,arglen);
  415. sysseg_move(dos_selector,lin,get_ds,longint(argv[count]),arglen+1);
  416. {$IfDef SYSTEM_DEBUG_STARTUP}
  417. Writeln(stderr,'arg ',count,' #',rm_argv^[count],'#',arglen,'#',argv[count],'#');
  418. {$EndIf SYSTEM_DEBUG_STARTUP}
  419. end;
  420. SysFreemem(rm_argv);
  421. argc:=proxy_argc;
  422. end;
  423. { create an nil entry }
  424. allocarg(argc,0);
  425. { free unused memory }
  426. sysreallocmem(argv,(argc+1)*sizeof(pointer));
  427. _args:=argv;
  428. end;
  429. procedure setup_environment;
  430. var env_selector : word;
  431. env_count : longint;
  432. dos_env,cp : pchar;
  433. begin
  434. stub_info:=__stubinfo;
  435. dos_env := sysgetmem(stub_info^.env_size);
  436. env_count:=0;
  437. sysseg_move(stub_info^.psp_selector,$2c, get_ds, longint(@env_selector), 2);
  438. sysseg_move(env_selector, 0, get_ds, longint(dos_env), stub_info^.env_size);
  439. cp:=dos_env;
  440. while cp ^ <> #0 do
  441. begin
  442. inc(env_count);
  443. while (cp^ <> #0) do inc(longint(cp)); { skip to NUL }
  444. inc(longint(cp)); { skip to next character }
  445. end;
  446. envp := sysgetmem((env_count+1) * sizeof(pchar));
  447. if (envp = nil) then HandleError (203);
  448. c_environ:=envp;
  449. cp:=dos_env;
  450. env_count:=0;
  451. while cp^ <> #0 do
  452. begin
  453. envp[env_count] := sysgetmem(strlen(cp)+1);
  454. strcopy(envp[env_count], cp);
  455. {$IfDef SYSTEM_DEBUG_STARTUP}
  456. Writeln(stderr,'env ',env_count,' = "',envp[env_count],'"');
  457. {$EndIf SYSTEM_DEBUG_STARTUP}
  458. inc(env_count);
  459. while (cp^ <> #0) do
  460. inc(longint(cp)); { skip to NUL }
  461. inc(longint(cp)); { skip to next character }
  462. end;
  463. envp[env_count]:=nil;
  464. longint(cp):=longint(cp)+3;
  465. dos_argv0 := sysgetmem(strlen(cp)+1);
  466. if (dos_argv0 = nil) then HandleError (203);
  467. strcopy(dos_argv0, cp);
  468. { update ___dos_argv0 also }
  469. ___dos_argv0:=dos_argv0
  470. end;
  471. {*****************************************************************************
  472. System Dependent Exit code
  473. *****************************************************************************}
  474. procedure __exit(exitcode:longint);cdecl;external;
  475. Procedure system_exit;
  476. var
  477. h : byte;
  478. begin
  479. for h:=0 to max_files-1 do
  480. if openfiles[h] then
  481. begin
  482. {$ifdef SYSTEMDEBUG}
  483. writeln(stderr,'file ',opennames[h],' not closed at exit');
  484. {$endif SYSTEMDEBUG}
  485. if h>=5 then
  486. do_close(h);
  487. end;
  488. { halt is not allways called !! }
  489. { not on normal exit !! PM }
  490. set_pm_interrupt($00,old_int00);
  491. {$ifndef EXCEPTIONS_IN_SYSTEM}
  492. set_pm_interrupt($75,old_int75);
  493. {$endif EXCEPTIONS_IN_SYSTEM}
  494. __exit(exitcode);
  495. end;
  496. procedure new_int00;
  497. begin
  498. HandleError(200);
  499. end;
  500. {$ifndef EXCEPTIONS_IN_SYSTEM}
  501. procedure new_int75;
  502. begin
  503. asm
  504. xorl %eax,%eax
  505. outb %al,$0x0f0
  506. movb $0x20,%al
  507. outb %al,$0x0a0
  508. outb %al,$0x020
  509. end;
  510. HandleError(200);
  511. end;
  512. {$endif EXCEPTIONS_IN_SYSTEM}
  513. var
  514. __stkbottom : pointer;external name '__stkbottom';
  515. {*****************************************************************************
  516. ParamStr/Randomize
  517. *****************************************************************************}
  518. function paramcount : longint;
  519. begin
  520. paramcount := argc - 1;
  521. end;
  522. function paramstr(l : longint) : string;
  523. begin
  524. if (l>=0) and (l+1<=argc) then
  525. paramstr:=strpas(argv[l])
  526. else
  527. paramstr:='';
  528. end;
  529. procedure randomize;
  530. var
  531. hl : longint;
  532. regs : trealregs;
  533. begin
  534. regs.realeax:=$2c00;
  535. sysrealintr($21,regs);
  536. hl:=lo(regs.realedx);
  537. randseed:=hl*$10000+ lo(regs.realecx);
  538. end;
  539. {*****************************************************************************
  540. SystemUnit Initialization
  541. *****************************************************************************}
  542. function CheckLFN:boolean;
  543. var
  544. regs : TRealRegs;
  545. RootName : pchar;
  546. begin
  547. { Check LFN API on drive c:\ }
  548. RootName:='C:\';
  549. syscopytodos(longint(RootName),strlen(RootName)+1);
  550. { Call 'Get Volume Information' ($71A0) }
  551. regs.realeax:=$71a0;
  552. regs.reales:=tb_segment;
  553. regs.realedi:=tb_offset;
  554. regs.realecx:=32;
  555. regs.realds:=tb_segment;
  556. regs.realedx:=tb_offset;
  557. regs.realflags:=carryflag;
  558. sysrealintr($21,regs);
  559. { If carryflag=0 and LFN API bit in ebx is set then use Long file names }
  560. CheckLFN:=(regs.realflags and carryflag=0) and (regs.realebx and $4000=$4000);
  561. end;
  562. {$ifdef EXCEPTIONS_IN_SYSTEM}
  563. {$define IN_SYSTEM}
  564. {$i dpmiexcp.pp}
  565. {$endif EXCEPTIONS_IN_SYSTEM}
  566. procedure SysInitStdIO;
  567. begin
  568. OpenStdIO(Input,fmInput,StdInputHandle);
  569. OpenStdIO(Output,fmOutput,StdOutputHandle);
  570. OpenStdIO(ErrOutput,fmOutput,StdErrorHandle);
  571. OpenStdIO(StdOut,fmOutput,StdOutputHandle);
  572. OpenStdIO(StdErr,fmOutput,StdErrorHandle);
  573. end;
  574. function GetProcessID: SizeUInt;
  575. begin
  576. GetProcessID := SizeUInt (Go32_info_block.pid);
  577. end;
  578. function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt;
  579. begin
  580. result := stklen;
  581. end;
  582. var
  583. temp_int : tseginfo;
  584. Begin
  585. { v2prt0.as adds 256 bytes to __stkbottom for extra safety during stack
  586. checking, so we subtract 256 here in order to calculate StackTop correctly
  587. and to ensure that StackLength = StackTop - StackBottom }
  588. StackLength := CheckInitialStkLen(InitialStkLen)-256;
  589. StackBottom := __stkbottom;
  590. { To be set if this is a GUI or console application }
  591. IsConsole := TRUE;
  592. { To be set if this is a library and not a program }
  593. IsLibrary := FALSE;
  594. { save old int 0 and 75 }
  595. get_pm_interrupt($00,old_int00);
  596. get_pm_interrupt($75,old_int75);
  597. temp_int.segment:=get_cs;
  598. temp_int.offset:=@new_int00;
  599. set_pm_interrupt($00,temp_int);
  600. {$ifndef EXCEPTIONS_IN_SYSTEM}
  601. temp_int.offset:=@new_int75;
  602. set_pm_interrupt($75,temp_int);
  603. {$endif EXCEPTIONS_IN_SYSTEM}
  604. { Setup heap }
  605. InitHeap;
  606. SysInitExceptions;
  607. initunicodestringmanager;
  608. { Setup stdin, stdout and stderr }
  609. SysInitStdIO;
  610. { Setup environment and arguments }
  611. Setup_Environment;
  612. Setup_Arguments;
  613. { Use LFNSupport LFN }
  614. LFNSupport:=CheckLFN;
  615. if LFNSupport then
  616. begin
  617. FileNameCasePreserving:=true;
  618. AllFilesMask := '*';
  619. end
  620. else
  621. AllFilesMask := '*.*';
  622. { Reset IO Error }
  623. InOutRes:=0;
  624. {$ifdef FPC_HAS_FEATURE_THREADING}
  625. InitSystemThreads;
  626. {$endif}
  627. {$ifdef EXCEPTIONS_IN_SYSTEM}
  628. InitDPMIExcp;
  629. InstallDefaultHandlers;
  630. {$endif EXCEPTIONS_IN_SYSTEM}
  631. initvariantmanager;
  632. End.