Add tests for invalid Keep-Alive headers that should be removed
[privoxy.git] / w32svrapi.h
1 #ifndef W32_SVRAPI_H_INCLUDED
2 #define W32_SVRAPI_H_INCLUDED
3 #define W32_SVRAPI_H_VERSION "$Id: w32svrapi.h,v 1.3 2011/09/04 11:10:56 fabiankeil Exp $"
4 /*********************************************************************
5  *
6  * File        :  $Source: /cvsroot/ijbswa/current/w32svrapi.h,v $
7  *
8  * Purpose     :  Win32 Services API for Privoxy.
9  *                Provides the implementation of an Win32 service to
10  *                allow the code to directly register and run as a
11  *                native Windows service application.
12  *
13  *                Since Win9x/ME platforms don't provide or support
14  *                running programs as services, this code uses runtime
15  *                loading and calling of the Win32 Service API, to
16  *                prevent the possibility of getting "entry point not
17  *                found" type errors on unsupported platforms. This adds
18  *                a little more complexity to the code, but it is worth
19  *                doing to provide that isolation.
20  *
21  * Copyright   :  Written by and Copyright (C) 2003 members of
22  *                the Privoxy team.  http://www.privoxy.org/
23  *
24  *                Written by and Copyright (C) 2003 Ian Cummings
25  *                <ian_a_c@hotmail.com>
26  *
27  *                Special thanks to Mates Dolák <matesek@post.cz> for
28  *                some very helpful feedback and suggestions during the
29  *                development of this code.
30  *
31  *
32  *                This program is free software; you can redistribute it
33  *                and/or modify it under the terms of the GNU General
34  *                Public License as published by the Free Software
35  *                Foundation; either version 2 of the License, or (at
36  *                your option) any later version.
37  *
38  *                This program is distributed in the hope that it will
39  *                be useful, but WITHOUT ANY WARRANTY; without even the
40  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
41  *                PARTICULAR PURPOSE.  See the GNU General Public
42  *                License for more details.
43  *
44  *                The GNU General Public License should be included with
45  *                this file.  If not, you can view it at
46  *                http://www.gnu.org/copyleft/gpl.html
47  *                or write to the Free Software Foundation, Inc., 59
48  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
49  *
50  *********************************************************************/
51
52
53 #ifdef _WIN32
54
55
56 extern char szThisServiceName[];
57 extern BOOL bRunAsService;
58 extern SERVICE_TABLE_ENTRY w32ServiceDispatchTable[];
59
60 extern BOOL install_service(const char *service_name);
61 extern BOOL uninstall_service(const char *service_name);
62 extern void w32_service_exit_notify(void);
63 extern void w32_set_service_cwd(void);
64 extern void w32_service_listen_loop(void *p);
65
66
67 extern BOOL CanSystemSupportServices();
68
69
70 extern SC_HANDLE w32_open_sc_manager(
71   LPCTSTR lpMachineName,   /* computer name */
72   LPCTSTR lpDatabaseName,  /* SCM database name */
73   DWORD dwDesiredAccess);  /* access type */
74
75
76 extern BOOL w32_close_service_handle(
77   SC_HANDLE hSCObject);    /* handle to service or SCM object */
78
79
80 extern SC_HANDLE w32_open_service(
81   SC_HANDLE hSCManager,    /* handle to SCM database */
82   LPCTSTR lpServiceName,   /* service name */
83   DWORD dwDesiredAccess);  /* access */
84
85
86 extern SC_HANDLE w32_create_service(
87   SC_HANDLE hSCManager,       /* handle to SCM database */
88   LPCTSTR lpServiceName,      /* name of service to start */
89   LPCTSTR lpDisplayName,      /* display name */
90   DWORD dwDesiredAccess,      /* type of access to service */
91   DWORD dwServiceType,        /* type of service */
92   DWORD dwStartType,          /* when to start service */
93   DWORD dwErrorControl,       /* severity of service failure */
94   LPCTSTR lpBinaryPathName,   /* name of binary file */
95   LPCTSTR lpLoadOrderGroup,   /* name of load ordering group */
96   LPDWORD lpdwTagId,          /* tag identifier */
97   LPCTSTR lpDependencies,     /* array of dependency names */
98   LPCTSTR lpServiceStartName, /* account name */
99   LPCTSTR lpPassword);        /* account password */
100
101
102 extern BOOL w32_delete_service(
103   SC_HANDLE hService);   /* handle to service */
104
105
106 extern BOOL w32_query_service_config(
107   SC_HANDLE hService,                     /* handle to service */
108   LPQUERY_SERVICE_CONFIG lpServiceConfig, /* buffer */
109   DWORD cbBufSize,                        /* size of buffer */
110   LPDWORD pcbBytesNeeded);                /* bytes needed */
111
112
113 extern BOOL w32_start_service_ctrl_dispatcher(
114   CONST LPSERVICE_TABLE_ENTRY lpServiceTable);   /* service table */
115
116
117 extern SERVICE_STATUS_HANDLE w32_register_service_ctrl_handler(
118   LPCTSTR lpServiceName,               /* service name */
119   LPHANDLER_FUNCTION lpHandlerProc);   /* handler function */
120
121
122 extern BOOL w32_set_service_status(
123   SERVICE_STATUS_HANDLE hServiceStatus,   /* service status handle */
124   LPSERVICE_STATUS lpServiceStatus);      /* status buffer */
125
126
127 #endif  /* def _WIN32 */
128
129
130 #endif /* ndef W32_SVRAPI_H_INCLUDED */
131