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.

1102 lines
26 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1999
  6. //
  7. // File: dlgcreat.h
  8. //
  9. //--------------------------------------------------------------------------
  10. /////////////////////////////////////////////////////////////////////
  11. // dlgcreat.h
  12. //
  13. // Class definition for dialogs that create new ADs objects.
  14. //
  15. // HISTORY
  16. // 24-Aug-97 Dan Morin Creation.
  17. //
  18. /////////////////////////////////////////////////////////////////////
  19. #ifndef _DLGCREAT_H
  20. #define _DLGCREAT_H
  21. #include <objsel.h> // object picker
  22. #include "util.h"
  23. #include "uiutil.h"
  24. // FORWARD DECLARATIONS
  25. class CNewADsObjectCreateInfo; // Defined in newobj.h
  26. class CWizExtensionSite;
  27. class CWizExtensionSiteManager;
  28. class CCreateNewObjectWizardBase;
  29. class CCreateNewObjectPageBase;
  30. class CCreateNewObjectDataPage;
  31. class CCreateNewObjectFinishPage;
  32. ///////////////////////////////////////////////////////////////////////////
  33. // CHPropSheetPageArr
  34. class CHPropSheetPageArr
  35. {
  36. public:
  37. CHPropSheetPageArr();
  38. ~CHPropSheetPageArr()
  39. {
  40. free(m_pArr);
  41. }
  42. void AddHPage(HPROPSHEETPAGE hPage);
  43. HPROPSHEETPAGE* GetArr(){ return m_pArr;}
  44. ULONG GetCount() {return m_nCount;}
  45. private:
  46. HPROPSHEETPAGE* m_pArr;
  47. ULONG m_nSize;
  48. ULONG m_nCount;
  49. };
  50. ///////////////////////////////////////////////////////////////////////////
  51. // CDsAdminNewObjSiteImpl
  52. class CDsAdminNewObjSiteImpl : public IDsAdminNewObj,
  53. public IDsAdminNewObjPrimarySite,
  54. public CComObjectRoot
  55. {
  56. DECLARE_NOT_AGGREGATABLE(CDsAdminNewObjSiteImpl)
  57. BEGIN_COM_MAP(CDsAdminNewObjSiteImpl)
  58. COM_INTERFACE_ENTRY(IDsAdminNewObj)
  59. COM_INTERFACE_ENTRY(IDsAdminNewObjPrimarySite)
  60. END_COM_MAP()
  61. public:
  62. CDsAdminNewObjSiteImpl()
  63. {
  64. m_pSite = NULL;
  65. }
  66. ~CDsAdminNewObjSiteImpl() {}
  67. // IDsAdminNewObj methods
  68. STDMETHOD(SetButtons)(THIS_ /*IN*/ ULONG nCurrIndex, /*IN*/ BOOL bValid);
  69. STDMETHOD(GetPageCounts)(THIS_ /*OUT*/ LONG* pnTotal,
  70. /*OUT*/ LONG* pnStartIndex);
  71. // IDsAdminNewObjPrimarySite methods
  72. STDMETHOD(CreateNew)(THIS_ /*IN*/ LPCWSTR pszName);
  73. STDMETHOD(Commit)(THIS_ );
  74. // Implementation
  75. public:
  76. void Init(CWizExtensionSite* pSite)
  77. {
  78. m_pSite = pSite;
  79. }
  80. private:
  81. BOOL _IsPrimarySite();
  82. CWizExtensionSite* m_pSite; // back pointer
  83. };
  84. ///////////////////////////////////////////////////////////////////////////
  85. // CWizExtensionSite
  86. class CWizExtensionSite
  87. {
  88. public:
  89. CWizExtensionSite(CWizExtensionSiteManager* pSiteManager)
  90. {
  91. ASSERT(pSiteManager != NULL);
  92. m_pSiteManager = pSiteManager;
  93. m_pSiteImplComObject = NULL;
  94. }
  95. ~CWizExtensionSite()
  96. {
  97. // if created during InitializeExtension(), it has
  98. // a ref count of 1, so need to release once to
  99. // destroy
  100. if (m_pSiteImplComObject != NULL)
  101. {
  102. m_pSiteImplComObject->Release();
  103. }
  104. }
  105. HRESULT InitializeExtension(GUID* pGuid);
  106. BOOL GetSummaryInfo(CString& s);
  107. IDsAdminNewObjExt* GetNewObjExt()
  108. {
  109. ASSERT(m_spIDsAdminNewObjExt != NULL);
  110. return m_spIDsAdminNewObjExt;
  111. }
  112. CWizExtensionSiteManager* GetSiteManager() { return m_pSiteManager;}
  113. CHPropSheetPageArr* GetHPageArr() { return &m_pageArray;}
  114. private:
  115. static BOOL CALLBACK FAR _OnAddPage(HPROPSHEETPAGE hsheetpage, LPARAM lParam);
  116. CWizExtensionSiteManager* m_pSiteManager; // back pointer
  117. CComPtr<IDsAdminNewObjExt> m_spIDsAdminNewObjExt; // extension interface pointer
  118. CHPropSheetPageArr m_pageArray; // array of property page handles
  119. CComObject<CDsAdminNewObjSiteImpl>* m_pSiteImplComObject; // fully formed COM object
  120. };
  121. ///////////////////////////////////////////////////////////////////////////
  122. // CWizExtensionSiteManager
  123. class CWizExtensionSiteList : public CList<CWizExtensionSite*, CWizExtensionSite*>
  124. {
  125. public:
  126. ~CWizExtensionSiteList()
  127. {
  128. while (!IsEmpty())
  129. delete RemoveTail();
  130. }
  131. };
  132. class CWizExtensionSiteManager
  133. {
  134. public:
  135. CWizExtensionSiteManager(CCreateNewObjectWizardBase* pWiz)
  136. {
  137. ASSERT(pWiz != NULL);
  138. m_pWiz = pWiz;
  139. m_pPrimaryExtensionSite = NULL;
  140. }
  141. ~CWizExtensionSiteManager()
  142. {
  143. if (m_pPrimaryExtensionSite != NULL)
  144. delete m_pPrimaryExtensionSite;
  145. }
  146. CCreateNewObjectWizardBase* GetWiz() { return m_pWiz;}
  147. CWizExtensionSite* GetPrimaryExtensionSite() { return m_pPrimaryExtensionSite;}
  148. CWizExtensionSiteList* GetExtensionSiteList() { return &m_extensionSiteList;}
  149. HRESULT CreatePrimaryExtension(GUID* pGuid,
  150. IADsContainer* pADsContainerObj,
  151. LPCWSTR lpszClassName);
  152. HRESULT CreateExtensions(GUID* aCreateWizExtGUIDArr, ULONG nCount,
  153. IADsContainer* pADsContainerObj,
  154. LPCWSTR lpszClassName);
  155. UINT GetTotalHPageCount();
  156. void SetObject(IADs* pADsObj);
  157. HRESULT WriteExtensionData(HWND hWnd, ULONG uContext);
  158. HRESULT NotifyExtensionsOnError(HWND hWnd, HRESULT hr, ULONG uContext);
  159. void GetExtensionsSummaryInfo(CString& s);
  160. private:
  161. CCreateNewObjectWizardBase* m_pWiz; // back pointer to wizard
  162. CWizExtensionSite* m_pPrimaryExtensionSite;
  163. CWizExtensionSiteList m_extensionSiteList;
  164. };
  165. /////////////////////////////////////////////////////////////////////
  166. // CCreateNewObjectWizardBase
  167. typedef CArray<CCreateNewObjectPageBase*, CCreateNewObjectPageBase*> CWizPagePtrArr;
  168. class CCreateNewObjectWizardBase
  169. {
  170. public:
  171. CCreateNewObjectWizardBase(CNewADsObjectCreateInfo* m_pNewADsObjectCreateInfo);
  172. virtual ~CCreateNewObjectWizardBase();
  173. HRESULT InitPrimaryExtension();
  174. HRESULT DoModal();
  175. BOOL OnFinish();
  176. HWND GetWnd();
  177. void SetWizardButtonsFirst(BOOL bValid)
  178. {
  179. SetWizardButtons(bValid ? PSWIZB_NEXT : 0);
  180. }
  181. void SetWizardButtonsMiddle(BOOL bValid)
  182. {
  183. SetWizardButtons(bValid ? (PSWIZB_BACK|PSWIZB_NEXT) : PSWIZB_BACK);
  184. }
  185. void SetWizardButtonsLast(BOOL bValid)
  186. {
  187. SetWizardButtons(bValid ? (PSWIZB_BACK|PSWIZB_FINISH) : (PSWIZB_BACK|PSWIZB_DISABLEDFINISH));
  188. }
  189. void EnableOKButton(BOOL bValid)
  190. {
  191. SetWizardButtons(bValid ? PSWIZB_FINISH : PSWIZB_DISABLEDFINISH);
  192. }
  193. void SetWizardOKCancel()
  194. {
  195. PropSheet_SetFinishText(GetWnd(), (LPCWSTR)m_szOKButtonCaption);
  196. }
  197. CNewADsObjectCreateInfo* GetInfo()
  198. {
  199. ASSERT(m_pNewADsObjectCreateInfo != NULL);
  200. return m_pNewADsObjectCreateInfo;
  201. }
  202. void SetWizardButtons(CCreateNewObjectPageBase* pPage, BOOL bValid);
  203. HRESULT SetWizardButtons(CWizExtensionSite* pSite, ULONG nCurrIndex, BOOL bValid);
  204. void SetObjectForExtensions(CCreateNewObjectPageBase* pPage);
  205. LPCWSTR GetCaption() { return m_szCaption;}
  206. HICON GetClassIcon();
  207. void GetSummaryInfo(CString& s);
  208. HRESULT CreateNewFromPrimaryExtension(LPCWSTR pszName);
  209. void GetPageCounts(CWizExtensionSite* pSite,
  210. /*OUT*/ LONG* pnTotal, /*OUT*/ LONG* pnStartIndex);
  211. BOOL HasFinishPage() { return m_pFinishPage != NULL; }
  212. protected:
  213. void AddPage(CCreateNewObjectPageBase* pPage);
  214. void SetWizardButtons(DWORD dwFlags)
  215. {
  216. ::PropSheet_SetWizButtons(GetWnd(), dwFlags);
  217. }
  218. virtual void GetSummaryInfoHeader(CString& s);
  219. virtual void OnFinishSetInfoFailed(HRESULT hr);
  220. private:
  221. void LoadCaptions();
  222. HRESULT WriteData(ULONG uContext);
  223. HRESULT RecreateObject();
  224. CNewADsObjectCreateInfo * m_pNewADsObjectCreateInfo;
  225. CCreateNewObjectFinishPage* m_pFinishPage;
  226. private:
  227. CWizExtensionSiteManager m_siteManager;
  228. CString m_szCaption;
  229. CString m_szOKButtonCaption;
  230. HICON m_hClassIcon;
  231. PROPSHEETHEADER m_psh;
  232. HWND m_hWnd; // cached HWND
  233. CWizPagePtrArr m_pages; // pages we own
  234. HRESULT m_hrReturnValue;
  235. static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam);
  236. };
  237. /////////////////////////////////////////////////////////////////////
  238. // CIconCtrl
  239. class CIconCtrl : public CStatic
  240. {
  241. public:
  242. CIconCtrl() { m_hIcon;}
  243. ~CIconCtrl() { DestroyIcon(m_hIcon); }
  244. void SetIcon(HICON hIcon)
  245. {
  246. ASSERT(hIcon != NULL);
  247. m_hIcon = hIcon;
  248. }
  249. protected:
  250. HICON m_hIcon;
  251. afx_msg void OnPaint();
  252. DECLARE_MESSAGE_MAP()
  253. };
  254. /////////////////////////////////////////////////////////////////////
  255. // CCreateNewObjectPageBase
  256. class CCreateNewObjectPageBase : public CPropertyPageEx_Mine
  257. {
  258. public:
  259. CCreateNewObjectPageBase(UINT nIDTemplate);
  260. // Implementation
  261. protected:
  262. virtual BOOL OnInitDialog();
  263. virtual BOOL OnSetActive();
  264. virtual void GetSummaryInfo(CString&) { };
  265. protected:
  266. CCreateNewObjectWizardBase* GetWiz() { ASSERT(m_pWiz != NULL); return m_pWiz;}
  267. private:
  268. CIconCtrl m_iconCtrl; // to display class icon
  269. CCreateNewObjectWizardBase* m_pWiz; // back pointer to wizard object
  270. friend class CCreateNewObjectWizardBase; // sets the m_pWiz member
  271. DECLARE_MESSAGE_MAP()
  272. protected:
  273. afx_msg LONG OnFormatCaption(WPARAM wParam, LPARAM lParam);
  274. };
  275. /////////////////////////////////////////////////////////////////////
  276. // CCreateNewObjectDataPage
  277. class CCreateNewObjectDataPage : public CCreateNewObjectPageBase
  278. {
  279. public:
  280. CCreateNewObjectDataPage(UINT nIDTemplate);
  281. // Implementation
  282. protected:
  283. virtual BOOL OnSetActive();
  284. virtual BOOL OnKillActive();
  285. virtual LRESULT OnWizardNext();
  286. virtual LRESULT OnWizardBack();
  287. virtual BOOL OnWizardFinish();
  288. // interface to exchange data: need to override
  289. // SetData(): called to write data from the UI to the temp. object
  290. // return successful HRESULT to allow a kill focus/page dismissal
  291. virtual HRESULT SetData(BOOL bSilent = FALSE) = 0;
  292. // GetData(): called to load data from temporary object to UI
  293. // return TRUE if want the Next/OK button to be enabled
  294. // when called with a non NULL IADs
  295. virtual BOOL GetData(IADs* pIADsCopyFrom) = 0;
  296. // function called after the finish page has done the commit,
  297. // need to implement if the page needs to do something after SetInfo()
  298. // has been called
  299. public:
  300. virtual HRESULT OnPostCommit(BOOL = FALSE) { return S_OK;}
  301. virtual HRESULT OnPreCommit(BOOL bSilent = FALSE) { return SetData(bSilent);}
  302. private:
  303. BOOL m_bFirstTimeGetDataCalled;
  304. };
  305. /////////////////////////////////////////////////////////////////////
  306. // CCreateNewObjectFinishPage
  307. class CCreateNewObjectFinishPage : public CCreateNewObjectPageBase
  308. {
  309. public:
  310. enum { IDD = IDD_CREATE_NEW_FINISH };
  311. CCreateNewObjectFinishPage();
  312. // Implementation
  313. protected:
  314. virtual BOOL OnSetActive();
  315. virtual BOOL OnKillActive();
  316. virtual BOOL OnWizardFinish();
  317. afx_msg void OnSetFocusEdit();
  318. DECLARE_MESSAGE_MAP()
  319. private:
  320. void WriteSummary(LPCWSTR lpszSummaryText);
  321. BOOL m_bNeedSetFocus;
  322. };
  323. ///////////////////////////////////////////////////////////////////
  324. // CCreateNewNamedObjectPage
  325. class CCreateNewNamedObjectPage : public CCreateNewObjectDataPage
  326. {
  327. protected:
  328. CCreateNewNamedObjectPage(UINT nIDTemplate)
  329. : CCreateNewObjectDataPage(nIDTemplate) {}
  330. protected:
  331. // interface to exchange data
  332. virtual HRESULT SetData(BOOL bSilent = FALSE);
  333. virtual BOOL GetData(IADs* pIADsCopyFrom);
  334. protected:
  335. virtual BOOL OnInitDialog();
  336. afx_msg void OnNameChange();
  337. virtual BOOL ValidateName(LPCTSTR pcszName);
  338. CString m_strName; // Name of object
  339. DECLARE_MESSAGE_MAP()
  340. };
  341. ///////////////////////////////////////////////////////////////
  342. ///////////////////////////////////////////////////////////////
  343. // NEW CN WIZARD
  344. // Create a new object where the only mandatory attribute is "cn"
  345. class CCreateNewObjectCnPage : public CCreateNewNamedObjectPage
  346. {
  347. protected:
  348. enum { IDD = IDD_CREATE_NEW_OBJECT_CN };
  349. public:
  350. CCreateNewObjectCnPage() : CCreateNewNamedObjectPage(IDD) {}
  351. };
  352. class CCreateNewObjectCnWizard : public CCreateNewObjectWizardBase
  353. {
  354. public:
  355. CCreateNewObjectCnWizard(CNewADsObjectCreateInfo* pNewADsObjectCreateInfo)
  356. : CCreateNewObjectWizardBase(pNewADsObjectCreateInfo)
  357. {
  358. AddPage(&m_page1);
  359. }
  360. private:
  361. CCreateNewObjectCnPage m_page1;
  362. };
  363. ///////////////////////////////////////////////////////////////
  364. ///////////////////////////////////////////////////////////////
  365. // NEW VOLUME WIZARD
  366. //
  367. // Create a new volume object (friendly name: shared folder)
  368. //
  369. //
  370. class CCreateNewVolumePage : public CCreateNewObjectDataPage
  371. {
  372. public:
  373. enum { IDD = IDD_CREATE_NEW_VOLUME };
  374. CCreateNewVolumePage();
  375. protected:
  376. // interface to exchange data
  377. virtual HRESULT SetData(BOOL bSilent = FALSE);
  378. virtual BOOL GetData(IADs* pIADsCopyFrom);
  379. protected:
  380. virtual BOOL OnInitDialog();
  381. afx_msg void OnNameChange();
  382. afx_msg void OnPathChange();
  383. void _UpdateUI();
  384. CString m_strName; // Name of object
  385. CString m_strUncPath; // UNC path of the object
  386. DECLARE_MESSAGE_MAP()
  387. };
  388. class CCreateNewVolumeWizard : public CCreateNewObjectWizardBase
  389. {
  390. public:
  391. CCreateNewVolumeWizard(CNewADsObjectCreateInfo* pNewADsObjectCreateInfo);
  392. private:
  393. CCreateNewVolumePage m_page1;
  394. };
  395. ///////////////////////////////////////////////////////////////
  396. ///////////////////////////////////////////////////////////////
  397. // NEW COMPUTER WIZARD
  398. class CCreateNewComputerPage : public CCreateNewObjectDataPage
  399. {
  400. public:
  401. enum { IDD = IDD_CREATE_NEW_COMPUTER };
  402. CCreateNewComputerPage();
  403. BOOL OnError(HRESULT hr);
  404. protected:
  405. // interface to exchange data
  406. virtual BOOL OnInitDialog();
  407. virtual HRESULT SetData(BOOL bSilent = FALSE);
  408. virtual BOOL GetData(IADs* pIADsCopyFrom);
  409. virtual HRESULT OnPostCommit(BOOL bSilent = FALSE);
  410. virtual void GetSummaryInfo(CString& s);
  411. protected:
  412. afx_msg void OnNameChange();
  413. afx_msg void OnSamNameChange();
  414. afx_msg void OnChangePrincipalButton();
  415. DECLARE_MESSAGE_MAP()
  416. private:
  417. CString m_strName; // DNS Name of computer
  418. CString m_strSamName; // Downlevel Name of computer
  419. // security
  420. void UpdateSecurityPrincipalUI(PDS_SELECTION pDsSelection);
  421. HRESULT BuildNewAccessList(PACL* ppDacl);
  422. HRESULT SetSecurity();
  423. CSidHolder m_securityPrincipalSidHolder;
  424. HRESULT _LookupSamAccountNameFromSid(PSID pSid, CString& szSamAccountName);
  425. HRESULT _ValidateName();
  426. HRESULT _ValidateSamName();
  427. };
  428. class CCreateNewComputerWizard : public CCreateNewObjectWizardBase
  429. {
  430. public:
  431. CCreateNewComputerWizard(CNewADsObjectCreateInfo* pNewADsObjectCreateInfo);
  432. protected:
  433. virtual void OnFinishSetInfoFailed(HRESULT hr);
  434. private:
  435. CCreateNewComputerPage m_page1;
  436. };
  437. ///////////////////////////////////////////////////////////////
  438. ///////////////////////////////////////////////////////////////
  439. // NEW OU WIZARD
  440. class CCreateNewOUPage : public CCreateNewObjectDataPage
  441. {
  442. public:
  443. enum { IDD = IDD_CREATE_NEW_OBJECT_CN };
  444. CCreateNewOUPage();
  445. protected:
  446. // interface to exchange data
  447. virtual HRESULT SetData(BOOL bSilent = FALSE);
  448. virtual BOOL GetData(IADs* pIADsCopyFrom);
  449. protected:
  450. virtual BOOL OnInitDialog();
  451. afx_msg void OnNameChange();
  452. virtual BOOL OnWizardFinish();
  453. virtual BOOL OnSetActive();
  454. CString m_strOUName; // Name of OU
  455. DECLARE_MESSAGE_MAP()
  456. };
  457. class CCreateNewOUWizard : public CCreateNewObjectWizardBase
  458. {
  459. public:
  460. CCreateNewOUWizard(CNewADsObjectCreateInfo* pNewADsObjectCreateInfo);
  461. private:
  462. CCreateNewOUPage m_page1;
  463. };
  464. ///////////////////////////////////////////////////////////////
  465. ///////////////////////////////////////////////////////////////
  466. // NEW GROUP WIZARD
  467. class CCreateNewGroupPage : public CCreateNewObjectDataPage
  468. {
  469. public:
  470. enum { IDD = IDD_CREATE_NEW_GROUP };
  471. CCreateNewGroupPage();
  472. protected:
  473. // interface to exchange data
  474. virtual HRESULT SetData(BOOL bSilent = FALSE);
  475. virtual BOOL GetData(IADs* pIADsCopyFrom);
  476. protected:
  477. virtual BOOL OnInitDialog();
  478. afx_msg void OnNameChange();
  479. afx_msg void OnSamNameChange();
  480. afx_msg void OnSecurityOrTypeChange();
  481. CString m_strGroupName; // Name of Group
  482. CString m_strSamName; // downlevel name of group
  483. BOOL m_fMixed;
  484. UINT m_SAMLength;
  485. private:
  486. BOOL _InitUI();
  487. DECLARE_MESSAGE_MAP()
  488. };
  489. class CCreateNewGroupWizard : public CCreateNewObjectWizardBase
  490. {
  491. public:
  492. CCreateNewGroupWizard(CNewADsObjectCreateInfo* pNewADsObjectCreateInfo);
  493. private:
  494. CCreateNewGroupPage m_page1;
  495. };
  496. ///////////////////////////////////////////////////////////////
  497. ///////////////////////////////////////////////////////////////
  498. // NEW CONTACT WIZARD
  499. class CCreateNewContactPage : public CCreateNewObjectDataPage
  500. {
  501. public:
  502. enum { IDD = IDD_CREATE_NEW_CONTACT };
  503. CCreateNewContactPage();
  504. protected:
  505. // interface to exchange data
  506. virtual HRESULT SetData(BOOL bSilent = FALSE);
  507. virtual BOOL GetData(IADs* pIADsCopyFrom);
  508. protected:
  509. virtual BOOL OnInitDialog();
  510. afx_msg void OnNameChange();
  511. afx_msg void OnFullNameChange();
  512. afx_msg void OnDispNameChange();
  513. CString m_strFirstName; // First Name of user
  514. CString m_strInitials; // Initials of user
  515. CString m_strLastName; // Last Name of user
  516. CString m_strFullName; // Full Name of user (and obj CN)
  517. CString m_strDispName; // Display Name of user (and obj CN)
  518. CUserNameFormatter m_nameFormatter; // name ordering for given name and surname
  519. DECLARE_MESSAGE_MAP()
  520. };
  521. class CCreateNewContactWizard : public CCreateNewObjectWizardBase
  522. {
  523. public:
  524. CCreateNewContactWizard(CNewADsObjectCreateInfo* pNewADsObjectCreateInfo);
  525. private:
  526. CCreateNewContactPage m_page1;
  527. };
  528. ///////////////////////////////////////////////////////////////
  529. ///////////////////////////////////////////////////////////////
  530. // NEW USER WIZARD
  531. class CCreateNewUserPage1 : public CCreateNewObjectDataPage
  532. {
  533. public:
  534. enum { IDD = IDD_CREATE_NEW_USER1 };
  535. CCreateNewUserPage1();
  536. LPCWSTR GetFullName() { return m_strFullName;};
  537. BOOL OnError( HRESULT hr );
  538. protected:
  539. virtual BOOL OnInitDialog();
  540. virtual void GetSummaryInfo(CString& s);
  541. // interface to exchange data
  542. virtual HRESULT SetData(BOOL bSilent = FALSE);
  543. virtual BOOL GetData(IADs* pIADsCopyFrom);
  544. protected:
  545. afx_msg void OnNameChange();
  546. afx_msg void OnLoginNameChange();
  547. afx_msg void OnSAMNameChange();
  548. afx_msg void OnFullNameChange();
  549. CString m_strFirstName; // First Name of user
  550. CString m_strInitials; // Initials of user
  551. CString m_strLastName; // Last Name of user
  552. CString m_strFullName; // Full Name of user (and obj CN)
  553. CString m_strLoginName; // Login name of user
  554. CString m_strSAMName; // NT4 Login name of user
  555. CString m_LocalDomain; // Current Domain
  556. CUserNameFormatter m_nameFormatter; // name ordering for given name and surname
  557. private:
  558. BOOL _InitUI();
  559. BOOL m_bForcingNameChange;
  560. DECLARE_MESSAGE_MAP()
  561. };
  562. class CCreateNewUserPage2 : public CCreateNewObjectDataPage
  563. {
  564. public:
  565. enum { IDD = IDD_CREATE_NEW_USER2 };
  566. CCreateNewUserPage2();
  567. void SetPage1(CCreateNewUserPage1* p)
  568. {
  569. ASSERT(p != NULL);
  570. m_pPage1 = p;
  571. }
  572. protected:
  573. virtual void GetSummaryInfo(CString& s);
  574. virtual BOOL OnInitDialog();
  575. // interface to exchange data
  576. virtual HRESULT SetData(BOOL bSilent = FALSE);
  577. virtual BOOL GetData(IADs* pIADsCopyFrom);
  578. virtual HRESULT OnPostCommit(BOOL bSilent = FALSE);
  579. protected:
  580. afx_msg void OnNameChange();
  581. afx_msg void OnLoginNameChange();
  582. afx_msg void OnPasswordPropsClick();
  583. DECLARE_MESSAGE_MAP()
  584. private:
  585. CCreateNewUserPage1* m_pPage1;
  586. void _GetCheckBoxSummaryInfo(UINT nCtrlID, UINT nStringID, CString& s);
  587. };
  588. class CCreateNewUserWizard : public CCreateNewObjectWizardBase
  589. {
  590. public:
  591. CCreateNewUserWizard(CNewADsObjectCreateInfo* pNewADsObjectCreateInfo);
  592. protected:
  593. virtual void GetSummaryInfoHeader(CString& s);
  594. virtual void OnFinishSetInfoFailed(HRESULT hr);
  595. private:
  596. CCreateNewUserPage1 m_page1;
  597. CCreateNewUserPage2 m_page2;
  598. };
  599. ///////////////////////////////////////////////////////////////
  600. ///////////////////////////////////////////////////////////////
  601. // NEW PRINT QUEUE WIZARD
  602. //
  603. // Create a new PrintQueue object. the only mandatory props
  604. // are "cn" and "uNCName".
  605. //
  606. class CCreateNewPrintQPage : public CCreateNewObjectDataPage
  607. {
  608. public:
  609. enum { IDD = IDD_CREATE_NEW_PRINTQ };
  610. CCreateNewPrintQPage();
  611. protected:
  612. // interface to exchange data
  613. virtual HRESULT SetData(BOOL bSilent = FALSE);
  614. virtual BOOL GetData(IADs* pIADsCopyFrom);
  615. protected:
  616. afx_msg void OnPathChange();
  617. CString m_strUncPath; // UNC path of the object
  618. CString m_strContainer; // UNC path of the object
  619. LPWSTR m_pwszNewObj; // Path to created object
  620. void _UpdateUI();
  621. DECLARE_MESSAGE_MAP()
  622. };
  623. class CCreateNewPrintQWizard : public CCreateNewObjectWizardBase
  624. {
  625. public:
  626. CCreateNewPrintQWizard(CNewADsObjectCreateInfo* pNewADsObjectCreateInfo);
  627. private:
  628. CCreateNewPrintQPage m_page1;
  629. };
  630. #ifdef FRS_CREATE
  631. ///////////////////////////////////////////////////////////////
  632. ///////////////////////////////////////////////////////////////
  633. // NEW FRS SUBSCRIBER WIZARD
  634. class CCreateNewFrsSubscriberPage : public CCreateNewNamedObjectPage
  635. {
  636. public:
  637. enum { IDD = IDD_CREATE_NEW_FRS_SUBSCRIBER };
  638. CCreateNewFrsSubscriberPage() : CCreateNewNamedObjectPage(IDD) {}
  639. protected:
  640. // interface to exchange data
  641. virtual HRESULT SetData(BOOL bSilent = FALSE);
  642. protected:
  643. CString m_strRootPath; // FRS root path
  644. CString m_strStagingPath; // FRS staging path
  645. private:
  646. BOOL ReadAbsolutePath( int ctrlID, OUT CString& strrefValue );
  647. };
  648. class CCreateNewFrsSubscriberWizard : public CCreateNewObjectWizardBase
  649. {
  650. public:
  651. CCreateNewFrsSubscriberWizard(CNewADsObjectCreateInfo* pNewADsObjectCreateInfo)
  652. : CCreateNewObjectWizardBase(pNewADsObjectCreateInfo)
  653. {
  654. AddPage(&m_page1);
  655. }
  656. private:
  657. CCreateNewFrsSubscriberPage m_page1;
  658. };
  659. #endif // FRS_CREATE
  660. ///////////////////////////////////////////////////////////////
  661. ///////////////////////////////////////////////////////////////
  662. // NEW SITE WIZARD AND NEW SUBNET WIZARD (NEWSITE.CPP)
  663. class CreateAndChoosePage : public CCreateNewNamedObjectPage
  664. {
  665. public:
  666. CreateAndChoosePage(UINT nIDTemplate);
  667. protected:
  668. // CWnd overrides
  669. afx_msg
  670. void
  671. OnDestroy();
  672. // CDialog overrides
  673. virtual
  674. BOOL
  675. OnInitDialog() = 0;
  676. // CPropertyPage overrides
  677. BOOL
  678. OnSetActive();
  679. private:
  680. typedef CCreateNewObjectDataPage Base;
  681. virtual void
  682. initListContents(LPCWSTR containerPath) = 0;
  683. protected:
  684. HWND listview;
  685. HIMAGELIST listview_imagelist;
  686. DECLARE_MESSAGE_MAP();
  687. };
  688. class CreateNewSitePage : public CreateAndChoosePage
  689. {
  690. public:
  691. CreateNewSitePage();
  692. protected:
  693. // CDialog overrides
  694. virtual
  695. BOOL
  696. OnInitDialog();
  697. // CCreateNewObjectDataPage overrides
  698. virtual
  699. HRESULT
  700. SetData(BOOL bSilent = FALSE);
  701. // JonN 5/11/01 251560 Disable OK until site link chosen
  702. DECLARE_MESSAGE_MAP()
  703. afx_msg void OnChange();
  704. afx_msg void OnSelChange( NMHDR*, LRESULT* );
  705. virtual BOOL ValidateName(LPCTSTR pcszName);
  706. virtual
  707. HRESULT
  708. OnPostCommit(BOOL bSilent = FALSE);
  709. virtual void
  710. initListContents(LPCWSTR containerPath);
  711. private:
  712. HRESULT
  713. tweakSiteLink(LPCTSTR siteDN);
  714. };
  715. class CreateNewSiteWizard : public CCreateNewObjectWizardBase
  716. {
  717. public:
  718. CreateNewSiteWizard(CNewADsObjectCreateInfo* pNewADsObjectCreateInfo);
  719. private:
  720. CreateNewSitePage page;
  721. };
  722. class CreateNewSubnetPage : public CreateAndChoosePage
  723. {
  724. public:
  725. CreateNewSubnetPage();
  726. protected:
  727. // CDialog overrides
  728. virtual
  729. BOOL
  730. OnInitDialog();
  731. // CCreateNewObjectDataPage overrides
  732. virtual
  733. HRESULT
  734. SetData(BOOL bSilent = FALSE);
  735. virtual void
  736. initListContents(LPCWSTR containerPath);
  737. private:
  738. HRESULT
  739. tweakSiteLink(LPCTSTR siteDN);
  740. protected:
  741. afx_msg void OnSubnetMaskChange();
  742. DECLARE_MESSAGE_MAP();
  743. };
  744. class CreateNewSubnetWizard : public CCreateNewObjectWizardBase
  745. {
  746. public:
  747. CreateNewSubnetWizard(CNewADsObjectCreateInfo* pNewADsObjectCreateInfo);
  748. private:
  749. CreateNewSubnetPage page;
  750. };
  751. ///////////////////////////////////////////////////////////////
  752. ///////////////////////////////////////////////////////////////
  753. // Shared between NEW SITE LINK WIZARD and NEW SITE LINK BRIDGE WIZARD
  754. class DSPROP_BSTR_BLOCK;
  755. class CCreatePageWithDuellingListboxes : public CCreateNewObjectDataPage
  756. {
  757. public:
  758. CCreatePageWithDuellingListboxes(
  759. UINT nIDTemplate,
  760. LPCWSTR lpcwszAttrName,
  761. const DSPROP_BSTR_BLOCK& bstrblock );
  762. protected:
  763. // interface to exchange data
  764. virtual HRESULT SetData(BOOL bSilent = FALSE);
  765. virtual BOOL GetData(IADs* pIADsCopyFrom);
  766. virtual BOOL OnSetActive();
  767. void SetWizardButtons();
  768. protected:
  769. afx_msg void OnNameChange();
  770. afx_msg void OnDuellingButtonAdd();
  771. afx_msg void OnDuellingButtonRemove();
  772. afx_msg void OnDuellingListboxSelchange();
  773. afx_msg void OnDestroy();
  774. CString m_strName;
  775. HWND m_hwndInListbox;
  776. HWND m_hwndOutListbox;
  777. CString m_strAttrName;
  778. const DSPROP_BSTR_BLOCK& m_bstrblock;
  779. DECLARE_MESSAGE_MAP()
  780. };
  781. ///////////////////////////////////////////////////////////////
  782. ///////////////////////////////////////////////////////////////
  783. // NEW SITE LINK WIZARD
  784. class CCreateNewSiteLinkPage : public CCreatePageWithDuellingListboxes
  785. {
  786. public:
  787. enum { IDD = IDD_CREATE_NEW_SITE_LINK };
  788. CCreateNewSiteLinkPage( const DSPROP_BSTR_BLOCK& bstrblock );
  789. protected:
  790. // interface to exchange data
  791. virtual BOOL OnSetActive();
  792. virtual HRESULT SetData(BOOL bSilent = FALSE);
  793. };
  794. class CCreateNewSiteLinkWizard : public CCreateNewObjectWizardBase
  795. {
  796. public:
  797. CCreateNewSiteLinkWizard(CNewADsObjectCreateInfo* pNewADsObjectCreateInfo,
  798. const DSPROP_BSTR_BLOCK& bstrblock );
  799. private:
  800. CCreateNewSiteLinkPage m_page1;
  801. };
  802. ///////////////////////////////////////////////////////////////
  803. ///////////////////////////////////////////////////////////////
  804. // NEW SITE LINK BRIDGE WIZARD
  805. class CCreateNewSiteLinkBridgePage : public CCreatePageWithDuellingListboxes
  806. {
  807. public:
  808. enum { IDD = IDD_CREATE_NEW_SITE_LINK_BRIDGE };
  809. CCreateNewSiteLinkBridgePage( const DSPROP_BSTR_BLOCK& bstrblock );
  810. protected:
  811. // interface to exchange data
  812. virtual HRESULT SetData(BOOL bSilent = FALSE);
  813. };
  814. class CCreateNewSiteLinkBridgeWizard : public CCreateNewObjectWizardBase
  815. {
  816. public:
  817. CCreateNewSiteLinkBridgeWizard(CNewADsObjectCreateInfo* pNewADsObjectCreateInfo,
  818. const DSPROP_BSTR_BLOCK& bstrblockSiteLinks );
  819. private:
  820. CCreateNewSiteLinkBridgePage m_page1;
  821. };
  822. #endif // _DLGCREAT_H