Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!ucsd!usc!cs.utexas.edu!uunet!zephyr.ens.tek.com!tekcrl!tekgvs!toma From: toma@tekgvs.LABS.TEK.COM (Tom Almy) Newsgroups: comp.sys.ibm.pc Subject: Re: Changing stack size in a .EXE file Message-ID: <6418@tekgvs.LABS.TEK.COM> Date: 28 Nov 89 16:42:10 GMT References: <1026@kosman.UUCP> Reply-To: toma@tekgvs.LABS.TEK.COM (Tom Almy) Organization: Tektronix, Inc., Beaverton, OR. Lines: 26 In article <1026@kosman.UUCP> kevin@kosman.UUCP (Kevin O'Gorman) writes: >I have a need to enlarge the stack for an existing .EXE file. I understand >that if I had any MS language, I would have EXEMOD.EXE, which does this >sort of thing. Unfortunately, I don't and I don't. [...] >Could someone who understands these things enlighten me? Life is not simple, with or without EXEMOD. If the stack is located at the end of the load module (as is the case with most programs, including Microsoft compiled) then the word at displacement 10H into the EXE file contains the initial SP value, which can be made larger, and the Minimum number of paragraphs needed (and the maximum required, which much be larger) at offsets 0AH and 0CH respectively need to be inlarged as well. Unfortunately (?) a number of compilers, including Borland Turbo C, carve out their own stack at runtime. The size of the stack is given as a compiler option, an initialized variable (the case with Turbo C), or can be overridden at execution time on the command line (Zortech, Lattice). In the last case, the fix is simple since you can invoke the program specifying the stack size. In the other cases you are out of luck -- no ammount of header twiddling will change the size of the stack. Tom Almy toma@tekgvs.labs.tek.com Standard Disclaimers Apply