guiddef.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /**
  2. * This file has no copyright assigned and is placed in the Public Domain.
  3. * This file is part of the w64 mingw-runtime package.
  4. * No warranty is given; refer to the file DISCLAIMER within this package.
  5. */
  6. #ifndef GUID_DEFINED
  7. #define GUID_DEFINED
  8. typedef struct _GUID {
  9. unsigned long Data1;
  10. unsigned short Data2;
  11. unsigned short Data3;
  12. unsigned char Data4[8 ];
  13. } GUID;
  14. #endif
  15. #ifndef UUID_DEFINED
  16. #define UUID_DEFINED
  17. typedef GUID UUID;
  18. #endif
  19. #ifndef FAR
  20. #define FAR
  21. #endif
  22. #ifndef DECLSPEC_SELECTANY
  23. #define DECLSPEC_SELECTANY __declspec(selectany)
  24. #endif
  25. #ifndef EXTERN_C
  26. #ifdef __cplusplus
  27. #define EXTERN_C extern "C"
  28. #else
  29. #define EXTERN_C extern
  30. #endif
  31. #endif
  32. #ifdef DEFINE_GUID
  33. #undef DEFINE_GUID
  34. #endif
  35. #ifdef INITGUID
  36. #ifdef __cplusplus
  37. #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 } }
  38. #else
  39. #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 } }
  40. #endif
  41. #else
  42. #define DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) EXTERN_C const GUID name
  43. #endif
  44. #define DEFINE_OLEGUID(name,l,w1,w2) DEFINE_GUID(name,l,w1,w2,0xC0,0,0,0,0,0,0,0x46)
  45. #ifndef _GUIDDEF_H_
  46. #define _GUIDDEF_H_
  47. #ifndef __LPGUID_DEFINED__
  48. #define __LPGUID_DEFINED__
  49. typedef GUID *LPGUID;
  50. #endif
  51. #ifndef __LPCGUID_DEFINED__
  52. #define __LPCGUID_DEFINED__
  53. typedef const GUID *LPCGUID;
  54. #endif
  55. #ifndef __IID_DEFINED__
  56. #define __IID_DEFINED__
  57. typedef GUID IID;
  58. typedef IID *LPIID;
  59. #define IID_NULL GUID_NULL
  60. #define IsEqualIID(riid1,riid2) IsEqualGUID(riid1,riid2)
  61. typedef GUID CLSID;
  62. typedef CLSID *LPCLSID;
  63. #define CLSID_NULL GUID_NULL
  64. #define IsEqualCLSID(rclsid1,rclsid2) IsEqualGUID(rclsid1,rclsid2)
  65. typedef GUID FMTID;
  66. typedef FMTID *LPFMTID;
  67. #define FMTID_NULL GUID_NULL
  68. #define IsEqualFMTID(rfmtid1,rfmtid2) IsEqualGUID(rfmtid1,rfmtid2)
  69. #ifdef __midl_proxy
  70. #define __MIDL_CONST
  71. #else
  72. #define __MIDL_CONST const
  73. #endif
  74. #ifndef _REFGUID_DEFINED
  75. #define _REFGUID_DEFINED
  76. #ifdef __cplusplus
  77. #define REFGUID const GUID &
  78. #else
  79. #define REFGUID const GUID *__MIDL_CONST
  80. #endif
  81. #endif
  82. #ifndef _REFIID_DEFINED
  83. #define _REFIID_DEFINED
  84. #ifdef __cplusplus
  85. #define REFIID const IID &
  86. #else
  87. #define REFIID const IID *__MIDL_CONST
  88. #endif
  89. #endif
  90. #ifndef _REFCLSID_DEFINED
  91. #define _REFCLSID_DEFINED
  92. #ifdef __cplusplus
  93. #define REFCLSID const IID &
  94. #else
  95. #define REFCLSID const IID *__MIDL_CONST
  96. #endif
  97. #endif
  98. #ifndef _REFFMTID_DEFINED
  99. #define _REFFMTID_DEFINED
  100. #ifdef __cplusplus
  101. #define REFFMTID const IID &
  102. #else
  103. #define REFFMTID const IID *__MIDL_CONST
  104. #endif
  105. #endif
  106. #endif
  107. #ifndef _SYS_GUID_OPERATORS_
  108. #define _SYS_GUID_OPERATORS_
  109. #include <string.h>
  110. #ifdef __cplusplus
  111. __inline int InlineIsEqualGUID(REFGUID rguid1,REFGUID rguid2) {
  112. return (((unsigned long *) &rguid1)[0]==((unsigned long *) &rguid2)[0] && ((unsigned long *) &rguid1)[1]==((unsigned long *) &rguid2)[1] &&
  113. ((unsigned long *) &rguid1)[2]==((unsigned long *) &rguid2)[2] && ((unsigned long *) &rguid1)[3]==((unsigned long *) &rguid2)[3]);
  114. }
  115. __inline int IsEqualGUID(REFGUID rguid1,REFGUID rguid2) { return !memcmp(&rguid1,&rguid2,sizeof(GUID)); }
  116. #else
  117. #define InlineIsEqualGUID(rguid1,rguid2) (((unsigned long *) rguid1)[0]==((unsigned long *) rguid2)[0] && ((unsigned long *) rguid1)[1]==((unsigned long *) rguid2)[1] && ((unsigned long *) rguid1)[2]==((unsigned long *) rguid2)[2] && ((unsigned long *) rguid1)[3]==((unsigned long *) rguid2)[3])
  118. #define IsEqualGUID(rguid1,rguid2) (!memcmp(rguid1,rguid2,sizeof(GUID)))
  119. #endif
  120. #ifdef __INLINE_ISEQUAL_GUID
  121. #undef IsEqualGUID
  122. #define IsEqualGUID(rguid1,rguid2) InlineIsEqualGUID(rguid1,rguid2)
  123. #endif
  124. #define IsEqualIID(riid1,riid2) IsEqualGUID(riid1,riid2)
  125. #define IsEqualCLSID(rclsid1,rclsid2) IsEqualGUID(rclsid1,rclsid2)
  126. #if !defined _SYS_GUID_OPERATOR_EQ_ && !defined _NO_SYS_GUID_OPERATOR_EQ_
  127. #define _SYS_GUID_OPERATOR_EQ_
  128. #ifdef __cplusplus
  129. __inline int operator==(REFGUID guidOne,REFGUID guidOther) { return IsEqualGUID(guidOne,guidOther); }
  130. __inline int operator!=(REFGUID guidOne,REFGUID guidOther) { return !(guidOne==guidOther); }
  131. #endif
  132. #endif
  133. #endif
  134. #endif