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