[comp.sys.ibm.pc] Procomm and DOS 3.x

gwr@linus.UUCP (Gordon W. Ross) (07/13/87)

Due to recent queries by Michael Hunter and M. Smith I have decided to
re-post the patch I developed and posted about a year ago.  Please
note that the patch given here is the least intrusive one.  I posted a
different one much earlier which disabled the stack check routine.

Procomm stack overflow patch:

Symptoms:
	Procomm v. 2.42 when running on PC DOS 3.2 and MS DOS 3.x
(some versions) will hang if CTRL-BREAK is pressed.  The message
"stack overflow" will be emitted as well as possibly some garbage
before the computer "locks up."

Cure: (Patching procedure)
With a copy of your procomm.exe file (not the original of course) do:

	RENAME PROCOMM.EXE PROCOMM.BIN
	DEBUG PROCOMM.BIN
	E 83D 90 90 90
	W
	Q
	RENAME PROCOMM.BIN PROCOMM.EXE

The above procedure assumes procomm.exe is in the current directory
and debug is loadable (in current dir, or in a dir in PATH).  If
anything happens which is not understood, simply omit the W command
above (which writes to disk) and use Q (to quit) instead.

Technical details:
	Procomm v. 2.42 has a stack checker which is called on
function entry to insure sufficient stack space for the function to
execute.  PC DOS 3.2 and some MS DOS 3.x versions have an "improved"
stack management service which insures that each new hardware
interrupt which occurs is given a new stack to use in its interrupt
service routine.  The size of these stacks and their number are
settable with the CONFIG.SYS option STACKS=n,s (number, size).  
	The "stack overflow" error discovered by procomm occurs
because DOS, in response to the CTRL-BREAK interrupt, has switched
stacks to one from the DOS stack pool, and Procomm is assuming its own
stack is still in use.  The limits used in the stack check routine
fail because the DOS stacks are normally much smaller (512 bytes by
default) than the stack used by Procomm.
	The easiest way to solve the disagreement about stack
ownership is to remove the call to the stack checking routine from the
interrupt handler for CTRL-BREAK.  The above patch does exactly this.
Procomm is otherwise happy to use the DOS supplied stack since
servicing the BREAK request does not require lots of stack space.   
	There may be another option for DOS 3.3 users:  It is possible
with DOS 3.3 to disable the DOS stack swapping by putting STACKS=0 in
the CONFIG.SYS file.  I have not tried this, but my understanding of
the problem indicates this should also work.
-- 
    Gordon W. Ross              Phone: (617) 271-3205
    The MITRE Corporation       ARPA: linus!gwr@MITRE-BEDFORD
    Bedford, MA  01730		UUCP: decvax!linus!gwr