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.

2880 lines
75 KiB

  1. /*++
  2. Copyright (c) 1994-2000 Microsoft Corporation
  3. Module Name :
  4. iisobj.h
  5. Abstract:
  6. IIS Object definitions
  7. Author:
  8. Ronald Meijer (ronaldm)
  9. Sergei Antonov (sergeia)
  10. Project:
  11. Internet Services Manager
  12. Revision History:
  13. --*/
  14. #ifndef __IISOBJ_H__
  15. #define __IISOBJ_H__
  16. #include "scache.h"
  17. #include "guids.h"
  18. #include "restrictlist.h"
  19. #include "tracknet.h"
  20. BOOL IsValidAddress(const void* lp, UINT nBytes, BOOL bReadWrite = TRUE);
  21. typedef struct _GET_PROCESS_MODE_STRUCT
  22. {
  23. CComAuthInfo * pComAuthInfo;
  24. DWORD dwProcessMode;
  25. DWORD dwReturnStatus;
  26. } GET_PROCESS_MODE_STRUCT;
  27. #define RES_TASKPAD_NEWVROOT _T("/img\\newvroot.gif")
  28. #define RES_TASKPAD_NEWSITE _T("/img\\newsite.gif")
  29. #define RES_TASKPAD_SECWIZ _T("/img\\secwiz.gif")
  30. //
  31. // Image background colour for the toolbar buttons
  32. //
  33. //#define RGB_BK_IMAGES (RGB(255,0,255)) // purple
  34. //
  35. // Forward Definitions
  36. //
  37. class CIISRoot;
  38. class CIISMachine;
  39. class CIISService;
  40. class CIISFileName;
  41. class CAppPoolsContainer;
  42. class CWebServiceExtensionContainer;
  43. enum
  44. {
  45. PROP_CHANGE_NO_UPDATE = 0,
  46. PROP_CHANGE_NOT_VISIBLE = 1,
  47. PROP_CHANGE_DISPLAY_ONLY = 2,
  48. PROP_CHANGE_REENUM_VDIR = 4,
  49. PROP_CHANGE_REENUM_FILES = 8
  50. };
  51. // used to be pack(4) but that didn't work on ia64, changed to pack(8) to make it work
  52. #pragma pack(8)
  53. class CIISObject : public CSnapInItemImpl<CIISObject>
  54. /*++
  55. Class Description:
  56. Base IIS object
  57. Public Interface:
  58. --*/
  59. {
  60. protected:
  61. //
  62. // Menu Commands, listed in toolbar order.
  63. //
  64. // IMPORTANT! -- this must be kept in sync with MenuItemDefs
  65. // in iisobj.cpp
  66. //
  67. enum
  68. {
  69. IDM_INVALID, /* invalid command ID */
  70. IDM_CONNECT,
  71. IDM_DISCOVER,
  72. IDM_START,
  73. IDM_STOP,
  74. IDM_PAUSE,
  75. /**/
  76. IDM_TOOLBAR /* Toolbar commands start here */
  77. };
  78. //
  79. // Additional menu commands that do not show up in the toolbar
  80. //
  81. enum
  82. {
  83. IDM_EXPLORE = IDM_TOOLBAR,
  84. IDM_OPEN,
  85. IDM_BROWSE,
  86. IDM_RECYCLE,
  87. IDM_PERMISSION,
  88. #if defined(_DEBUG) || DBG
  89. IDM_IMPERSONATE,
  90. IDM_REMOVE_IMPERSONATION,
  91. #endif // _DEBUG
  92. IDM_CONFIGURE,
  93. IDM_DISCONNECT,
  94. IDM_METABACKREST,
  95. IDM_SHUTDOWN,
  96. IDM_SAVE_DATA,
  97. IDM_NEW_VROOT,
  98. IDM_NEW_INSTANCE,
  99. IDM_NEW_FTP_SITE,
  100. IDM_NEW_FTP_SITE_FROM_FILE,
  101. IDM_NEW_FTP_VDIR,
  102. IDM_NEW_FTP_VDIR_FROM_FILE,
  103. IDM_NEW_WEB_SITE,
  104. IDM_NEW_WEB_SITE_FROM_FILE,
  105. IDM_NEW_WEB_VDIR,
  106. IDM_NEW_WEB_VDIR_FROM_FILE,
  107. IDM_NEW_APP_POOL,
  108. IDM_NEW_APP_POOL_FROM_FILE,
  109. IDM_VIEW_TASKPAD,
  110. IDM_TASK_EXPORT_CONFIG_WIZARD,
  111. IDM_WEBEXT_CONTAINER_ADD1,
  112. IDM_WEBEXT_CONTAINER_ADD2,
  113. IDM_WEBEXT_CONTAINER_PROHIBIT_ALL,
  114. IDM_WEBEXT_ALLOW,
  115. IDM_WEBEXT_PROHIBIT,
  116. // IDM_SERVICE_START,
  117. // IDM_SERVICE_STOP,
  118. // IDM_SERVICE_ENABLE,
  119. //
  120. // Don't move this last one -- it will be used
  121. // as an offset for service specific new instance
  122. // commands
  123. //
  124. IDM_NEW_EX_INSTANCE
  125. };
  126. protected:
  127. //
  128. // Sort Weights for CIISObject derived classes
  129. //
  130. enum
  131. {
  132. SW_ROOT,
  133. SW_MACHINE,
  134. SW_APP_POOLS,
  135. SW_SERVICE,
  136. SW_WEBSVCEXTS,
  137. SW_SITE,
  138. SW_VDIR,
  139. SW_DIR,
  140. SW_FILE,
  141. SW_APP_POOL,
  142. SW_WEBSVCEXT
  143. };
  144. //
  145. // Statics
  146. //
  147. public:
  148. static HRESULT SetImageList(LPIMAGELIST lpImageList);
  149. protected:
  150. static CComBSTR _bstrResult;
  151. //
  152. // Bitmap indices
  153. //
  154. protected:
  155. enum
  156. {
  157. iIISRoot = 0,
  158. iLocalMachine,
  159. iMachine,
  160. iFolder,
  161. iFolderStop,
  162. iFile,
  163. iError,
  164. iLocalMachineErr,
  165. iMachineErr,
  166. iFTPSiteErr,
  167. iWWWSiteErr,
  168. iApplicationErr,
  169. iWWWDir,
  170. iWWWDirErr,
  171. iFTPDir,
  172. iFTPDirErr,
  173. iWWWSite,
  174. iWWWSiteStop,
  175. iFTPSite,
  176. iFTPSiteStop,
  177. iApplication,
  178. iAppPool,
  179. iAppPoolStop,
  180. iAppPoolErr,
  181. iWebSvcGear,
  182. iWebSvcGearPlus,
  183. iWebSvcFilter,
  184. iWebSvcFilterPlus
  185. };
  186. protected:
  187. //
  188. // Menu item definition that uses resource definitions, and
  189. // provides some additional information for taskpads. This is replacement
  190. // for MMC structure CONTEXTMENUITEM defined in mmc.h
  191. //
  192. typedef struct tagCONTEXTMENUITEM_RC
  193. {
  194. UINT nNameID;
  195. UINT nStatusID;
  196. UINT nDescriptionID;
  197. LONG lCmdID;
  198. LONG lInsertionPointID;
  199. LONG fSpecialFlags;
  200. LPCTSTR lpszMouseOverBitmap;
  201. LPCTSTR lpszMouseOffBitmap;
  202. LPCTSTR lpszLanguageIndenpendentID;
  203. }
  204. CONTEXTMENUITEM_RC;
  205. static CONTEXTMENUITEM_RC _menuItemDefs[];
  206. //
  207. // Constructor/Destructor
  208. //
  209. public:
  210. CIISObject();
  211. void AddRef()
  212. {
  213. InterlockedIncrement(&m_use_count);
  214. }
  215. void Release()
  216. {
  217. InterlockedDecrement(&m_use_count);
  218. if (m_use_count <= 0)
  219. {
  220. delete this;
  221. }
  222. }
  223. int UseCount() {return m_use_count;}
  224. void SetConsoleData(IConsoleNameSpace * pConsoleNameSpace,IConsole * pConsole)
  225. {
  226. _lpConsoleNameSpace = pConsoleNameSpace;
  227. _lpConsole = pConsole;
  228. }
  229. protected:
  230. virtual ~CIISObject();
  231. private:
  232. LONG m_use_count;
  233. //
  234. // Interface:
  235. //
  236. public:
  237. virtual void * GetNodeType()
  238. {
  239. return (void *)&cInternetRootNode;
  240. }
  241. void * GetDisplayName()
  242. {
  243. return (void *)QueryDisplayName();
  244. }
  245. CIISObject * GetMachineObject() {return m_pMachineObject;}
  246. STDMETHOD(GetScopePaneInfo)(LPSCOPEDATAITEM lpScopeDataItem);
  247. STDMETHOD(GetResultPaneInfo)(LPRESULTDATAITEM lpResultDataItem);
  248. STDMETHOD(GetResultViewType)(LPOLESTR *lplpViewType, long * lpViewOptions);
  249. virtual LPOLESTR GetResultPaneColInfo(int nCol);
  250. virtual void InitializeChildHeaders(LPHEADERCTRL lpHeader) {}
  251. virtual HRESULT SetToolBarStates(CComPtr<IToolbar> lpToolBar);
  252. virtual HRESULT RenameItem(LPOLESTR new_name) {return S_OK;}
  253. virtual HRESULT GetContextHelp(CString& strHtmlPage);
  254. STDMETHOD (FillData)(CLIPFORMAT cf, LPSTREAM pStream);
  255. STDMETHOD (FillCustomData)(CLIPFORMAT cf, LPSTREAM pStream);
  256. virtual LPOLESTR QueryDisplayName() = 0;
  257. virtual int QueryImage() const = 0;
  258. //
  259. // Comparison methods
  260. //
  261. virtual int CompareScopeItem(CIISObject * pObject);
  262. virtual int CompareResultPaneItem(CIISObject * pObject, int nCol);
  263. void DoRunOnce(
  264. IN MMC_NOTIFY_TYPE event,
  265. IN LPARAM arg,
  266. IN LPARAM param
  267. );
  268. STDMETHOD(Notify)(
  269. MMC_NOTIFY_TYPE event,
  270. LPARAM arg,
  271. LPARAM param,
  272. IComponentData * pComponentData,
  273. IComponent * pComponent,
  274. DATA_OBJECT_TYPES type
  275. );
  276. STDMETHOD(AddMenuItems)(
  277. LPCONTEXTMENUCALLBACK piCallback,
  278. long * pInsertionAllowed,
  279. DATA_OBJECT_TYPES type
  280. );
  281. STDMETHOD(Command)(
  282. long lCommandID,
  283. CSnapInObjectRootBase * pObj,
  284. DATA_OBJECT_TYPES type
  285. );
  286. STDMETHOD(ControlbarNotify)(MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param);
  287. //
  288. // IExtendPropertySheet methods
  289. //
  290. STDMETHOD(CreatePropertyPages)(
  291. LPPROPERTYSHEETCALLBACK lpProvider,
  292. LONG_PTR handle,
  293. IUnknown * pUnk,
  294. DATA_OBJECT_TYPES type
  295. );
  296. STDMETHOD(QueryPagesFor)(DATA_OBJECT_TYPES type);
  297. //
  298. // Access
  299. //
  300. public:
  301. //
  302. // Type Functions
  303. //
  304. virtual BOOL IsControllable() const { return FALSE; }
  305. virtual BOOL IsPausable() const { return FALSE; }
  306. virtual BOOL IsConfigurable() const { return FALSE; }
  307. virtual BOOL IsDeletable() const { return FALSE; }
  308. virtual BOOL IsRefreshable() const { return FALSE; }
  309. virtual BOOL IsConnectable() const { return FALSE; }
  310. virtual BOOL IsDisconnectable() const { return FALSE; }
  311. virtual BOOL IsLeafNode() const { return FALSE; }
  312. virtual BOOL HasFileSystemFiles() const { return FALSE; }
  313. virtual LPCTSTR GetKeyType(LPCTSTR path = NULL) const { return _T(""); }
  314. virtual BOOL IsConfigFlushable() const { return FALSE; }
  315. virtual BOOL IsConfigImportExportable() const { return FALSE; }
  316. //
  317. // State Functions
  318. //
  319. virtual BOOL IsRunning() const { return FALSE; }
  320. virtual BOOL IsStopped() const { return FALSE; }
  321. virtual BOOL IsPaused() const { return FALSE; }
  322. virtual BOOL IsRenamable() const { return FALSE; }
  323. virtual BOOL IsClonable() const { return FALSE; }
  324. virtual BOOL IsBrowsable() const { return FALSE; }
  325. virtual BOOL IsExplorable() const { return FALSE; }
  326. virtual BOOL IsOpenable() const { return FALSE; }
  327. virtual BOOL IsPermissionable() const { return FALSE; }
  328. virtual BOOL HasResultItems(IResultData * pResult) const
  329. {
  330. return FALSE;
  331. }
  332. //
  333. // Assumed Functions
  334. //
  335. public:
  336. virtual BOOL IsStartable() const { return IsControllable() && !IsRunning(); }
  337. virtual BOOL IsStoppable() const { return IsControllable() && (IsRunning() || IsPaused() ); }
  338. public:
  339. BOOL IsExpanded() const;
  340. CIISObject * FindIdenticalScopePaneItem(CIISObject * pObject);
  341. HSCOPEITEM QueryScopeItem() const { return m_hScopeItem; }
  342. void ResetScopeItem() { m_hScopeItem = 0; }
  343. void ResetResultItem() { m_hResultItem = 0; }
  344. HSCOPEITEM QueryResultItem() const { return m_hResultItem; }
  345. HRESULT AskForAndAddMachine();
  346. void SetMyPropertySheetOpen(HWND hwnd) {m_hwnd = hwnd; }
  347. HWND IsMyPropertySheetOpen() const { return m_hwnd; }
  348. HRESULT AddToScopePane(
  349. HSCOPEITEM hRelativeID,
  350. BOOL fChild = TRUE,
  351. BOOL fNext = TRUE,
  352. BOOL fIsParent = TRUE
  353. );
  354. HRESULT AddToScopePaneSorted(HSCOPEITEM hParent, BOOL fIsParent = TRUE);
  355. HRESULT RefreshDisplay(BOOL bRefreshToolBar = TRUE);
  356. HRESULT SetCookie();
  357. void SetScopeItem(HSCOPEITEM hItem)
  358. {
  359. #if defined(_DEBUG) || DBG
  360. // cWebServiceExtension will reset m_hScopeItem
  361. ASSERT( IsEqualGUID(* (GUID *) GetNodeType(),cWebServiceExtension) ? TRUE : m_hScopeItem == 0);
  362. #endif
  363. m_hScopeItem = hItem;
  364. }
  365. virtual HRESULT OnDblClick(IComponentData * pcd, IComponent * pc);
  366. HRESULT SelectScopeItem();
  367. virtual HRESULT RemoveScopeItem();
  368. void SetResultItem(HRESULTITEM hItem)
  369. {
  370. #if defined(_DEBUG) || DBG
  371. // cWebServiceExtension will reset m_hResultItem
  372. ASSERT( IsEqualGUID(* (GUID *) GetNodeType(),cWebServiceExtension) ? TRUE : m_hResultItem == 0);
  373. #endif
  374. m_hResultItem = hItem;
  375. }
  376. virtual int QuerySortWeight() const = 0;
  377. IConsoleNameSpace * GetConsoleNameSpace();
  378. IConsole * GetConsole();
  379. virtual HRESULT OnViewChange(BOOL fScope, IResultData * pResult, IHeaderCtrl * pHeader, DWORD hint)
  380. {
  381. return S_OK;
  382. }
  383. // Tag is created when propertypage is open
  384. // tries to uniquely mark the item based on what it is representing
  385. // thus if you matched another items Tag with this tag and it matched
  386. // you would know that the item you are pointing to is really the same item.
  387. virtual CreateTag(){m_strTag = _T("");}
  388. //
  389. // Event Handlers
  390. //
  391. protected:
  392. virtual HRESULT EnumerateResultPane(BOOL fExpand, IHeaderCtrl * lpHeader,
  393. IResultData * lpResultData, BOOL fForRefresh = FALSE);
  394. virtual HRESULT CleanResult(IResultData * pResultData)
  395. {
  396. return S_OK;
  397. }
  398. virtual HRESULT EnumerateScopePane(HSCOPEITEM hParent) { return S_OK; }
  399. virtual HRESULT DeleteChildObjects(HSCOPEITEM hParent);
  400. virtual HRESULT RemoveChildren(HSCOPEITEM hParent);
  401. virtual HRESULT Refresh(BOOL fReEnumerate = TRUE) { return S_OK; }
  402. virtual HRESULT AddImages(LPIMAGELIST lpImageList);
  403. virtual HRESULT SetStandardVerbs(LPCONSOLEVERB lpConsoleVerb);
  404. virtual CIISRoot * GetRoot();
  405. virtual HRESULT DeleteNode(IResultData * pResult);
  406. virtual HRESULT ChangeVisibleColumns(MMC_VISIBLE_COLUMNS * pCol);
  407. virtual HRESULT ForceReportMode(IResultData * pResult) const { return S_OK; };
  408. static HRESULT AddMMCPage(
  409. LPPROPERTYSHEETCALLBACK lpProvider,
  410. CPropertyPage * pPage
  411. );
  412. protected:
  413. //
  414. // Add Menu Command helpers
  415. //
  416. static HRESULT AddMenuSeparator(
  417. LPCONTEXTMENUCALLBACK lpContextMenuCallback,
  418. LONG lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_TOP
  419. );
  420. static HRESULT AddMenuItemByCommand(
  421. LPCONTEXTMENUCALLBACK lpContextMenuCallback,
  422. LONG lCmdID,
  423. LONG fFlags = 0
  424. );
  425. //
  426. // Create result view helper
  427. //
  428. static void BuildResultView(
  429. LPHEADERCTRL pHeader,
  430. int cColumns,
  431. int * pnIDS,
  432. int * pnWidths
  433. );
  434. protected:
  435. HSCOPEITEM m_hScopeItem;
  436. HRESULTITEM m_hResultItem;
  437. BOOL m_fSkipEnumResult;
  438. public:
  439. static const GUID * m_NODETYPE;
  440. static const OLECHAR * m_SZNODETYPE;
  441. static const OLECHAR * m_SZDISPLAY_NAME;
  442. static const CLSID * m_SNAPIN_CLASSID;
  443. BOOL m_fIsExtension;
  444. DWORD m_UpdateFlag;
  445. BOOL m_fFlaggedForDeletion;
  446. HWND m_hwnd;
  447. LONG_PTR m_ppHandle;
  448. CString m_strTag;
  449. CIISObject * m_pMachineObject;
  450. public:
  451. static CWnd * GetMainWindow(IConsole * pConsole);
  452. // for extended view
  453. virtual HRESULT GetProperty(LPDATAOBJECT pDataObject,BSTR szPropertyName,BSTR* pbstrProperty);
  454. CComPtr<IConsole> _lpConsole;
  455. CComPtr<IConsoleNameSpace> _lpConsoleNameSpace;
  456. protected:
  457. static IToolbar * _lpToolBar;
  458. static CComPtr<IComponent> _lpComponent;
  459. static CComPtr<IComponentData> _lpComponentData;
  460. static CComBSTR _bstrLocalHost;
  461. public:
  462. static CLIPFORMAT m_CCF_MachineName;
  463. static CLIPFORMAT m_CCF_MyComputMachineName;
  464. static CLIPFORMAT m_CCF_Service;
  465. static CLIPFORMAT m_CCF_Instance;
  466. static CLIPFORMAT m_CCF_ParentPath;
  467. static CLIPFORMAT m_CCF_Node;
  468. static CLIPFORMAT m_CCF_MetaPath;
  469. static void Init()
  470. {
  471. m_CCF_MachineName = (CLIPFORMAT)RegisterClipboardFormat(ISM_SNAPIN_MACHINE_NAME);
  472. m_CCF_MyComputMachineName = (CLIPFORMAT)RegisterClipboardFormat(MYCOMPUT_MACHINE_NAME);
  473. m_CCF_Service = (CLIPFORMAT)RegisterClipboardFormat(ISM_SNAPIN_SERVICE);
  474. m_CCF_Instance = (CLIPFORMAT)RegisterClipboardFormat(ISM_SNAPIN_INSTANCE);
  475. m_CCF_ParentPath = (CLIPFORMAT)RegisterClipboardFormat(ISM_SNAPIN_PARENT_PATH);
  476. m_CCF_Node = (CLIPFORMAT)RegisterClipboardFormat(ISM_SNAPIN_NODE);
  477. m_CCF_MetaPath = (CLIPFORMAT)RegisterClipboardFormat(ISM_SNAPIN_META_PATH);
  478. }
  479. };
  480. typedef CList<CIISObject *, CIISObject *&> CIISObjectList;
  481. _declspec( selectany ) CLIPFORMAT CIISObject::m_CCF_MachineName = 0;
  482. _declspec( selectany ) CLIPFORMAT CIISObject::m_CCF_MyComputMachineName = 0;
  483. _declspec( selectany ) CLIPFORMAT CIISObject::m_CCF_Service = 0;
  484. _declspec( selectany ) CLIPFORMAT CIISObject::m_CCF_Instance = 0;
  485. _declspec( selectany ) CLIPFORMAT CIISObject::m_CCF_ParentPath = 0;
  486. _declspec( selectany ) CLIPFORMAT CIISObject::m_CCF_Node = 0;
  487. _declspec( selectany ) CLIPFORMAT CIISObject::m_CCF_MetaPath = 0;
  488. class CIISRoot : public CIISObject
  489. {
  490. //
  491. // Constructor/Destructor
  492. //
  493. public:
  494. CIISRoot();
  495. protected:
  496. virtual ~CIISRoot();
  497. //
  498. // Interface
  499. //
  500. public:
  501. virtual void InitializeChildHeaders(LPHEADERCTRL lpHeader);
  502. virtual HRESULT EnumerateScopePane(HSCOPEITEM hParent);
  503. virtual LPOLESTR GetResultPaneColInfo(int nCol);
  504. virtual HRESULT DeleteChildObjects(HSCOPEITEM hParent);
  505. //
  506. // Access
  507. //
  508. public:
  509. virtual BOOL IsConnectable() const
  510. {
  511. return !IsExtension();
  512. }
  513. virtual LPOLESTR QueryDisplayName() { return m_bstrDisplayName; }
  514. virtual int QueryImage() const { return iIISRoot; }
  515. virtual int QuerySortWeight() const { return SW_ROOT; }
  516. virtual void * GetNodeType()
  517. {
  518. return (void *)&cInternetRootNode;
  519. }
  520. STDMETHOD (FillCustomData)(CLIPFORMAT cf, LPSTREAM pStream);
  521. BOOL IsExtension() const
  522. {
  523. return m_fIsExtension;
  524. }
  525. public:
  526. CIISServerCache m_scServers;
  527. HRESULT InitAsExtension(IDataObject * pDataObject);
  528. HRESULT ResetAsExtension();
  529. virtual CreateTag(){m_strTag = _T("CIISRoot");}
  530. protected:
  531. virtual CIISRoot * GetRoot() { return this; }
  532. HRESULT EnumerateScopePaneExt(HSCOPEITEM hParent);
  533. protected:
  534. CComBSTR m_bstrDisplayName;
  535. static OLECHAR * m_SZNODETYPE;
  536. // we are using this machine name and pointer
  537. // only for extension case
  538. CIISMachine * m_pMachine;
  539. CString m_ExtMachineName;
  540. BOOL m_fRootAdded;
  541. };
  542. typedef CList<CIISFileName *, CIISFileName *&> ResultItemsList;
  543. typedef struct _ResultViewEntry
  544. {
  545. LONG_PTR _ResultData;
  546. ResultItemsList * _ResultItems;
  547. struct _ResultViewEntry& operator =(struct _ResultViewEntry& e)
  548. {
  549. _ResultData = e._ResultData;
  550. _ResultItems = e._ResultItems;
  551. return *this;
  552. }
  553. } ResultViewEntry;
  554. class CIISMBNode : public CIISObject
  555. /*++
  556. Class Description:
  557. Metabase node class
  558. Public Interface:
  559. --*/
  560. {
  561. //
  562. // Constructor/Destructor
  563. //
  564. public:
  565. CIISMBNode(CIISMachine * pOwner, LPCTSTR szNode);
  566. protected:
  567. ~CIISMBNode();
  568. //
  569. // Access
  570. //
  571. public:
  572. LPOLESTR QueryNodeName() const { return m_bstrNode; }
  573. CComBSTR & GetNodeName() { return m_bstrNode; }
  574. virtual LPOLESTR QueryMachineName() const;
  575. virtual CComAuthInfo * QueryAuthInfo();
  576. virtual CMetaInterface * QueryInterface();
  577. virtual BOOL IsLocal() const;
  578. virtual BOOL HasInterface() const;
  579. virtual BOOL HasResultItems(IResultData * pResult) const
  580. {
  581. POSITION pos = m_ResultViewList.GetHeadPosition();
  582. while (pos != NULL)
  583. {
  584. ResultViewEntry e = m_ResultViewList.GetNext(pos);
  585. if (e._ResultData == (DWORD_PTR)pResult)
  586. {
  587. return !e._ResultItems->IsEmpty();
  588. }
  589. }
  590. return FALSE;
  591. }
  592. virtual HRESULT CreateInterface(BOOL fShowError);
  593. virtual HRESULT AssureInterfaceCreated(BOOL fShowError);
  594. virtual void SetInterfaceError(HRESULT hr);
  595. BOOL OnLostInterface(CError & err);
  596. BOOL IsLostInterface(CError & err) const;
  597. BOOL IsAdministrator() const;
  598. WORD QueryMajorVersion() const;
  599. WORD QueryMinorVersion() const;
  600. CIISMachine * GetOwner() {return m_pOwner;}
  601. //
  602. // Interface:
  603. //
  604. public:
  605. void DisplayError(CError & err, HWND hWnd = NULL) const;
  606. virtual BOOL IsRefreshable() const { return TRUE; }
  607. virtual HRESULT RefreshData() { return S_OK; }
  608. virtual HRESULT Refresh(BOOL fReEnumerate = TRUE);
  609. virtual HRESULT OnDblClick(IComponentData * pcd, IComponent * pc)
  610. {
  611. return CIISObject::OnDblClick(pcd, pc);
  612. }
  613. virtual HRESULT RenameItem(LPOLESTR new_name)
  614. {
  615. ASSERT(IsRenamable());
  616. return S_OK;
  617. }
  618. STDMETHOD (FillCustomData)(CLIPFORMAT cf, LPSTREAM pStream);
  619. STDMETHOD (CreatePropertyPages)(
  620. LPPROPERTYSHEETCALLBACK lpProvider,
  621. LONG_PTR handle,
  622. IUnknown * pUnk,
  623. DATA_OBJECT_TYPES type
  624. );
  625. virtual void * GetNodeType()
  626. {
  627. // We really shouldn't be here
  628. return CIISObject::GetNodeType();
  629. }
  630. virtual HRESULT OnViewChange(BOOL fScope, IResultData * pResult, IHeaderCtrl * pHeader, DWORD hint);
  631. public:
  632. //
  633. // Build metabase path
  634. //
  635. virtual HRESULT BuildMetaPath(CComBSTR & bstrPath) const;
  636. //
  637. // Build URL
  638. //
  639. virtual HRESULT BuildURL(CComBSTR & bstrURL) const;
  640. virtual CreateTag();
  641. CIISMBNode * GetParentNode() const;
  642. HRESULT RemoveResultNode(CIISMBNode * pNode, IResultData * pResult);
  643. protected:
  644. HRESULT EnumerateResultPane_(
  645. BOOL fExpand,
  646. IHeaderCtrl * lpHeader,
  647. IResultData * lpResultData,
  648. CIISService * pService
  649. );
  650. virtual HRESULT CleanResult(IResultData * pResultData);
  651. HRESULT CreateEnumerator(CMetaEnumerator *& pEnum);
  652. HRESULT EnumerateVDirs(HSCOPEITEM hParent, CIISService * pService, BOOL bDisplayError = TRUE);
  653. HRESULT EnumerateWebDirs(HSCOPEITEM hParent, CIISService * pService);
  654. HRESULT AddFTPSite(
  655. const CSnapInObjectRootBase * pObj,
  656. DATA_OBJECT_TYPES type,
  657. DWORD * inst
  658. );
  659. HRESULT AddFTPVDir(
  660. const CSnapInObjectRootBase * pObj,
  661. DATA_OBJECT_TYPES type,
  662. CString& alias
  663. );
  664. HRESULT AddWebSite(
  665. const CSnapInObjectRootBase * pObj,
  666. DATA_OBJECT_TYPES type,
  667. DWORD * inst,
  668. DWORD version_major,
  669. DWORD version_minor
  670. );
  671. HRESULT AddWebVDir(
  672. const CSnapInObjectRootBase * pObj,
  673. DATA_OBJECT_TYPES type,
  674. CString& alias,
  675. DWORD version_major,
  676. DWORD version_minor
  677. );
  678. HRESULT AddAppPool(
  679. const CSnapInObjectRootBase * pObj,
  680. DATA_OBJECT_TYPES type,
  681. CAppPoolsContainer * pCont,
  682. CString& name
  683. );
  684. BOOL GetPhysicalPath(
  685. LPCTSTR metaPath,
  686. CString & alias,
  687. CString &physPath);
  688. protected:
  689. STDMETHOD(GetResultViewType)(LPOLESTR *lplpViewType, long * lpViewOptions);
  690. STDMETHOD(Command)(
  691. long lCommandID,
  692. CSnapInObjectRootBase * pObj,
  693. DATA_OBJECT_TYPES type
  694. );
  695. virtual HRESULT DeleteNode(IResultData * pResult);
  696. //
  697. // Helpers
  698. //
  699. protected:
  700. void SetErrorOverrides(CError & err, BOOL fShort = FALSE) const;
  701. LPCTSTR BuildPhysicalPath(CString & strPhysicalPath) const;
  702. ResultItemsList * AddResultItems(IResultData * pResultData);
  703. // ResultItemsList * FindResultItems(IResultData * pResultData);
  704. protected:
  705. static LPOLESTR _cszSeparator;
  706. static CComBSTR _bstrRedirectPathBuf;
  707. protected:
  708. CComBSTR m_bstrNode;
  709. CComBSTR m_bstrURL;
  710. CString m_strRedirectPath;
  711. CIISMachine * m_pOwner;
  712. CList<ResultViewEntry, ResultViewEntry&> m_ResultViewList;
  713. };
  714. typedef CList<CIISMBNode *, CIISMBNode *&> CIISMBNodeList;
  715. class CIISMachine : public CIISMBNode
  716. /*++
  717. Class Description:
  718. IIS Machine object. This is the object that owns the interface.
  719. Public Interface:
  720. --*/
  721. {
  722. //
  723. // Constructor/Destructor
  724. //
  725. public:
  726. CIISMachine(
  727. IConsoleNameSpace * pConsoleNameSpace,
  728. IConsole * pConsole,
  729. CComAuthInfo * pAuthInfo = NULL,
  730. CIISRoot * pRoot = NULL);
  731. protected:
  732. virtual ~CIISMachine();
  733. //
  734. // Access
  735. //
  736. public:
  737. static DWORD WINAPI GetProcessModeThread(LPVOID pInfo);
  738. BOOL GetProcessMode(GET_PROCESS_MODE_STRUCT * pMyStructOfInfo);
  739. virtual BOOL IsConnectable() const
  740. {
  741. return (m_pRootExt == NULL);
  742. }
  743. virtual BOOL IsDisconnectable() const
  744. {
  745. return (m_pRootExt == NULL);
  746. }
  747. virtual BOOL IsConfigurable() const
  748. {
  749. // bug:667856 should allow mimemaps for iis6 and iis5, but not for iis5.1. and not for anything before iis5
  750. return
  751. (
  752. IsAdministrator() &&
  753. (
  754. (QueryMajorVersion() >= 6) ||
  755. ((QueryMajorVersion() == 5) && (QueryMinorVersion() == 0))
  756. ));
  757. }
  758. virtual BOOL IsBrowsable() const { return TRUE; }
  759. virtual BOOL IsConfigFlushable() const
  760. {
  761. return (QueryMajorVersion() >= 6);
  762. }
  763. virtual LPOLESTR QueryDisplayName();
  764. virtual LPOLESTR GetResultPaneColInfo(int nCol);
  765. virtual int QueryImage() const;
  766. virtual int CompareScopeItem(CIISObject * pObject);
  767. virtual LPCTSTR GetKeyType(LPCTSTR path = NULL) const { return IIS_CLASS_COMPUTER_W; }
  768. virtual LPOLESTR QueryMachineName() const { return QueryServerName(); }
  769. virtual CComAuthInfo * QueryAuthInfo() { return &m_auth; }
  770. virtual CMetaInterface * QueryInterface() { return m_pInterface; }
  771. virtual BOOL HasInterface() const { return m_pInterface != NULL; }
  772. virtual BOOL IsLocal() const { return m_auth.IsLocal(); }
  773. BOOL IsLocalHost();
  774. virtual HRESULT CreateInterface(BOOL fShowError);
  775. virtual HRESULT AssureInterfaceCreated(BOOL fShowError);
  776. virtual void SetInterfaceError(HRESULT hr);
  777. HRESULT CheckCapabilities();
  778. HRESULT Impersonate(LPCTSTR szUserName, LPCTSTR szPassword);
  779. void RemoveImpersonation();
  780. BOOL HasAdministratorAccess()
  781. {
  782. return m_fIsAdministrator;
  783. }
  784. void StorePassword(LPCTSTR szPassword);
  785. BOOL ResolvePasswordFromCache();
  786. BOOL ResolveCredentials();
  787. BOOL HandleAccessDenied(CError & err);
  788. BOOL SetCacheDirty();
  789. BOOL UsesImpersonation() const { return m_auth.UsesImpersonation(); }
  790. BOOL PasswordEntered() const { return m_fPasswordEntered; }
  791. BOOL CanAddInstance() const { return m_fCanAddInstance; }
  792. BOOL Has10ConnectionsLimit() const { return m_fHas10ConnectionsLimit; }
  793. BOOL IsWorkstation() const { return m_fIsWorkstation; }
  794. BOOL IsPerformanceConfigurable() const { return m_fIsPerformanceConfigurable; }
  795. BOOL IsServiceLevelConfigurable() const { return m_fIsServiceLevelConfigurable; }
  796. WORD QueryMajorVersion() const { return LOWORD(m_dwVersion); }
  797. WORD QueryMinorVersion() const { return HIWORD(m_dwVersion); }
  798. LPOLESTR QueryServerName() const { return m_auth.QueryServerName(); }
  799. LPOLESTR QueryUserName() const { return m_auth.QueryUserName(); }
  800. LPOLESTR QueryPassword() const { return m_auth.QueryPassword(); }
  801. CAppPoolsContainer * QueryAppPoolsContainer() { return m_pAppPoolsContainer; }
  802. CWebServiceExtensionContainer * QueryWebSvcExtContainer() { return m_pWebServiceExtensionContainer; }
  803. virtual CreateTag() {m_strTag = QueryDisplayName();}
  804. virtual void * GetNodeType()
  805. {
  806. return (void *)&cMachineNode;
  807. }
  808. STDMETHOD(AddMenuItems)(
  809. LPCONTEXTMENUCALLBACK piCallback,
  810. long * pInsertionAllowed,
  811. DATA_OBJECT_TYPES type
  812. );
  813. STDMETHOD(Command)(
  814. long lCommandID,
  815. CSnapInObjectRootBase * pObj,
  816. DATA_OBJECT_TYPES type
  817. );
  818. STDMETHOD(CreatePropertyPages)(
  819. LPPROPERTYSHEETCALLBACK lpProvider,
  820. LONG_PTR handle,
  821. IUnknown * pUnk,
  822. DATA_OBJECT_TYPES type
  823. );
  824. STDMETHOD(GetResultViewType)(LPOLESTR *lplpViewType, long * lpViewOptions);
  825. DWORD GetMetabaseSystemChangeNumber()
  826. {
  827. return m_dwMetabaseSystemChangeNumber;
  828. }
  829. HRESULT RefreshMetabaseSystemChangeNumber();
  830. protected:
  831. void SetDisplayName();
  832. HRESULT OnMetaBackRest();
  833. HRESULT OnShutDown();
  834. HRESULT OnSaveData();
  835. HRESULT OnDisconnect();
  836. HRESULT InsertNewInstance(DWORD inst);
  837. //
  838. // Events
  839. //
  840. public:
  841. virtual HRESULT BuildMetaPath(CComBSTR & bstrPath) const;
  842. virtual HRESULT BuildURL(CComBSTR & bstrURL) const;
  843. public:
  844. virtual HRESULT EnumerateScopePane(HSCOPEITEM hParent);
  845. virtual HRESULT RemoveScopeItem();
  846. virtual HRESULT RefreshData();
  847. virtual int QuerySortWeight() const { return SW_MACHINE; }
  848. virtual HRESULT DeleteChildObjects(HSCOPEITEM hParent);
  849. virtual HRESULT DeleteNode(IResultData * pResult) {return S_OK;}
  850. //
  851. // Public Interface:
  852. //
  853. public:
  854. virtual void InitializeChildHeaders(LPHEADERCTRL lpHeader);
  855. static void InitializeHeaders(LPHEADERCTRL lpHeader);
  856. static HRESULT VerifyMachine(CIISMachine *& pMachine);
  857. //
  858. // Stream handlers
  859. //
  860. public:
  861. static HRESULT ReadFromStream(IStream * pStg, CIISMachine ** ppMachine, IConsoleNameSpace * pConsoleNameSpace,IConsole * pConsole);
  862. HRESULT WriteToStream(IStream * pStgSave);
  863. HRESULT InitializeFromStream(IStream * pStg);
  864. DWORD m_dwMetabaseSystemChangeNumber;
  865. CWNetConnectionTracker m_MachineWNetConnections;
  866. protected:
  867. //
  868. // Result View Layout
  869. //
  870. enum
  871. {
  872. COL_NAME,
  873. COL_LOCAL,
  874. COL_VERSION,
  875. COL_STATUS,
  876. /**/
  877. COL_TOTAL
  878. };
  879. static int _rgnLabels[COL_TOTAL];
  880. static int _rgnWidths[COL_TOTAL];
  881. protected:
  882. static LPOLESTR _cszNodeName;
  883. static CComBSTR _bstrYes;
  884. static CComBSTR _bstrNo;
  885. static CComBSTR _bstrVersionFmt;
  886. static BOOL _fStaticsLoaded;
  887. private:
  888. BOOL m_fPasswordEntered;
  889. BSTR m_bstrDisplayName;
  890. DWORD m_dwVersion;
  891. CError m_err;
  892. CComAuthInfo m_auth;
  893. CMetaInterface * m_pInterface;
  894. CIISRoot * m_pRootExt;
  895. BOOL m_fCanAddInstance;
  896. BOOL m_fHas10ConnectionsLimit;
  897. BOOL m_fIsWorkstation;
  898. BOOL m_fIsPerformanceConfigurable;
  899. BOOL m_fIsServiceLevelConfigurable;
  900. BOOL m_fIsAdministrator;
  901. BOOL m_fIsLocalHostIP;
  902. BOOL m_fLocalHostIPChecked;
  903. CAppPoolsContainer * m_pAppPoolsContainer;
  904. CWebServiceExtensionContainer * m_pWebServiceExtensionContainer;
  905. };
  906. //
  907. // Callback function to bring up site properties dialog
  908. //
  909. typedef HRESULT (__cdecl * PFNPROPERTIESDLG)(
  910. LPPROPERTYSHEETCALLBACK lpProvider,
  911. CComAuthInfo * pAuthInfo,
  912. LPCTSTR lpszMDPath,
  913. CWnd * pMainWnd,
  914. LPARAM lParam,
  915. LPARAM lParamParent,
  916. LONG_PTR handle
  917. );
  918. class CIISService : public CIISMBNode
  919. /*++
  920. Class Description:
  921. Public: Interface:
  922. --*/
  923. {
  924. //
  925. // Service definition
  926. //
  927. protected:
  928. typedef struct tagSERVICE_DEF
  929. {
  930. LPCTSTR szNodeName;
  931. LPCTSTR szProtocol;
  932. UINT nDescriptiveName;
  933. int nServiceImage;
  934. int nServiceImageStopped;
  935. int nSiteImage;
  936. int nSiteImageStopped;
  937. int nSiteImageErr;
  938. int nVDirImage;
  939. int nVDirImageErr;
  940. int nDirImage;
  941. int nFileImage;
  942. LPCTSTR szServiceClass;
  943. LPCTSTR szServerClass;
  944. LPCTSTR szVDirClass;
  945. PFNPROPERTIESDLG pfnSitePropertiesDlg;
  946. PFNPROPERTIESDLG pfnDirPropertiesDlg;
  947. }
  948. SERVICE_DEF;
  949. static SERVICE_DEF _rgServices[];
  950. static int ResolveServiceName(
  951. LPCTSTR szServiceName
  952. );
  953. //
  954. // Property Sheet callbacks
  955. //
  956. protected:
  957. static HRESULT __cdecl ShowFTPSiteProperties(
  958. LPPROPERTYSHEETCALLBACK lpProvider,
  959. CComAuthInfo * pAuthInfo,
  960. LPCTSTR lpszMDPath,
  961. CWnd * pMainWnd,
  962. LPARAM lParam,
  963. LPARAM lParamParent,
  964. LONG_PTR handle
  965. );
  966. static HRESULT __cdecl ShowFTPDirProperties(
  967. LPPROPERTYSHEETCALLBACK lpProvider,
  968. CComAuthInfo * pAuthInfo,
  969. LPCTSTR lpszMDPath,
  970. CWnd * pMainWnd,
  971. LPARAM lParam,
  972. LPARAM lParamParent,
  973. LONG_PTR handle
  974. );
  975. static HRESULT __cdecl ShowWebSiteProperties(
  976. LPPROPERTYSHEETCALLBACK lpProvider,
  977. CComAuthInfo * pAuthInfo,
  978. LPCTSTR lpszMDPath,
  979. CWnd * pMainWnd,
  980. LPARAM lParam,
  981. LPARAM lParamParent,
  982. LONG_PTR handle
  983. );
  984. static HRESULT __cdecl ShowWebDirProperties(
  985. LPPROPERTYSHEETCALLBACK lpProvider,
  986. CComAuthInfo * pAuthInfo,
  987. LPCTSTR lpszMDPath,
  988. CWnd * pMainWnd,
  989. LPARAM lParam,
  990. LPARAM lParamParent,
  991. LONG_PTR handle
  992. );
  993. //
  994. // Constructor/Destructor
  995. //
  996. public:
  997. CIISService(
  998. CIISMachine * pOwner,
  999. LPCTSTR szServiceName
  1000. );
  1001. protected:
  1002. virtual ~CIISService();
  1003. //
  1004. // Events
  1005. //
  1006. public:
  1007. virtual HRESULT EnumerateScopePane(HSCOPEITEM hParent);
  1008. virtual HRESULT RefreshData();
  1009. //
  1010. // Interface:
  1011. //
  1012. public:
  1013. HRESULT ShowSitePropertiesDlg(
  1014. LPPROPERTYSHEETCALLBACK lpProvider,
  1015. CComAuthInfo * pAuthInfo,
  1016. LPCTSTR lpszMDPath,
  1017. CWnd * pMainWnd,
  1018. LPARAM lParam,
  1019. LPARAM lParamParent,
  1020. LONG_PTR handle
  1021. );
  1022. HRESULT ShowDirPropertiesDlg(
  1023. LPPROPERTYSHEETCALLBACK lpProvider,
  1024. CComAuthInfo * pAuthInfo,
  1025. LPCTSTR lpszMDPath,
  1026. CWnd * pMainWnd,
  1027. LPARAM lParam,
  1028. LPARAM lParamParent,
  1029. LONG_PTR handle
  1030. );
  1031. STDMETHOD(CreatePropertyPages)(
  1032. LPPROPERTYSHEETCALLBACK lpProvider,
  1033. LONG_PTR handle,
  1034. IUnknown * pUnk,
  1035. DATA_OBJECT_TYPES type
  1036. );
  1037. //
  1038. // Access
  1039. //
  1040. public:
  1041. BOOL IsManagedService() const;
  1042. static void InitializeHeaders(LPHEADERCTRL lpHeader);
  1043. virtual void InitializeChildHeaders(LPHEADERCTRL lpHeader);
  1044. virtual LPOLESTR QueryDisplayName()
  1045. {
  1046. // Check if the service is disabled...
  1047. // if it is then appened on the "(Disabled)" word...
  1048. m_dwServiceStateDisplayed = m_dwServiceState;
  1049. if (-1 == m_dwServiceState)
  1050. {
  1051. return m_bstrDisplayNameStatus;
  1052. }
  1053. return m_bstrDisplayName;
  1054. }
  1055. virtual int QueryImage() const;
  1056. virtual int QuerySortWeight() const { return SW_SERVICE; }
  1057. LPCTSTR QueryServiceName()
  1058. {
  1059. return _rgServices[m_iServiceDef].szNodeName;
  1060. }
  1061. LPCTSTR QueryServiceClass() const
  1062. {
  1063. return _rgServices[m_iServiceDef].szServiceClass;
  1064. }
  1065. LPCTSTR QueryServerClass() const
  1066. {
  1067. return _rgServices[m_iServiceDef].szServerClass;
  1068. }
  1069. LPCTSTR QueryVDirClass() const
  1070. {
  1071. return _rgServices[m_iServiceDef].szVDirClass;
  1072. }
  1073. virtual LPCTSTR GetKeyType(LPCTSTR path = NULL) const { return QueryServiceClass(); }
  1074. //
  1075. // Display Types
  1076. //
  1077. public:
  1078. int QueryServiceImage () const;
  1079. int QueryServiceImageStopped () const;
  1080. int QuerySiteImage() const;
  1081. int QuerySiteImageStopped() const;
  1082. int QuerySiteImageErr() const;
  1083. int QueryVDirImage() const;
  1084. int QueryVDirImageErr() const;
  1085. int QueryDirImage() const;
  1086. int QueryFileImage() const;
  1087. #if 0
  1088. enum
  1089. {
  1090. IIS_SERVICE_DISABLED = 0
  1091. };
  1092. enum
  1093. {
  1094. SERVICE_COMMAND_STOP = 1,
  1095. SERVICE_COMMAND_START,
  1096. SERVICE_COMMAND_ENABLE
  1097. };
  1098. #endif
  1099. HRESULT GetServiceState();
  1100. HRESULT GetServiceState(DWORD& mode, DWORD& state, CString& name);
  1101. HRESULT ChangeServiceState(DWORD command);
  1102. HRESULT EnableService();
  1103. HRESULT StartService();
  1104. virtual void * GetNodeType()
  1105. {
  1106. return (void *)&cServiceCollectorNode;
  1107. }
  1108. HRESULT InsertNewInstance(DWORD inst);
  1109. //
  1110. // Interface:
  1111. //
  1112. protected:
  1113. STDMETHOD(AddMenuItems)(
  1114. LPCONTEXTMENUCALLBACK piCallback,
  1115. long * pInsertionAllowed,
  1116. DATA_OBJECT_TYPES type
  1117. );
  1118. STDMETHOD(Command)(
  1119. long lCommandID,
  1120. CSnapInObjectRootBase * pObj,
  1121. DATA_OBJECT_TYPES type
  1122. );
  1123. // STDMETHOD(CreatePropertyPages)(
  1124. // LPPROPERTYSHEETCALLBACK lpProvider,
  1125. // LONG_PTR handle,
  1126. // IUnknown * pUnk,
  1127. // DATA_OBJECT_TYPES type
  1128. // );
  1129. virtual HRESULT BuildURL(CComBSTR & bstrURL) const;
  1130. virtual CreateTag()
  1131. {
  1132. CIISMachine * pMachine = GetOwner();
  1133. if (pMachine)
  1134. {
  1135. // looks like "machinename (local computer)/LM/W3SVC"
  1136. CComBSTR bstrPath;
  1137. BuildMetaPath(bstrPath);
  1138. m_strTag = pMachine->QueryDisplayName();
  1139. m_strTag += bstrPath;
  1140. }
  1141. }
  1142. //
  1143. // Master properties
  1144. //
  1145. virtual BOOL IsConfigurable() const { return IsAdministrator(); }
  1146. virtual BOOL IsConfigImportExportable() const
  1147. {
  1148. return (QueryMajorVersion() >= 6);
  1149. }
  1150. virtual LPOLESTR GetResultPaneColInfo(int nCol);
  1151. virtual HRESULT DeleteNode(IResultData * pResult) {return S_OK;}
  1152. protected:
  1153. enum
  1154. {
  1155. COL_DESCRIPTION,
  1156. COL_STATE,
  1157. /**/
  1158. COL_TOTAL
  1159. };
  1160. static int _rgnLabels[COL_TOTAL];
  1161. static int _rgnWidths[COL_TOTAL];
  1162. static CComBSTR _bstrServiceDisabled;
  1163. static CComBSTR _bstrServiceRunning;
  1164. static CComBSTR _bstrServiceStopped;
  1165. static CComBSTR _bstrServicePaused;
  1166. static CComBSTR _bstrServiceStopPending;
  1167. static CComBSTR _bstrServiceStartPending;
  1168. static CComBSTR _bstrServicePausePending;
  1169. static CComBSTR _bstrServiceContPending;
  1170. static BOOL _fStaticsLoaded;
  1171. public:
  1172. DWORD m_dwServiceState;
  1173. DWORD m_dwServiceStateDisplayed;
  1174. private:
  1175. int m_iServiceDef;
  1176. BOOL m_fManagedService;
  1177. BOOL m_fCanAddInstance;
  1178. CComBSTR m_bstrDisplayName;
  1179. CComBSTR m_bstrDisplayNameStatus;
  1180. };
  1181. class CAppPoolNode;
  1182. typedef CList<CAppPoolNode *, CAppPoolNode *> CPoolList;
  1183. class CAppPoolsContainer : public CIISMBNode
  1184. /*++
  1185. Class Description:
  1186. Public: Interface:
  1187. --*/
  1188. {
  1189. //
  1190. // Property Sheet callbacks
  1191. //
  1192. protected:
  1193. static HRESULT __cdecl ShowProperties(
  1194. LPPROPERTYSHEETCALLBACK lpProvider,
  1195. CComAuthInfo * pAuthInfo,
  1196. LPCTSTR lpszMDPath,
  1197. CWnd * pMainWnd,
  1198. LPARAM lParam,
  1199. LPARAM lParamParent,
  1200. LONG_PTR handle
  1201. );
  1202. //
  1203. // Constructor/Destructor
  1204. //
  1205. public:
  1206. CAppPoolsContainer(
  1207. CIISMachine * pOwner,
  1208. CIISService * pWebService
  1209. );
  1210. virtual ~CAppPoolsContainer();
  1211. //
  1212. // Events
  1213. //
  1214. public:
  1215. virtual HRESULT EnumerateScopePane(HSCOPEITEM hParent);
  1216. //
  1217. // Interface:
  1218. //
  1219. public:
  1220. HRESULT ShowPropertiesDlg(
  1221. LPPROPERTYSHEETCALLBACK lpProvider,
  1222. CComAuthInfo * pAuthInfo,
  1223. LPCTSTR lpszMDPath,
  1224. CWnd * pMainWnd,
  1225. LPARAM lParam,
  1226. LPARAM lParamParent,
  1227. LONG_PTR handle
  1228. );
  1229. STDMETHOD(CreatePropertyPages)(
  1230. LPPROPERTYSHEETCALLBACK lpProvider,
  1231. LONG_PTR handle,
  1232. IUnknown * pUnk,
  1233. DATA_OBJECT_TYPES type
  1234. );
  1235. STDMETHOD(Command)(
  1236. long lCommandID,
  1237. CSnapInObjectRootBase * pObj,
  1238. DATA_OBJECT_TYPES type
  1239. );
  1240. //
  1241. // Access
  1242. //
  1243. public:
  1244. virtual void InitializeChildHeaders(LPHEADERCTRL lpHeader);
  1245. virtual LPOLESTR QueryDisplayName()
  1246. {
  1247. return m_bstrDisplayName;
  1248. }
  1249. virtual int QueryImage() const {return iFolder;}
  1250. virtual int QuerySortWeight() const {return SW_APP_POOLS;}
  1251. virtual HRESULT BuildMetaPath(CComBSTR & bstrPath) const;
  1252. virtual LPOLESTR GetResultPaneColInfo(int nCol);
  1253. virtual HRESULT DeleteNode(IResultData * pResult) {return S_OK;}
  1254. virtual void * GetNodeType(){return (void *)&cAppPoolsNode;}
  1255. virtual HRESULT RefreshData();
  1256. HRESULT RefreshDataChildren(CString AppPoolToRefresh,BOOL bVerifyChildren);
  1257. HRESULT EnumerateAppPools(CPoolList * pList);
  1258. HRESULT QueryDefaultPoolId(CString& id);
  1259. HRESULT InsertNewPool(CString& id);
  1260. virtual CreateTag()
  1261. {
  1262. CIISMachine * pMachine = GetOwner();
  1263. if (pMachine)
  1264. {
  1265. // looks like "machinename (local computer)/LM/W3SVC/AppPools"
  1266. CComBSTR bstrPath;
  1267. BuildMetaPath(bstrPath);
  1268. m_strTag = pMachine->QueryDisplayName();
  1269. m_strTag += bstrPath;
  1270. }
  1271. }
  1272. //
  1273. // Interface:
  1274. //
  1275. protected:
  1276. STDMETHOD(AddMenuItems)(
  1277. LPCONTEXTMENUCALLBACK piCallback,
  1278. long * pInsertionAllowed,
  1279. DATA_OBJECT_TYPES type
  1280. );
  1281. //
  1282. // Master properties
  1283. //
  1284. virtual BOOL IsConfigurable() const { return IsAdministrator(); }
  1285. virtual BOOL IsConfigImportExportable() const
  1286. {
  1287. return (QueryMajorVersion() >= 6);
  1288. }
  1289. protected:
  1290. //
  1291. // Result View Layout
  1292. //
  1293. enum
  1294. {
  1295. COL_DESCRIPTION,
  1296. COL_STATE,
  1297. COL_STATUS,
  1298. /**/
  1299. COL_TOTAL
  1300. };
  1301. static int _rgnLabels[COL_TOTAL];
  1302. static int _rgnWidths[COL_TOTAL];
  1303. private:
  1304. CComBSTR m_bstrDisplayName;
  1305. CIISService * m_pWebService;
  1306. };
  1307. class CAppPoolNode : public CIISMBNode
  1308. {
  1309. //
  1310. // Constructor/Destructor
  1311. //
  1312. public:
  1313. //
  1314. // Constructor which will resolve its properties at display time
  1315. //
  1316. CAppPoolNode(
  1317. CIISMachine * pOwner,
  1318. CAppPoolsContainer * pContainer,
  1319. LPCTSTR szNodeName,
  1320. DWORD dwState
  1321. );
  1322. virtual ~CAppPoolNode();
  1323. //
  1324. // Access
  1325. //
  1326. public:
  1327. virtual int QueryImage() const;
  1328. virtual LPOLESTR QueryDisplayName();
  1329. virtual LPOLESTR GetResultPaneColInfo(int nCol);
  1330. virtual int CompareResultPaneItem(CIISObject * pObject, int nCol);
  1331. virtual void InitializeChildHeaders(LPHEADERCTRL lpHeader);
  1332. virtual HRESULT DeleteNode(IResultData * pResult);
  1333. public:
  1334. //
  1335. // Type Functions
  1336. //
  1337. // virtual BOOL IsControllable() const { return TRUE; }
  1338. virtual BOOL IsConfigurable() const { return TRUE; }
  1339. virtual BOOL IsDeletable() const {return TRUE; }
  1340. virtual BOOL IsRefreshable() const { return TRUE; }
  1341. // virtual BOOL IsRenamable() const { return TRUE; }
  1342. virtual BOOL IsConfigImportExportable() const
  1343. {
  1344. return (QueryMajorVersion() >= 6);
  1345. }
  1346. //
  1347. // State Functions
  1348. //
  1349. virtual BOOL IsRunning() const { return m_dwState != MD_APPPOOL_STATE_STOPPED; }
  1350. virtual BOOL IsStopped() const { return m_dwState == MD_APPPOOL_STATE_STOPPED; }
  1351. virtual BOOL IsStartable() const { return !IsRunning(); }
  1352. virtual BOOL IsStoppable() const { return IsRunning(); }
  1353. //
  1354. // Interface:
  1355. //
  1356. public:
  1357. virtual HRESULT RefreshData();
  1358. HRESULT RefreshData(BOOL bRefreshChildren,BOOL bVerifyChildren);
  1359. virtual HRESULT EnumerateScopePane(HSCOPEITEM hParent);
  1360. virtual int QuerySortWeight() const { return SW_APP_POOL; }
  1361. virtual HRESULT BuildMetaPath(CComBSTR & bstrPath) const;
  1362. virtual CreateTag()
  1363. {
  1364. CIISMachine * pMachine = GetOwner();
  1365. if (pMachine)
  1366. {
  1367. // looks like "machinename (local computer)/LM/W3SVC/AppPools/DefaultAppPool"
  1368. CComBSTR bstrPath;
  1369. BuildMetaPath(bstrPath);
  1370. m_strTag = pMachine->QueryDisplayName();
  1371. m_strTag += bstrPath;
  1372. }
  1373. }
  1374. STDMETHOD(CreatePropertyPages)(
  1375. LPPROPERTYSHEETCALLBACK lpProvider,
  1376. LONG_PTR handle,
  1377. IUnknown * pUnk,
  1378. DATA_OBJECT_TYPES type
  1379. );
  1380. STDMETHOD(Command)(
  1381. long lCommandID,
  1382. CSnapInObjectRootBase * pObj,
  1383. DATA_OBJECT_TYPES type
  1384. );
  1385. virtual void * GetNodeType()
  1386. {
  1387. return (void *)&cAppPoolNode;
  1388. }
  1389. public:
  1390. static void InitializeHeaders(LPHEADERCTRL lpHeader);
  1391. HRESULT ChangeState(DWORD dwCommand);
  1392. protected:
  1393. HRESULT ShowPropertiesDlg(
  1394. LPPROPERTYSHEETCALLBACK lpProvider,
  1395. CComAuthInfo * pAuthInfo,
  1396. LPCTSTR lpszMDPath,
  1397. CWnd * pMainWnd,
  1398. LPARAM lParam,
  1399. LPARAM lParamParent,
  1400. LONG_PTR handle
  1401. );
  1402. STDMETHOD(AddMenuItems)(
  1403. LPCONTEXTMENUCALLBACK piCallback,
  1404. long * pInsertionAllowed,
  1405. DATA_OBJECT_TYPES type
  1406. );
  1407. protected:
  1408. //
  1409. // Result View Layout
  1410. //
  1411. enum
  1412. {
  1413. COL_DESCRIPTION,
  1414. COL_STATE,
  1415. COL_STATUS,
  1416. /**/
  1417. COL_TOTAL
  1418. };
  1419. static int _rgnLabels[COL_TOTAL];
  1420. static int _rgnWidths[COL_TOTAL];
  1421. protected:
  1422. static CComBSTR _bstrStarted;
  1423. static CComBSTR _bstrStopped;
  1424. // static CComBSTR _bstrPaused;
  1425. static CComBSTR _bstrUnknown;
  1426. static CComBSTR _bstrPending;
  1427. static BOOL _fStaticsLoaded;
  1428. private:
  1429. CString m_strDisplayName;
  1430. //
  1431. // Data members
  1432. //
  1433. BOOL m_fDeletable;
  1434. DWORD m_dwState;
  1435. DWORD m_dwWin32Error;
  1436. CAppPoolsContainer * m_pContainer;
  1437. };
  1438. class CIISSite : public CIISMBNode
  1439. {
  1440. //
  1441. // Constructor/Destructor
  1442. //
  1443. public:
  1444. //
  1445. // Constructor which will resolve its properties at display time
  1446. //
  1447. CIISSite(
  1448. CIISMachine * pOwner,
  1449. CIISService * pService,
  1450. LPCTSTR szNodeName
  1451. );
  1452. //
  1453. // Constructor with full information
  1454. //
  1455. CIISSite(
  1456. CIISMachine * pOwner,
  1457. CIISService * pService,
  1458. LPCTSTR szNodeName,
  1459. DWORD dwState,
  1460. BOOL fClusterEnabled,
  1461. USHORT sPort,
  1462. DWORD dwID,
  1463. DWORD dwIPAddress,
  1464. DWORD dwWin32Error,
  1465. LPOLESTR szHostHeaderName,
  1466. LPOLESTR szComment
  1467. );
  1468. protected:
  1469. virtual ~CIISSite();
  1470. //
  1471. // Access
  1472. //
  1473. public:
  1474. virtual int QueryImage() const;
  1475. virtual LPOLESTR QueryDisplayName();
  1476. virtual LPOLESTR GetResultPaneColInfo(int nCol);
  1477. virtual int CompareResultPaneItem(CIISObject * pObject, int nCol);
  1478. virtual LPCTSTR GetKeyType(LPCTSTR path = NULL) const
  1479. {
  1480. ASSERT_PTR(m_pService);
  1481. if (path != NULL && !CMetabasePath::IsMasterInstance(path))
  1482. {
  1483. return m_pService->QueryVDirClass();
  1484. }
  1485. else
  1486. {
  1487. return m_pService->QueryServerClass();
  1488. }
  1489. }
  1490. public:
  1491. //
  1492. // Type Functions
  1493. //
  1494. virtual BOOL IsControllable() const { return TRUE; }
  1495. virtual BOOL IsPausable() const { return IsRunning() || IsPaused(); }
  1496. virtual BOOL IsConfigurable() const { return TRUE; }
  1497. virtual BOOL IsDeletable() const
  1498. {
  1499. // Do not delete the only site for Pro SKU
  1500. CIISSite * that = (CIISSite *)this;
  1501. return !that->GetOwner()->IsWorkstation();
  1502. }
  1503. virtual BOOL IsRenamable() const { return TRUE; }
  1504. virtual BOOL HasFileSystemFiles() const
  1505. {
  1506. if (TRUE == m_fUsingActiveDir)
  1507. {
  1508. return FALSE;
  1509. }
  1510. return TRUE;
  1511. }
  1512. virtual BOOL IsConfigImportExportable() const
  1513. {
  1514. return (QueryMajorVersion() >= 6);
  1515. }
  1516. //
  1517. // State Functions
  1518. //
  1519. virtual BOOL IsRunning() const { return m_dwState == MD_SERVER_STATE_STARTED; }
  1520. virtual BOOL IsStopped() const { return m_dwState == MD_SERVER_STATE_STOPPED; }
  1521. virtual BOOL IsPaused() const { return m_dwState == MD_SERVER_STATE_PAUSED; }
  1522. virtual BOOL IsBrowsable() const { return TRUE; }
  1523. virtual BOOL IsExplorable() const { return TRUE; }
  1524. virtual BOOL IsOpenable() const { return TRUE; }
  1525. virtual BOOL IsPermissionable() const { return TRUE; }
  1526. //
  1527. // Data Access
  1528. //
  1529. public:
  1530. BOOL IsWolfPackEnabled() const { return m_fWolfPackEnabled; }
  1531. DWORD QueryIPAddress() const { return m_dwIPAddress; }
  1532. DWORD QueryWin32Error() const { return m_dwWin32Error; }
  1533. USHORT QueryPort() const { return m_sPort; }
  1534. USHORT QuerySSLPort() const { return m_sSSLPort; }
  1535. CIISService * QueryServiceContainer() {return m_pService;}
  1536. BOOL IsFtpSite()
  1537. {
  1538. if (m_pService)
  1539. {
  1540. return _tcsicmp(m_pService->QueryServiceName(), SZ_MBN_FTP) == 0;
  1541. }
  1542. return FALSE;
  1543. }
  1544. BOOL IsWebSite()
  1545. {
  1546. if (m_pService)
  1547. {
  1548. return _tcsicmp(m_pService->QueryServiceName(), SZ_MBN_WEB) == 0;
  1549. }
  1550. return FALSE;
  1551. }
  1552. //
  1553. // Interface:
  1554. //
  1555. public:
  1556. virtual HRESULT RefreshData();
  1557. virtual HRESULT EnumerateScopePane(HSCOPEITEM hParent);
  1558. virtual int QuerySortWeight() const { return SW_SITE; }
  1559. virtual HRESULT RenameItem(LPOLESTR new_name);
  1560. virtual HRESULT DeleteNode(IResultData * pResult);
  1561. STDMETHOD(CreatePropertyPages)(
  1562. LPPROPERTYSHEETCALLBACK lpProvider,
  1563. LONG_PTR handle,
  1564. IUnknown * pUnk,
  1565. DATA_OBJECT_TYPES type
  1566. );
  1567. STDMETHOD(Command)(
  1568. long lCommandID,
  1569. CSnapInObjectRootBase * pObj,
  1570. DATA_OBJECT_TYPES type
  1571. );
  1572. virtual void * GetNodeType()
  1573. {
  1574. return (void *)&cInstanceNode;
  1575. }
  1576. virtual CreateTag()
  1577. {
  1578. CIISMachine * pMachine = GetOwner();
  1579. if (pMachine)
  1580. {
  1581. // looks like "machinename (local computer)/LM/W3SVC/1/Root"
  1582. CComBSTR bstrPath;
  1583. BuildMetaPath(bstrPath);
  1584. m_strTag = pMachine->QueryDisplayName();
  1585. m_strTag += bstrPath;
  1586. }
  1587. }
  1588. public:
  1589. static void LoadStatics(void);
  1590. static void InitializeHeaders(LPHEADERCTRL lpHeader);
  1591. static void InitializeHeaders2(LPHEADERCTRL lpHeader);
  1592. virtual void InitializeChildHeaders(LPHEADERCTRL lpHeader);
  1593. DWORD GetInstance() { return m_dwID; }
  1594. protected:
  1595. virtual HRESULT BuildMetaPath(CComBSTR & bstrPath) const;
  1596. virtual HRESULT BuildURL(CComBSTR & bstrURL) const;
  1597. virtual HRESULT EnumerateResultPane(BOOL fExpand, IHeaderCtrl * lpHeader,
  1598. IResultData * lpResultData, BOOL fForRefresh = FALSE);
  1599. HRESULT ChangeState(DWORD dwCommand);
  1600. HRESULT ShowPropertiesDlg(
  1601. LPPROPERTYSHEETCALLBACK lpProvider,
  1602. CComAuthInfo * pAuthInfo,
  1603. LPCTSTR lpszMDPath,
  1604. CWnd * pMainWnd,
  1605. LPARAM lParam,
  1606. LPARAM lParamParent,
  1607. LONG_PTR handle
  1608. );
  1609. STDMETHOD(AddMenuItems)(
  1610. LPCONTEXTMENUCALLBACK piCallback,
  1611. long * pInsertionAllowed,
  1612. DATA_OBJECT_TYPES type
  1613. );
  1614. HRESULT InsertNewInstance(DWORD inst);
  1615. HRESULT InsertNewAlias(CString alias);
  1616. protected:
  1617. //
  1618. // Result View Layout
  1619. //
  1620. enum
  1621. {
  1622. COL_DESCRIPTION,
  1623. COL_ID,
  1624. COL_STATE,
  1625. COL_DOMAIN_NAME,
  1626. COL_IP_ADDRESS,
  1627. COL_TCP_PORT,
  1628. COL_SSL_PORT,
  1629. COL_STATUS,
  1630. /**/
  1631. COL_TOTAL
  1632. };
  1633. enum
  1634. {
  1635. COL_DESCRIPTION2,
  1636. COL_ID2,
  1637. COL_STATE2,
  1638. COL_IP_ADDRESS2,
  1639. COL_TCP_PORT2,
  1640. COL_STATUS2,
  1641. /**/
  1642. COL_TOTAL2
  1643. };
  1644. static int _rgnLabels[COL_TOTAL];
  1645. static int _rgnLabels2[COL_TOTAL2];
  1646. static int _rgnWidths[COL_TOTAL];
  1647. static int _rgnWidths2[COL_TOTAL2];
  1648. protected:
  1649. static CComBSTR _bstrStarted;
  1650. static CComBSTR _bstrStopped;
  1651. static CComBSTR _bstrPaused;
  1652. static CComBSTR _bstrUnknown;
  1653. static CComBSTR _bstrAllUnassigned;
  1654. static CComBSTR _bstrPending;
  1655. static BOOL _fStaticsLoaded;
  1656. private:
  1657. BOOL m_fResolved;
  1658. CString m_strDisplayName;
  1659. //
  1660. // Data members
  1661. //
  1662. BOOL m_fUsingActiveDir;
  1663. BOOL m_fWolfPackEnabled;
  1664. BOOL m_fFrontPageWeb;
  1665. DWORD m_dwID;
  1666. DWORD m_dwState;
  1667. DWORD m_dwIPAddress;
  1668. DWORD m_dwWin32Error;
  1669. DWORD m_dwEnumError;
  1670. USHORT m_sPort;
  1671. USHORT m_sSSLPort;
  1672. CComBSTR m_bstrHostHeaderName;
  1673. CComBSTR m_bstrComment;
  1674. CIISService * m_pService;
  1675. CComBSTR m_bstrDisplayNameStatus;
  1676. };
  1677. class CIISDirectory : public CIISMBNode
  1678. /*++
  1679. Class Description:
  1680. Vroot/dir/file class.
  1681. --*/
  1682. {
  1683. //
  1684. // Constructor/Destructor
  1685. //
  1686. public:
  1687. //
  1688. // Constructor which will resolve its properties at display time
  1689. //
  1690. CIISDirectory(
  1691. CIISMachine * pOwner,
  1692. CIISService * pService,
  1693. LPCTSTR szNodeName
  1694. );
  1695. //
  1696. // Constructor with full information
  1697. //
  1698. CIISDirectory(
  1699. CIISMachine * pOwner,
  1700. CIISService * pService,
  1701. LPCTSTR szNodeName,
  1702. BOOL fEnabledApplication,
  1703. DWORD dwWin32Error,
  1704. LPCTSTR redir_path
  1705. );
  1706. protected:
  1707. virtual ~CIISDirectory();
  1708. //
  1709. // Access
  1710. //
  1711. public:
  1712. virtual int QueryImage() const;
  1713. virtual LPOLESTR QueryDisplayName() { return m_bstrDisplayName; }
  1714. virtual LPOLESTR GetResultPaneColInfo(int nCol);
  1715. virtual LPCTSTR GetKeyType(LPCTSTR path = NULL) const
  1716. {
  1717. return m_pService->QueryVDirClass();
  1718. }
  1719. LPOLESTR QueryPath() { return m_bstrPath; }
  1720. CIISService * QueryServiceContainer() {return m_pService;}
  1721. public:
  1722. //
  1723. // Type Functions
  1724. //
  1725. virtual BOOL IsConfigurable() const { return TRUE; }
  1726. virtual BOOL IsDeletable() const { return TRUE; }
  1727. // virtual BOOL IsRenamable() const { return TRUE; }
  1728. virtual BOOL IsConfigImportExportable() const
  1729. {
  1730. return (QueryMajorVersion() >= 6);
  1731. }
  1732. //
  1733. // State Functions
  1734. //
  1735. virtual BOOL IsBrowsable() const { return TRUE; }
  1736. virtual BOOL IsExplorable() const { return TRUE; }
  1737. virtual BOOL IsOpenable() const { return TRUE; }
  1738. virtual BOOL IsPermissionable() const { return TRUE; }
  1739. virtual BOOL HasFileSystemFiles() const { return TRUE; }
  1740. //
  1741. // Data Access
  1742. //
  1743. public:
  1744. BOOL IsEnabledApplication() const { return m_fEnabledApplication; }
  1745. DWORD QueryWin32Error() const { return m_dwWin32Error; }
  1746. BOOL IsFtpDir()
  1747. {
  1748. return _tcsicmp(m_pService->QueryServiceName(), SZ_MBN_FTP) == 0;
  1749. }
  1750. BOOL IsWebDir()
  1751. {
  1752. return _tcsicmp(m_pService->QueryServiceName(), SZ_MBN_WEB) == 0;
  1753. }
  1754. //
  1755. // Interface:
  1756. //
  1757. public:
  1758. virtual HRESULT RefreshData();
  1759. virtual HRESULT EnumerateScopePane(HSCOPEITEM hParent);
  1760. virtual HRESULT OnViewChange(BOOL fScope, IResultData * pResult, IHeaderCtrl * pHeader, DWORD hint);
  1761. virtual int QuerySortWeight() const { return SW_VDIR; }
  1762. // virtual HRESULT RenameItem(LPOLESTR new_name);
  1763. STDMETHOD(AddMenuItems)(
  1764. LPCONTEXTMENUCALLBACK piCallback,
  1765. long * pInsertionAllowed,
  1766. DATA_OBJECT_TYPES type
  1767. );
  1768. STDMETHOD(Command)(
  1769. long lCommandID,
  1770. CSnapInObjectRootBase * pObj,
  1771. DATA_OBJECT_TYPES type
  1772. );
  1773. STDMETHOD(CreatePropertyPages)(
  1774. LPPROPERTYSHEETCALLBACK lpProvider,
  1775. LONG_PTR handle,
  1776. IUnknown * pUnk,
  1777. DATA_OBJECT_TYPES type
  1778. );
  1779. virtual void * GetNodeType()
  1780. {
  1781. return (void *)&cChildNode;
  1782. }
  1783. virtual CreateTag()
  1784. {
  1785. CIISMachine * pMachine = GetOwner();
  1786. if (pMachine)
  1787. {
  1788. // looks like "machinename (local computer)/LM/W3SVC/1/Root/TheVDir"
  1789. CComBSTR bstrPath;
  1790. BuildMetaPath(bstrPath);
  1791. m_strTag = pMachine->QueryDisplayName();
  1792. m_strTag += bstrPath;
  1793. }
  1794. }
  1795. public:
  1796. virtual void InitializeChildHeaders(LPHEADERCTRL lpHeader);
  1797. static void InitializeHeaders(LPHEADERCTRL lpHeader);
  1798. protected:
  1799. //virtual HRESULT BuildURL(CComBSTR & bstrURL) const;
  1800. HRESULT InsertNewAlias(CString alias);
  1801. virtual HRESULT EnumerateResultPane(BOOL fExpand, IHeaderCtrl * lpHeader,
  1802. IResultData * lpResultData, BOOL fForRefresh = FALSE)
  1803. {
  1804. CError err = CIISObject::EnumerateResultPane(fExpand, lpHeader, lpResultData, fForRefresh);
  1805. if ( err.Succeeded()
  1806. && !IsFtpDir()
  1807. // && QueryWin32Error() == ERROR_SUCCESS
  1808. && m_strRedirectPath.IsEmpty()
  1809. )
  1810. {
  1811. err = CIISMBNode::EnumerateResultPane_(
  1812. fExpand, lpHeader, lpResultData, m_pService);
  1813. }
  1814. return err;
  1815. }
  1816. HRESULT ShowPropertiesDlg(
  1817. LPPROPERTYSHEETCALLBACK lpProvider,
  1818. CComAuthInfo * pAuthInfo,
  1819. LPCTSTR lpszMDPath,
  1820. CWnd * pMainWnd,
  1821. LPARAM lParam,
  1822. LPARAM lParamParent,
  1823. LONG_PTR handle
  1824. );
  1825. protected:
  1826. //
  1827. // Result View Layout
  1828. //
  1829. enum
  1830. {
  1831. COL_ALIAS = 0,
  1832. COL_PATH,
  1833. COL_STATUS,
  1834. //
  1835. COL_TOTAL
  1836. };
  1837. static int _rgnLabels[COL_TOTAL];
  1838. static int _rgnWidths[COL_TOTAL];
  1839. protected:
  1840. // static CComBSTR _bstrName, _bstrPath;
  1841. // static BOOL _fStaticsLoaded;
  1842. private:
  1843. BOOL m_fResolved;
  1844. CComBSTR m_bstrDisplayName;
  1845. CComBSTR m_bstrPath;
  1846. //
  1847. // Data members
  1848. //
  1849. BOOL m_fEnabledApplication;
  1850. DWORD m_dwWin32Error;
  1851. DWORD m_dwEnumError;
  1852. CIISService * m_pService;
  1853. };
  1854. class CApplicationNode;
  1855. typedef CList<CApplicationNode *, CApplicationNode *&> CApplicationList;
  1856. class CApplicationNode : public CIISMBNode
  1857. {
  1858. public:
  1859. CApplicationNode(
  1860. CIISMachine * pOwner,
  1861. LPCTSTR path,
  1862. LPCTSTR name
  1863. )
  1864. : CIISMBNode(pOwner, name),
  1865. m_meta_path(path)
  1866. {
  1867. }
  1868. protected:
  1869. virtual ~CApplicationNode()
  1870. {
  1871. }
  1872. public:
  1873. virtual BOOL IsLeafNode() const { return TRUE; }
  1874. virtual int QueryImage() const
  1875. {
  1876. return iApplication;
  1877. }
  1878. virtual LPOLESTR QueryDisplayName();
  1879. LPOLESTR QueryDisplayName(BOOL bForceQuery);
  1880. virtual HRESULT BuildMetaPath(CComBSTR& path) const;
  1881. virtual int QuerySortWeight() const
  1882. {
  1883. CString parent, alias;
  1884. CMetabasePath::SplitMetaPathAtInstance(m_meta_path, parent, alias);
  1885. return alias.IsEmpty() ? SW_SITE : SW_VDIR;
  1886. }
  1887. virtual LPOLESTR GetResultPaneColInfo(int nCol);
  1888. // virtual int CompareResultPaneItem(CIISObject * pObject, int nCol);
  1889. static void InitializeHeaders(LPHEADERCTRL lpHeader);
  1890. virtual void * GetNodeType() {return (void *)&cApplicationNode;}
  1891. virtual CreateTag()
  1892. {
  1893. // This node doesn't have properties
  1894. m_strTag = _T("");
  1895. }
  1896. protected:
  1897. //
  1898. // Result View Layout
  1899. //
  1900. enum
  1901. {
  1902. COL_ALIAS,
  1903. COL_PATH,
  1904. //
  1905. COL_TOTAL
  1906. };
  1907. static int _rgnLabels[COL_TOTAL];
  1908. static int _rgnWidths[COL_TOTAL];
  1909. LPCTSTR FriendlyAppRoot(LPCTSTR lpAppRoot, CString & strFriendly);
  1910. private:
  1911. CString m_strDisplayName;
  1912. CString m_meta_path;
  1913. };
  1914. class CIISFileName : public CIISMBNode
  1915. {
  1916. public:
  1917. CIISFileName(
  1918. CIISMachine * pOwner,
  1919. CIISService * pService,
  1920. const DWORD dwAttributes,
  1921. LPCTSTR alias,
  1922. LPCTSTR redirect
  1923. );
  1924. protected:
  1925. virtual ~CIISFileName()
  1926. {
  1927. m_pService->Release();
  1928. }
  1929. public:
  1930. BOOL IsEnabledApplication() const
  1931. {
  1932. return m_fEnabledApplication;
  1933. }
  1934. DWORD QueryWin32Error() const
  1935. {
  1936. return m_dwWin32Error;
  1937. }
  1938. //
  1939. // Access
  1940. //
  1941. public:
  1942. virtual int QueryImage() const;
  1943. virtual LPOLESTR QueryDisplayName()
  1944. {
  1945. return m_bstrFileName;
  1946. }
  1947. virtual LPOLESTR GetResultPaneColInfo(int nCol);
  1948. virtual HRESULT DeleteNode(IResultData * pResult);
  1949. virtual LPCTSTR GetKeyType(LPCTSTR path = NULL) const
  1950. {
  1951. return (m_dwAttribute & FILE_ATTRIBUTE_DIRECTORY) != 0 ?
  1952. IIS_CLASS_WEB_DIR_W : IIS_CLASS_WEB_FILE_W;
  1953. }
  1954. CIISService * QueryServiceContainer() {return m_pService;}
  1955. //
  1956. // Type Functions
  1957. //
  1958. virtual BOOL IsConfigurable() const { return TRUE; }
  1959. virtual BOOL IsDeletable() const { return TRUE; }
  1960. virtual BOOL IsRenamable() const { return TRUE; }
  1961. virtual BOOL IsLeafNode() const { return TRUE; }
  1962. virtual BOOL IsConfigImportExportable() const
  1963. {
  1964. return (QueryMajorVersion() >= 6);
  1965. }
  1966. //
  1967. // State Functions
  1968. //
  1969. virtual BOOL IsBrowsable() const { return TRUE; }
  1970. virtual BOOL IsExplorable() const
  1971. {
  1972. return IsDir();
  1973. }
  1974. virtual BOOL IsOpenable() const
  1975. {
  1976. return TRUE;
  1977. }
  1978. virtual BOOL IsPermissionable() const
  1979. {
  1980. return TRUE;
  1981. }
  1982. virtual BOOL HasFileSystemFiles() const
  1983. {
  1984. return IsDir();
  1985. }
  1986. virtual int QuerySortWeight() const
  1987. {
  1988. return IsDir() ? SW_DIR : SW_FILE;
  1989. }
  1990. virtual void InitializeChildHeaders(LPHEADERCTRL lpHeader);
  1991. virtual HRESULT RefreshData();
  1992. virtual HRESULT EnumerateScopePane(HSCOPEITEM hParent);
  1993. virtual HRESULT OnDblClick(IComponentData * pcd, IComponent * pc);
  1994. STDMETHOD(AddMenuItems)(
  1995. LPCONTEXTMENUCALLBACK piCallback,
  1996. long * pInsertionAllowed,
  1997. DATA_OBJECT_TYPES type
  1998. );
  1999. STDMETHOD(Command)(
  2000. long lCommandID,
  2001. CSnapInObjectRootBase * pObj,
  2002. DATA_OBJECT_TYPES type
  2003. );
  2004. STDMETHOD(CreatePropertyPages)(
  2005. LPPROPERTYSHEETCALLBACK lpProvider,
  2006. LONG_PTR handle,
  2007. IUnknown * pUnk,
  2008. DATA_OBJECT_TYPES type
  2009. );
  2010. virtual void * GetNodeType()
  2011. {
  2012. return (void *)&cFileNode;
  2013. }
  2014. virtual CreateTag()
  2015. {
  2016. CIISMachine * pMachine = GetOwner();
  2017. if (pMachine)
  2018. {
  2019. // looks like "machinename (local computer)/LM/W3SVC/1/Root/DirOrFilename"
  2020. CComBSTR bstrPath;
  2021. BuildMetaPath(bstrPath);
  2022. m_strTag = pMachine->QueryDisplayName();
  2023. m_strTag += bstrPath;
  2024. }
  2025. }
  2026. virtual HRESULT RenameItem(LPOLESTR new_name);
  2027. virtual HRESULT OnViewChange(BOOL fScope, IResultData * pResult, IHeaderCtrl * pHeader, DWORD hint);
  2028. protected:
  2029. //
  2030. // Result View Layout
  2031. //
  2032. enum
  2033. {
  2034. COL_ALIAS,
  2035. COL_PATH,
  2036. COL_STATUS,
  2037. //
  2038. COL_TOTAL
  2039. };
  2040. static int _rgnLabels[COL_TOTAL];
  2041. static int _rgnWidths[COL_TOTAL];
  2042. HRESULT ShowPropertiesDlg(
  2043. LPPROPERTYSHEETCALLBACK lpProvider,
  2044. CComAuthInfo * pAuthInfo,
  2045. LPCTSTR lpszMDPath,
  2046. CWnd * pMainWnd,
  2047. LPARAM lParam,
  2048. LPARAM lParamParent,
  2049. LONG_PTR handle
  2050. );
  2051. HRESULT ShowDirPropertiesDlg(
  2052. LPPROPERTYSHEETCALLBACK lpProvider,
  2053. CComAuthInfo * pAuthInfo,
  2054. LPCTSTR lpszMDPath,
  2055. CWnd * pMainWnd,
  2056. LPARAM lParam,
  2057. LPARAM lParamParent,
  2058. LONG_PTR handle
  2059. );
  2060. HRESULT ShowFilePropertiesDlg(
  2061. LPPROPERTYSHEETCALLBACK lpProvider,
  2062. CComAuthInfo * pAuthInfo,
  2063. LPCTSTR lpszMDPath,
  2064. CWnd * pMainWnd,
  2065. LPARAM lParam,
  2066. LPARAM lParamParent,
  2067. LONG_PTR handle
  2068. );
  2069. HRESULT InsertNewAlias(CString alias);
  2070. virtual HRESULT EnumerateResultPane(BOOL fExpand, IHeaderCtrl * lpHeader,
  2071. IResultData * lpResultData, BOOL fForRefresh = FALSE)
  2072. {
  2073. CError err = CIISObject::EnumerateResultPane(fExpand, lpHeader, lpResultData, fForRefresh);
  2074. if (err.Succeeded() && m_dwWin32Error == ERROR_SUCCESS)
  2075. {
  2076. err = CIISMBNode::EnumerateResultPane_(fExpand,
  2077. lpHeader, lpResultData, m_pService);
  2078. }
  2079. return err;
  2080. }
  2081. BOOL IsDir() const
  2082. {
  2083. return (m_dwAttribute & FILE_ATTRIBUTE_DIRECTORY) != 0;
  2084. }
  2085. private:
  2086. BOOL m_fResolved;
  2087. CComBSTR m_bstrFileName;
  2088. CString m_RedirectString;
  2089. BOOL m_fEnabledApplication;
  2090. DWORD m_dwAttribute;
  2091. DWORD m_dwWin32Error;
  2092. DWORD m_dwEnumError;
  2093. CIISService * m_pService;
  2094. };
  2095. class CWebServiceExtension;
  2096. typedef CList<CWebServiceExtension *, CWebServiceExtension *&> CExtensionList;
  2097. class CWebServiceExtensionContainer : public CIISMBNode
  2098. {
  2099. //
  2100. // Constructor/Destructor
  2101. //
  2102. public:
  2103. CWebServiceExtensionContainer(
  2104. CIISMachine * pOwner,
  2105. CIISService * pWebService
  2106. );
  2107. virtual ~CWebServiceExtensionContainer();
  2108. //
  2109. // Events
  2110. //
  2111. public:
  2112. virtual HRESULT EnumerateResultPane(BOOL fExpand, IHeaderCtrl * lpHeader,IResultData * lpResultData, BOOL fForRefresh = FALSE);
  2113. virtual HRESULT CleanResult(IResultData * pResultData);
  2114. HRESULT CacheResult(IResultData * pResultData);
  2115. virtual BOOL HasResultItems(IResultData * pResult) const { return FALSE; }
  2116. //
  2117. // Interface:
  2118. //
  2119. public:
  2120. STDMETHOD(Command)(
  2121. long lCommandID,
  2122. CSnapInObjectRootBase * pObj,
  2123. DATA_OBJECT_TYPES type
  2124. );
  2125. //
  2126. // Access
  2127. //
  2128. public:
  2129. virtual BOOL IsLeafNode() const { return TRUE; }
  2130. virtual BOOL IsRefreshable() const { return TRUE; }
  2131. virtual void InitializeChildHeaders(LPHEADERCTRL lpHeader);
  2132. virtual HRESULT DeleteNode(IResultData * pResult) {return S_OK;}
  2133. virtual LPOLESTR QueryDisplayName() {return m_bstrDisplayName;}
  2134. virtual int QueryImage() const {return iFolder;}
  2135. virtual int QuerySortWeight() const {return SW_WEBSVCEXTS;}
  2136. virtual void * GetNodeType() {return (void *)&cWebServiceExtensionContainer;}
  2137. virtual HRESULT RefreshData();
  2138. virtual HRESULT ForceReportMode(IResultData * pResult) const;
  2139. virtual LPOLESTR GetResultPaneColInfo(int nCol);
  2140. virtual HRESULT GetContextHelp(CString& strHtmlPage);
  2141. virtual CreateTag()
  2142. {
  2143. // This node doesn't have properties
  2144. m_strTag = _T("");
  2145. }
  2146. // load data from metabase
  2147. HRESULT EnumerateWebServiceExtensions(CExtensionList * pList);
  2148. HRESULT InsertNewExtension(CRestrictionUIEntry * pNewEntry);
  2149. HRESULT QueryResultPaneSelectionID(IResultData * lpResultData,CString& id);
  2150. HRESULT SelectResultPaneSelectionID(IResultData * pResultData,CString id);
  2151. //
  2152. // Interface:
  2153. //
  2154. protected:
  2155. STDMETHOD(AddMenuItems)(
  2156. LPCONTEXTMENUCALLBACK piCallback,
  2157. long * pInsertionAllowed,
  2158. DATA_OBJECT_TYPES type
  2159. );
  2160. STDMETHOD(GetResultViewType)(LPOLESTR *lplpViewType, long * lpViewOptions);
  2161. protected:
  2162. //
  2163. // Result View Layout
  2164. //
  2165. enum
  2166. {
  2167. COL_DESCRIPTION,
  2168. COL_STATE,
  2169. COL_STATUS,
  2170. /**/
  2171. COL_TOTAL
  2172. };
  2173. static int _rgnLabels[COL_TOTAL];
  2174. static int _rgnWidths[COL_TOTAL];
  2175. private:
  2176. CComBSTR m_bstrDisplayName;
  2177. CIISService * m_pWebService;
  2178. IResultData * m_pResultData;
  2179. CString m_strLastResultSelectionID;
  2180. int m_iResultPaneCount;
  2181. CExtensionList m_WebSvcExtensionList;
  2182. DWORD m_dwResultDataCachedSignature;
  2183. };
  2184. class CWebServiceExtension : public CIISMBNode
  2185. {
  2186. //
  2187. // Constructor/Destructor
  2188. //
  2189. public:
  2190. CWebServiceExtension(
  2191. CIISMachine * pOwner,
  2192. CRestrictionUIEntry * pRestrictionUIEntry,
  2193. CIISService * pWebService
  2194. );
  2195. virtual ~CWebServiceExtension();
  2196. //
  2197. // Access
  2198. //
  2199. public:
  2200. virtual int QueryImage() const;
  2201. virtual int QueryImageForPropertyPage() const;
  2202. virtual LPOLESTR QueryDisplayName();
  2203. virtual LPOLESTR GetResultPaneColInfo(int nCol);
  2204. virtual int CompareResultPaneItem(CIISObject * pObject, int nCol);
  2205. virtual void InitializeChildHeaders(LPHEADERCTRL lpHeader);
  2206. virtual HRESULT DeleteNode(IResultData * pResult);
  2207. virtual HRESULT BuildMetaPath(CComBSTR & bstrPath) const;
  2208. public:
  2209. //
  2210. // Type Functions
  2211. //
  2212. virtual BOOL IsLeafNode() const { return TRUE; }
  2213. virtual BOOL IsConfigurable() const;
  2214. virtual BOOL IsDeletable() const;
  2215. virtual BOOL IsRefreshable() const { return TRUE; }
  2216. //
  2217. // Interface:
  2218. //
  2219. public:
  2220. virtual HRESULT GetContextHelp(CString& strHtmlPage);
  2221. virtual HRESULT RefreshData();
  2222. HRESULT RefreshData(BOOL bReselect);
  2223. virtual HRESULT OnDblClick(IComponentData * pcd, IComponent * pc);
  2224. virtual int QuerySortWeight() const { return SW_WEBSVCEXT; }
  2225. virtual void * GetNodeType(){return (void *)&cWebServiceExtension;}
  2226. virtual CreateTag()
  2227. {
  2228. CIISMachine * pMachine = GetOwner();
  2229. if (pMachine)
  2230. {
  2231. CComBSTR bstrPath;
  2232. BuildMetaPath(bstrPath);
  2233. m_strTag = pMachine->QueryDisplayName();
  2234. m_strTag += _T("//");
  2235. m_strTag += QueryDisplayName();
  2236. }
  2237. }
  2238. INT GetState() const;
  2239. HRESULT AddToResultPane(IResultData *pResultData,BOOL bSelect = FALSE,BOOL bPleaseAddRef = TRUE);
  2240. HRESULT AddToResultPaneSorted(IResultData *pResultData,BOOL bSelect = FALSE,BOOL bPleaseAddRef = TRUE);
  2241. HRESULT UpdateResultItem(IResultData *pResultData, BOOL bSelect);
  2242. STDMETHOD(CreatePropertyPages)(
  2243. LPPROPERTYSHEETCALLBACK lpProvider,
  2244. LONG_PTR handle,
  2245. IUnknown * pUnk,
  2246. DATA_OBJECT_TYPES type
  2247. );
  2248. STDMETHOD(Command)(
  2249. long lCommandID,
  2250. CSnapInObjectRootBase * pObj,
  2251. DATA_OBJECT_TYPES type
  2252. );
  2253. public:
  2254. static void InitializeHeaders(LPHEADERCTRL lpHeader);
  2255. // for extended view
  2256. virtual HRESULT GetProperty(LPDATAOBJECT pDataObject,BSTR szPropertyName,BSTR* pbstrProperty);
  2257. CWebServiceExtensionContainer * QueryContainer() const {return m_pOwner->QueryWebSvcExtContainer();}
  2258. HRESULT FindMyResultItem(IResultData *pResultData,BOOL bDeleteIfFound);
  2259. protected:
  2260. HRESULT ChangeState(INT iDesiredState);
  2261. HRESULT ShowPropertiesDlg(
  2262. LPPROPERTYSHEETCALLBACK lpProvider,
  2263. CComAuthInfo * pAuthInfo,
  2264. LPCTSTR lpszMDPath,
  2265. CWnd * pMainWnd,
  2266. LPARAM lParam,
  2267. LPARAM lParamParent,
  2268. LONG_PTR handle
  2269. );
  2270. STDMETHOD(AddMenuItems)(
  2271. LPCONTEXTMENUCALLBACK piCallback,
  2272. long * pInsertionAllowed,
  2273. DATA_OBJECT_TYPES type
  2274. );
  2275. STDMETHOD(GetResultViewType)(LPOLESTR *lplpViewType, long * lpViewOptions);
  2276. protected:
  2277. //
  2278. // Result View Layout
  2279. //
  2280. enum
  2281. {
  2282. COL_ICON,
  2283. COL_WEBSVCEXT,
  2284. COL_STATUS,
  2285. /**/
  2286. COL_TOTAL
  2287. };
  2288. static int _rgnLabels[COL_TOTAL];
  2289. static int _rgnWidths[COL_TOTAL];
  2290. protected:
  2291. static CComBSTR _bstrStatusAllowed;
  2292. static CComBSTR _bstrStatusProhibited;
  2293. static CComBSTR _bstrStatusCustom;
  2294. static CComBSTR _bstrStatusInUse;
  2295. static CComBSTR _bstrStatusNotInUse;
  2296. static CString _bstrMenuAllowOn;
  2297. static CString _bstrMenuAllowOff;
  2298. static CString _bstrMenuProhibitOn;
  2299. static CString _bstrMenuProhibitOff;
  2300. static CString _bstrMenuPropertiesOn;
  2301. static CString _bstrMenuPropertiesOff;
  2302. static CString _bstrMenuTasks;
  2303. static CString _bstrMenuTask1;
  2304. static CString _bstrMenuTask2;
  2305. static CString _bstrMenuTask3;
  2306. static CString _bstrMenuTask4;
  2307. static CString _bstrMenuIconBullet;
  2308. static CString _bstrMenuIconHelp;
  2309. static BOOL _fStaticsLoaded;
  2310. static BOOL _fStaticsLoaded2;
  2311. public:
  2312. CRestrictionUIEntry m_RestrictionUIEntry;
  2313. CIISService * m_pWebService;
  2314. };
  2315. #if 0
  2316. class CIISFileSystem
  2317. /*++
  2318. Class Description:
  2319. Pure virtual base class to help enumerate the filesystem. Sites,
  2320. virtual directory and file/directory nodes will be "is a" nodes
  2321. of this type, in addition to deriving from CIISMBNode.
  2322. Public Interface:
  2323. --*/
  2324. {
  2325. //
  2326. // Constructor/Destructor
  2327. //
  2328. public:
  2329. CIISFileSystem(LPCTSTR szFileName, BOOL fTerminal = FALSE);
  2330. protected:
  2331. virtual ~CIISFileSystem();
  2332. protected:
  2333. HRESULT BuildFilePath(
  2334. IConsoleNameSpace * pConsoleNameSpace,
  2335. HSCOPEITEM hScopeItem,
  2336. CComBSTR & bstrPath
  2337. ) const;
  2338. BOOL IsFileTerminal() const { return m_fTerminal; }
  2339. private:
  2340. CComBSTR m_bstrFileName;
  2341. BOOL m_fTerminal;
  2342. };
  2343. #endif 0
  2344. //
  2345. // Inline Expansion
  2346. //
  2347. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  2348. inline HRESULT CIISObject::AddImages(LPIMAGELIST lpImageList)
  2349. {
  2350. return SetImageList(lpImageList);
  2351. }
  2352. inline /* virtual */ CMetaInterface * CIISMBNode::QueryInterface()
  2353. {
  2354. ASSERT_PTR(m_pOwner != NULL);
  2355. ASSERT(m_pOwner->HasInterface());
  2356. return m_pOwner->QueryInterface();
  2357. }
  2358. inline /* virtual */ CComAuthInfo * CIISMBNode::QueryAuthInfo()
  2359. {
  2360. ASSERT_PTR(m_pOwner != NULL);
  2361. return m_pOwner->QueryAuthInfo();
  2362. }
  2363. inline /* virtual */ LPOLESTR CIISMBNode::QueryMachineName() const
  2364. {
  2365. ASSERT_PTR(m_pOwner);
  2366. return m_pOwner->QueryMachineName();
  2367. }
  2368. inline WORD CIISMBNode::QueryMajorVersion() const
  2369. {
  2370. ASSERT_PTR(m_pOwner);
  2371. return m_pOwner->QueryMajorVersion();
  2372. }
  2373. inline WORD CIISMBNode::QueryMinorVersion() const
  2374. {
  2375. ASSERT_PTR(m_pOwner);
  2376. return m_pOwner->QueryMinorVersion();
  2377. }
  2378. inline /* virtual */ BOOL CIISMBNode::IsLocal() const
  2379. {
  2380. ASSERT_PTR(m_pOwner);
  2381. return m_pOwner->IsLocal();
  2382. }
  2383. inline /* virtual */ BOOL CIISMBNode::HasInterface() const
  2384. {
  2385. ASSERT_PTR(m_pOwner);
  2386. return m_pOwner->HasInterface();
  2387. }
  2388. inline /* virtual */ HRESULT CIISMBNode::CreateInterface(BOOL fShowError)
  2389. {
  2390. ASSERT_PTR(m_pOwner);
  2391. return m_pOwner->CreateInterface(fShowError);
  2392. }
  2393. inline /* virtual */ HRESULT CIISMBNode::AssureInterfaceCreated(BOOL fShowError)
  2394. {
  2395. ASSERT_PTR(m_pOwner);
  2396. return m_pOwner->AssureInterfaceCreated(fShowError);
  2397. }
  2398. inline /* virtual */ void CIISMBNode::SetInterfaceError(HRESULT hr)
  2399. {
  2400. ASSERT_PTR(m_pOwner);
  2401. m_pOwner->SetInterfaceError(hr);
  2402. }
  2403. inline BOOL CIISMBNode::IsLostInterface(CError & err) const
  2404. {
  2405. return err.Win32Error() == RPC_S_SERVER_UNAVAILABLE;
  2406. }
  2407. inline HRESULT CIISMachine::AssureInterfaceCreated(BOOL fShowError)
  2408. {
  2409. return m_pInterface ? S_OK : CreateInterface(fShowError);
  2410. }
  2411. inline CIISService::QueryImage() const
  2412. {
  2413. CIISService * pTemp = (CIISService *) this;
  2414. pTemp->m_dwServiceStateDisplayed = m_dwServiceState;
  2415. if (SERVICE_RUNNING == m_dwServiceState || 0 == m_dwServiceState)
  2416. {
  2417. return QueryServiceImage();
  2418. }
  2419. else
  2420. {
  2421. return QueryServiceImageStopped();
  2422. }
  2423. }
  2424. inline CIISService::QueryServiceImage() const
  2425. {
  2426. ASSERT(m_iServiceDef >= 0);
  2427. return _rgServices[m_iServiceDef].nServiceImage;
  2428. }
  2429. inline CIISService::QueryServiceImageStopped() const
  2430. {
  2431. ASSERT(m_iServiceDef >= 0);
  2432. return _rgServices[m_iServiceDef].nServiceImageStopped;
  2433. }
  2434. inline CIISService::QuerySiteImage() const
  2435. {
  2436. ASSERT(m_iServiceDef >= 0);
  2437. return _rgServices[m_iServiceDef].nSiteImage;
  2438. }
  2439. inline CIISService::QuerySiteImageStopped() const
  2440. {
  2441. ASSERT(m_iServiceDef >= 0);
  2442. return _rgServices[m_iServiceDef].nSiteImageStopped;
  2443. }
  2444. inline CIISService::QuerySiteImageErr() const
  2445. {
  2446. ASSERT(m_iServiceDef >= 0);
  2447. return _rgServices[m_iServiceDef].nSiteImageErr;
  2448. }
  2449. inline CIISService::QueryVDirImage() const
  2450. {
  2451. ASSERT(m_iServiceDef >= 0);
  2452. return _rgServices[m_iServiceDef].nVDirImage;
  2453. }
  2454. inline CIISService::QueryVDirImageErr() const
  2455. {
  2456. ASSERT(m_iServiceDef >= 0);
  2457. return _rgServices[m_iServiceDef].nVDirImageErr;
  2458. }
  2459. inline CIISService::QueryDirImage() const
  2460. {
  2461. ASSERT(m_iServiceDef >= 0);
  2462. return _rgServices[m_iServiceDef].nDirImage;
  2463. }
  2464. inline CIISService::QueryFileImage() const
  2465. {
  2466. ASSERT(m_iServiceDef >= 0);
  2467. return _rgServices[m_iServiceDef].nFileImage;
  2468. }
  2469. inline BOOL CIISService::IsManagedService() const
  2470. {
  2471. return m_fManagedService;
  2472. }
  2473. inline HRESULT CIISSite::ShowPropertiesDlg(
  2474. LPPROPERTYSHEETCALLBACK lpProvider,
  2475. CComAuthInfo * pAuthInfo,
  2476. LPCTSTR lpszMDPath,
  2477. CWnd * pMainWnd,
  2478. LPARAM lParam,
  2479. LPARAM lParamParent,
  2480. LONG_PTR handle
  2481. )
  2482. {
  2483. ASSERT_PTR(m_pService);
  2484. return m_pService->ShowSitePropertiesDlg(
  2485. lpProvider,
  2486. pAuthInfo,
  2487. lpszMDPath,
  2488. pMainWnd,
  2489. lParam,
  2490. lParamParent,
  2491. handle
  2492. );
  2493. }
  2494. inline HRESULT CIISDirectory::ShowPropertiesDlg(
  2495. LPPROPERTYSHEETCALLBACK lpProvider,
  2496. CComAuthInfo * pAuthInfo,
  2497. LPCTSTR lpszMDPath,
  2498. CWnd * pMainWnd,
  2499. LPARAM lParam,
  2500. LPARAM lParamParent,
  2501. LONG_PTR handle
  2502. )
  2503. {
  2504. ASSERT_PTR(m_pService);
  2505. return m_pService->ShowDirPropertiesDlg(
  2506. lpProvider,
  2507. pAuthInfo,
  2508. lpszMDPath,
  2509. pMainWnd,
  2510. lParam,
  2511. lParamParent,
  2512. handle
  2513. );
  2514. }
  2515. inline HRESULT
  2516. CIISFileName::ShowPropertiesDlg(
  2517. LPPROPERTYSHEETCALLBACK lpProvider,
  2518. CComAuthInfo * pAuthInfo,
  2519. LPCTSTR lpszMDPath,
  2520. CWnd * pMainWnd,
  2521. LPARAM lParam,
  2522. LPARAM lParamParent,
  2523. LONG_PTR handle
  2524. )
  2525. {
  2526. ASSERT_PTR(m_pService);
  2527. return m_pService->ShowDirPropertiesDlg(
  2528. lpProvider,
  2529. pAuthInfo,
  2530. lpszMDPath,
  2531. pMainWnd,
  2532. lParam,
  2533. lParamParent,
  2534. handle
  2535. );
  2536. }
  2537. HRESULT CheckForMetabaseAccess(DWORD dwPermissions,
  2538. CIISMBNode * pIISObject,
  2539. BOOL bReConnect,
  2540. LPCTSTR path = METADATA_MASTER_ROOT_HANDLE);
  2541. HRESULT CheckForMetabaseAccess(DWORD dwPermissions,
  2542. CMetaInterface * pMyInterface,
  2543. LPCTSTR path = METADATA_MASTER_ROOT_HANDLE);
  2544. #endif // __IISOBJ_H__