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