Does anyone know of a generic version of (System.Classes.)MakeObjectInstance that will take a generic method type (as in ) of just a plain TMethod? Is a generic (as in ) version is possible?
I know , the new MakeObjInstance implementation is out of what it should do.But i think it's very nice to access the object instance from function arguments rather than X.Obj. My code is still limited,and need extra hard works.
I don't mind to integrate with DDL,but i really don't know if it would be useful since we can hook without this way.
Mahdi Safsafi From reading the source, that is what I want! Not quite how I was going to attempt to do it - yours is way better! :-D
ReplyDeleteWill this become apart of DDL? I hope it does.
Nicholas Ring I just found a way to pass the object instance.
ReplyDeleteNow it's possible to write something like this:
procedure TMyObjHook.DoxHooked(const S: String;A,B,C:Integer; Obj: TObject);
begin
{First Hidden Param = Self.}
{Last Param Obj = TMyObj Instance.}
//Obj.ClassName = TMyObj;
Trampoline(S,A,B,C,Obj);
end;
Isn't better than :
procedure TMyObjHook.DoxHooked(const S: String;A,B,C:Integer);
begin
Trampoline(S,A,B,C,Main.FMyObj);
end;
?
I know , the new MakeObjInstance implementation is out of what it should do.But i think it's very nice to access the object instance from function arguments rather than X.Obj.
My code is still limited,and need extra hard works.
I don't mind to integrate with DDL,but i really don't know if it would be useful since we can hook without this way.
Mahdi Safsafi Neat. Should I ask what the magic is? Need a tester? ;-)
ReplyDeleteI think you should add your MakeObject to DDL - not within DDetours.pas it self but as an external unit that people can bring in if they like...