Create a branch for Aleksandar Andrejevic for his work on NTVDM. See http://jira.reactos.org/browse/CORE-7250 for more details.

svn path=/branches/ntvdm/; revision=59241
This commit is contained in:
Hermès Bélusca-Maïto 2013-06-16 22:01:41 +00:00
parent 3e3200acef
commit 4f0b8d3db0
20620 changed files with 0 additions and 1232833 deletions

View file

@ -0,0 +1,17 @@
#ifndef __CRT_INTERNAL_ATEXIT_H
#define __CRT_INTERNAL_ATEXIT_H
#ifndef _CRT_PRECOMP_H
#error DO NOT INCLUDE THIS HEADER DIRECTLY
#endif
#define LOCK_EXIT _mlock(_EXIT_LOCK1)
#define UNLOCK_EXIT _munlock(_EXIT_LOCK1)
extern _onexit_t *atexit_table;
extern int atexit_table_size;
extern int atexit_registered; /* Points to free slot */
void __call_atexit(void);
#endif

View file

@ -0,0 +1,16 @@
/* console.h */
#ifndef __CRT_INTERNAL_CONSOLE_H
#define __CRT_INTERNAL_CONSOLE_H
#ifndef _CRT_PRECOMP_H
#error DO NOT INCLUDE THIS HEADER DIRECTLY
#endif
extern int char_avail;
extern int ungot_char;
#endif
/* EOF */

View file

@ -0,0 +1,25 @@
#ifndef __CRT_INTERNAL_IEEE_H
#define __CRT_INTERNAL_IEEE_H
typedef struct {
unsigned int mantissa:23;
unsigned int exponent:8;
unsigned int sign:1;
} float_s;
typedef struct {
unsigned int mantissal:32;
unsigned int mantissah:20;
unsigned int exponent:11;
unsigned int sign:1;
} double_s;
typedef struct {
unsigned int mantissal:32;
unsigned int mantissah:32;
unsigned int exponent:15;
unsigned int sign:1;
unsigned int empty:16;
} long_double_s;
#endif

View file

@ -0,0 +1,111 @@
#ifndef __CRT_INTERNAL_LOCALE_H
#define __CRT_INTERNAL_LOCALE_H
typedef struct MSVCRT_threadlocaleinfostruct {
LONG refcount;
unsigned int lc_codepage;
unsigned int lc_collate_cp;
unsigned long lc_handle[6];
LC_ID lc_id[6];
struct {
char *locale;
wchar_t *wlocale;
int *refcount;
int *wrefcount;
} lc_category[6];
int lc_clike;
int mb_cur_max;
int *lconv_intl_refcount;
int *lconv_num_refcount;
int *lconv_mon_refcount;
struct MSVCRT_lconv *lconv;
int *ctype1_refcount;
unsigned short *ctype1;
const unsigned short *pctype;
unsigned char *pclmap;
unsigned char *pcumap;
struct __lc_time_data *lc_time_curr;
} MSVCRT_threadlocinfo;
typedef struct MSVCRT_threadmbcinfostruct {
LONG refcount;
int mbcodepage;
int ismbcodepage;
int mblcid;
unsigned short mbulinfo[6];
unsigned char mbctype[257];
char mbcasemap[256];
} MSVCRT_threadmbcinfo;
struct MSVCRT_lconv {
char* decimal_point;
char* thousands_sep;
char* grouping;
char* int_curr_symbol;
char* currency_symbol;
char* mon_decimal_point;
char* mon_thousands_sep;
char* mon_grouping;
char* positive_sign;
char* negative_sign;
char int_frac_digits;
char frac_digits;
char p_cs_precedes;
char p_sep_by_space;
char n_cs_precedes;
char n_sep_by_space;
char p_sign_posn;
char n_sign_posn;
};
typedef struct MSVCRT_threadlocaleinfostruct *MSVCRT_pthreadlocinfo;
typedef struct MSVCRT_threadmbcinfostruct *MSVCRT_pthreadmbcinfo;
typedef struct MSVCRT_localeinfo_struct
{
MSVCRT_pthreadlocinfo locinfo;
MSVCRT_pthreadmbcinfo mbcinfo;
} MSVCRT__locale_tstruct, *MSVCRT__locale_t;
typedef struct __lc_time_data {
union {
char *str[43];
struct {
char *short_wday[7];
char *wday[7];
char *short_mon[12];
char *mon[12];
char *am;
char *pm;
char *short_date;
char *date;
char *time;
} names;
} str;
LCID lcid;
int unk[2];
wchar_t *wstr[43];
char data[1];
} MSVCRT___lc_time_data;
int _setmbcp_l(int, LCID, MSVCRT_pthreadmbcinfo) DECLSPEC_HIDDEN;
MSVCRT_pthreadmbcinfo get_mbcinfo(void) DECLSPEC_HIDDEN;
LCID MSVCRT_locale_to_LCID(const char*, unsigned short*) DECLSPEC_HIDDEN;
void __init_global_locale();
extern MSVCRT__locale_t global_locale;
#define MSVCRT_locale __get_MSVCRT_locale()
FORCEINLINE MSVCRT__locale_t __get_MSVCRT_locale()
{
if(!global_locale)
__init_global_locale();
return global_locale;
}
MSVCRT_pthreadlocinfo get_locinfo(void);
void __cdecl MSVCRT__free_locale(MSVCRT__locale_t);
void free_locinfo(MSVCRT_pthreadlocinfo);
void free_mbcinfo(MSVCRT_pthreadmbcinfo);
#endif //__CRT_INTERNAL_LOCALE_H

View file

