🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #2316

Re: Long command lines

#2316
From: Risto Kankkunen
Date: Fri, 21 Sep 1990 21:24
41 lines
2993 bytes
In article <10535@pt.cs.cmu.edu> ralf@b.gp.cs.cmu.edu (Ralf Brown) writes:
>In article <1990Sep21.104931.9205@canterbury.ac.nz> phys169@canterbury.ac.nz writes:
>}In article <10522@pt.cs.cmu.edu>, ralf@b.gp.cs.cmu.edu (Ralf Brown) writes:
>}>Actually, the place it would need to be implemented is in the EXEC DOS call,
>}>since that is what builds the environment copy and adds the program name.
>}
>}But a command processor could set up the environment with the parameters there
>}without waiting for a new DOS, or requiring users to upgrade their whole o/s.
>}True, it would be nicer to get the DOS call to some of the work, but I'm still
>}correct in saying that it is really essential for the command interpreters to
>}do their bit.
>
>Sorry, that won't work, since anything after the environment (such as extra
>parameters) is *NOT* copied when making a copy of the environment for the
>EXECed program.  That's why the DOS call has to add the extra parameters as
>it now adds the program name, if you want to pass a long commandline after
>the program name.

Yes, you're right. When I made the original suggestion I had not tested
the method, only read the interrupt list. I got the impression that if
the execing program builds the environment itself (instead of passing 0
as environment segment), DOS would not touch the segment. After your
comment I made a test program and found out that this is not the case.

I then noticed that there is the (undocumented) call 4b01, that only
loads a program. I think it would be possible to pass a long command
line using this call. First load the program letting DOS to stuff the
program name at the end of the environment. Then find this position of
the environment and add the command line parameters after that. It might
be necessary to pad the environment before the call so there is enough
room for the parameters. Finally, transfer control to the child program.

I tried to do this in a small test program, and it seemed it could be
done. The only problem I had was how to call the child program. What is
needed to pass the control to it? I tried to JMP or CALL to the initial
CS:IP and setting INT 22 to point to parent's return address, but this
didn't quite work. Any help?
-- 
 Risto Kankkunen                   kankkune@cs.Helsinki.FI (Internet)
 Department of Computer Science    rkankkunen@finuh         (Bitnet)
 University of Helsinki, Finland   ..!mcvax!uhecs!kankkune   (UUCP)
Technical Details
Message-ID: <7212@hydra.Helsinki.FI>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!news.funet.fi!hydra!kankkune
References: <10522@pt.cs.cmu.edu> <1990Sep21.104931.9205@canterbury.ac.nz> <10535@pt.cs.cmu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!news.funet.fi!hydra!kankkune
From: kankkune@cs.Helsinki.FI (Risto Kankkunen)
Newsgroups: comp.os.msdos.programmer
Subject: Re: Long command lines
Message-ID: <7212@hydra.Helsinki.FI>
Date: 21 Sep 90 21:24:35 GMT
References: <10522@pt.cs.cmu.edu> <1990Sep21.104931.9205@canterbury.ac.nz> <10535@pt.cs.cmu.edu>
Organization: University of Helsinki, Department of Computer Science
Lines: 41