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