@ -0,0 +1,26 @@
#ifndef __CRT_INTERNAL_MATH_H
#define __CRT_INTERNAL_MATH_H
#ifndef _CRT_PRECOMP_H
#error DO NOT INCLUDE THIS HEADER DIRECTLY
#endif
int _isinf (double); /* not exported */
int _isnanl (long double); /* not exported */
int _isinfl (long double); /* not exported */
#if defined(__GNUC__)
#define FPU_DOUBLE(var) double var; \
__asm__ __volatile__( "fstpl %0;fwait" : "=m" (var) : )
#define FPU_DOUBLES(var1,var2) double var1,var2; \
__asm__ __volatile__( "fstpl %0;fwait" : "=m" (var2) : ); \
__asm__ __volatile__( "fstpl %0;fwait" : "=m" (var1) : )
#elif defined(_MSC_VER)
#define FPU_DOUBLE(var) double var; \
__asm { fstp [var] }; __asm { fwait };
#define FPU_DOUBLES(var1,var2) double var1,var2; \
__asm { fstp [var1] }; __asm { fwait }; \
__asm { fstp [var2] }; __asm { fwait };
#endif
#endif

View file

@ -0,0 +1,60 @@
#ifndef __CRT_INTERNAL_MBSTRING_H
#define __CRT_INTERNAL_MBSTRING_H
#define _MALPHA 0x01
#define _MBLANK 0x02
#define _MDIGIT 0x04
#define _MKMOJI 0x08
#define _MKPNCT 0x10
#define _MLEAD 0x20
#define _MPUNCT 0x40
#define _MTRAIL 0x80
#define _MBALNUM (_MALPHA | _MDIGIT | _MKPNCT | _MKMOJI)
#define _MBALPHA (_MALPHA | _MKPNCT | _MKMOJI)
#define _MBGRAPH (_MALPHA | _MDIGIT | _MPUNCT | _MKPNCT | _MKMOJI)
#define _MBKANA (_MKPNCT | _MKMOJI)
#define _MBPRINT (_MALPHA | _MDIGIT | _MPUNCT | _MBLANK | _MKPNCT | _MKMOJI)
#define _MBPUNCT (_MPUNCT | _MKPNCT)
#define _MBLMASK(c) ((c) & 255)
#define _MBHMASK(c) ((c) & ~255)
#define _MBGETL(c) ((c) & 255)
#define _MBGETH(c) (((c) >> 8) & 255)
#define _MBIS16(c) ((c) & 0xff00)
/* Macros */
#define B _MBLANK
#define D _MDIGIT
#define P _MPUNCT
#define T _MTRAIL
/* Macros */
#define AT (_MALPHA | _MTRAIL)
#define GT (_MKPNCT | _MTRAIL)
#define KT (_MKMOJI | _MTRAIL)
#define LT (_MLEAD | _MTRAIL)
#define PT (_MPUNCT | _MTRAIL)
#define MAX_LOCALE_LENGTH 256
extern unsigned char _mbctype[257];
extern char MSVCRT_current_lc_all[MAX_LOCALE_LENGTH];
#if defined (_MSC_VER)
#undef _ismbbkana
#undef _ismbbkpunct
#undef _ismbbalpha
#undef _ismbbalnum
#undef _ismbbgraph
#undef _ismbbkalnum
#undef _ismbblead
#undef _ismbbprint
#undef _ismbbpunct
#undef _ismbbtrail
#endif
#endif

View file

