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.

175 lines
3.7 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1995
  5. //
  6. // File: cserv.hxx
  7. //
  8. // Contents: Contains definitions for the following objects
  9. // CWinNTService, CWinNTServiceConfig, and
  10. // CWinNTServiceControl.
  11. //
  12. //
  13. // History: 12/11/95 ramv (Ram Viswanathan) Created.
  14. //
  15. //----------------------------------------------------------------------------
  16. //
  17. //service specific constants
  18. //
  19. //
  20. //states in which the service is pending
  21. //
  22. #define NOTPENDING 0
  23. #define PENDING_START 1
  24. #define PENDING_STOP 2
  25. #define PENDING_PAUSE 3
  26. #define PENDING_CONTINUE 4
  27. //
  28. // service control codes
  29. //
  30. #define WINNT_START_SERVICE 1
  31. #define WINNT_STOP_SERVICE 2
  32. #define WINNT_PAUSE_SERVICE 3
  33. #define WINNT_CONTINUE_SERVICE 4
  34. #define SERVICE_ERROR 0x00000008
  35. class CWinNTFSServiceConfig;
  36. class CWinNTFSServiceControl;
  37. class CPropertyCache;
  38. class CWinNTService: INHERIT_TRACKING,
  39. public ISupportErrorInfo,
  40. public IADsService,
  41. public IADsServiceOperations,
  42. public IADsPropertyList,
  43. public CCoreADsObject,
  44. public INonDelegatingUnknown,
  45. public IADsExtension
  46. {
  47. public:
  48. /* IUnknown methods */
  49. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj);
  50. STDMETHODIMP_(ULONG) AddRef(void);
  51. STDMETHODIMP_(ULONG) Release(void);
  52. // INonDelegatingUnknown methods
  53. STDMETHOD(NonDelegatingQueryInterface)(THIS_
  54. const IID&,
  55. void **
  56. );
  57. DECLARE_NON_DELEGATING_REFCOUNTING
  58. DECLARE_IDispatch_METHODS;
  59. DECLARE_ISupportErrorInfo_METHODS;
  60. DECLARE_IADs_METHODS;
  61. DECLARE_IADsService_METHODS;
  62. DECLARE_IADsServiceOperations_METHODS;
  63. DECLARE_IADsPropertyList_METHODS;
  64. DECLARE_IADsExtension_METHODS;
  65. //
  66. // constructor and destructor
  67. //
  68. CWinNTService();
  69. ~CWinNTService();
  70. static
  71. HRESULT
  72. Create(
  73. LPTSTR lpszADsParent,
  74. LPTSTR pszDomainName,
  75. LPTSTR pszServerName,
  76. LPTSTR pszServiceName,
  77. DWORD dwObject,
  78. REFIID riid,
  79. CWinNTCredentials& Credentials,
  80. LPVOID * ppvoid
  81. );
  82. static
  83. HRESULT
  84. CWinNTService::AllocateServiceObject(
  85. LPTSTR pszServerName,
  86. LPTSTR pszServiceName,
  87. CWinNTService ** ppService
  88. );
  89. HRESULT
  90. WinNTOpenService(
  91. DWORD dwSCMDesiredAccess,
  92. DWORD dwSrvDesiredAccess
  93. );
  94. HRESULT
  95. WinNTCloseService();
  96. HRESULT
  97. GetServiceConfigInfo(
  98. LPQUERY_SERVICE_CONFIG *
  99. );
  100. HRESULT
  101. WinNTControlService(
  102. DWORD dwControl
  103. );
  104. HRESULT
  105. EvalPendingOperation(
  106. THIS_ DWORD dwOpPending,
  107. DWORD dwStatusDone,
  108. DWORD dwStatusPending,
  109. LPSERVICE_STATUS pStatus,
  110. DWORD *pdwRetval
  111. );
  112. STDMETHOD(ImplicitGetInfo)(void);
  113. protected:
  114. STDMETHOD(GetInfo)(THIS_ DWORD dwApiLevel, BOOL fExplicit) ;
  115. // Called by GetInfo
  116. STDMETHOD(UnMarshall)(THIS_ LPQUERY_SERVICE_CONFIG lpConfigInfo,
  117. BOOL fExplicit) ;
  118. HRESULT
  119. WinNTAddService(void);
  120. DWORD _dwWaitHint;
  121. DWORD _dwCheckPoint;
  122. DWORD _dwOpPending;
  123. BOOL _fValidHandle; //keeps track of whether we are pending any operation
  124. DWORD _dwTimeStarted;
  125. LPWSTR _pszServiceName;
  126. LPWSTR _pszPath;
  127. LPWSTR _pszServerName;
  128. SC_HANDLE _schSCManager;
  129. SC_HANDLE _schService;
  130. CAggregatorDispMgr * _pDispMgr;
  131. CADsExtMgr FAR * _pExtMgr;
  132. CPropertyCache * _pPropertyCache;
  133. CWinNTCredentials _Credentials;
  134. };