Convert DEBUG_REFERRALS to TRACE_* framework
[krb5.git] / src / include / win-mac.h
1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /*
3  * This file is now only used on Windows
4  */
5
6 /*
7  * type functions split out of here to make things look nicer in the
8  * various include files which need these definitions, as well as in
9  * the util/ directories.
10  */
11
12 #ifndef _KRB5_WIN_MAC_H
13 #define _KRB5_WIN_MAC_H
14
15 #ifdef _WIN32
16 #define ID_READ_PWD_DIALOG  10000
17 #define ID_READ_PWD_PROMPT  10001
18 #define ID_READ_PWD_PROMPT2 10002
19 #define ID_READ_PWD_PWD     10003
20
21 #ifdef RES_ONLY
22
23 #define APSTUDIO_HIDDEN_SYMBOLS
24 #include <windows.h>
25
26 #else /* ! RES_ONLY */
27
28 /* To ensure backward compatibility of the ABI use 32-bit time_t on
29  * 32-bit Windows.
30  */
31 #ifdef _KRB5_INT_H
32 #ifdef KRB5_GENERAL__
33 #error krb5.h included before k5-int.h
34 #endif /* KRB5_GENERAL__ */
35 #if _INTEGRAL_MAX_BITS >= 64 && _MSC_VER >= 1400 && !defined(_WIN64) && !defined(_USE_32BIT_TIME_T)
36 #if defined(_TIME_T_DEFINED) || defined(_INC_IO) || defined(_INC_TIME) || defined(_INC_WCHAR)
37 #error time_t has been defined as a 64-bit integer which is incompatible with Kerberos on this platform.
38 #endif /* _TIME_T_DEFINED */
39 #define _USE_32BIT_TIME_T
40 #endif
41 #endif
42
43 #define SIZEOF_INT      4
44 #define SIZEOF_SHORT    2
45 #define SIZEOF_LONG     4
46
47 #include <windows.h>
48 #include <limits.h>
49
50 #ifndef SIZE_MAX    /* in case Microsoft defines max size of size_t */
51 #ifdef  MAX_SIZE    /* Microsoft defines MAX_SIZE as max size of size_t */
52 #define SIZE_MAX MAX_SIZE
53 #else
54 #define SIZE_MAX UINT_MAX
55 #endif
56 #endif
57
58 #ifndef KRB5_CALLCONV
59 #  define KRB5_CALLCONV __stdcall
60 #  define KRB5_CALLCONV_C __cdecl
61
62 /*
63  * Use this to mark an incorrect calling convention that has been
64  * "immortalized" because it was incorrectly exported in a previous
65  * release.
66  */
67
68 #  define KRB5_CALLCONV_WRONG KRB5_CALLCONV_C
69
70 #endif /* !KRB5_CALLCONV */
71
72 #ifndef KRB5_SYSTYPES__
73 #define KRB5_SYSTYPES__
74 #include <sys/types.h>
75 typedef unsigned long    u_long;      /* Not part of sys/types.h on the pc */
76 typedef unsigned int     u_int;
77 typedef unsigned short   u_short;
78 typedef unsigned char    u_char;
79 typedef unsigned int     uint32_t;
80 typedef int              int32_t;
81 #if _INTEGRAL_MAX_BITS >= 64
82 typedef unsigned __int64 uint64_t;
83 typedef __int64          int64_t;
84 #endif
85 #ifndef SSIZE_T_DEFINED
86 #ifdef ssize_t
87 #undef ssize_t
88 #endif
89 #ifdef _WIN64
90 typedef __int64          ssize_t;
91 #else
92 typedef _W64 int         ssize_t;
93 #endif
94 #define SSIZE_T_DEFINED
95 #endif
96 #endif /* KRB5_SYSTYPES__ */
97
98 #define MAXHOSTNAMELEN  512
99 #ifndef MAXPATHLEN
100 #define MAXPATHLEN      256            /* Also for Windows temp files */
101 #endif
102
103 #ifdef KRB5_PRIVATE
104 #define HAVE_NETINET_IN_H
105 #define MSDOS_FILESYSTEM
106 #define HAVE_STRING_H
107 #define HAVE_SRAND
108 #define HAVE_ERRNO
109 #define HAVE_STRDUP
110 #define HAVE_GETADDRINFO
111 #define HAVE_GETNAMEINFO
112 #define NO_USERID
113 #define NO_PASSWORD
114 #define HAVE_STRERROR
115 #define SYS_ERRLIST_DECLARED
116 /* if __STDC_VERSION__ >= 199901L this shouldn't be needed */
117 #define inline __inline
118 #define NEED_INSIXADDR_ANY
119 #define ENABLE_THREADS
120 #endif
121
122 #define WM_KERBEROS5_CHANGED "Kerberos5 Changed"
123 #ifdef KRB4
124 #define WM_KERBEROS_CHANGED "Kerberos Changed"
125 #endif
126
127 /* Kerberos Windows initialization file */
128 #define KERBEROS_INI    "kerberos.ini"
129 #ifdef CYGNUS
130 #define KERBEROS_HLP    "kerbnet.hlp"
131 #else
132 #define KERBEROS_HLP    "krb5clnt.hlp"
133 #endif
134 #define INI_DEFAULTS    "Defaults"
135 #define   INI_USER        "User"          /* Default user */
136 #define   INI_INSTANCE    "Instance"      /* Default instance */
137 #define   INI_REALM       "Realm"         /* Default realm */
138 #define   INI_POSITION    "Position"
139 #define   INI_OPTIONS     "Options"
140 #define   INI_DURATION    "Duration"   /* Ticket duration in minutes */
141 #define INI_EXPIRATION  "Expiration" /* Action on expiration (alert or beep) */
142 #define   INI_ALERT       "Alert"
143 #define   INI_BEEP        "Beep"
144 #define   INI_FILES       "Files"
145 #ifdef KRB4
146 #define   INI_KRB_CONF    "krb.conf"     /* Location of krb.conf file */
147 #define   DEF_KRB_CONF    "krb.conf"      /* Default name for krb.conf file */
148 #else
149 #define INI_KRB5_CONF   "krb5.ini"      /* From k5-config.h */
150 #define INI_KRB_CONF    INI_KRB5_CONF   /* Location of krb.conf file */
151 #define DEF_KRB_CONF    INI_KRB5_CONF   /* Default name for krb.conf file */
152 #define INI_TICKETOPTS  "TicketOptions" /* Ticket options */
153 #define   INI_FORWARDABLE  "Forwardable" /* get forwardable tickets */
154 #define INI_KRB_CCACHE  "krb5cc"        /* From k5-config.h */
155 #endif
156 #define INI_KRB_REALMS  "krb.realms"    /* Location of krb.realms file */
157 #define DEF_KRB_REALMS  "krb.realms"    /* Default name for krb.realms file */
158 #define INI_RECENT_LOGINS "Recent Logins"
159 #define INI_LOGIN       "Login"
160
161 #ifdef KRB5_PRIVATE
162 #define HAS_VOID_TYPE
163 #define HAVE_STDARG_H
164 #define HAVE_SYS_TYPES_H
165 #define HAVE_STDLIB_H
166 #endif
167
168 /* This controls which encryption routines libcrypto will provide */
169 #define PROVIDE_DES_CBC_MD5
170 #define PROVIDE_DES_CBC_CRC
171 #define PROVIDE_DES_CBC_RAW
172 #define PROVIDE_DES_CBC_CKSUM
173 #define PROVIDE_CRC32
174 #define PROVIDE_RSA_MD4
175 #define PROVIDE_RSA_MD5
176 /* #define PROVIDE_DES3_CBC_SHA */
177 /* #define PROVIDE_DES3_CBC_RAW */
178 /* #define PROVIDE_NIST_SHA */
179
180 /* Ugly. Microsoft, in stdc mode, doesn't support the low-level i/o
181  * routines directly. Rather, they only export the _<function> version.
182  * The following defines works around this problem.
183  */
184 #include <sys\types.h>
185 #include <sys\stat.h>
186 #include <fcntl.h>
187 #include <io.h>
188 #include <process.h>
189 #include <wincrypt.h>
190
191 #ifdef NEED_SYSERROR
192 /* Only needed by util/et/error_message.c but let's keep the source clean */
193 #define sys_nerr        _sys_nerr
194 #define sys_errlist     _sys_errlist
195 #endif
196
197 /*
198  * Functions with slightly different names on the PC
199  */
200 #ifndef strcasecmp
201 #define strcasecmp   _stricmp
202 #endif
203 #ifndef strncasecmp
204 #define strncasecmp  _strnicmp
205 #endif
206
207 /* VS2005 has deprecated strdup */
208 #ifndef strdup
209 #define strdup _strdup
210 #endif
211
212 /* Windows has its own name for reentrant strtok. */
213 #define strtok_r strtok_s
214
215 HINSTANCE get_lib_instance(void);
216
217 #define GETSOCKNAME_ARG2_TYPE   struct sockaddr
218 #define GETSOCKNAME_ARG3_TYPE   size_t
219 #define GETPEERNAME_ARG2_TYPE   GETSOCKNAME_ARG2_TYPE
220 #define GETPEERNAME_ARG3_TYPE   GETSOCKNAME_ARG3_TYPE
221
222 #endif /* !RES_ONLY */
223
224 #endif /* _WIN32 */
225
226 #define THREEPARAMOPEN(x,y,z) open(x,y,z)
227
228 #ifndef KRB5_CALLCONV
229 #define KRB5_CALLCONV
230 #endif
231
232 #ifndef KRB5_CALLCONV_C
233 #define KRB5_CALLCONV_C
234 #endif
235
236 #endif /* _KRB5_WIN_MAC_H */