Sync with trunk (r48545)
[reactos.git] / include / psdk / guiddef.h
index 6e6f52d..b02e57e 100644 (file)
@@ -31,16 +31,28 @@ typedef struct _GUID
 } GUID;
 #endif
 
+#ifndef DECLSPEC_SELECTANY
+#define DECLSPEC_SELECTANY __declspec(selectany)
+#endif
+
+#ifndef EXTERN_C
+#ifdef __cplusplus
+#define EXTERN_C    extern "C"
+#else
+#define EXTERN_C    extern
+#endif
+#endif
+
 #undef DEFINE_GUID
 
 #ifdef INITGUID
 #ifdef __cplusplus
 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
-        EXTERN_C const GUID name = \
+        EXTERN_C const GUID DECLSPEC_SELECTANY name = \
        { l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }
 #else
 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
-        const GUID name = \
+        const GUID DECLSPEC_SELECTANY name = \
        { l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }
 #endif
 #else
@@ -98,6 +110,16 @@ typedef GUID FMTID,*LPFMTID;
 #endif /* !defined(__cplusplus) && !defined(CINTERFACE) */
 
 #if defined(__cplusplus) && !defined(CINTERFACE)
+
+__inline int InlineIsEqualGUID(REFGUID rguid1, REFGUID rguid2)
+{
+    return (
+        ((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]);
+}
+
 #define IsEqualGUID(rguid1, rguid2) (!memcmp(&(rguid1), &(rguid2), sizeof(GUID)))
 #else /* defined(__cplusplus) && !defined(CINTERFACE) */
 #define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID)))
@@ -105,6 +127,8 @@ typedef GUID FMTID,*LPFMTID;
 
 #if defined(__cplusplus) && !defined(CINTERFACE)
 #include <string.h>
+#if !defined _SYS_GUID_OPERATOR_EQ_ && !defined _NO_SYS_GUID_OPERATOR_EQ_
+#define _SYS_GUID_OPERATOR_EQ_
 inline bool operator==(const GUID& guidOne, const GUID& guidOther)
 {
     return !memcmp(&guidOne,&guidOther,sizeof(GUID));
@@ -114,7 +138,6 @@ inline bool operator!=(const GUID& guidOne, const GUID& guidOther)
     return !(guidOne == guidOther);
 }
 #endif
-
-extern const IID GUID_NULL;
+#endif
 
 #endif /* _GUIDDEF_H_ */