The other part:
unit patchbds;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
var
offset : array [1..7]of integer =($DC99,$DC9A,$DC9B,$DC9C,$DC9E,$DFB1,$DFB2);
original : array [1..7] of byte =($0F,$84,$C6,$02,$00,$75,$1F );
patch : array [1..7] of byte =($E9,$C7,$02,$00,$90,$90,$90);
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Odlg : TOpenDialog;
hfile :Thandle;
i : integer;
begin
Odlg := TOpenDialog.Create(self);
Odlg.InitialDir := GetCurrentDir;
Odlg.Options := [ofFileMustExist];
Odlg.Filter :=
'Executable|*.exe' ;
if Odlg.Execute
then ShowMessage('File : '+Odlg.FileName)
else ShowMessage('Open file was cancelled');
begin
Odlg.InitialDir:=ExtractFilePath(Application.ExeName);
hfile:= FileOpen(odlg.FileName,fmOpenWrite);
for i := low (patch) to high (patch) do
begin
FileSeek (hfile, Offset,0);
FileWrite (hfile, patch,1);
end;
FileClose(hfile);
end;
end;
end.