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.

184 lines
4.6 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation
  3. Module Name:
  4. compdata.h
  5. Abstract:
  6. header file defines CComponentData class
  7. Author:
  8. William Hsieh (williamh) created
  9. Revision History:
  10. --*/
  11. #ifndef __COMPDATA_H_
  12. #define __COMPDATA_H_
  13. extern const WCHAR* const DM_COMPDATA_SIGNATURE;
  14. class CComponent;
  15. class CComponentData :
  16. public IComponentData,
  17. public IExtendPropertySheet,
  18. public IExtendContextMenu,
  19. public IPersistStream,
  20. public ISnapinHelp
  21. {
  22. public:
  23. CComponentData();
  24. ~CComponentData();
  25. //
  26. // IUNKNOWN interface
  27. //
  28. STDMETHOD_(ULONG, AddRef)();
  29. STDMETHOD_(ULONG, Release)();
  30. STDMETHOD(QueryInterface)(REFIID riid, void** ppv);
  31. //
  32. // IComponentData interface
  33. //
  34. STDMETHOD(Initialize)(LPUNKNOWN pUnknown);
  35. STDMETHOD(CreateComponent)(LPCOMPONENT* ppComponent);
  36. STDMETHOD(Notify)(LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param);
  37. STDMETHOD(Destroy)();
  38. STDMETHOD(QueryDataObject)(MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT* ppDataObject);
  39. STDMETHOD(GetDisplayInfo)(SCOPEDATAITEM* pScopeDataItem);
  40. STDMETHOD(CompareObjects)(LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB);
  41. //
  42. // IExtendPropertySheet
  43. //
  44. STDMETHOD(CreatePropertyPages)(LPPROPERTYSHEETCALLBACK lpProvider, LONG_PTR handle, LPDATAOBJECT lpDataObject);
  45. STDMETHOD(QueryPagesFor)(LPDATAOBJECT lpDataObject);
  46. //
  47. // IExtendContextMenu
  48. //
  49. STDMETHOD(AddMenuItems)(LPDATAOBJECT pDataObject, LPCONTEXTMENUCALLBACK lpCallbackUnknown,
  50. long* pInsertionAllowed);
  51. STDMETHOD(Command)(long nCommandID, LPDATAOBJECT pDataObject);
  52. //
  53. // IPersistStream
  54. //
  55. STDMETHOD(IsDirty)();
  56. STDMETHOD(Load)(IStream* pStm);
  57. STDMETHOD(Save)(IStream* pStm, BOOL fClearDirty);
  58. STDMETHOD(GetSizeMax)(ULARGE_INTEGER *pcbSize);
  59. STDMETHOD(GetClassID)(CLSID* pClassID);
  60. virtual const CLSID& GetCoClassID() = 0;
  61. virtual BOOL IsPrimarySnapin() = 0;
  62. //
  63. //ISnapinHelp
  64. //
  65. STDMETHOD(GetHelpTopic)(LPOLESTR* lpCompileHelpFile);
  66. //
  67. // Helper functions
  68. //
  69. CCookie* GetActiveCookie(MMC_COOKIE cookie)
  70. {
  71. return (NULL == cookie) ? m_pCookieRoot : (CCookie*)cookie;
  72. }
  73. CScopeItem* FindScopeItem(MMC_COOKIE cookie);
  74. BOOL InitializeMachine()
  75. {
  76. ASSERT(m_pMachine);
  77. if (m_pMachine)
  78. {
  79. return m_pMachine->Initialize(m_hwndMain, NULL);
  80. }
  81. return FALSE;
  82. }
  83. String m_strMachineName;
  84. CMachine* m_pMachine;
  85. COOKIE_TYPE m_ctRoot;
  86. String m_strStartupDeviceId;
  87. String m_strStartupCommand;
  88. void SetDirty()
  89. {
  90. m_IsDirty = TRUE;
  91. }
  92. LPCONSOLENAMESPACE m_pScope;
  93. LPCONSOLE m_pConsole;
  94. HWND m_hwndMain;
  95. private:
  96. //
  97. // Event notification functions
  98. //
  99. HRESULT OnDelete(MMC_COOKIE cookie, MMC_COOKIE arg, LPARAM param);
  100. HRESULT OnExpand(LPDATAOBJECT lpDataObject, LPARAM arg, LPARAM param);
  101. HRESULT OnRename(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  102. HRESULT OnContextMenu(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  103. HRESULT OnProperties(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  104. HRESULT OnBtnClick(MMC_COOKIE cookie, LPARAM arg, LPARAM param);
  105. HRESULT CreateScopeItems();
  106. HRESULT CreateCookieSubtree(CScopeItem* pScopeItem, CCookie* pCookieParent);
  107. HRESULT LoadScopeIconsForScopePane();
  108. HRESULT ResetScopeItem(CScopeItem* pScopeItem);
  109. HRESULT DoStartupProperties(LPPROPERTYSHEETCALLBACK lpProvider, LONG_PTR handle,
  110. LPDATAOBJECT pDataObject);
  111. BOOL m_IsDirty;
  112. CCookie* m_pCookieRoot;
  113. CScopeItem* m_pScopeItemRoot;
  114. LONG m_Ref;
  115. };
  116. //
  117. // Primary snapin
  118. //
  119. class CComponentDataPrimary : public CComponentData
  120. {
  121. public:
  122. virtual const CLSID& GetCoClassID()
  123. {
  124. return CLSID_DEVMGR;
  125. }
  126. virtual BOOL IsPrimarySnapin()
  127. {
  128. return TRUE;
  129. }
  130. };
  131. //
  132. // Extension snapin
  133. //
  134. class CComponentDataExtension : public CComponentData
  135. {
  136. public:
  137. virtual const CLSID& GetCoClassID()
  138. {
  139. return CLSID_DEVMGR_EXTENSION;
  140. }
  141. virtual BOOL IsPrimarySnapin()
  142. {
  143. return FALSE;
  144. }
  145. };
  146. typedef struct tagCompDataPersistInfo
  147. {
  148. DWORD Size;
  149. WCHAR Signature[16];
  150. COOKIE_TYPE RootCookie;
  151. WCHAR ComputerFullName[MAX_PATH + 3];
  152. } COMPDATA_PERSISTINFO, *PCOMPDATA_PERSISTINFO;
  153. #endif //__COMPDATA_H_