LinuxCOM.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* -LICENSE-START-
  2. ** Copyright (c) 2009 Blackmagic Design
  3. **
  4. ** Permission is hereby granted, free of charge, to any person or organization
  5. ** obtaining a copy of the software and accompanying documentation covered by
  6. ** this license (the "Software") to use, reproduce, display, distribute,
  7. ** execute, and transmit the Software, and to prepare derivative works of the
  8. ** Software, and to permit third-parties to whom the Software is furnished to
  9. ** do so, all subject to the following:
  10. **
  11. ** The copyright notices in the Software and this entire statement, including
  12. ** the above license grant, this restriction and the following disclaimer,
  13. ** must be included in all copies of the Software, in whole or in part, and
  14. ** all derivative works of the Software, unless such copies or derivative
  15. ** works are solely in the form of machine-executable object code generated by
  16. ** a source language processor.
  17. **
  18. ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. ** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
  21. ** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
  22. ** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
  23. ** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  24. ** DEALINGS IN THE SOFTWARE.
  25. ** -LICENSE-END-
  26. */
  27. #ifndef __LINUX_COM_H_
  28. #define __LINUX_COM_H_
  29. struct REFIID
  30. {
  31. unsigned char byte0;
  32. unsigned char byte1;
  33. unsigned char byte2;
  34. unsigned char byte3;
  35. unsigned char byte4;
  36. unsigned char byte5;
  37. unsigned char byte6;
  38. unsigned char byte7;
  39. unsigned char byte8;
  40. unsigned char byte9;
  41. unsigned char byte10;
  42. unsigned char byte11;
  43. unsigned char byte12;
  44. unsigned char byte13;
  45. unsigned char byte14;
  46. unsigned char byte15;
  47. };
  48. typedef REFIID CFUUIDBytes;
  49. #define CFUUIDGetUUIDBytes(x) x
  50. typedef int HRESULT;
  51. typedef unsigned long ULONG;
  52. typedef void *LPVOID;
  53. #define SUCCEEDED(Status) ((HRESULT)(Status) >= 0)
  54. #define FAILED(Status) ((HRESULT)(Status)<0)
  55. #define IS_ERROR(Status) ((unsigned long)(Status) >> 31 == SEVERITY_ERROR)
  56. #define HRESULT_CODE(hr) ((hr) & 0xFFFF)
  57. #define HRESULT_FACILITY(hr) (((hr) >> 16) & 0x1fff)
  58. #define HRESULT_SEVERITY(hr) (((hr) >> 31) & 0x1)
  59. #define SEVERITY_SUCCESS 0
  60. #define SEVERITY_ERROR 1
  61. #define MAKE_HRESULT(sev,fac,code) ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) )
  62. #define S_OK ((HRESULT)0x00000000L)
  63. #define S_FALSE ((HRESULT)0x00000001L)
  64. #define E_UNEXPECTED ((HRESULT)0x8000FFFFL)
  65. #define E_NOTIMPL ((HRESULT)0x80000001L)
  66. #define E_OUTOFMEMORY ((HRESULT)0x80000002L)
  67. #define E_INVALIDARG ((HRESULT)0x80000003L)
  68. #define E_NOINTERFACE ((HRESULT)0x80000004L)
  69. #define E_POINTER ((HRESULT)0x80000005L)
  70. #define E_HANDLE ((HRESULT)0x80000006L)
  71. #define E_ABORT ((HRESULT)0x80000007L)
  72. #define E_FAIL ((HRESULT)0x80000008L)
  73. #define E_ACCESSDENIED ((HRESULT)0x80000009L)
  74. #define STDMETHODCALLTYPE
  75. #define IID_IUnknown (REFIID){0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}
  76. #define IUnknownUUID IID_IUnknown
  77. #ifndef BMD_PUBLIC
  78. #define BMD_PUBLIC
  79. #endif
  80. #ifdef __cplusplus
  81. class BMD_PUBLIC IUnknown
  82. {
  83. public:
  84. virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) = 0;
  85. virtual ULONG STDMETHODCALLTYPE AddRef(void) = 0;
  86. virtual ULONG STDMETHODCALLTYPE Release(void) = 0;
  87. };
  88. #endif
  89. #endif