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.

929 lines
21 KiB

  1. /*++
  2. Copyright (c) 1994-1998 Microsoft Corporation
  3. Module Name :
  4. cinetmgr.h
  5. Abstract:
  6. snapin definitions
  7. Author:
  8. Ronald Meijer (ronaldm)
  9. Project:
  10. Internet Services Manager
  11. Revision History:
  12. --*/
  13. #include "resource.h"
  14. //
  15. // AddFileSystem parameter helpers
  16. //
  17. #define GET_DIRECTORIES (TRUE)
  18. #define GET_FILES (FALSE)
  19. #define DELETE_CURRENT_DIR_TREE (TRUE)
  20. #define DONT_DELETE_CURRENT_DIR_TREE (FALSE)
  21. #define DELETE_FILES_ONLY (TRUE)
  22. #define DELETE_EVERYTHING (FALSE)
  23. #define CONTINUE_ON_OPEN_SHEET (TRUE)
  24. #define DONT_CONTINUE_ON_OPEN_SHEET (FALSE)
  25. //
  26. // Forward Definitions
  27. //
  28. class CIISObject;
  29. //
  30. // Extraction Helpers
  31. //
  32. INTERNAL * ExtractInternalFormat(LPDATAOBJECT lpDataObject);
  33. wchar_t * ExtractWorkstation(LPDATAOBJECT lpDataObject);
  34. GUID * ExtractNodeType(LPDATAOBJECT lpDataObject);
  35. CLSID * ExtractClassID(LPDATAOBJECT lpDataObject);
  36. //
  37. // Taskpad enumeration
  38. //
  39. class CEnumTasks :
  40. public IEnumTASK,
  41. public CComObjectRoot
  42. {
  43. public:
  44. CEnumTasks();
  45. virtual ~CEnumTasks();
  46. //
  47. // IEnumTASKS implementation
  48. //
  49. public:
  50. BEGIN_COM_MAP(CEnumTasks)
  51. COM_INTERFACE_ENTRY(IEnumTASK)
  52. END_COM_MAP()
  53. #if DBG==1
  54. public:
  55. ULONG InternalAddRef() { return CComObjectRoot::InternalAddRef(); }
  56. ULONG InternalRelease() { return CComObjectRoot::InternalRelease(); }
  57. int dbg_InstID;
  58. #endif // DBG==1
  59. //
  60. // IEnumTASK methods
  61. //
  62. public:
  63. STDMETHOD(Next)(
  64. OUT ULONG celt,
  65. OUT MMC_TASK * rgelt,
  66. OUT ULONG * pceltFetched
  67. );
  68. STDMETHOD(Skip)(ULONG celt);
  69. STDMETHOD(Reset)();
  70. STDMETHOD(Clone)(IEnumTASK ** ppenum);
  71. public:
  72. HRESULT Init(IDataObject * pdo, LPOLESTR szTaskGroup);
  73. private:
  74. CIISObject * m_pObject;
  75. };
  76. ///////////////////////////////////////////////////////////////////////////////
  77. class CComponentDataImpl:
  78. public IComponentData,
  79. public IExtendContextMenu,
  80. public IExtendPropertySheet,
  81. public IPersistStream,
  82. public ISnapinHelp,
  83. public CComObjectRoot,
  84. public CComCoClass<CComponentDataImpl, &CLSID_Snapin>
  85. /*++
  86. Class Description:
  87. Component Data Implementation class
  88. Public Interface:
  89. --*/
  90. {
  91. public:
  92. DECLARE_REGISTRY(
  93. CSnapin,
  94. _T("ISMSnapin.Snapin.1"),
  95. _T("ISMSnapin.Snapin"),
  96. IDS_SNAPIN_DESC,
  97. THREADFLAGS_BOTH
  98. )
  99. BEGIN_COM_MAP(CComponentDataImpl)
  100. COM_INTERFACE_ENTRY(IComponentData)
  101. COM_INTERFACE_ENTRY(IExtendContextMenu)
  102. COM_INTERFACE_ENTRY(IExtendPropertySheet)
  103. COM_INTERFACE_ENTRY(IPersistStream)
  104. COM_INTERFACE_ENTRY(ISnapinHelp)
  105. END_COM_MAP()
  106. friend class CSnapin;
  107. friend class CDataObject;
  108. CComponentDataImpl();
  109. ~CComponentDataImpl();
  110. public:
  111. //
  112. // Return CLSID
  113. //
  114. virtual const CLSID & GetCoClassID() { return CLSID_Snapin; }
  115. //
  116. // IComponentData interface members
  117. //
  118. public:
  119. STDMETHOD(Initialize)(LPUNKNOWN pUnknown);
  120. STDMETHOD(CreateComponent)(LPCOMPONENT * ppComponent);
  121. STDMETHOD(Notify)(
  122. LPDATAOBJECT lpDataObject,
  123. MMC_NOTIFY_TYPE event,
  124. LPARAM arg,
  125. LPARAM param
  126. );
  127. STDMETHOD(Destroy)();
  128. STDMETHOD(QueryDataObject)(
  129. MMC_COOKIE cookie,
  130. DATA_OBJECT_TYPES type,
  131. LPDATAOBJECT * lplpDataObject
  132. );
  133. STDMETHOD(GetDisplayInfo)(LPSCOPEDATAITEM lpScopeDataItem);
  134. STDMETHOD(CompareObjects)(
  135. LPDATAOBJECT lpDataObjectA,
  136. LPDATAOBJECT lpDataObjectB
  137. );
  138. //
  139. // IExtendContextMenu
  140. //
  141. public:
  142. STDMETHOD(AddMenuItems)(LPDATAOBJECT pDataObject,
  143. LPCONTEXTMENUCALLBACK pCallbackUnknown,
  144. long * pInsertionAllowed
  145. );
  146. STDMETHOD(Command)(
  147. long nCommandID,
  148. LPDATAOBJECT lpDataObject
  149. );
  150. //
  151. // IExtendPropertySheet interface
  152. //
  153. public:
  154. STDMETHOD(CreatePropertyPages)(
  155. LPPROPERTYSHEETCALLBACK lpProvider,
  156. LONG_PTR handle,
  157. LPDATAOBJECT lpDataObject
  158. );
  159. STDMETHOD(QueryPagesFor)(LPDATAOBJECT lpDataObject);
  160. //
  161. // IPersistStream interface members
  162. //
  163. public:
  164. STDMETHOD(GetClassID)(CLSID * pClassID);
  165. STDMETHOD(IsDirty)();
  166. STDMETHOD(Load)(IStream * pStm);
  167. STDMETHOD(Save)(IStream * pStm, BOOL fClearDirty);
  168. STDMETHOD(GetSizeMax)(ULARGE_INTEGER * pcbSize);
  169. // ISnapinHelp helper function
  170. STDMETHOD(GetHelpTopic)(LPOLESTR *pszHelpFile);
  171. //
  172. // Notify handler declarations
  173. //
  174. private:
  175. HRESULT OnAdd(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  176. HRESULT OnDelete(MMC_COOKIE cookie);
  177. HRESULT OnRemoveChildren(LPARAM arg);
  178. HRESULT OnRename(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  179. HRESULT OnExpand(LPDATAOBJECT lpDataObject, LPARAM arg, LPARAM param);
  180. HRESULT OnSelect(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  181. HRESULT OnContextMenu(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  182. HRESULT OnProperties(LPARAM param);
  183. #ifdef _DEBUG
  184. public:
  185. ULONG InternalAddRef() { return CComObjectRoot::InternalAddRef(); }
  186. ULONG InternalRelease() { return CComObjectRoot::InternalRelease(); }
  187. #endif // _DEBUG
  188. //
  189. // Scope item creation helpers
  190. //
  191. protected:
  192. void LoadDynamicExtensions(
  193. HSCOPEITEM pParent,
  194. CIISObject * pObject
  195. );
  196. void EnumerateScopePane(
  197. LPDATAOBJECT lpDataObject,
  198. HSCOPEITEM pParent
  199. );
  200. void ExpandIISObject(
  201. HSCOPEITEM pParent,
  202. CIISObject * pObject,
  203. LPTSTR lpszMachineName = NULL
  204. );
  205. void RefreshIISObject(
  206. CIISObject * pObject,
  207. BOOL fExpandTree,
  208. HSCOPEITEM pParent = NULL
  209. );
  210. //
  211. // Access
  212. //
  213. public:
  214. //
  215. // Get the server list
  216. //
  217. CObListPlus & GetServerList() { return m_oblServers; }
  218. //
  219. // Add a service object for each service entry in this
  220. // inetsloc-discovered information.
  221. //
  222. DWORD AddServerToList(
  223. IN BOOL fCache, // TRUE to add it to the cache
  224. IN LPINET_SERVER_INFO lpsi, // Discovery information
  225. IN CObListPlus & oblServices // List of installed services
  226. );
  227. //
  228. // Add a service object for each service running
  229. // on the machine listed above.
  230. //
  231. DWORD AddServerToList(
  232. IN BOOL fCache, // TRUE to add to the cache
  233. IN BOOL fDisplayErrors, // TRUE to handle errors
  234. IN CString & lpServerName, // Name of this server
  235. IN int & cServices, // # Services added
  236. IN CObListPlus & oblServices // List of installed services
  237. );
  238. //
  239. // Add a service object for each service running
  240. // on the machine listed above.
  241. //
  242. DWORD AddServerToList(
  243. IN BOOL fCache, // TRUE to add to the cache
  244. IN BOOL fDisplayErrors, // TRUE to handle errors
  245. IN CString & lpServerName, // Name of this server
  246. IN int & cServices // # Services added
  247. );
  248. //
  249. // Remove all service objects belonging to the given server name
  250. // from the list.
  251. //
  252. DWORD RemoveServerFromList(
  253. IN BOOL fCache,
  254. IN CString & strServerName
  255. );
  256. //
  257. //
  258. // Remove the entire list
  259. //
  260. void EmptyServerList();
  261. //
  262. // These numbers apply to the services in the mask
  263. //
  264. int QueryNumServers() const { return m_cServers; }
  265. int QueryNumServicesRunning() const { return m_cServicesRunning; }
  266. void AddToNumRunning(int nChange) { m_cServicesRunning += nChange; }
  267. void AddToNumServers(int nChange) { m_cServers += nChange; }
  268. //
  269. // Find server info object
  270. //
  271. CServerInfo * FindServerInfo(
  272. IN LPCTSTR lpstrMachine,
  273. IN CServiceInfo * pServiceInfo
  274. );
  275. //
  276. // Refresh the list information
  277. //
  278. void Refresh();
  279. //
  280. // Return TRUE if the entry was actually added, FALSE
  281. // if it was merely refreshed.
  282. //
  283. BOOL AddToList(
  284. IN BOOL fCache,
  285. IN CServerInfo * pServerInfo,
  286. IN BOOL fSelect = FALSE
  287. );
  288. //
  289. // Get the scope item handle of the root of the snap-in
  290. //
  291. HSCOPEITEM GetRootHandle() const { return m_hIISRoot; }
  292. //
  293. // Private Access to doc object functions
  294. //
  295. protected:
  296. //
  297. // Matchup DLL with super dlls
  298. //
  299. void MatchupSuperDLLs();
  300. //
  301. // Load the service DLLs
  302. //
  303. void GetServicesDLL();
  304. //
  305. // Load the add-on tools
  306. //
  307. void GetToolMenu();
  308. //
  309. // Get the names DLL names containing the machine page
  310. // extentions
  311. //
  312. void GetISMMachinePages();
  313. //
  314. // Add the fully constructed service object
  315. // to the list.
  316. //
  317. void AddServiceToList(CServiceInfo * pServiceInfo);
  318. int QueryNumInstalledServices() const;
  319. CServiceInfo * GetServiceAt(int nIndex);
  320. //
  321. // Cache Functions
  322. //
  323. protected:
  324. void AddCachedServersToView();
  325. void AddServerToCache(LPCTSTR strServer, BOOL fSetCacheDirty);
  326. BOOL RemoveServerFromCache(LPCTSTR strServer);
  327. CStringList & GetCachedServers() { return m_strlCachedServers; }
  328. void SetCacheDirty(BOOL fDirty = TRUE) { m_fIsCacheDirty = fDirty;}
  329. void ClearCacheDirty() { m_fIsCacheDirty = FALSE; }
  330. BOOL IsCacheDirty() { return m_fIsCacheDirty; }
  331. //
  332. // Helpers
  333. //
  334. protected:
  335. //
  336. // Bitmap types, as used by GetBitmapParms
  337. //
  338. enum BMP_TYPES
  339. {
  340. BMT_BUTTON,
  341. BMT_SERVICE,
  342. BMT_VROOT,
  343. };
  344. //
  345. // Verify bitmap is of the proper dimensions
  346. //
  347. BOOL VerifyBitmapSize(
  348. IN HBITMAP hBitmap,
  349. IN LONG nHeight,
  350. IN LONG nWidth
  351. );
  352. //
  353. // Helper function to stretch and compress a bitmap to a
  354. // 16x16 and a 32x32 image
  355. //
  356. void ConvertBitmapFormats(
  357. IN CBitmap & bmpSource,
  358. OUT CBitmap & bmp16x16,
  359. OUT CBitmap & bmp32x32
  360. );
  361. //
  362. // Fetch specific bitmap information from a service object
  363. //
  364. BOOL GetBitmapParms(
  365. IN CServiceInfo * pServiceInfo,
  366. IN BMP_TYPES bmpt,
  367. OUT CBitmap *& pbmp16x16,
  368. OUT CBitmap *& pbmp32x32,
  369. OUT COLORREF & rgbMask
  370. );
  371. protected:
  372. void DoConfigure(CIISObject * pObject);
  373. void DisconnectItem(CIISObject * pObject);
  374. void OnConnectOne();
  375. void OnMetaBackRest(CIISObject * pObject);
  376. void OnIISShutDown(CIISObject * pObject);
  377. BOOL DeleteObject(CIISObject * pObject);
  378. BOOL DoChangeState(CIISObject * pObject, int nNewState);
  379. BOOL FindOpenPropSheetOnNodeAndDescendants(
  380. IN LPPROPERTYSHEETPROVIDER piPropertySheetProvider,
  381. IN MMC_COOKIE cookie
  382. );
  383. BOOL KillChildren(
  384. IN HSCOPEITEM hParent,
  385. IN UINT nOpenErrorMsg,
  386. IN BOOL fFileNodesOnly,
  387. IN BOOL fContinueOnOpenSheet
  388. );
  389. HSCOPEITEM FindNextInstanceSibling(
  390. HSCOPEITEM hParent,
  391. CIISObject * pObject,
  392. BOOL * pfNext
  393. );
  394. HSCOPEITEM FindNextVDirSibling(
  395. HSCOPEITEM hParent,
  396. CIISObject * pObject
  397. );
  398. HSCOPEITEM AddIISObject(
  399. HSCOPEITEM hParent,
  400. CIISObject * pObject,
  401. HSCOPEITEM hNextSibling = NULL,
  402. BOOL fNext = TRUE
  403. );
  404. HSCOPEITEM FindServerInfoParent(
  405. HSCOPEITEM hParent,
  406. CServerInfo * pServerInfo
  407. );
  408. HSCOPEITEM AddServerInfoParent(
  409. HSCOPEITEM hParent,
  410. CServerInfo * pServerInfo
  411. );
  412. HSCOPEITEM ForceAddServerInfoParent(
  413. HSCOPEITEM hParent,
  414. CServerInfo * pServerInfo
  415. );
  416. HSCOPEITEM AddInstances(
  417. HSCOPEITEM hParent,
  418. CIISObject * pObject
  419. );
  420. HSCOPEITEM AddVirtualRoots(
  421. HSCOPEITEM hParent,
  422. LPCTSTR lpstrParentPath,
  423. CIISInstance * pObject
  424. );
  425. HSCOPEITEM AddFileSystem(
  426. HSCOPEITEM hParent,
  427. LPCTSTR lpstrRoot,
  428. LPCTSTR lpstrMetaRoot,
  429. CIISInstance * pObject,
  430. BOOL fGetDirs,
  431. BOOL fDeleteCurrentFileSystem
  432. );
  433. HSCOPEITEM AddServerInfo(
  434. HSCOPEITEM hRootNode,
  435. CServerInfo * pServerInfo,
  436. BOOL fAddParent
  437. );
  438. void AddScopeItemToResultPane(MMC_COOKIE cookie);
  439. private:
  440. BOOL m_fIsExtension;
  441. LPCONSOLENAMESPACE m_pScope;
  442. //LPCONSOLE m_pConsole;
  443. LPCONSOLE2 m_pConsole;
  444. HSCOPEITEM m_hIISRoot;
  445. //
  446. // List of service info structures
  447. //
  448. CObListPlus m_oblServices;
  449. ULONGLONG m_ullDiscoveryMask;
  450. //
  451. // Server list;
  452. //
  453. CObListPlus m_oblServers;
  454. //
  455. // New instance commands for services that support it
  456. //
  457. CObListPlus m_oblNewInstanceCmds;
  458. //
  459. // Counts
  460. //
  461. int m_cServers;
  462. int m_cServicesRunning;
  463. //
  464. // Cache
  465. //
  466. BOOL m_fIsCacheDirty;
  467. CStringList m_strlCachedServers;
  468. #ifdef _DEBUG
  469. friend class CDataObject;
  470. int m_cDataObjects;
  471. #endif
  472. };
  473. //
  474. // Snapin Description:
  475. //
  476. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  477. class CSnapin :
  478. public IComponent,
  479. public IExtendContextMenu,
  480. public IExtendControlbar,
  481. public IExtendPropertySheet,
  482. public IExtendTaskPad,
  483. public IResultDataCompareEx,
  484. //public IResultOwnerData,
  485. public IPersistStream,
  486. public ISnapinHelp,
  487. public CComObjectRoot
  488. /*++
  489. Class Description:
  490. Main snapin object class
  491. Public Interface:
  492. CSnapin : Constructor
  493. ~CSnapin : Destructor
  494. --*/
  495. {
  496. //
  497. // Constructor/Destructor
  498. //
  499. public:
  500. CSnapin();
  501. ~CSnapin();
  502. BEGIN_COM_MAP(CSnapin)
  503. COM_INTERFACE_ENTRY(IComponent)
  504. COM_INTERFACE_ENTRY(IExtendContextMenu)
  505. COM_INTERFACE_ENTRY(IExtendControlbar)
  506. COM_INTERFACE_ENTRY(IExtendPropertySheet)
  507. COM_INTERFACE_ENTRY(IExtendTaskPad)
  508. COM_INTERFACE_ENTRY(IResultDataCompareEx)
  509. COM_INTERFACE_ENTRY(IPersistStream)
  510. END_COM_MAP()
  511. friend class CDataObject;
  512. static long lDataObjectRefCount;
  513. //
  514. // IComponent interface members
  515. //
  516. public:
  517. STDMETHOD(Initialize)(LPCONSOLE lpConsole);
  518. STDMETHOD(Notify)(
  519. LPDATAOBJECT lpDataObject,
  520. MMC_NOTIFY_TYPE event,
  521. LPARAM arg,
  522. LPARAM param
  523. );
  524. STDMETHOD(Destroy)(MMC_COOKIE cookie);
  525. STDMETHOD(GetResultViewType)(
  526. MMC_COOKIE cookie,
  527. BSTR * ppViewType,
  528. long * pViewOptions
  529. );
  530. STDMETHOD(QueryDataObject)(
  531. MMC_COOKIE cookie,
  532. DATA_OBJECT_TYPES type,
  533. LPDATAOBJECT * lplpDataObject
  534. );
  535. STDMETHOD(GetDisplayInfo)(
  536. LPRESULTDATAITEM lpResultDataItem
  537. );
  538. STDMETHOD(CompareObjects)(
  539. LPDATAOBJECT lpDataObjectA,
  540. LPDATAOBJECT lpDataObjectB
  541. );
  542. //
  543. // IResultDataCompareEx interface
  544. //
  545. public:
  546. STDMETHOD(Compare)(RDCOMPARE * prdc, int * pnResult);
  547. //
  548. // IExtendControlbar interface
  549. //
  550. public:
  551. STDMETHOD(SetControlbar)(LPCONTROLBAR pControlbar);
  552. STDMETHOD(ControlbarNotify)(
  553. MMC_NOTIFY_TYPE event,
  554. LPARAM arg,
  555. LPARAM param
  556. );
  557. //
  558. // IExtendPropertySheet interface
  559. //
  560. public:
  561. STDMETHOD(CreatePropertyPages)(
  562. LPPROPERTYSHEETCALLBACK lpProvider,
  563. LONG_PTR handle,
  564. LPDATAOBJECT lpDataObject
  565. );
  566. STDMETHOD(QueryPagesFor)(LPDATAOBJECT lpDataObject);
  567. //
  568. // IExtendTaskpad methods
  569. //
  570. public:
  571. STDMETHOD(TaskNotify)(IDataObject * pdo, VARIANT * arg, VARIANT * param);
  572. STDMETHOD(EnumTasks)(
  573. IN IDataObject * pdo,
  574. IN LPOLESTR szTaskGroup,
  575. OUT IEnumTASK ** ppEnumTASK
  576. );
  577. STDMETHOD(GetTitle)(LPOLESTR pszGroup, LPOLESTR * pszTitle);
  578. STDMETHOD(GetDescriptiveText)(LPOLESTR pszGroup, LPOLESTR * pszText);
  579. STDMETHOD(GetBanner)(LPOLESTR pszGroup, LPOLESTR * szBitmapResource);
  580. STDMETHOD(GetBackground)(
  581. LPOLESTR pszGroup,
  582. MMC_TASK_DISPLAY_OBJECT * pTDO
  583. );
  584. STDMETHOD(GetListPadInfo)(
  585. LPOLESTR pszGroup,
  586. MMC_LISTPAD_INFO * lpListPadInfo
  587. )
  588. {
  589. return E_NOTIMPL;
  590. }
  591. //
  592. // IPersistStream interface:
  593. //
  594. public:
  595. STDMETHOD(GetClassID)(CLSID *pClassID);
  596. STDMETHOD(IsDirty)();
  597. STDMETHOD(Load)(IStream * pStm);
  598. STDMETHOD(Save)(IStream * pStm, BOOL fClearDirty);
  599. STDMETHOD(GetSizeMax)(ULARGE_INTEGER * pcbSize);
  600. // ISnapinHelp helper function
  601. STDMETHOD(GetHelpTopic)(LPOLESTR *pszHelpFile);
  602. //
  603. // IExtendContextMenu interface:
  604. //
  605. public:
  606. STDMETHOD(AddMenuItems)(
  607. LPDATAOBJECT pDataObject,
  608. LPCONTEXTMENUCALLBACK pCallbackUnknown,
  609. long * pInsertionAllowed
  610. );
  611. STDMETHOD(Command)(long nCommandID, LPDATAOBJECT pDataObject);
  612. //
  613. // Helpers for CSnapin
  614. //
  615. public:
  616. void SetIComponentData(CComponentDataImpl * pData);
  617. #if _DEBUG
  618. public:
  619. int dbg_cRef;
  620. ULONG InternalAddRef() {++dbg_cRef; return CComObjectRoot::InternalAddRef();}
  621. ULONG InternalRelease() {--dbg_cRef; return CComObjectRoot::InternalRelease();}
  622. #endif // _DEBUG
  623. //
  624. // Notify event handlers
  625. //
  626. protected:
  627. HRESULT OnFolder(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  628. HRESULT OnAddImages(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  629. HRESULT OnShow(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  630. HRESULT OnActivate(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  631. HRESULT OnMinimize(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  632. HRESULT OnPropertyChange(LPDATAOBJECT lpDataObject);
  633. HRESULT OnUpdateView(LPDATAOBJECT lpDataObject);
  634. HRESULT OnResultItemClkOrDblClk(MMC_COOKIE cookie, BOOL fDblClick);
  635. HRESULT OnButtonClick(LPDATAOBJECT lpDataObject, long lID);
  636. HRESULT SetToolbarStates(MMC_COOKIE cookie);
  637. void DestroyItem(LPDATAOBJECT lpDataObject);
  638. void HandleToolbar(LPARAM arg, LPARAM param);
  639. void HandleStandardVerbs(LPARAM arg, LPDATAOBJECT lpDataObject);
  640. //
  641. // Helper functions
  642. //
  643. protected:
  644. LPTSTR StringReferenceFromResourceID(UINT nID);
  645. BOOL IsEnumerating(LPDATAOBJECT lpDataObject);
  646. void LoadResources();
  647. HRESULT InitializeHeaders(MMC_COOKIE cookie);
  648. CISMShellExecutable * GetCommandAt(CObListPlus & obl, int nIndex);
  649. void Enumerate(MMC_COOKIE cookie, HSCOPEITEM pParent);
  650. void EnumerateResultPane(MMC_COOKIE cookie);
  651. void AddFileSystem(
  652. HSCOPEITEM hParent,
  653. LPCTSTR lpstrRoot,
  654. LPCTSTR lpstrMetaRoot,
  655. CIISInstance * pInstance,
  656. BOOL fGetDirs
  657. );
  658. //
  659. // Result pane helpers
  660. //
  661. protected:
  662. HRESULT InitializeBitmaps(MMC_COOKIE cookie);
  663. //
  664. // Interface pointers
  665. //
  666. protected:
  667. BOOL m_fWinSockInit; // Winsock initialized?
  668. BOOL m_fTaskView; // Taskpad view?
  669. BOOL m_fSettingsChanged;
  670. BOOL m_fIsExtension;
  671. LPCONSOLE m_pConsole; // Console's IConsole interface
  672. LPHEADERCTRL m_pHeader; // Result pane's header control interface
  673. LPCOMPONENTDATA m_pComponentData;
  674. LPCONSOLEVERB m_pConsoleVerb;
  675. LPRESULTDATA m_pResult; // My interface pointer to the result pane
  676. LPIMAGELIST m_pImageResult; // My interface pointer to the result pane image list
  677. LPTOOLBAR m_pToolbar; // Toolbar for view
  678. LPCONTROLBAR m_pControlbar; // control bar to hold my tool bars
  679. //LPEXTENDTASKPAD m_pTaskPad;
  680. //CComPtr<ITaskPad> m_pITaskPad;
  681. CBitmap * m_pbmpToolbar; // Imagelist for the toolbar
  682. CStringList m_strlRef; // Referred strings;
  683. CObListPlus m_oblResultItems; // Result item cache
  684. };
  685. inline void
  686. CSnapin::SetIComponentData(
  687. IN CComponentDataImpl * pData
  688. )
  689. {
  690. ASSERT(pData);
  691. ASSERT(m_pComponentData == NULL);
  692. LPUNKNOWN pUnk = pData->GetUnknown();
  693. HRESULT hr;
  694. hr = pUnk->QueryInterface(IID_IComponentData, (void **)&m_pComponentData);
  695. ASSERT(hr == S_OK);
  696. }
  697. class CSnapinAboutImpl :
  698. public ISnapinAbout,
  699. public CComObjectRoot,
  700. public CComCoClass<CSnapinAboutImpl, &CLSID_About>
  701. /*++
  702. Class Description:
  703. About dialog implementation
  704. Public Interface:
  705. CSnapinAboutImpl : Constructor
  706. ~CSnapinAboutImpl : Destructor
  707. --*/
  708. {
  709. //
  710. // Constructor/Destructor
  711. //
  712. public:
  713. CSnapinAboutImpl();
  714. ~CSnapinAboutImpl();
  715. public:
  716. DECLARE_REGISTRY(
  717. CSnapin,
  718. _T("ISMSnapin.About.1"),
  719. _T("ISMSnapin.About"),
  720. IDS_SNAPIN_DESC,
  721. THREADFLAGS_BOTH
  722. )
  723. BEGIN_COM_MAP(CSnapinAboutImpl)
  724. COM_INTERFACE_ENTRY(ISnapinAbout)
  725. END_COM_MAP()
  726. public:
  727. STDMETHOD(GetSnapinDescription)(LPOLESTR * lpDescription);
  728. STDMETHOD(GetProvider)(LPOLESTR * lpName);
  729. STDMETHOD(GetSnapinVersion)(LPOLESTR * lpVersion);
  730. STDMETHOD(GetSnapinImage)(HICON * hAppIcon);
  731. STDMETHOD(GetStaticFolderImage)(
  732. HBITMAP * hSmallImage,
  733. HBITMAP * hSmallImageOpen,
  734. HBITMAP * hLargeImage,
  735. COLORREF * cMask
  736. );
  737. //
  738. // Internal functions
  739. //
  740. private:
  741. HRESULT AboutHelper(UINT nID, LPOLESTR * lpPtr);
  742. };
  743. //
  744. // Helper macro
  745. //
  746. #define FREE_DATA(pData) ASSERT(pData != NULL);\
  747. do { if (pData != NULL) GlobalFree(pData); } while(0);
  748. //
  749. // Inline Expansion
  750. //
  751. // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  752. inline DWORD CComponentDataImpl::AddServerToList(
  753. IN BOOL fCache,
  754. IN BOOL fDisplayErrors,
  755. IN CString & lpServerName,
  756. IN int & cServices
  757. )
  758. {
  759. return AddServerToList(
  760. fCache,
  761. fDisplayErrors,
  762. lpServerName,
  763. cServices,
  764. m_oblServices
  765. );
  766. }
  767. inline void CComponentDataImpl::AddServiceToList(CServiceInfo * pServiceInfo)
  768. {
  769. m_oblServices.AddTail(pServiceInfo);
  770. }
  771. inline int CComponentDataImpl::QueryNumInstalledServices() const
  772. {
  773. return (int) m_oblServices.GetCount();
  774. }