set byte [SDA + 39h] during process termination, turn abort to fail

This is compatible to lMS-DOS which sets the flag before running
int 2Fh function 1122h [1] and clears it after closing handles and
freeing memory [2], before branching to the Parent Return Address.

The flag turns any int 24h abort response into a fail instead, to
avoid iterating infinitely during file handle closing.

[1]: https://hg.pushbx.org/ecm/msdos4/file/c057c6a1c9ad/src/DOS/ctrlc.nas#l752
[2]: https://hg.pushbx.org/ecm/msdos4/file/c057c6a1c9ad/src/DOS/ctrlc.nas#l829
This commit is contained in:
E. C. Masloch 2025-08-22 17:57:01 +02:00 committed by Kenneth J Davis
parent 3c751e2e28
commit 80d140984b
4 changed files with 10 additions and 0 deletions

View File

@ -42,6 +42,7 @@ segment HMA_TEXT
extern _ErrorMode extern _ErrorMode
extern _InDOS extern _InDOS
extern _term_type extern _term_type
extern _abort_progress
%IFDEF WIN31SUPPORT %IFDEF WIN31SUPPORT
extern _winInstanced extern _winInstanced
%ENDIF ; WIN31SUPPORT %ENDIF ; WIN31SUPPORT
@ -742,6 +743,9 @@ CritErrExit:
; Abort processing. ; Abort processing.
; ;
CritErrAbort: CritErrAbort:
test byte [_abort_progress], -1
mov al, FAIL
jnz CritErrExit
%if 0 %if 0
mov ax,[_cu_psp] mov ax,[_cu_psp]
mov es,ax mov es,ax

View File

@ -308,6 +308,7 @@ extern BYTE
ASM swap_always[], /* " " */ ASM swap_always[], /* " " */
ASM swap_indos[], /* " " */ ASM swap_indos[], /* " " */
ASM term_type, /* 0 normal, 1 ^C, 2 int 24h, 3 TSR */ ASM term_type, /* 0 normal, 1 ^C, 2 int 24h, 3 TSR */
ASM abort_progress, /* set during process termination */
ASM break_flg, /* true if break was detected */ ASM break_flg, /* true if break was detected */
ASM break_ena; /* break enabled flag */ ASM break_ena; /* break enabled flag */
extern void FAR * ASM dta; /* Disk transfer area (kludge) */ extern void FAR * ASM dta; /* Disk transfer area (kludge) */

View File

@ -796,6 +796,7 @@ _DayOfWeek db 2 ; 36 - day of week
_console_swap db 0 ; 37 console swapped during read from dev _console_swap db 0 ; 37 console swapped during read from dev
global _dosidle_flag global _dosidle_flag
_dosidle_flag db 1 ; 38 - safe to call int28 if nonzero _dosidle_flag db 1 ; 38 - safe to call int28 if nonzero
global _abort_progress
_abort_progress db 0 ; 39 - abort in progress _abort_progress db 0 ; 39 - abort in progress
global _CharReqHdr global _CharReqHdr
_CharReqHdr: _CharReqHdr:

View File

@ -588,6 +588,8 @@ VOID return_user(void)
setvec(0x23, p->ps_isv23); setvec(0x23, p->ps_isv23);
setvec(0x24, p->ps_isv24); setvec(0x24, p->ps_isv24);
abort_progress = -1;
/* And free all process memory if not a TSR return */ /* And free all process memory if not a TSR return */
network_redirector(REM_PROCESS_END); network_redirector(REM_PROCESS_END);
/* might be a good idea to do that after closing /* might be a good idea to do that after closing
@ -607,6 +609,8 @@ VOID return_user(void)
cu_psp = p->ps_parent; cu_psp = p->ps_parent;
q = MK_FP(cu_psp, 0); q = MK_FP(cu_psp, 0);
abort_progress = 0;
irp = (iregs FAR *) q->ps_stack; irp = (iregs FAR *) q->ps_stack;
irp->CS = FP_SEG(p->ps_isv22); irp->CS = FP_SEG(p->ps_isv22);