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.

180 lines
5.1 KiB

  1. //connode.h: connection node
  2. #ifndef _connode_h_
  3. #define _connode_h_
  4. #include <wincrypt.h>
  5. #include "basenode.h"
  6. //
  7. // Version number for the persistance info that is written for each connode
  8. // this is important for forward compatability.. New versions should bump
  9. // this count up and handle downward compatability cases.
  10. //
  11. #define CONNODE_PERSIST_INFO_VERSION 8
  12. // Important version numbers for backwards compatability
  13. #define CONNODE_PERSIST_INFO_VERSION_DOTNET_BETA3 7
  14. #define CONNODE_PERSIST_INFO_VERSION_WHISTLER_BETA1 6
  15. #define CONNODE_PERSIST_INFO_VERSION_TSAC_RTM 5
  16. #define CONNODE_PERSIST_INFO_VERSION_TSAC_BETA 3
  17. //
  18. // Screen resolution settings
  19. //
  20. #define SCREEN_RES_FROM_DROPDOWN 1
  21. #define SCREEN_RES_CUSTOM 2
  22. #define SCREEN_RES_FILL_MMC 3
  23. #define NUM_RESOLUTIONS 5
  24. class CConNode : public CBaseNode
  25. {
  26. public:
  27. CConNode();
  28. ~CConNode();
  29. BOOL SetServerName( LPTSTR szServerName);
  30. LPTSTR GetServerName() {return m_szServer;}
  31. BOOL SetDescription( LPTSTR szDescription);
  32. LPTSTR GetDescription() {return m_szDescription;}
  33. BOOL SetUserName( LPTSTR szUserName);
  34. LPTSTR GetUserName() {return m_szUserName;}
  35. BOOL GetPasswordSpecified() {return m_fPasswordSpecified;}
  36. VOID SetPasswordSpecified(BOOL f) {m_fPasswordSpecified = f;}
  37. //
  38. // Return the password in encrypted form
  39. //
  40. BOOL SetDomain( LPTSTR szDomain);
  41. LPTSTR GetDomain(){return m_szDomain;}
  42. VOID SetAutoLogon( BOOL bAutoLogon) {m_bAutoLogon = bAutoLogon;}
  43. BOOL IsAutoLogon() {return m_bAutoLogon;}
  44. VOID SetSavePassword(BOOL fSavePass) {m_bSavePassword = fSavePass;}
  45. BOOL GetSavePassword() {return m_bSavePassword;}
  46. BOOL IsConnected() {return m_bConnected;}
  47. void SetConnected(BOOL bCon) {m_bConnected=bCon;}
  48. //
  49. // Screen res selection type
  50. //
  51. int GetResType() {return m_resType;}
  52. void SetResType(int r) {m_resType = r;}
  53. //
  54. // Return client width/height from the screen res setting
  55. //
  56. int GetDesktopWidth() {return m_Width;}
  57. int GetDesktopHeight() {return m_Height;}
  58. void SetDesktopWidth(int i) {m_Width = i;}
  59. void SetDesktopHeight(int i) {m_Height = i;}
  60. LPTSTR GetProgramPath() {return m_szProgramPath;}
  61. void SetProgramPath(LPTSTR sz) {lstrcpy(m_szProgramPath,sz);}
  62. LPTSTR GetWorkDir() {return m_szProgramStartIn;}
  63. void SetWorkDir(LPTSTR sz) {lstrcpy(m_szProgramStartIn,sz);}
  64. void SetScopeID(HSCOPEITEM scopeID) {m_scopeID = scopeID;}
  65. HSCOPEITEM GetScopeID() {return m_scopeID;}
  66. VOID SetConnectToConsole(BOOL bConConsole) {m_bConnectToConsole = bConConsole;}
  67. BOOL GetConnectToConsole() {return m_bConnectToConsole;}
  68. VOID SetRedirectDrives(BOOL b) {m_bRedirectDrives = b;}
  69. BOOL GetRedirectDrives() {return m_bRedirectDrives;}
  70. //
  71. // Stream Persistance support
  72. //
  73. HRESULT PersistToStream( IStream* pStm);
  74. HRESULT InitFromStream( IStream* pStm);
  75. //
  76. // Connection initialized
  77. //
  78. BOOL IsConnInitialized() {return m_bConnectionInitialized;}
  79. void SetConnectionInitialized(BOOL bCon) {m_bConnectionInitialized=bCon;}
  80. IMsRdpClient* GetTsClient();
  81. void SetTsClient(IMsRdpClient* pTs);
  82. IMstscMhst* GetMultiHostCtl();
  83. void SetMultiHostCtl(IMstscMhst* pMhst);
  84. //
  85. // Return the view interface this control is hosted on
  86. //
  87. IComponent* GetView();
  88. void SetView(IComponent* pView);
  89. HRESULT SetClearTextPass(LPCTSTR szClearPass);
  90. HRESULT GetClearTextPass(LPTSTR szBuffer, INT cbLen);
  91. private:
  92. BOOL DataProtect(PBYTE pInData, DWORD cbLen, PBYTE* ppOutData, PDWORD pcbOutLen);
  93. BOOL DataUnprotect(PBYTE pInData, DWORD cbLen, PBYTE* ppOutData, PDWORD pcbOutLen);
  94. HRESULT ReadProtectedPassword(IStream* pStm);
  95. HRESULT WriteProtectedPassword(IStream* pStm);
  96. private:
  97. TCHAR m_szServer[MAX_PATH];
  98. TCHAR m_szDescription[MAX_PATH];
  99. TCHAR m_szUserName[CL_MAX_USERNAME_LENGTH];
  100. TCHAR m_szDomain[CL_MAX_DOMAIN_LENGTH];
  101. BOOL m_bAutoLogon;
  102. BOOL m_bSavePassword;
  103. BOOL m_bConnected;
  104. BOOL m_bConnectionInitialized;
  105. TCHAR m_szProgramPath[MAX_PATH];
  106. TCHAR m_szProgramStartIn[MAX_PATH];
  107. BOOL m_bConnectToConsole;
  108. BOOL m_bRedirectDrives;
  109. //
  110. // Screen resolution settings
  111. //
  112. int m_resType;
  113. int m_Width;
  114. int m_Height;
  115. HSCOPEITEM m_scopeID;
  116. //
  117. // Interface pointer to the Multi-host container
  118. //
  119. IMstscMhst* m_pMhostCtl;
  120. //
  121. // Interface pointer to the TS client control
  122. //
  123. IMsRdpClient* m_pTsClientCtl;
  124. //
  125. // IComponent view
  126. //
  127. IComponent* m_pIComponent;
  128. //
  129. // Encrypted password
  130. //
  131. DATA_BLOB _blobEncryptedPassword;
  132. BOOL m_fPasswordSpecified;
  133. };
  134. #endif // _connode_h_