File: objbase.h

package info (click to toggle)
baycomusb 0.10-12.1
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 6,928 kB
  • ctags: 9,413
  • sloc: ansic: 49,182; asm: 17,572; sh: 3,637; makefile: 585; pascal: 183; sed: 93; perl: 31
file content (63 lines) | stat: -rw-r--r-- 1,671 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

/* Various object oriented things... I think :-) */

#ifndef _objbase_h
#define _objbase_h

/* IUnknown needs to be a typedef */
typedef void IUnknown;
#define LPUNKNOWN	void *

#if 0
#define DEFINE_GUID(name, a, b, c, d, e, f, g, h, i, j, k) \
	static const GUID name = { a, b, c, { d, e, f, g, h, i, j, k } }
#endif

#if defined(__cplusplus) && !defined(CINTERFACE)

#define REFGUID			const GUID &
#define REFIID			REFGUID
#define REFCLSID		REFGUID
#define STDMETHOD(method)	virtual HRESULT __stdcall method
#define STDMETHOD_(type,method)	virtual type __stdcall method
#define PURE			= 0
#define THIS_
#define THIS			void
#define DECLARE_INTERFACE(iface) struct iface
#define DECLARE_INTERFACE_(iface, baseiface)	\
				struct iface : public baseiface

#else /* Not C++ */

#if 0
#define REFGUID			const GUID * const
#define REFIID			REFGUID
#define REFCLSID		REFGUID
#define STDMETHOD(method)	HRESULT (__stdcall *method)
#define STDMETHOD_(type,method)	type (__stdcall *method)
#define PURE
#define THIS_			void *This,
#define THIS			void *This
#endif
#define DECLARE_INTERFACE(iface) \
				typedef struct iface##Vtbl iface##Vtbl; \
				typedef struct iface { \
					iface##Vtbl *lpVtbl; \
				} iface; \
				struct iface##Vtbl
#define DECLARE_INTERFACE_(iface, baseiface)	\
				DECLARE_INTERFACE(iface)

#endif /* C++ */

static inline int IsEqualGUID(GUID g1, GUID g2)
{
	return !memcmp(&g1, &g2, sizeof(GUID));
}

extern WINAPI HRESULT CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter,
				DWORD dwClsContext, REFIID riid, LPVOID *ppv); 
extern WINAPI HRESULT CoInitialize(LPVOID pvReserved);
extern WINAPI void CoUninitialize(void);

#endif /* _objbase_h */