Article View: net.micro.pc
Article #5627Re: where are you after a batch file
From: hamilton
Date: Wed, 12 Feb 1986 08:27
Date: Wed, 12 Feb 1986 08:27
32 lines
2501 bytes
2501 bytes
>> Now, a suggestion: why doesn't somebody write a program that either (a) keeps
>> the directory stack in the environment, instead of having to have a writeable
>> file sitting around on disk and doing disk accesses for directory
>> pushing/popping?
>
>[this] is a great idea, but I've never seen anybody propose a method
>for handling this. You have to remember that when a program is run by
>DOS, it is given a COPY of the original environment. You can write a
>program to modify that environment (though it is still unclear how you
>know how much space that environment has been allocated, as opposed to how
>much it is using). You could even use Microsoft C 3.0's builtin functions
>for doing this. But when your program exits the old environment will be
>restored with none of your changes.
well, there is an ugly way to do this (modify command.com's copy of the
environment). i did some exploring some time back, and figured how to
scan memory and recognize memory control blocks. you can also find out
where command.com is (the para is all you want) from one of the several
pointers to it in your psp. the first memory control block before the
one containing command.com (if i remember right) is the one containing
command.com's environment (i _said_ it was ugly). the control block
tells you how much space is allocated to the environment, and you parse
to find how much was used. i wrote a little program using a scan for
control blocks to produce a map of allocated memory; the result is
slightly useful as a substitute for a "ps".
wayne hamilton
U of Il and US Army Corps of Engineers CERL
UUCP: {ihnp4,pur-ee,convex}!uiucdcs!uiucuxc!hamilton
ARPA: hamilton%uiucuxc@a.cs.uiuc.edu USMail: Box 476, Urbana, IL 61801
CSNET: hamilton%uiucuxc@uiuc.csnet Phone: (217)333-8703
Technical Details
Message-ID:
<21900112@uiucuxc>Path:
arc1-ca.pugleaf.net!utzoo!linus!decvax!bellcore!ulysses!mhuxr!mhuxt!houxm!ihnp4!inuxc!pur-ee!uiucdcs!uiucuxc!hamiltonReferences:
<440@tekig5.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.7.0.10 $; site uiucuxc Path: arc1-ca.pugleaf.net!utzoo!linus!decvax!bellcore!ulysses!mhuxr!mhuxt!houxm!ihnp4!inuxc!pur-ee!uiucdcs!uiucuxc!hamilton From: hamilton@uiucuxc.CSO.UIUC.EDU Newsgroups: net.micro.pc Subject: Re: where are you after a batch file Message-ID: <21900112@uiucuxc> Date: Wed, 12-Feb-86 03:27:00 EST Article-I.D.: uiucuxc.21900112 Posted: Wed Feb 12 03:27:00 1986 Date-Received: Fri, 14-Feb-86 07:43:24 EST References: <440@tekig5.UUCP> Lines: 32 Nf-ID: #R:tekig5.UUCP:440:uiucuxc:21900112:000:1795 Nf-From: uiucuxc.CSO.UIUC.EDU!hamilton Feb 12 02:27:00 1986