Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

CTRL-break handling in the Freepascal programs (Developers)

posted by glennmcc Homepage E-mail, North Jackson, Ohio (USA), 15.10.2022, 02:09

> 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:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 77 users online (0 registered, 77 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum