00001 /* 00002 Unix SMB/CIFS implementation. 00003 SMB parameters and setup 00004 Copyright (C) Andrew Tridgell 1992-1997, 00005 Copyright (C) Gerald (Jerry) Carter 2005 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program; if not, write to the Free Software 00019 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00020 */ 00021 00022 #ifndef _RPC_SVCCTL_H /* _RPC_SVCCTL_H */ 00023 #define _RPC_SVCCTL_H 00024 00025 /* svcctl pipe */ 00026 00027 #define SVCCTL_CLOSE_SERVICE 0x00 00028 #define SVCCTL_CONTROL_SERVICE 0x01 00029 #define SVCCTL_LOCK_SERVICE_DB 0x03 00030 #define SVCCTL_QUERY_SERVICE_SEC 0x04 00031 #define SVCCTL_SET_SERVICE_SEC 0x05 00032 #define SVCCTL_QUERY_STATUS 0x06 00033 #define SVCCTL_UNLOCK_SERVICE_DB 0x08 00034 #define SVCCTL_ENUM_DEPENDENT_SERVICES_W 0x0d 00035 #define SVCCTL_ENUM_SERVICES_STATUS_W 0x0e 00036 #define SVCCTL_OPEN_SCMANAGER_W 0x0f 00037 #define SVCCTL_OPEN_SERVICE_W 0x10 00038 #define SVCCTL_QUERY_SERVICE_CONFIG_W 0x11 00039 #define SVCCTL_START_SERVICE_W 0x13 00040 #define SVCCTL_GET_DISPLAY_NAME 0x14 00041 #define SVCCTL_QUERY_SERVICE_CONFIG2_W 0x27 00042 #define SVCCTL_QUERY_SERVICE_STATUSEX_W 0x28 00043 00044 /* ANSI versions not implemented currently 00045 #define SVCCTL_ENUM_SERVICES_STATUS_A 0x0e 00046 #define SVCCTL_OPEN_SCMANAGER_A 0x1b 00047 */ 00048 00049 /* SERVER_STATUS - type */ 00050 00051 #define SVCCTL_TYPE_WIN32 0x00000030 00052 #define SVCCTL_TYPE_DRIVER 0x0000000f 00053 00054 /* SERVER_STATUS - state */ 00055 #define SVCCTL_STATE_ACTIVE 0x00000001 00056 #define SVCCTL_STATE_INACTIVE 0x00000002 00057 #define SVCCTL_STATE_ALL ( SVCCTL_STATE_ACTIVE | SVCCTL_STATE_INACTIVE ) 00058 00059 /* SERVER_STATUS - CurrentState */ 00060 00061 #define SVCCTL_STATE_UNKNOWN 0x00000000 /* only used internally to smbd */ 00062 #define SVCCTL_STOPPED 0x00000001 00063 #define SVCCTL_START_PENDING 0x00000002 00064 #define SVCCTL_STOP_PENDING 0x00000003 00065 #define SVCCTL_RUNNING 0x00000004 00066 #define SVCCTL_CONTINUE_PENDING 0x00000005 00067 #define SVCCTL_PAUSE_PENDING 0x00000006 00068 #define SVCCTL_PAUSED 0x00000007 00069 00070 /* SERVER_STATUS - ControlAccepted */ 00071 00072 #define SVCCTL_ACCEPT_NONE 0x00000000 00073 #define SVCCTL_ACCEPT_STOP 0x00000001 00074 #define SVCCTL_ACCEPT_PAUSE_CONTINUE 0x00000002 00075 #define SVCCTL_ACCEPT_SHUTDOWN 0x00000004 00076 #define SVCCTL_ACCEPT_PARAMCHANGE 0x00000008 00077 #define SVCCTL_ACCEPT_NETBINDCHANGE 0x00000010 00078 #define SVCCTL_ACCEPT_HARDWAREPROFILECHANGE 0x00000020 00079 #define SVCCTL_ACCEPT_POWEREVENT 0x00000040 00080 00081 /* SERVER_STATUS - ControlAccepted */ 00082 #define SVCCTL_SVC_ERROR_IGNORE 0x00000000 00083 #define SVCCTL_SVC_ERROR_NORMAL 0x00000001 00084 #define SVCCTL_SVC_ERROR_CRITICAL 0x00000002 00085 #define SVCCTL_SVC_ERROR_SEVERE 0x00000003 00086 00087 /* QueryServiceConfig2 options */ 00088 #define SERVICE_CONFIG_DESCRIPTION 0x00000001 00089 #define SERVICE_CONFIG_FAILURE_ACTIONS 0x00000002 00090 00091 00092 /* Service Config - values for ServiceType field*/ 00093 00094 #define SVCCTL_KERNEL_DRVR 0x00000001 /* doubtful we'll have these */ 00095 #define SVCCTL_FILE_SYSTEM_DRVR 0x00000002 00096 #define SVCCTL_WIN32_OWN_PROC 0x00000010 00097 #define SVCCTL_WIN32_SHARED_PROC 0x00000020 00098 #define SVCCTL_WIN32_INTERACTIVE 0x00000100 00099 00100 /* Service Config - values for StartType field */ 00101 #define SVCCTL_BOOT_START 0x00000000 00102 #define SVCCTL_SYSTEM_START 0x00000001 00103 #define SVCCTL_AUTO_START 0x00000002 00104 #define SVCCTL_DEMAND_START 0x00000003 00105 #define SVCCTL_DISABLED 0x00000004 00106 00107 /* Service Controls */ 00108 00109 #define SVCCTL_CONTROL_STOP 0x00000001 00110 #define SVCCTL_CONTROL_PAUSE 0x00000002 00111 #define SVCCTL_CONTROL_CONTINUE 0x00000003 00112 #define SVCCTL_CONTROL_INTERROGATE 0x00000004 00113 #define SVCCTL_CONTROL_SHUTDOWN 0x00000005 00114 00115 #define SVC_HANDLE_IS_SCM 0x0000001 00116 #define SVC_HANDLE_IS_SERVICE 0x0000002 00117 #define SVC_HANDLE_IS_DBLOCK 0x0000003 00118 00119 #define SVC_STATUS_PROCESS_INFO 0x00000000 00120 00121 /* where we assume the location of the service control scripts */ 00122 #define SVCCTL_SCRIPT_DIR "svcctl" 00123 00124 /* utility structures for RPCs */ 00125 00126 typedef struct { 00127 uint32 type; 00128 uint32 state; 00129 uint32 controls_accepted; 00130 WERROR win32_exit_code; 00131 uint32 service_exit_code; 00132 uint32 check_point; 00133 uint32 wait_hint; 00134 } SERVICE_STATUS; 00135 00136 typedef struct { 00137 SERVICE_STATUS status; 00138 uint32 process_id; 00139 uint32 service_flags; 00140 } SERVICE_STATUS_PROCESS; 00141 00142 00143 typedef struct { 00144 UNISTR servicename; 00145 UNISTR displayname; 00146 SERVICE_STATUS status; 00147 } ENUM_SERVICES_STATUS; 00148 00149 typedef struct { 00150 uint32 service_type; 00151 uint32 start_type; 00152 uint32 error_control; 00153 UNISTR2 *executablepath; 00154 UNISTR2 *loadordergroup; 00155 uint32 tag_id; 00156 UNISTR2 *dependencies; 00157 UNISTR2 *startname; 00158 UNISTR2 *displayname; 00159 } SERVICE_CONFIG; 00160 00161 typedef struct { 00162 uint32 unknown; 00163 UNISTR description; 00164 } SERVICE_DESCRIPTION; 00165 00166 typedef struct { 00167 uint32 type; 00168 uint32 delay; 00169 } SC_ACTION; 00170 00171 typedef struct { 00172 uint32 reset_period; 00173 UNISTR2 *rebootmsg; /* i have no idea if these are UNISTR2's. I can't get a good trace */ 00174 UNISTR2 *command; 00175 uint32 num_actions; 00176 SC_ACTION *actions; 00177 } SERVICE_FAILURE_ACTIONS; 00178 00179 /* 00180 * dispatch table of functions to handle the =ServiceControl API 00181 */ 00182 00183 typedef struct { 00184 /* functions for enumerating subkeys and values */ 00185 WERROR (*stop_service)( const char *service, SERVICE_STATUS *status ); 00186 WERROR (*start_service) ( const char *service ); 00187 WERROR (*service_status)( const char *service, SERVICE_STATUS *status ); 00188 } SERVICE_CONTROL_OPS; 00189 00190 /* structure to store the service handle information */ 00191 00192 typedef struct _ServiceInfo { 00193 uint8 type; 00194 char *name; 00195 uint32 access_granted; 00196 SERVICE_CONTROL_OPS *ops; 00197 } SERVICE_INFO; 00198 00199 00200 /* rpc structures */ 00201 00202 /**************************/ 00203 00204 typedef struct { 00205 POLICY_HND handle; 00206 } SVCCTL_Q_CLOSE_SERVICE; 00207 00208 typedef struct { 00209 POLICY_HND handle; 00210 WERROR status; 00211 } SVCCTL_R_CLOSE_SERVICE; 00212 00213 /**************************/ 00214 00215 typedef struct { 00216 UNISTR2 *servername; 00217 UNISTR2 *database; 00218 uint32 access; 00219 } SVCCTL_Q_OPEN_SCMANAGER; 00220 00221 typedef struct { 00222 POLICY_HND handle; 00223 WERROR status; 00224 } SVCCTL_R_OPEN_SCMANAGER; 00225 00226 /**************************/ 00227 00228 typedef struct { 00229 POLICY_HND handle; 00230 UNISTR2 servicename; 00231 uint32 display_name_len; 00232 } SVCCTL_Q_GET_DISPLAY_NAME; 00233 00234 typedef struct { 00235 UNISTR2 displayname; 00236 uint32 display_name_len; 00237 WERROR status; 00238 } SVCCTL_R_GET_DISPLAY_NAME; 00239 00240 /**************************/ 00241 00242 typedef struct { 00243 POLICY_HND handle; 00244 UNISTR2 servicename; 00245 uint32 access; 00246 } SVCCTL_Q_OPEN_SERVICE; 00247 00248 typedef struct { 00249 POLICY_HND handle; 00250 WERROR status; 00251 } SVCCTL_R_OPEN_SERVICE; 00252 00253 /**************************/ 00254 00255 typedef struct { 00256 POLICY_HND handle; 00257 uint32 parmcount; 00258 UNISTR4_ARRAY *parameters; 00259 } SVCCTL_Q_START_SERVICE; 00260 00261 typedef struct { 00262 WERROR status; 00263 } SVCCTL_R_START_SERVICE; 00264 00265 /**************************/ 00266 00267 typedef struct { 00268 POLICY_HND handle; 00269 uint32 control; 00270 } SVCCTL_Q_CONTROL_SERVICE; 00271 00272 typedef struct { 00273 SERVICE_STATUS svc_status; 00274 WERROR status; 00275 } SVCCTL_R_CONTROL_SERVICE; 00276 00277 /**************************/ 00278 00279 typedef struct { 00280 POLICY_HND handle; 00281 } SVCCTL_Q_QUERY_STATUS; 00282 00283 typedef struct { 00284 SERVICE_STATUS svc_status; 00285 WERROR status; 00286 } SVCCTL_R_QUERY_STATUS; 00287 00288 /**************************/ 00289 00290 typedef struct { 00291 POLICY_HND handle; 00292 uint32 type; 00293 uint32 state; 00294 uint32 buffer_size; 00295 uint32 *resume; 00296 } SVCCTL_Q_ENUM_SERVICES_STATUS; 00297 00298 typedef struct { 00299 RPC_BUFFER buffer; 00300 uint32 needed; 00301 uint32 returned; 00302 uint32 *resume; 00303 WERROR status; 00304 } SVCCTL_R_ENUM_SERVICES_STATUS; 00305 00306 /**************************/ 00307 00308 typedef struct { 00309 POLICY_HND handle; 00310 uint32 state; 00311 uint32 buffer_size; 00312 } SVCCTL_Q_ENUM_DEPENDENT_SERVICES; 00313 00314 typedef struct { 00315 RPC_BUFFER buffer; 00316 uint32 needed; 00317 uint32 returned; 00318 WERROR status; 00319 } SVCCTL_R_ENUM_DEPENDENT_SERVICES; 00320 00321 00322 /**************************/ 00323 00324 typedef struct { 00325 POLICY_HND handle; 00326 uint32 buffer_size; 00327 } SVCCTL_Q_QUERY_SERVICE_CONFIG; 00328 00329 typedef struct { 00330 SERVICE_CONFIG config; 00331 uint32 needed; 00332 WERROR status; 00333 } SVCCTL_R_QUERY_SERVICE_CONFIG; 00334 00335 00336 /**************************/ 00337 00338 typedef struct { 00339 POLICY_HND handle; 00340 uint32 level; 00341 uint32 buffer_size; 00342 } SVCCTL_Q_QUERY_SERVICE_CONFIG2; 00343 00344 typedef struct { 00345 RPC_BUFFER buffer; 00346 uint32 needed; 00347 WERROR status; 00348 } SVCCTL_R_QUERY_SERVICE_CONFIG2; 00349 00350 00351 /**************************/ 00352 00353 typedef struct { 00354 POLICY_HND handle; 00355 uint32 level; 00356 uint32 buffer_size; 00357 } SVCCTL_Q_QUERY_SERVICE_STATUSEX; 00358 00359 typedef struct { 00360 RPC_BUFFER buffer; 00361 uint32 needed; 00362 WERROR status; 00363 } SVCCTL_R_QUERY_SERVICE_STATUSEX; 00364 00365 00366 /**************************/ 00367 00368 typedef struct { 00369 POLICY_HND handle; 00370 } SVCCTL_Q_LOCK_SERVICE_DB; 00371 00372 typedef struct { 00373 POLICY_HND h_lock; 00374 WERROR status; 00375 } SVCCTL_R_LOCK_SERVICE_DB; 00376 00377 00378 /**************************/ 00379 00380 typedef struct { 00381 POLICY_HND h_lock; 00382 } SVCCTL_Q_UNLOCK_SERVICE_DB; 00383 00384 typedef struct { 00385 WERROR status; 00386 } SVCCTL_R_UNLOCK_SERVICE_DB; 00387 00388 00389 /**************************/ 00390 00391 typedef struct { 00392 POLICY_HND handle; 00393 uint32 security_flags; 00394 uint32 buffer_size; 00395 } SVCCTL_Q_QUERY_SERVICE_SEC; 00396 00397 typedef struct { 00398 RPC_BUFFER buffer; 00399 uint32 needed; 00400 WERROR status; 00401 } SVCCTL_R_QUERY_SERVICE_SEC; 00402 00403 /**************************/ 00404 00405 typedef struct { 00406 POLICY_HND handle; 00407 uint32 security_flags; 00408 RPC_BUFFER buffer; 00409 uint32 buffer_size; 00410 } SVCCTL_Q_SET_SERVICE_SEC; 00411 00412 typedef struct { 00413 WERROR status; 00414 } SVCCTL_R_SET_SERVICE_SEC; 00415 00416 00417 #endif /* _RPC_SVCCTL_H */ 00418