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.

286 lines
5.1 KiB

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