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.

284 lines
5.1 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. );
  132. //
  133. // Dialog Data
  134. //
  135. protected:
  136. //{{AFX_DATA(CUserSessionsDlg)
  137. enum { IDD = IDD_USER_SESSIONS };
  138. CStatic m_static_Total;
  139. CButton m_button_DisconnectAll;
  140. CButton m_button_Disconnect;
  141. //}}AFX_DATA
  142. CFtpUsersListBox m_list_Users;
  143. //
  144. // Overrides
  145. //
  146. protected:
  147. //{{AFX_VIRTUAL(CUserSessionsDlg)
  148. protected:
  149. virtual void DoDataExchange(CDataExchange * pDX);
  150. //}}AFX_VIRTUAL
  151. //
  152. // Implementation
  153. //
  154. protected:
  155. //{{AFX_MSG(CUserSessionsDlg)
  156. afx_msg void OnButtonDisconnect();
  157. afx_msg void OnButtonDisconnectAll();
  158. afx_msg void OnButtonRefresh();
  159. afx_msg void OnSelchangeListUsers();
  160. afx_msg void OnDestroy();
  161. virtual BOOL OnInitDialog();
  162. //}}AFX_MSG
  163. afx_msg void OnHeaderItemClick(UINT nID, NMHDR *pNMHDR, LRESULT *lResult);
  164. DECLARE_MESSAGE_MAP()
  165. int QuerySortColumn() const { return m_nSortColumn; }
  166. DWORD SortUsersList();
  167. HRESULT RefreshUsersList();
  168. HRESULT DisconnectUser(CFtpUserInfo * pUserInfo);
  169. HRESULT BuildUserList();
  170. CFtpUserInfo * GetSelectedListItem(int * pnSel = NULL);
  171. CFtpUserInfo * GetNextSelectedItem(int * pnStartingIndex);
  172. void FillListBox(CFtpUserInfo * pSelection = NULL);
  173. void SetControlStates();
  174. void UpdateTotalCount();
  175. private:
  176. int m_nSortColumn;
  177. DWORD m_dwInstance;
  178. CString m_strServerName;
  179. CString m_strAdminName;
  180. CString m_strAdminPassword;
  181. HANDLE m_hImpToken, m_hLogToken;
  182. CString m_strTotalConnected;
  183. CObListPlus m_oblFtpUsers;
  184. CRMCListBoxResources m_ListBoxRes;
  185. };
  186. //
  187. // Inline Expansion
  188. //
  189. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  190. inline CFtpUserInfo * CFtpUsersListBox::GetItem(
  191. IN UINT nIndex
  192. )
  193. {
  194. return (CFtpUserInfo *)GetItemDataPtr(nIndex);
  195. }
  196. inline int CFtpUsersListBox::AddItem(
  197. IN const CFtpUserInfo * pItem
  198. )
  199. {
  200. return AddString((LPCTSTR)pItem);
  201. }
  202. inline CFtpUserInfo * CUserSessionsDlg::GetSelectedListItem(
  203. OUT int * pnSel
  204. )
  205. {
  206. return (CFtpUserInfo *)m_list_Users.GetSelectedListItem(pnSel);
  207. }
  208. inline CFtpUserInfo * CUserSessionsDlg::GetNextSelectedItem(
  209. IN OUT int * pnStartingIndex
  210. )
  211. {
  212. return (CFtpUserInfo *)m_list_Users.GetNextSelectedItem(pnStartingIndex);
  213. }
  214. #endif // __USERSESS_H__