In order to let our TSynLog logging class intercept all
exceptions, we use the low-level global RtlUnwindProc pointer,
defined in System.pas.
Alas, under Delphi 5, this global RtlUnwindProc variable is not
existing. The code calls directly the RtlUnWind Windows API
function, with no hope of custom interception.
Two solutions could be envisaged:
- Modify the
Sytem.pas source code, adding the new
RtlUnwindProc variable, just like Delphi 7;
- Patch the assembler code, directly in the process memory.
The first solution is simple. Even if compiling System.pas is a
bit more difficult than compiling other units, we already made that for our
Enhanced
RTL units. But you'll have to change the whole build chain in order to
use your custom System.dcu instead of the default one. And some
third-party units (only available in .dcu form) may not like the
fast that the System.pas interface changed...
So we used the second solution: change the assembler code in the running
process memory, to let call our RtlUnwindProc variable instead of
the Windows API.