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.

92 lines
3.1 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 g_ssStatus; // current status of the service
  39. extern SERVICE_STATUS_HANDLE g_sshStatusHandle;
  40. //////////////////////////////////////////////////////////////////////////////
  41. //// The service should use ReportStatusToSCMgr to indicate
  42. //// progress. This routine must also be used by StartService()
  43. //// to report to the SCM when the service is running.
  44. ////
  45. //// If a ServiceStop procedure is going to take longer than
  46. //// 3 seconds to execute, it should spawn a thread to
  47. //// execute the stop code, and return. Otherwise, the
  48. //// ServiceControlManager will believe that the service has
  49. //// stopped responding
  50. ////
  51. VOID MNMServiceStart(DWORD dwArgc, LPTSTR *lpszArgv);
  52. BOOL MNMServiceActivate();
  53. BOOL MNMServiceDeActivate();
  54. //////////////////////////////////////////////////////////////////////////////
  55. //////////////////////////////////////////////////////////////////////////////
  56. //// The following are procedures which
  57. //// may be useful to call within the above procedures,
  58. //// but require no implementation by the user.
  59. //// They are implemented in service.c
  60. //
  61. // FUNCTION: ReportStatusToSCMgr()
  62. //
  63. // PURPOSE: Sets the current status of the service and
  64. // reports it to the Service Control Manager
  65. //
  66. // PARAMETERS:
  67. // dwCurrentState - the state of the service
  68. // dwWin32ExitCode - error code to report
  69. // dwWaitHint - worst case estimate to next checkpoint
  70. //
  71. // RETURN VALUE:
  72. // TRUE - success
  73. // FALSE - failure
  74. //
  75. BOOL ReportStatusToSCMgr(DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint);
  76. #ifdef __cplusplus
  77. }
  78. #endif
  79. #endif __NTSRVC_H__