Source code of Windows XP (NT5)
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.

169 lines
4.8 KiB

  1. #ifndef _IAS_H_
  2. #define _IAS_H_
  3. // GetShareableApps()
  4. typedef struct
  5. {
  6. HWND hwnd;
  7. BOOL fShared;
  8. }
  9. IAS_HWND;
  10. typedef struct
  11. {
  12. ULONG cShared;
  13. ULONG cEntries;
  14. IAS_HWND aEntries[1];
  15. }
  16. IAS_HWND_ARRAY;
  17. typedef UINT IAS_GCC_ID;
  18. // GetPersonStatus()
  19. #define IAS_SHARING_NOTHING 0x0000
  20. #define IAS_SHARING_APPLICATIONS 0x0001
  21. #define IAS_SHARING_DESKTOP 0x0002
  22. typedef enum
  23. {
  24. IAS_VERSION_20 = 1,
  25. IAS_VERSION_30
  26. }
  27. IAS_VERSION;
  28. typedef struct
  29. {
  30. UINT cbSize;
  31. BOOL InShare; // Participating in share
  32. IAS_VERSION Version; // AS protocol version
  33. UINT AreSharing; // What person is sharing (IAS_SHARING_)
  34. BOOL Controllable; // Is person controllable
  35. BOOL IsPaused; // If controlled, is control paused currently
  36. IAS_GCC_ID InControlOfPending; // Whom we are waiting to control
  37. IAS_GCC_ID InControlOf; // Whom is controlled by person
  38. IAS_GCC_ID ControlledByPending;// Whom we are waiting to be controlled by
  39. IAS_GCC_ID ControlledBy; // Who is controlling person
  40. }
  41. IAS_PERSON_STATUS;
  42. // GetWindowStatus
  43. typedef enum
  44. {
  45. IAS_SHARE_DEFAULT = 0,
  46. IAS_SHARE_BYPROCESS,
  47. IAS_SHARE_BYTHREAD,
  48. IAS_SHARE_BYWINDOW
  49. }
  50. IAS_SHARE_TYPE;
  51. // lonchanc
  52. // In general, S_OK means success, E_*** means failure
  53. // For boolean values, S_OK means TRUE, S_FALSE means FALSE, and E_*** means failure.
  54. #undef INTERFACE
  55. #define INTERFACE IAppSharing
  56. // lonchanc: the idea of this IAppSharing is per call interface
  57. DECLARE_INTERFACE_(IAppSharing, IUnknown)
  58. {
  59. STDMETHOD(QueryInterface)(THIS_ REFIID, void **) PURE;
  60. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  61. STDMETHOD_(ULONG, Release)(THIS) PURE;
  62. //
  63. // INFORMATION
  64. //
  65. STDMETHOD_(BOOL, IsSharingAvailable)(THIS) PURE;
  66. STDMETHOD_(BOOL, CanShareNow)(THIS) PURE;
  67. STDMETHOD_(BOOL, IsInShare)(THIS) PURE;
  68. STDMETHOD_(BOOL, IsSharing)(THIS) PURE;
  69. STDMETHOD_(BOOL, IsWindowShareable)(THIS_ HWND hwnd) PURE;
  70. STDMETHOD_(BOOL, IsWindowShared)(THIS_ HWND hwnd) PURE;
  71. STDMETHOD_(BOOL, CanAllowControl)(THIS) PURE;
  72. STDMETHOD_(BOOL, IsControllable)(THIS) PURE;
  73. STDMETHOD(GetPersonStatus)(THIS_ IAS_GCC_ID Person, IAS_PERSON_STATUS *pStatus) PURE;
  74. //
  75. // SHARING
  76. //
  77. STDMETHOD(LaunchHostUI)(THIS) PURE;
  78. STDMETHOD(GetShareableApps)(THIS_ IAS_HWND_ARRAY **ppHwnds) PURE;
  79. STDMETHOD(FreeShareableApps)(THIS_ IAS_HWND_ARRAY * pHwnds) PURE;
  80. STDMETHOD(Share)(THIS_ HWND hwnd, IAS_SHARE_TYPE how) PURE;
  81. STDMETHOD(Unshare)(THIS_ HWND hwnd) PURE;
  82. //
  83. // CONTROL
  84. //
  85. // On host
  86. STDMETHOD(AllowControl)(THIS_ BOOL fAllowed) PURE;
  87. // From person controlling to person controlled
  88. STDMETHOD(TakeControl)(THIS_ IAS_GCC_ID PersonOf) PURE;
  89. STDMETHOD(CancelTakeControl)(THIS_ IAS_GCC_ID PersonOf) PURE;
  90. STDMETHOD(ReleaseControl)(THIS_ IAS_GCC_ID PersonOf) PURE;
  91. STDMETHOD(PassControl)(THIS_ IAS_GCC_ID PersonOf, IAS_GCC_ID PersonTo) PURE;
  92. // From person controlled
  93. STDMETHOD(GiveControl)(THIS_ IAS_GCC_ID PersonTo) PURE;
  94. STDMETHOD(CancelGiveControl)(THIS_ IAS_GCC_ID PersonTo) PURE;
  95. STDMETHOD(RevokeControl)(THIS_ IAS_GCC_ID PersonFrom) PURE;
  96. STDMETHOD(PauseControl)(IAS_GCC_ID PersonInControl) PURE;
  97. STDMETHOD(UnpauseControl)(IAS_GCC_ID PersonInControl) PURE;
  98. };
  99. // IAppSharingNotify interface
  100. DECLARE_INTERFACE_(IAppSharingNotify, IUnknown)
  101. {
  102. STDMETHOD(QueryInterface)(THIS_ REFIID, void**) PURE;
  103. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  104. STDMETHOD_(ULONG, Release)(THIS) PURE;
  105. STDMETHOD(OnReadyToShare)(THIS_ BOOL fReady) PURE;
  106. STDMETHOD(OnShareStarted)(THIS) PURE;
  107. STDMETHOD(OnSharingStarted)(THIS) PURE;
  108. STDMETHOD(OnShareEnded)(THIS) PURE;
  109. STDMETHOD(OnPersonJoined)(THIS_ IAS_GCC_ID gccID) PURE;
  110. STDMETHOD(OnPersonLeft)(THIS_ IAS_GCC_ID gccID) PURE;
  111. STDMETHOD(OnStartInControl)(THIS_ IAS_GCC_ID gccOf) PURE;
  112. STDMETHOD(OnStopInControl)(THIS_ IAS_GCC_ID gccOf) PURE;
  113. STDMETHOD(OnPausedInControl)(THIS_ IAS_GCC_ID gccInControlOf) PURE;
  114. STDMETHOD(OnUnpausedInControl)(THIS_ IAS_GCC_ID gccInControlOf) PURE;
  115. STDMETHOD(OnControllable)(THIS_ BOOL fControllable) PURE;
  116. STDMETHOD(OnStartControlled)(THIS_ IAS_GCC_ID gccBy) PURE;
  117. STDMETHOD(OnStopControlled)(THIS_ IAS_GCC_ID gccBy) PURE;
  118. STDMETHOD(OnPausedControlled)(THIS_ IAS_GCC_ID gccControlledBy) PURE;
  119. STDMETHOD(OnUnpausedControlled)(THIS_ IAS_GCC_ID gccControlledBy) PURE;
  120. };
  121. //
  122. // AS flags:
  123. //
  124. #define AS_SERVICE 0x0001 // Is this service context?
  125. #define AS_UNATTENDED 0x0002 // Is this unattended (no end user)?
  126. HRESULT WINAPI CreateASObject(IAppSharingNotify * pNotify, UINT flags, IAppSharing** ppAS);
  127. #endif // _IAS_H_