Code: Select all
procedure TForm1.Foo1(a, b : string);
begin
Self.Caption := a+' <> '+b;
end;
var Foo1Next: procedure(Bla: TObject; a,b: String);
procedure Foo1Callback(Bla: TObject; a,b: String);
begin
Foo1Next(Bla,a,b+' elelel'); // change it
(Bla as TForm1).Height := 100; // additional changes
end;
procedure TForm1.FormCreate(Sender: TObject);
var Form1Addr: pointer;
begin
form1.foo1('test1','test2');
// uallHook.HookCode(@Form1.Foo1,@Foo1Callback,@Foo1Next); // doesnt work
// so i haxx it a little bit, normlay you have a static offset
asm
push Offset Foo1
pop Form1Addr;
end;
uallHook.HookCode(Form1addr,@Foo1Callback,@Foo1Next);
form1.foo1('test1','test2');
end;
you can get the return address only if you hook the function an get it via ESP (have written an example above) or by call searching (where does the programm use exaclty this address for call)
if its an exported function and if its a static import, you can use relocation searching