Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!comp.vuw.ac.nz!csc.canterbury.ac.nz!phys169 From: phys169@csc.canterbury.ac.nz Newsgroups: comp.lang.pascal Subject: Re: Change ENV. Message-ID: <1991Jan16.141910.17@csc.canterbury.ac.nz> Date: 16 Jan 91 03:25:17 GMT References: <25474@adm.brl.mil> <1991Jan14.143941.10541@javelin.es.com> Organization: University of Canterbury, Christchurch, New Zealand Lines: 42 In article , thoger@solan.unit.no (Terje Th|gersen) writes: > There's a problem with the Int2Eh approach, though. According to some > refences, the use of INt2e will abort an executing batchfile. > Also, a program that used Int2eh (which was posted here recently) > bombed under QEMM 5.11, giving a exception #13.. > Was that my program? (Sorry, the NEWS has been down here for a while; I would have missed any follow-ups). Yes, the int 2E method has 2 limitations that I know of: (1) Bad effects in batch files, since the source of commands is now a batch file, (2) Early versions of DOS either didn't have int 2E or changed lots of registers, making life difficult, but not impossible. > A safer approach, as used by Microsoft in their WHAT.EXE, (a freebie that > came with masm 5.0) is as follows : > [stuff deleted about chasing back through the PSP chain] That is the best method, but somebody told me there were problems sometimes when trying to extend the memory. Possibly the problem is that programs down the chain look at their PSP to determine the environment starting address once at the start of execution, and assume it hasn't changed after that. Anyone know for sure if any programs do that?? The ideal would be (in my opinion) just one copy of the environment, with a bit of extra space at the end of it, in case it wants to grow. Many o/s keep giving sub-processes their own copy of the environment - I can see how that *might* be nice sometimes, but I've never ever found it useful in practice. Any comments?? > If you insert extra bytes into the env. area, you must be sure that you > don't go out of the max number allocated to the environment. There's a > word in the PSP somewhere that gives you the size of the environment area > in 16-byte paragraphs, but I just can't remember which. (I don't have > the code here, I'm afraid..) I think i found it in one of the public > domain dos tech. ref. documents. > I think what you're looking for the the memory allocation block parameters, at the segment just before the start of the environment, that contains the size and segment of the next MCB. Mark Aitchison.