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.

199 lines
5.2 KiB

  1. ///////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright(C) 1997-1998 Microsoft Corporation all rights reserved.
  4. //
  5. // Module: sdoserviceias.h
  6. //
  7. // Project: Everest
  8. //
  9. // Description: SDO Machine Class Declaration
  10. //
  11. // Author: TLP 9/1/98
  12. //
  13. ///////////////////////////////////////////////////////////////////////////
  14. #ifndef _INC_SDO_SERVICE_IAS_H_
  15. #define _INC_SDO_SERVICE_IAS_H_
  16. #include "resource.h" // main symbols
  17. #include <ias.h>
  18. #include <sdoiaspriv.h>
  19. #include "sdo.h"
  20. #include <sdofactory.h>
  21. #include "dsconnection.h"
  22. // SCM command for IAS service reset
  23. //
  24. #define SERVICE_CONTROL_RESET 128
  25. // Number of Service SDO properties
  26. //
  27. #define MAX_SERVICE_PROPERTIES 8
  28. // IAS Service SDO Property Information
  29. //
  30. typedef struct _IAS_PROPERTY_INFO
  31. {
  32. LONG Id;
  33. LPCWSTR lpszItemProgId;
  34. LPCWSTR lpszDSContainerName;
  35. } IAS_PROPERTY_INFO, *PIAS_PROPERTY_INFO;
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CSdoServiceIAS
  38. /////////////////////////////////////////////////////////////////////////////
  39. class CSdoServiceIAS : public CSdo
  40. {
  41. public:
  42. void getDataStoreObject(IDataStoreObject** obj) throw ()
  43. { (*obj = m_pDSObject)->AddRef(); }
  44. ////////////////////
  45. // ATL Interface Map
  46. ////////////////////
  47. BEGIN_COM_MAP(CSdoServiceIAS)
  48. COM_INTERFACE_ENTRY(ISdo)
  49. COM_INTERFACE_ENTRY(IDispatch)
  50. COM_INTERFACE_ENTRY_FUNC(IID_ISdoServiceControl, 0, &CSdoServiceIAS::QueryInterfaceInternal)
  51. COM_INTERFACE_ENTRY_IID(__uuidof(SdoService), CSdoServiceIAS)
  52. END_COM_MAP()
  53. DECLARE_SDO_FACTORY(CSdoServiceIAS);
  54. class CSdoServiceControlImpl :
  55. public IDispatchImpl<ISdoServiceControl, &IID_ISdoServiceControl, &LIBID_SDOIASLib>
  56. {
  57. public:
  58. CSdoServiceControlImpl(CSdoServiceIAS* pSdoServiceIAS);
  59. ~CSdoServiceControlImpl();
  60. //////////////////////////////
  61. // ISdoServiceControl Iterface
  62. ////////////////////////////////////////////////
  63. // IUnknown methods - delegate to outer IUnknown
  64. //////////////////////////////////////////////////////////////////////
  65. STDMETHOD(QueryInterface)(REFIID riid, void **ppv)
  66. {
  67. if ( riid == IID_IDispatch )
  68. {
  69. *ppv = static_cast<IDispatch*>(this);
  70. AddRef();
  71. return S_OK;
  72. }
  73. else
  74. {
  75. return m_pSdoServiceIAS->QueryInterface(riid, ppv);
  76. }
  77. }
  78. //////////////////////////////////////////////////////////////////////
  79. STDMETHOD_(ULONG,AddRef)(void)
  80. {
  81. return m_pSdoServiceIAS->AddRef();
  82. }
  83. //////////////////////////////////////////////////////////////////////
  84. STDMETHOD_(ULONG,Release)(void)
  85. {
  86. return m_pSdoServiceIAS->Release();
  87. }
  88. /////////////////////////////
  89. // ISdoServiceControl Methods
  90. //////////////////////////////////////////////////////////////////////
  91. STDMETHOD(StartService)(void);
  92. //////////////////////////////////////////////////////////////////////
  93. STDMETHOD(StopService)(void);
  94. //////////////////////////////////////////////////////////////////////
  95. STDMETHOD(GetServiceStatus)(
  96. /*[out]*/ LONG* pServiceStatus
  97. );
  98. //////////////////////////////////////////////////////////////////////
  99. STDMETHOD(ResetService)(void);
  100. private:
  101. //////////////////////////////////////////////////////////////////////
  102. HRESULT ControlIAS(DWORD dwControl);
  103. //////////////////////////////////////////////////////////////////////
  104. CSdoServiceIAS* m_pSdoServiceIAS;
  105. };
  106. /////////////////////////////////////////////////////////////////////////////
  107. CSdoServiceIAS();
  108. /////////////////////////////////////////////////////////////////////////////
  109. ~CSdoServiceIAS();
  110. /////////////////////////////////////////////////////////////////////////////
  111. HRESULT FinalInitialize(
  112. /*[in]*/ bool fInitNew,
  113. /*[in]*/ ISdoMachine* pAttachedMachine
  114. );
  115. private:
  116. friend CSdoServiceControlImpl;
  117. /////////////////////////////////////////////////////////////////////////////
  118. CSdoServiceIAS(const CSdoServiceIAS& rhs);
  119. CSdoServiceIAS& operator = (CSdoServiceIAS& rhs);
  120. /////////////////////////////////////////////////////////////////////////////
  121. HRESULT InitializeProperty(LONG Id);
  122. LPCWSTR GetServiceName(void);
  123. /////////////////////////////////////////////////////////////////////////////
  124. static HRESULT WINAPI QueryInterfaceInternal(
  125. void* pThis,
  126. REFIID riid,
  127. LPVOID* ppv,
  128. DWORD_PTR dw
  129. );
  130. // Class that implements ISdoServiceControl
  131. //
  132. CSdoServiceControlImpl m_clsSdoServiceControlImpl;
  133. // SCM Name of the service
  134. //
  135. _variant_t m_ServiceName;
  136. // Attached machine
  137. //
  138. ISdoMachine* m_pAttachedMachine;
  139. // Name of attached computer
  140. //
  141. BSTR m_bstrAttachedComputer;
  142. // Property status - used for lazy property initialization
  143. //
  144. typedef enum _PROPERTY_STATUS
  145. {
  146. PROPERTY_UNINITIALIZED,
  147. PROPERTY_INITIALIZED
  148. } PROPERTY_STATUS;
  149. PROPERTY_STATUS m_PropertyStatus[MAX_SERVICE_PROPERTIES];
  150. };
  151. #endif // _INC_IAS_SDO_SERVICE_H_