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.

289 lines
5.5 KiB

  1. /*++
  2. Copyright (c) 1994-1999 Microsoft Corporation
  3. Module Name :
  4. usersess.h
  5. Abstract:
  6. FTP User Sessions Dialog
  7. Author:
  8. Ronald Meijer (ronaldm)
  9. Project:
  10. Internet Services Manager
  11. Revision History:
  12. --*/
  13. #ifndef __USERSESS_H__
  14. #define __USERSESS_H__
  15. class CFtpUserInfo : public CObjectPlus
  16. /*++
  17. Class Description:
  18. Connected FTP User object
  19. Public Interface:
  20. CFtpUserInfo : Constructor
  21. QueryUserID : Get the user's ID code
  22. QueryAnonymous : Return TRUE if the user logged on anonymously
  23. QueryHostAddress : Get the user's IP Address
  24. QueryConnectTime : Get the user's connect time
  25. QueryUserName : Get the user's name
  26. OrderByName : Sort helper
  27. OrderByTime : Sort helper
  28. OrderByMachine : Sort helper
  29. --*/
  30. {
  31. //
  32. // Construction
  33. //
  34. public:
  35. CFtpUserInfo(
  36. IN LPIIS_USER_INFO_1 lpUserInfo
  37. );
  38. //
  39. // Access Functions
  40. //
  41. public:
  42. DWORD QueryUserID() const { return m_idUser; }
  43. BOOL QueryAnonymous() const { return m_fAnonymous; }
  44. CIPAddress QueryHostAddress() const { return m_iaHost; }
  45. DWORD QueryConnectTime() const { return m_tConnect; }
  46. LPCTSTR QueryUserName() const { return m_strUser; }
  47. //
  48. // Sorting Helper Functions
  49. //
  50. public:
  51. int OrderByName(
  52. IN const CObjectPlus * pobFtpUser
  53. ) const;
  54. int OrderByTime(
  55. IN const CObjectPlus * pobFtpUser
  56. ) const;
  57. int OrderByHostAddress(
  58. IN const CObjectPlus * pobFtpUser
  59. ) const;
  60. //
  61. // Private Data
  62. //
  63. private:
  64. BOOL m_fAnonymous;
  65. DWORD m_idUser;
  66. DWORD m_tConnect;
  67. CString m_strUser;
  68. CIPAddress m_iaHost;
  69. };
  70. class CFtpUsersListBox : public CHeaderListBox
  71. {
  72. /*++
  73. Class Description:
  74. Listbox of CFtpUserInfo objects
  75. Public Interface:
  76. CFtpUsersListBox : Constructor
  77. GetItem : Get FtpUserInfo object
  78. AddItem : Add FtpUserInfo object
  79. Initialize : Initialize the listbox
  80. --*/
  81. DECLARE_DYNAMIC(CFtpUsersListBox);
  82. public:
  83. //
  84. // Number of bitmaps
  85. //
  86. static const nBitmaps;
  87. //
  88. // Constructor/Destructor
  89. //
  90. public:
  91. CFtpUsersListBox();
  92. //
  93. // Access
  94. //
  95. public:
  96. CFtpUserInfo * GetItem(
  97. IN UINT nIndex
  98. );
  99. int AddItem(
  100. IN const CFtpUserInfo * pItem
  101. );
  102. virtual BOOL Initialize();
  103. protected:
  104. virtual void DrawItemEx(
  105. IN CRMCListBoxDrawStruct & ds
  106. );
  107. protected:
  108. CString m_strTimeSep;
  109. };
  110. class CUserSessionsDlg : public CDialog
  111. {
  112. /*++
  113. Class Description:
  114. FTP User sessions dialog
  115. Public Interface:
  116. CUserSessionsDlg : Constructor
  117. --*/
  118. //
  119. // Construction
  120. //
  121. public:
  122. //
  123. // Standard Constructor
  124. //
  125. CUserSessionsDlg(
  126. LPCTSTR lpServerName,
  127. DWORD dwInstance,
  128. LPCTSTR pAdminName,
  129. LPCTSTR pAdminPassword,
  130. CWnd * pParent = NULL,
  131. BOOL fLocal = TRUE
  132. );
  133. ~CUserSessionsDlg();
  134. //
  135. // Dialog Data
  136. //
  137. protected:
  138. //{{AFX_DATA(CUserSessionsDlg)
  139. enum { IDD = IDD_USER_SESSIONS };
  140. CStatic m_static_Total;
  141. CButton m_button_DisconnectAll;
  142. CButton m_button_Disconnect;
  143. //}}AFX_DATA
  144. CFtpUsersListBox m_list_Users;
  145. //
  146. // Overrides
  147. //
  148. protected:
  149. //{{AFX_VIRTUAL(CUserSessionsDlg)
  150. protected:
  151. virtual void DoDataExchange(CDataExchange * pDX);
  152. //}}AFX_VIRTUAL
  153. //
  154. // Implementation
  155. //
  156. protected:
  157. //{{AFX_MSG(CUserSessionsDlg)
  158. afx_msg void OnButtonDisconnect();
  159. afx_msg void OnButtonDisconnectAll();
  160. afx_msg void OnButtonRefresh();
  161. afx_msg void OnSelchangeListUsers();
  162. afx_msg void OnDestroy();
  163. virtual BOOL OnInitDialog();
  164. //}}AFX_MSG
  165. afx_msg void OnHeaderItemClick(UINT nID, NMHDR *pNMHDR, LRESULT *lResult);
  166. DECLARE_MESSAGE_MAP()
  167. int QuerySortColumn() const { return m_nSortColumn; }
  168. DWORD SortUsersList();
  169. HRESULT RefreshUsersList();
  170. HRESULT DisconnectUser(CFtpUserInfo * pUserInfo);
  171. HRESULT BuildUserList();
  172. CFtpUserInfo * GetSelectedListItem(int * pnSel = NULL);
  173. CFtpUserInfo * GetNextSelectedItem(int * pnStartingIndex);
  174. void FillListBox(CFtpUserInfo * pSelection = NULL);
  175. void SetControlStates();
  176. void UpdateTotalCount();
  177. HRESULT ConnectToComputer();
  178. private:
  179. int m_nSortColumn;
  180. DWORD m_dwInstance;
  181. CString m_strServerName;
  182. CString m_strAdminName;
  183. CString m_strAdminPassword;
  184. HANDLE m_hImpToken, m_hLogToken;
  185. CString m_strTotalConnected;
  186. CObListPlus m_oblFtpUsers;
  187. CRMCListBoxResources m_ListBoxRes;
  188. BOOL m_fLocal;
  189. BOOL m_NetUseSessionCreated;
  190. };
  191. //
  192. // Inline Expansion
  193. //
  194. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  195. inline CFtpUserInfo * CFtpUsersListBox::GetItem(
  196. IN UINT nIndex
  197. )
  198. {
  199. return (CFtpUserInfo *)GetItemDataPtr(nIndex);
  200. }
  201. inline int CFtpUsersListBox::AddItem(
  202. IN const CFtpUserInfo * pItem
  203. )
  204. {
  205. return AddString((LPCTSTR)pItem);
  206. }
  207. inline CFtpUserInfo * CUserSessionsDlg::GetSelectedListItem(
  208. OUT int * pnSel
  209. )
  210. {
  211. return (CFtpUserInfo *)m_list_Users.GetSelectedListItem(pnSel);
  212. }
  213. inline CFtpUserInfo * CUserSessionsDlg::GetNextSelectedItem(
  214. IN OUT int * pnStartingIndex
  215. )
  216. {
  217. return (CFtpUserInfo *)m_list_Users.GetNextSelectedItem(pnStartingIndex);
  218. }
  219. #endif // __USERSESS_H__