xref: /titanic_41/usr/src/uts/common/smbsrv/winsvc.h (revision 24a1f0af9f770e0e795ef1fa1c6dece8dd8dc959)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SMBSRV_WINSVC_H
27 #define	_SMBSRV_WINSVC_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * NT Service Control interface definition for the Service Control
33  * Manager (SCM).
34  */
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /*
41  * Service types (Bit Mask).
42  *
43  * SERVICE_WIN32_OWN_PROCESS	The service runs in its own process.
44  * SERVICE_WIN32_SHARE_PROCESS	The service shares a process with other
45  *                              services.
46  */
47 #define	SERVICE_KERNEL_DRIVER		0x00000001
48 #define	SERVICE_FILE_SYSTEM_DRIVER	0x00000002
49 #define	SERVICE_ADAPTER			0x00000004
50 #define	SERVICE_RECOGNIZER_DRIVER	0x00000008
51 #define	SERVICE_WIN32_OWN_PROCESS	0x00000010
52 #define	SERVICE_WIN32_SHARE_PROCESS	0x00000020
53 #define	SERVICE_INTERACTIVE_PROCESS	0x00000100
54 
55 #define	SERVICE_DRIVER (SERVICE_KERNEL_DRIVER				\
56 	    | SERVICE_FILE_SYSTEM_DRIVER				\
57 	    | SERVICE_RECOGNIZER_DRIVER)
58 
59 #define	SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS			\
60 	    | SERVICE_WIN32_SHARE_PROCESS)
61 
62 #define	SERVICE_TYPE_ALL (SERVICE_WIN32					\
63 	    | SERVICE_ADAPTER						\
64 	    | SERVICE_DRIVER						\
65 	    | SERVICE_INTERACTIVE_PROCESS)
66 
67 /*
68  * Start type.
69  */
70 #define	SERVICE_BOOT_START		0x00000000
71 #define	SERVICE_SYSTEM_START		0x00000001
72 #define	SERVICE_AUTO_START		0x00000002
73 #define	SERVICE_DEMAND_START		0x00000003
74 #define	SERVICE_DISABLED		0x00000004
75 
76 /*
77  * Error control type.
78  */
79 #define	SERVICE_ERROR_IGNORE		0x00000000
80 #define	SERVICE_ERROR_NORMAL		0x00000001
81 #define	SERVICE_ERROR_SEVERE		0x00000002
82 #define	SERVICE_ERROR_CRITICAL		0x00000003
83 
84 /*
85  * Value to indicate no change to an optional parameter.
86  */
87 #define	SERVICE_NO_CHANGE		0xffffffff
88 
89 /*
90  * Service State - for Enum Requests (Bit Mask).
91  */
92 #define	SERVICE_ACTIVE			0x00000001
93 #define	SERVICE_INACTIVE		0x00000002
94 #define	SERVICE_STATE_ALL		(SERVICE_ACTIVE | SERVICE_INACTIVE)
95 
96 /*
97  * Controls
98  */
99 #define	SERVICE_CONTROL_STOP		0x00000001
100 #define	SERVICE_CONTROL_PAUSE		0x00000002
101 #define	SERVICE_CONTROL_CONTINUE	0x00000003
102 #define	SERVICE_CONTROL_INTERROGATE	0x00000004
103 #define	SERVICE_CONTROL_SHUTDOWN	0x00000005
104 #define	SERVICE_CONTROL_PARAMCHANGE	0x00000006
105 #define	SERVICE_CONTROL_NETBINDADD	0x00000007
106 #define	SERVICE_CONTROL_NETBINDREMOVE	0x00000008
107 #define	SERVICE_CONTROL_NETBINDENABLE	0x00000009
108 #define	SERVICE_CONTROL_NETBINDDISABLE	0x0000000A
109 
110 /*
111  * Service State -- for CurrentState
112  */
113 #define	SERVICE_STOPPED			0x00000001
114 #define	SERVICE_START_PENDING		0x00000002
115 #define	SERVICE_STOP_PENDING		0x00000003
116 #define	SERVICE_RUNNING			0x00000004
117 #define	SERVICE_CONTINUE_PENDING	0x00000005
118 #define	SERVICE_PAUSE_PENDING		0x00000006
119 #define	SERVICE_PAUSED			0x00000007
120 
121 /*
122  * Controls Accepted  (Bit Mask)
123  *
124  * SERVICE_ACCEPT_NETBINDCHANGE
125  * Windows 2000/XP: The service is a network component that
126  * can accept changes in its binding without being stopped and restarted.
127  * This control code allows the service to receive SERVICE_CONTROL_NETBINDADD,
128  * SERVICE_CONTROL_NETBINDREMOVE, SERVICE_CONTROL_NETBINDENABLE, and
129  * SERVICE_CONTROL_NETBINDDISABLE notifications.
130  *
131  * SERVICE_ACCEPT_PARAMCHANGE
132  * Windows 2000/XP: The service can reread its startup parameters without
133  * being stopped and restarted. This control code allows the service to
134  * receive SERVICE_CONTROL_PARAMCHANGE notifications.
135  *
136  * SERVICE_ACCEPT_PAUSE_CONTINUE
137  * The service can be paused and continued. This control code allows the
138  * service to receive SERVICE_CONTROL_PAUSE and SERVICE_CONTROL_CONTINUE
139  * notifications.
140  *
141  * SERVICE_ACCEPT_SHUTDOWN
142  * The service is notified when system shutdown occurs. This control code
143  * allows the service to receive SERVICE_CONTROL_SHUTDOWN notifications.
144  * Note that ControlService cannot send this notification; only the system
145  * can send it.
146  *
147  * SERVICE_ACCEPT_STOP
148  * The service can be stopped. This control code allows the service to
149  * receive SERVICE_CONTROL_STOP notifications.
150  */
151 #define	SERVICE_ACCEPT_STOP		0x00000001
152 #define	SERVICE_ACCEPT_PAUSE_CONTINUE	0x00000002
153 #define	SERVICE_ACCEPT_SHUTDOWN		0x00000004
154 #define	SERVICE_ACCEPT_PARAMCHANGE	0x00000008
155 #define	SERVICE_ACCEPT_NETBINDCHANGE	0x00000010
156 
157 /*
158  * Service Control Manager object specific access types.
159  */
160 #define	SC_MANAGER_CONNECT		0x0001
161 #define	SC_MANAGER_CREATE_SERVICE	0x0002
162 #define	SC_MANAGER_ENUMERATE_SERVICE	0x0004
163 #define	SC_MANAGER_LOCK			0x0008
164 #define	SC_MANAGER_QUERY_LOCK_STATUS	0x0010
165 #define	SC_MANAGER_MODIFY_BOOT_CONFIG	0x0020
166 
167 #define	SC_MANAGER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED		       \
168 	    | SC_MANAGER_CONNECT				       \
169 	    | SC_MANAGER_CREATE_SERVICE				       \
170 	    | SC_MANAGER_ENUMERATE_SERVICE			       \
171 	    | SC_MANAGER_LOCK					       \
172 	    | SC_MANAGER_QUERY_LOCK_STATUS			       \
173 	    | SC_MANAGER_MODIFY_BOOT_CONFIG)
174 
175 /*
176  * Service object specific access type.
177  */
178 #define	SERVICE_QUERY_CONFIG		0x0001
179 #define	SERVICE_CHANGE_CONFIG		0x0002
180 #define	SERVICE_QUERY_STATUS		0x0004
181 #define	SERVICE_ENUMERATE_DEPENDENTS	0x0008
182 #define	SERVICE_START			0x0010
183 #define	SERVICE_STOP			0x0020
184 #define	SERVICE_PAUSE_CONTINUE		0x0040
185 #define	SERVICE_INTERROGATE		0x0080
186 #define	SERVICE_USER_DEFINED_CONTROL	0x0100
187 
188 #define	SERVICE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED		       \
189 	    | SERVICE_QUERY_CONFIG				       \
190 	    | SERVICE_CHANGE_CONFIG				       \
191 	    | SERVICE_QUERY_STATUS				       \
192 	    | SERVICE_ENUMERATE_DEPENDENTS			       \
193 	    | SERVICE_START					       \
194 	    | SERVICE_STOP					       \
195 	    | SERVICE_PAUSE_CONTINUE				       \
196 	    | SERVICE_INTERROGATE				       \
197 	    | SERVICE_USER_DEFINED_CONTROL)
198 
199 /*
200  * Info levels for ChangeServiceConfig2 and QueryServiceConfig2.
201  */
202 #define	SERVICE_CONFIG_DESCRIPTION	1
203 #define	SERVICE_CONFIG_FAILURE_ACTIONS	2
204 
205 /*
206  * Actions to take on service failure (SC_ACTION_TYPE).
207  */
208 #define	SC_ACTION_NONE			0
209 #define	SC_ACTION_RESTART		1
210 #define	SC_ACTION_REBOOT		2
211 #define	SC_ACTION_RUN_COMMAND		3
212 
213 #ifdef __cplusplus
214 }
215 #endif
216 
217 #endif /* _SMBSRV_WINSVC_H */
218