2019-08-09 15:31:52 +00:00
|
|
|
/*
|
|
|
|
* CRT definitions
|
|
|
|
*
|
|
|
|
* Copyright 2000 Francois Gouget.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __WINE_CORECRT_H
|
|
|
|
#define __WINE_CORECRT_H
|
|
|
|
|
|
|
|
#ifndef __WINE_USE_MSVCRT
|
|
|
|
#define __WINE_USE_MSVCRT
|
|
|
|
#endif
|
|
|
|
|
2021-10-14 09:08:54 +00:00
|
|
|
#ifdef __WINE_CONFIG_H
|
|
|
|
# error You cannot use config.h with msvcrt
|
|
|
|
#endif
|
|
|
|
|
2023-06-02 07:35:29 +00:00
|
|
|
#ifdef WINE_UNIX_LIB
|
|
|
|
# error msvcrt headers cannot be used in Unix code
|
|
|
|
#endif
|
|
|
|
|
2021-10-14 09:08:54 +00:00
|
|
|
#ifndef _WIN32
|
|
|
|
# define _WIN32
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef WIN32
|
|
|
|
# define WIN32
|
2019-08-09 15:31:52 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (defined(__x86_64__) || defined(__powerpc64__) || defined(__aarch64__)) && !defined(_WIN64)
|
|
|
|
#define _WIN64
|
|
|
|
#endif
|
|
|
|
|
2020-05-18 14:58:53 +00:00
|
|
|
#ifndef _MSVCR_VER
|
|
|
|
# define _MSVCR_VER 140
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(_UCRT) && _MSVCR_VER >= 140
|
|
|
|
# define _UCRT
|
|
|
|
#endif
|
|
|
|
|
2021-10-13 09:57:38 +00:00
|
|
|
#include <sal.h>
|
|
|
|
|
2021-10-14 12:05:33 +00:00
|
|
|
#ifndef _MSC_VER
|
|
|
|
# ifndef __int8
|
|
|
|
# define __int8 char
|
|
|
|
# endif
|
|
|
|
# ifndef __int16
|
|
|
|
# define __int16 short
|
|
|
|
# endif
|
|
|
|
# ifndef __int32
|
|
|
|
# define __int32 int
|
|
|
|
# endif
|
|
|
|
# ifndef __int64
|
|
|
|
# if defined(_WIN64) && !defined(__MINGW64__)
|
|
|
|
# define __int64 long
|
|
|
|
# else
|
|
|
|
# define __int64 long long
|
|
|
|
# endif
|
|
|
|
# endif
|
2019-08-09 15:31:52 +00:00
|
|
|
#endif
|
|
|
|
|
2020-02-14 14:40:50 +00:00
|
|
|
#ifndef NULL
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#define NULL 0
|
|
|
|
#else
|
|
|
|
#define NULL ((void *)0)
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2020-11-05 01:29:28 +00:00
|
|
|
#ifndef __has_attribute
|
|
|
|
#define __has_attribute(x) 0
|
|
|
|
#endif
|
|
|
|
|
2023-05-30 10:11:51 +00:00
|
|
|
#if !defined(_MSC_VER) && !defined(__MINGW32__)
|
2020-11-26 15:01:49 +00:00
|
|
|
# undef __stdcall
|
2019-08-09 15:31:52 +00:00
|
|
|
# ifdef __i386__
|
|
|
|
# ifdef __GNUC__
|
|
|
|
# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
|
|
|
|
# define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
|
|
|
|
# else
|
|
|
|
# define __stdcall __attribute__((__stdcall__))
|
|
|
|
# endif
|
|
|
|
# else
|
|
|
|
# error You need to define __stdcall for your compiler
|
|
|
|
# endif
|
|
|
|
# elif defined(__x86_64__) && defined (__GNUC__)
|
2020-11-05 01:29:28 +00:00
|
|
|
# if __has_attribute(__force_align_arg_pointer__)
|
2019-08-09 15:31:52 +00:00
|
|
|
# define __stdcall __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
|
|
|
|
# else
|
|
|
|
# define __stdcall __attribute__((ms_abi))
|
|
|
|
# endif
|
2023-05-30 10:11:51 +00:00
|
|
|
# elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__) && !defined(__CYGWIN__)
|
2019-08-09 15:31:52 +00:00
|
|
|
# define __stdcall __attribute__((pcs("aapcs-vfp")))
|
2020-12-20 22:38:46 +00:00
|
|
|
# elif defined(__aarch64__) && defined (__GNUC__) && __has_attribute(ms_abi)
|
2019-08-09 15:31:52 +00:00
|
|
|
# define __stdcall __attribute__((ms_abi))
|
|
|
|
# else /* __i386__ */
|
|
|
|
# define __stdcall
|
|
|
|
# endif /* __i386__ */
|
2020-11-26 15:01:49 +00:00
|
|
|
# undef __cdecl
|
2019-08-09 15:31:52 +00:00
|
|
|
# if defined(__i386__) && defined(__GNUC__)
|
2020-11-26 15:01:49 +00:00
|
|
|
# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
|
2019-08-09 15:31:52 +00:00
|
|
|
# define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
|
|
|
|
# else
|
|
|
|
# define __cdecl __attribute__((__cdecl__))
|
|
|
|
# endif
|
2020-06-17 13:09:34 +00:00
|
|
|
# else
|
2020-11-26 15:01:49 +00:00
|
|
|
# define __cdecl __stdcall
|
2019-08-09 15:31:52 +00:00
|
|
|
# endif
|
2023-05-30 10:11:51 +00:00
|
|
|
#endif /* _MSC_VER || __MINGW32__ */
|
2019-08-09 15:31:52 +00:00
|
|
|
|
|
|
|
#ifndef WINAPIV
|
2021-10-14 09:07:56 +00:00
|
|
|
# if defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__) && !defined(__MINGW32__) && !defined(__CYGWIN__)
|
2019-08-09 15:31:52 +00:00
|
|
|
# define WINAPIV __attribute__((pcs("aapcs")))
|
|
|
|
# else
|
|
|
|
# define WINAPIV __cdecl
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef DECLSPEC_NORETURN
|
|
|
|
# if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS)
|
|
|
|
# define DECLSPEC_NORETURN __declspec(noreturn)
|
|
|
|
# elif defined(__GNUC__)
|
|
|
|
# define DECLSPEC_NORETURN __attribute__((noreturn))
|
|
|
|
# else
|
|
|
|
# define DECLSPEC_NORETURN
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef DECLSPEC_ALIGN
|
|
|
|
# if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
|
|
|
|
# define DECLSPEC_ALIGN(x) __declspec(align(x))
|
|
|
|
# elif defined(__GNUC__)
|
|
|
|
# define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
|
|
|
|
# else
|
|
|
|
# define DECLSPEC_ALIGN(x)
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2020-01-29 12:40:04 +00:00
|
|
|
#ifndef _ACRTIMP
|
|
|
|
# ifdef _CRTIMP
|
|
|
|
# define _ACRTIMP _CRTIMP
|
|
|
|
# elif defined(_MSC_VER)
|
|
|
|
# define _ACRTIMP __declspec(dllimport)
|
|
|
|
# elif defined(__MINGW32__) || defined(__CYGWIN__)
|
|
|
|
# define _ACRTIMP __attribute__((dllimport))
|
|
|
|
# else
|
|
|
|
# define _ACRTIMP
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2019-08-09 15:31:52 +00:00
|
|
|
#define _ARGMAX 100
|
2020-02-20 18:27:41 +00:00
|
|
|
#define _CRT_INT_MAX 0x7fffffff
|
2019-08-09 15:31:52 +00:00
|
|
|
|
|
|
|
#ifndef _MSVCRT_LONG_DEFINED
|
|
|
|
#define _MSVCRT_LONG_DEFINED
|
|
|
|
/* we need 32-bit longs even on 64-bit */
|
2020-04-23 00:32:09 +00:00
|
|
|
#ifdef __LP64__
|
2019-08-09 15:31:52 +00:00
|
|
|
typedef int __msvcrt_long;
|
|
|
|
typedef unsigned int __msvcrt_ulong;
|
2020-04-23 00:32:09 +00:00
|
|
|
#else
|
|
|
|
typedef long __msvcrt_long;
|
|
|
|
typedef unsigned long __msvcrt_ulong;
|
|
|
|
#endif
|
2019-08-09 15:31:52 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _INTPTR_T_DEFINED
|
|
|
|
#ifdef _WIN64
|
|
|
|
typedef __int64 intptr_t;
|
|
|
|
#else
|
|
|
|
typedef int intptr_t;
|
|
|
|
#endif
|
|
|
|
#define _INTPTR_T_DEFINED
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _UINTPTR_T_DEFINED
|
|
|
|
#ifdef _WIN64
|
|
|
|
typedef unsigned __int64 uintptr_t;
|
|
|
|
#else
|
|
|
|
typedef unsigned int uintptr_t;
|
|
|
|
#endif
|
|
|
|
#define _UINTPTR_T_DEFINED
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _PTRDIFF_T_DEFINED
|
|
|
|
#ifdef _WIN64
|
|
|
|
typedef __int64 ptrdiff_t;
|
|
|
|
#else
|
|
|
|
typedef int ptrdiff_t;
|
|
|
|
#endif
|
|
|
|
#define _PTRDIFF_T_DEFINED
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _SIZE_T_DEFINED
|
|
|
|
#ifdef _WIN64
|
|
|
|
typedef unsigned __int64 size_t;
|
|
|
|
#else
|
|
|
|
typedef unsigned int size_t;
|
|
|
|
#endif
|
|
|
|
#define _SIZE_T_DEFINED
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _TIME32_T_DEFINED
|
|
|
|
typedef __msvcrt_long __time32_t;
|
|
|
|
#define _TIME32_T_DEFINED
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _TIME64_T_DEFINED
|
|
|
|
typedef __int64 DECLSPEC_ALIGN(8) __time64_t;
|
|
|
|
#define _TIME64_T_DEFINED
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef _USE_32BIT_TIME_T
|
|
|
|
# ifdef _WIN64
|
|
|
|
# error You cannot use 32-bit time_t in Win64
|
|
|
|
# endif
|
|
|
|
#elif !defined(_WIN64)
|
|
|
|
# define _USE_32BIT_TIME_T
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _TIME_T_DEFINED
|
|
|
|
#ifdef _USE_32BIT_TIME_T
|
|
|
|
typedef __time32_t time_t;
|
|
|
|
#else
|
|
|
|
typedef __time64_t time_t;
|
|
|
|
#endif
|
|
|
|
#define _TIME_T_DEFINED
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _WCHAR_T_DEFINED
|
|
|
|
#ifndef __cplusplus
|
|
|
|
typedef unsigned short wchar_t;
|
|
|
|
#endif
|
|
|
|
#define _WCHAR_T_DEFINED
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _WCTYPE_T_DEFINED
|
|
|
|
typedef unsigned short wint_t;
|
|
|
|
typedef unsigned short wctype_t;
|
|
|
|
#define _WCTYPE_T_DEFINED
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _ERRNO_T_DEFINED
|
|
|
|
typedef int errno_t;
|
|
|
|
#define _ERRNO_T_DEFINED
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct threadlocaleinfostruct;
|
|
|
|
struct threadmbcinfostruct;
|
|
|
|
typedef struct threadlocaleinfostruct *pthreadlocinfo;
|
|
|
|
typedef struct threadmbcinfostruct *pthreadmbcinfo;
|
|
|
|
|
|
|
|
typedef struct localeinfo_struct
|
|
|
|
{
|
|
|
|
pthreadlocinfo locinfo;
|
|
|
|
pthreadmbcinfo mbcinfo;
|
|
|
|
} _locale_tstruct, *_locale_t;
|
|
|
|
|
|
|
|
#ifndef _TAGLC_ID_DEFINED
|
|
|
|
typedef struct tagLC_ID {
|
|
|
|
unsigned short wLanguage;
|
|
|
|
unsigned short wCountry;
|
|
|
|
unsigned short wCodePage;
|
|
|
|
} LC_ID, *LPLC_ID;
|
|
|
|
#define _TAGLC_ID_DEFINED
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _THREADLOCALEINFO
|
|
|
|
typedef struct threadlocaleinfostruct {
|
2020-11-26 18:19:09 +00:00
|
|
|
#if _MSVCR_VER >= 140
|
|
|
|
unsigned short *pctype;
|
|
|
|
int mb_cur_max;
|
|
|
|
unsigned int lc_codepage;
|
|
|
|
#endif
|
|
|
|
|
2019-08-09 15:31:52 +00:00
|
|
|
int refcount;
|
2020-11-26 18:19:09 +00:00
|
|
|
#if _MSVCR_VER < 140
|
2019-08-09 15:31:52 +00:00
|
|
|
unsigned int lc_codepage;
|
2020-11-26 18:19:09 +00:00
|
|
|
#endif
|
2019-08-09 15:31:52 +00:00
|
|
|
unsigned int lc_collate_cp;
|
|
|
|
__msvcrt_ulong lc_handle[6];
|
|
|
|
LC_ID lc_id[6];
|
|
|
|
struct {
|
|
|
|
char *locale;
|
|
|
|
wchar_t *wlocale;
|
|
|
|
int *refcount;
|
|
|
|
int *wrefcount;
|
|
|
|
} lc_category[6];
|
|
|
|
int lc_clike;
|
2020-11-26 18:19:09 +00:00
|
|
|
#if _MSVCR_VER < 140
|
2019-08-09 15:31:52 +00:00
|
|
|
int mb_cur_max;
|
2020-11-26 18:19:09 +00:00
|
|
|
#endif
|
2019-08-09 15:31:52 +00:00
|
|
|
int *lconv_intl_refcount;
|
|
|
|
int *lconv_num_refcount;
|
|
|
|
int *lconv_mon_refcount;
|
|
|
|
struct lconv *lconv;
|
|
|
|
int *ctype1_refcount;
|
|
|
|
unsigned short *ctype1;
|
2020-11-26 18:19:09 +00:00
|
|
|
#if _MSVCR_VER < 140
|
|
|
|
unsigned short *pctype;
|
|
|
|
#endif
|
2019-08-09 15:31:52 +00:00
|
|
|
const unsigned char *pclmap;
|
|
|
|
const unsigned char *pcumap;
|
|
|
|
struct __lc_time_data *lc_time_curr;
|
2020-11-26 18:19:09 +00:00
|
|
|
#if _MSVCR_VER >= 110
|
|
|
|
wchar_t *lc_name[6];
|
|
|
|
#endif
|
2019-08-09 15:31:52 +00:00
|
|
|
} threadlocinfo;
|
|
|
|
#define _THREADLOCALEINFO
|
|
|
|
#endif
|
|
|
|
|
2023-06-12 10:06:33 +00:00
|
|
|
#ifdef __MINGW32__
|
2022-01-31 13:13:15 +00:00
|
|
|
#define __WINE_CRT_PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args)))
|
|
|
|
#define __WINE_CRT_SCANF_ATTR(fmt,args) __attribute__((format (scanf,fmt,args)))
|
|
|
|
#else
|
|
|
|
#define __WINE_CRT_PRINTF_ATTR(fmt,args)
|
|
|
|
#define __WINE_CRT_SCANF_ATTR(fmt,args)
|
|
|
|
#endif
|
|
|
|
|
2022-12-05 19:40:00 +00:00
|
|
|
#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
|
|
|
|
#define __WINE_ALLOC_SIZE(...) __attribute__((__alloc_size__(__VA_ARGS__)))
|
|
|
|
#else
|
|
|
|
#define __WINE_ALLOC_SIZE(...)
|
|
|
|
#endif
|
|
|
|
|
2022-12-05 19:36:31 +00:00
|
|
|
#if defined(__GNUC__) && (__GNUC__ > 10)
|
|
|
|
#define __WINE_DEALLOC(...) __attribute__((malloc (__VA_ARGS__)))
|
|
|
|
#else
|
|
|
|
#define __WINE_DEALLOC(...)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(__GNUC__) && (__GNUC__ > 2)
|
|
|
|
#define __WINE_MALLOC __attribute__((malloc))
|
|
|
|
#else
|
|
|
|
#define __WINE_MALLOC
|
|
|
|
#endif
|
|
|
|
|
2019-08-09 15:31:52 +00:00
|
|
|
#endif /* __WINE_CORECRT_H */
|