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.

933 lines
20 KiB

  1. /*++
  2. Copyright (c) 1994-2000 Microsoft Corporation
  3. Module Name :
  4. iisservice.cpp
  5. Abstract:
  6. IISService Object
  7. Author:
  8. Ronald Meijer (ronaldm)
  9. Sergei Antonov (sergeia)
  10. Project:
  11. Internet Services Manager
  12. Revision History:
  13. 10/28/2000 sergeia Split from iisobj.cpp
  14. --*/
  15. #include "stdafx.h"
  16. #include "common.h"
  17. #include "inetprop.h"
  18. #include "InetMgrApp.h"
  19. #include "supdlgs.h"
  20. #include "connects.h"
  21. #include "iisobj.h"
  22. #include "ftpsht.h"
  23. #include "fservic.h"
  24. #include "facc.h"
  25. #include "fmessage.h"
  26. #include "fvdir.h"
  27. #include "fsecure.h"
  28. #include "w3sht.h"
  29. #include "wservic.h"
  30. #include "wvdir.h"
  31. #include "wsecure.h"
  32. #include "fltdlg.h"
  33. #include "filters.h"
  34. #include "w3accts.h"
  35. #include "perform.h"
  36. #include "docum.h"
  37. #include "httppage.h"
  38. #include "defws.h"
  39. #include "deffs.h"
  40. #include "errors.h"
  41. #ifdef _DEBUG
  42. #undef THIS_FILE
  43. static char BASED_CODE THIS_FILE[] = __FILE__;
  44. #endif
  45. #define new DEBUG_NEW
  46. //
  47. // CIISService Implementation
  48. //
  49. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  50. /* static */
  51. HRESULT
  52. __cdecl
  53. CIISService::ShowFTPSiteProperties(
  54. IN LPPROPERTYSHEETCALLBACK lpProvider,
  55. IN CComAuthInfo * pAuthInfo, OPTIONAL
  56. IN LPCTSTR lpszMDPath,
  57. IN CWnd * pMainWnd, OPTIONAL
  58. IN LPARAM lParam, OPTIONAL
  59. IN LONG_PTR handle OPTIONAL
  60. )
  61. /*++
  62. Routine Description:
  63. Callback function to display FTP site properties.
  64. Arguments:
  65. LPPROPERTYSHEETCALLBACK lpProvider Property sheet provider
  66. CComAuthInfo * pAuthInfo COM Authentication info or NULL.
  67. LPCTSTR lpszMDPath Metabase path
  68. CWnd * pMainWnd Parent window
  69. LPARAM lParam LPARAM to pass to MMC
  70. LONG handle handle to pass to MMC
  71. Return Value:
  72. HRESULT
  73. --*/
  74. {
  75. AFX_MANAGE_STATE(::AfxGetStaticModuleState());
  76. ASSERT_PTR(lpProvider);
  77. CError err;
  78. CFtpSheet * pSheet = new CFtpSheet(
  79. pAuthInfo,
  80. lpszMDPath,
  81. pMainWnd,
  82. lParam,
  83. handle
  84. );
  85. if (pSheet)
  86. {
  87. pSheet->SetModeless();
  88. CIISMachine * pOwner = ((CIISMBNode *)lParam)->GetOwner();
  89. ASSERT(pOwner != NULL);
  90. //
  91. // Add instance pages
  92. //
  93. if (!pOwner->Has10ConnectionsLimit() || !CMetabasePath::IsMasterInstance(lpszMDPath))
  94. {
  95. err = AddMMCPage(lpProvider, new CFtpServicePage(pSheet));
  96. }
  97. err = AddMMCPage(lpProvider, new CFtpAccountsPage(pSheet));
  98. err = AddMMCPage(lpProvider, new CFtpMessagePage(pSheet));
  99. //
  100. // Add directory pages
  101. //
  102. err = AddMMCPage(lpProvider, new CFtpDirectoryPage(pSheet, TRUE));
  103. if (pOwner->QueryMajorVersion() >= 6)
  104. {
  105. err = AddMMCPage(lpProvider, new CFtpSecurityPage(pSheet));
  106. }
  107. //
  108. // Add master site pages
  109. //
  110. if (CMetabasePath::IsMasterInstance(lpszMDPath) && pOwner->QueryMajorVersion() >= 6)
  111. {
  112. err = AddMMCPage(lpProvider, new CDefFtpSitePage(pSheet));
  113. }
  114. }
  115. else
  116. {
  117. err = ERROR_NOT_ENOUGH_MEMORY;
  118. }
  119. return err;
  120. }
  121. /* static */
  122. HRESULT
  123. __cdecl
  124. CIISService::ShowFTPDirProperties(
  125. IN LPPROPERTYSHEETCALLBACK lpProvider,
  126. IN CComAuthInfo * pAuthInfo, OPTIONAL
  127. IN LPCTSTR lpszMDPath,
  128. IN CWnd * pMainWnd, OPTIONAL
  129. IN LPARAM lParam, OPTIONAL
  130. IN LONG_PTR handle OPTIONAL
  131. )
  132. /*++
  133. Routine Description:
  134. Callback function to display FTP dir properties.
  135. Arguments:
  136. LPPROPERTYSHEETCALLBACK lpProvider Property sheet provider
  137. CComAuthInfo * pAuthInfo COM Authentication info or NULL.
  138. LPCTSTR lpszMDPath Metabase path
  139. CWnd * pMainWnd Parent window
  140. LPARAM lParam LPARAM to pass to MMC
  141. LONG handle handle to pass to MMC
  142. Return Value:
  143. HRESULT
  144. --*/
  145. {
  146. AFX_MANAGE_STATE(::AfxGetStaticModuleState());
  147. ASSERT_PTR(lpProvider);
  148. CError err;
  149. CFtpSheet * pSheet = new CFtpSheet(
  150. pAuthInfo,
  151. lpszMDPath,
  152. pMainWnd,
  153. lParam,
  154. handle
  155. );
  156. if (pSheet)
  157. {
  158. pSheet->SetModeless();
  159. CIISMachine * pOwner = ((CIISMBNode *)lParam)->GetOwner();
  160. ASSERT(pOwner != NULL);
  161. //
  162. // Add directory pages
  163. //
  164. err = AddMMCPage(lpProvider, new CFtpDirectoryPage(pSheet, FALSE));
  165. if (pOwner->QueryMajorVersion() >= 6)
  166. {
  167. err = AddMMCPage(lpProvider, new CFtpSecurityPage(pSheet));
  168. }
  169. }
  170. else
  171. {
  172. err = ERROR_NOT_ENOUGH_MEMORY;
  173. }
  174. return err;
  175. }
  176. /* static */
  177. HRESULT
  178. __cdecl
  179. CIISService::ShowWebSiteProperties(
  180. IN LPPROPERTYSHEETCALLBACK lpProvider,
  181. IN CComAuthInfo * pAuthInfo, OPTIONAL
  182. IN LPCTSTR lpszMDPath,
  183. IN CWnd * pMainWnd, OPTIONAL
  184. IN LPARAM lParam, OPTIONAL
  185. IN LONG_PTR handle OPTIONAL
  186. )
  187. /*++
  188. Routine Description:
  189. Callback function to display Web site properties.
  190. Arguments:
  191. LPPROPERTYSHEETCALLBACK lpProvider Property sheet provider
  192. CComAuthInfo * pAuthInfo COM Authentication info or NULL.
  193. LPCTSTR lpszMDPath Metabase path
  194. CWnd * pMainWnd Parent window
  195. LPARAM lParam LPARAM to pass to MMC
  196. LONG handle handle to pass to MMC
  197. Return Value:
  198. HRESULT
  199. --*/
  200. {
  201. AFX_MANAGE_STATE(::AfxGetStaticModuleState());
  202. ASSERT_PTR(lpProvider);
  203. CError err;
  204. CW3Sheet * pSheet = new CW3Sheet(
  205. pAuthInfo,
  206. lpszMDPath,
  207. 0,
  208. pMainWnd,
  209. lParam,
  210. handle
  211. );
  212. if (pSheet)
  213. {
  214. pSheet->SetModeless();
  215. pSheet->SetSheetType(pSheet->SHEET_TYPE_SITE);
  216. CIISMachine * pOwner = ((CIISMBNode *)lParam)->GetOwner();
  217. ASSERT(pOwner != NULL);
  218. BOOL bMaster = CMetabasePath::IsMasterInstance(lpszMDPath);
  219. BOOL bClient = pOwner->Has10ConnectionsLimit();
  220. BOOL bDownlevel = (pOwner->QueryMajorVersion() == 5 && pOwner->QueryMinorVersion() == 0);
  221. //
  222. // Add instance pages
  223. //
  224. if (!bClient || !bMaster)
  225. {
  226. err = AddMMCPage(lpProvider, new CW3ServicePage(pSheet));
  227. }
  228. if (!bClient)
  229. {
  230. err = AddMMCPage(lpProvider, new CW3AccountsPage(pSheet));
  231. if (bDownlevel)
  232. {
  233. if (!bMaster)
  234. {
  235. err = AddMMCPage(lpProvider, new CW3PerfPage(pSheet));
  236. }
  237. }
  238. else
  239. {
  240. err = AddMMCPage(lpProvider, new CW3PerfPage(pSheet));
  241. }
  242. }
  243. err = AddMMCPage(lpProvider, new CW3FiltersPage(pSheet));
  244. //
  245. // Add directory pages
  246. //
  247. err = AddMMCPage(lpProvider, new CW3DirectoryPage(pSheet, TRUE));
  248. err = AddMMCPage(lpProvider, new CW3DocumentsPage(pSheet));
  249. err = AddMMCPage(lpProvider, new CW3SecurityPage(pSheet, TRUE, FILE_ATTRIBUTE_VIRTUAL_DIRECTORY));
  250. err = AddMMCPage(lpProvider, new CW3HTTPPage(pSheet));
  251. err = AddMMCPage(lpProvider, new CW3ErrorsPage(pSheet));
  252. if (bMaster && pOwner->QueryMajorVersion() >= 6)
  253. {
  254. err = AddMMCPage(lpProvider, new CDefWebSitePage(pSheet));
  255. }
  256. }
  257. else
  258. {
  259. err = ERROR_NOT_ENOUGH_MEMORY;
  260. }
  261. return S_OK;
  262. }
  263. /* static */
  264. HRESULT
  265. __cdecl
  266. CIISService::ShowWebDirProperties(
  267. IN LPPROPERTYSHEETCALLBACK lpProvider,
  268. IN CComAuthInfo * pAuthInfo, OPTIONAL
  269. IN LPCTSTR lpszMDPath,
  270. IN CWnd * pMainWnd, OPTIONAL
  271. IN LPARAM lParam, OPTIONAL
  272. IN LONG_PTR handle OPTIONAL
  273. )
  274. /*++
  275. Routine Description:
  276. Callback function to display Web dir properties.
  277. Arguments:
  278. LPPROPERTYSHEETCALLBACK lpProvider Property sheet provider
  279. CComAuthInfo * pAuthInfo COM Authentication info or NULL.
  280. LPCTSTR lpszMDPath Metabase path
  281. CWnd * pMainWnd Parent window
  282. LPARAM lParam LPARAM to pass to MMC
  283. LONG handle handle to pass to MMC
  284. Return Value:
  285. HRESULT
  286. --*/
  287. {
  288. AFX_MANAGE_STATE(::AfxGetStaticModuleState());
  289. ASSERT_PTR(lpProvider);
  290. CError err;
  291. CW3Sheet * pSheet = new CW3Sheet(
  292. pAuthInfo,
  293. lpszMDPath,
  294. 0,
  295. pMainWnd,
  296. lParam,
  297. handle
  298. );
  299. if (pSheet)
  300. {
  301. pSheet->SetModeless();
  302. //
  303. // Add directory pages
  304. //
  305. pSheet->SetSheetType(pSheet->SHEET_TYPE_VDIR);
  306. err = AddMMCPage(lpProvider, new CW3DirectoryPage(pSheet, FALSE));
  307. err = AddMMCPage(lpProvider, new CW3DocumentsPage(pSheet));
  308. err = AddMMCPage(lpProvider, new CW3SecurityPage(pSheet, FALSE, FILE_ATTRIBUTE_VIRTUAL_DIRECTORY));
  309. err = AddMMCPage(lpProvider, new CW3HTTPPage(pSheet));
  310. err = AddMMCPage(lpProvider, new CW3ErrorsPage(pSheet));
  311. }
  312. else
  313. {
  314. err = ERROR_NOT_ENOUGH_MEMORY;
  315. }
  316. return err;
  317. }
  318. //
  319. // Administrable services
  320. //
  321. /* static */ CIISService::SERVICE_DEF CIISService::_rgServices[] =
  322. {
  323. {
  324. _T("MSFTPSVC"),
  325. _T("ftp://"),
  326. IDS_SVC_FTP,
  327. iFolder, // TODO: Need service bitmap
  328. iFTPSite,
  329. iFTPDir,
  330. iFolder,
  331. iFile,
  332. IIS_CLASS_FTP_SERVICE_W,
  333. IIS_CLASS_FTP_SERVER_W,
  334. IIS_CLASS_FTP_VDIR_W,
  335. &CIISService::ShowFTPSiteProperties,
  336. &CIISService::ShowFTPDirProperties,
  337. },
  338. {
  339. _T("W3SVC"),
  340. _T("http://"),
  341. IDS_SVC_WEB,
  342. iFolder, // TODO: Need service bitmap
  343. iWWWSite,
  344. iWWWDir,
  345. iFolder,
  346. iFile,
  347. IIS_CLASS_WEB_SERVICE_W,
  348. IIS_CLASS_WEB_SERVER_W,
  349. IIS_CLASS_WEB_VDIR_W,
  350. &CIISService::ShowWebSiteProperties,
  351. &CIISService::ShowWebDirProperties,
  352. },
  353. };
  354. /* static */
  355. int
  356. CIISService::ResolveServiceName(
  357. IN LPCTSTR szServiceName
  358. )
  359. /*++
  360. Routine Description:
  361. Look up the service name in the table. Return table index.
  362. Arguments:
  363. LPCTSTR szServiceName : Metabase node name
  364. Return Value:
  365. Table index or -1 if not found.
  366. --*/
  367. {
  368. int iDef = -1;
  369. //
  370. // Sequential search because we expect just a few entries
  371. //
  372. for (int i = 0; i < ARRAY_SIZE(_rgServices); ++i)
  373. {
  374. if (!::lstrcmpi(szServiceName, _rgServices[i].szNodeName))
  375. {
  376. iDef = i;
  377. break;
  378. }
  379. }
  380. return iDef;
  381. }
  382. CIISService::CIISService(
  383. IN CIISMachine * pOwner,
  384. IN LPCTSTR szServiceName
  385. )
  386. /*++
  387. Routine Description:
  388. Constructor. Determine if the given service is administrable,
  389. and resolve the details
  390. Arguments:
  391. CIISMachine * pOwner : Owner machine object
  392. LPCTSTR szServiceName : Service name
  393. Return Value:
  394. N/A
  395. --*/
  396. : CIISMBNode(pOwner, szServiceName)
  397. {
  398. m_iServiceDef = ResolveServiceName(QueryNodeName());
  399. m_fManagedService = (m_iServiceDef >= 0);
  400. m_fCanAddInstance = pOwner->CanAddInstance();
  401. if (m_fManagedService)
  402. {
  403. ASSERT(m_iServiceDef < ARRAY_SIZE(_rgServices));
  404. VERIFY(m_bstrDisplayName.LoadString(
  405. _rgServices[m_iServiceDef].nDescriptiveName
  406. ));
  407. }
  408. }
  409. /* virtual */
  410. CIISService::~CIISService()
  411. /*++
  412. Routine Description:
  413. Destructor
  414. Arguments:
  415. N/A
  416. Return Value:
  417. N/A
  418. --*/
  419. {
  420. }
  421. /* virtual */
  422. void
  423. CIISService::InitializeChildHeaders(
  424. IN LPHEADERCTRL lpHeader
  425. )
  426. /*++
  427. Routine Description:
  428. Build result view for immediate descendant type
  429. Arguments:
  430. LPHEADERCTRL lpHeader : Header control
  431. Return Value:
  432. None
  433. --*/
  434. {
  435. CIISSite::InitializeHeaders(lpHeader);
  436. }
  437. /* virtual */
  438. HRESULT
  439. CIISService::EnumerateScopePane(HSCOPEITEM hParent)
  440. /*++
  441. Routine Description:
  442. Enumerate scope child items.
  443. Arguments:
  444. HSCOPEITEM hParent : Parent console handle
  445. Return Value:
  446. HRESULT
  447. --*/
  448. {
  449. CError err;
  450. DWORD dwInstance;
  451. CString strInstance;
  452. CMetaEnumerator * pme = NULL;
  453. if (!IsAdministrator())
  454. {
  455. return err;
  456. }
  457. err = CreateEnumerator(pme);
  458. while (err.Succeeded())
  459. {
  460. CIISSite * pSite;
  461. err = pme->Next(dwInstance, strInstance);
  462. if (err.Succeeded())
  463. {
  464. TRACEEOLID("Enumerating node: " << dwInstance);
  465. if (NULL == (pSite = new CIISSite(m_pOwner, this, strInstance)))
  466. {
  467. err = ERROR_NOT_ENOUGH_MEMORY;
  468. break;
  469. }
  470. err = pSite->AddToScopePane(hParent);
  471. }
  472. }
  473. SAFE_DELETE(pme);
  474. if (err.Win32Error() == ERROR_NO_MORE_ITEMS)
  475. {
  476. err.Reset();
  477. }
  478. if (err.Failed())
  479. {
  480. DisplayError(err);
  481. }
  482. // SetInterfaceError(err);
  483. return err;
  484. }
  485. /* virtual */
  486. HRESULT
  487. CIISService::AddMenuItems(
  488. IN LPCONTEXTMENUCALLBACK lpContextMenuCallback,
  489. IN OUT long * pInsertionAllowed,
  490. IN DATA_OBJECT_TYPES type
  491. )
  492. {
  493. ASSERT_READ_PTR(lpContextMenuCallback);
  494. //
  495. // Add base menu items
  496. //
  497. HRESULT hr = CIISObject::AddMenuItems(
  498. lpContextMenuCallback,
  499. pInsertionAllowed,
  500. type
  501. );
  502. if (SUCCEEDED(hr) && m_fCanAddInstance)
  503. {
  504. ASSERT(pInsertionAllowed != NULL);
  505. if (IsAdministrator() && (*pInsertionAllowed & CCM_INSERTIONALLOWED_NEW) != 0)
  506. {
  507. AddMenuSeparator(lpContextMenuCallback);
  508. if (lstrcmpi(GetNodeName(), SZ_MBN_FTP) == 0)
  509. {
  510. AddMenuItemByCommand(lpContextMenuCallback, IDM_NEW_FTP_SITE);
  511. }
  512. else if (lstrcmpi(GetNodeName(), SZ_MBN_WEB) == 0)
  513. {
  514. AddMenuItemByCommand(lpContextMenuCallback, IDM_NEW_WEB_SITE);
  515. }
  516. }
  517. //
  518. // CODEWORK: Add new instance commands for each of the services
  519. // keeping in mind which ones are installed and all.
  520. // add that info to the table, remembering that this
  521. // is per service.
  522. //
  523. }
  524. return hr;
  525. }
  526. HRESULT
  527. CIISService::InsertNewInstance(DWORD inst)
  528. {
  529. CError err;
  530. // Now we should insert and select this new site
  531. TCHAR buf[16];
  532. CIISSite * pSite = new CIISSite(m_pOwner, this, _itot(inst, buf, 10));
  533. if (pSite != NULL)
  534. {
  535. // If service is not expanded we will get error and no effect
  536. if (!IsExpanded())
  537. {
  538. SelectScopeItem();
  539. IConsoleNameSpace2 * pConsole
  540. = (IConsoleNameSpace2 *)GetConsoleNameSpace();
  541. pConsole->Expand(QueryScopeItem());
  542. }
  543. // WAS needs some time to update status of new site as started
  544. Sleep(1000);
  545. err = pSite->AddToScopePaneSorted(QueryScopeItem(), FALSE);
  546. if (err.Succeeded())
  547. {
  548. VERIFY(SUCCEEDED(pSite->SelectScopeItem()));
  549. }
  550. }
  551. else
  552. {
  553. err = ERROR_NOT_ENOUGH_MEMORY;
  554. }
  555. return err;
  556. }
  557. HRESULT
  558. CIISService::Command(
  559. IN long lCommandID,
  560. IN CSnapInObjectRootBase * pObj,
  561. IN DATA_OBJECT_TYPES type
  562. )
  563. {
  564. AFX_MANAGE_STATE(::AfxGetStaticModuleState());
  565. HRESULT hr = S_OK;
  566. DWORD inst;
  567. switch (lCommandID)
  568. {
  569. case IDM_NEW_FTP_SITE:
  570. if (SUCCEEDED(hr = AddFTPSite(pObj, type, &inst)))
  571. {
  572. hr = InsertNewInstance(inst);
  573. }
  574. break;
  575. case IDM_NEW_WEB_SITE:
  576. if (SUCCEEDED(hr = AddWebSite(pObj, type, &inst)))
  577. {
  578. hr = InsertNewInstance(inst);
  579. }
  580. break;
  581. default:
  582. hr = CIISMBNode::Command(lCommandID, pObj, type);
  583. break;
  584. }
  585. return hr;
  586. }
  587. /* virtual */
  588. HRESULT
  589. CIISService::BuildURL(
  590. OUT CComBSTR & bstrURL
  591. ) const
  592. /*++
  593. Routine Description:
  594. Recursively build up the URL from the current node
  595. and its parents.
  596. Arguments:
  597. CComBSTR & bstrURL : Returns URL
  598. Return Value:
  599. HRESULT
  600. --*/
  601. {
  602. //
  603. // This starts off the URL
  604. //
  605. ASSERT(m_iServiceDef < ARRAY_SIZE(_rgServices));
  606. bstrURL = _rgServices[m_iServiceDef].szProtocol;
  607. return S_OK;
  608. }
  609. HRESULT
  610. CIISService::ShowSitePropertiesDlg(
  611. IN LPPROPERTYSHEETCALLBACK lpProvider,
  612. IN CComAuthInfo * pAuthInfo, OPTIONAL
  613. IN LPCTSTR lpszMDPath,
  614. IN CWnd * pMainWnd, OPTIONAL
  615. IN LPARAM lParam, OPTIONAL
  616. IN LONG_PTR handle OPTIONAL
  617. )
  618. /*++
  619. Routine Description:
  620. Display site properties dialog
  621. Arguments:
  622. LPPROPERTYSHEETCALLBACK lpProvider Property sheet provider
  623. CComAuthInfo * pAuthInfo COM Authentication info or NULL.
  624. LPCTSTR lpszMDPath Metabase path
  625. CWnd * pMainWnd Parent window
  626. LPARAM lParam LPARAM to pass to MMC
  627. LONG handle handle to pass to MMC
  628. Return Value:
  629. HRESULT
  630. --*/
  631. {
  632. AFX_MANAGE_STATE(::AfxGetStaticModuleState());
  633. ASSERT(m_iServiceDef >= 0 && m_iServiceDef < ARRAY_SIZE(_rgServices));
  634. return (*_rgServices[m_iServiceDef].pfnSitePropertiesDlg)(
  635. lpProvider,
  636. pAuthInfo,
  637. lpszMDPath,
  638. pMainWnd,
  639. lParam,
  640. handle
  641. );
  642. }
  643. HRESULT
  644. CIISService::ShowDirPropertiesDlg(
  645. IN LPPROPERTYSHEETCALLBACK lpProvider,
  646. IN CComAuthInfo * pAuthInfo, OPTIONAL
  647. IN LPCTSTR lpszMDPath,
  648. IN CWnd * pMainWnd, OPTIONAL
  649. IN LPARAM lParam, OPTIONAL
  650. IN LONG_PTR handle OPTIONAL
  651. )
  652. /*++
  653. Routine Description:
  654. Display directory properties dialog
  655. Arguments:
  656. LPPROPERTYSHEETCALLBACK lpProvider Property sheet provider
  657. CComAuthInfo * pAuthInfo COM Authentication info or NULL.
  658. LPCTSTR lpszMDPath Metabase path
  659. CWnd * pMainWnd Parent window
  660. LPARAM lParam LPARAM to pass to MMC
  661. LONG handle handle to pass to MMC
  662. Return Value:
  663. HRESULT
  664. --*/
  665. {
  666. AFX_MANAGE_STATE(::AfxGetStaticModuleState());
  667. ASSERT(m_iServiceDef >= 0 && m_iServiceDef < ARRAY_SIZE(_rgServices));
  668. return (*_rgServices[m_iServiceDef].pfnDirPropertiesDlg)(
  669. lpProvider,
  670. pAuthInfo,
  671. lpszMDPath,
  672. pMainWnd,
  673. lParam,
  674. handle
  675. );
  676. }
  677. /* virtual */
  678. HRESULT
  679. CIISService::CreatePropertyPages(
  680. IN LPPROPERTYSHEETCALLBACK lpProvider,
  681. IN LONG_PTR handle,
  682. IN IUnknown * pUnk,
  683. IN DATA_OBJECT_TYPES type
  684. )
  685. /*++
  686. Routine Description:
  687. Create the property pages for the given object
  688. Arguments:
  689. LPPROPERTYSHEETCALLBACK lpProvider : Provider
  690. LONG_PTR handle : Handle.
  691. IUnknown * pUnk,
  692. DATA_OBJECT_TYPES type
  693. Return Value:
  694. HRESULT
  695. --*/
  696. {
  697. AFX_MANAGE_STATE(::AfxGetStaticModuleState());
  698. CComBSTR bstrPath;
  699. //
  700. // CODEWORK: What to do with m_err? This might be
  701. // a bad machine object in the first place. Aborting
  702. // when the machine object has an error code isn't
  703. // such a bad solution here.
  704. //
  705. /*
  706. if (m_err.Failed())
  707. {
  708. m_err.MessageBox();
  709. return m_err;
  710. }
  711. */
  712. CError err(BuildMetaPath(bstrPath));
  713. if (err.Succeeded())
  714. {
  715. //
  716. // Show master properties
  717. //
  718. err = ShowSitePropertiesDlg(
  719. lpProvider,
  720. QueryAuthInfo(),
  721. bstrPath,
  722. GetMainWindow(),
  723. (LPARAM)this,
  724. handle
  725. );
  726. }
  727. err.MessageBoxOnFailure();
  728. return err;
  729. }