VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/i8042prt/include/guiddef.h@ 4612

Last change on this file since 4612 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 KB
Line 
1//+---------------------------------------------------------------------------
2//
3// Microsoft Windows
4// Copyright (c) Microsoft Corporation. All rights reserved.
5//
6// File: guiddef.h
7//
8// Contents: GUID definition
9//
10//----------------------------------------------------------------------------
11
12#ifndef GUID_DEFINED
13#define GUID_DEFINED
14#if defined(__midl)
15typedef struct {
16 unsigned long Data1;
17 unsigned short Data2;
18 unsigned short Data3;
19 byte Data4[ 8 ];
20} GUID;
21#else
22typedef struct _GUID {
23 unsigned long Data1;
24 unsigned short Data2;
25 unsigned short Data3;
26 unsigned char Data4[ 8 ];
27} GUID;
28#endif
29#endif
30
31#ifndef FAR
32#ifdef _WIN32
33#define FAR
34#else
35#define FAR _far
36#endif
37#endif
38
39#ifndef DECLSPEC_SELECTANY
40#if (_MSC_VER >= 1100)
41#define DECLSPEC_SELECTANY __declspec(selectany)
42#else
43#define DECLSPEC_SELECTANY
44#endif
45#endif
46
47#ifndef EXTERN_C
48#ifdef __cplusplus
49#define EXTERN_C extern "C"
50#else
51#define EXTERN_C extern
52#endif
53#endif
54
55#ifdef DEFINE_GUID
56#undef DEFINE_GUID
57#endif
58
59#ifdef INITGUID
60#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
61 EXTERN_C const GUID DECLSPEC_SELECTANY name \
62 = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
63#else
64#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
65 EXTERN_C const GUID FAR name
66#endif // INITGUID
67
68#define DEFINE_OLEGUID(name, l, w1, w2) DEFINE_GUID(name, l, w1, w2, 0xC0,0,0,0,0,0,0,0x46)
69
70#ifndef _GUIDDEF_H_
71#define _GUIDDEF_H_
72
73#ifndef __LPGUID_DEFINED__
74#define __LPGUID_DEFINED__
75typedef GUID *LPGUID;
76#endif
77
78#ifndef __LPCGUID_DEFINED__
79#define __LPCGUID_DEFINED__
80typedef const GUID *LPCGUID;
81#endif
82
83#ifndef __IID_DEFINED__
84#define __IID_DEFINED__
85
86typedef GUID IID;
87typedef IID *LPIID;
88#define IID_NULL GUID_NULL
89#define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)
90typedef GUID CLSID;
91typedef CLSID *LPCLSID;
92#define CLSID_NULL GUID_NULL
93#define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)
94typedef GUID FMTID;
95typedef FMTID *LPFMTID;
96#define FMTID_NULL GUID_NULL
97#define IsEqualFMTID(rfmtid1, rfmtid2) IsEqualGUID(rfmtid1, rfmtid2)
98
99#ifdef __midl_proxy
100#define __MIDL_CONST
101#else
102#define __MIDL_CONST const
103#endif
104
105#ifndef _REFGUID_DEFINED
106#define _REFGUID_DEFINED
107#ifdef __cplusplus
108#define REFGUID const GUID &
109#else
110#define REFGUID const GUID * __MIDL_CONST
111#endif
112#endif
113
114#ifndef _REFIID_DEFINED
115#define _REFIID_DEFINED
116#ifdef __cplusplus
117#define REFIID const IID &
118#else
119#define REFIID const IID * __MIDL_CONST
120#endif
121#endif
122
123#ifndef _REFCLSID_DEFINED
124#define _REFCLSID_DEFINED
125#ifdef __cplusplus
126#define REFCLSID const IID &
127#else
128#define REFCLSID const IID * __MIDL_CONST
129#endif
130#endif
131
132#ifndef _REFFMTID_DEFINED
133#define _REFFMTID_DEFINED
134#ifdef __cplusplus
135#define REFFMTID const IID &
136#else
137#define REFFMTID const IID * __MIDL_CONST
138#endif
139#endif
140
141#endif // !__IID_DEFINED__
142
143#if !defined (__midl)
144#if !defined (_SYS_GUID_OPERATORS_)
145#define _SYS_GUID_OPERATORS_
146#include <string.h>
147
148// Faster (but makes code fatter) inline version...use sparingly
149#ifdef __cplusplus
150__inline int InlineIsEqualGUID(REFGUID rguid1, REFGUID rguid2)
151{
152 return (
153 ((unsigned long *) &rguid1)[0] == ((unsigned long *) &rguid2)[0] &&
154 ((unsigned long *) &rguid1)[1] == ((unsigned long *) &rguid2)[1] &&
155 ((unsigned long *) &rguid1)[2] == ((unsigned long *) &rguid2)[2] &&
156 ((unsigned long *) &rguid1)[3] == ((unsigned long *) &rguid2)[3]);
157}
158
159__inline int IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
160{
161 return !memcmp(&rguid1, &rguid2, sizeof(GUID));
162}
163
164#else // ! __cplusplus
165
166#define InlineIsEqualGUID(rguid1, rguid2) \
167 (((unsigned long *) rguid1)[0] == ((unsigned long *) rguid2)[0] && \
168 ((unsigned long *) rguid1)[1] == ((unsigned long *) rguid2)[1] && \
169 ((unsigned long *) rguid1)[2] == ((unsigned long *) rguid2)[2] && \
170 ((unsigned long *) rguid1)[3] == ((unsigned long *) rguid2)[3])
171
172#define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID)))
173
174#endif // __cplusplus
175
176#ifdef __INLINE_ISEQUAL_GUID
177#undef IsEqualGUID
178#define IsEqualGUID(rguid1, rguid2) InlineIsEqualGUID(rguid1, rguid2)
179#endif
180
181// Same type, different name
182
183#define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)
184#define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)
185
186
187#if !defined _SYS_GUID_OPERATOR_EQ_ && !defined _NO_SYS_GUID_OPERATOR_EQ_
188#define _SYS_GUID_OPERATOR_EQ_
189// A couple of C++ helpers
190
191#ifdef __cplusplus
192__inline int operator==(REFGUID guidOne, REFGUID guidOther)
193{
194 return IsEqualGUID(guidOne,guidOther);
195}
196
197__inline int operator!=(REFGUID guidOne, REFGUID guidOther)
198{
199 return !(guidOne == guidOther);
200}
201#endif
202#endif // _SYS_GUID_OPERATOR_EQ_
203#endif // _SYS_GUID_OPERATORS_
204#endif // __midl
205#endif // _GUIDDEF_H_
206
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette