Home | History | Annotate | Download | only in include
      1 /**
      2  * This file is part of the mingw-w64 runtime package.
      3  * No warranty is given; refer to the file DISCLAIMER within this package.
      4  */
      5 #ifndef GUID_DEFINED
      6 #define GUID_DEFINED
      7 
      8 /* Make sure __LONG32 is defined.  */
      9 #include <_mingw.h>
     10 
     11 #ifdef __WIDL__
     12 typedef struct {
     13   unsigned long Data1;
     14   unsigned short Data2;
     15   unsigned short Data3;
     16   byte Data4[8];
     17 } GUID;
     18 #else
     19 typedef struct _GUID {
     20   unsigned __LONG32 Data1;
     21   unsigned short Data2;
     22   unsigned short Data3;
     23   unsigned char Data4[8];
     24 } GUID;
     25 #endif
     26 #endif
     27 
     28 #if defined(__cplusplus) && (USE___UUIDOF == 0)
     29 extern "C++" {
     30 __extension__ template<typename T> const GUID &__mingw_uuidof();
     31 }
     32 #endif
     33 
     34 #ifndef FAR
     35 #define FAR
     36 #endif
     37 
     38 #ifndef DECLSPEC_SELECTANY
     39 #define DECLSPEC_SELECTANY __declspec(selectany)
     40 #endif
     41 
     42 #ifndef EXTERN_C
     43 #ifdef __cplusplus
     44 #define EXTERN_C extern "C"
     45 #else
     46 #define EXTERN_C extern
     47 #endif
     48 #endif
     49 
     50 #ifdef DEFINE_GUID
     51 #undef DEFINE_GUID
     52 #endif
     53 
     54 #ifdef INITGUID
     55 #ifdef __cplusplus
     56 #define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) EXTERN_C const GUID DECLSPEC_SELECTANY name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
     57 #else
     58 #define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) const GUID DECLSPEC_SELECTANY name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
     59 #endif
     60 #else
     61 #define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) EXTERN_C const GUID name
     62 #endif
     63 
     64 #define DEFINE_OLEGUID(name, l, w1, w2) DEFINE_GUID (name, l, w1, w2, 0xc0, 0, 0, 0, 0, 0, 0, 0x46)
     65 
     66 #ifndef _GUIDDEF_H_
     67 #define _GUIDDEF_H_
     68 
     69 #ifndef __LPGUID_DEFINED__
     70 #define __LPGUID_DEFINED__
     71 typedef GUID *LPGUID;
     72 #endif
     73 
     74 #ifndef __LPCGUID_DEFINED__
     75 #define __LPCGUID_DEFINED__
     76 typedef const GUID *LPCGUID;
     77 #endif
     78 
     79 #ifndef __IID_DEFINED__
     80 #define __IID_DEFINED__
     81 
     82 typedef GUID IID;
     83 typedef IID *LPIID;
     84 
     85 #define IID_NULL GUID_NULL
     86 #define IsEqualIID(riid1, riid2) IsEqualGUID (riid1, riid2)
     87 
     88 #ifndef CLSID_DEFINED
     89 #define CLSID_DEFINED
     90 typedef GUID CLSID;
     91 #endif
     92 
     93 typedef CLSID *LPCLSID;
     94 
     95 #define CLSID_NULL GUID_NULL
     96 #define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID (rclsid1, rclsid2)
     97 typedef GUID FMTID;
     98 typedef FMTID *LPFMTID;
     99 #define FMTID_NULL GUID_NULL
    100 #define IsEqualFMTID(rfmtid1, rfmtid2) IsEqualGUID (rfmtid1, rfmtid2)
    101 
    102 #ifdef __WIDL_proxy
    103 #define __MIDL_CONST
    104 #else
    105 #define __MIDL_CONST const
    106 #endif
    107 
    108 #ifndef _REFGUID_DEFINED
    109 #define _REFGUID_DEFINED
    110 #ifdef __cplusplus
    111 #define REFGUID const GUID &
    112 #else
    113 #define REFGUID const GUID *__MIDL_CONST
    114 #endif
    115 #endif
    116 
    117 #ifndef _REFIID_DEFINED
    118 #define _REFIID_DEFINED
    119 #ifdef __cplusplus
    120 #define REFIID const IID &
    121 #else
    122 #define REFIID const IID *__MIDL_CONST
    123 #endif
    124 #endif
    125 
    126 #ifndef _REFCLSID_DEFINED
    127 #define _REFCLSID_DEFINED
    128 #ifdef __cplusplus
    129 #define REFCLSID const IID &
    130 #else
    131 #define REFCLSID const IID *__MIDL_CONST
    132 #endif
    133 #endif
    134 
    135 #ifndef _REFFMTID_DEFINED
    136 #define _REFFMTID_DEFINED
    137 #ifdef __cplusplus
    138 #define REFFMTID const IID &
    139 #else
    140 #define REFFMTID const IID *__MIDL_CONST
    141 #endif
    142 #endif
    143 #endif
    144 
    145 #ifndef __WIDL__
    146 #ifndef _SYS_GUID_OPERATORS_
    147 #define _SYS_GUID_OPERATORS_
    148 #include <string.h>
    149 
    150 #ifdef __cplusplus
    151 __inline int InlineIsEqualGUID (REFGUID rguid1, REFGUID rguid2) {
    152   return ((&rguid1.Data1)[0] == (&rguid2.Data1)[0] && (&rguid1.Data1)[1] == (&rguid2.Data1)[1] && (&rguid1.Data1)[2] == (&rguid2.Data1)[2] && (&rguid1.Data1)[3] == (&rguid2.Data1)[3]);
    153 }
    154 
    155 __inline int IsEqualGUID (REFGUID rguid1, REFGUID rguid2) {
    156   return !memcmp (&rguid1,&rguid2, sizeof (GUID));
    157 }
    158 #else
    159 #define InlineIsEqualGUID(rguid1, rguid2) ((&(rguid1)->Data1)[0] == (&(rguid2)->Data1)[0] && (&(rguid1)->Data1)[1] == (&(rguid2)->Data1)[1] && (&(rguid1)->Data1)[2] == (&(rguid2)->Data1)[2] && (&(rguid1)->Data1)[3] == (&(rguid2)->Data1)[3])
    160 #define IsEqualGUID(rguid1, rguid2) (!memcmp (rguid1, rguid2, sizeof (GUID)))
    161 #endif
    162 
    163 #ifdef __INLINE_ISEQUAL_GUID
    164 #undef IsEqualGUID
    165 #define IsEqualGUID(rguid1, rguid2) InlineIsEqualGUID (rguid1, rguid2)
    166 #endif
    167 
    168 #define IsEqualIID(riid1, riid2) IsEqualGUID (riid1, riid2)
    169 #define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID (rclsid1, rclsid2)
    170 
    171 #if !defined (_SYS_GUID_OPERATOR_EQ_) && !defined (_NO_SYS_GUID_OPERATOR_EQ_)
    172 #define _SYS_GUID_OPERATOR_EQ_
    173 #ifdef __cplusplus
    174 __inline bool operator== (REFGUID guidOne, REFGUID guidOther) { return !!IsEqualGUID (guidOne, guidOther); }
    175 __inline bool operator!= (REFGUID guidOne, REFGUID guidOther) { return ! (guidOne == guidOther); }
    176 #endif
    177 #endif
    178 
    179 #endif
    180 #endif
    181 #endif
    182