]> git.sesse.net Git - vlc/blob - libs/loader/com.h
Create a modules-like directory for libraries
[vlc] / libs / loader / com.h
1 /*
2  * Modified for use with MPlayer, detailed CVS changelog at
3  * http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/
4  * $Id$
5  */
6
7 #ifndef AVIFILE_COM_H
8 #define AVIFILE_COM_H
9
10 #include "config.h"
11
12 #ifdef HAVE_STDINT_H
13 #include <stdint.h>
14 #else
15 #include <inttypes.h>
16 #endif
17
18 /**
19  * Internal functions and structures for COM emulation code.
20  */
21
22 #if !defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 void* CoTaskMemAlloc(unsigned long cb);
29 void CoTaskMemFree(void* cb);
30
31 #ifndef GUID_TYPE
32 #define GUID_TYPE
33 typedef struct
34 {
35     uint32_t f1;
36     uint16_t f2;
37     uint16_t f3;
38     uint8_t  f4[8];
39 } GUID;
40 #endif
41
42 extern const GUID IID_IUnknown;
43 extern const GUID IID_IClassFactory;
44
45 typedef long (*GETCLASSOBJECT) (GUID* clsid, const GUID* iid, void** ppv);
46 int RegisterComClass(const GUID* clsid, GETCLASSOBJECT gcs);
47 int UnregisterComClass(const GUID* clsid, GETCLASSOBJECT gcs);
48
49 #ifndef STDCALL
50 #define STDCALL __attribute__((__stdcall__))
51 #endif
52
53 struct IUnknown;
54 struct IClassFactory;
55 struct IUnknown_vt
56 {
57     long STDCALL (*QueryInterface)(struct IUnknown* _this, const GUID* iid, void** ppv);
58     long STDCALL (*AddRef)(struct IUnknown* _this) ;
59     long STDCALL (*Release)(struct IUnknown* _this) ;
60 } ;
61
62 typedef struct IUnknown
63 {
64     struct IUnknown_vt* vt;
65 } IUnknown;
66
67 struct IClassFactory_vt
68 {
69     long STDCALL (*QueryInterface)(struct IUnknown* _this, const GUID* iid, void** ppv);
70     long STDCALL (*AddRef)(struct IUnknown* _this) ;
71     long STDCALL (*Release)(struct IUnknown* _this) ;
72     long STDCALL (*CreateInstance)(struct IClassFactory* _this, struct IUnknown* pUnkOuter, const GUID* riid, void** ppvObject);
73 };
74
75 struct IClassFactory
76 {
77     struct IClassFactory_vt* vt;
78 };
79
80 long CoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter,
81                       long dwClsContext, const GUID* riid, void** ppv);
82
83 #ifdef __cplusplus
84 };
85 #endif /* __cplusplus */
86
87 #endif /* WIN32 */
88
89 #endif /* AVIFILE_COM_H */