flat assembler
Message board for the users of flat assembler.

Index > Windows > Automatic generation of COM interface definition

Author
Thread Post new topic Reply to topic
Smokin Marlboro



Joined: 13 Mar 2012
Posts: 3
Smokin Marlboro 13 Mar 2012, 19:18
I want to use COM APIs available for Direct2D, DirectWrite, shell actions, etc. But there's a catch - while I have all documentation I need on the interface methods, I have no clue on how methods are ordered and thus cannot make my own interface definitions. MSDN sorts method names alphabetically, so I have to look for the info somewhere else.

I found pinvoke.net to be easy to parse, but lacking completeness. C++ includes are quite hard for me to extract info from. Need help!
Post 13 Mar 2012, 19:18
View user's profile Send private message Reply with quote
Coty



Joined: 17 May 2010
Posts: 553
Location: ␀
Coty 13 Mar 2012, 19:44
Are you asking how to invoke windows's COM API from Assembly? Or am I mistaken? If so, there are a few examples included in FASM's ZIP file that demonstrate invoking things from windows API...

_________________
http://codercat.org/
Post 13 Mar 2012, 19:44
View user's profile Send private message Send e-mail Visit poster's website Reply with quote
Smokin Marlboro



Joined: 13 Mar 2012
Posts: 3
Smokin Marlboro 13 Mar 2012, 20:28
I know how to invoke COM API, I need only the declarations of interfaces, but a lot of them - and writing them one by one is, well, very time-consuming, boring, susceptible to errors and hard to accomplish without knowing the order of methods in an interface. AFAIK, C++ headers from Windows SDK contain all the info I need, but I don't know how to parse it and be sure it's valid. There are, though, IDL files, which are simpler to understand, but not every DLL that exports COM API has corresponding IDL file. D2D1, for example, has no IDL and d2d1.h is amazingly unclear.
Post 13 Mar 2012, 20:28
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20303
Location: In your JS exploiting you and your system
revolution 14 Mar 2012, 06:11
Smokin Marlboro: What do you want us to do? It is not clear what you are asking for. Do you want us to do the work of extraction for you? Do you want us to tell you how to extract or where to extract from? Do you want us to write a program of some type? Do you need help from us to write your own program? Do you want us to google something for you? Something else?
Post 14 Mar 2012, 06:11
View user's profile Send private message Visit poster's website Reply with quote
Smokin Marlboro



Joined: 13 Mar 2012
Posts: 3
Smokin Marlboro 14 Mar 2012, 08:06
Sorry if my question is not clear. I'll give you an example.

Suppose I want to use Direct2D in my program. I know what methods to call, I know parameters these methods accept. I just don't know the order of methods in a specific interface. From my experience with COM interop in C# I assume the order to be important. So this specific problem is - where to get info that helps me to build all interface definitions for FASM that I need? Anyway, I'm currently extracting info from d2d1.h manually, but if there is a way to generate the info I need - it would be great.
Post 14 Mar 2012, 08:06
View user's profile Send private message Reply with quote
Blank



Joined: 28 Feb 2012
Posts: 13
Location: Ukraine
Blank 17 Mar 2012, 15:53
Smokin Marlboro, extraction would be executed in short time, if you use some editor with find/replace function which support regexp(e.g. Notepad++). For example I'm easily port interface structs(of Direct3D) from c headers to fasm's interface delarations.

Code:
//from...
DECLARE_INTERFACE_(IDirect3D9,IUnknown)
{
  STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
        STDMETHOD_(ULONG,AddRef)(THIS) PURE;
        STDMETHOD_(ULONG,Release)(THIS) PURE;
//...
; to...
interface IDirect3D9,\
       QueryInterface,\
       AddRef,\
       Release,\
;...
    
Post 17 Mar 2012, 15:53
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 29 Mar 2012, 04:38
I have visual studio if you need help with them I can give them to you in FASM include format.
Post 29 Mar 2012, 04:38
View user's profile Send private message Reply with quote
bzdashek



Joined: 15 Feb 2012
Posts: 147
Location: Tolstokvashino, Russia
bzdashek 29 Mar 2012, 06:53
typedef wrote:
I have visual studio if you need help with them I can give them to you in FASM include format.

Do you use some tool or convert them manually?
Post 29 Mar 2012, 06:53
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 29 Mar 2012, 17:59
No Usually the ones I have used have like 10-30 functions so it's just copy & paste. But I can make a tool in PHP to do that or in C/C++.

Do you want me to ? PHP is better this way though
Post 29 Mar 2012, 17:59
View user's profile Send private message Reply with quote
bzdashek



Joined: 15 Feb 2012
Posts: 147
Location: Tolstokvashino, Russia
bzdashek 30 Mar 2012, 05:09
typedef wrote:
No Usually the ones I have used have like 10-30 functions so it's just copy & paste. But I can make a tool in PHP to do that or in C/C++.

Do you want me to ? PHP is better this way though

Well, I do not use COM much myself yet, but I think this tool will be very helpful for those who do, so I believe it would be great, if you find some time to make it. But it's your time, of course, so the final decision is yours.
Post 30 Mar 2012, 05:09
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.