/*
- Unix SMB/Netbios implementation.
- Version 1.9.
+ Unix SMB/CIFS implementation.
SMB parameters and setup
- Copyright (C) Andrew Tridgell 1992-1997
- Copyright (C) Luke Kenneth Casson Leighton 1996-1997
- Copyright (C) Paul Ashton 1997
+ Copyright (C) Andrew Tridgell 1992-1997,
+ Copyright (C) Gerald (Jerry) Carter 2005
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _RPC_SVCCTL_H /* _RPC_SVCCTL_H */
#define _RPC_SVCCTL_H
-
/* svcctl pipe */
-#define SVC_OPEN_SC_MAN 0x0f
-#define SVC_ENUM_SVCS_STATUS 0x0e
-#define SVC_QUERY_SVC_CONFIG 0x11
-#define SVC_QUERY_DISP_NAME 0x14
-#define SVC_OPEN_SERVICE 0x10
-#define SVC_START_SERVICE 0x13
-#define SVC_CLOSE 0x00
-
-
-/* SVC_Q_OPEN_SC_MAN */
-typedef struct q_svc_open_sc_man_info
-{
- uint32 ptr_srv_name; /* pointer (to server name?) */
- UNISTR2 uni_srv_name; /* unicode server name starting with '\\' */
-
- uint32 ptr_db_name; /* pointer (to database name?) */
- UNISTR2 uni_db_name; /* unicode database name */
-
- uint32 des_access; /* 0x80000004 - SC_MANAGER_xxxx */
-
-} SVC_Q_OPEN_SC_MAN;
-
-/* SVC_R_OPEN_SC_MAN */
-typedef struct r_svc_open_sc_man_info
-{
- POLICY_HND pol;
- uint32 status; /* return status */
-
-} SVC_R_OPEN_SC_MAN;
-
-/* SVC_Q_OPEN_SERVICE */
-typedef struct q_svc_open_service_info
-{
- POLICY_HND scman_pol;
- UNISTR2 uni_svc_name; /* unicode service name */
- uint32 des_access; /* 0x8000 0001 */
-
-} SVC_Q_OPEN_SERVICE;
-
-/* SVC_R_OPEN_SERVICE */
-typedef struct r_svc_open_service_info
-{
- POLICY_HND pol;
- uint32 status; /* return status */
-
-} SVC_R_OPEN_SERVICE;
-
-#define MAX_SVC_ARGS 4
-
-/* SVC_Q_START_SERVICE */
-typedef struct q_svc_start_service_info
-{
- POLICY_HND pol;
-
- uint32 argc;
- uint32 ptr_argv;
- uint32 argc2;
- UNISTR2 argv[MAX_SVC_ARGS];
-
-} SVC_Q_START_SERVICE;
-
-/* SVC_R_START_SERVICE */
-typedef struct r_svc_start_service_info
-{
- uint32 status;
-
-} SVC_R_START_SERVICE;
-
-
-/* QUERY_SERVICE_CONFIG */
-typedef struct query_service_config_info
-{
- uint32 service_type;
- uint32 start_type;
- uint32 error_control;
- uint32 ptr_bin_path_name;
- uint32 ptr_load_order_grp;
- uint32 tag_id;
- uint32 ptr_dependencies;
- uint32 ptr_service_start_name;
- uint32 ptr_display_name;
-
- UNISTR2 uni_bin_path_name;
- UNISTR2 uni_load_order_grp;
- UNISTR2 uni_dependencies;
- UNISTR2 uni_service_start_name;
- UNISTR2 uni_display_name;
-
-} QUERY_SERVICE_CONFIG;
-
-/* SVC_STATUS */
-typedef struct svc_status_info
-{
- uint32 svc_type;
- uint32 current_state;
- uint32 controls_accepted;
- uint32 win32_exit_code;
- uint32 svc_specific_exit_code;
- uint32 check_point;
- uint32 wait_hint;
-
-} SVC_STATUS;
-
-/* ENUM_SRVC_STATUS */
-typedef struct enum_svc_status_info
-{
- UNISTR uni_srvc_name;
- UNISTR uni_disp_name;
- SVC_STATUS status;
-
-} ENUM_SRVC_STATUS;
-
-/* SVC_Q_ENUM_SVCS_STATUS */
-typedef struct q_svc_enum_svcs_status_info
-{
- POLICY_HND pol;
- uint32 service_type; /* 0x00000030 - win32 | 0x0000000b - driver */
- uint32 service_state; /* 0x00000003 - state_all */
- uint32 buf_size; /* max service buffer size */
- ENUM_HND resume_hnd; /* resume handle */
-
-} SVC_Q_ENUM_SVCS_STATUS;
-
-/* SVC_R_ENUM_SVCS_STATUS */
-typedef struct r_svc_enum_svcs_status_info
-{
- uint32 buf_size; /* service buffer size */
- ENUM_SRVC_STATUS *svcs;
- uint32 more_buf_size;
- uint32 num_svcs;
- ENUM_HND resume_hnd; /* resume handle */
- uint32 dos_status; /* return status, DOS error code (wow!) */
-
-} SVC_R_ENUM_SVCS_STATUS;
-
-
-/* SVC_Q_QUERY_SVC_CONFIG */
-typedef struct q_svc_query_svc_cfg_info
-{
- POLICY_HND pol;
- uint32 buf_size;
-} SVC_Q_QUERY_SVC_CONFIG;
-
-
-/* SVC_R_QUERY_SVC_CONFIG */
-typedef struct r_svc_query_svc_cfg_info
-{
- QUERY_SERVICE_CONFIG *cfg;
- uint32 buf_size;
- uint32 status; /* return status */
-
-} SVC_R_QUERY_SVC_CONFIG;
-
-
-/* SVC_Q_QUERY_DISP_NAME */
-typedef struct q_svc_query_disp_name_info
-{
- POLICY_HND scman_pol;
- UNISTR2 uni_svc_name;
- uint32 buf_size;
-
-} SVC_Q_QUERY_DISP_NAME;
-
-
-/* SVC_R_QUERY_DISP_NAME */
-typedef struct r_svc_query_disp_name_info
-{
- UNISTR2 uni_disp_name;
- uint32 buf_size;
- uint32 status;
-
-} SVC_R_QUERY_DISP_NAME;
-
-
-/* SVC_Q_CLOSE */
-typedef struct q_svc_close_info
-{
- POLICY_HND pol;
+#define SVCCTL_CLOSE_SERVICE 0x00
+#define SVCCTL_CONTROL_SERVICE 0x01
+#define SVCCTL_LOCK_SERVICE_DB 0x03
+#define SVCCTL_QUERY_SERVICE_SEC 0x04
+#define SVCCTL_SET_SERVICE_SEC 0x05
+#define SVCCTL_QUERY_STATUS 0x06
+#define SVCCTL_UNLOCK_SERVICE_DB 0x08
+#define SVCCTL_ENUM_DEPENDENT_SERVICES_W 0x0d
+#define SVCCTL_ENUM_SERVICES_STATUS_W 0x0e
+#define SVCCTL_OPEN_SCMANAGER_W 0x0f
+#define SVCCTL_OPEN_SERVICE_W 0x10
+#define SVCCTL_QUERY_SERVICE_CONFIG_W 0x11
+#define SVCCTL_START_SERVICE_W 0x13
+#define SVCCTL_GET_DISPLAY_NAME 0x14
+#define SVCCTL_QUERY_SERVICE_CONFIG2_W 0x27
+#define SVCCTL_QUERY_SERVICE_STATUSEX_W 0x28
+
+/* ANSI versions not implemented currently
+#define SVCCTL_ENUM_SERVICES_STATUS_A 0x0e
+#define SVCCTL_OPEN_SCMANAGER_A 0x1b
+*/
-} SVC_Q_CLOSE;
+/* SERVER_STATUS - type */
+
+#define SVCCTL_TYPE_WIN32 0x00000030
+#define SVCCTL_TYPE_DRIVER 0x0000000f
+/* SERVER_STATUS - state */
+#define SVCCTL_STATE_ACTIVE 0x00000001
+#define SVCCTL_STATE_INACTIVE 0x00000002
+#define SVCCTL_STATE_ALL ( SVCCTL_STATE_ACTIVE | SVCCTL_STATE_INACTIVE )
+/* SERVER_STATUS - CurrentState */
-/* SVC_R_CLOSE */
-typedef struct r_svc_close_info
-{
- POLICY_HND pol;
- uint32 status; /* return status */
+#define SVCCTL_STATE_UNKNOWN 0x00000000 /* only used internally to smbd */
+#define SVCCTL_STOPPED 0x00000001
+#define SVCCTL_START_PENDING 0x00000002
+#define SVCCTL_STOP_PENDING 0x00000003
+#define SVCCTL_RUNNING 0x00000004
+#define SVCCTL_CONTINUE_PENDING 0x00000005
+#define SVCCTL_PAUSE_PENDING 0x00000006
+#define SVCCTL_PAUSED 0x00000007
+
+/* SERVER_STATUS - ControlAccepted */
+
+#define SVCCTL_ACCEPT_NONE 0x00000000
+#define SVCCTL_ACCEPT_STOP 0x00000001
+#define SVCCTL_ACCEPT_PAUSE_CONTINUE 0x00000002
+#define SVCCTL_ACCEPT_SHUTDOWN 0x00000004
+#define SVCCTL_ACCEPT_PARAMCHANGE 0x00000008
+#define SVCCTL_ACCEPT_NETBINDCHANGE 0x00000010
+#define SVCCTL_ACCEPT_HARDWAREPROFILECHANGE 0x00000020
+#define SVCCTL_ACCEPT_POWEREVENT 0x00000040
+
+/* SERVER_STATUS - ControlAccepted */
+#define SVCCTL_SVC_ERROR_IGNORE 0x00000000
+#define SVCCTL_SVC_ERROR_NORMAL 0x00000001
+#define SVCCTL_SVC_ERROR_CRITICAL 0x00000002
+#define SVCCTL_SVC_ERROR_SEVERE 0x00000003
+
+/* QueryServiceConfig2 options */
+#define SERVICE_CONFIG_DESCRIPTION 0x00000001
+#define SERVICE_CONFIG_FAILURE_ACTIONS 0x00000002
-} SVC_R_CLOSE;
+/* Service Config - values for ServiceType field*/
+
+#define SVCCTL_KERNEL_DRVR 0x00000001 /* doubtful we'll have these */
+#define SVCCTL_FILE_SYSTEM_DRVR 0x00000002
+#define SVCCTL_WIN32_OWN_PROC 0x00000010
+#define SVCCTL_WIN32_SHARED_PROC 0x00000020
+#define SVCCTL_WIN32_INTERACTIVE 0x00000100
+
+/* Service Config - values for StartType field */
+#define SVCCTL_BOOT_START 0x00000000
+#define SVCCTL_SYSTEM_START 0x00000001
+#define SVCCTL_AUTO_START 0x00000002
+#define SVCCTL_DEMAND_START 0x00000003
+#define SVCCTL_DISABLED 0x00000004
+
+#define SVC_HANDLE_IS_SCM 0x0000001
+#define SVC_HANDLE_IS_SERVICE 0x0000002
+#define SVC_HANDLE_IS_DBLOCK 0x0000003
+
+#define SVC_STATUS_PROCESS_INFO 0x00000000
+
+/* utility structures for RPCs */
+
+/*
+ * "struct SERVICE_STATUS" comes from librpc/gen_ndr/svcctl.h
+ */
+
+typedef struct SERVICE_STATUS SERVICE_STATUS;
+
+typedef struct {
+ SERVICE_STATUS status;
+ uint32 process_id;
+ uint32 service_flags;
+} SERVICE_STATUS_PROCESS;
+
+
+typedef struct {
+ UNISTR servicename;
+ UNISTR displayname;
+ SERVICE_STATUS status;
+} ENUM_SERVICES_STATUS;
+
+typedef struct {
+ uint32 unknown;
+ UNISTR description;
+} SERVICE_DESCRIPTION;
+
+typedef struct {
+ uint32 type;
+ uint32 delay;
+} SC_ACTION;
+
+typedef struct {
+ uint32 reset_period;
+ UNISTR2 *rebootmsg; /* i have no idea if these are UNISTR2's. I can't get a good trace */
+ UNISTR2 *command;
+ uint32 num_actions;
+ SC_ACTION *actions;
+} SERVICE_FAILURE_ACTIONS;
+
+
+/* rpc structures */
+
+/**************************/
+
+typedef struct {
+ POLICY_HND handle;
+ uint32 type;
+ uint32 state;
+ uint32 buffer_size;
+ uint32 *resume;
+} SVCCTL_Q_ENUM_SERVICES_STATUS;
+
+typedef struct {
+ RPC_BUFFER buffer;
+ uint32 needed;
+ uint32 returned;
+ uint32 *resume;
+ WERROR status;
+} SVCCTL_R_ENUM_SERVICES_STATUS;
+
+/**************************/
+
+typedef struct {
+ POLICY_HND handle;
+ uint32 level;
+ uint32 buffer_size;
+} SVCCTL_Q_QUERY_SERVICE_CONFIG2;
+
+typedef struct {
+ RPC_BUFFER buffer;
+ uint32 needed;
+ WERROR status;
+} SVCCTL_R_QUERY_SERVICE_CONFIG2;
+
+
+/**************************/
+
+typedef struct {
+ POLICY_HND handle;
+ uint32 level;
+ uint32 buffer_size;
+} SVCCTL_Q_QUERY_SERVICE_STATUSEX;
+
+typedef struct {
+ RPC_BUFFER buffer;
+ uint32 needed;
+ WERROR status;
+} SVCCTL_R_QUERY_SERVICE_STATUSEX;
#endif /* _RPC_SVCCTL_H */