ReactOS 0.4.15-dev-8241-g63935f8
usage.c File Reference
#include "sc.h"
#include <conio.h>
Include dependency graph for usage.c:

Go to the source code of this file.

Functions

VOID MainUsage (VOID)
 
VOID StartUsage (VOID)
 
VOID PauseUsage (VOID)
 
VOID InterrogateUsage (VOID)
 
VOID StopUsage (VOID)
 
VOID ContinueUsage (VOID)
 
VOID DeleteUsage (VOID)
 
VOID CreateUsage (VOID)
 
VOID ControlUsage (VOID)
 
VOID SdShowUsage (VOID)
 
VOID SdSetUsage (VOID)
 
VOID QueryConfigUsage (VOID)
 
VOID QueryDescriptionUsage (VOID)
 
VOID QueryFailureUsage (VOID)
 
VOID SetDescriptionUsage (VOID)
 
VOID SetConfigUsage (VOID)
 
VOID SetFailureUsage (VOID)
 
VOID GetDisplayNameUsage (VOID)
 
VOID GetKeyNameUsage (VOID)
 
VOID EnumDependUsage (VOID)
 

Function Documentation

◆ ContinueUsage()

VOID ContinueUsage ( VOID  )

Definition at line 127 of file usage.c.

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}
#define _tprintf
Definition: tchar.h:506
#define _T(x)
Definition: vfdio.h:22

Referenced by ScControl().

◆ ControlUsage()

VOID ControlUsage ( VOID  )

Definition at line 169 of file usage.c.

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}

Referenced by ScControl().

◆ CreateUsage()

VOID CreateUsage ( VOID  )

Definition at line 146 of file usage.c.

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}

Referenced by Create().

◆ DeleteUsage()

VOID DeleteUsage ( VOID  )

Definition at line 135 of file usage.c.

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}

Referenced by ScControl().

◆ EnumDependUsage()

VOID EnumDependUsage ( VOID  )

Definition at line 285 of file usage.c.

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}

Referenced by ScControl().

◆ GetDisplayNameUsage()

VOID GetDisplayNameUsage ( VOID  )

Definition at line 268 of file usage.c.

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}

Referenced by ScControl().

◆ GetKeyNameUsage()

VOID GetKeyNameUsage ( VOID  )

Definition at line 276 of file usage.c.

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}

Referenced by ScControl().

◆ InterrogateUsage()

VOID InterrogateUsage ( VOID  )

Definition at line 110 of file usage.c.

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}

Referenced by ScControl().

◆ MainUsage()

VOID MainUsage ( VOID  )

Definition at line 14 of file usage.c.

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}
int tolower(int c)
Definition: utclib.c:902
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
int _getch()
Definition: getch.c:16
int32_t INT
Definition: typedefs.h:58

Referenced by _tmain(), and ScControl().

◆ PauseUsage()

VOID PauseUsage ( VOID  )

Definition at line 102 of file usage.c.

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}

Referenced by ScControl().

◆ QueryConfigUsage()

VOID QueryConfigUsage ( VOID  )

Definition at line 197 of file usage.c.

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}

Referenced by ScControl().

◆ QueryDescriptionUsage()

VOID QueryDescriptionUsage ( VOID  )

Definition at line 205 of file usage.c.

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}

Referenced by ScControl().

◆ QueryFailureUsage()

VOID QueryFailureUsage ( VOID  )

Definition at line 213 of file usage.c.

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}

Referenced by ScControl().

◆ SdSetUsage()

VOID SdSetUsage ( VOID  )

Definition at line 189 of file usage.c.

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}

Referenced by ScControl().

◆ SdShowUsage()

VOID SdShowUsage ( VOID  )

Definition at line 181 of file usage.c.

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}

Referenced by ScControl().

◆ SetConfigUsage()

VOID SetConfigUsage ( VOID  )

Definition at line 229 of file usage.c.

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}

Referenced by SetConfig().

◆ SetDescriptionUsage()

VOID SetDescriptionUsage ( VOID  )

Definition at line 221 of file usage.c.

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}

Referenced by ScControl().

◆ SetFailureUsage()

VOID SetFailureUsage ( VOID  )

Definition at line 249 of file usage.c.

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}

Referenced by SetFailure().

◆ StartUsage()

VOID StartUsage ( VOID  )

Definition at line 93 of file usage.c.

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}

Referenced by ScControl().

◆ StopUsage()

VOID StopUsage ( VOID  )

Definition at line 119 of file usage.c.

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}

Referenced by ScControl().