Xref: utzoo comp.windows.ms:8324 comp.sys.ibm.pc.misc:5395 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!caen!news.cs.indiana.edu!ariel.unm.edu!hydra.cirt.unm.edu!mikep From: mikep@hydra.cirt.unm.edu (Mike Prine CIRT) Newsgroups: comp.windows.ms,comp.sys.ibm.pc.misc Subject: Repost(DOS 3.x Patches) Keywords: DOS 3.x, environment, echo, not for version 4 Message-ID: <1991Jan10.010337.29586@ariel.unm.edu> Date: 10 Jan 91 01:03:37 GMT Sender: news@ariel.unm.edu (News supported software) Organization: University of New Mexico, Albuquerque Lines: 387 John Wright, the original author, posted this article to the net over a year ago but with the recient interest on the topic I thought a repost would be useful. I have used these patches, particularly the environment size, over the years and not encountered any problems but your mileage may vary. Enjoy! Note: I lost my online copy due to multiple disk problems so had to reenter it by scanner and correct typos. Although I have checked the code for typos don't assume I caught them all. For most users deleting everything except the 1st patch is probably best but proceed with caution in any case and make sure you have backups and a bootable floppy before trying any of this. At the end I have included info on the offsets of the various patches for several versions of DOS we had. If John Wright, the original author, is still around maybe he could make this or a more current vesion avaliable for FTP from one of the common sites for such things. From ariel!nmvax!tut.cis.ohio-state.edulclca!ctrsol!ginosko!uunet!cs.dal.ca~lane ~c Artlcle 36807 of comp.sys.ibm.pc: Path: arlel!unmvax!t~t.cis~ohio-state~edu!cicalctrsol!linosko!uunet?cs.dal~ca~lane >From: lan~cs-d~l-ca (John Wright/Dr. Pat Lane) Newsgroups: comp.sys.ibm.pc Subject: Patches to COMMAND.COM for DOS3.3x (LONG) Summary: My old set of patches updated for several vers of DOS 3.3 Keywords: DOS COMMAND.COM patch environment size echo Message-ID: 8~Au~l4~o44~r~ 647~ics~da Date; 14 Aug 89 04:41:11 GMT Organization: Math, Stats & CS, Dalhousie University, Halifax, NS, Canada Lines: 325 Some time ago I posted a set of Patches for COMMAND.COM to do some nice things like increace the default environment size and make ECHO OFF the default for all batch files. All these patches had been Posted on Usenet before but usually for a single version of DOS. I presented the patches for several versions 3.10 to 3.30, from IBM, Microsoft and Compaq. In this posting I present the patches for versions: IBM PCDOS 3.30, Microsoft MSDOS 3.30 and Compaq MSDOS 3.31. In a companion posting to this one, I present patches for IBM PCDOS 4.00, Microsoft MSDOS 4.00 and Microsoft MSDOS 4.01. Of course many of these Patches are no longer as useful since DOS now provides other means of accomplishing the same things. But some, myself included, may still find these patches to be preferable. Since DOS 3.10, you can set the size of the environment space by using the /E parameter of COMMAND.COM (least we forget, it's /E:xxxx where) XXXX is in 16 byte paragraphs for DOS 3.10 or bytes for 3.20 and up). This as usually done by using SHELL= in the CONFIG.SYS file to specify the string DOS uses to call COMMAND.COM for the initial invocation . The drawback to this is that it only applies to the first, bottom level shell. If you run COMMAND again (without a /E) it will just use the default size of 160 byte, (unless the environment is already bigger than 160 bytes in which case it will use the environment size rounded up to the next 16 bytes). If you go into another program and "drop down" into DOS or if you use a shell program to run DOS commands you, you are actually re-running COMMAND with the default environment size and it won't be long before you get that "Out of environment space" message. It's amazing that DOS has gone so far without anybody doing something about it (like making the default bigger or providing some mechanism whereby the size specified in CONFIG.SYS would carry though to all subsequent invocations of COMMAND). Since DOS 3.30, you can prevent batch file lines from being displayed by putting a '@' before them. An '@echo off' as the first line will prevent all lines in the file (including the 'echo off') from being echoed. This solution, while upwardly compatible, is Just plain ugly. Also lt causes problems if you take your batch files to a system running a lower version of DOS. To produce a blank line, you can use 'echo' followed by an unprintable character (such as DEL) which makes creatiny or editing the file more difficult, but seems to work in every version of DOS. Since some version of DOS (not sure which), 'echo.' works, though I've never seen it documented. I include the 'echo-space' Patch mainly for upward compatibility. Users please note that these patches have been tested rather perfunctorily and should be used with some caution. Definitely keep an unpatched copy of COMMAND.COM on a bootable disk. If you mess up your regular copy of COMMAND.COM, you won't be able boot with it; you'll have to boot from the floppy and copy the original COMMAND.COM over the messed up one before you can reboot normally. Following the presentation of the patches for the various DOS versions, I list a couple of batch files I use for effecting the patches. Following that I list the dis-assembled code around the patched areas so that those with DOS versions other than those shown will be able to find the proper offsets. Remember to add 100h to offsets when patching with DEBUG. OFFSETS for patch to COMMAND.COM for IBM PCDOS 3.30 or COMPAQ PCDOS 3.31 Default environment size of 512 bytes [0DB8] = 0A 00 -> 20 00 (any size environment from 160 to 32768 bytes (000A to 0800 hex) can be made the default by coding the ammount, divided by 16, in hexadecimal digits, at the address shown with the low order byte first) ECho OFF for AUTOEXEC.BAT [1204] = 03 -> 02 Echo off for batch files except AUTOEXEC.BAT [1C68] = 01 -> 00 ECHO produces blank line [3E29] = E8 20 00 74 -> 83 F9 01 72 COMMAND.COMs in IBM 3.30 and COMPAQ 3.31 appear to be identical except for version no., identification and copyright strings. OFFSETS for patch to COMMAND.COM for Microsoft MSDOS 3.30 Default environment size of 512 bytes [0DB8] = 0A 00 -> 20 00 ECHO OFF for AUTOEXEC.BAT [1205] = 03 -> 02 Echo off for batch files except AUTOEXEC.BAT [1C68] = 01 -> 00 ECHO produces blank line [3E29] = E8 20 00 74 -> 83 F9 01 72 Microsoft MSDOS 3.30 COMMAND.COM has some minor differences with IBM PCDOS 3.30 (besides identification and copyright strings) and there is one offset which is changed ([1205] instead of [1204]). Following are two batch files PATCH.BAT and UNPATCH.BAT for installing and un-installing the patches for IBM PC-DOS 3.30. It should be easy enough to modify this for other DOS 3 verslons. --------------------- PATCH.BAT for IBM PCDOS 3.30 ---------------------- echo off echo INSTALL COMMAND.COM PATCHS FOR IBM PC-DOS 4.00 rem usage PATCH [filespec] rem Patch 1. Default environment size is 512 bytes rem Patch 2. ECHO OFF default for AUTOEXEC.BAT rem Patch 3. ECHO OFF default for batch files except AUTOEXEC.BAT rem Patch 4. ECHO-space produces blank line if "%1"=="" goto :default set $s=%1 echo About to modify %$s% goto pause :default set $s=COMMAND.COM echo About to Modify %$s% in the dcfault drive and directory pause :pause if not exist %$s% goto error echo creating PATCH.TMP... echo e0EB8 >patch.tmp echo 20 00 >>patch.tmp rem end of patch 1 echo e1304 >>patch.tmp echo 02 >>patch.tmp rem end of patch 2 echo e1D68 >>patch.tmp echo 00 >>patch.tmp rem end of patch 3 echo e3F29 >>patch.tmp echo 83 F9 01 72 >>patch.tmp rem end of patch 4 echo w >>patch.tmp echo q >>patch.tmp debug %$s% patch.tmp echo 0A 00 >>patch.tmp rem end of patch 1 echo e1304 >>patch.tmp echo 03 >>patch.tmp rem end of patch 2 echo e1D68 >>patch.tmp echo 01 >>patch.tmp rem end of patch 3 echo e3F29 >>patch.tmp echo E8 20 00 74 >>patch.tmp rem end of patch 4 echo w >>patch.tmp echo q >>patch.tmp debug %$s% 83F901 CMP CX,+01 2320:3F2C 7409 JZ 3F37 -> 7209 JB 3F37 2320:3F2E BA8200 MOV DX,0082 2320:3F31 E810F1 CALL 3044 2320:3F34 E9AFF0 JMP 2FE6 Look for 'BA 82 00 E8'. Good luck and let me know lf you have problems with these patches. -- John Wright //////////// Phone: 902-424-3805 or 902-424-6527 Post: c/o Dr Pat Lane, Biology Dept, Dalhousie U, Hlalifax N.S., CANADA B3H-4H8 Cdn/Eannet:lane@cs.dal.cdn Uucp:lane@dalcs.uucp or {uunet watmath}!dalcsllane Arpa;lane~dalc,.uucp~uunet.uu.net Internet:lane~c,.dal.c~ -- John Wright //////////// Phone: 902-424-3805 or 902-424-6527 ======================================================================== end of original article ======================================================================== Offset information for some other DOS versions ======================================================================== ======================================================================== Version Environment Echo-1 Echo-2 Echo-3 MSDOS 3.10 0DE1 112B 19C7 38E8 MSDOS 3.20 0E2F 123E 1BAC 3B48 MSDOS 3.21 0E2F 123E 1BBC 3B58 PCDOS 3.30 0EB8 1304 1D68 3F29 MSDOS 3.30+ 0EB8 1304 1DF7 3FF9 Telex 3.30 0EB8 1304 1DF7 3F49 Telex 3.21 0D4F 115E 1ABC 3A18 Enjoy. Mike Prine ~ ~ ~ ~ ~ ~ ~ ~ ~