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.

192 lines
5.0 KiB

  1. /*++
  2. Copyright (c) 1999-2000 Microsoft Corporation
  3. Module Name:
  4. RemoteDesktopSession
  5. Abstract:
  6. The CRemoteDesktopSession class is the parent
  7. class for the Remote Desktop class hierarchy on the server-side.
  8. It helps the CRemoteDesktopServerHost class to implement
  9. the ISAFRemoteDesktopSession interface.
  10. The Remote Desktop class hierarchy provides a pluggable C++ interface
  11. for remote desktop access, by abstracting the implementation
  12. specific details of remote desktop access for the server-side.
  13. Author:
  14. Tad Brockway 02/00
  15. Revision History:
  16. --*/
  17. #ifndef __REMOTEDESKTOPSESSION_H_
  18. #define __REMOTEDESKTOPSESSION_H_
  19. #include <RemoteDesktopTopLevelObject.h>
  20. #include "resource.h"
  21. #include <rdshost.h>
  22. #include "RDSHostCP.h"
  23. #include <DataChannelMgr.h>
  24. #include <sessmgr.h>
  25. ///////////////////////////////////////////////////////
  26. //
  27. // CRemoteDesktopSession
  28. //
  29. class CRemoteDesktopServerHost;
  30. class ATL_NO_VTABLE CRemoteDesktopSession :
  31. public CRemoteDesktopTopLevelObject,
  32. public CComObjectRootEx<CComSingleThreadModel>,
  33. public CComCoClass<CRemoteDesktopSession, &CLSID_SAFRemoteDesktopSession>,
  34. public IConnectionPointContainerImpl<CRemoteDesktopSession>,
  35. public IDispatchImpl<ISAFRemoteDesktopSession, &IID_ISAFRemoteDesktopSession, &LIBID_RDSSERVERHOSTLib>,
  36. public IProvideClassInfo2Impl<&CLSID_SAFRemoteDesktopSession, &DIID__ISAFRemoteDesktopSessionEvents, &LIBID_RDSSERVERHOSTLib>,
  37. public CProxy_ISAFRemoteDesktopSessionEvents< CRemoteDesktopSession >
  38. {
  39. private:
  40. protected:
  41. CComPtr<IRemoteDesktopHelpSessionMgr> m_HelpSessionManager;
  42. CComPtr<IRemoteDesktopHelpSession> m_HelpSession;
  43. CComBSTR m_HelpSessionID;
  44. //
  45. // Keep a back pointer to the RDS host object.
  46. //
  47. CRemoteDesktopServerHost *m_RDSHost;
  48. //
  49. // IDispatch Pointers for Scriptable Event Object Registrations
  50. //
  51. IDispatch *m_OnConnected;
  52. IDispatch *m_OnDisconnected;
  53. //
  54. // Accessor Method for Data Channel Manager
  55. //
  56. virtual CRemoteDesktopChannelMgr *GetChannelMgr() = 0;
  57. //
  58. // Return the session description and name, depending on the subclass.
  59. //
  60. virtual VOID GetSessionName(CComBSTR &name) = 0;
  61. virtual VOID GetSessionDescription(CComBSTR &descr) = 0;
  62. //
  63. // Shutdown method.
  64. //
  65. void Shutdown();
  66. public:
  67. //
  68. // Constructor/Destructor
  69. //
  70. CRemoteDesktopSession()
  71. {
  72. m_OnConnected = NULL;
  73. m_OnDisconnected = NULL;
  74. }
  75. virtual ~CRemoteDesktopSession();
  76. //
  77. // Return the help session ID.
  78. //
  79. CComBSTR &GetHelpSessionID() {
  80. return m_HelpSessionID;
  81. }
  82. HRESULT FinalConstruct();
  83. DECLARE_REGISTRY_RESOURCEID(IDR_REMOTEDESKTOPSESSION)
  84. DECLARE_PROTECT_FINAL_CONSTRUCT()
  85. //
  86. // COM Interface Map
  87. //
  88. BEGIN_COM_MAP(CRemoteDesktopSession)
  89. COM_INTERFACE_ENTRY(ISAFRemoteDesktopSession)
  90. COM_INTERFACE_ENTRY2(IDispatch, ISAFRemoteDesktopSession)
  91. COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
  92. COM_INTERFACE_ENTRY(IProvideClassInfo)
  93. COM_INTERFACE_ENTRY(IProvideClassInfo2)
  94. END_COM_MAP()
  95. //
  96. // Connection Point Map
  97. //
  98. BEGIN_CONNECTION_POINT_MAP(CRemoteDesktopSession)
  99. CONNECTION_POINT_ENTRY(DIID__ISAFRemoteDesktopSessionEvents)
  100. END_CONNECTION_POINT_MAP()
  101. public:
  102. //
  103. // If subclass overrides, it should invoke the parent implementation.
  104. //
  105. // If parms are non-NULL, then the session already exists. Otherwise,
  106. // a new session should be created.
  107. //
  108. virtual HRESULT Initialize(
  109. BSTR connectParms,
  110. CRemoteDesktopServerHost *hostObject,
  111. REMOTE_DESKTOP_SHARING_CLASS sharingClass,
  112. BOOL enableCallback,
  113. DWORD timeOut,
  114. BSTR userHelpCreateBlob,
  115. LONG tsSessionID,
  116. BSTR userSID
  117. );
  118. //
  119. // Called when a connection to the client has been established/
  120. // terminated
  121. //
  122. virtual VOID ClientConnected();
  123. virtual VOID ClientDisconnected();
  124. //
  125. // Instruct object to use hostname or ipaddress when constructing
  126. // connect parameters
  127. //
  128. virtual HRESULT UseHostName( BSTR hostname ) { return S_OK; }
  129. //
  130. // ISAFRemoteDesktopSession Methods
  131. //
  132. STDMETHOD(get_ConnectParms)(BSTR *parms) = 0;
  133. STDMETHOD(get_ChannelManager)(ISAFRemoteDesktopChannelMgr **mgr) = 0;
  134. STDMETHOD(Disconnect)() = 0;
  135. STDMETHOD(put_SharingClass)(REMOTE_DESKTOP_SHARING_CLASS sharingClass);
  136. STDMETHOD(get_SharingClass)(REMOTE_DESKTOP_SHARING_CLASS *sharingClass);
  137. STDMETHOD(CloseRemoteDesktopSession)();
  138. STDMETHOD(put_OnConnected)(/*[in]*/IDispatch *iDisp);
  139. STDMETHOD(put_OnDisconnected)(/*[in]*/IDispatch *iDisp);
  140. //
  141. // Return this class name.
  142. //
  143. virtual const LPTSTR ClassName() { return _T("CRemoteDesktopSession"); }
  144. virtual HRESULT StartListening() = 0;
  145. };
  146. #endif //__REMOTEDESKTOPSESSION_H_