ReactOS 0.4.15-dev-7961-gdcf9eb0
usage.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Services
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: base/applications/sc/usage.c
5 * PURPOSE: display usage info
6 * COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <gedmurphy@gmail.com>
7 *
8 */
9
10#include "sc.h"
11
12#include <conio.h>
13
15{
16 INT c;
17
18 _tprintf(_T("DESCRIPTION:\n")
19 _T("\tSC is a command line program used for communicating with\n")
20 _T("\tthe Service Control Manager and its services.\n")
21 _T("USAGE:\n")
22 _T("\tsc <server> [command] [service name] <option1> <option2>...\n")
23
24 _T("\tThe optional parameter <server> has the form \"\\ServerName\"\n")
25 _T("\tFurther help on commands can be obtained by typing: \"sc [command]\"\n")
26 _T("\tService Commands:\n")
27 _T("\t query : Queries the status for a service, or\n")
28 _T("\t enumerates the status for types of services.\n")
29 _T("\t queryex : Queries the extended status for a service, or\n")
30 _T("\t enumerates the status for types of services.\n")
31 _T("\t start : Starts a service.\n")
32 _T("\t pause : Sends a PAUSE control request to a service.\n")
33 _T("\t interrogate : Sends a INTERROGATE control request to a service.\n")
34 _T("\t continue : Sends a CONTINUE control request to a service.\n")
35 _T("\t stop : Sends a STOP request to a service.\n")
36 _T("\t config : Changes the configuration of a service (persistent).\n")
37 _T("\t description : Changes the description of a service.\n")
38 _T("\t failure : Changes the actions taken by a service upon failure.\n")
39 _T("\t qc : Queries the configuration information for a service.\n")
40 _T("\t qdescription : Queries the description for a service.\n")
41 _T("\t qfailure : Queries the actions taken by a service upon failure.\n")
42 _T("\t delete : Deletes a service (from the registry).\n")
43 _T("\t create : Creates a service (adds it to the registry).\n")
44 _T("\t control : Sends a control to a service.\n")
45 _T("\t sdshow : Displays a service's security descriptor.\n")
46 _T("\t sdset : Sets a service's security descriptor.\n")
47 _T("\t GetDisplayName : Gets the DisplayName for a service.\n")
48 _T("\t GetKeyName : Gets the ServiceKeyName for a service.\n")
49 _T("\t EnumDepend : Enumerates Service Dependencies.\n"));
50// "\n")
51// "\tService Name Independent Commands:\n")
52// "\t boot : (ok | bad) Indicates whether the last boot should\n")
53// "\t be saved as the last-known-good boot configuration\n")
54// "\t Lock : Locks the SCM Database\n")
55// "\t QueryLock : Queries the LockStatus for the SCM Database\n")
56
57 _tprintf(_T("\nWould you like to see help for the QUERY and QUERYEX commands? [ y | n ]: "));
58 c = _getch(); // _gettch isn't defined in our tchar.h
59 _tprintf(_T("%c\n"), c);
60 if (tolower(c) == 'y')
61 {
62 _tprintf(_T("QUERY and QUERYEX OPTIONS :\n")
63 _T(" If the query command is followed by a service name, the status\n")
64 _T(" for that service is returned. Further options do not apply in\n")
65 _T(" this case. If the query command is followed by nothing or one of\n")
66 _T(" the options listed below, the services are enumerated.\n")
67 _T(" type= Type of services to enumerate (driver, service, interact, all)\n")
68 _T(" (default = service)\n")
69 _T(" state= State of services to enumerate (active, all, inactive)\n")
70 _T(" (default = active)\n")
71 _T(" bufsize= The size (in bytes) of the enumeration buffer\n")
72 _T(" (default = 4096)\n")
73 _T(" ri= The resume index number at which to begin the enumeration\n")
74 _T(" (default = 0)\n")
75 _T(" group= Service group to enumerate\n")
76 _T(" (default = all groups)\n")
77 _T("SYNTAX EXAMPLES\n")
78 _T("sc query - Enumerates status for active services & drivers\n")
79 _T("sc query messenger - Displays status for the messenger service\n")
80 _T("sc queryex messenger - Displays extended status for the messenger service\n")
81 _T("sc query type= driver - Enumerates only active drivers\n")
82 _T("sc query type= service - Enumerates only Win32 services\n")
83 _T("sc query state= all - Enumerates all services & drivers\n")
84 _T("sc query bufsize= 50 - Enumerates with a 50 byte buffer.\n")
85 _T("sc query ri= 14 - Enumerates with resume index = 14\n")
86 _T("sc queryex group= \"\" - Enumerates active services not in a group\n")
87 _T("sc query type= service type= interact - Enumerates all interactive services\n")
88 _T("sc query type= driver group= NDIS - Enumerates all NDIS drivers\n"));
89 }
90}
91
92
94{
95 _tprintf(_T("DESCRIPTION:\n")
96 _T(" Starts a service running.\n")
97 _T("USAGE:\n")
98 _T(" sc <server> start [service name] <arg1> <arg2> ...\n"));
99}
100
101
103{
104 _tprintf(_T("DESCRIPTION:\n")
105 _T(" Sends a PAUSE control request to a service.\n")
106 _T("USAGE:\n")
107 _T(" sc <server> pause [service name]\n"));
108}
109
111{
112 _tprintf(_T("DESCRIPTION:\n")
113 _T(" Sends an INTERROGATE control request to a service.\n")
114 _T("USAGE:\n")
115 _T(" sc <server> interrogate [service name]\n"));
116}
117
118
120{
121 _tprintf(_T("DESCRIPTION:\n")
122 _T(" Sends a STOP control request to a service.\n")
123 _T("USAGE:\n")
124 _T(" sc <server> stop [service name]\n"));
125}
126
128{
129 _tprintf(_T("DESCRIPTION:\n")
130 _T(" Sends a CONTINUE control request to a service.\n")
131 _T("USAGE:\n")
132 _T(" sc <server> continue [service name]\n"));
133}
134
136{
137 _tprintf(_T("DESCRIPTION:\n")
138 _T(" Deletes a service entry from the registry.\n")
139 _T(" If the service is running, or another process has an\n")
140 _T(" open handle to the service, the service is simply marked\n")
141 _T(" for deletion.\n")
142 _T("USAGE:\n")
143 _T(" sc <server> delete [service name]\n"));
144}
145
147{
148 _tprintf(_T("Creates a service entry in the registry and Service Database.\n")
149 _T("SYNTAX:\n")
150 _T("sc create [service name] [binPath= ] <option1> <option2>...\n")
151 _T("CREATE OPTIONS:\n")
152 _T("NOTE: The option name includes the equal sign.\n")
153 _T(" type= <own|share|interact|kernel|filesys|rec>\n")
154 _T(" (default = own)\n")
155 _T(" start= <boot|system|auto|demand|disabled>\n")
156 _T(" (default = demand)\n")
157 _T(" error= <normal|severe|critical|ignore>\n")
158 _T(" (default = normal)\n")
159 _T(" binPath= <BinaryPathName>\n")
160 _T(" group= <LoadOrderGroup>\n")
161 _T(" tag= <yes|no>\n")
162 _T(" depend= <Dependencies(separated by / (forward slash))>\n")
163 _T(" obj= <AccountName|ObjectName>\n")
164 _T(" (default = LocalSystem)\n")
165 _T(" DisplayName= <display name>\n")
166 _T(" password= <password>\n"));
167}
168
170{
171 _tprintf(_T("DESCRIPTION:\n")
172 _T(" Sends a CONTROL code to a service.\n")
173 _T("USAGE:\n")
174 _T(" sc <server> control [service name] <value>\n")
175 _T(" <value> = user-defined control code\n")
176 _T(" <value> = <paramchange|\n")
177 _T(" netbindadd|netbindremove|\n")
178 _T(" netbindenable|netbinddisable>\n"));
179}
180
182{
183 _tprintf(_T("DESCRIPTION:\n")
184 _T(" Displays a service's security descriptor in SDDL format.\n")
185 _T("USAGE:\n")
186 _T(" sc <server> sdshow <service name>\n"));
187}
188
190{
191 _tprintf(_T("DESCRIPTION:\n")
192 _T(" Sets a service's security descriptor.\n")
193 _T("USAGE:\n")
194 _T(" sc <server> sdset <service name> <SD in SDDL format>\n"));
195}
196
198{
199 _tprintf(_T("DESCRIPTION:\n")
200 _T(" Queries the configuration information for a service.\n")
201 _T("USAGE:\n")
202 _T(" sc <server> qc [service name] <bufferSize>\n"));
203}
204
206{
207 _tprintf(_T("DESCRIPTION:\n")
208 _T(" Retrieves the description string of a service.\n")
209 _T("USAGE:\n")
210 _T(" sc <server> qdescription [service name] <bufferSize>\n"));
211}
212
214{
215 _tprintf(_T("DESCRIPTION:\n")
216 _T(" Retrieves the actions performed on service failure.\n")
217 _T("USAGE:\n")
218 _T(" sc <server> qfailure [service name] <bufferSize>\n"));
219}
220
222{
223 _tprintf(_T("DESCRIPTION:\n")
224 _T(" Sets the description string of a service.\n")
225 _T("USAGE:\n")
226 _T(" sc <server> description [service name] [description]\n"));
227}
228
230{
231 _tprintf(_T("DESCRIPTION:\n")
232 _T(" Modifies a service entry in the registry and Service Database.\n")
233 _T("USAGE:\n")
234 _T(" sc <server> config [service name] <option1> <option2>...\n")
235 _T("CONFIG OPTIONS:\n")
236 _T(" NOTE: The option name includes the equal sign.\n")
237 _T(" type= <own|share|interact|kernel|filesys|rec>\n")
238 _T(" start= <boot|system|auto|demand|disabled>\n")
239 _T(" error= <normal|severe|critical|ignore>\n")
240 _T(" binPath= <BinaryPathName>\n")
241 _T(" group= <LoadOrderGroup>\n")
242 _T(" tag= <yes|no>\n")
243 _T(" depend= <Dependencies(separated by / (forward slash))>\n")
244 _T(" obj= <AccountName|ObjectName>\n")
245 _T(" DisplayName= <display name>\n")
246 _T(" password= <password>\n"));
247}
248
250{
251 _tprintf(_T("DESCRIPTION:\n")
252 _T(" Changes the actions upon failure.\n")
253 _T("USAGE:\n")
254 _T(" sc <server> failure [service name] <option1> <option2>...\n")
255 _T("\n")
256 _T("OPTIONS:\n")
257 _T(" reset= <Length of period of no failures (in seconds)\n")
258 _T(" after which to reset the failure count to 0 (may be INFINITE)>\n")
259 _T(" (Must be used in conjunction with actions= )\n")
260 _T(" reboot= <Message broadcast before rebooting on failure>\n")
261 _T(" command= <Command line to be run on failure>\n")
262 _T(" actions= <Failure actions and their delay time (in milliseconds),\n")
263 _T(" separated by / (forward slash) -- e.g., run/5000/reboot/800\n")
264 _T(" Valid actions are <run|restart|reboot> >\n")
265 _T(" (Must be used in conjunction with the reset= option)\n"));
266}
267
269{
270 _tprintf(_T("DESCRIPTION:\n")
271 _T(" Gets the display name associated with a particular service.\n")
272 _T("USAGE:\n")
273 _T(" sc <server> GetDisplayName <service key name> <bufsize>\n"));
274}
275
277{
278 _tprintf(_T("DESCRIPTION:\n")
279 _T(" Gets the key name associated with a particular service, using the\n")
280 _T(" display name as input.\n")
281 _T("USAGE:\n")
282 _T(" sc <server> GetKeyName <service display name> <bufsize>\n"));
283}
284
286{
287 _tprintf(_T("DESCRIPTION:\n")
288 _T(" Enumerates te Services that are dependent on this one.\n")
289 _T("USAGE:\n")
290 _T(" sc <server> EnumDepend <service display name> <bufsize>\n"));
291}
int tolower(int c)
Definition: utclib.c:902
VOID QueryConfigUsage(VOID)
Definition: usage.c:197
VOID ContinueUsage(VOID)
Definition: usage.c:127
VOID MainUsage(VOID)
Definition: usage.c:14
VOID CreateUsage(VOID)
Definition: usage.c:146
VOID QueryFailureUsage(VOID)
Definition: usage.c:213
VOID StopUsage(VOID)
Definition: usage.c:119
VOID SetDescriptionUsage(VOID)
Definition: usage.c:221
VOID QueryDescriptionUsage(VOID)
Definition: usage.c:205
VOID GetDisplayNameUsage(VOID)
Definition: usage.c:268
VOID SetFailureUsage(VOID)
Definition: usage.c:249
VOID StartUsage(VOID)
Definition: usage.c:93
VOID ControlUsage(VOID)
Definition: usage.c:169
VOID EnumDependUsage(VOID)
Definition: usage.c:285
VOID SdSetUsage(VOID)
Definition: usage.c:189
VOID DeleteUsage(VOID)
Definition: usage.c:135
VOID SetConfigUsage(VOID)
Definition: usage.c:229
VOID PauseUsage(VOID)
Definition: usage.c:102
VOID SdShowUsage(VOID)
Definition: usage.c:181
VOID InterrogateUsage(VOID)
Definition: usage.c:110
VOID GetKeyNameUsage(VOID)
Definition: usage.c:276
const GLubyte * c
Definition: glext.h:8905
#define _tprintf
Definition: tchar.h:506
#define c
Definition: ke_i.h:80
int _getch()
Definition: getch.c:16
int32_t INT
Definition: typedefs.h:58
#define _T(x)
Definition: vfdio.h:22