News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

ObjAsm32 COM method address

Started by jag, January 18, 2007, 04:26:18 AM

Previous topic - Next topic

jag

Hi. I know there is a macro in ObjAsm32 called MethodAddr.
However, when trying with a COM method like:

mov ebx, $MethodAddr(d3d::IDirect3D9.CreateDevice)

..I get an error

Does ObjAsm32 have any mechanism to do so? or will I have to do it manually by looking at the vtable?

Thanks!

Biterider

Hi jag
The MethodAddr and the new DbgIMT macros are intended for interface objects created with ObjAsm32. This is this way, since the compiler knows all about the internals of these objects.
For foreign objects/interfaces you have to extract the data by yourself, which is not too hard to do. Basically follow the interface pointer to the VMT and add the offset of the method you want to know. Finally read the value at this location and voila.

Regards,

Biterider


jag

Okay, but is there a way I can use the DirectX Inc files to get the offset, rather than counting lines and multiplying by 4?
I would suspect your ObjAsm32 does this, as I see this is in ICall:

call (??Txo ptr [edx]).??MName

I am new to masm though and I can't figure out what those two question marks do or how you override the dot operator.

jag

I figured it out if anyone wants to know:

mov eax, (IDirect3DDevice9_VMT PTR [eax]).EndScene

However, I'm still curious as to the question marks in your macro.

Biterider

Hi jag
The 2 question marks are part of the symbol name. I use them for all ObjAsm32 internal symbols that I can reuse. Reusing symbols has 2 big advantages: you can speedup the compilation time and you will stay away from an internal ML bug. The other side of the coin is that you must pay attention with nested macros that use the same symbol!

Regards,

Biterider