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.

140 lines
3.5 KiB

  1. /*++
  2. Copyright (c) 1999-2000 Microsoft Corporation
  3. Module Name:
  4. RemoteDesktopServerHost
  5. Abstract:
  6. Author:
  7. Tad Brockway 02/00
  8. Revision History:
  9. --*/
  10. #ifndef __REMOTEDESKTOPSERVERHOST_H_
  11. #define __REMOTEDESKTOPSERVERHOST_H_
  12. #include <RemoteDesktopTopLevelObject.h>
  13. #include "resource.h"
  14. #include "RemoteDesktopSession.h"
  15. ///////////////////////////////////////////////////////
  16. //
  17. // CRemoteDesktopServerHost
  18. //
  19. class ATL_NO_VTABLE CRemoteDesktopServerHost :
  20. public CRemoteDesktopTopLevelObject,
  21. public CComObjectRootEx<CComSingleThreadModel>,
  22. public CComCoClass<CRemoteDesktopServerHost, &CLSID_SAFRemoteDesktopServerHost>,
  23. public IDispatchImpl<ISAFRemoteDesktopServerHost, &IID_ISAFRemoteDesktopServerHost, &LIBID_RDSSERVERHOSTLib>
  24. {
  25. private:
  26. CComPtr<IRemoteDesktopHelpSessionMgr> m_HelpSessionManager;
  27. PSID m_LocalSystemSID;
  28. //
  29. // Session Map
  30. //
  31. typedef struct SessionMapEntry
  32. {
  33. CComObject<CRemoteDesktopSession> *obj;
  34. } SESSIONMAPENTRY, *PSESSIONMAPENTRY;
  35. typedef std::map<CComBSTR, PSESSIONMAPENTRY, CompareBSTR, CRemoteDesktopAllocator<PSESSIONMAPENTRY> > SessionMap;
  36. SessionMap m_SessionMap;
  37. //
  38. // Return the Local System SID.
  39. //
  40. PSID GetLocalSystemSID() {
  41. if (m_LocalSystemSID == NULL) {
  42. DWORD result = CreateSystemSid(&m_LocalSystemSID);
  43. if (result != ERROR_SUCCESS) {
  44. SetLastError(result);
  45. m_LocalSystemSID = NULL;
  46. }
  47. }
  48. return m_LocalSystemSID;
  49. }
  50. HRESULT
  51. TranslateStringAddress(
  52. LPTSTR pszAddress,
  53. ULONG* pNetAddr
  54. );
  55. public:
  56. CRemoteDesktopServerHost() {
  57. m_LocalSystemSID = NULL;
  58. }
  59. ~CRemoteDesktopServerHost();
  60. HRESULT FinalConstruct();
  61. // There should be a single instance of this class for each server.
  62. DECLARE_CLASSFACTORY_SINGLETON(CRemoteDesktopServerHost);
  63. DECLARE_REGISTRY_RESOURCEID(IDR_REMOTEDESKTOPSERVERHOST)
  64. DECLARE_PROTECT_FINAL_CONSTRUCT()
  65. //
  66. // COM Interface Map
  67. //
  68. BEGIN_COM_MAP(CRemoteDesktopServerHost)
  69. COM_INTERFACE_ENTRY(ISAFRemoteDesktopServerHost)
  70. COM_INTERFACE_ENTRY(IDispatch)
  71. END_COM_MAP()
  72. public:
  73. //
  74. // ISAFRemoteDesktopServerHost Methods
  75. //
  76. STDMETHOD(CreateRemoteDesktopSession)(
  77. REMOTE_DESKTOP_SHARING_CLASS sharingClass,
  78. BOOL fEnableCallback,
  79. LONG timeOut,
  80. BSTR userHelpBlob,
  81. ISAFRemoteDesktopSession **session
  82. );
  83. STDMETHOD(CreateRemoteDesktopSessionEx)(
  84. REMOTE_DESKTOP_SHARING_CLASS sharingClass,
  85. BOOL bEnableCallback,
  86. LONG timeout,
  87. BSTR userHelpCreateBlob,
  88. LONG tsSessionID,
  89. BSTR userSID,
  90. ISAFRemoteDesktopSession **session
  91. );
  92. STDMETHOD(OpenRemoteDesktopSession)(
  93. BSTR parms,
  94. ISAFRemoteDesktopSession **session
  95. );
  96. STDMETHOD(CloseRemoteDesktopSession)(ISAFRemoteDesktopSession *session);
  97. STDMETHOD(ConnectToExpert)(
  98. /*[in]*/ BSTR connectParmToExpert,
  99. /*[in]*/ LONG timeout,
  100. /*[out, retval]*/ LONG* SafErrCode
  101. );
  102. //
  103. // Return the name of this class.
  104. //
  105. virtual const LPTSTR ClassName() {
  106. return TEXT("CRemoteDesktopServerHost");
  107. }
  108. };
  109. #endif //__REMOTEDESKTOPSERVERHOST_H_