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.

133 lines
3.5 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2000 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // CService.h
  7. //
  8. // Description:
  9. // Header file for CService class.
  10. //
  11. // The CService class is provides several routines that aid in
  12. // configuring a service.
  13. //
  14. // Implementation Files:
  15. // CService.cpp
  16. //
  17. // Maintained By:
  18. // Vij Vasu (Vvasu) 13-MAR-2000
  19. //
  20. //////////////////////////////////////////////////////////////////////////////
  21. // Make sure that this file is included only once per compile path.
  22. #pragma once
  23. //////////////////////////////////////////////////////////////////////////
  24. // Include Files
  25. //////////////////////////////////////////////////////////////////////////
  26. // For basic types
  27. #include <windows.h>
  28. // For HINF
  29. #include <setupapi.h>
  30. // For the string class
  31. #include "CommonDefs.h"
  32. // For the CStr class.
  33. #include "CStr.h"
  34. //////////////////////////////////////////////////////////////////////////
  35. // Forward declarations
  36. //////////////////////////////////////////////////////////////////////////
  37. class CStatusReport;
  38. //////////////////////////////////////////////////////////////////////////////
  39. //++
  40. //
  41. // class CService
  42. //
  43. // Description:
  44. // The CService class is provides several routines that aid in
  45. // configuring a service.
  46. //
  47. //--
  48. //////////////////////////////////////////////////////////////////////////////
  49. class CService
  50. {
  51. public:
  52. //////////////////////////////////////////////////////////////////////////
  53. // Constructors and destructors
  54. //////////////////////////////////////////////////////////////////////////
  55. // Constructor.
  56. CService(
  57. const WCHAR * pszNameIn
  58. )
  59. : m_strName( pszNameIn)
  60. {
  61. }
  62. // Destructor
  63. ~CService() {}
  64. //////////////////////////////////////////////////////////////////////////
  65. // Public member functions
  66. //////////////////////////////////////////////////////////////////////////
  67. // Create this service in the SCM database.
  68. void
  69. Create( HINF hInfHandleIn );
  70. // Erase this service from the SCM database.
  71. void
  72. Cleanup( HINF hInfHandleIn );
  73. // Start this service.
  74. void
  75. Start(
  76. SC_HANDLE hServiceControlManagerIn
  77. , bool fWaitForServiceStartIn = true
  78. , ULONG ulQueryIntervalMilliSecIn = 500
  79. , UINT cQueryCountIn = 10
  80. , CStatusReport * pStatusReportIn = NULL
  81. );
  82. // Stop this service.
  83. void
  84. Stop(
  85. SC_HANDLE hServiceControlManagerIn
  86. , ULONG ulQueryIntervalMilliSecIn = 500
  87. , UINT cQueryCountIn = 10
  88. , CStatusReport * pStatusReportIn = NULL
  89. );
  90. // Enable the service
  91. private:
  92. //////////////////////////////////////////////////////////////////////////
  93. // Private member functions
  94. //////////////////////////////////////////////////////////////////////////
  95. // Copy constructor
  96. CService( const CService & );
  97. // Assignment operator
  98. const CService & operator =( const CService & );
  99. //////////////////////////////////////////////////////////////////////////
  100. // Private data
  101. //////////////////////////////////////////////////////////////////////////
  102. // The name of this service.
  103. CStr m_strName;
  104. }; // class CService