Plain and Exe Patch Files

BinPatch can work with complete directories or simple files. However, the most common application of GenPatch is to create a patch file that updates one file (start state) into another version (end state). Say you have two similar files "OLD.EXE" and "NEW.EXE" and the patch should transform "OLD.EXE" into "NEW.EXE". Then "OLD.EXE" is your start state and "NEW.EXE" your end state for the patch file. All you needed to supply GenPatch is the start state filename (may actually be more than one as you will learn in the multiversion section), the end state filename and finally select a name for your patch. Let's choose "OLD2NEW" for this purpose, then all you need to provide on the command line (assuming that GenPatch is in your system path) is:

> GenPatch OLD.EXE NEW.EXE OLD2NEW

and you have your patch file.

Normally the patch file will have the suffix ".utp" that indicates it is a plain patch file. A plain patch file must be applied using DoPatch (see below). Add one extra option to the command line for GenPatch to create an executable patch file. Choose "-s" for a command line interface and "-s=gui" for a kindly windows interface for your patch file.

> GenPatch OLD.EXE NEW.EXE OLD2NEW -s=gui 

and you have your executable patch file with windows interface. This time the patch file will have the ".exe" suffix and you may execute it by double-clicking or starting it from the command line.

To apply your patch file you have several options. If it's executable, simply start it and that's it. If it's a plain patch file you may choose from one of these example commandlines, each achieving different results:

> DoPatch OLD2NEW.UTP OLD.EXE PATCHED.EXE
> DoPatch OLD2NEW.UTP OLD.EXE
> DoPatch OLD2NEW.UTP -auto

The first one creates a new file, "PATCHED.EXE," by applying the patch file to "OLD.EXE" which remains unchanged. The second applies the patch to "OLD.EXE" and replaces it in the process. "OLD.EXE" will now be identical to "NEW.EXE".

The last one is somewhat special, in that it enables the "Autofind" feature of DoPatch to scan your files for the target file. It will present all files that are identical to "NEW.EXE" or files where the patch file could be applied. Executable patch files, on the other hand, will always make an autofind for the comfort of customers.