mpm_winnt.h revision 5a58a10705b7b154b53294e0c0283d64eabdcb7f
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb/* ====================================================================
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * The Apache Software License, Version 1.1
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * Copyright (c) 2000 The Apache Software Foundation. All rights
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * reserved.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * Redistribution and use in source and binary forms, with or without
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * modification, are permitted provided that the following conditions
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * are met:
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * 1. Redistributions of source code must retain the above copyright
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * notice, this list of conditions and the following disclaimer.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * 2. Redistributions in binary form must reproduce the above copyright
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * notice, this list of conditions and the following disclaimer in
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * the documentation and/or other materials provided with the
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * distribution.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * 3. The end-user documentation included with the redistribution,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * if any, must include the following acknowledgment:
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * "This product includes software developed by the
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * Apache Software Foundation (http://www.apache.org/)."
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * Alternately, this acknowledgment may appear in the software itself,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * if and wherever such third-party acknowledgments normally appear.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * 4. The names "Apache" and "Apache Software Foundation" must
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * not be used to endorse or promote products derived from this
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * software without prior written permission. For written
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * permission, please contact apache@apache.org.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * 5. Products derived from this software may not be called "Apache",
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * nor may "Apache" appear in their name, without prior written
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * permission of the Apache Software Foundation.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * SUCH DAMAGE.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * ====================================================================
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * This software consists of voluntary contributions made by many
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * individuals on behalf of the Apache Software Foundation. For more
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * information on the Apache Software Foundation, please see
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * <http://www.apache.org/>.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb *
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * Portions of this software are based upon public domain software
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * originally written at the National Center for Supercomputing Applications,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb * University of Illinois, Urbana-Champaign.
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb */
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#ifndef APACHE_MPM_WINNT_H
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#define APACHE_MPM_WINNT_H
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#include "ap_listen.h"
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb/* From registry.c: */
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbapr_status_t ap_registry_create_key(const char *key);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbapr_status_t ap_registry_delete_key(const char *key);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbapr_status_t ap_registry_store_value(const char *key, const char *name,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb const char *value);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbapr_status_t ap_registry_get_value(apr_pool_t *p, const char *key,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb const char *name, char **ppValue);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbapr_status_t ap_registry_store_array(apr_pool_t *p, const char *key,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb const char *name, int nelts,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb char const* const* elts);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbapr_status_t ap_registry_get_array(apr_pool_t *p, const char *key,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb const char *name,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb apr_array_header_t **parray);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbapr_status_t ap_registry_delete_value(const char *key, const char *name);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb/* From service.c: */
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#define SERVICE_APACHE_RESTART 128
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#define DEFAULT_SERVICE_NAME AP_SERVER_BASEPRODUCT
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#define SERVICECONFIG9X "Software\\Microsoft\\Windows\\CurrentVersion\\RunServices"
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#define SERVICECONFIG "System\\CurrentControlSet\\Services\\%s"
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb#define SERVICEPARAMS "System\\CurrentControlSet\\Services\\%s\\Parameters"
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbextern char const* service_name;
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbextern char const* display_name;
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbapr_status_t mpm_service_set_name(apr_pool_t *p, const char *name);
d4abb06ac220bb280ae996b6d21bbd257db51bb1jerenkrantzapr_status_t mpm_merge_service_args(apr_pool_t *p, apr_array_header_t *args,
d4abb06ac220bb280ae996b6d21bbd257db51bb1jerenkrantz int fixed_args);
d4abb06ac220bb280ae996b6d21bbd257db51bb1jerenkrantz
d4abb06ac220bb280ae996b6d21bbd257db51bb1jerenkrantzapr_status_t mpm_service_to_start(void);
d4abb06ac220bb280ae996b6d21bbd257db51bb1jerenkrantzapr_status_t mpm_service_started(void);
d4abb06ac220bb280ae996b6d21bbd257db51bb1jerenkrantzapr_status_t mpm_service_install(apr_pool_t *ptemp, int argc,
d4abb06ac220bb280ae996b6d21bbd257db51bb1jerenkrantz char const* const* argv);
d4abb06ac220bb280ae996b6d21bbd257db51bb1jerenkrantzapr_status_t mpm_service_uninstall(void);
d4abb06ac220bb280ae996b6d21bbd257db51bb1jerenkrantz
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbapr_status_t mpm_service_start(apr_pool_t *ptemp, int argc,
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb char const* const* argv);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbvoid mpm_signal_service(apr_pool_t *ptemp, int signal);
a2a0abd88b19e042a3eb2a9fa1702c25ad51303dwrowe
a2a0abd88b19e042a3eb2a9fa1702c25ad51303dwrowevoid mpm_service_stopping(void);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbvoid mpm_start_console_handler(void);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbvoid mpm_start_child_console_handler(void);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb/* From winnt.c: */
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbextern OSVERSIONINFO osver;
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbextern int ap_max_requests_per_child;
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbextern void clean_child_exit(int);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb
b38846b15c8891c6dec44dcc4f96ca40721bf663rbbAP_DECLARE(void) ap_start_shutdown(void);
c3e342e5b0b9fea6617ee16d2da02c3ef2108126dougmAP_DECLARE(void) ap_start_restart(int gracefully);
b38846b15c8891c6dec44dcc4f96ca40721bf663rbb
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowevoid setup_signal_names(char *prefix);
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowevoid signal_parent(int type);
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowetypedef struct CompContext {
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe OVERLAPPED Overlapped;
c2cf53a40a9814eb91db2cdf820f97d943f21628coar SOCKET accept_socket;
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe apr_socket_t *sock;
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe ap_listen_rec *lr;
731344ed8f3677d1661c261ca5fcdd2ee3dbc74ccoar char *recv_buf;
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe int recv_buf_size;
731344ed8f3677d1661c261ca5fcdd2ee3dbc74ccoar apr_pool_t *ptrans;
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe struct sockaddr *sa_server;
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe int sa_server_len;
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe struct sockaddr *sa_client;
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe int sa_client_len;
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe} COMP_CONTEXT, *PCOMP_CONTEXT;
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe/* This code is stolen from the apr_private.h and misc/win32/misc.c
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe * Please see those sources for detailed documentation.
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe */
3e392a5afd51526de3cb15d57ee46d8cb160ae65gregamestypedef enum {
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe DLL_WINBASEAPI = 0, // kernel32 From WinBase.h
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe DLL_WINADVAPI = 1, // advapi32 From WinBase.h
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe DLL_WINSOCKAPI = 2, // mswsock From WinSock.h
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe DLL_WINSOCK2API = 3, // ws2_32 From WinSock2.h
d4abb06ac220bb280ae996b6d21bbd257db51bb1jerenkrantz DLL_defined = 4 // must define as last idx_ + 1
d4abb06ac220bb280ae996b6d21bbd257db51bb1jerenkrantz} ap_dlltoken_e;
d4abb06ac220bb280ae996b6d21bbd257db51bb1jerenkrantz
d4abb06ac220bb280ae996b6d21bbd257db51bb1jerenkrantzFARPROC ap_load_dll_func(ap_dlltoken_e fnLib, char *fnName, int ordinal);
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe#define AP_DECLARE_LATE_DLL_FUNC(lib, rettype, calltype, fn, ord, args, names) \
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe typedef rettype (calltype *ap_winapi_fpt_##fn) args; \
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe static ap_winapi_fpt_##fn ap_winapi_pfn_##fn = NULL; \
3e392a5afd51526de3cb15d57ee46d8cb160ae65gregames __inline rettype ap_winapi_##fn args \
3e392a5afd51526de3cb15d57ee46d8cb160ae65gregames { if (!ap_winapi_pfn_##fn) \
3e392a5afd51526de3cb15d57ee46d8cb160ae65gregames ap_winapi_pfn_##fn = (ap_winapi_fpt_##fn) ap_load_dll_func(lib, #fn, ord); \
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe return (*(ap_winapi_pfn_##fn)) names; }; \
731344ed8f3677d1661c261ca5fcdd2ee3dbc74ccoar
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe/* WinNT kernel only */
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wroweAP_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI, BOOL, WINAPI, CancelIo, 0, (
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe IN HANDLE hFile),
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe (hFile));
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe#define CancelIo ap_winapi_CancelIo
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe/* Win9x kernel only */
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewroweAP_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI, DWORD, WINAPI, RegisterServiceProcess, 0, (
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe DWORD dwProcessId,
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe DWORD dwType),
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe (dwProcessId, dwType));
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe#define RegisterServiceProcess ap_winapi_RegisterServiceProcess
fa06de8a28a737e8fbaad76d7f3ff67aaa5e4a09wrowe
c2cf53a40a9814eb91db2cdf820f97d943f21628coar#endif /* APACHE_MPM_WINNT_H */
83a8dc5a596a8a1b9d14f063268287d123b9ed7ewrowe