[*]Taking a pointer of an interface structure (in memory).
[*]Pushing the 'this interface' object parameter so the render method will operate on the object/interface that called in the first place.
[*]Then exctracting the virtual function table pointer from the interface structure. Its always the first DWORD of any Interface.
[*]Then calling the 'Render' function pointer located in the virtual function table. All the functions have lables such as 'Render' cause they are actualy a stucture of DWORD function pointers. One function pointer to one structure name. So effectively the call is doing something like "call " where 12 (hypothetically) could be the third function pointer called "Render" (3 * 4bytes = 12). I dont know what the *real* offset is for Render in this interface. But you get the idea.

Well there you go. I dont use FASM, never have, so i cant help you much more than this. (However, i would be surprised if FASM can't handly what you have posted. Its pretty simple operations).

You say that you can Use an API call to get a group of pointers to certain function and this function have subfunctions, so you when you use Call .IPicture.Render your calling a subrutine which IPicture.Render has the address where that subroutine starts, if that is the case why don't just use IPicture.Render not

Sincerely:
Alonso Murillo

This is a COM call to a virtual function.

Its not Masm specific. It is M$ OLE specific.

Your source is

[*]Taking a pointer of an interface structure (in memory).
[*]Pushing the 'this interface' object parameter so the render method will operate on the object/interface that called in the first place.
[*]Then exctracting the virtual function table pointer from the interface structure. Its always the first DWORD of any Interface.
[*]Then calling the 'Render' function pointer located in the virtual function table. All the functions have lables such as 'Render' cause they are actualy a stucture of DWORD function pointers. One function pointer to one structure name. So effectively the call is doing something like "call " where 12 (hypothetically) could be the third function pointer called "Render" (3 * 4bytes = 12). I dont know what the *real* offset is for Render in this interface. But you get the idea.

Well there you go. I dont use FASM, never have, so i cant help you much more than this. (However, i would be surprised if FASM can't handly what you have posted. Its pretty simple operations).

no, there is no API's in this picture.. only memory, memory pointers, and function pointers. Here is another stab at putting the picture together. I made up fake memory addresses and function pointers, but the intent is how it actually works

Because IPicture is not data. It is a data format or layout.
It is also a data type.
You must allocate (define) data of type IPicture, or use a pointer of type IPicture.
MASM allows you to force the type of a register-based address with the .IPicture notation.

What I'm asking is why can we use mov eax,IPicture.Render instead of mov eax, pPicture, because IPicture.Render should have a pointer to the sub that we want to call.

Sure, if i only passed pPicture technically the computer would have all it needs. But the computer is not a mind-reader. I still has not IDEA what your intending when you throw an interface at it.

Its like saying.. "Call some function, and get it right". You have to TELL it what function you want to call from the interface. You say "here is my interface, with specific data stored in it", and then you look up the function you want to use on your data and say "Now call this 'Render' function you happend to have in your interface, you will notice i pushed on the stack all the parameters you will need for this function, Mr. CPU".

I cant explain this anymore. I've done so from a memory map side, software side, and now an "Im talking to my computer" side. If your still having problems with this concept you should re-read this thread a couple of times.

Consider this. What if the 'Render' function also needs to use the 'get_CurDC' function as part of its operation. I need to give it the interface itself as the first param of any COM call, so that it is standardized and every COM function will know this fact. If it needs to call something specific to itself, it will know the first param is the "THIS" interface pointer, and can look up other fucntions it needs from its vtable.

The next two lines "Mov eax, " and "Call .IPicture.Render" is telling the CPU to call the specific Render function as i mentioned above.

This is correct for C++, as the C++ compiler does 'extra' work your not seing here. There is *ALWYAS* a "THIS INTERFACE" pointer as the first param to any method call from a COM interface. Since the guys who wrote C++ know this, they decided to hide this extra param from you. After all it it would be extra typing that can be easily automated.

In assembly this is not true. MASM assumes NOTHING. You need to fit the formate exactly and do the extra that C++ would have done for you. In this case the MASM equivalent would be: