xref: /aoo42x/main/sal/osl/w32/system.h (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL == 0
29*cdf0e10cSrcweir #    define NO_DEBUG_CRT
30*cdf0e10cSrcweir #endif
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir #ifndef _WIN32_WINNT
33*cdf0e10cSrcweir #	define _WIN32_WINNT 0x0400
34*cdf0e10cSrcweir #	define _CTYPE_DISABLE_MACROS /* wg. dynamischer C-Runtime MH */
35*cdf0e10cSrcweir #endif
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir #include <stdio.h>
38*cdf0e10cSrcweir #include <stdlib.h>
39*cdf0e10cSrcweir #include <stdarg.h>
40*cdf0e10cSrcweir #include <ctype.h>
41*cdf0e10cSrcweir #include <malloc.h>
42*cdf0e10cSrcweir #include <limits.h>
43*cdf0e10cSrcweir #include <process.h>
44*cdf0e10cSrcweir #include <time.h>
45*cdf0e10cSrcweir #include <fcntl.h>
46*cdf0e10cSrcweir #include <sys/types.h>
47*cdf0e10cSrcweir #include <sys/stat.h>
48*cdf0e10cSrcweir #include <io.h>
49*cdf0e10cSrcweir #include <share.h>
50*cdf0e10cSrcweir #include <direct.h>
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir /* Must define this else build breaks because Winsock2.h
53*cdf0e10cSrcweir     includes Windows.h and without WIN32_LEAN_AND_MEAN
54*cdf0e10cSrcweir     also includes mswsock.h which needs a forward typedef
55*cdf0e10cSrcweir     of SOCKET ...
56*cdf0e10cSrcweir */
57*cdf0e10cSrcweir #define WIN32_LEAN_AND_MEAN
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir #ifdef GCC
60*cdf0e10cSrcweir     // windows.h includes winsock2.h
61*cdf0e10cSrcweir     // if _WIN32_WINNT > 0x0400
62*cdf0e10cSrcweir     // so someone cannot include winsock.h
63*cdf0e10cSrcweir     // at the same time without patching
64*cdf0e10cSrcweir     // windows.h
65*cdf0e10cSrcweir     #include <windows.h>
66*cdf0e10cSrcweir #ifdef __MINGW32__
67*cdf0e10cSrcweir     #include <winsock2.h>
68*cdf0e10cSrcweir     #include <ws2tcpip.h>
69*cdf0e10cSrcweir #endif
70*cdf0e10cSrcweir     #include <shlobj.h>
71*cdf0e10cSrcweir     #ifndef NO_DEBUG_CRT
72*cdf0e10cSrcweir         #include <crtdbg.h>
73*cdf0e10cSrcweir     #endif
74*cdf0e10cSrcweir #else
75*cdf0e10cSrcweir     // winsock2.h includes windows.h
76*cdf0e10cSrcweir     #pragma warning(push,1) /* disable warnings within system headers */
77*cdf0e10cSrcweir     #pragma warning(disable:4917)
78*cdf0e10cSrcweir     #include <winsock2.h>
79*cdf0e10cSrcweir     #include <wsipx.h>
80*cdf0e10cSrcweir     #include <shlobj.h>
81*cdf0e10cSrcweir     #ifndef NO_DEBUG_CRT
82*cdf0e10cSrcweir         #include <crtdbg.h>
83*cdf0e10cSrcweir     #endif
84*cdf0e10cSrcweir     #pragma warning(pop)
85*cdf0e10cSrcweir #endif
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir #define _MAX_CMD	4096	/* maximum length of commandline     */
88*cdf0e10cSrcweir /* #define _MAX_ENV	4096	 maximum length of environment var (isn't used anywhere) */
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir #ifdef GCC
91*cdf0e10cSrcweir     #	ifndef SA_FAMILY_DECL
92*cdf0e10cSrcweir     #		define SA_FAMILY_DECL short sa_family
93*cdf0e10cSrcweir     #	endif
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir 	typedef struct sockaddr_ipx {
96*cdf0e10cSrcweir 		SA_FAMILY_DECL;
97*cdf0e10cSrcweir 		char sa_netnum[4];
98*cdf0e10cSrcweir 		char sa_nodenum[6];
99*cdf0e10cSrcweir 		unsigned short sa_socket;
100*cdf0e10cSrcweir 	} SOCKADDR_IPX;
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir     #	define NSPROTO_IPX		1000
103*cdf0e10cSrcweir     #	define NSPROTO_SPX		1256
104*cdf0e10cSrcweir     #	define NSPROTO_SPXII	1257
105*cdf0e10cSrcweir #endif // #ifdef GCC
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir #ifdef _DLL_
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir #ifdef __cplusplus
110*cdf0e10cSrcweir     extern "C" DWORD g_dwPlatformId;
111*cdf0e10cSrcweir #else
112*cdf0e10cSrcweir     extern DWORD g_dwPlatformId;
113*cdf0e10cSrcweir #endif // #ifdef __cplusplus
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir     #define IS_NT (g_dwPlatformId == VER_PLATFORM_WIN32_NT)
116*cdf0e10cSrcweir #else
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir #ifdef __cplusplus
119*cdf0e10cSrcweir     extern "C" DWORD GetPlatformId(void);
120*cdf0e10cSrcweir #else
121*cdf0e10cSrcweir     extern DWORD GetPlatformId(void);
122*cdf0e10cSrcweir #endif // #ifdef __cplusplus
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir     #define IS_NT (GetPlatformId() == VER_PLATFORM_WIN32_NT)
125*cdf0e10cSrcweir #endif // #ifdef _DLL_
126*cdf0e10cSrcweir 
127