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.

348 lines
10 KiB

  1. //
  2. // configdlg.h : definition of TSConfigDlg
  3. // the class defines the User Configuration Property page for Termainl Server
  4. //
  5. #if !defined(_TSCONFIGDLG_)
  6. #define _TSCONFIGDLG_
  7. #include "resource.h"
  8. #include <winsta.h>
  9. typedef LONG APIERR; // err
  10. #define SIZE_MAX_SERVERNAME 256
  11. #define SIZE_MAX_USERNAME 256
  12. #define SIZE_SMALL_STRING_BUFFER 256
  13. #define MAX_INIT_DIR_SIZE 256
  14. #define MAX_INIT_PROGRAM_SIZE 256
  15. #define MAX_PHONENO_SIZE 256
  16. class TSConfigDlg
  17. {
  18. public:
  19. enum { IDD = IDD_TS_USER_CONFIG_EDIT };
  20. static BOOL CALLBACK PropertyPageDlgProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
  21. static UINT CALLBACK PropSheetPageProc( HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp );
  22. static BOOL m_sbWindowLogSet;
  23. private:
  24. // dialog data.
  25. struct TDialogData
  26. {
  27. BOOL _fDirty;
  28. TCHAR _nlsUserName[MAX_PATH];
  29. TCHAR _nlsServerName[MAX_PATH];
  30. BOOL _fAllowLogon;
  31. ULONG _ulConnection;
  32. ULONG _ulDisconnection;
  33. ULONG _ulIdle;
  34. TCHAR _nlsInitialProgram[MAX_INIT_PROGRAM_SIZE+1];
  35. TCHAR _nlsWorkingDirectory[MAX_INIT_DIR_SIZE+1];
  36. BOOL _fClientSpecified;
  37. BOOL _fAutoClientDrives;
  38. BOOL _fAutoClientLpts;
  39. BOOL _fForceClientLptDef;
  40. INT _iEncryption;
  41. BOOL _fDisableEncryption;
  42. BOOL _fHomeDirectoryMapRoot;
  43. INT _iBroken;
  44. INT _iReconnect;
  45. INT _iCallback;
  46. TCHAR _nlsPhoneNumber[MAX_PHONENO_SIZE];
  47. INT _iShadow;
  48. TCHAR _nlsNWLogonServer[MAX_PATH];
  49. TCHAR _nlsWFProfilePath[MAX_PATH];
  50. TCHAR _nlsWFHomeDir[MAX_PATH];
  51. TCHAR _nlsWFHomeDirDrive[MAX_PATH];
  52. BOOL _fWFHomeDirDirty;
  53. } tDialogData;
  54. public:
  55. TSConfigDlg (LPWSTR wMachineName, LPWSTR wUserName);
  56. virtual ~TSConfigDlg ();
  57. BOOL AssertClass() const;
  58. BOOL OnCommand (WPARAM wParam, LPARAM lParam);
  59. BOOL OnNotify (WPARAM wParam, LPARAM lParam);
  60. BOOL OnInitDialog (HWND hwndDlg, WPARAM wParam, LPARAM lParam);
  61. APIERR GetUserInfo ();
  62. APIERR SetUserInfo ();
  63. void UCStructToMembers( PUSERCONFIG pUCStruct );
  64. void MembersToUCStruct( PUSERCONFIG pUCStruct ) const;
  65. BOOL MembersToControls ();
  66. BOOL ControlsToMembers (TDialogData *);
  67. BOOL InitControls ();
  68. BOOL VerifyChanges ();
  69. BOOL ApplyChanges ();
  70. public:
  71. // control helpers.
  72. inline BOOL IsChecked (UINT controlId);
  73. inline void SetCheck (UINT controlId, BOOL bCheck);
  74. inline void EnableControl(UINT controlId, BOOL bEnable);
  75. inline int GetComboCurrentSel(UINT controlId);
  76. inline void SetComboCurrentSel(UINT controlId, int iSel);
  77. public : // access class members
  78. inline PROPSHEETPAGE *GetPSP ()
  79. {return &m_tPropSheetPage;}
  80. inline HWND GetDlgHandle () const
  81. {return m_hDlg;}
  82. inline LPTSTR GetServername ()
  83. {return m_Username;}
  84. inline LPTSTR GetUsername ()
  85. {return m_Servername;}
  86. private:
  87. UINT m_id;
  88. PROPSHEETPAGE m_tPropSheetPage;
  89. HWND m_hDlg;
  90. TCHAR m_Username[SIZE_MAX_USERNAME];
  91. TCHAR m_Servername[SIZE_MAX_SERVERNAME];
  92. public:
  93. // get/set data to/from dialog box controls.
  94. BOOL GetAllowLogon (BOOL *pbAllowLogon);
  95. BOOL SetAllowLogon (BOOL bAllowLogon);
  96. BOOL GetConnectionTimeOut(ULONG *pValue);
  97. BOOL SetConnectionTimeOut(ULONG iValue);
  98. BOOL GetDisConnectionTimeOut(ULONG *pValue);
  99. BOOL SetDisConnectionTimeOut(ULONG iValue);
  100. BOOL GetIdleTimeOut(ULONG *pValue);
  101. BOOL SetIdleTimeOut(ULONG iValue);
  102. BOOL SetCommandLineAndWorkingDirectory(BOOL bUseInherited, LPCTSTR dir, LPCTSTR cmd);
  103. BOOL GetCommandLineAndWorkingDirectory(BOOL *pbUseInherited, LPTSTR dir, LPTSTR cmd);
  104. BOOL SetSecurity(int iLevel, BOOL bDisableAfterLogon);
  105. BOOL GetSecurity(int *piLevel, BOOL *pbDisableAfterLogon);
  106. BOOL SetBrokenConnectionOption(int iLevel);
  107. BOOL GetBrokenConnectionOption(int *piLevel);
  108. BOOL SetReconnectDisconnection(int iLevel);
  109. BOOL GetReconnectDisconnection(int *piLevel);
  110. BOOL SetCallBackOptonAndPhoneNumber(int iCallBack, LPCTSTR PhoneNo);
  111. BOOL GetCallBackOptonAndPhoneNumber(int *piCallBack, LPTSTR PhoneNo);
  112. BOOL SetShadowing(int iLevel);
  113. BOOL GetShadowing(int *piLevel);
  114. public:
  115. BOOL ALLOWLOGONEvent (WORD wNotifyCode);
  116. BOOL CONNECTION_NONEEvent (WORD wNotifyCode);
  117. BOOL IDLE_NONEEvent (WORD wNotifyCode);
  118. BOOL DISCONNECTION_NONEEvent (WORD wNotifyCode);
  119. BOOL INITIALPROGRAM_INHERITEvent (WORD wNotifyCode);
  120. BOOL SECURITY_DISABLEAFTERLOGONEvent (WORD wNotifyCode);
  121. /*
  122. inline void SetUserName( const TCHAR * pszUserName )
  123. {
  124. ASSERT(pszUserName);
  125. ASSERT(_tcslen(pszUserName) < MAX_PATH);
  126. _tcscpy(_nlsUserName, pszUserName);
  127. }
  128. inline VOID SetDirty()
  129. { _fDirty = TRUE; }
  130. // member data functions
  131. inline BOOL QueryAllowLogon() const
  132. { return _fAllowLogon; }
  133. inline VOID SetAllowLogon( BOOL fAllowLogon )
  134. { _fAllowLogon = fAllowLogon; }
  135. inline ULONG QueryConnection() const
  136. { return _ulConnection; }
  137. inline VOID SetConnection( ULONG ulConnection )
  138. { _ulConnection = ulConnection; }
  139. inline ULONG QueryDisconnection() const
  140. { return _ulDisconnection; }
  141. inline VOID SetDisconnection( ULONG ulDisconnection )
  142. { _ulDisconnection = ulDisconnection; }
  143. inline ULONG QueryIdle() const
  144. { return _ulIdle; }
  145. inline VOID SetIdle( ULONG ulIdle )
  146. { _ulIdle = ulIdle; }
  147. inline const TCHAR * QueryInitialProgram() const
  148. { return (LPCTSTR)_nlsInitialProgram;}
  149. inline void SetInitialProgram( const TCHAR * pszInitialProgram )
  150. {
  151. ASSERT(pszInitialProgram);
  152. ASSERT(_tcslen(pszInitialProgram) < MAX_PATH);
  153. _tcscpy(_nlsInitialProgram, pszInitialProgram);
  154. }
  155. inline const TCHAR * QueryWorkingDirectory() const
  156. { return (LPCTSTR) _nlsWorkingDirectory; }
  157. inline void SetWorkingDirectory( const TCHAR * pszWorkingDirectory )
  158. {
  159. ASSERT(pszWorkingDirectory);
  160. ASSERT(_tcslen(pszWorkingDirectory) < MAX_PATH);
  161. _tcscpy(_nlsWorkingDirectory, pszWorkingDirectory);
  162. }
  163. inline BOOL QueryClientSpecified() const
  164. { return _fClientSpecified; }
  165. inline VOID SetClientSpecified( BOOL fClientSpecified )
  166. { _fClientSpecified = fClientSpecified; }
  167. inline BOOL QueryAutoClientDrives() const
  168. { return _fAutoClientDrives; }
  169. inline VOID SetAutoClientDrives( BOOL fAutoClientDrives )
  170. { _fAutoClientDrives = fAutoClientDrives; }
  171. inline BOOL QueryAutoClientLpts() const
  172. { return _fAutoClientLpts; }
  173. inline VOID SetAutoClientLpts( BOOL fAutoClientLpts )
  174. { _fAutoClientLpts = fAutoClientLpts; }
  175. inline BOOL QueryForceClientLptDef() const
  176. { return _fForceClientLptDef; }
  177. inline VOID SetForceClientLptDef( BOOL fForceClientLptDef )
  178. { _fForceClientLptDef = fForceClientLptDef; }
  179. inline INT QueryEncryption() const
  180. { return _iEncryption; }
  181. inline VOID SetEncryption( INT iEncryption )
  182. { _iEncryption = iEncryption; }
  183. inline BOOL QueryDisableEncryption() const
  184. { return _fDisableEncryption; }
  185. inline VOID SetDisableEncryption( BOOL fDisableEncryption )
  186. { _fDisableEncryption = fDisableEncryption; }
  187. inline BOOL QueryHomeDirectoryMapRoot() const
  188. { return _fHomeDirectoryMapRoot; }
  189. inline VOID SetHomeDirectoryMapRoot( BOOL fHomeDirectoryMapRoot )
  190. { _fHomeDirectoryMapRoot = fHomeDirectoryMapRoot; }
  191. inline INT QueryBroken() const
  192. { return _iBroken; }
  193. inline VOID SetBroken( INT iBroken )
  194. { _iBroken = iBroken; }
  195. inline INT QueryReconnect() const
  196. { return _iReconnect; }
  197. inline VOID SetReconnect( INT iReconnect )
  198. { _iReconnect = iReconnect; }
  199. inline INT QueryCallback() const
  200. { return _iCallback; }
  201. inline VOID SetCallback( INT iCallback )
  202. { _iCallback = iCallback; }
  203. inline const TCHAR * QueryPhoneNumber() const
  204. { return (LPCTSTR)_nlsPhoneNumber; }
  205. inline void SetPhoneNumber( const TCHAR * pszPhoneNumber )
  206. {
  207. ASSERT(pszPhoneNumber);
  208. ASSERT(_tcslen(pszPhoneNumber) < MAX_PATH);
  209. _tcscpy(_nlsPhoneNumber, pszPhoneNumber);
  210. }
  211. inline INT QueryShadow() const
  212. { return _iShadow; }
  213. inline VOID SetShadow( INT iShadow )
  214. { _iShadow = iShadow; }
  215. inline const TCHAR * QueryNWLogonServer() const
  216. { return (LPCTSTR)_nlsNWLogonServer; }
  217. inline void SetNWLogonServer( const TCHAR * pszNWLogonServer )
  218. {
  219. ASSERT(pszNWLogonServer);
  220. ASSERT(_tcslen(pszNWLogonServer) < MAX_PATH);
  221. _tcscpy(_nlsNWLogonServer, pszNWLogonServer);
  222. }
  223. inline const TCHAR * QueryServerName() const
  224. { return (LPCTSTR)_nlsServerName; }
  225. inline const TCHAR * QueryWFProfilePath() const
  226. { return (LPCTSTR)_nlsWFProfilePath; }
  227. inline void SetWFProfilePath( const TCHAR * pszWFProfilePath )
  228. {
  229. ASSERT(pszWFProfilePath);
  230. ASSERT(_tcslen(pszWFProfilePath) < MAX_PATH);
  231. _tcscpy(_nlsWFProfilePath, pszWFProfilePath);
  232. }
  233. inline const TCHAR * QueryWFHomeDir() const
  234. { return (LPCTSTR)_nlsWFHomeDir; }
  235. inline void SetWFHomeDir( const TCHAR * pszWFHomeDir )
  236. {
  237. ASSERT(pszWFHomeDir);
  238. ASSERT(_tcslen(pszWFHomeDir) < MAX_PATH);
  239. _tcscpy(_nlsWFHomeDir, pszWFHomeDir);
  240. }
  241. inline const TCHAR * QueryWFHomeDirDrive() const
  242. { return (LPCTSTR)_nlsWFHomeDirDrive; }
  243. inline void SetWFHomeDirDrive( const TCHAR * pszWFHomeDirDrive )
  244. {
  245. ASSERT(pszWFHomeDirDrive);
  246. ASSERT(_tcslen(pszWFHomeDirDrive) < MAX_PATH);
  247. _tcscpy(_nlsWFHomeDirDrive, pszWFHomeDirDrive);
  248. }
  249. inline VOID SetWFHomeDirDirty()
  250. { _fWFHomeDirDirty = TRUE; }
  251. inline BOOL QueryWFHomeDirDirty() const
  252. { return _fWFHomeDirDirty; }
  253. */
  254. };
  255. #endif
  256. // EOF