Hi,
normally I call methods of objects with this construct:
(f.e. DirectDraw or Shell objects)
mov eax, objecthandle
mov eax,
push objecthandle
call method
now I found another way in the TextService object:
mov ecx, objecthandle
mov eax,
call method
where the handle must be in the ecx register.
My questions:
Why are there two different ways, and what are the similar
constructs in C++?
Are there some more wired ways to access objects and methods?
Have I pay attention to some registers at input / output, like the ecx register?
beaster.
The call methods you indicate for DirectDraw and Shell objects seem to be calls to a COM interface. This maps to the binary composition of *some* C++ compilers output (MS is in this list), as the C++ standard does not specify HOW things are done, just what needs to be done.
However, in the main C++ objects need an additional (and hidded in the source code) parameter to be passed to every object method call, that being a reference to WHICH object, otherwise known as "this" "this" is the objecthandle you refer to.
"this" resolves the question "which object am I using?" for the method.
It works like this:
The object reference points to the object (obviously). At that pointed to location resides a pointer to a table of function pointers, these functions are the methods of that object.
You do not define 'method' (as in 'call method'), but it is probably a simple offset into the function table, ie,
method #1
call + 0
method #2
call +4
and so on.
I am not familiar with the TextService object. Where did you find it (MSDN search comes up empty). I would doubt it's COM, it might be C++, but it's not MSVC++.