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.

114 lines
3.8 KiB

  1. // Copyright (C) 1993-1998 Microsoft Corporation. All Rights Reserved.
  2. //
  3. // MODULE: nmmgr.h
  4. //
  5. // AUTHOR: claus giloi
  6. //
  7. // COMMENTS: Based on Service sample in NT SDK
  8. // Code will have the following command line interface
  9. //
  10. // <service exe> -? to display this list
  11. // <service exe> -install to install the service
  12. // <service exe> -remove to remove the service
  13. // <service exe> -debug <params> to run as a console app for debugging
  14. //
  15. // Note: This code also implements Ctrl+C and Ctrl+Break handlers
  16. // when using the debug option. These console events cause
  17. // your ServiceStop routine to be called
  18. //
  19. // Also, this code only handles the OWN_SERVICE service type
  20. // running in the LOCAL_SYSTEM security context.
  21. //
  22. // To control your service ( start, stop, etc ) you may use the
  23. // Services control panel applet or the NET.EXE program.
  24. //
  25. // To aid in writing/debugging service, the
  26. // SDK contains a utility (MSTOOLS\BIN\SC.EXE) that
  27. // can be used to control, configure, or obtain service status.
  28. // SC displays complete status for any service/driver
  29. // in the service database, and allows any of the configuration
  30. // parameters to be easily changed at the command line.
  31. // For more information on SC.EXE, type SC at the command line.
  32. //
  33. #ifndef __NTSRVC_H__
  34. #define __NTSRVC_H__
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38. extern SERVICE_STATUS ssStatus; // current status of the service
  39. extern SERVICE_STATUS_HANDLE sshStatusHandle;
  40. //////////////////////////////////////////////////////////////////////////////
  41. //// todo: change to desired strings
  42. ////
  43. // name of the executable
  44. #define SZAPPNAME REMOTE_CONTROL_NAME
  45. // internal name of the service
  46. #define SZSERVICENAME REMOTE_CONTROL_NAME
  47. // displayed name of the service
  48. #define SZSERVICEDISPLAYNAME REMOTE_CONTROL_DISPLAY_NAME
  49. // list of service dependencies - "dep1\0dep2\0\0"
  50. #define SZDEPENDENCIES ""
  51. //////////////////////////////////////////////////////////////////////////////
  52. #define STATE_INACTIVE 0
  53. #define STATE_BUSY 1
  54. #define STATE_ACTIVE 2
  55. extern DWORD g_dwActiveState;
  56. //////////////////////////////////////////////////////////////////////////////
  57. //// The service should use ReportStatusToSCMgr to indicate
  58. //// progress. This routine must also be used by StartService()
  59. //// to report to the SCM when the service is running.
  60. ////
  61. //// If a ServiceStop procedure is going to take longer than
  62. //// 3 seconds to execute, it should spawn a thread to
  63. //// execute the stop code, and return. Otherwise, the
  64. //// ServiceControlManager will believe that the service has
  65. //// stopped responding
  66. ////
  67. VOID MNMServiceStart(DWORD dwArgc, LPTSTR *lpszArgv);
  68. VOID MNMServiceStop();
  69. VOID MNMServicePause();
  70. VOID MNMServiceContinue();
  71. BOOL MNMServiceActivate();
  72. BOOL MNMServiceDeActivate();
  73. //////////////////////////////////////////////////////////////////////////////
  74. //////////////////////////////////////////////////////////////////////////////
  75. //// The following are procedures which
  76. //// may be useful to call within the above procedures,
  77. //// but require no implementation by the user.
  78. //// They are implemented in service.c
  79. //
  80. // FUNCTION: ReportStatusToSCMgr()
  81. //
  82. // PURPOSE: Sets the current status of the service and
  83. // reports it to the Service Control Manager
  84. //
  85. // PARAMETERS:
  86. // dwCurrentState - the state of the service
  87. // dwWin32ExitCode - error code to report
  88. // dwWaitHint - worst case estimate to next checkpoint
  89. //
  90. // RETURN VALUE:
  91. // TRUE - success
  92. // FALSE - failure
  93. //
  94. BOOL ReportStatusToSCMgr(DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint);
  95. #ifdef __cplusplus
  96. }
  97. #endif
  98. #endif __NTSRVC_H__