

 .---.        .---.                                                                 .----------.
 |    \      /    |    .-.                                                          |          |
 |  |\ \    / /|  |    | |    .--------.   .-----------.  .---------.  .-------.    |  .-------'
 |  | \ \  / / |  |    `-'    | .------'   `----. .----'  | .-------'  | ,---. |    |  | 
 |  |  \ \/ /  |  |    .-.    | |               | |       | |          | |   | |    |  `----.
 |  |   \__/   |  |    | |    \ \               | |       | `----.     | `---' |    |  ,----'
 |  |          |  |    | |     \ `-----.        | |       | ,----'     |  .---'     |  |
 |  |          |  |    | |      `----. |        | |       | |          | , \        |  |
 |  |          |  |    | |           | |        | |       | |          | |\ \       |  |
 |  |          |  |    | |           | |        | |       | |          | | \ \      |  '-------.
 |  |          |  |    | |    .------' |        | |       | '------.   | |  \ \     |          |
 `--'          `--'    `-'    `--------'        `-'       `--------'   `-'   `-'    `----------'


                                  .----------------------. 
                      .-----------|   Proudly Presents   |-----------.
       .--------------+----------------------------------------------+--------------.
       |                               A tutor about                                |
       |                             Patching in Pascal                             |       
       `----------------------------------------------------------------------------'


I have used -= Borland Pascal v7.0 =- to compile this patcher. Since there aren't many tutors on
patching (leave alone in pascal) I decided to write one, so here we go.



.-----------------------------------------------------------------------------------------------.
|                                   Source for patcher                                          |
`-----------------------------------------------------------------------------------------------'


program Patcher_by_MisterE(input, output) ;
var filename : file of byte;     (*  <----- just act as if you understand this              *)
var counter, nop, number : byte ;(*  <----- some variables, adjust to your own choice       *)
var position1 : longint ;


(* At location $3e9f2 change this: 0F 8C 48 01 00 00    to this: 90 90 90 90 90 90          *)
(* The $ means that $3e9f2 is hexadecimal                                                   *)


begin
  writeln ;
  writeln ;
  writeln(' MisterE''s patcher');(*  <----- please include this when you use my patcher, or *)
  writeln(' Patcher for: .... ');(*         write your own patcher                          *)
  writeln(' Cracked by   .... ');
  writeln ;
  nop := $90 ;                   (*  <----- change to $90                                   *)
  position1 := $3e9f2 ;          (*  <----- position of byte(s) to be patched               *)
  assign(filename, 'file.exe') ; (*  <----- filename to be patched                          *)
  {$I-} Reset(Filename); {$I+}   (*  <----- point to begin file, $I-+ for dis/en-abling     *)
                                                                       (* io-checking       *)


                                 (*         If an error occurs the error number gets stored *)
                                 (*         in IOResult, see your manual for the error numbers*)


  If IOResult <> 0 then          (*  <----- If an error occurs, then....                    *)
    begin
    writeln(' File not found!'); (*  <----- ... say the file was not found                  *)
    halt ;                       (*  <----- halt the program                                *)
    end;
  seek(filename, position1) ;    (*  <----- point to the position you want to patch         *)
  read(filename, number) ;       (*  <----- read a byte                                     *)

  if (number <> $0F) and (number <> $90) then (* If number is not $0F or $90 then something *)
    begin                                                                      (* is wrong  *)
    writeln('Wrong version/program') ;        (* Say you got the wrong version/program      *)
    halt ;                                    (* Again stop running the program             *)
    end ;
  if (number = $90) then                      (* If getal is $90, say .....                 *)
    begin
    writeln('Already patched file') ;         (* The file is already patched                *)
    halt ;                                    (* halt                                       *)
    end ;
  seek(filename, position1) ;                 (* point to position1 again                   *)
  for counter := 1 to 6 do write(filename, nop) ; (* Patch it 6 times!!!!                   *)
  close(filename) ;                           (* You MUST close the file otherwise data loss*)
end.                                          (* could occur....                            *)

.-----------------------------------------------------------------------------------------------.
|                                     End Source for patcher                                    |
`-----------------------------------------------------------------------------------------------'


Well, I hope you learned SOMETHING from this tutor.

If you have any comments, questions, need help or whatever, mail me at MisterE@freemail.nl

OR

look for me at EFNET => #cracking4newbies or #cracking


.-----------------------------------------------------------------------------------------------.
|                                        GREETZ                                                 |
`-----------------------------------------------------------------------------------------------'

Still the same greetz:

Greetz go to: everyone on #cracking4newbies - #tno - #inside98

.-----------------------------------------------------------------------------------------------.
`-----------------------------------------------------------------------------------------------'