Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
2.6 KiB

  1. // comdecl.h: Macros to facilitate COM interface and GUID declarations.
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. #ifndef _COMDECL_H_
  4. #define _COMDECL_H_
  5. #ifndef _XBOX
  6. #include <basetyps.h> // For standard COM interface macros
  7. #else
  8. #pragma warning(push)
  9. #pragma warning(disable:4061)
  10. #include <xtl.h> // Required by xobjbase.h
  11. #include <xobjbase.h> // Special definitions for Xbox build
  12. #pragma warning(pop)
  13. #endif
  14. // The DEFINE_CLSID() and DEFINE_IID() macros defined below allow COM GUIDs to
  15. // be declared and defined in such a way that clients can obtain the GUIDs using
  16. // either the __uuidof() extension or the old-style CLSID_Foo / IID_IFoo names.
  17. // If using the latter approach, the client can also choose whether to get the
  18. // GUID definitions by defining the INITGUID preprocessor constant or by linking
  19. // to a GUID library. This works in either C or C++.
  20. #ifdef __cplusplus
  21. #define DECLSPEC_UUID_WRAPPER(x) __declspec(uuid(#x))
  22. #ifdef INITGUID
  23. #define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
  24. class DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) className; \
  25. EXTERN_C const GUID DECLSPEC_SELECTANY CLSID_##className = __uuidof(className)
  26. #define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
  27. interface DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) interfaceName; \
  28. EXTERN_C const GUID DECLSPEC_SELECTANY IID_##interfaceName = __uuidof(interfaceName)
  29. #else // INITGUID
  30. #define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
  31. class DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) className; \
  32. EXTERN_C const GUID CLSID_##className
  33. #define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
  34. interface DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) interfaceName; \
  35. EXTERN_C const GUID IID_##interfaceName
  36. #endif // INITGUID
  37. #else // __cplusplus
  38. #define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
  39. DEFINE_GUID(CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
  40. #define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
  41. DEFINE_GUID(IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
  42. #endif // __cplusplus
  43. #endif // #ifndef _COMDECL_H_