system.pp 18 KB

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