r10656: BIG merge from trunk. Features not copied over
[tprouty/samba.git] / source / include / rpc_svcctl.h
index 90b90bd24b1e819cd63078ceb3bfb480e4f7bc36..443a6588a661ab4a01bc79454a60765017810393 100644 (file)
 #ifndef _RPC_SVCCTL_H /* _RPC_SVCCTL_H */
 #define _RPC_SVCCTL_H 
 
-
 /* svcctl pipe */
 
 #define SVCCTL_CLOSE_SERVICE                   0x00
 #define SVCCTL_CONTROL_SERVICE                 0x01
+#define SVCCTL_LOCK_SERVICE_DB                 0x03
+#define SVCCTL_QUERY_SERVICE_SEC               0x04    /* not impmenented */
+#define SVCCTL_SET_SEVICE_SEC                  0x05    /* not implemented */
 #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
@@ -36,6 +39,7 @@
 #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
@@ -54,6 +58,7 @@
 
 /* SERVER_STATUS - CurrentState */
 
+#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_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
+
+
+/* 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
+
 /* Service Controls */
 
 #define SVCCTL_CONTROL_STOP                    0x00000001
 #define SVCCTL_CONTROL_PAUSE                   0x00000002
 #define SVCCTL_CONTROL_CONTINUE                        0x00000003
+#define SVCCTL_CONTROL_INTERROGATE             0x00000004
+#define SVCCTL_CONTROL_SHUTDOWN                 0x00000005
+
+#define SVC_HANDLE_IS_SCM                      0x0000001
+#define SVC_HANDLE_IS_SERVICE                  0x0000002
+#define SVC_HANDLE_IS_DBLOCK                   0x0000003
+
+#define SVC_STATUS_PROCESS_INFO                 0x00000000
+
+/* where we assume the location of the service control scripts */
+#define SVCCTL_SCRIPT_DIR  "svcctl"
 
 /* utility structures for RPCs */
 
@@ -90,6 +132,13 @@ typedef struct {
        uint32 wait_hint;
 } SERVICE_STATUS;
 
+typedef struct {
+       SERVICE_STATUS status;
+       uint32 process_id;
+       uint32 service_flags;
+} SERVICE_STATUS_PROCESS;
+
+
 typedef struct {
        UNISTR servicename;
        UNISTR displayname;
@@ -108,6 +157,61 @@ typedef struct {
        UNISTR2 *displayname;
 } SERVICE_CONFIG;
 
+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;
+
+typedef struct Service_info_struct {
+       uint32  type;           /* should be SVC_HANDLE_IS_SERVICE */
+       pstring servicename;    /* the name of the service */
+       pstring servicetype;    /* internal or external */
+       pstring filename;       /* what file name we can find this in, 
+                                  as well as the "index" for what the 
+                                  service name is */
+       pstring provides;
+       pstring dependencies;
+       pstring shouldstart;
+       pstring shouldstop;
+       pstring requiredstart;
+       pstring requiredstop;
+       pstring shortdescription;
+       pstring description;
+} Service_info;
+
+/* 
+ * dispatch table of functions to handle the =ServiceControl API
+ */ 
+typedef struct {
+       /* functions for enumerating subkeys and values */      
+       WERROR  (*stop_service)( const char *service, SERVICE_STATUS *status );
+       WERROR  (*start_service) ( const char *service );
+       WERROR  (*service_status)( const char *service, SERVICE_STATUS *status );
+} SERVICE_CONTROL_OPS;
+
+/* structure to store the service handle information  */
+
+typedef struct _ServiceInfo {
+       uint8                   type;
+       char                    *name;
+       uint32                  access_granted;
+       SERVICE_CONTROL_OPS     *ops;
+} SERVICE_INFO;
+
 
 /* rpc structures */
 
@@ -118,6 +222,7 @@ typedef struct {
 } SVCCTL_Q_CLOSE_SERVICE;
 
 typedef struct {
+        POLICY_HND handle;
        WERROR status;
 } SVCCTL_R_CLOSE_SERVICE;
 
@@ -229,6 +334,7 @@ typedef struct {
        WERROR status;
 } SVCCTL_R_ENUM_DEPENDENT_SERVICES;
 
+
 /**************************/
 
 typedef struct {
@@ -242,5 +348,58 @@ typedef struct {
        WERROR status;
 } SVCCTL_R_QUERY_SERVICE_CONFIG;
 
+
+/**************************/
+
+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;
+
+
+/**************************/
+
+typedef struct {
+       POLICY_HND handle;
+} SVCCTL_Q_LOCK_SERVICE_DB;
+
+typedef struct {
+       POLICY_HND h_lock;
+       WERROR status;
+} SVCCTL_R_LOCK_SERVICE_DB;
+
+
+/**************************/
+
+typedef struct {
+       POLICY_HND h_lock;
+} SVCCTL_Q_UNLOCK_SERVICE_DB;
+
+typedef struct {
+       WERROR status;
+} SVCCTL_R_UNLOCK_SERVICE_DB;
+
 #endif /* _RPC_SVCCTL_H */