Path: blob/main/crypto/krb5/src/include/win-mac.h
104895 views
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */1/*2* This file is now only used on Windows3*/45/*6* type functions split out of here to make things look nicer in the7* various include files which need these definitions, as well as in8* the util/ directories.9*/1011#ifndef _KRB5_WIN_MAC_H12#define _KRB5_WIN_MAC_H1314#ifdef _WIN3215#define ID_READ_PWD_DIALOG 1000016#define ID_READ_PWD_PROMPT 1000117#define ID_READ_PWD_PROMPT2 1000218#define ID_READ_PWD_PWD 100031920#ifdef RES_ONLY2122#define APSTUDIO_HIDDEN_SYMBOLS23#include <windows.h>2425#else /* ! RES_ONLY */26#include <stdlib.h>27#ifdef DEBUG28#include <crtdbg.h>29#endif3031/* To ensure backward compatibility of the ABI use 32-bit time_t on32* 32-bit Windows.33*/34#ifdef _KRB5_INT_H35#ifdef KRB5_GENERAL__36#error krb5.h included before k5-int.h37#endif /* KRB5_GENERAL__ */38#if _INTEGRAL_MAX_BITS >= 64 && _MSC_VER >= 1400 && !defined(_WIN64) && !defined(_USE_32BIT_TIME_T)39#if defined(_TIME_T_DEFINED) || defined(_INC_IO) || defined(_INC_TIME) || defined(_INC_WCHAR)40#error time_t has been defined as a 64-bit integer which is incompatible with Kerberos on this platform.41#endif /* _TIME_T_DEFINED */42#define _USE_32BIT_TIME_T43#endif44#endif4546#define SIZEOF_INT 447#define SIZEOF_SHORT 248#define SIZEOF_LONG 44950#include <windows.h>51#include <limits.h>5253#ifndef SIZE_MAX /* in case Microsoft defines max size of size_t */54#ifdef MAX_SIZE /* Microsoft defines MAX_SIZE as max size of size_t */55#define SIZE_MAX MAX_SIZE56#else57#define SIZE_MAX UINT_MAX58#endif59#endif6061#ifndef KRB5_CALLCONV62# define KRB5_CALLCONV __stdcall63# define KRB5_CALLCONV_C __cdecl6465/*66* Use this to mark an incorrect calling convention that has been67* "immortalized" because it was incorrectly exported in a previous68* release.69*/7071# define KRB5_CALLCONV_WRONG KRB5_CALLCONV_C7273#endif /* !KRB5_CALLCONV */7475#ifndef KRB5_SYSTYPES__76#define KRB5_SYSTYPES__77#include <sys/types.h>78typedef unsigned long u_long; /* Not part of sys/types.h on the pc */79typedef unsigned int u_int;80typedef unsigned short u_short;81typedef unsigned char u_char;82typedef unsigned short uint16_t;83typedef short int16_t;84typedef unsigned int uint32_t;85typedef int int32_t;86#if _INTEGRAL_MAX_BITS >= 6487typedef unsigned __int64 uint64_t;88typedef __int64 int64_t;89#endif90#ifndef SSIZE_T_DEFINED91#ifdef ssize_t92#undef ssize_t93#endif94#ifdef _WIN6495typedef __int64 ssize_t;96#else97typedef _W64 int ssize_t;98#endif99#define SSIZE_T_DEFINED100#endif101#endif /* KRB5_SYSTYPES__ */102103#ifndef MAXHOSTNAMELEN104#define MAXHOSTNAMELEN 512105#endif106107#ifndef MAXPATHLEN108#define MAXPATHLEN 256 /* Also for Windows temp files */109#endif110111#ifdef KRB5_PRIVATE112#define HAVE_NETINET_IN_H113#define MSDOS_FILESYSTEM114#define HAVE_STRING_H115#define HAVE_SRAND116#define HAVE_ERRNO117#define HAVE_STRDUP118#define HAVE_GETADDRINFO119#define HAVE_GETNAMEINFO120#define NO_USERID121#define NO_PASSWORD122#define HAVE_STRERROR123#define SYS_ERRLIST_DECLARED124#if _MSC_VER >= 1900125#define HAVE_VSNPRINTF126#endif127/* Visual Studio 2012 errors out when we macroize keywords in C++ mode */128#ifndef __cplusplus129#define inline __inline130#endif131#define NEED_INSIXADDR_ANY132#define ENABLE_THREADS133#endif134135#define WM_KERBEROS5_CHANGED "Kerberos5 Changed"136#ifdef KRB4137#define WM_KERBEROS_CHANGED "Kerberos Changed"138#endif139140/* Kerberos Windows initialization file */141#define KERBEROS_INI "kerberos.ini"142#ifdef CYGNUS143#define KERBEROS_HLP "kerbnet.hlp"144#else145#define KERBEROS_HLP "krb5clnt.hlp"146#endif147#define INI_DEFAULTS "Defaults"148#define INI_USER "User" /* Default user */149#define INI_INSTANCE "Instance" /* Default instance */150#define INI_REALM "Realm" /* Default realm */151#define INI_POSITION "Position"152#define INI_OPTIONS "Options"153#define INI_DURATION "Duration" /* Ticket duration in minutes */154#define INI_EXPIRATION "Expiration" /* Action on expiration (alert or beep) */155#define INI_ALERT "Alert"156#define INI_BEEP "Beep"157#define INI_FILES "Files"158#ifdef KRB4159#define INI_KRB_CONF "krb.conf" /* Location of krb.conf file */160#define DEF_KRB_CONF "krb.conf" /* Default name for krb.conf file */161#else162#define INI_KRB5_CONF "krb5.ini" /* From k5-config.h */163#define INI_KRB_CONF INI_KRB5_CONF /* Location of krb.conf file */164#define DEF_KRB_CONF INI_KRB5_CONF /* Default name for krb.conf file */165#define INI_TICKETOPTS "TicketOptions" /* Ticket options */166#define INI_FORWARDABLE "Forwardable" /* get forwardable tickets */167#define INI_KRB_CCACHE "krb5cc" /* From k5-config.h */168#endif169#define INI_KRB_REALMS "krb.realms" /* Location of krb.realms file */170#define DEF_KRB_REALMS "krb.realms" /* Default name for krb.realms file */171#define INI_RECENT_LOGINS "Recent Logins"172#define INI_LOGIN "Login"173174#ifdef KRB5_PRIVATE175#define HAS_VOID_TYPE176#define HAVE_STDARG_H177#define HAVE_SYS_TYPES_H178#define HAVE_STDLIB_H179#endif180181/* Ugly. Microsoft, in stdc mode, doesn't support the low-level i/o182* routines directly. Rather, they only export the _<function> version.183* The following defines works around this problem.184*/185#include <sys\types.h>186#include <sys\stat.h>187#include <fcntl.h>188#include <io.h>189#include <process.h>190#include <wincrypt.h>191192#ifdef NEED_SYSERROR193/* Only needed by util/et/error_message.c but let's keep the source clean */194#define sys_nerr _sys_nerr195#define sys_errlist _sys_errlist196#endif197198/*199* Functions with slightly different names on the PC200*/201#ifndef strcasecmp202#define strcasecmp _stricmp203#endif204#ifndef strncasecmp205#define strncasecmp _strnicmp206#endif207208/* VS2005 has deprecated strdup */209#ifndef strdup210#define strdup _strdup211#endif212213/* Windows has its own name for reentrant strtok. */214#define strtok_r strtok_s215216HINSTANCE get_lib_instance(void);217218#define GETSOCKNAME_ARG3_TYPE size_t219#define GETPEERNAME_ARG3_TYPE GETSOCKNAME_ARG3_TYPE220221#endif /* !RES_ONLY */222223#endif /* _WIN32 */224225#define THREEPARAMOPEN(x,y,z) open(x,y,z)226227#define DEFKTNAME "FILE:%{WINDOWS}\\krb5kt"228#define DEFCKTNAME "FILE:%{WINDOWS}\\krb5clientkt"229230#ifndef KRB5_CALLCONV231#define KRB5_CALLCONV232#endif233234#ifndef KRB5_CALLCONV_C235#define KRB5_CALLCONV_C236#endif237238#ifndef PKCS11_MODNAME239#define PKCS11_MODNAME "C:\\Program Files\\OpenSC Project\\OpenSC\\pkcs11\\opensc-pkcs11.dll"240#endif241242#endif /* _KRB5_WIN_MAC_H */243244245