@ -0,0 +1,197 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#ifndef _INC_INTERNAL
#define _INC_INTERNAL
#include <crtdefs.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <stdarg.h>
#include <limits.h>
#include <windef.h>
#include <winbase.h>
#ifdef __REACTOS__
#include "malloc.h"
struct _exception;
__declspec(dllimport) void __setusermatherr(int (__cdecl *)(struct _exception *));
#define __mingw_fprintf fprintf
#define __mingw_vfprintf vfprintf
#endif
#pragma pack(push,_CRT_PACKING)
#ifndef __INTERNAL_FUNC_DEFINED
#define __INTERNAL_FUNC_DEFINED
typedef void (__cdecl *_PVFV)(void);
typedef int (__cdecl *_PIFV)(void);
typedef void (__cdecl *_PVFI)(int);
#endif
#if defined (SPECIAL_CRTEXE) && (defined (_DLL) || defined (__GNUC__))
extern int _commode;
#else
_CRTIMP extern int _commode;
#endif
#define __IOINFO_TM_ANSI 0
#define __IOINFO_TM_UTF8 1
#define __IOINFO_TM_UTF16LE 2
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4214)
#pragma warning(disable:4820)
#endif
typedef struct {
intptr_t osfhnd;
char osfile;
char pipech;
int lockinitflag;
CRITICAL_SECTION lock;
char textmode : 7;
char unicode : 1;
char pipech2[2];
} ioinfo;
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#define IOINFO_ARRAY_ELTS (1 << 5)
#define _pioinfo(i) (__pioinfo[(i) >> 5] + ((i) & (IOINFO_ARRAY_ELTS - 1)))
#define _osfile(i) (_pioinfo(i)->osfile)
#define _pipech2(i) (_pioinfo(i)->pipech2)
#define _textmode(i) (_pioinfo(i)->textmode)
#define _tm_unicode(i) (_pioinfo(i)->unicode)
#define _pioinfo_safe(i) ((((i) != -1) && ((i) != -2)) ? _pioinfo(i) : &__badioinfo)
#define _osfhnd_safe(i) (_pioinfo_safe(i)->osfhnd)
#define _osfile_safe(i) (_pioinfo_safe(i)->osfile)
#define _pipech_safe(i) (_pioinfo_safe(i)->pipech)
#define _pipech2_safe(i) (_pioinfo_safe(i)->pipech2)
#define _textmode_safe(i) (_pioinfo_safe(i)->textmode)
#define _tm_unicode_safe(i) (_pioinfo_safe(i)->unicode)
#ifndef __badioinfo
extern ioinfo ** __MINGW_IMP_SYMBOL(__badioinfo)[];
#define __badioinfo (* __MINGW_IMP_SYMBOL(__badioinfo))
#endif
#ifndef __pioinfo
extern ioinfo ** __MINGW_IMP_SYMBOL(__pioinfo)[];
#define __pioinfo (* __MINGW_IMP_SYMBOL(__pioinfo))
#endif
#define _NO_CONSOLE_FILENO (intptr_t)-2
#ifndef _FILE_DEFINED
#define _FILE_DEFINED
struct _iobuf {
char *_ptr;
int _cnt;
char *_base;
int _flag;
int _file;
int _charbuf;
int _bufsiz;
char *_tmpfname;
};
typedef struct _iobuf FILE;
#endif
#if !defined (_FILEX_DEFINED) && defined (_WINDOWS_)
#define _FILEX_DEFINED
typedef struct {
FILE f;
CRITICAL_SECTION lock;
} _FILEX;
#endif
extern int _dowildcard;
extern int _newmode;
#ifndef __winitenv
extern wchar_t *** __MINGW_IMP_SYMBOL(__winitenv);
#define __winitenv (* __MINGW_IMP_SYMBOL(__winitenv))
#endif
#ifndef __initenv
extern char *** __MINGW_IMP_SYMBOL(__initenv);
#define __initenv (* __MINGW_IMP_SYMBOL(__initenv))
#endif
#ifndef _acmdln
extern char ** __MINGW_IMP_SYMBOL(_acmdln);
#define _acmdln (* __MINGW_IMP_SYMBOL(_acmdln))
/* _CRTIMP extern char *_acmdln; */
#endif
#ifndef _wcmdln
extern char ** __MINGW_IMP_SYMBOL(_wcmdln);
#define _wcmdln (* __MINGW_IMP_SYMBOL(_wcmdln))
/* __CRTIMP extern wchar_t *_wcmdln; */
#endif
_CRTIMP __declspec(noreturn) void __cdecl _amsg_exit(int);
int __CRTDECL _setargv(void);
int __CRTDECL __setargv(void);
int __CRTDECL _wsetargv(void);
int __CRTDECL __wsetargv(void);
int __CRTDECL main(int _Argc, char **_Argv, char **_Env);
int __CRTDECL wmain(int _Argc, wchar_t **_Argv, wchar_t **_Env);
#ifndef _STARTUP_INFO_DEFINED
#define _STARTUP_INFO_DEFINED
typedef struct {
int newmode;
} _startupinfo;
#endif
_CRTIMP int __cdecl __getmainargs(int * _Argc, char *** _Argv, char ***_Env, int _DoWildCard, _startupinfo *_StartInfo);
_CRTIMP int __cdecl __wgetmainargs(int * _Argc, wchar_t ***_Argv, wchar_t ***_Env, int _DoWildCard, _startupinfo *_StartInfo);
#define _CONSOLE_APP 1
#define _GUI_APP 2
typedef enum __enative_startup_state {
__uninitialized = 0, __initializing, __initialized
} __enative_startup_state;
extern volatile __enative_startup_state __native_startup_state;
extern volatile void *__native_startup_lock;
extern volatile unsigned int __native_dllmain_reason;
extern volatile unsigned int __native_vcclrit_reason;
_CRTIMP void __cdecl __set_app_type (int);
typedef LONG NTSTATUS;
#include <crtdbg.h>
#include <errno.h>
void * __cdecl _encode_pointer(void *);
void * __cdecl _encoded_null();
void * __cdecl _decode_pointer(void *);
BOOL __cdecl _ValidateImageBase (PBYTE pImageBase);
PIMAGE_SECTION_HEADER __cdecl _FindPESection (PBYTE pImageBase, DWORD_PTR rva);
BOOL __cdecl _IsNonwritableInCurrentImage (PBYTE pTarget);
#ifdef __cplusplus
}
#endif
#pragma pack(pop)
#endif

View file

@ -0,0 +1,64 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#ifndef _INC_OSCALLS
#define _INC_OSCALLS
#ifndef _CRTBLD
#error ERROR: Use of C runtime library internal header file.
#endif
#include <crtdefs.h>
#ifdef NULL
#undef NULL
#endif
#define NOMINMAX
#define _WIN32_FUSION 0x0100
//#include <windows.h>
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winuser.h>
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4214)
#endif
typedef struct _FTIME
{
unsigned short twosecs : 5;
unsigned short minutes : 6;
unsigned short hours : 5;
} FTIME;
typedef FTIME *PFTIME;
typedef struct _FDATE
{
unsigned short day : 5;
unsigned short month : 4;
unsigned short year : 7;
} FDATE;
#ifdef _MSC_VER
#pragma warning(pop)
#endif
typedef FDATE *PFDATE;
#endif

View file

