forked from dolgop/opencascade
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStepWrapperTarget.pas
680 lines (586 loc) · 19.3 KB
/
StepWrapperTarget.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
unit StepWrapperTarget; {$Z4}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Ìîäóëü: "w:/CAD/StepWrapperTarget/StepWrapperTarget.pas"
// Delphi îáâÿçêà äëÿ DLL (.pas)
// Generated from UML model, root element: <<AdapterTarget::Category>> CAD::StepWrapperTarget
//
//
// Âñå ïðàâà ïðèíàäëåæàò ÎÎÎ ÍÏÏ "Ãàðàíò-Ñåðâèñ".
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
interface
uses
SysConst
, SysUtils
, Windows
, Classes
, ActiveX
, StepUnit;
const
CLibraryVersion: LongWord = 3;
CLibraryName: PAnsiChar = 'StepWrapperTarget.dll';
type
// Ñèñòåìíûå èñêëþ÷åíèÿ.
ELoadLibraryError = class (Exception); // èñïîëüçóåòñÿ ïðè çàãðóçêå dll;
EGetProcAddressError = class (Exception); // èñïîëüçóåòñÿ ïðè âûçîâå îïåðàöèè dll;
EStdException = class (Exception); // èñïîëüçóåòñÿ ïðè ìàïèíãå íåèçâåñòíûõ Sdt èñêëþ÷åíèé;
ECorbaException = class (Exception); // èñïîëüçóåòñÿ ïðè ìàïèíãå íåèçâåñòíûõ CORBA èñêëþ÷åíèé;
EWrongVersion = class (Exception); // âûáðàñûâàåòñÿ â ñëó÷àå íå ñîîòâåòñòâèÿ âåðñèè êëèåíòà è dll
EUnknownFactoryKey = class (Exception); // âûáðàñûâàåòñÿ â ñëó÷àå, åñëè íåò íè îäíîãî çàðåãåñòðèðîâàííîãî ñåðâàíòà c çàäàííûì êëþ÷îì äëÿ çàïðàøèâàåìîãî èíòåðôåéñà
// exported root factory interface
IStepWrapperTargetRoot = interface (IInterface) ['{F98207B3-F212-4528-85F0-E56F343C39BF}']
procedure MakeFaceList (out aRet {: IFaceList}); stdcall;
procedure MakePointsTable (out aRet {: IPointsTable}); stdcall;
procedure MakeShapeList (out aRet {: IShapeList}); stdcall;
procedure MakeStepManager (
const aFileName: PAnsiChar;
out aRet {: IStepManager}
); stdcall; overload;
procedure MakeTrianglesTable (out aRet {: ITrianglesTable}); stdcall;
end;
// DLL wrapper interface
IStepWrapperTargetDll = interface (IInterface)
function GetVersion (): LongWord;
function MakeFaceList () : IFaceList;
function MakePointsTable () : IPointsTable;
function MakeShapeList () : IShapeList;
function MakeStepManager (
const aFileName: PAnsiChar
) : IStepManager; overload;
function MakeTrianglesTable () : ITrianglesTable;
end;
// DLL wrapper impl
TStepWrapperTargetDll = class (TInterfacedObject, IStepWrapperTargetDll)
private
f_HModule: HModule;
f_DllRoot: IStepWrapperTargetRoot;
private
procedure DllLoad;
procedure DllFree;
procedure RootInit(aClientVersion: LongWord); overload;
procedure RootInit(aClientVersion: LongWord; const aLocale: PAnsiChar); overload;
procedure RootDone;
function GetRoot: IStepWrapperTargetRoot;
public
constructor Create (aClientVersion: LongWord); reintroduce; overload;
constructor Create (aClientVersion: LongWord; const aLocale: PAnsiChar); reintroduce; overload;
destructor Destroy; override;
class function Make(): IStepWrapperTargetDll; overload;;
class function Make(const aLocale: PAnsiChar): IStepWrapperTargetDll; overload;;
function GetVersion: LongWord;
public
function MakeFaceList () : IFaceList;
function MakePointsTable () : IPointsTable;
function MakeShapeList () : IShapeList;
function MakeStepManager (
const aFileName: PAnsiChar
) : IStepManager; overload;
function MakeTrianglesTable () : ITrianglesTable;
end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
implementation
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function TStepWrapperTargetDll.MakeFaceList () : IFaceList;
var
aRes: IFaceList;
begin
GetRoot().MakeFaceList(aRes);
Result := aRes;
end;
function TStepWrapperTargetDll.MakePointsTable () : IPointsTable;
var
aRes: IPointsTable;
begin
GetRoot().MakePointsTable(aRes);
Result := aRes;
end;
function TStepWrapperTargetDll.MakeShapeList () : IShapeList;
var
aRes: IShapeList;
begin
GetRoot().MakeShapeList(aRes);
Result := aRes;
end;
function TStepWrapperTargetDll.MakeStepManager (
const aFileName: PAnsiChar
) : IStepManager;
var
aRes: IStepManager;
begin
GetRoot().MakeStepManager(aFileName, aRes);
Result := aRes;
end;
function TStepWrapperTargetDll.MakeTrianglesTable () : ITrianglesTable;
var
aRes: ITrianglesTable;
begin
GetRoot().MakeTrianglesTable(aRes);
Result := aRes;
end;
procedure TStepWrapperTargetDll.DllLoad;
function GetOsDependentCatalog: string;
begin
if (Longint (Windows.GetVersion) < 0) then
Result := ExtractFilePath (ParamStr (0))+'win9X'
else
Result := ExtractFilePath (ParamStr (0))+'winNT';
end;
var
l_CurrentDir: string;
l_ErrorMode: UINT;
l_OsDependentCatalog: string;
begin
l_ErrorMode := SetErrorMode (SEM_FAILCRITICALERRORS);
try
l_CurrentDir := GetCurrentDir;
l_OsDependentCatalog := GetOsDependentCatalog;
if SetCurrentDir (l_OsDependentCatalog) then
try
f_HModule := LoadLibraryA (CLibraryName);
finally
SetCurrentDir (l_CurrentDir);
end
else
f_HModule := LoadLibraryA (PAnsiChar (l_OsDependentCatalog+'\'+CLibraryName));
if (f_HModule = HMODULE (0)) then
begin
f_HModule := LoadLibraryA (CLibraryName);
if (f_HModule = HMODULE (0)) then
raise ELoadLibraryError.Create ('Dynamic library "'+CLibraryName+'" not found');
end;
finally
SetErrorMode (l_ErrorMode);
end;
end;
procedure TStepWrapperTargetDll.DllFree;
begin
if (f_HModule <> HMODULE (0)) then
begin
try
FreeLibrary (f_HModule);
except
end;
end;
end;
constructor TStepWrapperTargetDll.Create(aClientVersion: LongWord);
begin
inherited Create;
DllLoad;
RootInit(aClientVersion);
end;
constructor TStepWrapperTargetDll.Create (aClientVersion: LongWord; const aLocale: PAnsiChar);
begin
inherited Create;
DllLoad;
RootInit(aClientVersion, aLocale);
end;
destructor TStepWrapperTargetDll.Destroy;
begin
f_DllRoot := nil;
RootDone;
DllFree;
inherited;
end;
class function TStepWrapperTargetDll.Make(const aLocale: PAnsiChar): IStepWrapperTargetDll;
begin
Result := TStepWrapperTargetDll.Create(CLibraryVersion, aLocale);
end;
class function TStepWrapperTargetDll.Make: IStepWrapperTargetDll;
begin
Result := TStepWrapperTargetDll.Create(CLibraryVersion);
end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// plain DLL method's wrappers
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function TStepWrapperTargetDll.GetVersion: LongWord;
const
CProcName = '_tie_dll_version@0';
type
TProcType = function: Integer; stdcall;
var
l_ProcAddress: Pointer;
begin
l_ProcAddress := GetProcAddress (f_HModule, PAnsiChar (CProcName));
if (not Assigned (l_ProcAddress)) then
raise EGetProcAddressError.Create ('DLL method not found: '+CLibraryName+'.'+CProcName);
Result := TProcType (l_ProcAddress);
end;
function TStepWrapperTargetDll.GetRoot: IStepWrapperTargetRoot;
const
CProcName = '_tie_dll_get_root@4';
type
TProcType = procedure (out aRoot{: IStepWrapperTargetRoot}); stdcall;
var
l_ProcAddress: Pointer;
begin
if (not Assigned (f_DllRoot)) then
begin
l_ProcAddress := GetProcAddress (f_HModule, PAnsiChar (CProcName));
if (not Assigned (l_ProcAddress)) then
raise EGetProcAddressError.Create ('DLL method not found: '+CLibraryName+'.'+CProcName);
TProcType (l_ProcAddress)(f_DllRoot);
end;
Result := f_DllRoot;
end;
procedure TStepWrapperTargetDll.RootInit (aClientVersion: LongWord; const aLocale: PAnsiChar);
const
CProcName = '_tie_dll_init_with_locale@8';
type
TProcType = procedure (aClientVersion: LongWord; const aLocale: PAnsiChar); stdcall;
var
l_ProcAddress: Pointer;
begin
l_ProcAddress := GetProcAddress (f_HModule, PAnsiChar (CProcName));
if (not Assigned (l_ProcAddress)) then
raise EGetProcAddressError.Create ('DLL method not found: '+CLibraryName+'.'+CProcName);
TProcType (l_ProcAddress) (aClientVersion, aLocale);
end;
procedure TStepWrapperTargetDll.RootInit(aClientVersion: LongWord);
const
CProcName = '_tie_dll_init@4';
type
TProcType = procedure (aClientVersion: LongWord); stdcall;
var
l_ProcAddress: Pointer;
begin
l_ProcAddress := GetProcAddress (f_HModule, PAnsiChar (CProcName));
if (not Assigned (l_ProcAddress)) then
raise EGetProcAddressError.Create ('DLL method not found: '+CLibraryName+'.'+CProcName);
TProcType (l_ProcAddress) (aClientVersion);
end;
procedure TStepWrapperTargetDll.RootDone;
const
CProcName = '_tie_dll_done@0';
type
TProcType = procedure; stdcall;
var
l_ProcAddress: Pointer;
begin
if f_HModule <> HMODULE (0) then
begin
l_ProcAddress := GetProcAddress (f_HModule, PAnsiChar (CProcName));
if (not Assigned (l_ProcAddress)) then
raise EGetProcAddressError.Create ('DLL method not found: '+CLibraryName+'.'+CProcName);
TProcType (l_ProcAddress);
end;
end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// exception maping support
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
type
TExceptionIdMapItem = record
rId: AnsiString;
rEClass: ExceptClass;
rMessage: string;
end;
resourcestring
// "Íîðìàëüíûå" òåêñòîâûå ñîîáùåíèÿ äëÿ èñêëþ÷åíèé, êîòîðûå "âèäèò" ïîëüçîâàòåëü.
// (!) Îáùèé ôîðìàò äëÿ èìåí: ñòðîêà ñ èìåíåì `S<ÈìÿÈñêëþ÷åíèÿ>` ñîîòâåòñòâóåò êëàññó ñ èìåíåì `E<ÈìÿÈñêëþ÷åíèÿ>`.
//
_SBadArgument = 'Àðãóìåíò ôóíêöèè âûõîäèò çà ãðàíèöû äîïóñòèìûõ çíà÷åíèé';
_SCantReadFile = 'Îøèáêà ïðè ÷òåíèè ôàéëà ñ äàííûìè';
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const
// Êàðòà [map] ïåðåêîäèðîâêè: òåêñòîâîé ñòðîêå ñòàâèòüñÿ â ñîîòâåòñòâèå íóæíûé ìåòà-êëàññ èñêëþ÷åíèÿ è ñîîáùåíèå.
//
cIdToExceptionMapMaxItems = 6; // ìàêñèìàëüíîå êîëè÷åñòâî ýëåìåíòîâ â òàáëèöå
type
TIdToExceptionMapArray = array [0..cIdToExceptionMapMaxItems - 1] of TExceptionIdMapItem;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
type
TIdToExceptionMap = class(TObject)
private
f_Map: TIdToExceptionMapArray;
public
constructor Create;
reintroduce;
function ConvertIdToIndex(const aId: PAnsiChar; out aIndex: Longword): Boolean;
function GetExceptionClass(anIndex: Longword): ExceptClass;
function CreateException(anIndex: Longword): Exception;
end;
{TIdToExceptionMap}
function TIdToExceptionMap.ConvertIdToIndex(const aId: PAnsiChar; out aIndex: Longword): Boolean;
var
l_Index: Longword;
begin
Result := False;
aIndex := 0;
for l_Index := Low (f_Map) to High (f_Map) do
if (StrComp (aId, PAnsiChar (f_Map[l_Index].rId)) = 0) then
begin
aIndex := l_Index;
Result := True;
Break;
end;
end;
constructor TIdToExceptionMap.Create;
procedure lp_Init(anIndex: Longword; const aGUID, aMessage: string; const aClass: ExceptClass);
begin
with f_Map[anIndex] do
begin
rId := aGUID;
rEClass := aClass;
rMessage := aMessage;
end;
end;
begin
inherited Create;
// çàïîëíåíèå f_Map
lp_Init (0, '0000-0000-0000-0000-000000000000', 'dummy exception', EStdException);
lp_Init (1, '4DDEBC97-3F88-4811-9423-8BDEE07A9C21', 'Âûõîä çà ãðàíèöû ìàññèâà', EListError);
lp_Init (2, '69708A24-C2D3-4685-8016-7E2FD8A5888C', 'Íåïðàâèëüíàÿ âåðñèÿ ÄËË', EWrongVersion);
lp_Init (3, '42540CD0-2B0C-45F2-82DB-0474D2D29867', 'No one servant was registers in factory with a given key', EUnknownFactoryKey);
lp_Init (5, '9DA313BD-767C-479D-8003-6EA2E11712E6', '_SCantReadFile', ECantReadFile);
lp_Init (6, '723AEF3B-D02F-4E18-B314-DD71CB48031C', '_SBadArgument', EBadArgument);
end;
function TIdToExceptionMap.CreateException(anIndex: Longword): Exception;
begin
with f_Map [anIndex] do
Result := rEClass.Create (rMessage);
end;
function TIdToExceptionMap.GetExceptionClass(anIndex: Longword): ExceptClass;
begin
Result := f_Map [anIndex].rEClass;
end;
var
g_ExceptionMap: TIdToExceptionMap = nil;
var
gExceptClsProc: Pointer;
gExceptObjProc: Pointer;
function GetExceptionClass (aExceptionRecord: PExceptionRecord): ExceptClass;
type
TExceptClsProc = function (aExceptionRecord: PExceptionRecord): ExceptClass;
var
lIndex: Cardinal;
begin
Result := nil;
case aExceptionRecord^.ExceptionCode of
DWORD ($E0040200):
begin
if (
((aExceptionRecord^.ExceptionFlags and EXCEPTION_NONCONTINUABLE) <> 0)
and (aExceptionRecord^.NumberParameters = 0)
) then
begin
Result := EOutOfMemory;
end;
end;
DWORD ($E0040201):
begin
if (
((aExceptionRecord^.ExceptionFlags and EXCEPTION_NONCONTINUABLE) <> 0)
and (aExceptionRecord^.NumberParameters = 1)
and (aExceptionRecord^.ExceptionInformation [0] <> 0)
) then
begin
Result := EStdException;
end;
end;
DWORD ($E0040202):
begin
if (
((aExceptionRecord^.ExceptionFlags and EXCEPTION_NONCONTINUABLE) <> 0)
and (aExceptionRecord^.NumberParameters = 1)
and (aExceptionRecord^.ExceptionInformation [0] <> 0)
) then
begin
Result := ECorbaException;
end;
end;
DWORD ($E0040203):
begin
if (
((aExceptionRecord^.ExceptionFlags and EXCEPTION_NONCONTINUABLE) <> 0)
and (aExceptionRecord^.NumberParameters = 1)
and (aExceptionRecord^.ExceptionInformation [0] <> 0)
and g_ExceptionMap.ConvertIdToIndex (PAnsiChar (aExceptionRecord^.ExceptionInformation [0]), lIndex)
) then
begin
Result := g_ExceptionMap.GetExceptionClass(lIndex);
end
else
if (
((aExceptionRecord^.ExceptionFlags and EXCEPTION_NONCONTINUABLE) <> 0)
and (aExceptionRecord^.NumberParameters = 2)
and (aExceptionRecord^.ExceptionInformation [0] = 0)
and (aExceptionRecord^.ExceptionInformation [1] <> 0)
) then
begin
Result := g_ExceptionMap.GetExceptionClass(aExceptionRecord^.ExceptionInformation [1]);
end;
end;
end;
if (
Result = nil
) then
begin
Result := TExceptClsProc (gExceptClsProc) (aExceptionRecord);
end;
end;
var
g_CorbaExceptionMessage : String = '';
g_StdExceptionMessage : String = '';
function GetExceptionObject (aExceptionRecord: PExceptionRecord): Exception;
type
TExceptObjProc = function (aExceptionRecord: PExceptionRecord): Exception;
var
lIndex: Cardinal;
begin
Result := nil;
case aExceptionRecord^.ExceptionCode of
DWORD ($E0040200):
begin
if (
((aExceptionRecord^.ExceptionFlags and EXCEPTION_NONCONTINUABLE) <> 0)
and (aExceptionRecord^.NumberParameters = 0)
) then
begin
// (!) Ñïåöèàëüíûé òðþê: ýòî èñêëþ÷åíèå î "íåõâàòêå" ïàìÿòè è îíî íå ìîæåò áûòü ñîçäàíî äèíàìè÷åñêè.
try
OutOfMemoryError ();
except
on l_Exception: EOutOfMemory do Result := l_Exception;
end;
end;
end;
DWORD ($E0040201):
begin
if ((aExceptionRecord^.ExceptionFlags and EXCEPTION_NONCONTINUABLE) <> 0) then
begin
if (
(aExceptionRecord^.NumberParameters = 1)
and (aExceptionRecord^.ExceptionInformation [0] <> 0)
) then
begin
try
g_StdExceptionMessage := PAnsiChar (aExceptionRecord^.ExceptionInformation [0]);
Result := EStdException.Create (g_StdExceptionMessage);
finally
try
CoTaskMemFree (Pointer (aExceptionRecord^.ExceptionInformation [0]));
finally
aExceptionRecord^.NumberParameters := 2;
aExceptionRecord^.ExceptionInformation [0] := 0;
aExceptionRecord^.ExceptionInformation [1] := DWORD (-1);
end;
end;
end
else
begin
if (
(aExceptionRecord^.NumberParameters = 2)
and (aExceptionRecord^.ExceptionInformation [0] = 0)
and (aExceptionRecord^.ExceptionInformation [1] = DWORD (-1))
) then
begin
Result := EStdException.Create (g_StdExceptionMessage);
end;
end;
end;
end;
DWORD ($E0040202):
begin
if ((aExceptionRecord^.ExceptionFlags and EXCEPTION_NONCONTINUABLE) <> 0) then
begin
if (
(aExceptionRecord^.NumberParameters = 1)
and (aExceptionRecord^.ExceptionInformation [0] <> 0)
) then
begin
try
g_CorbaExceptionMessage := PAnsiChar (aExceptionRecord^.ExceptionInformation [0]);
Result := ECorbaException.Create (g_CorbaExceptionMessage);
finally
try
CoTaskMemFree (Pointer (aExceptionRecord^.ExceptionInformation [0]));
finally
aExceptionRecord^.NumberParameters := 2;
aExceptionRecord^.ExceptionInformation [0] := 0;
aExceptionRecord^.ExceptionInformation [1] := DWORD (-1);
end;
end;
end
else
begin
if (
(aExceptionRecord^.NumberParameters = 2)
and (aExceptionRecord^.ExceptionInformation [0] = 0)
and (aExceptionRecord^.ExceptionInformation [1] = DWORD (-1))
) then
begin
Result := ECorbaException.Create (g_CorbaExceptionMessage);
end;
end;
end;
end;
DWORD ($E0040203):
begin
if ((aExceptionRecord^.ExceptionFlags and EXCEPTION_NONCONTINUABLE) <> 0) then
begin
if (
(aExceptionRecord^.NumberParameters = 1)
and (aExceptionRecord^.ExceptionInformation [0] <> 0)
) then
begin
try
if (
g_ExceptionMap.ConvertIdToIndex (PAnsiChar (aExceptionRecord^.ExceptionInformation [0]), lIndex)
) then
begin
Result := g_ExceptionMap.CreateException(lIndex);
end;
finally
try
CoTaskMemFree (Pointer (aExceptionRecord^.ExceptionInformation [0]));
finally
aExceptionRecord^.NumberParameters := 2;
aExceptionRecord^.ExceptionInformation [0] := 0;
aExceptionRecord^.ExceptionInformation [1] := DWORD (lIndex);
end;
end;
end
else
begin
if (
(aExceptionRecord^.NumberParameters = 2)
and (aExceptionRecord^.ExceptionInformation [0] = 0)
and (aExceptionRecord^.ExceptionInformation [1] <> 0)
) then
begin
lIndex := Longword (aExceptionRecord^.ExceptionInformation [1]);
Result := g_ExceptionMap.CreateException(lIndex);
end;
end;
end;
end;
end;
if (Result = nil) then
begin
Result := TExceptObjProc (gExceptObjProc) (aExceptionRecord);
end;
end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure ExitProc;
begin
ExceptObjProc := gExceptObjProc;
ExceptClsProc := gExceptClsProc;
FreeAndNil(g_ExceptionMap);
end;
procedure InitProc;
begin
g_ExceptionMap := TIdToExceptionMap.Create;
gExceptClsProc := ExceptClsProc;
gExceptObjProc := ExceptObjProc;
//
ExceptClsProc := @GetExceptionClass;
ExceptObjProc := @GetExceptionObject;
end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
initialization
InitProc;
finalization
ExitProc;
Finalize(g_CorbaExceptionMessage);
Finalize(g_StdExceptionMessage);
end.