Patcher Program Help

Introduction

So, you want to know more about this mysterious patcher program? What the entire goal of the patcher program is to take patch files (created by differ, or written by hand) and patch a binary file. Explained a bit easier, what patcher does is take a file on your computer and slightly alters bits and peices of it.

I wrote it because I thought that there were way too many little programs out there which patch files, but all of them are slightly different, and some took much more space than others. With patcher, you can just distribute a patch file instead of an entire executable. The patch file is a simple text file, e-mail friendly, can be printed out and typed in by hand, and is a very easy format to learn.

Usage

It is fairly easy to use patcher. What you need is the patcher executable (patcher.exe), a patchfile, and the program that you want to patch. Several sample patchfiles are available via Binky. To get a list of them, send a message to binky@mailbot.ml.org with only one line in the message (body) part of the e-mail, "index progs/patcher/patches" (no quotes).

As far as parameters go, Differ must have three parameters. It will not ask you for the files if you do not tell it. Possibly in a later release... Anyway, the first parameter is the path and filename of the patch file. The second is the file with no modifications, and the third is the file which you patched.

Patcher can have three parameters, or none at all. If specified, the first parameter is the patch file's name and location. The second is the file to patch, and the third is the file to output the patched file to. If not specified, Patcher will prompt for any missing information. This makes patcher drag 'n droppable. If you drop a patch file onto patcher.exe, then it will pop up and ask you for where the file is that you want to patch.

Error Codes

Bytes do not match up
When Patcher tries to apply a patch to a file, it checks the existing information to see if the patch was already applied (or another one was applied in its spot), and to see if the file you are trying to patch is the correct one to patch. If the information is not correct, Patcher will abort. Usually, this happens because the program being patched is the wrong version (version 1.41 is different than 1.42, for example). Sometimes it is because the file has been patched already with either the current patch or another one.
Error Opening Patch File
The patch file was either typed in wrong, or else there are some unforseen troubles opening it up.
Ran out of input file, but more left to patch
Either the patch is corrupt, or the file currently being patched is too small. Make sure that both are right.
Out of Memory
Patcher just tried to allocate a little memory to work with. Apparently, none was left. Very unusual, since Patcher requires very little memory.
Patch File Corrupted -- EOF 1
There were no changes in the patch file. Either there was nothing for patcher to do (which would make a very useless patch file), or the format was corrupt.
Patch File Corrupted -- EOF 2
This only occurs immediately after where the offset is calculated. Apparently, the offset was figured out, but there was nothing left in the file for what to patch.
Patch File Corrupted -- EOF 3
Patcher just read which byte to change and what it is supposed to be originally, but can not find any more data to complete the patch.
Patch File Corrupted -- EOF 4
It just ran out of lines in the patch file without finding a blank line at the end. Make sure that the patch file has a blank line at the end (at least one, if not several).
Patch File Corrupted -- Method
An invalid method number was found. Do you have an old version of patcher? Time to upgrade!
Patch File Corrupted -- NS 1
The patch file format was violated. A manditory space was omitted from between the old value and the method.
Patch File Corrupted -- NS 2
The patch file format was violated. A manditory space was omitted from between the method and the new value (method 0).
Patch File Corrupted -- NS 3
The patch file format was violated. A manditory space was omitted from between the method and the new value (method 1).
Patch File Corrupted -- NS 4
The patch file format was violated. A manditory space was omitted from between the method and the new value (method 3).

Revision History

2.3
Actually fixed the bug reported by Julian Hilaire with his help.
2.2
Hopefully fixed a bug with patcher where it applies a patch even if you say no, which was told to me by Julian Hilaire.
2.1
Fixed a couple minor bugs with differ. Made patcher read patchfile old and new hex numbers correctly, the no now works. These bugs were brought to my attention (and one was fixed) by Julian Hilaire.
2.0
Rewritten to take advantage of a slightly different style of patchfile. Now uses a linked list so patches can be out of order, multiple patches can be applied, and multiple changes per patch can be applied at once. The idea for a continuing change was submitted and coded into the 1.0 version by Jerel Arbaugh.
1.1
Bugfix release.
1.0
This was a very sucky version. Not many things worked, needed cwsdpmi or equivalent, buggy in places, and generally a bad version. Luckily, there were enough people interested in it that I felt the desire to continue.