@ -0,0 +1,72 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#if defined(_MSC_VER)
#if defined(_M_IA64) || defined(_M_AMD64)
#define _ATTRIBUTES read
#else
#define _ATTRIBUTES read
#endif
/* Reference list of existing section for msvcrt. */
#pragma section(".CRTMP$XCA",long,_ATTRIBUTES)
#pragma section(".CRTMP$XCZ",long,_ATTRIBUTES)
#pragma section(".CRTMP$XIA",long,_ATTRIBUTES)
#pragma section(".CRTMP$XIZ",long,_ATTRIBUTES)
#pragma section(".CRTMA$XCA",long,_ATTRIBUTES)
#pragma section(".CRTMA$XCZ",long,_ATTRIBUTES)
#pragma section(".CRTMA$XIA",long,_ATTRIBUTES)
#pragma section(".CRTMA$XIZ",long,_ATTRIBUTES)
#pragma section(".CRTVT$XCA",long,_ATTRIBUTES)
#pragma section(".CRTVT$XCZ",long,_ATTRIBUTES)
#pragma section(".CRT$XCA",long,_ATTRIBUTES)
#pragma section(".CRT$XCAA",long,_ATTRIBUTES)
#pragma section(".CRT$XCC",long,_ATTRIBUTES)
#pragma section(".CRT$XCZ",long,_ATTRIBUTES)
#pragma section(".CRT$XDA",long,_ATTRIBUTES)
#pragma section(".CRT$XDC",long,_ATTRIBUTES)
#pragma section(".CRT$XDZ",long,_ATTRIBUTES)
#pragma section(".CRT$XIA",long,_ATTRIBUTES)
#pragma section(".CRT$XIAA",long,_ATTRIBUTES)
#pragma section(".CRT$XIC",long,_ATTRIBUTES)
#pragma section(".CRT$XID",long,_ATTRIBUTES)
#pragma section(".CRT$XIY",long,_ATTRIBUTES)
#pragma section(".CRT$XIZ",long,_ATTRIBUTES)
#pragma section(".CRT$XLA",long,_ATTRIBUTES)
#pragma section(".CRT$XLC",long,_ATTRIBUTES)
#pragma section(".CRT$XLD",long,_ATTRIBUTES)
#pragma section(".CRT$XLZ",long,_ATTRIBUTES)
#pragma section(".CRT$XPA",long,_ATTRIBUTES)
#pragma section(".CRT$XPX",long,_ATTRIBUTES)
#pragma section(".CRT$XPXA",long,_ATTRIBUTES)
#pragma section(".CRT$XPZ",long,_ATTRIBUTES)
#pragma section(".CRT$XTA",long,_ATTRIBUTES)
#pragma section(".CRT$XTB",long,_ATTRIBUTES)
#pragma section(".CRT$XTX",long,_ATTRIBUTES)
#pragma section(".CRT$XTZ",long,_ATTRIBUTES)
#pragma section(".rdata$T",long,read)
#pragma section(".rtc$IAA",long,read)
#pragma section(".rtc$IZZ",long,read)
#pragma section(".rtc$TAA",long,read)
#pragma section(".rtc$TZZ",long,read)
/* for tlssup.c: */
#pragma section(".tls",long,read,write)
#pragma section(".tls$AAA",long,read,write)
#pragma section(".tls$ZZZ",long,read,write)
#endif /* _MSC_VER */
#if defined(_MSC_VER)
#define _CRTALLOC(x) __declspec(allocate(x))
#elif defined(__GNUC__)
#define _CRTALLOC(x) __attribute__ ((section (x) ))
#else
#error Your compiler is not supported.
#endif

View file

@ -0,0 +1,14 @@
extern int msvcrt_error_mode;
extern int __app_type;
#define _UNKNOWN_APP 0
#define _CONSOLE_APP 1
#define _GUI_APP 2
int
__cdecl
__crt_MessageBoxA (
_In_opt_ const char *pszText,
_In_ unsigned int uType);

View file

@ -0,0 +1,72 @@
/*
* Copyright (c) 2002, TransGaming Technologies Inc.
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __CRT_INTERNAL_WINE_MTDLL_H
#define __CRT_INTERNAL_WINE_MTDLL_H
#if defined(_MT)
#define _mlock(locknum) _lock(locknum)
#define _munlock(locknum) _unlock(locknum)
void _unlock( int locknum );
void _lock( int locknum );
#else
#define _mlock(locknum) do {} while(0)
#define _munlock(locknum) do {} while(0)
#endif
#define _SIGNAL_LOCK 1
#define _IOB_SCAN_LOCK 2
#define _TMPNAM_LOCK 3
#define _INPUT_LOCK 4
#define _OUTPUT_LOCK 5
#define _CSCANF_LOCK 6
#define _CPRINTF_LOCK 7
#define _CONIO_LOCK 8
#define _HEAP_LOCK 9
#define _BHEAP_LOCK 10 /* No longer used? */
#define _TIME_LOCK 11
#define _ENV_LOCK 12
#define _EXIT_LOCK1 13
#define _EXIT_LOCK2 14
#define _THREADDATA_LOCK 15 /* No longer used? */
#define _POPEN_LOCK 16
#define _LOCKTAB_LOCK 17
#define _OSFHND_LOCK 18
#define _SETLOCALE_LOCK 19
#define _LC_COLLATE_LOCK 20 /* No longer used? */
#define _LC_CTYPE_LOCK 21 /* No longer used? */
#define _LC_MONETARY_LOCK 22 /* No longer used? */
#define _LC_NUMERIC_LOCK 23 /* No longer used? */
#define _LC_TIME_LOCK 24 /* No longer used? */
#define _MB_CP_LOCK 25
#define _NLG_LOCK 26
#define _TYPEINFO_LOCK 27
#define _STREAM_LOCKS 28
/* Must match definition in msvcrt/stdio.h */
#define _IOB_ENTRIES 20
#define _LAST_STREAM_LOCK (_STREAM_LOCKS+_IOB_ENTRIES-1)
#define _TOTAL_LOCKS (_LAST_STREAM_LOCK+1)
#endif /* WINE_MTDLL_H */

View file

