source: trunk/include/win/basetsd.h@ 21360

Last change on this file since 21360 was 21360, checked in by vladest, 16 years ago
  1. Security interface constants and structures added
  2. Fixed conflicts of data definitions in security interface
File size: 5.6 KB
Line 
1/*
2 * Compilers that uses ILP32, LP64 or P64 type models
3 * for both Win32 and Win64 are supported by this file.
4 *
5 * Copyright (C) 1999 Patrik Stridvall
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef __WINE_BASETSD_H
23#define __WINE_BASETSD_H
24
25#ifdef __cplusplus
26extern "C" {
27#endif /* defined(__cplusplus) */
28
29/*
30 * Win32 was easy to implement under Unix since most (all?) 32-bit
31 * Unices uses the same type model (ILP32) as Win32, where int, long
32 * and pointer are 32-bit.
33 *
34 * Win64, however, will cause some problems when implemented under Unix.
35 * Linux/{Alpha, Sparc64} and most (all?) other 64-bit Unices uses
36 * the LP64 type model where int is 32-bit and long and pointer are
37 * 64-bit. Win64 on the other hand uses the P64 (sometimes called LLP64)
38 * type model where int and long are 32 bit and pointer is 64-bit.
39 */
40
41/* Type model independent typedefs */
42/* The __intXX types are native types defined by the MS C compiler.
43 * Apps that make use of them before they get defined here, can
44 * simply add to the command line:
45 * -D__int8=char -D__int16=short -D__int32=int "-D__int64=long long"
46 */
47#if !defined(_MSC_VER) && !defined(__WIDL__)
48# ifndef __int8
49# define __int8 char
50# endif
51# ifndef __int16
52# define __int16 short
53# endif
54# ifndef __int32
55# define __int32 int
56# endif
57# ifndef __int64
58# define __int64 long long
59# endif
60#endif /* !defined(_MSC_VER) */
61
62/* FIXME: DECLSPEC_ALIGN should be declared only in winnt.h, but we need it here too */
63#ifndef DECLSPEC_ALIGN
64# if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
65# define DECLSPEC_ALIGN(x) __declspec(align(x))
66# elif defined(__GNUC__)
67# define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
68# else
69# define DECLSPEC_ALIGN(x)
70# endif
71#endif
72
73typedef signed char INT8, *PINT8;
74typedef signed short INT16, *PINT16;
75typedef signed int INT32, *PINT32;
76typedef unsigned char UINT8, *PUINT8;
77typedef unsigned short UINT16, *PUINT16;
78typedef unsigned int UINT32, *PUINT32;
79typedef signed int LONG32, *PLONG32;
80typedef unsigned int ULONG32, *PULONG32;
81typedef unsigned int DWORD32, *PDWORD32;
82
83#ifdef _MSC_VER
84typedef signed __int64 INT64, *PINT64;
85typedef unsigned __int64 UINT64, *PUINT64;
86typedef signed __int64 LONG64, *PLONG64;
87typedef unsigned __int64 ULONG64, *PULONG64;
88typedef unsigned __int64 DWORD64, *PDWORD64;
89#else
90typedef signed __int64 DECLSPEC_ALIGN(8) INT64, *PINT64;
91typedef unsigned __int64 DECLSPEC_ALIGN(8) UINT64, *PUINT64;
92typedef signed __int64 DECLSPEC_ALIGN(8) LONG64, *PLONG64;
93typedef unsigned __int64 DECLSPEC_ALIGN(8) ULONG64, *PULONG64;
94typedef unsigned __int64 DECLSPEC_ALIGN(8) DWORD64, *PDWORD64;
95#endif
96
97/* Win32 or Win64 dependent typedef/defines. */
98
99#ifdef _WIN64
100
101typedef signed __int64 INT_PTR, *PINT_PTR;
102typedef signed __int64 LONG_PTR, *PLONG_PTR;
103typedef unsigned __int64 UINT_PTR, *PUINT_PTR;
104typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
105typedef unsigned __int64 DWORD_PTR, *PDWORD_PTR;
106
107#define MAXINT_PTR 0x7fffffffffffffff
108#define MININT_PTR 0x8000000000000000
109#define MAXUINT_PTR 0xffffffffffffffff
110
111typedef int HALF_PTR, *PHALF_PTR;
112typedef unsigned int UHALF_PTR, *PUHALF_PTR;
113
114#define MAXHALF_PTR 0x7fffffff
115#define MINHALF_PTR 0x80000000
116#define MAXUHALF_PTR 0xffffffff
117
118#else /* FIXME: defined(_WIN32) */
119
120#ifndef INT_PTR_D
121#define INT_PTR_D
122typedef int INT_PTR, *PINT_PTR;
123#endif
124typedef long LONG_PTR, *PLONG_PTR;
125#ifndef UINT_PTR_D
126#define UINT_PTR_D
127typedef unsigned int UINT_PTR, *PUINT_PTR;
128#endif
129typedef unsigned long ULONG_PTR, *PULONG_PTR;
130#ifndef DWORD_PTR_D
131#define DWORD_PTR_D
132typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
133#endif
134
135#define MAXINT_PTR 0x7fffffff
136#define MININT_PTR 0x80000000
137#define MAXUINT_PTR 0xffffffff
138
139typedef signed short HALF_PTR, *PHALF_PTR;
140typedef unsigned short UHALF_PTR, *PUHALF_PTR;
141
142#define MAXUHALF_PTR 0xffff
143#define MAXHALF_PTR 0x7fff
144#define MINHALF_PTR 0x8000
145
146#endif /* defined(_WIN64) || defined(_WIN32) */
147
148typedef LONG_PTR SSIZE_T, *PSSIZE_T;
149typedef ULONG_PTR SIZE_T, *PSIZE_T;
150
151/* Some Wine-specific definitions */
152
153/* Architecture dependent settings. */
154/* These are hardcoded to avoid dependencies on config.h in Winelib apps. */
155#if defined(__i386__)
156# undef WORDS_BIGENDIAN
157# undef BITFIELDS_BIGENDIAN
158# define ALLOW_UNALIGNED_ACCESS
159#elif defined(__sparc__)
160# define WORDS_BIGENDIAN
161# define BITFIELDS_BIGENDIAN
162# undef ALLOW_UNALIGNED_ACCESS
163#elif defined(__powerpc__)
164# define WORDS_BIGENDIAN
165# define BITFIELDS_BIGENDIAN
166# undef ALLOW_UNALIGNED_ACCESS
167#elif defined(__ALPHA__)
168# undef WORDS_BIGENDIAN
169# undef BITFIELDS_BIGENDIAN
170# undef ALLOW_UNALIGNED_ACCESS
171#elif !defined(RC_INVOKED) && !defined(__WIDL__)
172# error Unknown CPU architecture!
173#endif
174
175#ifdef __cplusplus
176} /* extern "C" */
177#endif /* defined(__cplusplus) */
178
179#endif /* !defined(__WINE_BASETSD_H) */
Note: See TracBrowser for help on using the repository browser.