About me

Contact me via mail: kbasm.com AT gmail D.O.T com


My name is Wang Qi (family name is Wang), I live in Beijing, the capital of China.

I am a professional software and game developer with more than 10 years programming experience.

I have strong knowledge and experience in following areas: game development on mobile, iPhone, Android, and Flash, Windows application development.

Currently my daily job is developing social games in Flash. I spend most of my partial time on C++ research and library development.

My personal motto is: I Maybe can't success even if I make efforts, but I Certainly can't success if I don't make efforts.

My English is not very bad, but also not perfect. If you find syntax error or anything should be improved on this site or in my source code, just let me know.

The domain name is kbasm.com. kb is one abbreviation of my used internet nick name, asm is that I loved ASM language. kbasm, is not kabam, or kbam.
 

Connect me via Linkedin http://www.linkedin.com/profile/view?id=55671110&trk=tab_pro

Qi
Posts: 7
Comment
Re:
Reply #7 on : Tue November 08, 2011, 23:01:52
Hi Magno again,

I reviewed the code.
Seems it only hooks method for certain object instance, not for all objects, because it doesn't pass the "Self".

Can't remember why I did that, because the code was written several years ago.

Sorry for any inconvenience. It should be not difficult to change to pass the "Self", but most likely I won't improve the library by myself.
Qi
Posts: 7
Comment
Re:
Reply #6 on : Tue November 08, 2011, 05:17:37
Hi Magno,

lObjTarget is the Self pointer of the "source" function which is to be hooked.
It's passed to the hook function as an extra function.
The intention is just an convenient way for the hook function to find out the source object.
So it doesn't matter if you just ignore it and pass it as nil.

But usually the hook function needs that pointer to access the original object.
Magno Machado
Posts: 7
Comment
Code hook
Reply #5 on : Tue November 08, 2011, 04:46:51
I'm investigating your code hook library for use on my open source project Emballo. The project already provides a nice mocking framework that works with virtual methods, and I would use your library to make it possible to mock non virtual methods.

Looking at your sample project I saw that the hook happen with this line:
H := GCodeHookHelper.HookWithObjectMethod(lObjTarget, lObjHook, @TObjTarget.TestTarget, @TObjHook.TestHook, 2, 0);

I understand that you need to pass lObjHook reference so that your library can call the TObjHook.TestHook instance method. But I do not understand why you need to pass the lObjTarget reference.
Is the hook restricted to that particular instance?
Qi
Posts: 7
Comment
Re: Delhi 2006
Reply #4 on : Sun September 11, 2011, 00:50:07
@Tom Wise

It's weird, the code was compiled cleanly under D7.
Any way, it's a trivial problem.
vmtSelfPtr div SizeOf(Pointer) just means the value of vmtSelfPtr is divided by the value of pointer size. Pointer size on a 32 bit PC is just 4.
So you can change that line with hard coded constants.

Sorry that I have no plan on continue working on any Delphi stuff after Borland/Code Gear was sold. Now I am focusing on C++ development. :-)
Tom Wise
Posts: 7
Comment
Delhi 2006
Reply #3 on : Sat September 10, 2011, 13:33:31
Just want to say thanks for you work.

MethodTable: array[vmtSelfPtr div SizeOf(Pointer) .. vmtDestroy div SizeOf(Pointer)] of Pointer;

will not compile in Delphi 2006


[Pascal Error] DenomoMemHook.pas(220): E2029 '..' expected but 'DIV' found
[Pascal Error] DenomoMemHook.pas(220): E2029 ']' expected but '..' found
[Pascal Error] DenomoMemHook.pas(220): E2029 '..' expected but 'DIV' found
[Pascal Error] DenomoMemHook.pas(220): E2029 ';' expected but ']' found
[Pascal Error] DenomoMemHook.pas(220): E2029 ',' or ':' expected but ';' found
[Pascal Error] DenomoMemHook.pas(1409): E2010 Incompatible types: 'Integer' and 'Pointer'
[Pascal Fatal Error] Denomo.pas(38): F2063 Could not compile used unit 'DenomoMemHook.pas'
Mutskeevest
Posts: 7
Comment
goods
Reply #2 on : Sat April 05, 2008, 01:53:04
Hello, excellent site, very rich in content
and correctly carefully thought out,
personally I found here much interesting
and useful
Alan
Posts: 7
Comment
Re:
Reply #1 on : Mon November 19, 2007, 15:59:09
Hi,

Just to let you know that I have left a couple of comments for you on borland.public.delphi.thirdpartytools.general regarding Denomo.

Cheers, Alan.

Write a comment

  • Required fields are marked with *
  • Security Code is case sensitive, 'A' is different with 'a'.

If you have trouble reading the code, click on the code itself to generate a new random code.
Security Code: