librpc: fix IDL for svcctl_ChangeServiceConfigW
[bbaumbach/samba-autobuild/.git] / librpc / idl / svcctl.idl
index c70858fbd9997a93c1a9b83b369e32d2875af8af..a9dd3dec99031241ecc945c22b027281c3ee6960 100644 (file)
@@ -9,19 +9,54 @@ import "misc.idl", "security.idl";
   version(2.0),
   pointer_default(unique),
   endpoint("ncacn_np:[\\pipe\\svcctl]", "ncalrpc:"),
+  helper("../librpc/ndr/ndr_svcctl.h"),
   helpstring("Service Control")
 ] interface svcctl
 {
+       const int MAX_SERVICE_NAME_LENGTH = 256;
+       const short SC_MAX_DEPEND_SIZE = 4 * 1024;
+       const short SC_MAX_NAME_LENGTH = MAX_SERVICE_NAME_LENGTH + 1;
+       const short SC_MAX_PATH_LENGTH = 32 * 1024;
+       const short SC_MAX_PWD_SIZE = 514;
+       const short SC_MAX_COMPUTER_NAME_LENGTH = 1024;
+       const short SC_MAX_ACCOUNT_NAME_LENGTH = 2 * 1024;
+       const short SC_MAX_COMMENT_LENGTH = 128;
+       const short SC_MAX_ARGUMENT_LENGTH = 1024;
+       const short SC_MAX_ARGUMENTS = 1024;
+
        typedef struct {
                uint32 is_locked;
                [string,charset(UTF16)] uint16 *lock_owner;
                uint32 lock_duration;
        } SERVICE_LOCK_STATUS;
 
+       typedef [v1_enum] enum {
+               SVCCTL_STATE_UNKNOWN            = 0x00000000,   /* only used internally to smbd */
+               SVCCTL_STOPPED                  = 0x00000001,
+               SVCCTL_START_PENDING            = 0x00000002,
+               SVCCTL_STOP_PENDING             = 0x00000003,
+               SVCCTL_RUNNING                  = 0x00000004,
+               SVCCTL_CONTINUE_PENDING         = 0x00000005,
+               SVCCTL_PAUSE_PENDING            = 0x00000006,
+               SVCCTL_PAUSED                   = 0x00000007
+       } svcctl_ServiceStatus;
+
+       const int SVCCTL_ACCEPT_NONE                    = 0x00000000;
+
+       typedef [bitmap32bit] bitmap {
+               SVCCTL_ACCEPT_STOP                      = 0x00000001,
+               SVCCTL_ACCEPT_PAUSE_CONTINUE            = 0x00000002,
+               SVCCTL_ACCEPT_SHUTDOWN                  = 0x00000004,
+               SVCCTL_ACCEPT_PARAMCHANGE               = 0x00000008,
+               SVCCTL_ACCEPT_NETBINDCHANGE             = 0x00000010,
+               SVCCTL_ACCEPT_HARDWAREPROFILECHANGE     = 0x00000020,
+               SVCCTL_ACCEPT_POWEREVENT                = 0x00000040
+       } svcctl_ControlsAccepted;
+
        typedef struct {
                uint32 type;
-               uint32 state;
-               uint32 controls_accepted;
+               svcctl_ServiceStatus state;
+               svcctl_ControlsAccepted controls_accepted;
                WERROR win32_exit_code;
                uint32 service_exit_code;
                uint32 check_point;
@@ -34,11 +69,17 @@ import "misc.idl", "security.idl";
                uint32 service_flags;
        } SERVICE_STATUS_PROCESS;
 
-       typedef struct {
+       typedef [public,gensize] struct {
+               [relative] nstring *service_name;
+               [relative] nstring *display_name;
+               SERVICE_STATUS status;
+       } ENUM_SERVICE_STATUSW;
+
+       typedef [public,gensize] struct {
                [relative] astring *service_name;
                [relative] astring *display_name;
                SERVICE_STATUS status;
-       } ENUM_SERVICE_STATUS;
+       } ENUM_SERVICE_STATUSA;
 
        const int SERVICE_TYPE_KERNEL_DRIVER       = 0x01;
        const int SERVICE_TYPE_FS_DRIVER           = 0x02;
@@ -48,43 +89,7 @@ import "misc.idl", "security.idl";
        const int SERVICE_TYPE_WIN32_OWN_PROCESS   = 0x10;
        const int SERVICE_TYPE_WIN32_SHARE_PROCESS = 0x20;
        const int SERVICE_TYPE_WIN32=SERVICE_TYPE_WIN32_OWN_PROCESS|SERVICE_TYPE_WIN32_SHARE_PROCESS;
-
-       const int SERVICE_STATE_ACTIVE   = 0x01;
-       const int SERVICE_STATE_INACTIVE = 0x02;
-       const int SERVICE_STATE_ALL      = 0x03;
-
-       typedef [public,bitmap32bit] bitmap {
-               SV_TYPE_WORKSTATION       = 0x00000001,
-               SV_TYPE_SERVER            = 0x00000002,
-               SV_TYPE_SQLSERVER         = 0x00000004,
-               SV_TYPE_DOMAIN_CTRL       = 0x00000008,
-               SV_TYPE_DOMAIN_BAKCTRL    = 0x00000010,
-               SV_TYPE_TIME_SOURCE       = 0x00000020,
-               SV_TYPE_AFP               = 0x00000040,
-               SV_TYPE_NOVELL            = 0x00000080,
-
-               SV_TYPE_DOMAIN_MEMBER     = 0x00000100,
-               SV_TYPE_PRINTQ_SERVER     = 0x00000200,
-               SV_TYPE_DIALIN_SERVER     = 0x00000400,
-               SV_TYPE_SERVER_UNIX       = 0x00000800,
-               SV_TYPE_NT                = 0x00001000,
-               SV_TYPE_WFW               = 0x00002000,
-               SV_TYPE_SERVER_MFPN       = 0x00004000,
-               SV_TYPE_SERVER_NT         = 0x00008000,
-               SV_TYPE_POTENTIAL_BROWSER = 0x00010000,
-               SV_TYPE_BACKUP_BROWSER    = 0x00020000,
-               SV_TYPE_MASTER_BROWSER    = 0x00040000,
-               SV_TYPE_DOMAIN_MASTER     = 0x00080000,
-               SV_TYPE_SERVER_OSF        = 0x00100000,
-               SV_TYPE_SERVER_VMS        = 0x00200000,
-               SV_TYPE_WIN95_PLUS        = 0x00400000,
-               SV_TYPE_DFS_SERVER        = 0x00800000,
-               SV_TYPE_ALTERNATE_XPORT   = 0x20000000,
-               SV_TYPE_LOCAL_LIST_ONLY   = 0x40000000,
-               SV_TYPE_DOMAIN_ENUM       = 0x80000000
-       } svcctl_ServerType;
-
-       const uint32 SV_TYPE_ALL        = 0xFFFFFFFF;
+       const int SERVICE_TYPE_INTERACTIVE_PROCESS = 0x100;
 
        /*****************/
        /* Function 0x00 */
@@ -129,9 +134,9 @@ import "misc.idl", "security.idl";
        /* Function 0x04 */
        WERROR svcctl_QueryServiceObjectSecurity(
                [in] policy_handle *handle,
-               [in] uint32 security_flags,
-               [out,ref,size_is(buffer_size)] uint8 *buffer,
-               [in,range(0,0x40000)] uint32 buffer_size,
+               [in] security_secinfo security_flags,
+               [out,ref,size_is(offered)] uint8 *buffer,
+               [in,range(0,0x40000)] uint32 offered,
                [out,ref,range(0,0x40000)] uint32 *needed
        );
 
@@ -139,9 +144,9 @@ import "misc.idl", "security.idl";
        /* Function 0x05 */
        WERROR svcctl_SetServiceObjectSecurity(
                [in] policy_handle *handle,
-               [in] uint32 security_flags,
-               [in,ref,size_is(buffer_size)] uint8 *buffer,
-               [in] uint32 buffer_size
+               [in] security_secinfo security_flags,
+               [in,ref,size_is(offered)] uint8 *buffer,
+               [in] uint32 offered
        );
 
        /*****************/
@@ -194,18 +199,20 @@ import "misc.idl", "security.idl";
                SVCCTL_DISABLED                 = 0x00000004
        } svcctl_StartType;
 
