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.

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