@ -0,0 +1,33 @@
/* rterror.h */
#ifndef __CRT_INTERNAL_RTERROR_H
#define __CRT_INTERNAL_RTERROR_H
#define _RT_STACK 0 /* stack overflow */
#define _RT_NULLPTR 1 /* null pointer assignment */
#define _RT_FLOAT 2 /* floating point not loaded */
#define _RT_INTDIV 3 /* integer divide by 0 */
#define _RT_SPACEARG 4 /* not enough space for arguments */
#define _RT_SPACEENV 5 /* not enough space for environment */
#define _RT_ABORT 6 /* abnormal program termination */
#define _RT_THREAD 7 /* not enough space for thread data */
#define _RT_LOCK 8 /* unexpected multi-thread lock error */
#define _RT_HEAP 9 /* unexpected heap error */
#define _RT_OPENCON 10 /* unable to open console device */
#define _RT_NONCONT 11 /* non-continuable exception */
#define _RT_INVALDISP 12 /* invalid disposition of exception */
#define _RT_ONEXIT 13 /* insufficient heap to allocate
* initial table of function pointers
* used by _onexit()/atexit(). */
#define _RT_PUREVIRT 14 /* pure virtual function call attempted
* (C++ error) */
#define _RT_STDIOINIT 15 /* not enough space for stdio initialization */
#define _RT_LOWIOINIT 16 /* not enough space for lowio initialization */
__declspec(noreturn) void _amsg_exit (int errnum);
/* not in any other header */
void _dosmaperr(unsigned long oserrcode);
#endif /* __MSVCRT_INTERNAL_RTERROR_H */

View file

@ -0,0 +1,20 @@
#include <errno.h>
extern void * __pInvalidArgHandler;
void _invalid_parameter(
const wchar_t * expression,
const wchar_t * function,
const wchar_t * file,
unsigned int line,
uintptr_t pReserved);
#ifndef _LIBCNT_
#define MSVCRT_INVALID_PMT(x) _invalid_parameter(NULL, NULL, NULL, 0, 0)
#define MSVCRT_CHECK_PMT(x) ((x) || (MSVCRT_INVALID_PMT(0),0))
#else
/* disable secure crt parameter checks */
#define MSVCRT_CHECK_PMT
#define MSVCRT_INVALID_PMT
#endif

View file

@ -0,0 +1,55 @@
#define DIFFTIME 0x19db1ded53e8000ULL
#define DIFFDAYS (3 * DAYSPER100YEARS + 17 * DAYSPER4YEARS + 1 * DAYSPERYEAR)
#define DAYSPERYEAR 365
#define DAYSPER4YEARS (4*DAYSPERYEAR+1)
#define DAYSPER100YEARS (25*DAYSPER4YEARS-1)
#define DAYSPER400YEARS (4*DAYSPER100YEARS+1)
#define SECONDSPERDAY (24*60*60)
#define SECONDSPERHOUR (60*60)
#define LEAPDAY 59
static __inline
__time64_t
FileTimeToUnixTime(const FILETIME *FileTime, USHORT *millitm)
{
ULARGE_INTEGER ULargeInt;
__time64_t time;
ULargeInt.LowPart = FileTime->dwLowDateTime;
ULargeInt.HighPart = FileTime->dwHighDateTime;
ULargeInt.QuadPart -= DIFFTIME;
time = ULargeInt.QuadPart / 10000000;
if (millitm)
*millitm = (USHORT)((ULargeInt.QuadPart % 10000000) / 10000);
return time;
}
static __inline
long leapyears_passed(long days)
{
long quadcenturies, centuries, quadyears;
quadcenturies = days / DAYSPER400YEARS;
days -= quadcenturies;
centuries = days / DAYSPER100YEARS;
days += centuries;
quadyears = days / DAYSPER4YEARS;
return quadyears - centuries + quadcenturies;
}
static __inline
long leapdays_passed(long days)
{
return leapyears_passed(days + DAYSPERYEAR - LEAPDAY + 1);
}
static __inline
long years_passed(long days)
{
return (days - leapdays_passed(days)) / 365;
}
extern long dst_begin;
extern long dst_end;

View file

@ -0,0 +1,69 @@
/* tls.h */
#ifndef __CRT_INTERNAL_TLS_H
#define __CRT_INTERNAL_TLS_H
#ifndef _CRT_PRECOMP_H
#error DO NOT INCLUDE THIS HEADER DIRECTLY
#endif
#include <stddef.h>
#include <time.h>
#include <locale.h>
#include <windef.h>
#include <winbase.h>
#include <winnt.h>
#include <internal/wine/eh.h>
/* TLS data */
extern DWORD tls_index;
struct __thread_data {
DWORD tid;
HANDLE handle;
int thread_errno;
unsigned long thread_doserrno;
int unk1;
unsigned int random_seed; /* seed for rand() */
char *strtok_next; /* next ptr for strtok() */
wchar_t *wcstok_next; /* next ptr for wcstok() */
unsigned char *mbstok_next; /* next ptr for mbstok() */
char *strerror_buffer; /* buffer for strerror */
wchar_t *wcserror_buffer; /* buffer for wcserror */
char *tmpnam_buffer; /* buffer for tmpname() */
wchar_t *wtmpnam_buffer; /* buffer for wtmpname() */
void *unk2[2];
char *asctime_buffer; /* buffer for asctime */
wchar_t *wasctime_buffer; /* buffer for wasctime */
struct tm *time_buffer; /* buffer for localtime/gmtime */
char *efcvt_buffer; /* buffer for ecvt/fcvt */
int unk3[2];
void *unk4[4];
int fpecode;
struct MSVCRT_threadmbcinfostruct *mbcinfo;
struct MSVCRT_threadlocaleinfostruct *locinfo;
BOOL have_locale;
int unk5[1];
terminate_function terminate_handler;
unexpected_function unexpected_handler;
_se_translator_function se_translator;
void *unk6[3];
int unk7;
EXCEPTION_RECORD *exc_record;
void *unk8[100];
};
typedef struct __thread_data thread_data_t;
extern inline BOOL msvcrt_init_tls(void);
extern inline BOOL msvcrt_free_tls(void);
extern thread_data_t *msvcrt_get_thread_data(void);
extern inline void msvcrt_free_tls_mem(void);
#define MSVCRT_ENABLE_PER_THREAD_LOCALE 1
#define MSVCRT_DISABLE_PER_THREAD_LOCALE 2
#endif /* __MSVCRT_INTERNAL_TLS_H */
/* EOF */

