VOGONS


First post, by markot

User metadata
Rank Member
Rank
Member

I got some old computer programs I need to patch and I would like to do it using the DEBUG program which ships with MS-DOS. I know the bytes which to change in EXE files and have tested it using HEX editor. Now I need to make a BAT file that patches the EXE file, but I can't find any examples on the web how to do it.

So I would need an example how to make a BAT file that starts DEBUG which loads EXE into memory, patches the bytes at certain locations and writes the changes to disk.

Reply 1 of 4, by markot

User metadata
Rank Member
Rank
Member

Now found some information on http://www.robvanderwoude.com/debug.php

So the process is basically the following: debug filename < patch.txt

where patch.txt contains the commands for debug.

Reply 2 of 4, by BloodyCactus

User metadata
Rank Oldbie
Rank
Oldbie

just remember to rename the exe to bin because debug cant save an exe once its loaded with relocations etc. and your offsets would be different, so rename .exe to .bin and your offsets stay the same and debug does not relocate the data.

--/\-[ Stu : Bloody Cactus :: [ https://bloodycactus.com :: http://kråketær.com ]-/\--

Reply 3 of 4, by peterferrie

User metadata
Rank Oldbie
Rank
Oldbie

You can make the changes interactively, but BloodyCactus is correct that the file must be renamed first so that it is not interpreted as an EXE.
Note that if the file is too large for debug to load, then there is no alternative other than a hex editor.