| 1 | #include "idl_types.h" | 
|---|
| 2 |  | 
|---|
| 3 | /* | 
|---|
| 4 | svcctl interface definitions | 
|---|
| 5 | */ | 
|---|
| 6 |  | 
|---|
| 7 | import "misc.idl", "security.idl"; | 
|---|
| 8 | [ uuid("367abb81-9844-35f1-ad32-98f038001003"), | 
|---|
| 9 | version(2.0), | 
|---|
| 10 | pointer_default(unique), | 
|---|
| 11 | endpoint("ncacn_np:[\\pipe\\svcctl]", "ncalrpc:"), | 
|---|
| 12 | helper("../librpc/ndr/ndr_svcctl.h"), | 
|---|
| 13 | helpstring("Service Control") | 
|---|
| 14 | ] interface svcctl | 
|---|
| 15 | { | 
|---|
| 16 | typedef struct { | 
|---|
| 17 | uint32 is_locked; | 
|---|
| 18 | [string,charset(UTF16)] uint16 *lock_owner; | 
|---|
| 19 | uint32 lock_duration; | 
|---|
| 20 | } SERVICE_LOCK_STATUS; | 
|---|
| 21 |  | 
|---|
| 22 | typedef [v1_enum] enum { | 
|---|
| 23 | SVCCTL_STATE_UNKNOWN            = 0x00000000,   /* only used internally to smbd */ | 
|---|
| 24 | SVCCTL_STOPPED                  = 0x00000001, | 
|---|
| 25 | SVCCTL_START_PENDING            = 0x00000002, | 
|---|
| 26 | SVCCTL_STOP_PENDING             = 0x00000003, | 
|---|
| 27 | SVCCTL_RUNNING                  = 0x00000004, | 
|---|
| 28 | SVCCTL_CONTINUE_PENDING         = 0x00000005, | 
|---|
| 29 | SVCCTL_PAUSE_PENDING            = 0x00000006, | 
|---|
| 30 | SVCCTL_PAUSED                   = 0x00000007 | 
|---|
| 31 | } svcctl_ServiceStatus; | 
|---|
| 32 |  | 
|---|
| 33 | const int SVCCTL_ACCEPT_NONE                    = 0x00000000; | 
|---|
| 34 |  | 
|---|
| 35 | typedef [bitmap32bit] bitmap { | 
|---|
| 36 | SVCCTL_ACCEPT_STOP                      = 0x00000001, | 
|---|
| 37 | SVCCTL_ACCEPT_PAUSE_CONTINUE            = 0x00000002, | 
|---|
| 38 | SVCCTL_ACCEPT_SHUTDOWN                  = 0x00000004, | 
|---|
| 39 | SVCCTL_ACCEPT_PARAMCHANGE               = 0x00000008, | 
|---|
| 40 | SVCCTL_ACCEPT_NETBINDCHANGE             = 0x00000010, | 
|---|
| 41 | SVCCTL_ACCEPT_HARDWAREPROFILECHANGE     = 0x00000020, | 
|---|
| 42 | SVCCTL_ACCEPT_POWEREVENT                = 0x00000040 | 
|---|
| 43 | } svcctl_ControlsAccepted; | 
|---|
| 44 |  | 
|---|
| 45 | typedef struct { | 
|---|
| 46 | uint32 type; | 
|---|
| 47 | svcctl_ServiceStatus state; | 
|---|
| 48 | svcctl_ControlsAccepted controls_accepted; | 
|---|
| 49 | WERROR win32_exit_code; | 
|---|
| 50 | uint32 service_exit_code; | 
|---|
| 51 | uint32 check_point; | 
|---|
| 52 | uint32 wait_hint; | 
|---|
| 53 | } SERVICE_STATUS; | 
|---|
| 54 |  | 
|---|
| 55 | typedef [public] struct { | 
|---|
| 56 | SERVICE_STATUS status; | 
|---|
| 57 | uint32 process_id; | 
|---|
| 58 | uint32 service_flags; | 
|---|
| 59 | } SERVICE_STATUS_PROCESS; | 
|---|
| 60 |  | 
|---|
| 61 | typedef [public,gensize] struct { | 
|---|
| 62 | [relative] nstring *service_name; | 
|---|
| 63 | [relative] nstring *display_name; | 
|---|
| 64 | SERVICE_STATUS status; | 
|---|
| 65 | } ENUM_SERVICE_STATUSW; | 
|---|
| 66 |  | 
|---|
| 67 | typedef [public,gensize] struct { | 
|---|
| 68 | [relative] astring *service_name; | 
|---|
| 69 | [relative] astring *display_name; | 
|---|
| 70 | SERVICE_STATUS status; | 
|---|
| 71 | } ENUM_SERVICE_STATUSA; | 
|---|
| 72 |  | 
|---|
| 73 | const int SERVICE_TYPE_KERNEL_DRIVER       = 0x01; | 
|---|
| 74 | const int SERVICE_TYPE_FS_DRIVER           = 0x02; | 
|---|
| 75 | const int SERVICE_TYPE_ADAPTER             = 0x04; | 
|---|
| 76 | const int SERVICE_TYPE_RECOGNIZER_DRIVER   = 0x08; | 
|---|
| 77 | const int SERVICE_TYPE_DRIVER=SERVICE_TYPE_KERNEL_DRIVER|SERVICE_TYPE_FS_DRIVER|SERVICE_TYPE_RECOGNIZER_DRIVER; | 
|---|
| 78 | const int SERVICE_TYPE_WIN32_OWN_PROCESS   = 0x10; | 
|---|
| 79 | const int SERVICE_TYPE_WIN32_SHARE_PROCESS = 0x20; | 
|---|
| 80 | const int SERVICE_TYPE_WIN32=SERVICE_TYPE_WIN32_OWN_PROCESS|SERVICE_TYPE_WIN32_SHARE_PROCESS; | 
|---|
| 81 | const int SERVICE_TYPE_INTERACTIVE_PROCESS = 0x100; | 
|---|
| 82 |  | 
|---|
| 83 | typedef [public,bitmap32bit] bitmap { | 
|---|
| 84 | SV_TYPE_WORKSTATION       = 0x00000001, | 
|---|
| 85 | SV_TYPE_SERVER            = 0x00000002, | 
|---|
| 86 | SV_TYPE_SQLSERVER         = 0x00000004, | 
|---|
| 87 | SV_TYPE_DOMAIN_CTRL       = 0x00000008, | 
|---|
| 88 | SV_TYPE_DOMAIN_BAKCTRL    = 0x00000010, | 
|---|
| 89 | SV_TYPE_TIME_SOURCE       = 0x00000020, | 
|---|
| 90 | SV_TYPE_AFP               = 0x00000040, | 
|---|
| 91 | SV_TYPE_NOVELL            = 0x00000080, | 
|---|
| 92 |  | 
|---|
| 93 | SV_TYPE_DOMAIN_MEMBER     = 0x00000100, | 
|---|
| 94 | SV_TYPE_PRINTQ_SERVER     = 0x00000200, | 
|---|
| 95 | SV_TYPE_DIALIN_SERVER     = 0x00000400, | 
|---|
| 96 | SV_TYPE_SERVER_UNIX       = 0x00000800, | 
|---|
| 97 | SV_TYPE_NT                = 0x00001000, | 
|---|
| 98 | SV_TYPE_WFW               = 0x00002000, | 
|---|
| 99 | SV_TYPE_SERVER_MFPN       = 0x00004000, | 
|---|
| 100 | SV_TYPE_SERVER_NT         = 0x00008000, | 
|---|
| 101 | SV_TYPE_POTENTIAL_BROWSER = 0x00010000, | 
|---|
| 102 | SV_TYPE_BACKUP_BROWSER    = 0x00020000, | 
|---|
| 103 | SV_TYPE_MASTER_BROWSER    = 0x00040000, | 
|---|
| 104 | SV_TYPE_DOMAIN_MASTER     = 0x00080000, | 
|---|
| 105 | SV_TYPE_SERVER_OSF        = 0x00100000, | 
|---|
| 106 | SV_TYPE_SERVER_VMS        = 0x00200000, | 
|---|
| 107 | SV_TYPE_WIN95_PLUS        = 0x00400000, | 
|---|
| 108 | SV_TYPE_DFS_SERVER        = 0x00800000, | 
|---|
| 109 | SV_TYPE_ALTERNATE_XPORT   = 0x20000000, | 
|---|
| 110 | SV_TYPE_LOCAL_LIST_ONLY   = 0x40000000, | 
|---|
| 111 | SV_TYPE_DOMAIN_ENUM       = 0x80000000 | 
|---|
| 112 | } svcctl_ServerType; | 
|---|
| 113 |  | 
|---|
| 114 | const uint32 SV_TYPE_ALL        = 0xFFFFFFFF; | 
|---|
| 115 |  | 
|---|
| 116 | /*****************/ | 
|---|
| 117 | /* Function 0x00 */ | 
|---|
| 118 | WERROR svcctl_CloseServiceHandle( | 
|---|
| 119 | [in,out,ref] policy_handle *handle | 
|---|
| 120 | ); | 
|---|
| 121 |  | 
|---|
| 122 | /*****************/ | 
|---|
| 123 | /* Function 0x01 */ | 
|---|
| 124 |  | 
|---|
| 125 | /* Service Controls */ | 
|---|
| 126 |  | 
|---|
| 127 | typedef [v1_enum] enum { | 
|---|
| 128 | SVCCTL_CONTROL_STOP             = 0x00000001, | 
|---|
| 129 | SVCCTL_CONTROL_PAUSE            = 0x00000002, | 
|---|
| 130 | SVCCTL_CONTROL_CONTINUE         = 0x00000003, | 
|---|
| 131 | SVCCTL_CONTROL_INTERROGATE      = 0x00000004, | 
|---|
| 132 | SVCCTL_CONTROL_SHUTDOWN         = 0x00000005 | 
|---|
| 133 | } SERVICE_CONTROL; | 
|---|
| 134 |  | 
|---|
| 135 | WERROR svcctl_ControlService( | 
|---|
| 136 | [in,ref] policy_handle *handle, | 
|---|
| 137 | [in] SERVICE_CONTROL control, | 
|---|
| 138 | [out,ref] SERVICE_STATUS *service_status | 
|---|
| 139 | ); | 
|---|
| 140 |  | 
|---|
| 141 | /*****************/ | 
|---|
| 142 | /* Function 0x02 */ | 
|---|
| 143 | WERROR svcctl_DeleteService( | 
|---|
| 144 | [in,ref] policy_handle *handle | 
|---|
| 145 | ); | 
|---|
| 146 |  | 
|---|
| 147 | /*****************/ | 
|---|
| 148 | /* Function 0x03 */ | 
|---|
| 149 |  | 
|---|
| 150 | WERROR svcctl_LockServiceDatabase( | 
|---|
| 151 | [in,ref] policy_handle *handle, | 
|---|
| 152 | [out,ref] policy_handle *lock | 
|---|
| 153 | ); | 
|---|
| 154 |  | 
|---|
| 155 | /*****************/ | 
|---|
| 156 | /* Function 0x04 */ | 
|---|
| 157 | WERROR svcctl_QueryServiceObjectSecurity( | 
|---|
| 158 | [in] policy_handle *handle, | 
|---|
| 159 | [in] security_secinfo security_flags, | 
|---|
| 160 | [out,ref,size_is(offered)] uint8 *buffer, | 
|---|
| 161 | [in,range(0,0x40000)] uint32 offered, | 
|---|
| 162 | [out,ref,range(0,0x40000)] uint32 *needed | 
|---|
| 163 | ); | 
|---|
| 164 |  | 
|---|
| 165 | /*****************/ | 
|---|
| 166 | /* Function 0x05 */ | 
|---|
| 167 | WERROR svcctl_SetServiceObjectSecurity( | 
|---|
| 168 | [in] policy_handle *handle, | 
|---|
| 169 | [in] security_secinfo security_flags, | 
|---|
| 170 | [in,ref,size_is(offered)] uint8 *buffer, | 
|---|
| 171 | [in] uint32 offered | 
|---|
| 172 | ); | 
|---|
| 173 |  | 
|---|
| 174 | /*****************/ | 
|---|
| 175 | /* Function 0x06 */ | 
|---|
| 176 | WERROR svcctl_QueryServiceStatus( | 
|---|
| 177 | [in,ref] policy_handle *handle, | 
|---|
| 178 | [out,ref] SERVICE_STATUS *service_status | 
|---|
| 179 | ); | 
|---|
| 180 |  | 
|---|
| 181 | /*****************/ | 
|---|
| 182 | /* Function 0x07 */ | 
|---|
| 183 | [todo] WERROR svcctl_SetServiceStatus( | 
|---|
| 184 | ); | 
|---|
| 185 |  | 
|---|
| 186 | /*****************/ | 
|---|
| 187 | /* Function 0x08 */ | 
|---|
| 188 | WERROR svcctl_UnlockServiceDatabase( | 
|---|
| 189 | [in,out,ref] policy_handle *lock | 
|---|
| 190 | ); | 
|---|
| 191 |  | 
|---|
| 192 | /*****************/ | 
|---|
| 193 | /* Function 0x09 */ | 
|---|
| 194 | [todo] WERROR svcctl_NotifyBootConfigStatus( | 
|---|
| 195 | ); | 
|---|
| 196 |  | 
|---|
| 197 | /*****************/ | 
|---|
| 198 | /* Function 0x0a */ | 
|---|
| 199 | WERROR svcctl_SCSetServiceBitsW( | 
|---|
| 200 | [in,ref] policy_handle *handle, | 
|---|
| 201 | [in] uint32 bits, | 
|---|
| 202 | [in] boolean32 bitson, | 
|---|
| 203 | [in] boolean32 immediate | 
|---|
| 204 | ); | 
|---|
| 205 |  | 
|---|
| 206 | /*****************/ | 
|---|
| 207 | /* Function 0x0b */ | 
|---|
| 208 |  | 
|---|
| 209 | typedef [v1_enum] enum { | 
|---|
| 210 | SVCCTL_SVC_ERROR_IGNORE         = 0x00000000, | 
|---|
| 211 | SVCCTL_SVC_ERROR_NORMAL         = 0x00000001, | 
|---|
| 212 | SVCCTL_SVC_ERROR_CRITICAL       = 0x00000002, | 
|---|
| 213 | SVCCTL_SVC_ERROR_SEVERE         = 0x00000003 | 
|---|
| 214 | } svcctl_ErrorControl; | 
|---|
| 215 |  | 
|---|
| 216 | typedef [v1_enum] enum { | 
|---|
| 217 | SVCCTL_BOOT_START               = 0x00000000, | 
|---|
| 218 | SVCCTL_SYSTEM_START             = 0x00000001, | 
|---|
| 219 | SVCCTL_AUTO_START               = 0x00000002, | 
|---|
| 220 | SVCCTL_DEMAND_START             = 0x00000003, | 
|---|
| 221 | SVCCTL_DISABLED                 = 0x00000004 | 
|---|
| 222 | } svcctl_StartType; | 
|---|
| 223 |  | 
|---|
| 224 | WERROR svcctl_ChangeServiceConfigW( | 
|---|
| 225 | [in,ref] policy_handle *handle, | 
|---|
| 226 | [in] uint32 type, | 
|---|
| 227 | [in] svcctl_StartType start_type, | 
|---|
| 228 | [in] svcctl_ErrorControl error_control, | 
|---|
| 229 | [in,unique] [string,charset(UTF16)] uint16 *binary_path, | 
|---|
| 230 | [in,unique] [string,charset(UTF16)] uint16 *load_order_group, | 
|---|
| 231 | [out,ref] uint32 *tag_id, | 
|---|
| 232 | [in,unique] [string,charset(UTF16)] uint16 *dependencies, | 
|---|
| 233 | [in,unique] [string,charset(UTF16)] uint16 *service_start_name, | 
|---|
| 234 | [in,unique] [string,charset(UTF16)] uint16 *password, | 
|---|
| 235 | [in,unique] [string,charset(UTF16)] uint16 *display_name | 
|---|
| 236 | ); | 
|---|
| 237 |  | 
|---|
| 238 | /*****************/ | 
|---|
| 239 | /* Function 0x0c */ | 
|---|
| 240 | WERROR svcctl_CreateServiceW( | 
|---|
| 241 | [in,ref] policy_handle *scmanager_handle, | 
|---|
| 242 | [in] [string,charset(UTF16)] uint16 ServiceName[], | 
|---|
| 243 | [in,unique] [string,charset(UTF16)] uint16 *DisplayName, | 
|---|
| 244 | [in] uint32 desired_access, | 
|---|
| 245 | [in] uint32 type, | 
|---|
| 246 | [in] svcctl_StartType start_type, | 
|---|
| 247 | [in] svcctl_ErrorControl error_control, | 
|---|
| 248 | [in] [string,charset(UTF16)] uint16 binary_path[], | 
|---|
| 249 | [in,unique] [string,charset(UTF16)] uint16 *LoadOrderGroupKey, | 
|---|
| 250 | [in,out,unique] uint32 *TagId, | 
|---|
| 251 | [in,unique,size_is(dependencies_size)] uint8 *dependencies, | 
|---|
| 252 | [in] uint32 dependencies_size, | 
|---|
| 253 | [in,unique] [string,charset(UTF16)] uint16 *service_start_name, | 
|---|
| 254 | [in,unique,size_is(password_size)] uint8 *password, | 
|---|
| 255 | [in] uint32 password_size, | 
|---|
| 256 | [out,ref] policy_handle *handle | 
|---|
| 257 | ); | 
|---|
| 258 |  | 
|---|
| 259 | /*****************/ | 
|---|
| 260 | /* Function 0x0d */ | 
|---|
| 261 | WERROR svcctl_EnumDependentServicesW( | 
|---|
| 262 | [in,ref] policy_handle *service, | 
|---|
| 263 | [in] svcctl_ServiceState state, | 
|---|
| 264 | [out,ref,size_is(offered)] uint8 *service_status, | 
|---|
| 265 | [in,range(0,0x40000)] uint32 offered, | 
|---|
| 266 | [out,ref,range(0,0x40000)] uint32 *needed, | 
|---|
| 267 | [out,ref,range(0,0x40000)] uint32 *services_returned | 
|---|
| 268 | ); | 
|---|
| 269 |  | 
|---|
| 270 | /*****************/ | 
|---|
| 271 | /* Function 0x0e */ | 
|---|
| 272 |  | 
|---|
| 273 | typedef [v1_enum] enum { | 
|---|
| 274 | SERVICE_STATE_ACTIVE    = 0x00000001, | 
|---|
| 275 | SERVICE_STATE_INACTIVE  = 0x00000002, | 
|---|
| 276 | SERVICE_STATE_ALL       = ( SERVICE_STATE_ACTIVE | SERVICE_STATE_INACTIVE ) | 
|---|
| 277 | } svcctl_ServiceState; | 
|---|
| 278 |  | 
|---|
| 279 | WERROR svcctl_EnumServicesStatusW( | 
|---|
| 280 | [in,ref] policy_handle *handle, | 
|---|
| 281 | [in] uint32 type, | 
|---|
| 282 | [in] svcctl_ServiceState state, | 
|---|
| 283 | [out,ref,size_is(offered)] uint8 *service, | 
|---|
| 284 | [in] [range(0,0x40000)] uint32 offered, | 
|---|
| 285 | [out,ref] [range(0,0x40000)] uint32 *needed, | 
|---|
| 286 | [out,ref] [range(0,0x40000)] uint32 *services_returned, | 
|---|
| 287 | [in,out,unique] uint32 *resume_handle | 
|---|
| 288 | ); | 
|---|
| 289 |  | 
|---|
| 290 | /*****************/ | 
|---|
| 291 | /* Function 0x0f */ | 
|---|
| 292 |  | 
|---|
| 293 | /* Service Control Manager Bits */ | 
|---|
| 294 |  | 
|---|
| 295 | typedef [bitmap32bit] bitmap { | 
|---|
| 296 | SC_RIGHT_MGR_CONNECT            = 0x0001, | 
|---|
| 297 | SC_RIGHT_MGR_CREATE_SERVICE     = 0x0002, | 
|---|
| 298 | SC_RIGHT_MGR_ENUMERATE_SERVICE  = 0x0004, | 
|---|
| 299 | SC_RIGHT_MGR_LOCK               = 0x0008, | 
|---|
| 300 | SC_RIGHT_MGR_QUERY_LOCK_STATUS  = 0x0010, | 
|---|
| 301 | SC_RIGHT_MGR_MODIFY_BOOT_CONFIG = 0x0020 | 
|---|
| 302 | } svcctl_MgrAccessMask; | 
|---|
| 303 |  | 
|---|
| 304 | const int SC_MANAGER_READ_ACCESS = | 
|---|
| 305 | (SEC_STD_READ_CONTROL                   | | 
|---|
| 306 | SC_RIGHT_MGR_CONNECT                   | | 
|---|
| 307 | SC_RIGHT_MGR_ENUMERATE_SERVICE         | | 
|---|
| 308 | SC_RIGHT_MGR_QUERY_LOCK_STATUS); | 
|---|
| 309 |  | 
|---|
| 310 | const int SC_MANAGER_EXECUTE_ACCESS = SC_MANAGER_READ_ACCESS; | 
|---|
| 311 |  | 
|---|
| 312 | const int SC_MANAGER_WRITE_ACCESS = | 
|---|
| 313 | (SEC_STD_REQUIRED                       | | 
|---|
| 314 | SC_MANAGER_READ_ACCESS                 | | 
|---|
| 315 | SC_RIGHT_MGR_CREATE_SERVICE            | | 
|---|
| 316 | SC_RIGHT_MGR_LOCK                      | | 
|---|
| 317 | SC_RIGHT_MGR_MODIFY_BOOT_CONFIG); | 
|---|
| 318 |  | 
|---|
| 319 | const int SC_MANAGER_ALL_ACCESS = SC_MANAGER_WRITE_ACCESS; | 
|---|
| 320 |  | 
|---|
| 321 | WERROR svcctl_OpenSCManagerW( | 
|---|
| 322 | [in,unique] [string,charset(UTF16)] uint16 *MachineName, | 
|---|
| 323 | [in,unique] [string,charset(UTF16)] uint16 *DatabaseName, | 
|---|
| 324 | [in] svcctl_MgrAccessMask access_mask, | 
|---|
| 325 | [out,ref] policy_handle *handle | 
|---|
| 326 | ); | 
|---|
| 327 |  | 
|---|
| 328 | /*****************/ | 
|---|
| 329 | /* Function 0x10 */ | 
|---|
| 330 |  | 
|---|
| 331 | /* Service Object Bits */ | 
|---|
| 332 |  | 
|---|
| 333 | typedef [bitmap32bit] bitmap { | 
|---|
| 334 | SC_RIGHT_SVC_QUERY_CONFIG               = 0x0001, | 
|---|
| 335 | SC_RIGHT_SVC_CHANGE_CONFIG              = 0x0002, | 
|---|
| 336 | SC_RIGHT_SVC_QUERY_STATUS               = 0x0004, | 
|---|
| 337 | SC_RIGHT_SVC_ENUMERATE_DEPENDENTS       = 0x0008, | 
|---|
| 338 | SC_RIGHT_SVC_START                      = 0x0010, | 
|---|
| 339 | SC_RIGHT_SVC_STOP                       = 0x0020, | 
|---|
| 340 | SC_RIGHT_SVC_PAUSE_CONTINUE             = 0x0040, | 
|---|
| 341 | SC_RIGHT_SVC_INTERROGATE                = 0x0080, | 
|---|
| 342 | SC_RIGHT_SVC_USER_DEFINED_CONTROL       = 0x0100 | 
|---|
| 343 | } svcctl_ServiceAccessMask; | 
|---|
| 344 |  | 
|---|
| 345 | const int SERVICE_READ_ACCESS = | 
|---|
| 346 | (SEC_STD_READ_CONTROL                   | | 
|---|
| 347 | SC_RIGHT_SVC_ENUMERATE_DEPENDENTS      | | 
|---|
| 348 | SC_RIGHT_SVC_INTERROGATE               | | 
|---|
| 349 | SC_RIGHT_SVC_QUERY_CONFIG              | | 
|---|
| 350 | SC_RIGHT_SVC_QUERY_STATUS              | | 
|---|
| 351 | SC_RIGHT_SVC_USER_DEFINED_CONTROL); | 
|---|
| 352 |  | 
|---|
| 353 | const int SERVICE_EXECUTE_ACCESS = | 
|---|
| 354 | (SERVICE_READ_ACCESS                    | | 
|---|
| 355 | SC_RIGHT_SVC_START                     | | 
|---|
| 356 | SC_RIGHT_SVC_STOP                      | | 
|---|
| 357 | SC_RIGHT_SVC_PAUSE_CONTINUE); | 
|---|
| 358 |  | 
|---|
| 359 | const int SERVICE_WRITE_ACCESS = | 
|---|
| 360 | (SEC_STD_REQUIRED                       | | 
|---|
| 361 | SERVICE_READ_ACCESS                    | | 
|---|
| 362 | SERVICE_EXECUTE_ACCESS                 | | 
|---|
| 363 | SC_RIGHT_SVC_CHANGE_CONFIG); | 
|---|
| 364 |  | 
|---|
| 365 | const int SERVICE_ALL_ACCESS = SERVICE_WRITE_ACCESS; | 
|---|
| 366 |  | 
|---|
| 367 | WERROR svcctl_OpenServiceW( | 
|---|
| 368 | [in,ref] policy_handle *scmanager_handle, | 
|---|
| 369 | [in] [string,charset(UTF16)] uint16 ServiceName[], | 
|---|
| 370 | [in] svcctl_ServiceAccessMask access_mask, | 
|---|
| 371 | [out,ref] policy_handle *handle | 
|---|
| 372 | ); | 
|---|
| 373 |  | 
|---|
| 374 | /*****************/ | 
|---|
| 375 | /* Function 0x11 */ | 
|---|
| 376 |  | 
|---|
| 377 | typedef [public,gensize] struct { | 
|---|
| 378 | uint32 service_type; | 
|---|
| 379 | svcctl_StartType start_type; | 
|---|
| 380 | svcctl_ErrorControl error_control; | 
|---|
| 381 | [string,charset(UTF16)] [range(0,8192)] uint16 *executablepath; | 
|---|
| 382 | [string,charset(UTF16)] [range(0,8192)] uint16 *loadordergroup; | 
|---|
| 383 | uint32 tag_id; | 
|---|
| 384 | [string,charset(UTF16)] [range(0,8192)] uint16 *dependencies; | 
|---|
| 385 | [string,charset(UTF16)] [range(0,8192)] uint16 *startname; | 
|---|
| 386 | [string,charset(UTF16)] [range(0,8192)] uint16 *displayname; | 
|---|
| 387 | } QUERY_SERVICE_CONFIG; | 
|---|
| 388 |  | 
|---|
| 389 | WERROR svcctl_QueryServiceConfigW( | 
|---|
| 390 | [in,ref] policy_handle *handle, | 
|---|
| 391 | [out] QUERY_SERVICE_CONFIG *query, | 
|---|
| 392 | [in] [range(0,8192)] uint32 offered, | 
|---|
| 393 | [out,ref] [range(0,8192)] uint32 *needed | 
|---|
| 394 | ); | 
|---|
| 395 |  | 
|---|
| 396 | /*****************/ | 
|---|
| 397 | /* Function 0x12 */ | 
|---|
| 398 | WERROR svcctl_QueryServiceLockStatusW( | 
|---|
| 399 | [in,ref] policy_handle *handle, | 
|---|
| 400 | [in] uint32 offered, | 
|---|
| 401 | [out,ref] SERVICE_LOCK_STATUS *lock_status, | 
|---|
| 402 | [out,ref] uint32 *needed | 
|---|
| 403 | ); | 
|---|
| 404 |  | 
|---|
| 405 | /*****************/ | 
|---|
| 406 | /* Function 0x13 */ | 
|---|
| 407 |  | 
|---|
| 408 | const int SC_MAX_ARGUMENT_LENGTH = 1024; | 
|---|
| 409 | const int SC_MAX_ARGUMENTS = 1024; | 
|---|
| 410 |  | 
|---|
| 411 | typedef struct { | 
|---|
| 412 | [string,charset(UTF16),range(0,SC_MAX_ARGUMENT_LENGTH)] uint16 *string; | 
|---|
| 413 | } svcctl_ArgumentString; | 
|---|
| 414 |  | 
|---|
| 415 | WERROR svcctl_StartServiceW( | 
|---|
| 416 | [in,ref] policy_handle *handle, | 
|---|
| 417 | [in,range(0,SC_MAX_ARGUMENTS)] uint32 NumArgs, | 
|---|
| 418 | [in,unique,size_is(NumArgs)] svcctl_ArgumentString *Arguments | 
|---|
| 419 | ); | 
|---|
| 420 |  | 
|---|
| 421 | /*****************/ | 
|---|
| 422 | /* Function 0x14 */ | 
|---|
| 423 | WERROR svcctl_GetServiceDisplayNameW( | 
|---|
| 424 | [in,ref] policy_handle *handle, | 
|---|
| 425 | [in,unique] [string,charset(UTF16)] uint16 *service_name, | 
|---|
| 426 | [out,ref] [string,charset(UTF16)] uint16 **display_name, | 
|---|
| 427 | [in,out,unique] uint32 *display_name_length | 
|---|
| 428 | ); | 
|---|
| 429 |  | 
|---|
| 430 | /*****************/ | 
|---|
| 431 | /* Function 0x15 */ | 
|---|
| 432 | WERROR svcctl_GetServiceKeyNameW( | 
|---|
| 433 | [in,ref] policy_handle *handle, | 
|---|
| 434 | [in,unique] [string,charset(UTF16)] uint16 *service_name, | 
|---|
| 435 | [out,ref] [string,charset(UTF16)] uint16 **key_name, | 
|---|
| 436 | [in,out,unique] uint32 *display_name_length | 
|---|
| 437 | ); | 
|---|
| 438 |  | 
|---|
| 439 | /*****************/ | 
|---|
| 440 | /* Function 0x16 */ | 
|---|
| 441 | WERROR svcctl_SCSetServiceBitsA( | 
|---|
| 442 | [in,ref] policy_handle *handle, | 
|---|
| 443 | [in] uint32 bits, | 
|---|
| 444 | [in] boolean32 bitson, | 
|---|
| 445 | [in] boolean32 immediate | 
|---|
| 446 | ); | 
|---|
| 447 |  | 
|---|
| 448 | /*****************/ | 
|---|
| 449 | /* Function 0x17 */ | 
|---|
| 450 | WERROR svcctl_ChangeServiceConfigA( | 
|---|
| 451 | [in,ref] policy_handle *handle, | 
|---|
| 452 | [in] uint32 type, | 
|---|
| 453 | [in] svcctl_StartType start_type, | 
|---|
| 454 | [in] svcctl_ErrorControl error_control, | 
|---|
| 455 | [in,unique] [string,charset(UTF16)] uint16 *binary_path, | 
|---|
| 456 | [in,unique] [string,charset(UTF16)] uint16 *load_order_group, | 
|---|
| 457 | [out,ref] uint32 *tag_id, | 
|---|
| 458 | [in,unique] [string,charset(UTF16)] uint16 *dependencies, | 
|---|
| 459 | [in,unique] [string,charset(UTF16)] uint16 *service_start_name, | 
|---|
| 460 | [in,unique] [string,charset(UTF16)] uint16 *password, | 
|---|
| 461 | [in,unique] [string,charset(UTF16)] uint16 *display_name | 
|---|
| 462 | ); | 
|---|
| 463 |  | 
|---|
| 464 | /*****************/ | 
|---|
| 465 | /* Function 0x18 */ | 
|---|
| 466 | WERROR svcctl_CreateServiceA( | 
|---|
| 467 | [in,ref] policy_handle *handle, | 
|---|
| 468 | [in,unique] [string,charset(UTF16)] uint16 *ServiceName, | 
|---|
| 469 | [in,unique] [string,charset(UTF16)] uint16 *DisplayName, | 
|---|
| 470 | [in] uint32 desired_access, | 
|---|
| 471 | [in] uint32 type, | 
|---|
| 472 | [in] svcctl_StartType start_type, | 
|---|
| 473 | [in] svcctl_ErrorControl error_control, | 
|---|
| 474 | [in,unique] [string,charset(UTF16)] uint16 *binary_path, | 
|---|
| 475 | [in,unique] [string,charset(UTF16)] uint16 *LoadOrderGroupKey, | 
|---|
| 476 | [out,unique] uint32 *TagId, | 
|---|
| 477 | [in,unique] [string,charset(UTF16)] uint16 *dependencies, | 
|---|
| 478 | [in,unique] [string,charset(UTF16)] uint16 *service_start_name, | 
|---|
| 479 | [in,unique] [string,charset(UTF16)] uint16 *password | 
|---|
| 480 | ); | 
|---|
| 481 |  | 
|---|
| 482 | /*****************/ | 
|---|
| 483 | /* Function 0x19 */ | 
|---|
| 484 | WERROR svcctl_EnumDependentServicesA( | 
|---|
| 485 | [in,ref] policy_handle *service, | 
|---|
| 486 | [in] svcctl_ServiceState state, | 
|---|
| 487 | [out,unique] ENUM_SERVICE_STATUSA *service_status, | 
|---|
| 488 | [in] uint32 offered, | 
|---|
| 489 | [out,ref] uint32 *needed, | 
|---|
| 490 | [out,ref] uint32 *services_returned | 
|---|
| 491 | ); | 
|---|
| 492 |  | 
|---|
| 493 | /*****************/ | 
|---|
| 494 | /* Function 0x1a */ | 
|---|
| 495 | WERROR svcctl_EnumServicesStatusA( | 
|---|
| 496 | [in,ref] policy_handle *handle, | 
|---|
| 497 | [in] uint32 type, | 
|---|
| 498 | [in] svcctl_ServiceState state, | 
|---|
| 499 | [in] uint32 offered, | 
|---|
| 500 | [out,size_is(offered)] uint8 service[*], | 
|---|
| 501 | [out,ref] uint32 *needed, | 
|---|
| 502 | [out,ref] uint32 *services_returned, | 
|---|
| 503 | [in,out,unique] uint32 *resume_handle | 
|---|
| 504 | ); | 
|---|
| 505 |  | 
|---|
| 506 | /*****************/ | 
|---|
| 507 | /* Function 0x1b */ | 
|---|
| 508 | WERROR svcctl_OpenSCManagerA( | 
|---|
| 509 | [in,unique] [string,charset(UTF16)] uint16 *MachineName, | 
|---|
| 510 | [in,unique] [string,charset(UTF16)] uint16 *DatabaseName, | 
|---|
| 511 | [in] uint32 access_mask, | 
|---|
| 512 | [out,ref] policy_handle *handle | 
|---|
| 513 | ); | 
|---|
| 514 |  | 
|---|
| 515 | /*****************/ | 
|---|
| 516 | /* Function 0x1c */ | 
|---|
| 517 | WERROR svcctl_OpenServiceA( | 
|---|
| 518 | [in,ref] policy_handle *scmanager_handle, | 
|---|
| 519 | [in,unique] [string,charset(UTF16)] uint16 *ServiceName, | 
|---|
| 520 | [in] uint32 access_mask | 
|---|
| 521 | ); | 
|---|
| 522 |  | 
|---|
| 523 | /*****************/ | 
|---|
| 524 | /* Function 0x1d */ | 
|---|
| 525 | WERROR svcctl_QueryServiceConfigA( | 
|---|
| 526 | [in,ref] policy_handle *handle, | 
|---|
| 527 | [out] uint8 query[offered], /*QUERYU_SERVICE_CONFIG */ | 
|---|
| 528 | [in] uint32 offered, | 
|---|
| 529 | [out,ref] uint32 *needed | 
|---|
| 530 | ); | 
|---|
| 531 |  | 
|---|
| 532 | /*****************/ | 
|---|
| 533 | /* Function 0x1e */ | 
|---|
| 534 | WERROR svcctl_QueryServiceLockStatusA( | 
|---|
| 535 | [in,ref] policy_handle *handle, | 
|---|
| 536 | [in] uint32 offered, | 
|---|
| 537 | [out,ref] SERVICE_LOCK_STATUS *lock_status, | 
|---|
| 538 | [out,ref] uint32 *needed | 
|---|
| 539 | ); | 
|---|
| 540 |  | 
|---|
| 541 | /*****************/ | 
|---|
| 542 | /* Function 0x1f */ | 
|---|
| 543 | WERROR svcctl_StartServiceA( | 
|---|
| 544 | [in,ref] policy_handle *handle, | 
|---|
| 545 | [in] uint32 NumArgs, | 
|---|
| 546 | [in,unique/*FIXME:,length_is(NumArgs)*/] [string,charset(UTF16)] uint16 *Arguments | 
|---|
| 547 | ); | 
|---|
| 548 |  | 
|---|
| 549 | /*****************/ | 
|---|
| 550 | /* Function 0x20 */ | 
|---|
| 551 | WERROR svcctl_GetServiceDisplayNameA( | 
|---|
| 552 | [in,ref] policy_handle *handle, | 
|---|
| 553 | [in,unique] [string,charset(UTF16)] uint16 *service_name, | 
|---|
| 554 | [out,ref] [string,charset(UTF16)] uint16 **display_name, | 
|---|
| 555 | [in,out,unique] uint32 *display_name_length | 
|---|
| 556 | ); | 
|---|
| 557 |  | 
|---|
| 558 | /*****************/ | 
|---|
| 559 | /* Function 0x21 */ | 
|---|
| 560 | WERROR svcctl_GetServiceKeyNameA( | 
|---|
| 561 | [in,ref] policy_handle *handle, | 
|---|
| 562 | [in,unique] [string,charset(UTF16)] uint16 *service_name, | 
|---|
| 563 | [out,ref] [string,charset(UTF16)] uint16 **key_name, | 
|---|
| 564 | [in,out,unique] uint32 *display_name_length | 
|---|
| 565 | ); | 
|---|
| 566 |  | 
|---|
| 567 | /*****************/ | 
|---|
| 568 | /* Function 0x22 */ | 
|---|
| 569 | [todo] WERROR svcctl_GetCurrentGroupeStateW( | 
|---|
| 570 | ); | 
|---|
| 571 |  | 
|---|
| 572 | /*****************/ | 
|---|
| 573 | /* Function 0x23 */ | 
|---|
| 574 | [todo] WERROR svcctl_EnumServiceGroupW( | 
|---|
| 575 | ); | 
|---|
| 576 |  | 
|---|
| 577 | /*****************/ | 
|---|
| 578 | /* Function 0x24 */ | 
|---|
| 579 | WERROR svcctl_ChangeServiceConfig2A( | 
|---|
| 580 | [in,ref] policy_handle *handle, | 
|---|
| 581 | [in] uint32 info_level, | 
|---|
| 582 | [in,unique] uint8 *info | 
|---|
| 583 | ); | 
|---|
| 584 |  | 
|---|
| 585 | /*****************/ | 
|---|
| 586 | /* Function 0x25 */ | 
|---|
| 587 | WERROR svcctl_ChangeServiceConfig2W( | 
|---|
| 588 | [in,ref] policy_handle *handle, | 
|---|
| 589 | [in] uint32 info_level, | 
|---|
| 590 | [in,unique] uint8 *info | 
|---|
| 591 | ); | 
|---|
| 592 |  | 
|---|
| 593 | /*****************/ | 
|---|
| 594 | /* Function 0x26 */ | 
|---|
| 595 |  | 
|---|
| 596 | typedef [v1_enum] enum { | 
|---|
| 597 | SERVICE_CONFIG_DESCRIPTION      = 0x00000001, | 
|---|
| 598 | SERVICE_CONFIG_FAILURE_ACTIONS  = 0x00000002 | 
|---|
| 599 | } svcctl_ConfigLevel; | 
|---|
| 600 |  | 
|---|
| 601 | typedef [gensize,public] struct { | 
|---|
| 602 | [relative] nstring *description; | 
|---|
| 603 | } SERVICE_DESCRIPTION; | 
|---|
| 604 |  | 
|---|
| 605 | typedef [v1_enum] enum { | 
|---|
| 606 | SC_ACTION_NONE          = 0, | 
|---|
| 607 | SC_ACTION_RESTART       = 1, | 
|---|
| 608 | SC_ACTION_REBOOT        = 2, | 
|---|
| 609 | SC_ACTION_RUN_COMMAND   = 3 | 
|---|
| 610 | } SC_ACTION_TYPE; | 
|---|
| 611 |  | 
|---|
| 612 | typedef struct { | 
|---|
| 613 | SC_ACTION_TYPE type; | 
|---|
| 614 | uint32 delay; | 
|---|
| 615 | } SC_ACTION; | 
|---|
| 616 |  | 
|---|
| 617 | typedef [public,gensize] struct { | 
|---|
| 618 | uint32 reset_period; | 
|---|
| 619 | [relative] nstring *rebootmsg; | 
|---|
| 620 | [relative] nstring *command; | 
|---|
| 621 | [range(0,1024)] uint32 num_actions; | 
|---|
| 622 | [relative] [size_is(num_actions)] SC_ACTION *actions; | 
|---|
| 623 | } SERVICE_FAILURE_ACTIONS; | 
|---|
| 624 |  | 
|---|
| 625 | WERROR svcctl_QueryServiceConfig2A( | 
|---|
| 626 | [in,ref] policy_handle *handle, | 
|---|
| 627 | [in] svcctl_ConfigLevel info_level, | 
|---|
| 628 | [out] uint8 buffer[offered], | 
|---|
| 629 | [in] uint32 offered, | 
|---|
| 630 | [out,ref] uint32 *needed | 
|---|
| 631 | ); | 
|---|
| 632 |  | 
|---|
| 633 | /*****************/ | 
|---|
| 634 | /* Function 0x27 */ | 
|---|
| 635 | WERROR svcctl_QueryServiceConfig2W( | 
|---|
| 636 | [in,ref] policy_handle *handle, | 
|---|
| 637 | [in] svcctl_ConfigLevel info_level, | 
|---|
| 638 | [out,ref,size_is(offered)] uint8 *buffer, | 
|---|
| 639 | [in] [range(0,8192)] uint32 offered, | 
|---|
| 640 | [out,ref] [range(0,8192)] uint32 *needed | 
|---|
| 641 | ); | 
|---|
| 642 |  | 
|---|
| 643 | /*****************/ | 
|---|
| 644 | /* Function 0x28 */ | 
|---|
| 645 |  | 
|---|
| 646 | typedef [v1_enum] enum { | 
|---|
| 647 | SVC_STATUS_PROCESS_INFO         = 0x00000000 | 
|---|
| 648 | } svcctl_StatusLevel; | 
|---|
| 649 |  | 
|---|
| 650 | WERROR svcctl_QueryServiceStatusEx( | 
|---|
| 651 | [in,ref] policy_handle *handle, | 
|---|
| 652 | [in] svcctl_StatusLevel info_level, | 
|---|
| 653 | [out,ref,size_is(offered)] uint8 *buffer, | 
|---|
| 654 | [in] [range(0,8192)] uint32 offered, | 
|---|
| 655 | [out,ref] [range(0,8192)] uint32 *needed | 
|---|
| 656 | ); | 
|---|
| 657 |  | 
|---|
| 658 | /*****************/ | 
|---|
| 659 | /* Function 0x29 */ | 
|---|
| 660 | WERROR EnumServicesStatusExA( | 
|---|
| 661 | [in,ref] policy_handle *scmanager, | 
|---|
| 662 | [in] uint32 info_level, | 
|---|
| 663 | [in] uint32 type, | 
|---|
| 664 | [in] svcctl_ServiceState state, | 
|---|
| 665 | [out] uint8 services[offered], | 
|---|
| 666 | [in] uint32 offered, | 
|---|
| 667 | [out,ref] uint32 *needed, | 
|---|
| 668 | [out,ref] uint32 *service_returned, | 
|---|
| 669 | [in,out,unique] uint32 *resume_handle, | 
|---|
| 670 | [out,ref] [string,charset(UTF16)] uint16 **group_name | 
|---|
| 671 | ); | 
|---|
| 672 |  | 
|---|
| 673 | /*****************/ | 
|---|
| 674 | /* Function 0x2a */ | 
|---|
| 675 | WERROR EnumServicesStatusExW( | 
|---|
| 676 | [in,ref] policy_handle *scmanager, | 
|---|
| 677 | [in] uint32 info_level, | 
|---|
| 678 | [in] uint32 type, | 
|---|
| 679 | [in] svcctl_ServiceState state, | 
|---|
| 680 | [out,ref,size_is(offered)] uint8 *services, | 
|---|
| 681 | [in] [range(0,0x40000)] uint32 offered, | 
|---|
| 682 | [out,ref] [range(0,0x40000)] uint32 *needed, | 
|---|
| 683 | [out,ref] [range(0,0x40000)] uint32 *service_returned, | 
|---|
| 684 | [in,out,unique] [range(0,0x40000)] uint32 *resume_handle, | 
|---|
| 685 | [in,unique] [string,charset(UTF16)] uint16 *group_name | 
|---|
| 686 | ); | 
|---|
| 687 |  | 
|---|
| 688 | /*****************/ | 
|---|
| 689 | /* Function 0x2b */ | 
|---|
| 690 | [todo] WERROR svcctl_SCSendTSMessage( | 
|---|
| 691 | ); | 
|---|
| 692 | } | 
|---|