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.

130 lines
4.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997-1998
  5. //
  6. // File: MacAdmin.hxx
  7. //
  8. // Contents: Declaration of the CMachineAdm
  9. //
  10. // Classes: CMachineAdm
  11. //
  12. // History: 12-10-97 mohamedn created
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include <catalog.hxx>
  17. #include "catadmin.hxx"
  18. //
  19. // forward declarations
  20. //
  21. class CCatAdm;
  22. typedef CComObject<CCatAdm> CatAdmObject;
  23. interface IHTMLDocument2;
  24. //+---------------------------------------------------------------------------
  25. //
  26. // Class: CMachineAdm
  27. //
  28. // Purpose: Index Server administration interface
  29. //
  30. // History: 12-10-97 mohamedn created
  31. //
  32. //----------------------------------------------------------------------------
  33. class ATL_NO_VTABLE CMachineAdm :
  34. public CComObjectRootEx<CComMultiThreadModel>,
  35. public CComCoClass<CMachineAdm, &CLSID_AdminIndexServer>,
  36. public IObjectSafetyImpl<CMachineAdm>,
  37. public IObjectWithSiteImpl<CMachineAdm>,
  38. public ISupportErrorInfo,
  39. public IDispatchImpl<IAdminIndexServer, &IID_IAdminIndexServer, &LIBID_CIODMLib>
  40. {
  41. public:
  42. CMachineAdm();
  43. ULONG InternalAddRef();
  44. ULONG InternalRelease();
  45. void IncObjectCount() { _cMinRefCountToDestroy++; }
  46. void DecObjectCount() { _cMinRefCountToDestroy--; }
  47. //
  48. // internal methods
  49. //
  50. void Initialize();
  51. void SetErrorInfo( HRESULT hRes );
  52. void GetCatalogAutomationObject(XPtr<CCatalogAdmin> & xCatAdmin,
  53. XInterface<CatAdmObject> & xICatAdm );
  54. BOOL CatalogExists( WCHAR const * pCatName, WCHAR const * pCatLocation );
  55. BOOL IsCurrentObjectValid() { return (CIODM_INITIALIZED == _eCurrentState); }
  56. IDispatch * GetIDisp( unsigned i );
  57. DECLARE_REGISTRY_RESOURCEID(IDR_MACHINEADM)
  58. BEGIN_COM_MAP(CMachineAdm)
  59. COM_INTERFACE_ENTRY(IAdminIndexServer)
  60. COM_INTERFACE_ENTRY(IDispatch)
  61. COM_INTERFACE_ENTRY_IMPL(IObjectSafety)
  62. COM_INTERFACE_ENTRY_IMPL(IObjectWithSite)
  63. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  64. END_COM_MAP()
  65. // ISupportsErrorInfo
  66. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  67. // IAdminIndexServer
  68. public:
  69. STDMETHOD(Stop)();
  70. STDMETHOD(Start)();
  71. STDMETHOD(Pause)();
  72. STDMETHOD(IsPaused)(VARIANT_BOOL *pfIsPaused);
  73. STDMETHOD(Continue)();
  74. STDMETHOD(IsRunning)(VARIANT_BOOL *pfIsRunning);
  75. STDMETHOD(EnableCI) ( VARIANT_BOOL fAutoStart );
  76. STDMETHOD(GetCatalog)( IDispatch ** pIDisp );
  77. STDMETHOD(FindNextCatalog)( VARIANT_BOOL * fFound);
  78. STDMETHOD(FindFirstCatalog)( VARIANT_BOOL * fFound);
  79. STDMETHOD(GetCatalogByName)(BSTR bstrCatalogName, IDispatch **pDisp);
  80. STDMETHOD(AddCatalog)(BSTR bstrCatName, BSTR bstrCatLocation, IDispatch **pIDsip);
  81. STDMETHOD(RemoveCatalog)(BSTR bstrCatName, VARIANT_BOOL fDelDirectory);
  82. STDMETHOD(get_MachineName)( BSTR *pVal);
  83. STDMETHOD(put_MachineName)( BSTR newVal);
  84. STDMETHOD(SetLongProperty) (BSTR bstrPropName, LONG lPropVal );
  85. STDMETHOD(GetLongProperty) (BSTR bstrPropName, LONG * plPropVal );
  86. STDMETHOD(SetSZProperty) (BSTR bstrPropName, BSTR bstrPropVal);
  87. STDMETHOD(GetSZProperty) (BSTR bstrPropName, BSTR * bstrPropVal);
  88. void SafeForScripting(void);
  89. private:
  90. HRESULT IUnknown_QueryService(IUnknown* punk, REFGUID guidService, REFIID riid, void **ppvOut);
  91. HRESULT GetHTMLDoc2(IUnknown *punk, IHTMLDocument2 **ppHtmlDoc);
  92. HRESULT LocalZoneCheckPath(LPCWSTR bstrPath);
  93. HRESULT LocalZoneCheck(IUnknown *punkSite);
  94. private:
  95. CMutexSem _mtx;
  96. DWORD _cEnumIndex;
  97. WCHAR _wcsMachineName[MAX_PATH];
  98. XPtr<CMachineAdmin> _xMachineAdmin;
  99. CCountedIDynArray<CatAdmObject> _aICatAdmin;
  100. //
  101. // to control when objects are deleted.
  102. //
  103. enum eCiOdmState { CIODM_NOT_INITIALIZED, CIODM_INITIALIZED, CIODM_DESTROY };
  104. eCiOdmState _eCurrentState;
  105. LONG _cMinRefCountToDestroy;
  106. };