View file

@ -0,0 +1,183 @@
/*
* msvcrt C++ exception handling
*
* Copyright 2002 Alexandre Julliard
*
* 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 __MSVCRT_CPPEXCEPT_H
#define __MSVCRT_CPPEXCEPT_H
#include <pseh/pseh2.h>
#define CXX_FRAME_MAGIC_VC6 0x19930520
#define CXX_FRAME_MAGIC_VC7 0x19930521
#define CXX_FRAME_MAGIC_VC8 0x19930522
#define CXX_EXCEPTION 0xe06d7363
/* Macros to define assembler functions somewhat portably */
#define EH_NONCONTINUABLE 0x01
#define EH_UNWINDING 0x02
#define EH_EXIT_UNWIND 0x04
#define EH_STACK_INVALID 0x08
#define EH_NESTED_CALL 0x10
typedef void (*vtable_ptr)();
/* type_info object, see cpp.c for inplementation */
typedef struct __type_info
{
const vtable_ptr *vtable;
char *name; /* Unmangled name, allocated lazily */
char mangled[32]; /* Variable length, but we declare it large enough for static RTTI */
} type_info;
/* exception object */
typedef struct __exception
{
const vtable_ptr *vtable;
char *name; /* Name of this exception, always a new copy for each object */
int do_free; /* Whether to free 'name' in our dtor */
} exception;
/* the exception frame used by CxxFrameHandler */
typedef struct __cxx_exception_frame
{
EXCEPTION_REGISTRATION_RECORD frame; /* the standard exception frame */
int trylevel;
DWORD ebp;
} cxx_exception_frame;
/* info about a single catch {} block */
typedef struct __catchblock_info
{
UINT flags; /* flags (see below) */
const type_info *type_info; /* C++ type caught by this block */
int offset; /* stack offset to copy exception object to */
void (*handler)(void);/* catch block handler code */
} catchblock_info;
#define TYPE_FLAG_CONST 1
#define TYPE_FLAG_VOLATILE 2
#define TYPE_FLAG_REFERENCE 8
/* info about a single try {} block */
typedef struct __tryblock_info
{
int start_level; /* start trylevel of that block */
int end_level; /* end trylevel of that block */
int catch_level; /* initial trylevel of the catch block */
int catchblock_count; /* count of catch blocks in array */
const catchblock_info *catchblock; /* array of catch blocks */
} tryblock_info;
/* info about the unwind handler for a given trylevel */
typedef struct __unwind_info
{
int prev; /* prev trylevel unwind handler, to run after this one */
void (*handler)(void);/* unwind handler */
} unwind_info;
/* descriptor of all try blocks of a given function */
typedef struct __cxx_function_descr
{
UINT magic; /* must be CXX_FRAME_MAGIC */
UINT unwind_count; /* number of unwind handlers */
const unwind_info *unwind_table; /* array of unwind handlers */
UINT tryblock_count; /* number of try blocks */
const tryblock_info *tryblock; /* array of try blocks */
UINT ipmap_count;
const void *ipmap;
const void *expect_list; /* expected exceptions list when magic >= VC7 */
UINT flags; /* flags when magic >= VC8 */
} cxx_function_descr;
#define FUNC_DESCR_SYNCHRONOUS 1 /* synchronous exceptions only (built with /EHs) */
typedef void (*cxx_copy_ctor)(void);
/* offsets for computing the this pointer */
typedef struct
{
int this_offset; /* offset of base class this pointer from start of object */
int vbase_descr; /* offset of virtual base class descriptor */
int vbase_offset; /* offset of this pointer offset in virtual base class descriptor */
} this_ptr_offsets;
/* complete information about a C++ type */
typedef struct __cxx_type_info
{
UINT flags; /* flags (see CLASS_* flags below) */
const type_info *type_info; /* C++ type info */
this_ptr_offsets offsets; /* offsets for computing the this pointer */
unsigned int size; /* object size */
cxx_copy_ctor copy_ctor; /* copy constructor */
} cxx_type_info;
#define CLASS_IS_SIMPLE_TYPE 1
#define CLASS_HAS_VIRTUAL_BASE_CLASS 4
/* table of C++ types that apply for a given object */
typedef struct __cxx_type_info_table
{
UINT count; /* number of types */
const cxx_type_info *info[3]; /* variable length, we declare it large enough for static RTTI */
} cxx_type_info_table;
typedef DWORD (*cxx_exc_custom_handler)( PEXCEPTION_RECORD, cxx_exception_frame*,
PCONTEXT, EXCEPTION_REGISTRATION_RECORD**,
const cxx_function_descr*, int nested_trylevel,
EXCEPTION_REGISTRATION_RECORD *nested_frame, DWORD unknown3 );
/* type information for an exception object */
typedef struct __cxx_exception_type
{
UINT flags; /* TYPE_FLAG flags */
void (*destructor)(void);/* exception object destructor */
cxx_exc_custom_handler custom_handler; /* custom handler for this exception */
const cxx_type_info_table *type_info_table; /* list of types for this exception object */
} cxx_exception_type;
void WINAPI _CxxThrowException(exception*,const cxx_exception_type*);
int CDECL _XcptFilter(NTSTATUS, PEXCEPTION_POINTERS);
int CDECL __CppXcptFilter(NTSTATUS, PEXCEPTION_POINTERS);
static inline const char *dbgstr_type_info( const type_info *info )
{
if (!info) return "{}";
return wine_dbg_sprintf( "{vtable=%p name=%s (%s)}",
info->vtable, info->mangled, info->name ? info->name : "" );
}
/* compute the this pointer for a base class of a given type */
static inline void *get_this_pointer( const this_ptr_offsets *off, void *object )
{
void *this_ptr;
int *offset_ptr;
if (!object) return NULL;
this_ptr = (char *)object + off->this_offset;
if (off->vbase_descr >= 0)
{
/* move this ptr to vbase descriptor */
this_ptr = (char *)this_ptr + off->vbase_descr;
/* and fetch additional offset from vbase descriptor */
offset_ptr = (int *)(*(char **)this_ptr + off->vbase_offset);
this_ptr = (char *)this_ptr + *offset_ptr;
}
return this_ptr;
}
#endif /* __MSVCRT_CPPEXCEPT_H */

