xref: /aoo42x/main/sal/osl/w32/system.h (revision 9eab2a37)
1*9eab2a37SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9eab2a37SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9eab2a37SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9eab2a37SAndrew Rist  * distributed with this work for additional information
6*9eab2a37SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9eab2a37SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9eab2a37SAndrew Rist  * "License"); you may not use this file except in compliance
9*9eab2a37SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*9eab2a37SAndrew Rist  *
11*9eab2a37SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*9eab2a37SAndrew Rist  *
13*9eab2a37SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9eab2a37SAndrew Rist  * software distributed under the License is distributed on an
15*9eab2a37SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9eab2a37SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9eab2a37SAndrew Rist  * specific language governing permissions and limitations
18*9eab2a37SAndrew Rist  * under the License.
19*9eab2a37SAndrew Rist  *
20*9eab2a37SAndrew Rist  *************************************************************/
21*9eab2a37SAndrew Rist 
22*9eab2a37SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #if OSL_DEBUG_LEVEL == 0
25cdf0e10cSrcweir #    define NO_DEBUG_CRT
26cdf0e10cSrcweir #endif
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #ifndef _WIN32_WINNT
29cdf0e10cSrcweir #	define _WIN32_WINNT 0x0400
30cdf0e10cSrcweir #	define _CTYPE_DISABLE_MACROS /* wg. dynamischer C-Runtime MH */
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <stdio.h>
34cdf0e10cSrcweir #include <stdlib.h>
35cdf0e10cSrcweir #include <stdarg.h>
36cdf0e10cSrcweir #include <ctype.h>
37cdf0e10cSrcweir #include <malloc.h>
38cdf0e10cSrcweir #include <limits.h>
39cdf0e10cSrcweir #include <process.h>
40cdf0e10cSrcweir #include <time.h>
41cdf0e10cSrcweir #include <fcntl.h>
42cdf0e10cSrcweir #include <sys/types.h>
43cdf0e10cSrcweir #include <sys/stat.h>
44cdf0e10cSrcweir #include <io.h>
45cdf0e10cSrcweir #include <share.h>
46cdf0e10cSrcweir #include <direct.h>
47cdf0e10cSrcweir 
48cdf0e10cSrcweir /* Must define this else build breaks because Winsock2.h
49cdf0e10cSrcweir     includes Windows.h and without WIN32_LEAN_AND_MEAN
50cdf0e10cSrcweir     also includes mswsock.h which needs a forward typedef
51cdf0e10cSrcweir     of SOCKET ...
52cdf0e10cSrcweir */
53cdf0e10cSrcweir #define WIN32_LEAN_AND_MEAN
54cdf0e10cSrcweir 
55cdf0e10cSrcweir #ifdef GCC
56cdf0e10cSrcweir     // windows.h includes winsock2.h
57cdf0e10cSrcweir     // if _WIN32_WINNT > 0x0400
58cdf0e10cSrcweir     // so someone cannot include winsock.h
59cdf0e10cSrcweir     // at the same time without patching
60cdf0e10cSrcweir     // windows.h
61cdf0e10cSrcweir     #include <windows.h>
62cdf0e10cSrcweir #ifdef __MINGW32__
63cdf0e10cSrcweir     #include <winsock2.h>
64cdf0e10cSrcweir     #include <ws2tcpip.h>
65cdf0e10cSrcweir #endif
66cdf0e10cSrcweir     #include <shlobj.h>
67cdf0e10cSrcweir     #ifndef NO_DEBUG_CRT
68cdf0e10cSrcweir         #include <crtdbg.h>
69cdf0e10cSrcweir     #endif
70cdf0e10cSrcweir #else
71cdf0e10cSrcweir     // winsock2.h includes windows.h
72cdf0e10cSrcweir     #pragma warning(push,1) /* disable warnings within system headers */
73cdf0e10cSrcweir     #pragma warning(disable:4917)
74cdf0e10cSrcweir     #include <winsock2.h>
75cdf0e10cSrcweir     #include <wsipx.h>
76cdf0e10cSrcweir     #include <shlobj.h>
77cdf0e10cSrcweir     #ifndef NO_DEBUG_CRT
78cdf0e10cSrcweir         #include <crtdbg.h>
79cdf0e10cSrcweir     #endif
80cdf0e10cSrcweir     #pragma warning(pop)
81cdf0e10cSrcweir #endif
82cdf0e10cSrcweir 
83cdf0e10cSrcweir #define _MAX_CMD	4096	/* maximum length of commandline     */
84cdf0e10cSrcweir /* #define _MAX_ENV	4096	 maximum length of environment var (isn't used anywhere) */
85cdf0e10cSrcweir 
86cdf0e10cSrcweir #ifdef GCC
87cdf0e10cSrcweir     #	ifndef SA_FAMILY_DECL
88cdf0e10cSrcweir     #		define SA_FAMILY_DECL short sa_family
89cdf0e10cSrcweir     #	endif
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	typedef struct sockaddr_ipx {
92cdf0e10cSrcweir 		SA_FAMILY_DECL;
93cdf0e10cSrcweir 		char sa_netnum[4];
94cdf0e10cSrcweir 		char sa_nodenum[6];
95cdf0e10cSrcweir 		unsigned short sa_socket;
96cdf0e10cSrcweir 	} SOCKADDR_IPX;
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     #	define NSPROTO_IPX		1000
99cdf0e10cSrcweir     #	define NSPROTO_SPX		1256
100cdf0e10cSrcweir     #	define NSPROTO_SPXII	1257
101cdf0e10cSrcweir #endif // #ifdef GCC
102cdf0e10cSrcweir 
103cdf0e10cSrcweir #ifdef _DLL_
104cdf0e10cSrcweir 
105cdf0e10cSrcweir #ifdef __cplusplus
106cdf0e10cSrcweir     extern "C" DWORD g_dwPlatformId;
107cdf0e10cSrcweir #else
108cdf0e10cSrcweir     extern DWORD g_dwPlatformId;
109cdf0e10cSrcweir #endif // #ifdef __cplusplus
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     #define IS_NT (g_dwPlatformId == VER_PLATFORM_WIN32_NT)
112cdf0e10cSrcweir #else
113cdf0e10cSrcweir 
114cdf0e10cSrcweir #ifdef __cplusplus
115cdf0e10cSrcweir     extern "C" DWORD GetPlatformId(void);
116cdf0e10cSrcweir #else
117cdf0e10cSrcweir     extern DWORD GetPlatformId(void);
118cdf0e10cSrcweir #endif // #ifdef __cplusplus
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     #define IS_NT (GetPlatformId() == VER_PLATFORM_WIN32_NT)
121cdf0e10cSrcweir #endif // #ifdef _DLL_
122cdf0e10cSrcweir 
123