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.

359 lines
12 KiB

  1. //
  2. // tscsetting.h
  3. //
  4. // Terminal Services Client settings collection
  5. //
  6. // Copyright(C) Microsoft Corporation 2000
  7. // Author: Nadim Abdo (nadima)
  8. //
  9. #ifndef _TSCSETTING_H_
  10. #define _TSCSETTING_H_
  11. #include "tscdefines.h"
  12. #include "setstore.h"
  13. #include "autreg.h"
  14. #include "constr.h"
  15. typedef struct tag_PERFOPTIONS_PERSISTINFO
  16. {
  17. LPCTSTR szValName;
  18. BOOL fDefaultVal;
  19. UINT fFlagVal;
  20. BOOL fForceSave; //true if should always be saved
  21. } PERFOPTIONS_PERSISTINFO, *PPERFOPTIONS_PERSISTINFO;
  22. class CTscSettings
  23. {
  24. public:
  25. //
  26. // Public members
  27. //
  28. CTscSettings();
  29. ~CTscSettings();
  30. VOID InitializeToDefaults();
  31. BOOL ValidateSettings();
  32. HRESULT LoadFromStore(ISettingsStore* pStore);
  33. HRESULT SaveToStore(ISettingsStore* pStore);
  34. HRESULT ApplyToControl(IMsRdpClient* pTsc);
  35. HRESULT GetUpdatesFromControl(IMsRdpClient* pTsc);
  36. BOOL SaveRegSettings();
  37. BOOL UpdateRegMRU(LPTSTR szNewServer);
  38. VOID SetFileName(LPTSTR szFile);
  39. LPTSTR GetFileName() {return _szFileName;}
  40. //
  41. // Accessors for the settings
  42. //
  43. LPCTSTR GetFirstMRUServer() {return _szMRUServer[0];}
  44. LPCTSTR GetMRUServer(INT idx) {return _szMRUServer[idx];}
  45. VOID SetAutoConnect(BOOL bAutoConnect) {_fAutoConnectEnabled = bAutoConnect;}
  46. BOOL GetAutoConnect() {return _fAutoConnectEnabled;}
  47. //
  48. // Connection string accessors
  49. //
  50. VOID
  51. SetConnectString(CRdpConnectionString& conStr)
  52. {
  53. _ConnectString = conStr;
  54. }
  55. VOID
  56. SetConnectString(LPTSTR szConnectString)
  57. {
  58. _ConnectString.SetFullConnectionString(szConnectString);
  59. }
  60. CRdpConnectionString&
  61. GetConnectString() {return _ConnectString;}
  62. LPTSTR
  63. GetFlatConnectString()
  64. {
  65. return _ConnectString.GetFullConnectionString();
  66. }
  67. //Can't use GetUserName as that conflicts with the
  68. //the uniwrap macro which will try to redefine the name
  69. //to a wrapper call.
  70. VOID SetLogonUserName(LPCTSTR szUserName);
  71. LPCTSTR GetLogonUserName() {return _szUserName;}
  72. VOID SetDomain(LPCTSTR szDomain);
  73. LPCTSTR GetDomain() {return _szDomain;}
  74. VOID SetEnableStartProgram(BOOL b) {_fEnableStartProgram = b;}
  75. BOOL GetEnableStartProgram() {return _fEnableStartProgram;}
  76. VOID SetStartProgram(LPCTSTR szStartProg);
  77. LPTSTR GetStartProgram() {return _szAlternateShell;}
  78. VOID SetWorkDir(LPCTSTR szWorkDir);
  79. LPTSTR GetWorkDir() {return _szWorkingDir;}
  80. VOID StoreWindowPlacement(WINDOWPLACEMENT wp) {_windowPlacement = wp;}
  81. WINDOWPLACEMENT* GetWindowPlacement() {return &_windowPlacement;}
  82. VOID SetDesktopSizeID(UINT _desktopSizeID);
  83. UINT GetDesktopSizeID() {return _desktopSizeID;}
  84. VOID SetDesktopWidth(UINT wd) {_desktopWidth = wd;}
  85. UINT GetDesktopWidth() {return _desktopWidth;}
  86. VOID SetDesktopHeight(UINT ht) {_desktopHeight = ht;}
  87. UINT GetDesktopHeight() {return _desktopHeight;}
  88. VOID SetStartFullScreen(BOOL b) {_fStartFullScreen = b;}
  89. BOOL GetStartFullScreen() {return _fStartFullScreen;}
  90. VOID SetCompress(BOOL b) {_fCompress = b;}
  91. BOOL GetCompress() {return _fCompress;}
  92. BOOL GetAutoLogon() {return _fAutoLogon;}
  93. VOID SetAutoLogon(BOOL b) {_fAutoLogon = b;}
  94. BOOL GetUIPasswordEdited() {return _fUIPasswordEdited;}
  95. VOID SetUIPasswordEdited(BOOL b) {_fUIPasswordEdited = b;}
  96. HRESULT SetClearTextPass(LPCTSTR szClearPass);
  97. HRESULT GetClearTextPass(LPTSTR szBuffer, INT cbLen);
  98. VOID SetSavePassword(BOOL b) {_fSavePassword = b;}
  99. BOOL GetSavePassword() {return _fSavePassword;}
  100. BOOL GetPasswordProvided();
  101. INT GetColorDepth() {return _colorDepthBpp;}
  102. VOID SetColorDepth(INT bpp) {_colorDepthBpp = bpp;}
  103. INT GetKeyboardHookMode();
  104. VOID SetKeyboardHookMode(INT hookmode);
  105. INT GetSoundRedirectionMode();
  106. VOID SetSoundRedirectionMode(INT soundMode);
  107. BOOL GetSmoothScrolling() {return _smoothScrolling;}
  108. VOID SetSmoothScrolling(BOOL b) {_smoothScrolling = b;}
  109. #ifdef SMART_SIZING
  110. BOOL GetSmartSizing() {return _smartSizing;}
  111. VOID SetSmartSizing(BOOL b) {_smartSizing = b;}
  112. #endif // SMART_SIZING
  113. BOOL GetAcceleratorPassthrough() {return _acceleratorPassthrough;}
  114. VOID SetAcceleratorPassthrough(BOOL b) {_acceleratorPassthrough = b;}
  115. BOOL GetShadowBitmapEnabled() {return _shadowBitmapEnabled;}
  116. VOID SetShadowBitmapEnabled(BOOL b) {_shadowBitmapEnabled=b;}
  117. UINT GetTransportType() {return _transportType;}
  118. VOID SetTransportType(UINT tt) {_transportType=tt;}
  119. UINT GetSasSequence() {return _sasSequence;}
  120. VOID SetSasSequence(UINT ss) {_sasSequence=ss;}
  121. BOOL GetEncryptionEnabled() {return _encryptionEnabled;}
  122. VOID SetEncryptionEnabled(BOOL b) {_encryptionEnabled=b;}
  123. BOOL GetDedicatedTerminal() {return _dedicatedTerminal;}
  124. VOID SetDedicatedTerminal(BOOL b) {_dedicatedTerminal=b;}
  125. UINT GetMCSPort() {return _MCSPort;}
  126. VOID SetMCSPort(UINT mcsport) {_MCSPort=mcsport;}
  127. BOOL GetEnableMouse() {return _fEnableMouse;}
  128. VOID SetEnableMouse(BOOL b) {_fEnableMouse=b;}
  129. BOOL GetBitmapPersitenceFromPerfFlags()
  130. {
  131. BOOL fBitmapPersistence =
  132. (_dwPerfFlags & TS_PERF_DISABLE_BITMAPCACHING) ? FALSE : TRUE;
  133. return fBitmapPersistence;
  134. }
  135. BOOL GetDisableCtrlAltDel() {return _fDisableCtrlAltDel;}
  136. VOID SetDisableCtrlAltDel(BOOL b) {_fDisableCtrlAltDel=b;}
  137. BOOL GetEnableWindowsKey() {return _fEnableWindowsKey;}
  138. VOID SetEnableWindowsKey(BOOL b) {_fEnableWindowsKey=b;}
  139. BOOL GetDoubleClickDetect() {return _fDoubleClickDetect;}
  140. VOID SetDoubleClickDetect(BOOL b) {_fDoubleClickDetect=b;}
  141. BOOL GetMaximizeShell() {return _fMaximizeShell;}
  142. VOID SetMaximizeShell(BOOL b) {_fMaximizeShell = b;}
  143. BOOL GetDriveRedirection() {return _fDriveRedirectionEnabled;}
  144. VOID SetDriveRedirection(BOOL b) {_fDriveRedirectionEnabled = b;}
  145. BOOL GetPrinterRedirection() {return _fPrinterRedirectionEnabled;}
  146. VOID SetPrinterRedirection(BOOL b) {_fPrinterRedirectionEnabled = b;}
  147. BOOL GetCOMPortRedirection() {return _fPortRedirectionEnabled;}
  148. VOID SetCOMPortRedirection(BOOL b) {_fPortRedirectionEnabled = b;}
  149. BOOL GetSCardRedirection() {return _fSCardRedirectionEnabled;}
  150. VOID SetSCardRedirection(BOOL b) {_fSCardRedirectionEnabled = b;}
  151. BOOL GetConnectToConsole() {return _fConnectToConsole;}
  152. VOID SetConnectToConsole(BOOL b) {_fConnectToConsole=b;}
  153. BOOL GetDisplayBBar() {return _fDisplayBBar;}
  154. VOID SetDisplayBBar(BOOL b) {_fDisplayBBar = b;}
  155. BOOL GetPinBBar() {return _fPinBBar;}
  156. VOID SetPinBBar(BOOL b) {_fPinBBar = b;}
  157. #ifdef PROXY_SERVER
  158. VOID SetProxyServer(LPCTSTR szProxyServer);
  159. LPCTSTR GetProxyServer() {return _szProxyServer;}
  160. #endif //PROXY_SERVER
  161. DWORD GetPerfFlags() {return _dwPerfFlags;}
  162. VOID SetPerfFlags(DWORD dw) {_dwPerfFlags = dw;}
  163. BOOL GetEnableArc() {return _fEnableAutoReconnect;}
  164. VOID SetEnableArc(BOOL b) {_fEnableAutoReconnect = b;}
  165. private:
  166. BOOL GetPluginDllList();
  167. BOOL ReadPassword(ISettingsStore* pSto);
  168. BOOL ReadPerfOptions(ISettingsStore* pStore);
  169. BOOL WritePerfOptions(ISettingsStore* pStore);
  170. HRESULT
  171. ApplyConnectionArgumentSettings(
  172. IN LPCTSTR szConArg,
  173. IN IMsRdpClientAdvancedSettings2* pAdvSettings
  174. );
  175. //
  176. // keep track of last filename this
  177. // was opened/saved from.
  178. //
  179. TCHAR _szFileName[MAX_PATH];
  180. //
  181. // Settings data members
  182. //
  183. BOOL _fCompress;
  184. BOOL _fAutoLogon;
  185. BOOL _fAutoConnectEnabled;
  186. BOOL _fStartFullScreen;
  187. BOOL _fbrowseDNSDomain;
  188. TCHAR _browseDNSDomainName[TSC_MAX_DOMAIN_LENGTH];
  189. WINDOWPLACEMENT _windowPlacement;
  190. CRdpConnectionString _ConnectString;
  191. TCHAR _szUserName[TSC_MAX_USERNAME_LENGTH];
  192. TCHAR _szDomain[TSC_MAX_DOMAIN_LENGTH];
  193. BOOL _fEnableStartProgram;
  194. TCHAR _szAlternateShell[TSC_MAX_ALTERNATESHELL_LENGTH];
  195. TCHAR _szWorkingDir[TSC_MAX_WORKINGDIR_LENGTH];
  196. BYTE _Password[TSC_MAX_PASSWORD_LENGTH_BYTES];
  197. BOOL _fSavePassword;
  198. BOOL _fPasswordProvided;
  199. BYTE _Salt[TSC_SALT_LENGTH];
  200. UINT _desktopSizeID;
  201. UINT _desktopWidth;
  202. UINT _desktopHeight;
  203. TCHAR _szMRUServer[TSC_NUM_SERVER_MRU][TSC_MAX_ADDRESS_LENGTH];
  204. TCHAR _szCLXCmdLine[MAX_PATH];
  205. //
  206. // User provided a password in the UI
  207. //
  208. BOOL _fUIPasswordEdited;
  209. DATA_BLOB _blobEncryptedPassword;
  210. TCHAR _szClearPass[TSC_MAX_PASSLENGTH_TCHARS];
  211. DCTCHAR _szIconFile[MAX_PATH];
  212. UINT _iconIndex;
  213. INT _colorDepthBpp;
  214. UINT _keyboardHookMode;
  215. INT _soundRedirectionMode;
  216. BOOL _smoothScrolling;
  217. #ifdef SMART_SIZING
  218. BOOL _smartSizing;
  219. #endif // SMART_SIZING
  220. BOOL _acceleratorPassthrough;
  221. BOOL _shadowBitmapEnabled;
  222. UINT _transportType;
  223. UINT _sasSequence;
  224. BOOL _encryptionEnabled;
  225. BOOL _dedicatedTerminal;
  226. UINT _MCSPort;
  227. BOOL _fEnableMouse;
  228. BOOL _fDisableCtrlAltDel;
  229. BOOL _fEnableWindowsKey;
  230. BOOL _fDoubleClickDetect;
  231. BOOL _fMaximizeShell;
  232. UINT _RegBitmapCacheSize;
  233. UINT _drawThreshold;
  234. UINT _BitmapVirtualCache8BppSize;
  235. UINT _BitmapVirtualCache16BppSize;
  236. UINT _BitmapVirtualCache24BppSize;
  237. UINT _RegScaleBitmapCachesByBPP;
  238. UINT _RegNumBitmapCaches;
  239. UINT _RegBCProportion[TS_BITMAPCACHE_MAX_CELL_CACHES];
  240. UINT _RegBCMaxEntries[TS_BITMAPCACHE_MAX_CELL_CACHES];
  241. UINT _bSendBitmapKeys[TS_BITMAPCACHE_MAX_CELL_CACHES];
  242. UINT _GlyphSupportLevel;
  243. UINT _GlyphCacheSize[10];
  244. UINT _fragCellSize;
  245. UINT _brushSupportLevel;
  246. UINT _maxInputEventCount;
  247. UINT _eventsAtOnce;
  248. UINT _minSendInterval;
  249. UINT _keepAliveIntervalMS;
  250. TCHAR _szKeybLayoutStr[UTREG_UI_KEYBOARD_LAYOUT_LEN];
  251. UINT _shutdownTimeout;
  252. UINT _connectionTimeout;
  253. UINT _singleConTimeout;
  254. #ifdef OS_WINCE
  255. //
  256. // WinCE only keyboard settings
  257. //
  258. UINT _keyboardType;
  259. UINT _keyboardSubType;
  260. UINT _keyboardFunctionKey;
  261. #endif
  262. #ifdef DC_DEBUG
  263. BOOL _hatchBitmapPDUData;
  264. BOOL _hatchSSBOrderData;
  265. BOOL _hatchIndexPDUData;
  266. BOOL _hatchMemBltOrderData;
  267. BOOL _labelMemBltOrders;
  268. BOOL _bitmapCacheMonitor;
  269. #endif
  270. BOOL _fDriveRedirectionEnabled;
  271. BOOL _fPrinterRedirectionEnabled;
  272. BOOL _fPortRedirectionEnabled;
  273. BOOL _fSCardRedirectionEnabled;
  274. TCHAR _szPluginList[MAX_PATH*10];
  275. BOOL _fConnectToConsole;
  276. BOOL _fDisplayBBar;
  277. BOOL _fPinBBar;
  278. #ifdef PROXY_SERVER
  279. TCHAR _szProxyServer[TSC_MAX_ADDRESS_LENGTH];
  280. #endif //PROXY_SERVER
  281. DWORD _dwPerfFlags;
  282. BOOL _fEnableAutoReconnect;
  283. UINT _nArcMaxRetries;
  284. };
  285. #endif //_TSCSETTING_H_