revert commits 26437-26439 the right way[tm]
[mplayer/glamo.git] / loader / com.h
blob3e9c1f36925a2181140278fa4bff3aadfceb5fc7
1 /*
2 * Modified for use with MPlayer, detailed changelog at
3 * http://svn.mplayerhq.hu/mplayer/trunk/
4 */
6 #ifndef MPLAYER_COM_H
7 #define MPLAYER_COM_H
9 #include "config.h"
11 #ifdef HAVE_STDINT_H
12 #include <stdint.h>
13 #else
14 #include <inttypes.h>
15 #endif
17 /**
18 * Internal functions and structures for COM emulation code.
21 #if !defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
27 #ifndef GUID_TYPE
28 #define GUID_TYPE
29 typedef struct
31 uint32_t f1;
32 uint16_t f2;
33 uint16_t f3;
34 uint8_t f4[8];
35 } GUID;
36 #endif
38 extern const GUID IID_IUnknown;
39 extern const GUID IID_IClassFactory;
41 typedef long (*GETCLASSOBJECT) (GUID* clsid, const GUID* iid, void** ppv);
42 int RegisterComClass(const GUID* clsid, GETCLASSOBJECT gcs);
43 int UnregisterComClass(const GUID* clsid, GETCLASSOBJECT gcs);
45 #ifndef STDCALL
46 #define STDCALL __attribute__((__stdcall__))
47 #endif
49 struct IUnknown;
50 struct IClassFactory;
51 struct IUnknown_vt
53 long STDCALL (*QueryInterface)(struct IUnknown* this, const GUID* iid, void** ppv);
54 long STDCALL (*AddRef)(struct IUnknown* this) ;
55 long STDCALL (*Release)(struct IUnknown* this) ;
56 } ;
58 typedef struct IUnknown
60 struct IUnknown_vt* vt;
61 } IUnknown;
63 struct IClassFactory_vt
65 long STDCALL (*QueryInterface)(struct IUnknown* this, const GUID* iid, void** ppv);
66 long STDCALL (*AddRef)(struct IUnknown* this) ;
67 long STDCALL (*Release)(struct IUnknown* this) ;
68 long STDCALL (*CreateInstance)(struct IClassFactory* this, struct IUnknown* pUnkOuter, const GUID* riid, void** ppvObject);
71 struct IClassFactory
73 struct IClassFactory_vt* vt;
76 #ifdef WIN32_LOADER
77 long CoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter,
78 long dwClsContext, const GUID* riid, void** ppv);
79 void* CoTaskMemAlloc(unsigned long cb);
80 void CoTaskMemFree(void* cb);
81 #else
82 long STDCALL CoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter,
83 long dwClsContext, const GUID* riid, void** ppv);
84 void* STDCALL CoTaskMemAlloc(unsigned long);
85 void STDCALL CoTaskMemFree(void*);
86 #endif
88 #ifdef __cplusplus
90 #endif /* __cplusplus */
92 #endif /* WIN32 */
94 #endif /* MPLAYER_COM_H */