1da6c28aaSamw /* 2da6c28aaSamw * CDDL HEADER START 3da6c28aaSamw * 4da6c28aaSamw * The contents of this file are subject to the terms of the 5da6c28aaSamw * Common Development and Distribution License (the "License"). 6da6c28aaSamw * You may not use this file except in compliance with the License. 7da6c28aaSamw * 8da6c28aaSamw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9da6c28aaSamw * or http://www.opensolaris.org/os/licensing. 10da6c28aaSamw * See the License for the specific language governing permissions 11da6c28aaSamw * and limitations under the License. 12da6c28aaSamw * 13da6c28aaSamw * When distributing Covered Code, include this CDDL HEADER in each 14da6c28aaSamw * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15da6c28aaSamw * If applicable, add the following below this CDDL HEADER, with the 16da6c28aaSamw * fields enclosed by brackets "[]" replaced with your own identifying 17da6c28aaSamw * information: Portions Copyright [yyyy] [name of copyright owner] 18da6c28aaSamw * 19da6c28aaSamw * CDDL HEADER END 20da6c28aaSamw */ 21da6c28aaSamw /* 22037cac00Sjoyce mcintosh * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23da6c28aaSamw * Use is subject to license terms. 24da6c28aaSamw */ 25da6c28aaSamw 26da6c28aaSamw #ifndef _SMBSRV_WINSVC_H 27da6c28aaSamw #define _SMBSRV_WINSVC_H 28da6c28aaSamw 29da6c28aaSamw /* 30da6c28aaSamw * NT Service Control interface definition for the Service Control 31da6c28aaSamw * Manager (SCM). 32da6c28aaSamw */ 33da6c28aaSamw 34da6c28aaSamw #ifdef __cplusplus 35da6c28aaSamw extern "C" { 36da6c28aaSamw #endif 37da6c28aaSamw 38da6c28aaSamw /* 39da6c28aaSamw * Service types (Bit Mask). 40da6c28aaSamw * 41da6c28aaSamw * SERVICE_WIN32_OWN_PROCESS The service runs in its own process. 42da6c28aaSamw * SERVICE_WIN32_SHARE_PROCESS The service shares a process with other 43da6c28aaSamw * services. 44da6c28aaSamw */ 45da6c28aaSamw #define SERVICE_KERNEL_DRIVER 0x00000001 46da6c28aaSamw #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002 47da6c28aaSamw #define SERVICE_ADAPTER 0x00000004 48da6c28aaSamw #define SERVICE_RECOGNIZER_DRIVER 0x00000008 49da6c28aaSamw #define SERVICE_WIN32_OWN_PROCESS 0x00000010 50da6c28aaSamw #define SERVICE_WIN32_SHARE_PROCESS 0x00000020 51da6c28aaSamw #define SERVICE_INTERACTIVE_PROCESS 0x00000100 52da6c28aaSamw 53da6c28aaSamw #define SERVICE_DRIVER (SERVICE_KERNEL_DRIVER \ 54da6c28aaSamw | SERVICE_FILE_SYSTEM_DRIVER \ 55da6c28aaSamw | SERVICE_RECOGNIZER_DRIVER) 56da6c28aaSamw 57da6c28aaSamw #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS \ 58da6c28aaSamw | SERVICE_WIN32_SHARE_PROCESS) 59da6c28aaSamw 60da6c28aaSamw #define SERVICE_TYPE_ALL (SERVICE_WIN32 \ 61da6c28aaSamw | SERVICE_ADAPTER \ 62da6c28aaSamw | SERVICE_DRIVER \ 63da6c28aaSamw | SERVICE_INTERACTIVE_PROCESS) 64da6c28aaSamw 65da6c28aaSamw /* 66da6c28aaSamw * Start type. 67da6c28aaSamw */ 68da6c28aaSamw #define SERVICE_BOOT_START 0x00000000 69da6c28aaSamw #define SERVICE_SYSTEM_START 0x00000001 70da6c28aaSamw #define SERVICE_AUTO_START 0x00000002 71da6c28aaSamw #define SERVICE_DEMAND_START 0x00000003 72da6c28aaSamw #define SERVICE_DISABLED 0x00000004 73da6c28aaSamw 74da6c28aaSamw /* 75da6c28aaSamw * Error control type. 76da6c28aaSamw */ 77da6c28aaSamw #define SERVICE_ERROR_IGNORE 0x00000000 78da6c28aaSamw #define SERVICE_ERROR_NORMAL 0x00000001 79da6c28aaSamw #define SERVICE_ERROR_SEVERE 0x00000002 80da6c28aaSamw #define SERVICE_ERROR_CRITICAL 0x00000003 81da6c28aaSamw 82da6c28aaSamw /* 83da6c28aaSamw * Value to indicate no change to an optional parameter. 84da6c28aaSamw */ 85da6c28aaSamw #define SERVICE_NO_CHANGE 0xffffffff 86da6c28aaSamw 87da6c28aaSamw /* 88da6c28aaSamw * Service State - for Enum Requests (Bit Mask). 89da6c28aaSamw */ 90da6c28aaSamw #define SERVICE_ACTIVE 0x00000001 91da6c28aaSamw #define SERVICE_INACTIVE 0x00000002 92da6c28aaSamw #define SERVICE_STATE_ALL (SERVICE_ACTIVE | SERVICE_INACTIVE) 93da6c28aaSamw 94da6c28aaSamw /* 95da6c28aaSamw * Controls 96da6c28aaSamw */ 97da6c28aaSamw #define SERVICE_CONTROL_STOP 0x00000001 98da6c28aaSamw #define SERVICE_CONTROL_PAUSE 0x00000002 99da6c28aaSamw #define SERVICE_CONTROL_CONTINUE 0x00000003 100da6c28aaSamw #define SERVICE_CONTROL_INTERROGATE 0x00000004 101da6c28aaSamw #define SERVICE_CONTROL_SHUTDOWN 0x00000005 102da6c28aaSamw #define SERVICE_CONTROL_PARAMCHANGE 0x00000006 103da6c28aaSamw #define SERVICE_CONTROL_NETBINDADD 0x00000007 104da6c28aaSamw #define SERVICE_CONTROL_NETBINDREMOVE 0x00000008 105da6c28aaSamw #define SERVICE_CONTROL_NETBINDENABLE 0x00000009 106da6c28aaSamw #define SERVICE_CONTROL_NETBINDDISABLE 0x0000000A 107da6c28aaSamw 108da6c28aaSamw /* 109da6c28aaSamw * Service State -- for CurrentState 110da6c28aaSamw */ 111da6c28aaSamw #define SERVICE_STOPPED 0x00000001 112da6c28aaSamw #define SERVICE_START_PENDING 0x00000002 113da6c28aaSamw #define SERVICE_STOP_PENDING 0x00000003 114da6c28aaSamw #define SERVICE_RUNNING 0x00000004 115da6c28aaSamw #define SERVICE_CONTINUE_PENDING 0x00000005 116da6c28aaSamw #define SERVICE_PAUSE_PENDING 0x00000006 117da6c28aaSamw #define SERVICE_PAUSED 0x00000007 118da6c28aaSamw 119da6c28aaSamw /* 120da6c28aaSamw * Controls Accepted (Bit Mask) 121da6c28aaSamw * 122da6c28aaSamw * SERVICE_ACCEPT_NETBINDCHANGE 123da6c28aaSamw * Windows 2000/XP: The service is a network component that 124da6c28aaSamw * can accept changes in its binding without being stopped and restarted. 125da6c28aaSamw * This control code allows the service to receive SERVICE_CONTROL_NETBINDADD, 126da6c28aaSamw * SERVICE_CONTROL_NETBINDREMOVE, SERVICE_CONTROL_NETBINDENABLE, and 127da6c28aaSamw * SERVICE_CONTROL_NETBINDDISABLE notifications. 128da6c28aaSamw * 129da6c28aaSamw * SERVICE_ACCEPT_PARAMCHANGE 130da6c28aaSamw * Windows 2000/XP: The service can reread its startup parameters without 131da6c28aaSamw * being stopped and restarted. This control code allows the service to 132da6c28aaSamw * receive SERVICE_CONTROL_PARAMCHANGE notifications. 133da6c28aaSamw * 134da6c28aaSamw * SERVICE_ACCEPT_PAUSE_CONTINUE 135da6c28aaSamw * The service can be paused and continued. This control code allows the 136da6c28aaSamw * service to receive SERVICE_CONTROL_PAUSE and SERVICE_CONTROL_CONTINUE 137da6c28aaSamw * notifications. 138da6c28aaSamw * 139da6c28aaSamw * SERVICE_ACCEPT_SHUTDOWN 140da6c28aaSamw * The service is notified when system shutdown occurs. This control code 141da6c28aaSamw * allows the service to receive SERVICE_CONTROL_SHUTDOWN notifications. 142da6c28aaSamw * Note that ControlService cannot send this notification; only the system 143da6c28aaSamw * can send it. 144da6c28aaSamw * 145da6c28aaSamw * SERVICE_ACCEPT_STOP 146da6c28aaSamw * The service can be stopped. This control code allows the service to 147da6c28aaSamw * receive SERVICE_CONTROL_STOP notifications. 148da6c28aaSamw */ 149da6c28aaSamw #define SERVICE_ACCEPT_STOP 0x00000001 150da6c28aaSamw #define SERVICE_ACCEPT_PAUSE_CONTINUE 0x00000002 151da6c28aaSamw #define SERVICE_ACCEPT_SHUTDOWN 0x00000004 152da6c28aaSamw #define SERVICE_ACCEPT_PARAMCHANGE 0x00000008 153da6c28aaSamw #define SERVICE_ACCEPT_NETBINDCHANGE 0x00000010 154da6c28aaSamw 155da6c28aaSamw /* 156da6c28aaSamw * Service Control Manager object specific access types. 157da6c28aaSamw */ 158da6c28aaSamw #define SC_MANAGER_CONNECT 0x0001 159da6c28aaSamw #define SC_MANAGER_CREATE_SERVICE 0x0002 160da6c28aaSamw #define SC_MANAGER_ENUMERATE_SERVICE 0x0004 161da6c28aaSamw #define SC_MANAGER_LOCK 0x0008 162da6c28aaSamw #define SC_MANAGER_QUERY_LOCK_STATUS 0x0010 163da6c28aaSamw #define SC_MANAGER_MODIFY_BOOT_CONFIG 0x0020 164da6c28aaSamw 165da6c28aaSamw #define SC_MANAGER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED \ 166da6c28aaSamw | SC_MANAGER_CONNECT \ 167da6c28aaSamw | SC_MANAGER_CREATE_SERVICE \ 168da6c28aaSamw | SC_MANAGER_ENUMERATE_SERVICE \ 169da6c28aaSamw | SC_MANAGER_LOCK \ 170da6c28aaSamw | SC_MANAGER_QUERY_LOCK_STATUS \ 171da6c28aaSamw | SC_MANAGER_MODIFY_BOOT_CONFIG) 172da6c28aaSamw 173da6c28aaSamw /* 174da6c28aaSamw * Service object specific access type. 175da6c28aaSamw */ 176da6c28aaSamw #define SERVICE_QUERY_CONFIG 0x0001 177da6c28aaSamw #define SERVICE_CHANGE_CONFIG 0x0002 178da6c28aaSamw #define SERVICE_QUERY_STATUS 0x0004 179da6c28aaSamw #define SERVICE_ENUMERATE_DEPENDENTS 0x0008 180da6c28aaSamw #define SERVICE_START 0x0010 181da6c28aaSamw #define SERVICE_STOP 0x0020 182da6c28aaSamw #define SERVICE_PAUSE_CONTINUE 0x0040 183da6c28aaSamw #define SERVICE_INTERROGATE 0x0080 184da6c28aaSamw #define SERVICE_USER_DEFINED_CONTROL 0x0100 185da6c28aaSamw 186da6c28aaSamw #define SERVICE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED \ 187da6c28aaSamw | SERVICE_QUERY_CONFIG \ 188da6c28aaSamw | SERVICE_CHANGE_CONFIG \ 189da6c28aaSamw | SERVICE_QUERY_STATUS \ 190da6c28aaSamw | SERVICE_ENUMERATE_DEPENDENTS \ 191da6c28aaSamw | SERVICE_START \ 192da6c28aaSamw | SERVICE_STOP \ 193da6c28aaSamw | SERVICE_PAUSE_CONTINUE \ 194da6c28aaSamw | SERVICE_INTERROGATE \ 195da6c28aaSamw | SERVICE_USER_DEFINED_CONTROL) 196da6c28aaSamw 197da6c28aaSamw /* 198da6c28aaSamw * Info levels for ChangeServiceConfig2 and QueryServiceConfig2. 199da6c28aaSamw */ 200da6c28aaSamw #define SERVICE_CONFIG_DESCRIPTION 1 201da6c28aaSamw #define SERVICE_CONFIG_FAILURE_ACTIONS 2 202*e3f2c991SKeyur Desai #define SERVICE_CONFIG_DELAYED_AUTO_START_INFO 3 203*e3f2c991SKeyur Desai #define SERVICE_CONFIG_FAILURE_ACTIONS_FLAG 4 204*e3f2c991SKeyur Desai #define SERVICE_CONFIG_SERVICE_SID_INFO 5 205*e3f2c991SKeyur Desai #define SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO 6 206*e3f2c991SKeyur Desai #define SERVICE_CONFIG_PRESHUTDOWN_INFO 7 207*e3f2c991SKeyur Desai #define SERVICE_CONFIG_TRIGGER_INFO 8 208*e3f2c991SKeyur Desai #define SERVICE_CONFIG_PREFERRED_NODE 9 209da6c28aaSamw 210da6c28aaSamw /* 211da6c28aaSamw * Actions to take on service failure (SC_ACTION_TYPE). 212da6c28aaSamw */ 213da6c28aaSamw #define SC_ACTION_NONE 0 214da6c28aaSamw #define SC_ACTION_RESTART 1 215da6c28aaSamw #define SC_ACTION_REBOOT 2 216da6c28aaSamw #define SC_ACTION_RUN_COMMAND 3 217da6c28aaSamw 218037cac00Sjoyce mcintosh /* 219037cac00Sjoyce mcintosh * Information level for QueryServiceStatusEx 220037cac00Sjoyce mcintosh */ 221037cac00Sjoyce mcintosh #define SC_STATUS_PROCESS_INFO 0 222037cac00Sjoyce mcintosh 223da6c28aaSamw #ifdef __cplusplus 224da6c28aaSamw } 225da6c28aaSamw #endif 226da6c28aaSamw 227da6c28aaSamw #endif /* _SMBSRV_WINSVC_H */ 228