Newbies guide to cracking |   By ThrawN 
---------------------------

This is lesson 2 is the series.
--------------------------------
PROGRAMMING A CRACK FOR LESSON1

-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Target: LESSON 1
Website: \lesson1.txt
Time required: 5 mins or less
Tools required: Delphi 5 (Should work for lower versions, demo can be downloaded)
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

Well you cracked the game but now how about a patch to release your crack.
Load up delphi and create a new application.
In the code window (probely hidden behind the blank form) goto uses and add ShellAPI.
Mine now looks like this:
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ShellAPI;

This is so we can use the shellAPI.
Now place a Button somewhere on the form. Double click on it and now ur staring at:
procedure TForm1.Button1Click(Sender: TObject);
Forget about the Begin and End; u can see.. remove them. now add this code below:
//------------------------------------------------------------------
 Const A: Array[1..1] of Record {<-------- 1 byte to be patched}
                          A : Longint;
                          B : Byte;

                         End =
((A:$0002F904;B:$90)); {<--------------- offset  and byte to be changed}


Var Ch:Char;
    I:Byte;
    F:File;
    Filename : String;
//------------------------------------------------------------------
Now this is quite basic. Im sure by looking at it you can see what its about. You put in the offset and the byte you want to change to. Now we need to include the source to patch the exe. Add the following lines after     Filename : String;
//------------------------------------------------------------------
Begin
Filename:='pinball.exe';            {<---Exe name is here}
If FileExists(Filename) then        
begin
AssignFile(F,Filename);
 try
  Reset(F,1);
 except
  Halt;
 end;
 For I:=1 to 1 do         {<----------- 1 byte to be patched}
 Begin
  Seek(F,A[I].A);
  Ch:=Char(A[I].B);
  Blockwrite(F,Ch,1);
 End;
 MessageDlg('File successfully patched!', mtInformation, [mbOK],0);  
end else
 MessageDlg('File ' + Filename + ' not found !', mtError, [mbOK],0);
End;
//------------------------------------------------------------------

Thats the patch source. Now dazzle up the form if you like with image or whatever and compile. Delphi produces fairly large exe's but doesnt require 200 gig of dll's like VB does. Use a exe packer like UPX to reduce its size to at least 120kb maybe more :). Check out www.protools.cjb.net for UPX.
Congrates, you just made your first patch in delphi

I have included a sample patch source for your viewing.

Contact info:  thrawnc@hotmail.com