View file

@ -0,0 +1,53 @@
/*
* C++ exception handling facility
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __WINE_EH_H
#define __WINE_EH_H
#ifndef __WINE_USE_MSVCRT
#define __WINE_USE_MSVCRT
#endif
#if !defined(__cplusplus) && !defined(USE_MSVCRT_PREFIX)
#error "eh.h is meant only for C++ applications"
#endif
#ifndef MSVCRT
# ifdef USE_MSVCRT_PREFIX
# define MSVCRT(x) MSVCRT_##x
# else
# define MSVCRT(x) x
# endif
#endif
struct _EXCEPTION_POINTERS;
typedef void (*terminate_handler)();
typedef void (*terminate_function)();
typedef void (*unexpected_handler)();
typedef void (*unexpected_function)();
typedef void (*_se_translator_function)(unsigned int code, struct _EXCEPTION_POINTERS *info);
terminate_function MSVCRT(set_terminate)(terminate_function func);
unexpected_function MSVCRT(set_unexpected)(unexpected_function func);
_se_translator_function MSVCRT(_set_se_translator)(_se_translator_function func);
void MSVCRT(terminate)();
void MSVCRT(unexpected)();
#endif /* __WINE_EH_H */

View file

@ -0,0 +1,136 @@
/*
* Copyright 2001 Jon Griffiths
* Copyright 2004 Dimitrie O. Paun
*
* 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
*
* NOTES
* Naming conventions
* - Symbols are prefixed with MSVCRT_ if they conflict
* with libc symbols
* - Internal symbols are usually prefixed by msvcrt_.
* - Exported symbols that are not present in the public
* headers are usually kept the same as the original.
* Other conventions
* - To avoid conflicts with the standard C library,
* no msvcrt headers are included in the implementation.
* - Instead, symbols are duplicated here, prefixed with
* MSVCRT_, as explained above.
* - To avoid inconsistencies, a test for each symbol is
* added into tests/headers.c. Please always add a
* corresponding test when you add a new symbol!
*/
#ifndef __WINE_MSVCRT_H
#define __WINE_MSVCRT_H
#include <stdarg.h>
#include <signal.h>
#include "windef.h"
#include "winbase.h"
extern unsigned int __lc_codepage;
extern int __lc_collate_cp;
extern int __mb_cur_max;
extern const unsigned short _ctype [257];
void __cdecl _purecall(void);
__declspec(noreturn) void __cdecl _amsg_exit(int errnum);
extern char **_environ;
extern wchar_t **_wenviron;
extern char ** SnapshotOfEnvironmentA(char **);
extern wchar_t ** SnapshotOfEnvironmentW(wchar_t **);
/* Application type flags */
#define _UNKNOWN_APP 0
#define _CONSOLE_APP 1
#define _GUI_APP 2
/* I/O Streamming flags missing from stdio.h */
#define _IOYOURBUF 0x0100
#define _IOAPPEND 0x0200
#define _IOSETVBUF 0x0400
#define _IOFEOF 0x0800
#define _IOFLRTN 0x1000
#define _IOCTRLZ 0x2000
#define _IOCOMMIT 0x4000
#define _IOFREE 0x10000
//wchar_t *wstrdupa(const char *);
//
///* FIXME: This should be declared in new.h but it's not an extern "C" so
// * it would not be much use anyway. Even for Winelib applications.
// */
//int __cdecl _set_new_mode(int mode);
//
void* __cdecl MSVCRT_operator_new(size_t);
void __cdecl MSVCRT_operator_delete(void*);
typedef void* (__cdecl *malloc_func_t)(size_t);
typedef void (__cdecl *free_func_t)(void*);
extern char* __cdecl __unDName(char *,const char*,int,malloc_func_t,free_func_t,unsigned short int);
extern char* __cdecl __unDNameEx(char *,const char*,int,malloc_func_t,free_func_t,void *,unsigned short int);
/* Setup and teardown multi threaded locks */
extern void msvcrt_init_mt_locks(void);
extern void msvcrt_free_mt_locks(void);
extern BOOL msvcrt_init_locale(void);
extern void msvcrt_init_math(void);
extern void msvcrt_init_io(void);
extern void msvcrt_free_io(void);
extern void msvcrt_init_console(void);
extern void msvcrt_free_console(void);
extern void msvcrt_init_args(void);
extern void msvcrt_free_args(void);
extern void msvcrt_init_signals(void);
extern void msvcrt_free_signals(void);
extern unsigned create_io_inherit_block(WORD*, BYTE**);
/* _set_abort_behavior codes */
#define MSVCRT__WRITE_ABORT_MSG 1
#define MSVCRT__CALL_REPORTFAULT 2
#define MSVCRT_LC_ALL LC_ALL
#define MSVCRT_LC_COLLATE LC_COLLATE
#define MSVCRT_LC_CTYPE LC_CTYPE
#define MSVCRT_LC_MONETARY LC_MONETARY
#define MSVCRT_LC_NUMERIC LC_NUMERIC
#define MSVCRT_LC_TIME LC_TIME
#define MSVCRT_LC_MIN LC_MIN
#define MSVCRT_LC_MAX LC_MAX
#define MSVCRT__OUT_TO_DEFAULT 0
#define MSVCRT__OUT_TO_STDERR 1
#define MSVCRT__OUT_TO_MSGBOX 2
#define MSVCRT__REPORT_ERRMODE 3
typedef void (*float_handler)(int, int);
void _default_handler(int signal);
typedef struct _sig_element
{
int signal;
char *signame;
__p_sig_fn_t handler;
}sig_element;
#define MSVCRT_malloc malloc
#define MSVCRT_free free
char* _setlocale(int,const char*);
NTSYSAPI VOID NTAPI RtlAssert(PVOID FailedAssertion,PVOID FileName,ULONG LineNumber,PCHAR Message);
#endif /* __WINE_MSVCRT_H */

