Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) the Wine project |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Lesser General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2.1 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Lesser General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Lesser General Public |
| 15 | * License along with this library; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | */ |
| 18 | |
Patrik Stridvall | 4a73973 | 1999-07-04 11:01:21 +0000 | [diff] [blame] | 19 | #ifndef __WINE_WINSVC_H |
| 20 | #define __WINE_WINSVC_H |
| 21 | |
| 22 | #ifdef __cplusplus |
| 23 | extern "C" { |
| 24 | #endif /* defined(__cplusplus) */ |
| 25 | |
| 26 | #include "windef.h" |
| 27 | |
Peter Hunnisett | 565b008 | 2000-09-19 02:43:00 +0000 | [diff] [blame] | 28 | /* Controls */ |
| 29 | #define SERVICE_CONTROL_STOP 0x00000001 |
| 30 | #define SERVICE_CONTROL_PAUSE 0x00000002 |
| 31 | #define SERVICE_CONTROL_CONTINUE 0x00000003 |
| 32 | #define SERVICE_CONTROL_INTERROGATE 0x00000004 |
| 33 | #define SERVICE_CONTROL_SHUTDOWN 0x00000005 |
| 34 | #define SERVICE_CONTROL_PARAMCHANGE 0x00000006 |
| 35 | #define SERVICE_CONTROL_NETBINDADD 0x00000007 |
| 36 | #define SERVICE_CONTROL_NETBINDREMOVE 0x00000008 |
| 37 | #define SERVICE_CONTROL_NETBINDENABLE 0x00000009 |
| 38 | #define SERVICE_CONTROL_NETBINDDISABLE 0x0000000A |
| 39 | #define SERVICE_CONTROL_DEVICEEVENT 0x0000000B |
| 40 | #define SERVICE_CONTROL_HARDWAREPROFILECHANGE 0x0000000C |
| 41 | #define SERVICE_CONTROL_POWEREVENT 0x0000000D |
| 42 | |
| 43 | /* Service State */ |
| 44 | #define SERVICE_STOPPED 0x00000001 |
| 45 | #define SERVICE_START_PENDING 0x00000002 |
| 46 | #define SERVICE_STOP_PENDING 0x00000003 |
| 47 | #define SERVICE_RUNNING 0x00000004 |
| 48 | #define SERVICE_CONTINUE_PENDING 0x00000005 |
| 49 | #define SERVICE_PAUSE_PENDING 0x00000006 |
| 50 | #define SERVICE_PAUSED 0x00000007 |
| 51 | |
| 52 | /* Controls Accepted */ |
| 53 | #define SERVICE_ACCEPT_STOP 0x00000001 |
| 54 | #define SERVICE_ACCEPT_PAUSE_CONTINUE 0x00000002 |
| 55 | #define SERVICE_ACCEPT_SHUTDOWN 0x00000004 |
| 56 | #define SERVICE_ACCEPT_PARAMCHANGE 0x00000008 |
| 57 | #define SERVICE_ACCEPT_NETBINDCHANGE 0x00000010 |
| 58 | #define SERVICE_ACCEPT_HARDWAREPROFILECHANGE 0x00000020 |
| 59 | #define SERVICE_ACCEPT_POWEREVENT 0x00000040 |
| 60 | |
| 61 | /* Service Control Manager Object access types */ |
| 62 | #define SC_MANAGER_CONNECT 0x0001 |
| 63 | #define SC_MANAGER_CREATE_SERVICE 0x0002 |
| 64 | #define SC_MANAGER_ENUMERATE_SERVICE 0x0004 |
| 65 | #define SC_MANAGER_LOCK 0x0008 |
| 66 | #define SC_MANAGER_QUERY_LOCK_STATUS 0x0010 |
| 67 | #define SC_MANAGER_MODIFY_BOOT_CONFIG 0x0020 |
| 68 | #define SC_MANAGER_ALL_ACCESS ( STANDARD_RIGHTS_REQUIRED | \ |
| 69 | SC_MANAGER_CONNECT | \ |
| 70 | SC_MANAGER_CREATE_SERVICE | \ |
| 71 | SC_MANAGER_ENUMERATE_SERVICE | \ |
| 72 | SC_MANAGER_LOCK | \ |
| 73 | SC_MANAGER_QUERY_LOCK_STATUS | \ |
| 74 | SC_MANAGER_MODIFY_BOOT_CONFIG ) |
| 75 | |
| 76 | #define SERVICE_QUERY_CONFIG 0x0001 |
| 77 | #define SERVICE_CHANGE_CONFIG 0x0002 |
| 78 | #define SERVICE_QUERY_STATUS 0x0004 |
| 79 | #define SERVICE_ENUMERATE_DEPENDENTS 0x0008 |
| 80 | #define SERVICE_START 0x0010 |
| 81 | #define SERVICE_STOP 0x0020 |
| 82 | #define SERVICE_PAUSE_CONTINUE 0x0040 |
| 83 | #define SERVICE_INTERROGATE 0x0080 |
| 84 | #define SERVICE_USER_DEFINED_CONTROL 0x0100 |
| 85 | |
| 86 | #define SERVICE_ALL_ACCESS ( STANDARD_RIGHTS_REQUIRED | \ |
| 87 | SERVICE_QUERY_CONFIG | \ |
| 88 | SERVICE_CHANGE_CONFIG | \ |
| 89 | SERVICE_QUERY_STATUS | \ |
| 90 | SERVICE_ENUMERATE_DEPENDENTS | \ |
| 91 | SERVICE_START | \ |
| 92 | SERVICE_STOP | \ |
| 93 | SERVICE_PAUSE_CONTINUE | \ |
| 94 | SERVICE_INTERROGATE | \ |
| 95 | SERVICE_USER_DEFINED_CONTROL ) |
| 96 | |
| 97 | |
| 98 | |
Patrik Stridvall | 4a73973 | 1999-07-04 11:01:21 +0000 | [diff] [blame] | 99 | /* Handle types */ |
| 100 | |
François Gouget | 29625ff | 2001-01-02 20:17:15 +0000 | [diff] [blame] | 101 | typedef HANDLE SC_HANDLE, *LPSC_HANDLE; |
| 102 | typedef DWORD SERVICE_STATUS_HANDLE; |
Peter Hunnisett | 565b008 | 2000-09-19 02:43:00 +0000 | [diff] [blame] | 103 | |
Patrik Stridvall | 4a73973 | 1999-07-04 11:01:21 +0000 | [diff] [blame] | 104 | |
| 105 | /* Service status structure */ |
| 106 | |
| 107 | typedef struct _SERVICE_STATUS { |
| 108 | DWORD dwServiceType; |
| 109 | DWORD dwCurrentState; |
| 110 | DWORD dwControlsAccepted; |
| 111 | DWORD dwWin32ExitCode; |
| 112 | DWORD dwServiceSpecificExitCode; |
| 113 | DWORD dwCheckPoint; |
| 114 | DWORD dwWaitHint; |
| 115 | } SERVICE_STATUS, *LPSERVICE_STATUS; |
| 116 | |
| 117 | /* Service main function prototype */ |
| 118 | |
Patrik Stridvall | f94462f | 2002-01-31 23:22:07 +0000 | [diff] [blame] | 119 | typedef VOID (CALLBACK *LPSERVICE_MAIN_FUNCTIONA)(DWORD,LPSTR*); |
| 120 | typedef VOID (CALLBACK *LPSERVICE_MAIN_FUNCTIONW)(DWORD,LPWSTR*); |
Patrik Stridvall | 4a73973 | 1999-07-04 11:01:21 +0000 | [diff] [blame] | 121 | DECL_WINELIB_TYPE_AW(LPSERVICE_MAIN_FUNCTION) |
| 122 | |
| 123 | /* Service start table */ |
| 124 | |
| 125 | typedef struct _SERVICE_TABLE_ENTRYA { |
| 126 | LPSTR lpServiceName; |
| 127 | LPSERVICE_MAIN_FUNCTIONA lpServiceProc; |
| 128 | } SERVICE_TABLE_ENTRYA, *LPSERVICE_TABLE_ENTRYA; |
| 129 | |
| 130 | typedef struct _SERVICE_TABLE_ENTRYW { |
| 131 | LPWSTR lpServiceName; |
| 132 | LPSERVICE_MAIN_FUNCTIONW lpServiceProc; |
| 133 | } SERVICE_TABLE_ENTRYW, *LPSERVICE_TABLE_ENTRYW; |
| 134 | |
| 135 | DECL_WINELIB_TYPE_AW(SERVICE_TABLE_ENTRY) |
| 136 | DECL_WINELIB_TYPE_AW(LPSERVICE_TABLE_ENTRY) |
| 137 | |
| 138 | /* Service status enumeration structure */ |
| 139 | |
| 140 | typedef struct _ENUM_SERVICE_STATUSA { |
| 141 | LPSTR lpServiceName; |
| 142 | LPSTR lpDisplayName; |
| 143 | SERVICE_STATUS ServiceStatus; |
| 144 | } ENUM_SERVICE_STATUSA, *LPENUM_SERVICE_STATUSA; |
| 145 | |
| 146 | typedef struct _ENUM_SERVICE_STATUSW { |
| 147 | LPWSTR lpServiceName; |
| 148 | LPWSTR lpDisplayName; |
| 149 | SERVICE_STATUS ServiceStatus; |
| 150 | } ENUM_SERVICE_STATUSW, *LPENUM_SERVICE_STATUSW; |
| 151 | |
| 152 | DECL_WINELIB_TYPE_AW(ENUM_SERVICE_STATUS) |
| 153 | DECL_WINELIB_TYPE_AW(LPENUM_SERVICE_STATUS) |
| 154 | |
| 155 | /* Service control handler function prototype */ |
| 156 | |
Patrik Stridvall | f94462f | 2002-01-31 23:22:07 +0000 | [diff] [blame] | 157 | typedef VOID (WINAPI *LPHANDLER_FUNCTION)(DWORD); |
Patrik Stridvall | 4a73973 | 1999-07-04 11:01:21 +0000 | [diff] [blame] | 158 | |
| 159 | /* API function prototypes */ |
| 160 | |
| 161 | BOOL WINAPI CloseServiceHandle(SC_HANDLE); |
| 162 | BOOL WINAPI ControlService(SC_HANDLE,DWORD,LPSERVICE_STATUS); |
Peter Hunnisett | 565b008 | 2000-09-19 02:43:00 +0000 | [diff] [blame] | 163 | SC_HANDLE WINAPI CreateServiceA(SC_HANDLE,LPCSTR,LPCSTR,DWORD,DWORD,DWORD,DWORD,LPCSTR, |
Patrik Stridvall | 4a73973 | 1999-07-04 11:01:21 +0000 | [diff] [blame] | 164 | LPCSTR,LPDWORD,LPCSTR,LPCSTR,LPCSTR); |
Peter Hunnisett | 565b008 | 2000-09-19 02:43:00 +0000 | [diff] [blame] | 165 | SC_HANDLE WINAPI CreateServiceW(SC_HANDLE,LPCWSTR,LPCWSTR,DWORD,DWORD,DWORD,DWORD,LPCWSTR, |
Patrik Stridvall | 4a73973 | 1999-07-04 11:01:21 +0000 | [diff] [blame] | 166 | LPCWSTR,LPDWORD,LPCWSTR,LPCWSTR,LPCWSTR); |
| 167 | #define CreateService WINELIB_NAME_AW(CreateService) |
| 168 | BOOL WINAPI DeleteService(SC_HANDLE); |
| 169 | BOOL WINAPI EnumServicesStatusA(SC_HANDLE,DWORD,DWORD,LPENUM_SERVICE_STATUSA, |
| 170 | DWORD,LPDWORD,LPDWORD,LPDWORD); |
| 171 | BOOL WINAPI EnumServicesStatusW(SC_HANDLE,DWORD,DWORD,LPENUM_SERVICE_STATUSW, |
| 172 | DWORD,LPDWORD,LPDWORD,LPDWORD); |
| 173 | #define EnumServicesStatus WINELIB_NAME_AW(EnumServicesStatus) |
| 174 | SC_HANDLE WINAPI OpenSCManagerA(LPCSTR,LPCSTR,DWORD); |
| 175 | SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR,LPCWSTR,DWORD); |
| 176 | #define OpenSCManager WINELIB_NAME_AW(OpenSCManager) |
| 177 | SC_HANDLE WINAPI OpenServiceA(SC_HANDLE,LPCSTR,DWORD); |
| 178 | SC_HANDLE WINAPI OpenServiceW(SC_HANDLE,LPCWSTR,DWORD); |
| 179 | #define OpenService WINELIB_NAME_AW(OpenService) |
| 180 | SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerA(LPCSTR,LPHANDLER_FUNCTION); |
| 181 | SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerW(LPCWSTR,LPHANDLER_FUNCTION); |
| 182 | #define RegisterServiceCtrlHandler WINELIB_NAME_AW(RegisterServiceCtrlHandler) |
| 183 | BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE,LPSERVICE_STATUS); |
| 184 | BOOL WINAPI StartServiceA(SC_HANDLE,DWORD,LPCSTR*); |
| 185 | BOOL WINAPI StartServiceW(SC_HANDLE,DWORD,LPCWSTR*); |
| 186 | #define StartService WINELIB_NAME_AW(StartService) |
| 187 | BOOL WINAPI StartServiceCtrlDispatcherA(LPSERVICE_TABLE_ENTRYA); |
| 188 | BOOL WINAPI StartServiceCtrlDispatcherW(LPSERVICE_TABLE_ENTRYW); |
| 189 | #define StartServiceCtrlDispatcher WINELIB_NAME_AW(StartServiceCtrlDispatcher) |
| 190 | BOOL WINAPI QueryServiceStatus(SC_HANDLE,LPSERVICE_STATUS); |
| 191 | |
| 192 | #ifdef __cplusplus |
| 193 | } /* extern "C" */ |
| 194 | #endif /* defined(__cplusplus) */ |
| 195 | |
| 196 | #endif /* !defined(__WINE_WINSVC_H) */ |