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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
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.
25 #include "apr_pools.h"
30 #define PLATFORM "Win32"
32 /* going away shortly... */
33 #define HAVE_DRIVE_LETTERS
34 #define HAVE_UNC_PATHS
35 #define CASE_BLIND_FILESYSTEM
37 #define APACHE_MPM_DIR "server/mpm/winnt" /* generated on unix */
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
52 AP_DECLARE_DATA extern int real_exit_code;
54 #define exit(status) ((exit)((real_exit_code==2) ? (real_exit_code = (status)) \
55 : ((real_exit_code = 0), (status))))
58 #ifdef AP_DECLARE_EXPORT
60 /* Defined in util_win32.c and available only to the core module for
64 AP_DECLARE(apr_status_t) ap_os_proc_filepath(char **binpath, apr_pool_t *p);
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
74 FARPROC ap_load_dll_func(ap_dlltoken_e fnLib, char* fnName, int ordinal);
76 PSECURITY_ATTRIBUTES GetNullACL();
77 void CleanNullACL(void *sa);
79 int set_listeners_noninheritable(apr_pool_t *p);
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; }; \
90 /* Win2K kernel only */
91 AP_DECLARE_LATE_DLL_FUNC(AP_DLL_WINADVAPI, BOOL, WINAPI, ChangeServiceConfig2A, 0, (
95 (hService, dwInfoLevel, lpInfo));
96 #undef ChangeServiceConfig2
97 #define ChangeServiceConfig2 ap_winapi_ChangeServiceConfig2A
99 /* WinNT kernel only */
100 AP_DECLARE_LATE_DLL_FUNC(AP_DLL_WINBASEAPI, BOOL, WINAPI, CancelIo, 0, (
104 #define CancelIo ap_winapi_CancelIo
106 /* Win9x kernel only */
107 AP_DECLARE_LATE_DLL_FUNC(AP_DLL_WINBASEAPI, DWORD, WINAPI, RegisterServiceProcess, 0, (
110 (dwProcessId, dwType));
111 #define RegisterServiceProcess ap_winapi_RegisterServiceProcess
113 #endif /* def AP_DECLARE_EXPORT */
119 #endif /* ndef AP_OS_H */
120 #endif /* def WIN32 */