ifc_omservice.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #ifndef NULLSOFT_WINAMP_OMSERVICE_INTERFACE_HEADER
  2. #define NULLSOFT_WINAMP_OMSERVICE_INTERFACE_HEADER
  3. #if defined(_MSC_VER) && (_MSC_VER >= 1020)
  4. #pragma once
  5. #endif
  6. #include <bfc/dispatch.h>
  7. // {2999A8B2-7780-4542-9257-02D4E89310B8}
  8. static const GUID IFC_OmService =
  9. { 0x2999a8b2, 0x7780, 0x4542, { 0x92, 0x57, 0x2, 0xd4, 0xe8, 0x93, 0x10, 0xb8 } };
  10. interface IDispatch;
  11. class ifc_omservicehost;
  12. #define OMSVC_E_INSUFFICIENT_BUFFER MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_INSUFFICIENT_BUFFER) //same as STRSAFE_E_INSUFFICIENT_BUFFER
  13. // supports AddRef(), Release(), QueryInterface()
  14. class __declspec(novtable) ifc_omservice : public Dispatchable
  15. {
  16. public:
  17. typedef enum
  18. {
  19. RuntimeFlagsMask = 0xFFFF0000,
  20. } FlagsMask;
  21. protected:
  22. ifc_omservice() {}
  23. ~ifc_omservice() {}
  24. public:
  25. unsigned int GetId();
  26. HRESULT GetName(wchar_t *pszBuffer, unsigned int cchBufferMax);
  27. HRESULT GetUrl(wchar_t *pszBuffer, unsigned int cchBufferMax);
  28. HRESULT GetUrlDirect(wchar_t *pszBuffer, unsigned int cchBufferMax);
  29. HRESULT GetIcon(wchar_t *pszBuffer, unsigned int cchBufferMax);
  30. HRESULT GetExternal(IDispatch **ppDispatch);
  31. HRESULT GetRating(unsigned int *rating);
  32. HRESULT GetVersion(unsigned int *version);
  33. HRESULT GetFlags(unsigned int *flags);
  34. HRESULT SetAddress(const wchar_t *pszAddress);
  35. HRESULT GetAddress(wchar_t *pszBuffer, unsigned int cchBufferMax);
  36. HRESULT GetGeneration(unsigned int *generation);
  37. HRESULT UpdateFlags(unsigned int flags);
  38. public:
  39. DISPATCH_CODES
  40. {
  41. API_GETID = 10,
  42. API_GETNAME = 20,
  43. API_GETURL = 30,
  44. API_GETICON = 40,
  45. API_GETEXTERNAL = 50,
  46. API_GETRATING = 60,
  47. API_GETVERSION = 70,
  48. API_GETFLAGS = 80,
  49. API_SETADDRESS = 90,
  50. API_GETADDRESS = 100,
  51. API_GETGENERATION = 110,
  52. API_GETURLDIRECT = 120,
  53. API_UPDATEFLAGS = 130,
  54. };
  55. };
  56. inline unsigned int ifc_omservice::GetId()
  57. {
  58. return _call(API_GETID, 0);
  59. }
  60. inline HRESULT ifc_omservice::GetName(wchar_t *pszBuffer, unsigned int cchBufferMax)
  61. {
  62. return _call(API_GETNAME, (HRESULT)E_NOTIMPL, pszBuffer, cchBufferMax);
  63. }
  64. inline HRESULT ifc_omservice::GetUrl(wchar_t *pszBuffer, unsigned int cchBufferMax)
  65. {
  66. return _call(API_GETURL, E_NOTIMPL, pszBuffer, cchBufferMax);
  67. }
  68. inline HRESULT ifc_omservice::GetUrlDirect(wchar_t *pszBuffer, unsigned int cchBufferMax)
  69. {
  70. return _call(API_GETURLDIRECT, E_NOTIMPL, pszBuffer, cchBufferMax);
  71. }
  72. inline HRESULT ifc_omservice::GetIcon(wchar_t *pszBuffer, unsigned int cchBufferMax)
  73. {
  74. return _call(API_GETICON, (HRESULT)E_NOTIMPL, pszBuffer, cchBufferMax);
  75. }
  76. inline HRESULT ifc_omservice::GetExternal(IDispatch **ppDispatch)
  77. {
  78. return _call(API_GETEXTERNAL, (HRESULT)E_NOTIMPL, ppDispatch);
  79. }
  80. inline HRESULT ifc_omservice::GetRating(unsigned int *rating)
  81. {
  82. return _call(API_GETRATING, (HRESULT)E_NOTIMPL, rating);
  83. }
  84. inline HRESULT ifc_omservice::GetVersion(unsigned int *version)
  85. {
  86. return _call(API_GETVERSION, (HRESULT)E_NOTIMPL, version);
  87. }
  88. inline HRESULT ifc_omservice::GetFlags(unsigned int *flags)
  89. {
  90. return _call(API_GETFLAGS, (HRESULT)E_NOTIMPL, flags);
  91. }
  92. inline HRESULT ifc_omservice::SetAddress(const wchar_t *pszAddress)
  93. {
  94. return _call(API_SETADDRESS, (HRESULT)E_NOTIMPL, pszAddress);
  95. }
  96. inline HRESULT ifc_omservice::GetAddress(wchar_t *pszBuffer, unsigned int cchBufferMax)
  97. {
  98. return _call(API_GETADDRESS, (HRESULT)E_NOTIMPL, pszBuffer, cchBufferMax);
  99. }
  100. inline HRESULT ifc_omservice::GetGeneration(unsigned int *generation)
  101. {
  102. return _call(API_GETGENERATION, (HRESULT)E_NOTIMPL, generation);
  103. }
  104. inline HRESULT ifc_omservice::UpdateFlags(unsigned int flags)
  105. {
  106. return _call(API_UPDATEFLAGS, (HRESULT)E_NOTIMPL, flags);
  107. }
  108. #endif //NULLSOFT_WINAMP_OMSERVICE_INTERFACE_HEADER