Leaked source code of windows server 2003
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.

200 lines
5.6 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. DWORD m_ExpirationTime; // ticket expiration time.
  45. //
  46. // Keep a back pointer to the RDS host object.
  47. //
  48. CRemoteDesktopServerHost *m_RDSHost;
  49. //
  50. // IDispatch Pointers for Scriptable Event Object Registrations
  51. //
  52. IDispatch *m_OnConnected;
  53. IDispatch *m_OnDisconnected;
  54. //
  55. // Accessor Method for Data Channel Manager
  56. //
  57. virtual CRemoteDesktopChannelMgr *GetChannelMgr() = 0;
  58. //
  59. // Return the session description and name, depending on the subclass.
  60. //
  61. virtual VOID GetSessionName(CComBSTR &name) = 0;
  62. virtual VOID GetSessionDescription(CComBSTR &descr) = 0;
  63. //
  64. // Shutdown method.
  65. //
  66. void Shutdown();
  67. public:
  68. //
  69. // Constructor/Destructor
  70. //
  71. CRemoteDesktopSession()
  72. {
  73. m_OnConnected = NULL;
  74. m_OnDisconnected = NULL;
  75. m_ExpirationTime = 0;
  76. }
  77. virtual ~CRemoteDesktopSession();
  78. //
  79. // Return the help session ID.
  80. //
  81. CComBSTR &GetHelpSessionID() {
  82. return m_HelpSessionID;
  83. }
  84. HRESULT FinalConstruct();
  85. DECLARE_REGISTRY_RESOURCEID(IDR_REMOTEDESKTOPSESSION)
  86. DECLARE_PROTECT_FINAL_CONSTRUCT()
  87. //
  88. // COM Interface Map
  89. //
  90. BEGIN_COM_MAP(CRemoteDesktopSession)
  91. COM_INTERFACE_ENTRY(ISAFRemoteDesktopSession)
  92. COM_INTERFACE_ENTRY2(IDispatch, ISAFRemoteDesktopSession)
  93. COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
  94. COM_INTERFACE_ENTRY(IProvideClassInfo)
  95. COM_INTERFACE_ENTRY(IProvideClassInfo2)
  96. END_COM_MAP()
  97. //
  98. // Connection Point Map
  99. //
  100. BEGIN_CONNECTION_POINT_MAP(CRemoteDesktopSession)
  101. CONNECTION_POINT_ENTRY(DIID__ISAFRemoteDesktopSessionEvents)
  102. END_CONNECTION_POINT_MAP()
  103. public:
  104. //
  105. // If subclass overrides, it should invoke the parent implementation.
  106. //
  107. // If parms are non-NULL, then the session already exists. Otherwise,
  108. // a new session should be created.
  109. //
  110. virtual HRESULT Initialize(
  111. BSTR connectParms,
  112. CRemoteDesktopServerHost *hostObject,
  113. REMOTE_DESKTOP_SHARING_CLASS sharingClass,
  114. BOOL enableCallback,
  115. DWORD timeOut,
  116. BSTR userHelpCreateBlob,
  117. LONG tsSessionID,
  118. BSTR userSID
  119. );
  120. //
  121. // Called when a connection to the client has been established/
  122. // terminated
  123. //
  124. virtual VOID ClientConnected();
  125. virtual VOID ClientDisconnected();
  126. //
  127. // Instruct object to use hostname or ipaddress when constructing
  128. // connect parameters
  129. //
  130. virtual HRESULT UseHostName( BSTR hostname ) { return S_OK; }
  131. //
  132. // ISAFRemoteDesktopSession Methods
  133. //
  134. STDMETHOD(get_ConnectParms)(BSTR *parms) = 0;
  135. STDMETHOD(get_ChannelManager)(ISAFRemoteDesktopChannelMgr **mgr) = 0;
  136. STDMETHOD(Disconnect)() = 0;
  137. STDMETHOD(put_SharingClass)(REMOTE_DESKTOP_SHARING_CLASS sharingClass);
  138. STDMETHOD(get_SharingClass)(REMOTE_DESKTOP_SHARING_CLASS *sharingClass);
  139. STDMETHOD(CloseRemoteDesktopSession)();
  140. STDMETHOD(put_OnConnected)(/*[in]*/IDispatch *iDisp);
  141. STDMETHOD(put_OnDisconnected)(/*[in]*/IDispatch *iDisp);
  142. STDMETHOD(get_HelpSessionId)(/*[out, retval]*/ BSTR* HelpSessionId);
  143. STDMETHOD(get_UserBlob)(/*[out, retval]*/ BSTR* UserBlob );
  144. STDMETHOD(put_UserBlob)(/*[in]*/ BSTR UserBlob);
  145. STDMETHOD(get_ExpireTime)(/*[out, retval]*/ DWORD* pExpireTime);
  146. //
  147. // Return this class name.
  148. //
  149. virtual const LPTSTR ClassName() { return _T("CRemoteDesktopSession"); }
  150. virtual HRESULT StartListening() = 0;
  151. virtual BOOL CheckAccessRight(BSTR userSid);
  152. };
  153. #endif //__REMOTEDESKTOPSESSION_H_