[Delphi] WriteProcessMemory?

Extreme Coder - Delphi
Loyal Member
Joined
Sep 8, 2007
Messages
1,375
Reaction score
40
here is my attempt at writeprocessmemory after following an example from Torry Delphi pages
Code:
unit Unit4;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls,GunZLib;

  const
  Address = $777042EB;
  Value = $90; //NOP

type
  TForm4 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Strings : TbountyGunZ;
  Form4: TForm4;
  ProcessID : Integer;
  ThreadID : Integer;
  WindowName : Integer;
  HandleWindow : Integer;
  Data : Pchar;
  Written : Cardinal;
implementation

{$R *.dfm}

procedure ByPassSerial();
begin

WindowName := FindWindow(nil,'EpicGunZ Launcher'); // Find our GunZClient
ThreadId := GetWindowThreadProcessId(WindowName, @ProcessId);
HandleWindow := OpenProcess(PROCESS_ALL_ACCESS, False, ProcessId);
GetMem(Data,1);
Data^ := chr(Value);
  WriteProcessMemory(HandleWindow, ptr(Address),Data,2, Written); // Nop the serial Key
 freemem(Data);
CloseHandle(HandleWindow);
end;

procedure TForm4.Button1Click(Sender: TObject);
begin
try
begin
ByPassSerial;
end;
except
begin
showmessage('epic phail');
end;

end;
end;

end.

What im trying to do is trying to NOP at the given address, but it doesnt work :S
 
I run the code while the Target Application is running 'EpicGunZ Launcher',
basically i wana NOP the program on the entrypoint so i can get a error and so the program closes. But it seems to not work
 
Back