1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
/* Copyright 1999-2005 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef WIN32
#ifndef AP_OS_H
#define AP_OS_H
/* Delegate windows include to the apr.h header, if USER or GDI declarations
* are required (for a window rather than console application), include
* windows.h prior to any other Apache header files.
*/
#include "apr_pools.h"
#include <io.h>
#include <fcntl.h>
#define PLATFORM "Win32"
/* going away shortly... */
#define HAVE_DRIVE_LETTERS
#define HAVE_UNC_PATHS
#define CASE_BLIND_FILESYSTEM
#define APACHE_MPM_DIR "server/mpm/winnt" /* generated on unix */
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/* BIG RED WARNING: exit() is mapped to allow us to capture the exit
* status. This header must only be included from modules linked into
* the ApacheCore.dll - since it's a horrible behavior to exit() from
* any module outside the main() block, and we -will- assume it's a
* fatal error.
*/
AP_DECLARE_DATA extern int ap_real_exit_code;
#define exit(status) ((exit)((ap_real_exit_code==2) ? (ap_real_exit_code = (status)) \
: ((ap_real_exit_code = 0), (status))))
#ifdef AP_DECLARE_EXPORT
/* Defined in util_win32.c and available only to the core module for
* win32 MPM design.
*/
AP_DECLARE(apr_status_t) ap_os_proc_filepath(char **binpath, apr_pool_t *p);
typedef enum {
AP_DLL_WINBASEAPI = 0, // kernel32 From WinBase.h
AP_DLL_WINADVAPI = 1, // advapi32 From WinBase.h
AP_DLL_WINSOCKAPI = 2, // mswsock From WinSock.h
AP_DLL_WINSOCK2API = 3, // ws2_32 From WinSock2.h
AP_DLL_defined = 4 // must define as last idx_ + 1
} ap_dlltoken_e;
FARPROC ap_load_dll_func(ap_dlltoken_e fnLib, char* fnName, int ordinal);
PSECURITY_ATTRIBUTES GetNullACL();
void CleanNullACL(void *sa);
DWORD wait_for_many_objects(DWORD nCount, CONST HANDLE *lpHandles,
DWORD dwSeconds);
int set_listeners_noninheritable(apr_pool_t *p);
#define AP_DECLARE_LATE_DLL_FUNC(lib, rettype, calltype, fn, ord, args, names) \
typedef rettype (calltype *ap_winapi_fpt_##fn) args; \
static ap_winapi_fpt_##fn ap_winapi_pfn_##fn = NULL; \
__inline rettype ap_winapi_##fn args \
{ if (!ap_winapi_pfn_##fn) \
ap_winapi_pfn_##fn = (ap_winapi_fpt_##fn) ap_load_dll_func(lib, #fn, ord); \
return (*(ap_winapi_pfn_##fn)) names; }; \
/* Win2K kernel only */
AP_DECLARE_LATE_DLL_FUNC(AP_DLL_WINADVAPI, BOOL, WINAPI, ChangeServiceConfig2A, 0, (
SC_HANDLE hService,
DWORD dwInfoLevel,
LPVOID lpInfo),
(hService, dwInfoLevel, lpInfo));
#undef ChangeServiceConfig2
#define ChangeServiceConfig2 ap_winapi_ChangeServiceConfig2A
/* WinNT kernel only */
AP_DECLARE_LATE_DLL_FUNC(AP_DLL_WINBASEAPI, BOOL, WINAPI, CancelIo, 0, (
IN HANDLE hFile),
(hFile));
#undef CancelIo
#define CancelIo ap_winapi_CancelIo
/* Win9x kernel only */
AP_DECLARE_LATE_DLL_FUNC(AP_DLL_WINBASEAPI, DWORD, WINAPI, RegisterServiceProcess, 0, (
DWORD dwProcessId,
DWORD dwType),
(dwProcessId, dwType));
#define RegisterServiceProcess ap_winapi_RegisterServiceProcess
#endif /* def AP_DECLARE_EXPORT */
#ifdef __cplusplus
}
#endif
#endif /* ndef AP_OS_H */
#endif /* def WIN32 */
|