How do I use PATCH, maybe with my own programs?

The file format is actually quite simple - you just need a text file which consists of lines each starting with one of the following commands:

FILE <filename> e.g. FILE test.exe

specifies the file to which the following instructions are to be applied. A patch file may contain multiple FILE directives.

VER <offset> <data> e.g. VER 00001234 abcdef

checks if the specified data is present at the given file offset [all values in hex, data can be just a string of digits with no blanks in between; up to 16 bytes are allowed in one statement]. If the check fails, the patch process is aborted resp. the program skips to the next FILE statement.

CHA <offset> <data> e.g. CHA 00001234 012345

changes the data at the given offset - syntax is same as in VER. It is a good idea to do all VERification before starting the first CHA.

Blank lines and data lines starting with a ";" are ignored.

As you can see from this, there seems to be no way to _insert_ or _delete_ bytes in the file. To make patches applicable to multiple versions of the same file, you can specifiy more than one FILE directive for the same filename - only a patch with all VER commands matching is executed.

Credit: Marcus Groeber


[Back: Tools, Toolkits, Accessories]
[Next: What programming editors are available for OS/2?]