system.pp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 1999-2006 by Florian Klaempfl and Pavel Ozerski
  4. member of the Free Pascal development team.
  5. FPC Pascal system unit for the Win64 API.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. unit System;
  13. interface
  14. { $define SYSTEMEXCEPTIONDEBUG}
  15. {$ifdef SYSTEMDEBUG}
  16. {$define SYSTEMEXCEPTIONDEBUG}
  17. {$endif SYSTEMDEBUG}
  18. {$define DISABLE_NO_THREAD_MANAGER}
  19. {$define HAS_WIDESTRINGMANAGER}
  20. {$define DISABLE_NO_DYNLIBS_MANAGER}
  21. {$define FPC_SYSTEM_HAS_SYSDLH}
  22. {$ifdef FPC_USE_WIN64_SEH}
  23. {$define FPC_SYSTEM_HAS_RAISEEXCEPTION}
  24. {$define FPC_SYSTEM_HAS_RERAISE}
  25. {$define FPC_SYSTEM_HAS_CAPTUREBACKTRACE}
  26. {$endif FPC_USE_WIN64_SEH}
  27. { include system-independent routine headers }
  28. {$I systemh.inc}
  29. const
  30. LineEnding = #13#10;
  31. LFNSupport = true;
  32. DirectorySeparator = '\';
  33. DriveSeparator = ':';
  34. ExtensionSeparator = '.';
  35. PathSeparator = ';';
  36. AllowDirectorySeparators : set of char = ['\','/'];
  37. AllowDriveSeparators : set of char = [':'];
  38. { FileNameCaseSensitive and FileNameCasePreserving are defined separately below!!! }
  39. maxExitCode = 65535;
  40. MaxPathLen = 260;
  41. AllFilesMask = '*';
  42. type
  43. PEXCEPTION_FRAME = ^TEXCEPTION_FRAME;
  44. TEXCEPTION_FRAME = record
  45. next : PEXCEPTION_FRAME;
  46. handler : pointer;
  47. end;
  48. const
  49. { Default filehandles }
  50. UnusedHandle : THandle = THandle(-1);
  51. StdInputHandle : THandle = 0;
  52. StdOutputHandle : THandle = 0;
  53. StdErrorHandle : THandle = 0;
  54. System_exception_frame : PEXCEPTION_FRAME =nil;
  55. FileNameCaseSensitive : boolean = false;
  56. FileNameCasePreserving: boolean = true;
  57. CtrlZMarksEOF: boolean = true; (* #26 is considered as end of file *)
  58. sLineBreak = LineEnding;
  59. DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF;
  60. var
  61. { C compatible arguments }
  62. argc : longint;
  63. argv : ppchar;
  64. { Win32 Info }
  65. startupinfo : tstartupinfo deprecated; // Delphi does not have one in interface
  66. StartupConsoleMode : dword;
  67. MainInstance : qword;
  68. cmdshow : longint;
  69. DLLreason : dword;
  70. DLLparam : PtrInt;
  71. const
  72. hprevinst: qword=0;
  73. type
  74. TDLL_Entry_Hook = procedure (dllparam : PtrInt);
  75. const
  76. Dll_Process_Detach_Hook : TDLL_Entry_Hook = nil;
  77. Dll_Thread_Attach_Hook : TDLL_Entry_Hook = nil;
  78. Dll_Thread_Detach_Hook : TDLL_Entry_Hook = nil;
  79. Const
  80. { it can be discussed whether fmShareDenyNone means read and write or read, write and delete, see
  81. also http://bugs.freepascal.org/view.php?id=8898, this allows users to configure the used
  82. value
  83. }
  84. fmShareDenyNoneFlags : DWord = 3;
  85. implementation
  86. {$asmmode att}
  87. var
  88. SysInstance : qword;
  89. FPCSysInstance: PQWord = @SysInstance; public name '_FPC_SysInstance';
  90. {$ifdef FPC_USE_WIN64_SEH}
  91. function main_wrapper(arg: Pointer; proc: Pointer): ptrint; assembler; nostackframe;
  92. asm
  93. subq $40, %rsp
  94. .seh_stackalloc 40
  95. .seh_endprologue
  96. call %rdx { "arg" is passed in %rcx }
  97. nop { this nop is critical for exception handling }
  98. addq $40, %rsp
  99. .seh_handler __FPC_default_handler,@except,@unwind
  100. end;
  101. {$endif FPC_USE_WIN64_SEH}
  102. {$define FPC_SYSTEM_HAS_STACKTOP}
  103. function StackTop: pointer; assembler;nostackframe;
  104. asm
  105. movq %gs:(8),%rax
  106. end;
  107. { include system independent routines }
  108. {$I system.inc}
  109. {*****************************************************************************
  110. System Dependent Exit code
  111. *****************************************************************************}
  112. {$ifndef FPC_USE_WIN64_SEH}
  113. procedure install_exception_handlers;forward;
  114. {$endif FPC_USE_WIN64_SEH}
  115. procedure PascalMain;external name 'PASCALMAIN';
  116. { include code common with win32 }
  117. {$I syswin.inc}
  118. { TLS directory code }
  119. {$I systlsdir.inc}
  120. Procedure system_exit;
  121. begin
  122. { see comments in win32/system.pp about this logic }
  123. if IsLibrary then
  124. begin
  125. if DllInitState in [DLL_PROCESS_ATTACH,DLL_PROCESS_DETACH] then
  126. LongJmp(DLLBuf,1)
  127. else
  128. MainThreadIDWin32:=0;
  129. end;
  130. if not IsConsole then
  131. begin
  132. Close(stderr);
  133. Close(stdout);
  134. Close(erroutput);
  135. Close(Input);
  136. Close(Output);
  137. { what about Input and Output ?? PM }
  138. { now handled, FPK }
  139. end;
  140. { call exitprocess, with cleanup as required }
  141. ExitProcess(exitcode);
  142. end;
  143. var
  144. { old compilers emitted a reference to _fltused if a module contains
  145. floating type code so the linker could leave away floating point
  146. libraries or not. VC does this as well so we need to define this
  147. symbol as well (FK)
  148. }
  149. _fltused : int64;cvar;public;
  150. { value of the stack segment
  151. to check if the call stack can be written on exceptions }
  152. _SS : Cardinal;
  153. procedure Exe_entry;[public,alias:'_FPC_EXE_Entry'];
  154. begin
  155. IsLibrary:=false;
  156. { install the handlers for exe only ?
  157. or should we install them for DLL also ? (PM) }
  158. {$ifndef FPC_USE_WIN64_SEH}
  159. install_exception_handlers;
  160. {$endif FPC_USE_WIN64_SEH}
  161. ExitCode:=0;
  162. asm
  163. xorq %rax,%rax
  164. movw %ss,%ax
  165. movl %eax,_SS(%rip)
  166. movq %rbp,%rsi
  167. xorq %rbp,%rbp
  168. {$ifdef FPC_USE_WIN64_SEH}
  169. xor %rcx,%rcx
  170. lea PASCALMAIN(%rip),%rdx
  171. call main_wrapper
  172. {$else FPC_USE_WIN64_SEH}
  173. call PASCALMAIN
  174. {$endif FPC_USE_WIN64_SEH}
  175. movq %rsi,%rbp
  176. end ['RSI','RBP']; { <-- specifying RSI allows compiler to save/restore it properly }
  177. { if we pass here there was no error ! }
  178. system_exit;
  179. end;
  180. procedure _FPC_DLLMainCRTStartup(_hinstance : qword;_dllreason : dword;_dllparam:Pointer);stdcall;public name '_DLLMainCRTStartup';
  181. begin
  182. IsConsole:=true;
  183. sysinstance:=_hinstance;
  184. dllreason:=_dllreason;
  185. dllparam:=PtrInt(_dllparam);
  186. DLL_Entry;
  187. end;
  188. procedure _FPC_DLLWinMainCRTStartup(_hinstance : qword;_dllreason : dword;_dllparam:Pointer);stdcall;public name '_DLLWinMainCRTStartup';
  189. begin
  190. IsConsole:=false;
  191. sysinstance:=_hinstance;
  192. dllreason:=_dllreason;
  193. dllparam:=PtrInt(_dllparam);
  194. DLL_Entry;
  195. end;
  196. function is_prefetch(p : pointer) : boolean;
  197. var
  198. a : array[0..15] of byte;
  199. doagain : boolean;
  200. instrlo,instrhi,opcode : byte;
  201. i : longint;
  202. begin
  203. result:=false;
  204. { read memory savely without causing another exeception }
  205. if not(ReadProcessMemory(GetCurrentProcess,p,@a,sizeof(a),nil)) then
  206. exit;
  207. i:=0;
  208. doagain:=true;
  209. while doagain and (i<15) do
  210. begin
  211. opcode:=a[i];
  212. instrlo:=opcode and $f;
  213. instrhi:=opcode and $f0;
  214. case instrhi of
  215. { prefix? }
  216. $20,$30:
  217. doagain:=(instrlo and 7)=6;
  218. $60:
  219. doagain:=(instrlo and $c)=4;
  220. $f0:
  221. doagain:=instrlo in [0,2,3];
  222. $0:
  223. begin
  224. result:=(instrlo=$f) and (a[i+1] in [$d,$18]);
  225. exit;
  226. end;
  227. else
  228. doagain:=false;
  229. end;
  230. inc(i);
  231. end;
  232. end;
  233. //
  234. // Hardware exception handling
  235. //
  236. {$I seh64.inc}
  237. type
  238. TVectoredExceptionHandler = function (excep : PExceptionPointers) : Longint;
  239. function AddVectoredExceptionHandler(FirstHandler : DWORD;VectoredHandler : TVectoredExceptionHandler) : longint;
  240. external 'kernel32' name 'AddVectoredExceptionHandler';
  241. {$ifndef FPC_USE_WIN64_SEH}
  242. const
  243. MaxExceptionLevel = 16;
  244. exceptLevel : Byte = 0;
  245. var
  246. exceptRip : array[0..MaxExceptionLevel-1] of Int64;
  247. exceptError : array[0..MaxExceptionLevel-1] of Byte;
  248. resetFPU : array[0..MaxExceptionLevel-1] of Boolean;
  249. {$ifdef SYSTEMEXCEPTIONDEBUG}
  250. procedure DebugHandleErrorAddrFrame(error : longint; addr, frame : pointer);
  251. begin
  252. if IsConsole then
  253. begin
  254. write(stderr,'HandleErrorAddrFrame(error=',error);
  255. write(stderr,',addr=',hexstr(int64(addr),16));
  256. writeln(stderr,',frame=',hexstr(int64(frame),16),')');
  257. end;
  258. HandleErrorAddrFrame(error,addr,frame);
  259. end;
  260. {$endif SYSTEMEXCEPTIONDEBUG}
  261. procedure JumpToHandleErrorFrame;
  262. var
  263. rip, rbp : int64;
  264. error : longint;
  265. begin
  266. // save ebp
  267. asm
  268. movq (%rbp),%rax
  269. movq %rax,rbp
  270. end;
  271. if exceptLevel>0 then
  272. dec(exceptLevel);
  273. rip:=exceptRip[exceptLevel];
  274. error:=exceptError[exceptLevel];
  275. {$ifdef SYSTEMEXCEPTIONDEBUG}
  276. if IsConsole then
  277. writeln(stderr,'In JumpToHandleErrorFrame error=',error);
  278. {$endif SYSTEMEXCEPTIONDEBUG}
  279. if resetFPU[exceptLevel] then
  280. SysResetFPU;
  281. { build a fake stack }
  282. asm
  283. movq rbp,%r8
  284. movq rip,%rdx
  285. movl error,%ecx
  286. pushq rip
  287. movq rbp,%rbp // Change frame pointer
  288. {$ifdef SYSTEMEXCEPTIONDEBUG}
  289. jmpl DebugHandleErrorAddrFrame
  290. {$else not SYSTEMEXCEPTIONDEBUG}
  291. jmpl HandleErrorAddrFrame
  292. {$endif SYSTEMEXCEPTIONDEBUG}
  293. end;
  294. end;
  295. function syswin64_x86_64_exception_handler(excep : PExceptionPointers) : Longint;public;
  296. var
  297. res: longint;
  298. err: byte;
  299. must_reset_fpu: boolean;
  300. begin
  301. res:=EXCEPTION_CONTINUE_SEARCH;
  302. {$ifdef SYSTEMEXCEPTIONDEBUG}
  303. if IsConsole then
  304. Writeln(stderr,'syswin64_x86_64_exception_handler called');
  305. {$endif SYSTEMEXCEPTIONDEBUG}
  306. if excep^.ContextRecord^.SegSs=_SS then
  307. begin
  308. err := 0;
  309. must_reset_fpu := true;
  310. {$ifdef SYSTEMEXCEPTIONDEBUG}
  311. if IsConsole then Writeln(stderr,'Exception ',
  312. hexstr(excep^.ExceptionRecord^.ExceptionCode,8));
  313. {$endif SYSTEMEXCEPTIONDEBUG}
  314. case cardinal(excep^.ExceptionRecord^.ExceptionCode) of
  315. STATUS_INTEGER_DIVIDE_BY_ZERO,
  316. STATUS_FLOAT_DIVIDE_BY_ZERO :
  317. err := 200;
  318. STATUS_ARRAY_BOUNDS_EXCEEDED :
  319. begin
  320. err := 201;
  321. must_reset_fpu := false;
  322. end;
  323. STATUS_STACK_OVERFLOW :
  324. begin
  325. err := 202;
  326. must_reset_fpu := false;
  327. end;
  328. STATUS_FLOAT_OVERFLOW :
  329. err := 205;
  330. STATUS_FLOAT_DENORMAL_OPERAND,
  331. STATUS_FLOAT_UNDERFLOW :
  332. err := 206;
  333. { excep^.ContextRecord^.FloatSave.StatusWord := excep^.ContextRecord^.FloatSave.StatusWord and $ffffff00;}
  334. STATUS_FLOAT_INEXACT_RESULT,
  335. STATUS_FLOAT_INVALID_OPERATION,
  336. STATUS_FLOAT_STACK_CHECK :
  337. err := 207;
  338. STATUS_INTEGER_OVERFLOW :
  339. begin
  340. err := 215;
  341. must_reset_fpu := false;
  342. end;
  343. STATUS_ILLEGAL_INSTRUCTION:
  344. err := 216;
  345. STATUS_ACCESS_VIOLATION:
  346. { Athlon prefetch bug? }
  347. if is_prefetch(pointer(excep^.ContextRecord^.rip)) then
  348. begin
  349. { if yes, then retry }
  350. excep^.ExceptionRecord^.ExceptionCode := 0;
  351. res:=EXCEPTION_CONTINUE_EXECUTION;
  352. end
  353. else
  354. err := 216;
  355. STATUS_CONTROL_C_EXIT:
  356. err := 217;
  357. STATUS_PRIVILEGED_INSTRUCTION:
  358. begin
  359. err := 218;
  360. must_reset_fpu := false;
  361. end;
  362. else
  363. begin
  364. if ((excep^.ExceptionRecord^.ExceptionCode and SEVERITY_ERROR) = SEVERITY_ERROR) then
  365. err := 217
  366. else
  367. { pass through exceptions which aren't an error. The problem is that vectored handlers
  368. always are called before structured ones so we see also internal exceptions of libraries.
  369. I wonder if there is a better solution (FK)
  370. }
  371. res:=EXCEPTION_CONTINUE_SEARCH;
  372. end;
  373. end;
  374. if (err <> 0) and (exceptLevel < MaxExceptionLevel) then
  375. begin
  376. exceptRip[exceptLevel] := excep^.ContextRecord^.Rip;
  377. exceptError[exceptLevel] := err;
  378. resetFPU[exceptLevel] := must_reset_fpu;
  379. inc(exceptLevel);
  380. excep^.ContextRecord^.Rip := Int64(@JumpToHandleErrorFrame);
  381. excep^.ExceptionRecord^.ExceptionCode := 0;
  382. res := EXCEPTION_CONTINUE_EXECUTION;
  383. {$ifdef SYSTEMEXCEPTIONDEBUG}
  384. if IsConsole then begin
  385. writeln(stderr,'Exception Continue Exception set at ',
  386. hexstr(exceptRip[exceptLevel-1],16));
  387. writeln(stderr,'Rip changed to ',
  388. hexstr(int64(@JumpToHandleErrorFrame),16), ' error=', err);
  389. end;
  390. {$endif SYSTEMEXCEPTIONDEBUG}
  391. end;
  392. end;
  393. syswin64_x86_64_exception_handler := res;
  394. end;
  395. procedure install_exception_handlers;
  396. begin
  397. AddVectoredExceptionHandler(1,@syswin64_x86_64_exception_handler);
  398. end;
  399. {$endif ndef FPC_USE_WIN64_SEH}
  400. procedure LinkIn(p1,p2,p3: Pointer); inline;
  401. begin
  402. end;
  403. procedure _FPC_mainCRTStartup;stdcall;public name '_mainCRTStartup';
  404. begin
  405. IsConsole:=true;
  406. GetConsoleMode(GetStdHandle((Std_Input_Handle)),@StartupConsoleMode);
  407. {$ifdef FPC_USE_TLS_DIRECTORY}
  408. LinkIn(@_tls_used,@FreePascal_TLS_callback,@FreePascal_end_of_TLS_callback);
  409. {$endif FPC_USE_TLS_DIRECTORY}
  410. Exe_entry;
  411. end;
  412. procedure _FPC_WinMainCRTStartup;stdcall;public name '_WinMainCRTStartup';
  413. begin
  414. IsConsole:=false;
  415. {$ifdef FPC_USE_TLS_DIRECTORY}
  416. LinkIn(@_tls_used,@FreePascal_TLS_callback,@FreePascal_end_of_TLS_callback);
  417. {$endif FPC_USE_TLS_DIRECTORY}
  418. Exe_entry;
  419. end;
  420. {$ifdef FPC_SECTION_THREADVARS}
  421. function fpc_tls_add(addr: pointer): pointer; assembler; nostackframe;
  422. [public,alias: 'FPC_TLS_ADD']; compilerproc;
  423. asm
  424. sub $56,%rsp { 32 spill area + 16 local vars + 8 misalignment }
  425. .seh_stackalloc 56
  426. .seh_endprologue
  427. lea tls_data_start(%rip),%rax
  428. sub %rax,%rcx
  429. cmpb $0,IsLibrary(%rip)
  430. mov _tls_index(%rip),%eax
  431. jnz .L1
  432. mov %gs:(88),%rdx
  433. add (%rdx,%rax,8),%rcx
  434. mov %rcx,%rax
  435. jmp .L3
  436. .L1:
  437. mov %rcx,32(%rsp)
  438. call GetLastError
  439. mov %rax,40(%rsp) { save LastError }
  440. mov _tls_index(%rip),%ecx
  441. call TlsGetValue
  442. test %rax,%rax
  443. jnz .L2
  444. { This can happen when a thread existed before DLL was loaded,
  445. or if DisableThreadLibraryCalls was called. }
  446. call SysAllocateThreadVars
  447. mov $0x1000000,%rcx
  448. call InitThread
  449. mov _tls_index(%rip),%ecx
  450. call TlsGetValue
  451. .L2:
  452. add %rax,32(%rsp)
  453. mov 40(%rsp),%rcx
  454. call SetLastError
  455. mov 32(%rsp),%rax
  456. .L3:
  457. add $56,%rsp
  458. end;
  459. {$endif FPC_SECTION_THREADVARS}
  460. function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt;
  461. type
  462. tdosheader = packed record
  463. e_magic : word;
  464. e_cblp : word;
  465. e_cp : word;
  466. e_crlc : word;
  467. e_cparhdr : word;
  468. e_minalloc : word;
  469. e_maxalloc : word;
  470. e_ss : word;
  471. e_sp : word;
  472. e_csum : word;
  473. e_ip : word;
  474. e_cs : word;
  475. e_lfarlc : word;
  476. e_ovno : word;
  477. e_res : array[0..3] of word;
  478. e_oemid : word;
  479. e_oeminfo : word;
  480. e_res2 : array[0..9] of word;
  481. e_lfanew : longint;
  482. end;
  483. tpeheader = packed record
  484. PEMagic : longint;
  485. Machine : word;
  486. NumberOfSections : word;
  487. TimeDateStamp : longint;
  488. PointerToSymbolTable : longint;
  489. NumberOfSymbols : longint;
  490. SizeOfOptionalHeader : word;
  491. Characteristics : word;
  492. Magic : word;
  493. MajorLinkerVersion : byte;
  494. MinorLinkerVersion : byte;
  495. SizeOfCode : longint;
  496. SizeOfInitializedData : longint;
  497. SizeOfUninitializedData : longint;
  498. AddressOfEntryPoint : longint;
  499. BaseOfCode : longint;
  500. {$ifdef win32}
  501. BaseOfData : longint;
  502. {$endif win32}
  503. ImageBase : PtrInt;
  504. SectionAlignment : longint;
  505. FileAlignment : longint;
  506. MajorOperatingSystemVersion : word;
  507. MinorOperatingSystemVersion : word;
  508. MajorImageVersion : word;
  509. MinorImageVersion : word;
  510. MajorSubsystemVersion : word;
  511. MinorSubsystemVersion : word;
  512. Reserved1 : longint;
  513. SizeOfImage : longint;
  514. SizeOfHeaders : longint;
  515. CheckSum : longint;
  516. Subsystem : word;
  517. DllCharacteristics : word;
  518. SizeOfStackReserve : PtrInt;
  519. SizeOfStackCommit : PtrInt;
  520. SizeOfHeapReserve : PtrInt;
  521. SizeOfHeapCommit : PtrInt;
  522. LoaderFlags : longint;
  523. NumberOfRvaAndSizes : longint;
  524. DataDirectory : array[1..$80] of byte;
  525. end;
  526. begin
  527. result:=tpeheader((pointer(getmodulehandle(nil))+(tdosheader(pointer(getmodulehandle(nil))^).e_lfanew))^).SizeOfStackReserve;
  528. end;
  529. begin
  530. { pass dummy value }
  531. StackLength := CheckInitialStkLen($1000000);
  532. StackBottom := StackTop - StackLength;
  533. { get some helpful informations }
  534. GetStartupInfo(@startupinfo);
  535. { some misc Win32 stuff }
  536. if not IsLibrary then
  537. SysInstance:=getmodulehandle(nil);
  538. MainInstance:=SysInstance;
  539. cmdshow:=startupinfo.wshowwindow;
  540. { Setup heap and threading, these may be already initialized from TLS callback }
  541. if not Assigned(CurrentTM.BeginThread) then
  542. begin
  543. InitHeap;
  544. InitSystemThreads;
  545. end;
  546. SysInitExceptions;
  547. initunicodestringmanager;
  548. InitWin32Widestrings;
  549. SysInitStdIO;
  550. { Arguments }
  551. setup_arguments;
  552. InitSystemDynLibs;
  553. { Reset IO Error }
  554. InOutRes:=0;
  555. ProcessID := GetCurrentProcessID;
  556. DispCallByIDProc:=@DoDispCallByIDError;
  557. end.