#------------------------------------------------------------------------------#
#                             - Challenge #2 -                                 #
#                                 by JaZZ                                      #
#------------------------------------------------------------------------------#

I choose to code the patcher in C. The compiler i've used is Borland C++ 4.52. 
(Thanks fravia for the info of "quasi free" release from pc plus). The exe 
length is about 30K, which is not tiny, maybe this is the reason why almost 
patchers are DOS based ;-), although less functionnal. I choose to add two 
features to mine,that is:
1- The ability to patch at multiple locations. Well the experience proofs it's
useful.
2- The possibility to make a backup of the original file. The exe will be
renamed as ".bak".

I think the listing is self-explanatory enough, the only things required are:

long length= 593920;       /* size of the file to be patched in bytes */
char *prgnam="bbrk32.exe"; /* name of the file to be patched */
int how_many=3;            /* number of patches to be applied */
int sizes[]={1,1,3};       /* size of each one in bytes */
long offset[]= { 0x403B6,0x45226,0x6A07D }; /* offset of each patch */
unsigned char patch[]={0x33,0xEB,0x6A,0x01,0x5a}; /* the bytes of the
							  patches, one
							  after the other */
The program will put 33    at offet403B6
	             EB    at      45226
	             6A,01,5A  at  6A07D
	             
Before patching, i only check the size which in most of the cases is enough to
differentiate between versions of the target. Backing up the file (if selected)
is a quite easy using the CopyFile function.
I provided an example for patching brainsbreaker v2.1. If you want to compile,
don't forget to set the target to win32 and libraries to static.

#------------------------------------------------------------------------------#