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.

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