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.

140 lines
4.0 KiB

  1. //
  2. // CComponentData class
  3. //
  4. #include "wbemcli.h"
  5. #include "SComPtr.h"
  6. class CComponentData:
  7. public IComponentData,
  8. public IPersistStreamInit,
  9. public ISnapinHelp,
  10. public IExtendContextMenu
  11. {
  12. friend class CDataObject;
  13. friend class CSnapIn;
  14. protected:
  15. ULONG m_cRef;
  16. HWND m_hwndFrame;
  17. LPCONSOLENAMESPACE m_pScope;
  18. LPCONSOLE m_pConsole;
  19. HSCOPEITEM m_hRoot;
  20. HSCOPEITEM m_ahChildren[NUM_NAMESPACE_ITEMS];
  21. LPGPEINFORMATION m_pGPTInformation;
  22. LPIEAKMMCCOOKIE m_lpCookieList;
  23. BOOL m_fOneTimeApply; // flag on whether to apply GPO once or always
  24. TCHAR m_szInsFile[MAX_PATH]; // current path to ins file in current GPO
  25. HANDLE m_hLock; // handle to our lock file in the GPO
  26. public:
  27. CComponentData(BOOL bIsRSoP);
  28. ~CComponentData();
  29. STDMETHODIMP SetInsFile();
  30. LPCTSTR GetInsFile() {return m_szInsFile;}
  31. STDMETHODIMP_(HANDLE) GetLockHandle();
  32. STDMETHODIMP SetLockHandle(HANDLE hLock);
  33. STDMETHODIMP SignalPolicyChanged(BOOL bMachine, BOOL bAdd, GUID *pGuidExtension,
  34. GUID *pGuidSnapin);
  35. //
  36. // RSoP implementation methods
  37. //
  38. BOOL IsRSoP() {return m_bIsRSoP;}
  39. BSTR GetRSoPNamespace() {return m_bstrRSoPNamespace;}
  40. // IUnknown methods
  41. STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
  42. STDMETHODIMP_(ULONG) AddRef();
  43. STDMETHODIMP_(ULONG) Release();
  44. //
  45. // Implemented IComponentData methods
  46. //
  47. STDMETHODIMP Initialize(LPUNKNOWN pUnknown);
  48. STDMETHODIMP CreateComponent(LPCOMPONENT* ppComponent);
  49. STDMETHODIMP QueryDataObject(MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT* ppDataObject);
  50. STDMETHODIMP Destroy(void);
  51. STDMETHODIMP Notify(LPDATAOBJECT lpDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param);
  52. STDMETHODIMP GetDisplayInfo(LPSCOPEDATAITEM pItem);
  53. STDMETHODIMP CompareObjects(LPDATAOBJECT lpDataObjectA, LPDATAOBJECT lpDataObjectB);
  54. //
  55. // Implemented IExtendContextMenu methods
  56. //
  57. STDMETHODIMP AddMenuItems(LPDATAOBJECT lpDataObject,
  58. LPCONTEXTMENUCALLBACK piCallback, long *pInsertionAllowed);
  59. STDMETHODIMP Command(long lCommandID, LPDATAOBJECT lpDataObject);
  60. //
  61. // Implemented IPersistStreamInit interface members
  62. //
  63. STDMETHODIMP GetClassID(CLSID *pClassID);
  64. STDMETHODIMP IsDirty(VOID);
  65. STDMETHODIMP Load(IStream *pStm);
  66. STDMETHODIMP Save(IStream *pStm, BOOL fClearDirty);
  67. STDMETHODIMP GetSizeMax(ULARGE_INTEGER *pcbSize);
  68. STDMETHODIMP InitNew(VOID);
  69. //
  70. // Implemented ISnapinHelp interface members
  71. //
  72. STDMETHODIMP GetHelpTopic(LPOLESTR *lpCompiledHelpFile);
  73. BOOL IsPlanningMode() { return m_bPlanningMode;}
  74. private:
  75. HRESULT EnumerateScopePane(LPDATAOBJECT lpDataObject, HSCOPEITEM hParent);
  76. //
  77. // RSoP implementation methods & variables
  78. //
  79. BOOL IsRSoPViewInPreferenceMode();
  80. BOOL m_bIsRSoP;
  81. BOOL m_bPlanningMode;
  82. IRSOPInformation *m_pRSOPInformation;
  83. BSTR m_bstrRSoPNamespace;
  84. };
  85. //
  86. // ComponentData class factory
  87. //
  88. class CComponentDataCF : public IClassFactory
  89. {
  90. protected:
  91. ULONG m_cRef;
  92. public:
  93. CComponentDataCF(BOOL bIsRSoP);
  94. ~CComponentDataCF();
  95. BOOL IsRSoP() {return m_bIsRSoP;}
  96. // IUnknown methods
  97. STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
  98. STDMETHODIMP_(ULONG) AddRef();
  99. STDMETHODIMP_(ULONG) Release();
  100. // IClassFactory methods
  101. STDMETHODIMP CreateInstance(LPUNKNOWN, REFIID, LPVOID FAR *);
  102. STDMETHODIMP LockServer(BOOL);
  103. private:
  104. BOOL m_bIsRSoP;
  105. };