e.g. direct2d uses COM technology. It creates an object with pointer to its virtual function table.
Without checking the original include header file, is there any way to export this virtual function table from a dll file like d2d1.dll?
I checked the d2d1.lib file. It only export few functions used to create COM object. It does not contain any information of functions in the vtbl...
Anyone can teach me how to do?
http://masm32.com/board/index.php?topic=4374.0
@enzechen
For the case that you need Direct2D includes and libs that work with the MASM32 SDK, see this post:
http://masm32.com/board/index.php?topic=3015.msg31568#msg31568
(see also the other post in that thread)
regards
ENZECHEN,
Typically when activating a COM interface (yes, even in MASM assembly), one uses CoCreateInstance (https://msdn.microsoft.com/en-us/library/windows/desktop/ms686615(v=vs.85).aspx). This function returns the address of the virtual function table (as, LPVOID *ppv). This is just an address (usually somewhere inside the DLL). The function table follows. The address for the QueryInterface (https://msdn.microsoft.com/en-us/library/windows/desktop/ms682521(v=vs.85).aspx) implementation, is the same address as the virtual function table address returned from CoCreateInstance. What you really need is a header file (or, include file) that lists the names of all the implemented functions from the selected COM interface, in the correct order. Then it is simple to call the COM interface functions merely by knowing the virtual function table address and the function name (the offset to the implemented function of interest). In a 32-bit application, each address in the virtual function table is 4 bytes long, and so the offset to each successive function implementation is an additional 4 bytes in memory. It is even easier to call a COM interface method by pushing the required parameters onto the stack (in reverse order), then using the CALL syntax with the address of the virtual function table and the correct offset added to it.