ReactOS 0.4.15-dev-8093-g3285f69
service.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------------
2THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
3ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED
4TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
5PARTICULAR PURPOSE.
6
7Copyright (C) Microsoft Corporation. All rights reserved.
8
9 MODULE: service.h
10
11 Comments: The use of this header file and the accompanying service.c
12 file simplifies the process of writting a service. You as a developer
13 simply need to follow the TODO's outlined in this header file, and
14 implement the ServiceStart() and ServiceStop() functions.
15
16 There is no need to modify the code in service.c. Just add service.c
17 to your project and link with the following libraries...
18
19 libcmt.lib kernel32.lib advapi.lib shell32.lib
20
21 This code also supports unicode. Be sure to compile both service.c and
22 and code #include "service.h" with the same Unicode setting.
23
24 Upon completion, your code will have the following command line interface
25
26 <service exe> -? to display this list
27 <service exe> -install to install the service
28 <service exe> -remove to remove the service
29 <service exe> -debug <params> to run as a console app for debugging
30
31 Note: This code also implements Ctrl+C and Ctrl+Break handlers
32 when using the debug option. These console events cause
33 your ServiceStop routine to be called
34
35 Also, this code only handles the OWN_SERVICE service type
36 running in the LOCAL_SYSTEM security context.
37
38 To control your service ( start, stop, etc ) you may use the
39 Services control panel applet or the NET.EXE program.
40
41 To aid in writing/debugging service, the
42 SDK contains a utility (MSTOOLS\BIN\SC.EXE) that
43 can be used to control, configure, or obtain service status.
44 SC displays complete status for any service/driver
45 in the service database, and allows any of the configuration
46 parameters to be easily changed at the command line.
47 For more information on SC.EXE, type SC at the command line.
48
49
50------------------------------------------------------------------------------*/
51
52#ifndef _SERVICE_H
53#define _SERVICE_H
54
55
56#ifdef __cplusplus
57extern "C" {
58#endif
59
60
64// name of the executable
65#define SZAPPNAME "nfsd"
66// internal name of the service
67#define SZSERVICENAME "pnfs"
68// displayed name of the service
69#define SZSERVICEDISPLAYNAME "NFSv4.1 Client"
70// list of service dependencies - "dep1\0dep2\0\0"
71#define SZDEPENDENCIES ""
73
74
75
88 VOID ServiceStart(DWORD dwArgc, LPTSTR *lpszArgv);
91
92
93
99
100//
101// FUNCTION: ReportStatusToSCMgr()
102//
103// PURPOSE: Sets the current status of the service and
104// reports it to the Service Control Manager
105//
106// PARAMETERS:
107// dwCurrentState - the state of the service
108// dwWin32ExitCode - error code to report
109// dwWaitHint - worst case estimate to next checkpoint
110//
111// RETURN VALUE:
112// TRUE - success
113// FALSE - failure
114//
115 BOOL ReportStatusToSCMgr(DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint);
116
117
118//
119// FUNCTION: AddToMessageLog(LPTSTR lpszMsg)
120//
121// PURPOSE: Allows any thread to log an error message
122//
123// PARAMETERS:
124// lpszMsg - text for message
125//
126// RETURN VALUE:
127// none
128//
129 void AddToMessageLog(LPTSTR lpszMsg);
131
132
133#ifdef __cplusplus
134}
135#endif
136
137#endif
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
void AddToMessageLog(LPTSTR lpszMsg)
Definition: service.c:289
BOOL ReportStatusToSCMgr(DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint)
Definition: service.c:240
VOID ServiceStart(DWORD dwArgc, LPTSTR *lpszArgv)
Definition: nfs41_daemon.c:381
VOID ServiceStop()
Definition: nfs41_daemon.c:156
CHAR * LPTSTR
Definition: xmlstorage.h:192