- Do not send the WM_MOUSEACTIVATE message for a window that has no parent.
[reactos.git] / base / applications / sc / usage.c
1 /*
2 * PROJECT: ReactOS Services
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: base/system/sc/usage.c
5 * PURPOSE: display usage info
6 * COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <gedmurphy@gmail.com>
7 *
8 */
9 #include "sc.h"
10
11 VOID MainUsage(VOID)
12 {
13 INT c;
14
15 _tprintf(_T("DESCRIPTION:\n")
16 _T("\tSC is a command line program used for communicating with\n")
17 _T("\tthe Service Control Manager and its services.\n")
18 _T("USAGE:\n")
19 _T("\tsc <server> [command] [service name] <option1> <option2>...\n")
20
21 _T("\tThe optional parameter <server> has the form \"\\ServerName\"\n")
22 _T("\tFurther help on commands can be obtained by typing: \"sc [command]\"\n")
23 _T("\tService Commands:\n")
24 _T("\t query : Queries the status for a service, or\n")
25 _T("\t enumerates the status for types of services.\n")
26 _T("\t queryex : Queries the extended status for a service, or\n")
27 _T("\t enumerates the status for types of services.\n")
28 _T("\t start : Starts a service.\n")
29 _T("\t pause : Sends a PAUSE control request to a service.\n")
30 _T("\t interrogate : Sends a INTERROGATE control request to a service.\n")
31 _T("\t continue : Sends a CONTINUE control request to a service.\n")
32 _T("\t stop : Sends a STOP request to a service.\n")
33 // "\t config : Changes the configuration of a service (persistant).\n"
34 // "\t description : Changes the description of a service.\n"
35 // "\t failure : Changes the actions taken by a service upon failure.\n"
36 // "\t qc : Queries the configuration information for a service.\n"
37 // "\t qdescription : Queries the description for a service.\n"
38 // "\t qfailure : Queries the actions taken by a service upon failure.\n"
39 _T("\t delete : Deletes a service (from the registry).\n")
40 _T("\t create : Creates a service. (adds it to the registry).\n")
41 _T("\t control : Sends a control to a service.\n"));
42 // "\t sdshow : Displays a service's security descriptor.\n")
43 // "\t sdset : Sets a service's security descriptor.\n")
44 // "\t GetDisplayName : Gets the DisplayName for a service.\n")
45 // "\t GetKeyName : Gets the ServiceKeyName for a service.\n")
46 // "\t EnumDepend : Enumerates Service Dependencies.\n")
47 // "\n")
48 // "\tService Name Independant Commands:\n")
49 // "\t boot : (ok | bad) Indicates whether the last boot should\n")
50 // "\t be saved as the last-known-good boot configuration\n")
51 // "\t Lock : Locks the SCM Database\n")
52 // "\t QueryLock : Queries the LockStatus for the SCM Database\n")
53
54 _tprintf(_T("\nWould you like to see help for the QUERY and QUERYEX commands? [ y | n ]: "));
55 c = _getch(); // _gettch isn't defined in our tchar.h
56 _tprintf(_T("%c\n"), c);
57 if (tolower(c) == 'y')
58 {
59 _tprintf(_T("QUERY and QUERYEX OPTIONS :\n")
60 _T(" If the query command is followed by a service name, the status\n")
61 _T(" for that service is returned. Further options do not apply in\n")
62 _T(" this case. If the query command is followed by nothing or one of\n")
63 _T(" the options listed below, the services are enumerated.\n")
64 _T(" type= Type of services to enumerate (driver, service, interact, all)\n")
65 _T(" (default = service)\n")
66 _T(" state= State of services to enumerate (inactive, all)\n")
67 _T(" (default = active)\n")
68 /*
69 _T(" bufsize= The size (in bytes) of the enumeration buffer\n")
70 _T(" (default = 4096)\n")
71 _T(" ri= The resume index number at which to begin the enumeration\n")
72 _T(" (default = 0)\n")
73 _T(" group= Service group to enumerate\n")
74 _T(" (default = all groups)\n")
75 */
76 _T("SYNTAX EXAMPLES\n")
77 _T("sc query - Enumerates status for active services & drivers\n")
78 _T("sc query messenger - Displays status for the messenger service\n")
79 _T("sc queryex messenger - Displays extended status for the messenger service\n")
80 _T("sc query type= driver - Enumerates only active drivers\n")
81 _T("sc query type= service - Enumerates only Win32 services\n")
82 _T("sc query state= all - Enumerates all services & drivers\n")
83 // _T("sc query bufsize= 50 - Enumerates with a 50 byte buffer.\n")
84 // _T("sc query ri= 14 - Enumerates with resume index = 14\n")
85 // _T("sc queryex group= "" - Enumerates active services not in a group\n")
86 _T("sc query type= service type= interact - Enumerates all interactive services\n")
87 _T("sc query type= driver group= NDIS - Enumerates all NDIS drivers\n"));
88 }
89 }
90
91
92 VOID StartUsage(VOID)
93 {
94 _tprintf(_T("DESCRIPTION:\n")
95 _T(" Starts a service running.\n")
96 _T("USAGE:\n")
97 _T(" sc <server> start [service name] <arg1> <arg2> ...\n"));
98 }
99
100
101 VOID PauseUsage(VOID)
102 {
103 _tprintf(_T("DESCRIPTION:\n")
104 _T(" Sends a PAUSE control request to a service.\n")
105 _T("USAGE:\n")
106 _T(" sc <server> pause [service name]\n"));
107 }
108
109 VOID InterrogateUsage(VOID)
110 {
111 _tprintf(_T("DESCRIPTION:\n")
112 _T(" Sends an INTERROGATE control request to a service.\n")
113 _T("USAGE:\n")
114 _T(" sc <server> interrogate [service name]\n"));
115 }
116
117
118 VOID StopUsage(VOID)
119 {
120 _tprintf(_T("DESCRIPTION:\n")
121 _T(" Sends an STOP control request to a service.\n")
122 _T("USAGE:\n")
123 _T(" sc <server> stop [service name]\n"));
124 }
125
126 VOID ContinueUsage(VOID)
127 {
128 _tprintf(_T("DESCRIPTION:\n")
129 _T(" Sends an CONTINUE control request to a service.\n")
130 _T("USAGE:\n")
131 _T(" sc <server> continue [service name]\n"));
132 }
133
134
135 VOID ConfigUsage(VOID)
136 {
137 _tprintf(_T("not yet implemented\n"));
138 }
139
140
141 VOID DescriptionUsage(VOID)
142 {
143 _tprintf(_T("DESCRIPTION:\n")
144 _T(" Sets the description string for a service.\n")
145 _T("USAGE:\n")
146 _T(" sc <server> description [service name]\n"));
147 }
148
149 VOID DeleteUsage(VOID)
150 {
151 _tprintf(_T("DESCRIPTION:\n")
152 _T(" Deletes a service entry from the registry.\n")
153 _T(" If the service is running, or another process has an\n")
154 _T(" open handle to the service, the service is simply marked\n")
155 _T(" for deletion.\n")
156 _T("USAGE:\n")
157 _T(" sc <server> delete [service name]\n"));
158 }
159
160 VOID CreateUsage(VOID)
161 {
162 _tprintf(_T("Creates a service entry in the registry and Service Database.\n")
163 _T("SYNTAX:\n")
164 _T("sc create [service name] [binPath= ] <option1> <option2>...\n")
165 _T("CREATE OPTIONS:\n")
166 _T("NOTE: The option name includes the equal sign.\n")
167 _T(" type= <own|share|interact|kernel|filesys|rec>\n")
168 _T(" (default = own)\n")
169 _T(" start= <boot|system|auto|demand|disabled>\n")
170 _T(" (default = demand)\n")
171 _T(" error= <normal|severe|critical|ignore>\n")
172 _T(" (default = normal)\n")
173 _T(" binPath= <BinaryPathName>\n")
174 _T(" group= <LoadOrderGroup>\n")
175 _T(" tag= <yes|no>\n")
176 _T(" depend= <Dependencies(separated by / (forward slash))>\n")
177 _T(" obj= <AccountName|ObjectName>\n")
178 _T(" (default = LocalSystem)\n")
179 _T(" DisplayName= <display name>\n")
180 _T(" password= <password>\n"));
181 }