View file

@ -0,0 +1,50 @@
#define DEFINE_THISCALL_WRAPPER(func, args) \
void __declspec(naked) __thiscall_ ## func (void) \
{ \
__asm { pop eax } \
__asm { push ecx } \
__asm { push eax } \
__asm { jmp func } \
}
exception * __stdcall MSVCRT_exception_ctor(exception * _this, const char ** name);
exception * __stdcall MSVCRT_exception_ctor_noalloc(exception * _this, char ** name, int noalloc);
exception * __stdcall MSVCRT_exception_copy_ctor(exception * _this, const exception * rhs);
exception * __stdcall MSVCRT_exception_default_ctor(exception * _this);
void __stdcall MSVCRT_exception_dtor(exception * _this);
exception * __stdcall MSVCRT_exception_opequals(exception * _this, const exception * rhs);
void * __stdcall MSVCRT_exception_vector_dtor(exception * _this, unsigned int flags);
void * __stdcall MSVCRT_exception_scalar_dtor(exception * _this, unsigned int flags);
const char * __stdcall MSVCRT_what_exception(exception * _this);
bad_typeid * __stdcall MSVCRT_bad_typeid_copy_ctor(bad_typeid * _this, const bad_typeid * rhs);
bad_typeid * __stdcall MSVCRT_bad_typeid_ctor(bad_typeid * _this, const char * name);
bad_typeid * __stdcall MSVCRT_bad_typeid_default_ctor(bad_typeid * _this);
void __stdcall MSVCRT_bad_typeid_dtor(bad_typeid * _this);
bad_typeid * __stdcall MSVCRT_bad_typeid_opequals(bad_typeid * _this, const bad_typeid * rhs);
void * __stdcall MSVCRT_bad_typeid_vector_dtor(bad_typeid * _this, unsigned int flags);
void * __stdcall MSVCRT_bad_typeid_scalar_dtor(bad_typeid * _this, unsigned int flags);
__non_rtti_object * __stdcall MSVCRT___non_rtti_object_copy_ctor(__non_rtti_object * _this, const __non_rtti_object * rhs);
__non_rtti_object * __stdcall MSVCRT___non_rtti_object_ctor(__non_rtti_object * _this, const char * name);
void __stdcall MSVCRT___non_rtti_object_dtor(__non_rtti_object * _this);
__non_rtti_object * __stdcall MSVCRT___non_rtti_object_opequals(__non_rtti_object * _this, const __non_rtti_object *rhs);
void * __stdcall MSVCRT___non_rtti_object_vector_dtor(__non_rtti_object * _this, unsigned int flags);
void * __stdcall MSVCRT___non_rtti_object_scalar_dtor(__non_rtti_object * _this, unsigned int flags);
bad_cast * __stdcall MSVCRT_bad_cast_ctor(bad_cast * _this, const char ** name);
bad_cast * __stdcall MSVCRT_bad_cast_copy_ctor(bad_cast * _this, const bad_cast * rhs);
bad_cast * __stdcall MSVCRT_bad_cast_ctor_charptr(bad_cast * _this, const char * name);
bad_cast * __stdcall MSVCRT_bad_cast_default_ctor(bad_cast * _this);
void __stdcall MSVCRT_bad_cast_dtor(bad_cast * _this);
bad_cast * __stdcall MSVCRT_bad_cast_opequals(bad_cast * _this, const bad_cast * rhs);
void * __stdcall MSVCRT_bad_cast_vector_dtor(bad_cast * _this, unsigned int flags);
void * __stdcall MSVCRT_bad_cast_scalar_dtor(bad_cast * _this, unsigned int flags);
int __stdcall MSVCRT_type_info_opequals_equals(type_info * _this, const type_info * rhs);
int __stdcall MSVCRT_type_info_opnot_equals(type_info * _this, const type_info * rhs);
int __stdcall MSVCRT_type_info_before(type_info * _this, const type_info * rhs);
void __stdcall MSVCRT_type_info_dtor(type_info * _this);
const char * __stdcall MSVCRT_type_info_name(type_info * _this);
const char * __stdcall MSVCRT_type_info_raw_name(type_info * _this);
void * __stdcall MSVCRT_type_info_vector_dtor(type_info * _this, unsigned int flags);
#define __ASM_VTABLE(name,funcs)
//void *MSVCRT_ ## name ##_vtable[] =