Xref: utzoo comp.sys.ibm.pc:29781 comp.binaries.ibm.pc.d:3330 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!uxc!iuvax!bobmon From: bobmon@iuvax.cs.indiana.edu (RAMontante) Newsgroups: comp.sys.ibm.pc,comp.binaries.ibm.pc.d Subject: Re: How to hide 'echo off' in batch files? Summary: COMMAND.COM patches (long) Message-ID: <21667@iuvax.cs.indiana.edu> Date: 6 Jun 89 14:06:46 GMT References: <562@megatek.UUCP> <2551@infocenter.UUCP> Reply-To: bobmon@iuvax.cs.indiana.edu (RAMontante) Organization: malkaryotic Lines: 185 Oh well, for people who think that patching brain-damaged software is a Good Thing to Do, here are the batch-file patches I've used, with context. They've worked on MS-DOS v2.11 through v3.21, and might work on later versions. "Enjoy." p.s. Two separate patches are involved. I was told that my description of which patch fixes which batch file is backwards, but I can't remember whether I updated the descriptions or not. Usually both patches are desired anyway. Also, some miscellaneous patches and some notes are at the end. ____________________________________________ This file is basically an annotated script from a DEBUG session, plus some appended trivia. If you can't figure out how to use DEBUG this won't be very clear, but then it won't be much use either. For each patch, I start by searching for a target string (that's the "s" command). I unassemble the surrounding locations to be sure I have what I want ("u"), then I change the indicated byte ("e"). DOS Echo-Off Patches ~~~~~~~~~~~~~~~~~~~~ C:\MISC debug command.com - - -{ ECHO OFF default for AUTOEXEC.BAT } - -s cs:100 2000 00 bb 03 00 b4 48 cd 21 5BE4:122D - -u 122d 5BE4:122D 00BB0300 ADD [BP+DI+0003],BH { the } 5BE4:1231 B448 MOV AH,48 { search } 5BE4:1233 CD21 INT 21 { string } 5BE4:1235 7271 JB 12A8 5BE4:1237 A37B0B MOV [0B7B],AX 5BE4:123A C606D00B02 MOV BYTE PTR [0BD0],03 <-- change to 02 5BE4:123F 8EC0 MOV ES,AX ~~~~~~~~~~~~ 5BE4:1241 33FF XOR DI,DI 5BE4:1243 B000 MOV AL,00 5BE4:1245 AA STOSB 5BE4:1246 33C0 XOR AX,AX 5BE4:1248 AB STOSW 5BE4:1249 AB STOSW 5BE4:124A B8FFFF MOV AX,FFFF - -e 123e 5BE4:123E 03.02 { make the change } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -{ ECHO OFF default for } -{ alternate search: -scs:100 2000 81 c3 b8 00 } - -s cs:100 2000 24 01 50 e8 96 00 5BE4:1BBB - -u 1bb0 5BE4:1BB0 06 PUSH ES 5BE4:1BB1 E88C1A CALL 3640 5BE4:1BB4 E86AFF CALL 1B21 5BE4:1BB7 26 ES: 5BE4:1BB8 A0D00B MOV AL,[0BD0] 5BE4:1BBB 2401 AND AL,01 <-- change to 00 5BE4:1BBD 50 PUSH AX ~~~~~~~~~~~~ 5BE4:1BBE E89600 CALL 1C57 { search string ends here } 5BE4:1BC1 BEAB3D MOV SI,3DAB 5BE4:1BC4 E8D415 CALL 319B 5BE4:1BC7 8BD9 MOV BX,CX 5BE4:1BC9 81C3B800 ADD BX,00B8 { alternate search string } 5BE4:1BCD 51 PUSH CX 5BE4:1BCE B104 MOV CL,04 - -e 1bbc 5BE4:1BBC 01.00 { make the change } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { make CLS clear 25 lines of screen [it doesn't normally?] } - -u 2690 xxxx:2690 CD10 INT 10 xxxx:2692 B40F MOV AH,0F xxxx:2694 CD10 INT 10 xxxx:2696 8AD4 MOV DL,AH xxxx:2698 FECA DEC DL xxxx:269A B618 MOV DH,18 ^^-- originally 19 xxxx:269C 33C0 XOR AX,AX ~~~~~~~~~~~~~ xxxx:269E 8BC8 MOV CX,AX xxxx:26A0 BB0007 MOV BX,0700 xxxx:26A3 B406 MOV AH,06 xxxx:26A5 CD10 INT 10 xxxx:26A7 33D2 XOR DX,DX xxxx:26A9 B700 MOV BH,00 xxxx:26AB B402 MOV AH,02 xxxx:26AD CD10 INT 10 xxxx:26AF C3 RET - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { make ECHO[spacechar] give a blank line; [spacechar] is a single char. } - -u38e1 xxxx:38E1 C3 RET xxxx:38E2 8026zzzzFE AND BYTE PTR [zzzz],FE xxxx:38E7 C3 RET xxxx:38E8 E82000 CALL 390B <-- xxxx:38EB 7409 JZ 38F6 <-- xxxx:38ED BA8200 MOV DX,0082 xxxx:38F0 E8AAF1 CALL 2A9D xxxx:38F3 E949F1 JMP 2A3F xxxx:38F6 8E1Exxxx MOV DS,[xxxx] xxxx:38FA 8A1Ezzzz MOV BL,[zzzz] xxxx:38FE 0E PUSH CS xxxx:38FF 1F POP DS xxxx:3900 80E301 AND BL,01 - -q C:\MISC - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - In above -- zzzz represents a constant value, here 0b9e unassemblies: xxxx represents miscellaneous values __________________________________________________________________________ version \AUTOEXEC.BAT other.BAT 25-line CLS echo ~~~~~~~ ~~~~~~~~~~~~~ ~~~~~~~~~ ~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ patches 01 -> 00 03 -> 02 19 -> 18 e8200074 -> 83f90172 Location Offsets (per John Wright etc.) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ MSDOS 3.10 IBM/Compaq/generic 105B 1967 263B 3878 Zenith (early?) ?? 1987 ?? Zenith (IO.SYSv3.12) 112B 19C7 269B 38E8 * MSDOS 3.20 generic 115E 1ABC 3A18 Compaq 11A4 1B6C 3AC8 Zenith v3.21 ?? ?? ?? ** IBM (PCDOS 3.20) 115E 1B2C 3A88 PCDOS 3.30 (IBM) 1304 1B6C 3E29 -- * "echo ." is known to work for this version ** Patches work, but I don't remember the locations. Mea culpa. Also, "echo." works - RAM _____________________________________________________________________________ Notes: ~~~~~~ Date: Mon, 10 Nov 86 21:11:36 cst From: jai@im4u.UTEXAS.EDU (S. Jayashankar) Subject: COMMAND.COM Patch for Echo OFF Under DOS 3.1 I tried this patch on DOS 3.1. It works fine. However, the RENAME command is affected too: it doesn't accept a path name anymore for the first argument (it accepts only a file name in the current directory). When I restored my unpatched COMMAND.COM, it worked correctly. Has anyone else had the same problem? Jai. [ I use a `mv' program which is much nicer anyway, so I'm not affected. - RAM ] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Tom Reingold & Mike Brown suggest suggest patching location 0x1887; my > version of command.com shows the following evidence of an OEM patch there: - -u187c 4502:187C 2E CS: 4502:187D C7065648FFFF MOV WORD PTR [4856],FFFF 4502:1883 33C9 XOR CX,CX 4502:1885 EB10 JMP 1897 <-- Unconditional branch, 4502:1887 90 NOP <-- byte filler 4502:1888 E8D900 CALL 1964 4502:188B E80202 CALL 1A90 4502:188E F7064B0BFFFF TEST WORD PTR [0B4B],FFFF 4502:1894 75B2 JNZ 1848 4502:1896 C3 RET 4502:1897 E8F601 CALL 1A90 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~