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.

576 lines
10 KiB

  1. /*++
  2. Copyright (c) 1994-2001 Microsoft Corporation
  3. Module Name :
  4. supdlgs.h
  5. Abstract:
  6. Supporting dialogs definitions
  7. Author:
  8. Ronald Meijer (ronaldm)
  9. Sergei Antonov (sergeia)
  10. Project:
  11. Internet Services Manager
  12. Revision History:
  13. --*/
  14. UINT IisMessageBox(HWND hWnd, LPCTSTR szText, UINT nType, UINT nIDHelp);
  15. UINT IisMessageBox(HWND hWnd, UINT nIDText, UINT nType, UINT nIDHelp);
  16. class CUserAccountDlg : public CDialog
  17. /*++
  18. Class Description:
  19. User account dialog. Present a user account/password and allow
  20. changing, browsing and checking the password
  21. Public Interface:
  22. CUserAccountDlg : Constructor
  23. --*/
  24. {
  25. //
  26. // Construction
  27. //
  28. public:
  29. CUserAccountDlg(
  30. IN LPCTSTR lpstrServer,
  31. IN LPCTSTR lpstrUserName,
  32. IN LPCTSTR lpstrPassword,
  33. IN CWnd * pParent = NULL
  34. );
  35. //
  36. // Dialog Data
  37. //
  38. public:
  39. //{{AFX_DATA(CUserAccountDlg)
  40. enum { IDD = IDD_USER_ACCOUNT };
  41. CEdit m_edit_UserName;
  42. CEdit m_edit_Password;
  43. CString m_strUserName;
  44. //}}AFX_DATA
  45. CString m_strPassword;
  46. //
  47. // Overrides
  48. //
  49. protected:
  50. //{{AFX_VIRTUAL(CUserAccountDlg)
  51. protected:
  52. virtual void DoDataExchange(CDataExchange * pDX);
  53. //}}AFX_VIRTUAL
  54. //
  55. // Implementation
  56. //
  57. protected:
  58. //{{AFX_MSG(CUserAccountDlg)
  59. afx_msg void OnButtonBrowseUsers();
  60. afx_msg void OnButtonCheckPassword();
  61. afx_msg void OnChangeEditUsername();
  62. //}}AFX_MSG
  63. DECLARE_MESSAGE_MAP()
  64. private:
  65. CString m_strServer;
  66. };
  67. class CClearTxtDlg : public CDialog
  68. /*++
  69. Class Description:
  70. Dialog which displays the clear text warning
  71. Public Interface:
  72. CClearTxtDlg : Constructor
  73. --*/
  74. {
  75. public:
  76. //
  77. // Constructor
  78. //
  79. CClearTxtDlg(CWnd * pParent = NULL);
  80. //
  81. // Dialog Data
  82. //
  83. protected:
  84. //{{AFX_DATA(CClearTxtDlg)
  85. enum { IDD = IDD_CLEARTEXTWARNING };
  86. //}}AFX_DATA
  87. //
  88. // Overrides
  89. //
  90. protected:
  91. //{{AFX_VIRTUAL(CClearTxtDlg)
  92. protected:
  93. virtual void DoDataExchange(CDataExchange * pDX);
  94. //}}AFX_VIRTUAL
  95. //
  96. // Implementation
  97. //
  98. protected:
  99. //{{AFX_MSG(CClearTxtDlg)
  100. virtual BOOL OnInitDialog();
  101. //}}AFX_MSG
  102. DECLARE_MESSAGE_MAP()
  103. };
  104. class CIPAccessDescriptorListBox : public CHeaderListBox
  105. /*++
  106. Class Description:
  107. Listbox of CIPAccessDescriptor objects
  108. Public Interface:
  109. CIPAccessDescriptorListBox : Constructor
  110. GetItem : Get CIPAccessDescriptor item at specified position
  111. in the listbox
  112. AddItem : Add new CIPAccessDescriptor item to the listbox
  113. Initialize : Initialize the listbox
  114. --*/
  115. {
  116. DECLARE_DYNAMIC(CIPAccessDescriptorListBox);
  117. public:
  118. //
  119. // Number of bitmaps
  120. //
  121. static const nBitmaps;
  122. //
  123. // Constructor/Destructor
  124. //
  125. public:
  126. CIPAccessDescriptorListBox(
  127. IN BOOL fDomainsAllowed = FALSE
  128. );
  129. //
  130. // Interface
  131. //
  132. public:
  133. CIPAccessDescriptor * GetItem(
  134. IN UINT nIndex
  135. );
  136. int AddItem(
  137. IN const CIPAccessDescriptor * pItem
  138. );
  139. //
  140. // Return the singly selected item, or NULL
  141. // if 0, or more than one item is selected
  142. //
  143. CIPAccessDescriptor * GetSelectedItem(
  144. OUT int * pnSel = NULL
  145. );
  146. //
  147. // Return next selected listbox item (doesn't matter
  148. // if the listbox is single select or multi-select)
  149. //
  150. CIPAccessDescriptor * GetNextSelectedItem(
  151. IN OUT int * pnStartingIndex
  152. );
  153. virtual BOOL Initialize();
  154. protected:
  155. virtual void DrawItemEx(
  156. IN CRMCListBoxDrawStruct & ds
  157. );
  158. protected:
  159. BOOL m_fDomainsAllowed;
  160. CString m_strGranted;
  161. CString m_strDenied;
  162. CString m_strFormat;
  163. };
  164. class CAccessEntryListBox : public CRMCListBox
  165. /*++
  166. Class Description:
  167. Listbox of access entry objects. Listbox may be
  168. single or multiselect.
  169. Public Interface:
  170. CAccessEntryListBox : Constructor
  171. AddToAccessList : Add to list
  172. FillAccessListBox : Fill listbox
  173. ResolveAccessList : Resolve all SIDS in the container
  174. AddUserPermissions : Add user permissions
  175. GetSelectedItem : Get item if it's the only one selected,
  176. or NULL.
  177. --*/
  178. {
  179. DECLARE_DYNAMIC(CAccessEntryListBox);
  180. public:
  181. static const nBitmaps; // Number of bitmaps
  182. //
  183. // Constructor
  184. //
  185. public:
  186. CAccessEntryListBox(
  187. IN int nTab = 0
  188. );
  189. //
  190. // Interface
  191. //
  192. public:
  193. //
  194. // Return the singly selected item, or NULL
  195. // if 0, or more than one item is selected
  196. //
  197. CAccessEntry * GetSelectedItem(
  198. OUT int * pnSel = NULL
  199. );
  200. //
  201. // Return next selected listbox item (doesn't matter
  202. // if the listbox is single select or multi-select)
  203. //
  204. CAccessEntry * GetNextSelectedItem(
  205. IN OUT int * pnStartingIndex
  206. );
  207. //
  208. // Get item at selection or NULL
  209. //
  210. CAccessEntry * GetItem(UINT nIndex);
  211. //
  212. // Interface to container
  213. //
  214. public:
  215. BOOL AddToAccessList(
  216. IN CWnd * pWnd,
  217. IN LPCTSTR lpstrServer,
  218. IN CObListPlus & obl
  219. );
  220. void FillAccessListBox(
  221. IN CObListPlus & obl
  222. );
  223. protected:
  224. void ResolveAccessList(
  225. IN CObListPlus &obl
  226. );
  227. BOOL AddUserPermissions(
  228. IN LPCTSTR lpstrServer,
  229. IN CObListPlus &oblSID,
  230. IN CAccessEntry * newUser,
  231. IN ACCESS_MASK accPermissions
  232. );
  233. //
  234. // Interface to listbox
  235. //
  236. protected:
  237. int AddItem(CAccessEntry * pItem);
  238. void SetTabs(int nTab);
  239. protected:
  240. virtual void DrawItemEx(CRMCListBoxDrawStruct & s);
  241. private:
  242. int m_nTab;
  243. };
  244. class CDnsNameDlg : public CDialog
  245. {
  246. /*++
  247. Class Description:
  248. DNS Name resolution dialog. Enter a DNS name, and this will be
  249. resolved to an IP address. Optionally set the value in associated
  250. ip control.
  251. Public Interface:
  252. CDnsNameDlg : Construct the dialog
  253. QueryIPValue : Find out the resolved IP address (only set when OK
  254. is pressed).
  255. --*/
  256. //
  257. // Construction
  258. //
  259. public:
  260. //
  261. // Construct with associated IP address control
  262. //
  263. CDnsNameDlg(
  264. IN CIPAddressCtrl * pIpControl = NULL,
  265. IN CWnd * pParent = NULL
  266. );
  267. //
  268. // Construct with IP value
  269. //
  270. CDnsNameDlg(
  271. IN DWORD dwIPValue,
  272. IN CWnd * pParent = NULL
  273. );
  274. DWORD QueryIPValue() const;
  275. //
  276. // Dialog Data
  277. //
  278. protected:
  279. //{{AFX_DATA(CDnsNameDlg)
  280. enum { IDD = IDD_DNS };
  281. CEdit m_edit_DNSName;
  282. CButton m_button_OK;
  283. //}}AFX_DATA
  284. //
  285. // Overrides
  286. //
  287. protected:
  288. //{{AFX_VIRTUAL(CDnsNameDlg)
  289. protected:
  290. virtual void DoDataExchange(CDataExchange * pDX);
  291. //}}AFX_VIRTUAL
  292. //
  293. // Implementation
  294. //
  295. protected:
  296. //{{AFX_MSG(CDnsNameDlg)
  297. virtual void OnOK();
  298. virtual BOOL OnInitDialog();
  299. afx_msg void OnChangeEditDnsName();
  300. //}}AFX_MSG
  301. DECLARE_MESSAGE_MAP()
  302. DWORD FillIpControlFromName();
  303. DWORD FillNameFromIpValue();
  304. private:
  305. CIPAddressCtrl * m_pIpControl;
  306. DWORD m_dwIPValue;
  307. };
  308. class CIPAccessDlg : public CDialog
  309. /*++
  310. Class Description:
  311. Access description editor dialog. If constructed with a NULL access
  312. descriptor pointer, the access descriptor object will be allocated.
  313. Otherwise, the dialog will work with the given access descriptor
  314. Public Interface:
  315. CIPAccessDlg : Constructor
  316. --*/
  317. {
  318. //
  319. // Construction
  320. //
  321. public:
  322. //
  323. // standard constructor
  324. //
  325. CIPAccessDlg(
  326. IN BOOL fDenyAccessMode,
  327. IN OUT CIPAccessDescriptor *& pAccess,
  328. IN CObListPlus * poblAccessList = NULL,
  329. IN CWnd * pParent = NULL,
  330. IN BOOL fAllowDomains = FALSE
  331. );
  332. //
  333. // Dialog Data
  334. //
  335. protected:
  336. //
  337. // Must match type order
  338. //
  339. enum
  340. {
  341. RADIO_SINGLE,
  342. RADIO_MULTIPLE,
  343. RADIO_DOMAIN,
  344. };
  345. //{{AFX_DATA(CIPAccessDlg)
  346. enum { IDD = IDD_IP_ACCESS };
  347. int m_nStyle;
  348. CEdit m_edit_Domain;
  349. CStatic m_static_IpAddress;
  350. CStatic m_static_SubnetMask;
  351. CButton m_button_DNS;
  352. CButton m_button_OK;
  353. //}}AFX_DATA
  354. CButton m_radio_Domain;
  355. CIPAddressCtrl m_ipa_IPAddress;
  356. CIPAddressCtrl m_ipa_SubnetMask;
  357. //
  358. // Overrides
  359. //
  360. protected:
  361. //{{AFX_VIRTUAL(CIPAccessDlg)
  362. protected:
  363. virtual void DoDataExchange(CDataExchange * pDX);
  364. //}}AFX_VIRTUAL
  365. //
  366. // Implementation
  367. //
  368. protected:
  369. //{{AFX_MSG(CIPAccessDlg)
  370. virtual BOOL OnInitDialog();
  371. virtual void OnOK();
  372. virtual void OnCancel();
  373. afx_msg void OnRadioMultiple();
  374. afx_msg void OnRadioSingle();
  375. afx_msg void OnRadioDomain();
  376. afx_msg void OnButtonDns();
  377. //}}AFX_MSG
  378. afx_msg void OnItemChanged();
  379. DECLARE_MESSAGE_MAP()
  380. void SetControlStates(
  381. IN int nStyle
  382. );
  383. private:
  384. BOOL m_fNew;
  385. BOOL m_fDenyAccessMode;
  386. BOOL m_fAllowDomains;
  387. CComBSTR m_bstrIPAddress;
  388. CComBSTR m_bstrNetworkID;
  389. CComBSTR m_bstrDomainName;
  390. CIPAccessDescriptor *& m_pAccess;
  391. CObListPlus * m_poblAccessList;
  392. };
  393. //
  394. // Inline Expansion
  395. //
  396. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  397. inline CAccessEntryListBox::CAccessEntryListBox (
  398. IN int nTab
  399. )
  400. {
  401. SetTabs(nTab);
  402. }
  403. inline void CAccessEntryListBox::SetTabs(
  404. IN int nTab
  405. )
  406. {
  407. m_nTab = nTab;
  408. }
  409. inline CAccessEntry * CAccessEntryListBox::GetItem(
  410. IN UINT nIndex
  411. )
  412. {
  413. return (CAccessEntry *)GetItemDataPtr(nIndex);
  414. }
  415. inline int CAccessEntryListBox::AddItem(
  416. IN CAccessEntry * pItem
  417. )
  418. {
  419. return AddString ((LPCTSTR)pItem);
  420. }
  421. inline CAccessEntry * CAccessEntryListBox::GetSelectedItem(
  422. OUT int * pnSel
  423. )
  424. {
  425. return (CAccessEntry *)CRMCListBox::GetSelectedListItem(pnSel);
  426. }
  427. inline CAccessEntry * CAccessEntryListBox::GetNextSelectedItem(
  428. IN OUT int * pnStartingIndex
  429. )
  430. {
  431. return (CAccessEntry *)CRMCListBox::GetNextSelectedItem(pnStartingIndex);
  432. }
  433. inline CIPAccessDescriptor * CIPAccessDescriptorListBox::GetItem(
  434. IN UINT nIndex
  435. )
  436. {
  437. return (CIPAccessDescriptor *)GetItemDataPtr(nIndex);
  438. }
  439. inline int CIPAccessDescriptorListBox::AddItem(
  440. IN const CIPAccessDescriptor * pItem
  441. )
  442. {
  443. return AddString((LPCTSTR)pItem);
  444. }
  445. inline CIPAccessDescriptor * CIPAccessDescriptorListBox::GetSelectedItem(
  446. OUT int * pnSel
  447. )
  448. {
  449. return (CIPAccessDescriptor *)CRMCListBox::GetSelectedListItem(pnSel);
  450. }
  451. inline CIPAccessDescriptor * CIPAccessDescriptorListBox::GetNextSelectedItem(
  452. IN OUT int * pnStartingIndex
  453. )
  454. {
  455. return (CIPAccessDescriptor *)CRMCListBox::GetNextSelectedItem(pnStartingIndex);
  456. }
  457. inline DWORD CDnsNameDlg::QueryIPValue() const
  458. {
  459. return m_dwIPValue;
  460. }