-       WERROR svcctl_ChangeServiceConfigW(
+       [public] WERROR svcctl_ChangeServiceConfigW(
                [in,ref] policy_handle *handle,
                [in] uint32 type,
                [in] svcctl_StartType start_type,
                [in] svcctl_ErrorControl error_control,
                [in,unique] [string,charset(UTF16)] uint16 *binary_path,
                [in,unique] [string,charset(UTF16)] uint16 *load_order_group,
-               [out,ref] uint32 *tag_id,
-               [in,unique] [string,charset(UTF16)] uint16 *dependencies,
-               [in,unique] [string,charset(UTF16)] uint16 *service_start_name,
-               [in,unique] [string,charset(UTF16)] uint16 *password,
-               [in,unique] [string,charset(UTF16)] uint16 *display_name
+               [in,out,unique] uint32 *tag_id,
+               [in,unique,size_is(dwDependSize)] [string,charset(UTF16)] uint16 *dependencies,
+               [in,range(0, SC_MAX_DEPEND_SIZE)] uint32 dwDependSize,
+               [in,unique,range(0, SC_MAX_ACCOUNT_NAME_LENGTH)] [string,charset(UTF16)] uint16 *service_start_name,
+               [in,unique,size_is(dwPwSize)] [string,charset(UTF16)] uint16 *password,
+               [in,range(0, SC_MAX_PWD_SIZE)] uint32 dwPwSize,
+               [in,unique,range(0, SC_MAX_NAME_LENGTH)] [string,charset(UTF16)] uint16 *display_name
        );
 
        /*****************/
@@ -233,10 +240,10 @@ import "misc.idl", "security.idl";
        /* Function 0x0d */
        WERROR svcctl_EnumDependentServicesW(
                [in,ref] policy_handle *service,
-               [in] uint32 state,
-               [out,ref,size_is(buf_size)] uint8 *service_status,
-               [in,range(0,0x40000)] uint32 buf_size,
-               [out,ref,range(0,0x40000)] uint32 *bytes_needed,
+               [in] svcctl_ServiceState state,
+               [out,ref,size_is(offered)] uint8 *service_status,
+               [in,range(0,0x40000)] uint32 offered,
+               [out,ref,range(0,0x40000)] uint32 *needed,
                [out,ref,range(0,0x40000)] uint32 *services_returned
        );
 
@@ -244,19 +251,19 @@ import "misc.idl", "security.idl";
        /* Function 0x0e */
 
        typedef [v1_enum] enum {
-               SVCCTL_STATE_ACTIVE     = 0x00000001,
-               SVCCTL_STATE_INACTIVE   = 0x00000002,
-               SVCCTL_STATE_ALL        = ( SVCCTL_STATE_ACTIVE | SVCCTL_STATE_INACTIVE )
+               SERVICE_STATE_ACTIVE    = 0x00000001,
+               SERVICE_STATE_INACTIVE  = 0x00000002,
+               SERVICE_STATE_ALL       = ( SERVICE_STATE_ACTIVE | SERVICE_STATE_INACTIVE )
        } svcctl_ServiceState;
 
        WERROR svcctl_EnumServicesStatusW(
                [in,ref] policy_handle *handle,
                [in] uint32 type,
                [in] svcctl_ServiceState state,
-               [out,ref,size_is(buf_size)] uint8 *service,
-               [in] [range(0,262144)] uint32 buf_size,
-               [out,ref] [range(0,262144)] uint32 *bytes_needed,
-               [out,ref] [range(0,262144)] uint32 *services_returned,
+               [out,ref,size_is(offered)] uint8 *service,
+               [in] [range(0,0x40000)] uint32 offered,
+               [out,ref] [range(0,0x40000)] uint32 *needed,
+               [out,ref] [range(0,0x40000)] uint32 *services_returned,
                [in,out,unique] uint32 *resume_handle
        );
 
@@ -362,25 +369,33 @@ import "misc.idl", "security.idl";
        WERROR svcctl_QueryServiceConfigW(
                [in,ref] policy_handle *handle,
                [out] QUERY_SERVICE_CONFIG *query,
-               [in] [range(0,8192)] uint32 buf_size,
-               [out,ref] [range(0,8192)] uint32 *bytes_needed
+               [in] [range(0,8192)] uint32 offered,
+               [out,ref] [range(0,8192)] uint32 *needed
        );
 
        /*****************/
        /* Function 0x12 */
        WERROR svcctl_QueryServiceLockStatusW(
                [in,ref] policy_handle *handle,
-               [in] uint32 buf_size,
+               [in] uint32 offered,
                [out,ref] SERVICE_LOCK_STATUS *lock_status,
-               [out,ref] uint32 *required_buf_size
+               [out,ref] uint32 *needed
        );
 
        /*****************/
        /* Function 0x13 */
+
+       const int SC_MAX_ARGUMENT_LENGTH = 1024;
+       const int SC_MAX_ARGUMENTS = 1024;
+
+       typedef struct {
+               [string,charset(UTF16),range(0,SC_MAX_ARGUMENT_LENGTH)] uint16 *string;
+       } svcctl_ArgumentString;
+
        WERROR svcctl_StartServiceW(
                [in,ref] policy_handle *handle,
-               [in] uint32 NumArgs,
-               [in,unique/*FIXME:,length_is(NumArgs)*/] [string,charset(UTF16)] uint16 *Arguments
+               [in,range(0,SC_MAX_ARGUMENTS)] uint32 NumArgs,
+               [in,unique,size_is(NumArgs)] svcctl_ArgumentString *Arguments
        );
 
        /*****************/
@@ -448,10 +463,10 @@ import "misc.idl", "security.idl";
        /* Function 0x19 */
        WERROR svcctl_EnumDependentServicesA(
                [in,ref] policy_handle *service,
-               [in] uint32 state,
-               [out,unique] ENUM_SERVICE_STATUS *service_status,
-               [in] uint32 buf_size,
-               [out,ref] uint32 *bytes_needed,
+               [in] svcctl_ServiceState state,
+               [out,unique] ENUM_SERVICE_STATUSA *service_status,
+               [in] uint32 offered,
+               [out,ref] uint32 *needed,
                [out,ref] uint32 *services_returned
        );
 
@@ -460,10 +475,10 @@ import "misc.idl", "security.idl";
        WERROR svcctl_EnumServicesStatusA(
                [in,ref] policy_handle *handle,
                [in] uint32 type,
-               [in] uint32 state,
-               [in] uint32 buf_size,
-               [out,size_is(buf_size)] uint8 service[*],
-               [out,ref] uint32 *bytes_needed,
+               [in] svcctl_ServiceState state,
+               [in] uint32 offered,
+               [out,size_is(offered)] uint8 service[*],
+               [out,ref] uint32 *needed,
                [out,ref] uint32 *services_returned,
                [in,out,unique] uint32 *resume_handle
        );
@@ -482,25 +497,26 @@ import "misc.idl", "security.idl";
        WERROR svcctl_OpenServiceA(
                [in,ref] policy_handle *scmanager_handle,
                [in,unique] [string,charset(UTF16)] uint16 *ServiceName,
-               [in] uint32 access_mask
+               [in] uint32 access_mask,
+               [out,ref] policy_handle *handle
        );
 
        /*****************/
        /* Function 0x1d */
        WERROR svcctl_QueryServiceConfigA(
                [in,ref] policy_handle *handle,
-               [out] uint8 query[buf_size], /*QUERYU_SERVICE_CONFIG */
-               [in] uint32 buf_size,
-               [out,ref] uint32 *bytes_needed
+               [out] uint8 query[offered], /*QUERYU_SERVICE_CONFIG */
+               [in] uint32 offered,
+               [out,ref] uint32 *needed
        );
 
        /*****************/
        /* Function 0x1e */
        WERROR svcctl_QueryServiceLockStatusA(
                [in,ref] policy_handle *handle,
-               [in] uint32 buf_size,
+               [in] uint32 offered,
                [out,ref] SERVICE_LOCK_STATUS *lock_status,
-               [out,ref] uint32 *required_buf_size
+               [out,ref] uint32 *needed
        );
 
        /*****************/
@@ -590,9 +606,9 @@ import "misc.idl", "security.idl";
        WERROR svcctl_QueryServiceConfig2A(
                [in,ref] policy_handle *handle,
                [in] svcctl_ConfigLevel info_level,
-               [out] uint8 buffer[buf_size],
-               [in] uint32 buf_size,
-               [out,ref] uint32 *bytes_needed
+               [out] uint8 buffer[offered],
+               [in] uint32 offered,
+               [out,ref] uint32 *needed
        );
 
        /*****************/
@@ -600,9 +616,9 @@ import "misc.idl", "security.idl";
        WERROR svcctl_QueryServiceConfig2W(
                [in,ref] policy_handle *handle,
                [in] svcctl_ConfigLevel info_level,
-               [out,ref,size_is(buf_size)] uint8 *buffer,
-               [in] [range(0,8192)] uint32 buf_size,
-               [out,ref] [range(0,8192)] uint32 *bytes_needed
+               [out,ref,size_is(offered)] uint8 *buffer,
+               [in] [range(0,8192)] uint32 offered,
+               [out,ref] [range(0,8192)] uint32 *needed
        );
 
        /*****************/
@@ -615,9 +631,9 @@ import "misc.idl", "security.idl";
        WERROR svcctl_QueryServiceStatusEx(
                [in,ref] policy_handle *handle,
                [in] svcctl_StatusLevel info_level,
-               [out,ref,size_is(buf_size)] uint8 *buffer,
-               [in] [range(0,8192)] uint32 buf_size,
-               [out,ref] [range(0,8192)] uint32 *bytes_needed
+               [out,ref,size_is(offered)] uint8 *buffer,
+               [in] [range(0,8192)] uint32 offered,
+               [out,ref] [range(0,8192)] uint32 *needed
        );
 
        /*****************/
@@ -626,10 +642,10 @@ import "misc.idl", "security.idl";
                [in,ref] policy_handle *scmanager,
                [in] uint32 info_level,
                [in] uint32 type,
-               [in] uint32 state,
-               [out] uint8 services[buf_size],
-               [in] uint32 buf_size,
-               [out,ref] uint32 *bytes_needed,
+               [in] svcctl_ServiceState state,
+               [out] uint8 services[offered],
+               [in] uint32 offered,
+               [out,ref] uint32 *needed,
                [out,ref] uint32 *service_returned,
                [in,out,unique] uint32 *resume_handle,
                [out,ref] [string,charset(UTF16)] uint16 **group_name
@@ -641,12 +657,12 @@ import "misc.idl", "security.idl";
                [in,ref] policy_handle *scmanager,
                [in] uint32 info_level,
                [in] uint32 type,
-               [in] uint32 state,
-               [out,ref,size_is(buf_size)] uint8 *services,
-               [in] [range(0,262144)] uint32 buf_size,
-               [out,ref] [range(0,262144)] uint32 *bytes_needed,
-               [out,ref] [range(0,262144)] uint32 *service_returned,
-               [in,out,unique] [range(0,262144)] uint32 *resume_handle,
+               [in] svcctl_ServiceState state,
+               [out,ref,size_is(offered)] uint8 *services,
+               [in] [range(0,0x40000)] uint32 offered,
+               [out,ref] [range(0,0x40000)] uint32 *needed,
+               [out,ref] [range(0,0x40000)] uint32 *service_returned,
+               [in,out,unique] [range(0,0x40000)] uint32 *resume_handle,
                [in,unique] [string,charset(UTF16)] uint16 *group_name
        );