THE BYTE PATCHER

Enclosed files: patch.c   (the source)
                patch.mak (makefile for MS Visual C++ 4.0)
                msc.bat   (batch to set environment variables for compiling)
                patch.exe (compiled program)

SOME NOTES
Program is written using plain C functions and using only API calls.
I haven't commented parameters to the API calls, 'cause you'll find
them in any API reference, in paper or on-line form.
It was successfully compiled using Microsoft Visual C++ 4.0 (no errors,
no warnings). Resulting file is an about 16Kb 32bit code.
(I've tried to compile it using Borland C++ 5.0 and it works too)
The program work is easy to follow. We don't have any main window,
so no window creation and registration, and no message loop.
The program deals with user using Messagebox. It is in some way large,
but mainly the code deals with possible errors.
These are program steps:
- present a box with program info and the Yes/No buttons to decide to proceed
- open the file using CreateFile
- check file size, to assure we are working on the correct file
- move file pointer to the patching location
- read the number of bytes to be patched
- compare bytes read with original data, to assure we are patching the right
  location and the correct version
- if all went ok, we write the patch to the file
- ... and close it

Note on SetFilePointer: this API call report no error if you try to move a
file pointer beyond the end of the file. On the contrary this always report
the correct move, so we have no way to decide if we went beyond end of file.
This bear to the necessity to call GetFileSize to assure we are working on
the correct file.
                                                bye, Mad - 1/VI/1998












