Document 1114 SID and DEBUG 04/13/92 BK SID AND THE DEBUG PATCH Often software manufacturers will have to make changes to their software after it has been released to customers. Usually these are very small changes to the instructions that make up the software, sometimes only affecting 1 or 2 bytes out of the entire program. Since the changes are so small, they can often be completed by the customer by following a patch listing from the manufacturer. These patch listings depend on the use of DEBUG. A typical patch listing will look something like this: 1) COPY BROKFILE.EXE BROKFILE.SAV 2) DEBUG BROKFILE.EXE 3) -S 100 L FFFF B2 01 7C 56 8B 1E 4) -E xxxx:yyyy 91 92 93 94 88 1F 5) -W 6) -Q DR DOS 6.0 has a similar utility called SID. While the function of the two applications is the same, the actual commands are a little different. Below is the typical listing with the purpose of each step explained and the SID equivalent described. The format in each step explained here is: DEBUG COMMAND LINE GENERAL COMMENTS AND CLARIFICATION EQUIVALENT SID COMMAND LINE 1) COPY BROKFILE.EXE BROKFILE.BAK Just in case things do not go as planned, make a back- up. (same command) 2) DEBUG BROKFILE.EXE DEBUG is loading and reading the subject file into memory. To accomplish this in SID, type SID at the command line and then use the R command to read the subject file into memory starting at memory offset address 100. SID will display the starting and ending address of the file in memory in a SEGMENT:OFFSET format. Note these addresses. SID #RBROKFILE.EXE,100 3) -S 100 L FFFF B2 01 7C 56 8B 1E DEBUG is searching from the offset address 100 to the last address of FFFF (a hexadecimal number) for the pattern of bytes listed (B2 01 7C 56 8B 1E B8). this is a pattern that is unique to the area or areas of the file that need to be changed. DEBUG will return the addresses of the desired patterns in a SEGMENT:OFFSET format like 2345:1DF5. The specific values returned will vary. There may be more than one found. The patch listing will usually refer to these values as 'xxxx:yyyy'. The SID SR command is very similar. Some of the arguments are separated with commas instead of spaces. The address or addresses that contain the desired pattern will be returned in the same xxxx:yyyy format. Record the addresses returned. #SR100,FFFF,B2 01 7c 56 8B 1E 4) -E xxxx:yyyy 91 92 93 94 88 1F DEBUG is entering new values for the bytes in memory. This is how the software is actually changed. The xxxx:yyyy is the address at which the new values should be added. The following numbers are the new values themselves. In SID, use the S command and specify where the new values should start. SID will display that starting address and the current value in memory and be waiting for the new value. Enter the first value listed after xxxx:yyyy in the -E command line of the patch listing. Press Enter. SID will now show the next address and its current value and be waiting for the new value. Enter the next value in the -E command line. Continue entering the remaining values. After the last value has been en- tered, SID will display the next address and be waiting for a new value. Simply enter a '.' and press ENTER. SID will return to its '#' prompt. #Sxxxx:yyyy xxxx:yyyy B2 91 xxxx:yyyz 01 92 xxxx:yyya 7C 93 xxxx:yyyb 56 94 xxxx:yyyb 8B 88 xxxx:yyyb 1E 1F xxxx:yyyb 22 . # 5) -W The update version of the software is written from memory to the original file name. In SID use the W command followed by the filename. #WBROKFILE.EXE 6) -Q You're done. Quit. SID's command is the same. #Q On the next page is a sample of what this patch process would look like in SID. [DR DOS] C:\MYFILES>SID -------------------------------------------------- *** Symbolic Instruction Debugger *** Release 3.2 Copyright (c) 1983,1984,1985,1988,1990,1991 Digital Research, Inc. All Rights Reserved -------------------------------------------------- #RBROKFILE.EXE,100 Start End 1056:0100 2056:7BF2 #SR100,FFFF,B2 01 7C 56 8B 1E 1056:2344 #S1056:2344 1056:2344 B2 91 1056:2345 01 92 1056:2346 7C 93 1056:2347 56 94 1056:2348 8B 88 1056:2349 1E 1F 1056:234A B8 . #WBROKFILE.EXE #Q [DR DOS] C:\MYFILES>