CTRL-break handling in the Freepascal programs (Developers)
> As you maybe know, FPC uses the DJGPP compatible memory and interrupt
> architecture (but not the LibC library).
>
> One of the consequencies is that the FPC programs can be anytime
> interrupted by CTRL-C, CTRL-Break and CTRL-\
>
> It is not always the desidered behaviour.
> Unfortunately, the FreePascal documentation says nothing about it.
>
> However for a quite long time I know that the CTRL-C and CTRL-\ signaling
> can be turned off by calling <Set_CTRL_C(false)> from unit DPMIExcp.
>
> But this does not help for CTRL-Break.
>
> I had to investigate the DJGPP sources and there I found that there is a
> variable __djgpp_hwint_flags.
>
> It has even an alias in the DPMIExcp to <djgpp_hwint_flags>
>
> So, the magic code for turning off the CTRL-C, CTRL-Break and CTRL-\ is:
>
> var djgpp_hwint_flags : word;external name '___djgpp_hwint_flags';
> begin
> djgpp_hwint_flags:=3;
> writeln('Do not shy to press CTRL-C or CTRL-Break and then Enter);
> readln;
> writeln('We survived the CTRL-C and CTRL-Break');
> end.
>
>
> Note, that in the code I set the <djgpp_hwint_flags> to WORD and not to
> LONGINT like is done in the DPMIEXCP.
> I am pretty sure that that is a bug in DPMIEXCP code (it should really be
> WORD)
Q: With all of that turned-off,
is there some other key press which _can_ be used to interupt the program
if one should desire to do so ?
---
--
http://glennmcc.org/
Complete thread:
- CTRL-break handling in the Freepascal programs - Laaca, 15.10.2022, 00:52
- CTRL-break handling in the Freepascal programs - glennmcc, 15.10.2022, 02:09
- CTRL-break handling in the Freepascal programs - Laaca, 15.10.2022, 08:31
- CTRL-break handling in the Freepascal programs - glennmcc, 15.10.2022, 02:09