mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 14:53:40 +00:00
[MINGW]
Update mingw library to mingw-w64 trunk (mingw-w64-src_20100325) svn path=/branches/ros-amd64-bringup/; revision=46537
This commit is contained in:
parent
b8a5d2b45c
commit
8236cf6a81
52 changed files with 659 additions and 585 deletions
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _INC_INTERNAL
|
#ifndef _INC_INTERNAL
|
||||||
|
@ -18,9 +18,12 @@ extern "C" {
|
||||||
|
|
||||||
#pragma pack(push,_CRT_PACKING)
|
#pragma pack(push,_CRT_PACKING)
|
||||||
|
|
||||||
|
#ifndef __INTERNAL_FUNC_DEFINED
|
||||||
|
#define __INTERNAL_FUNC_DEFINED
|
||||||
typedef void (__cdecl *_PVFV)(void);
|
typedef void (__cdecl *_PVFV)(void);
|
||||||
typedef int (__cdecl *_PIFV)(void);
|
typedef int (__cdecl *_PIFV)(void);
|
||||||
typedef void (__cdecl *_PVFI)(int);
|
typedef void (__cdecl *_PVFI)(int);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined (SPECIAL_CRTEXE) && (defined (_DLL) || defined (__GNUC__))
|
#if defined (SPECIAL_CRTEXE) && (defined (_DLL) || defined (__GNUC__))
|
||||||
extern int _commode;
|
extern int _commode;
|
||||||
|
@ -32,12 +35,6 @@ extern "C" {
|
||||||
#define __IOINFO_TM_UTF8 1
|
#define __IOINFO_TM_UTF8 1
|
||||||
#define __IOINFO_TM_UTF16LE 2
|
#define __IOINFO_TM_UTF16LE 2
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable:4214)
|
|
||||||
#pragma warning(disable:4820)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
intptr_t osfhnd;
|
intptr_t osfhnd;
|
||||||
char osfile;
|
char osfile;
|
||||||
|
@ -49,10 +46,6 @@ extern "C" {
|
||||||
char pipech2[2];
|
char pipech2[2];
|
||||||
} ioinfo;
|
} ioinfo;
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(pop)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define IOINFO_ARRAY_ELTS (1 << 5)
|
#define IOINFO_ARRAY_ELTS (1 << 5)
|
||||||
|
|
||||||
#define _pioinfo(i) (__pioinfo[(i) >> 5] + ((i) & (IOINFO_ARRAY_ELTS - 1)))
|
#define _pioinfo(i) (__pioinfo[(i) >> 5] + ((i) & (IOINFO_ARRAY_ELTS - 1)))
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _INC_OSCALLS
|
#ifndef _INC_OSCALLS
|
||||||
|
@ -30,11 +30,6 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable:4214)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct _FTIME
|
typedef struct _FTIME
|
||||||
{
|
{
|
||||||
unsigned short twosecs : 5;
|
unsigned short twosecs : 5;
|
||||||
|
@ -51,10 +46,6 @@ typedef struct _FDATE
|
||||||
unsigned short year : 7;
|
unsigned short year : 7;
|
||||||
} FDATE;
|
} FDATE;
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(pop)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef FDATE *PFDATE;
|
typedef FDATE *PFDATE;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined (__ia64__) || defined (__x86_64)
|
#if defined (__ia64__) || defined (__x86_64)
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
#define _ATTRIBUTES shared
|
#define _ATTRIBUTES shared
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if 0
|
||||||
/* Reference list of existing section for msvcrt. */
|
/* Reference list of existing section for msvcrt. */
|
||||||
#pragma section(".CRTMP$XCA",long,_ATTRIBUTES)
|
#pragma section(".CRTMP$XCA",long,_ATTRIBUTES)
|
||||||
#pragma section(".CRTMP$XCZ",long,_ATTRIBUTES)
|
#pragma section(".CRTMP$XCZ",long,_ATTRIBUTES)
|
||||||
|
@ -55,14 +55,6 @@
|
||||||
#pragma section(".rtc$IZZ",long,read)
|
#pragma section(".rtc$IZZ",long,read)
|
||||||
#pragma section(".rtc$TAA",long,read)
|
#pragma section(".rtc$TAA",long,read)
|
||||||
#pragma section(".rtc$TZZ",long,read)
|
#pragma section(".rtc$TZZ",long,read)
|
||||||
#pragma section(".tls",long,read,write)
|
|
||||||
#pragma section(".tls$ZZZ",long,read,write)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
#define _CRTALLOC(x) __declspec(allocate(x))
|
|
||||||
#elif defined(__GNUC__)
|
|
||||||
#define _CRTALLOC(x) __attribute__ ((section (x) ))
|
#define _CRTALLOC(x) __attribute__ ((section (x) ))
|
||||||
#else
|
|
||||||
#error
|
|
||||||
#endif
|
|
||||||
|
|
14
reactos/lib/3rdparty/mingw/CRT_fp10.c
vendored
14
reactos/lib/3rdparty/mingw/CRT_fp10.c
vendored
|
@ -1,22 +1,12 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void _fpreset (void);
|
void _fpreset (void);
|
||||||
|
|
||||||
void _fpreset (void)
|
void _fpreset (void)
|
||||||
{
|
{ __asm__ ("fninit" ) ;}
|
||||||
#ifdef __GNUC__
|
|
||||||
__asm__ ("fninit" );
|
|
||||||
#else
|
|
||||||
__asm fninit;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
void __attribute__ ((alias ("_fpreset"))) fpreset(void);
|
void __attribute__ ((alias ("_fpreset"))) fpreset(void);
|
||||||
#else
|
|
||||||
void fpreset(void) { _fpreset(); }
|
|
||||||
#endif
|
|
||||||
|
|
6
reactos/lib/3rdparty/mingw/CRT_fp8.c
vendored
6
reactos/lib/3rdparty/mingw/CRT_fp8.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <_mingw.h>
|
#include <_mingw.h>
|
||||||
|
@ -14,8 +14,4 @@ void _fpreset (void)
|
||||||
(* __MINGW_IMP_SYMBOL(_fpreset))();
|
(* __MINGW_IMP_SYMBOL(_fpreset))();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
void __attribute__ ((alias ("_fpreset"))) fpreset(void);
|
void __attribute__ ((alias ("_fpreset"))) fpreset(void);
|
||||||
#else
|
|
||||||
void fpreset(void) { _fpreset(); }
|
|
||||||
#endif
|
|
||||||
|
|
2
reactos/lib/3rdparty/mingw/CRT_glob.c
vendored
2
reactos/lib/3rdparty/mingw/CRT_glob.c
vendored
|
@ -2,7 +2,7 @@
|
||||||
* CRT_glob.c
|
* CRT_glob.c
|
||||||
* This file has no copyright is assigned and is placed in the Public Domain.
|
* This file has no copyright is assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within the package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within the package.
|
||||||
*
|
*
|
||||||
* Include this object file to set _dowildcard to a state that will turn on
|
* Include this object file to set _dowildcard to a state that will turn on
|
||||||
* command line globbing by default. (wildcard.o which goes into libmingw32.a
|
* command line globbing by default. (wildcard.o which goes into libmingw32.a
|
||||||
|
|
17
reactos/lib/3rdparty/mingw/CRT_noglob.c
vendored
Normal file
17
reactos/lib/3rdparty/mingw/CRT_noglob.c
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
/*
|
||||||
|
* CRT_noglob.c
|
||||||
|
* This file has no copyright is 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 the package.
|
||||||
|
*
|
||||||
|
* Include this object file to set _dowildcard to a state that will turn off
|
||||||
|
* command line globbing by default. (wildcard.o which goes into libmingw32.a
|
||||||
|
* has a default state of off if not configured with --enable-wildcard.)
|
||||||
|
*
|
||||||
|
* To use this object include the object file in your link command:
|
||||||
|
* gcc -o foo.exe foo.o CRT_noglob.o
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
int _dowildcard = 0;
|
||||||
|
|
2
reactos/lib/3rdparty/mingw/_newmode.c
vendored
2
reactos/lib/3rdparty/mingw/_newmode.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int _newmode = 0;
|
int _newmode = 0;
|
||||||
|
|
2
reactos/lib/3rdparty/mingw/atonexit.c
vendored
2
reactos/lib/3rdparty/mingw/atonexit.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#undef CRTDLL
|
#undef CRTDLL
|
||||||
|
|
2
reactos/lib/3rdparty/mingw/binmode.c
vendored
2
reactos/lib/3rdparty/mingw/binmode.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SPECIAL_CRTEXE
|
#define SPECIAL_CRTEXE
|
||||||
|
|
2
reactos/lib/3rdparty/mingw/charmax.c
vendored
2
reactos/lib/3rdparty/mingw/charmax.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sect_attribs.h>
|
#include <sect_attribs.h>
|
||||||
|
|
2
reactos/lib/3rdparty/mingw/crt0_c.c
vendored
2
reactos/lib/3rdparty/mingw/crt0_c.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
2
reactos/lib/3rdparty/mingw/crt0_w.c
vendored
2
reactos/lib/3rdparty/mingw/crt0_w.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
|
14
reactos/lib/3rdparty/mingw/crt_handler.c
vendored
14
reactos/lib/3rdparty/mingw/crt_handler.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -13,6 +13,14 @@
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#if defined (_WIN64) && defined (__ia64__)
|
||||||
|
#error FIXME: Unsupported __ImageBase implementation.
|
||||||
|
#else
|
||||||
|
#define __ImageBase __MINGW_LSYMBOL(_image_base__)
|
||||||
|
/* This symbol is defined by the linker. */
|
||||||
|
extern IMAGE_DOS_HEADER __ImageBase;
|
||||||
|
#endif
|
||||||
|
|
||||||
#pragma pack(push,1)
|
#pragma pack(push,1)
|
||||||
typedef struct _UNWIND_INFO {
|
typedef struct _UNWIND_INFO {
|
||||||
BYTE VersionAndFlags;
|
BYTE VersionAndFlags;
|
||||||
|
@ -107,6 +115,8 @@ __mingw_SEH_error_handler (struct _EXCEPTION_RECORD* ExceptionRecord,
|
||||||
(*old_handler) (SIGSEGV);
|
(*old_handler) (SIGSEGV);
|
||||||
action = EXCEPTION_CONTINUE_EXECUTION;
|
action = EXCEPTION_CONTINUE_EXECUTION;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
action = EXCEPTION_EXECUTE_HANDLER;
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
||||||
case EXCEPTION_PRIV_INSTRUCTION:
|
case EXCEPTION_PRIV_INSTRUCTION:
|
||||||
|
@ -125,6 +135,8 @@ __mingw_SEH_error_handler (struct _EXCEPTION_RECORD* ExceptionRecord,
|
||||||
(*old_handler) (SIGILL);
|
(*old_handler) (SIGILL);
|
||||||
action = EXCEPTION_CONTINUE_EXECUTION;
|
action = EXCEPTION_CONTINUE_EXECUTION;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
action = EXCEPTION_EXECUTE_HANDLER;
|
||||||
break;
|
break;
|
||||||
case EXCEPTION_FLT_INVALID_OPERATION:
|
case EXCEPTION_FLT_INVALID_OPERATION:
|
||||||
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
|
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
|
||||||
|
|
6
reactos/lib/3rdparty/mingw/crtbegin.c
vendored
Normal file
6
reactos/lib/3rdparty/mingw/crtbegin.c
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
19
reactos/lib/3rdparty/mingw/crtdll.c
vendored
19
reactos/lib/3rdparty/mingw/crtdll.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CRTDLL
|
#ifdef CRTDLL
|
||||||
|
@ -40,6 +40,7 @@ extern _CRTALLOC(".CRT$XIZ") _PIFV __xi_z[];
|
||||||
extern _CRTALLOC(".CRT$XCA") _PVFV __xc_a[];
|
extern _CRTALLOC(".CRT$XCA") _PVFV __xc_a[];
|
||||||
extern _CRTALLOC(".CRT$XCZ") _PVFV __xc_z[];
|
extern _CRTALLOC(".CRT$XCZ") _PVFV __xc_z[];
|
||||||
|
|
||||||
|
/* TLS initialization hook. */
|
||||||
extern const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback;
|
extern const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback;
|
||||||
|
|
||||||
static int __proc_attached = 0;
|
static int __proc_attached = 0;
|
||||||
|
@ -49,9 +50,9 @@ extern _PVFV *__onexitend;
|
||||||
|
|
||||||
extern int mingw_app_type;
|
extern int mingw_app_type;
|
||||||
|
|
||||||
extern BOOL WINAPI DllMain (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved);
|
extern WINBOOL WINAPI DllMain (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved);
|
||||||
|
|
||||||
extern BOOL WINAPI DllEntryPoint (HANDLE, DWORD, LPVOID);
|
extern WINBOOL WINAPI DllEntryPoint (HANDLE, DWORD, LPVOID);
|
||||||
|
|
||||||
static int pre_c_init (void);
|
static int pre_c_init (void);
|
||||||
|
|
||||||
|
@ -71,7 +72,7 @@ pre_c_init (void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI _CRT_INIT (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
|
WINBOOL WINAPI _CRT_INIT (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
|
||||||
{
|
{
|
||||||
if (dwReason == DLL_PROCESS_DETACH)
|
if (dwReason == DLL_PROCESS_DETACH)
|
||||||
{
|
{
|
||||||
|
@ -148,12 +149,12 @@ BOOL WINAPI _CRT_INIT (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL __DllMainCRTStartup (HANDLE, DWORD, LPVOID);
|
static WINBOOL __DllMainCRTStartup (HANDLE, DWORD, LPVOID);
|
||||||
|
|
||||||
BOOL WINAPI DllMainCRTStartup (HANDLE, DWORD, LPVOID);
|
WINBOOL WINAPI DllMainCRTStartup (HANDLE, DWORD, LPVOID);
|
||||||
int __mingw_init_ehandler (void);
|
int __mingw_init_ehandler (void);
|
||||||
|
|
||||||
BOOL WINAPI
|
WINBOOL WINAPI
|
||||||
DllMainCRTStartup (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
|
DllMainCRTStartup (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
|
||||||
{
|
{
|
||||||
mingw_app_type = 0;
|
mingw_app_type = 0;
|
||||||
|
@ -167,10 +168,10 @@ DllMainCRTStartup (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
|
||||||
return __DllMainCRTStartup (hDllHandle, dwReason, lpreserved);
|
return __DllMainCRTStartup (hDllHandle, dwReason, lpreserved);
|
||||||
}
|
}
|
||||||
|
|
||||||
__declspec(noinline) BOOL
|
__declspec(noinline) WINBOOL
|
||||||
__DllMainCRTStartup (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
|
__DllMainCRTStartup (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
|
||||||
{
|
{
|
||||||
BOOL retcode = TRUE;
|
WINBOOL retcode = TRUE;
|
||||||
|
|
||||||
__native_dllmain_reason = dwReason;
|
__native_dllmain_reason = dwReason;
|
||||||
if (dwReason == DLL_PROCESS_DETACH && __proc_attached == 0)
|
if (dwReason == DLL_PROCESS_DETACH && __proc_attached == 0)
|
||||||
|
|
6
reactos/lib/3rdparty/mingw/crtend.c
vendored
Normal file
6
reactos/lib/3rdparty/mingw/crtend.c
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
15
reactos/lib/3rdparty/mingw/crtexe.c
vendored
15
reactos/lib/3rdparty/mingw/crtexe.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#undef CRTDLL
|
#undef CRTDLL
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
#include <sect_attribs.h>
|
#include <sect_attribs.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <intrin.h>
|
|
||||||
|
|
||||||
#ifndef __winitenv
|
#ifndef __winitenv
|
||||||
extern wchar_t *** __MINGW_IMP_SYMBOL(__winitenv);
|
extern wchar_t *** __MINGW_IMP_SYMBOL(__winitenv);
|
||||||
|
@ -32,6 +31,11 @@ extern char *** __MINGW_IMP_SYMBOL(__initenv);
|
||||||
#define __initenv (* __MINGW_IMP_SYMBOL(__initenv))
|
#define __initenv (* __MINGW_IMP_SYMBOL(__initenv))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Hack, for bug in ld. Will be removed soon. */
|
||||||
|
#define __ImageBase __MINGW_LSYMBOL(_image_base__)
|
||||||
|
/* This symbol is defined by ld. */
|
||||||
|
extern IMAGE_DOS_HEADER __ImageBase;
|
||||||
|
|
||||||
extern void _fpreset (void);
|
extern void _fpreset (void);
|
||||||
#define SPACECHAR _T(' ')
|
#define SPACECHAR _T(' ')
|
||||||
#define DQUOTECHAR _T('\"')
|
#define DQUOTECHAR _T('\"')
|
||||||
|
@ -47,11 +51,7 @@ extern int * __MINGW_IMP_SYMBOL(_commode);
|
||||||
#define _commode (* __MINGW_IMP_SYMBOL(_commode))
|
#define _commode (* __MINGW_IMP_SYMBOL(_commode))
|
||||||
extern int _dowildcard;
|
extern int _dowildcard;
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
|
||||||
int _MINGW_INSTALL_DEBUG_MATHERR __attribute__((weak)) = 0;
|
int _MINGW_INSTALL_DEBUG_MATHERR __attribute__((weak)) = 0;
|
||||||
#else
|
|
||||||
int _MINGW_INSTALL_DEBUG_MATHERR = 0;
|
|
||||||
#endif
|
|
||||||
extern int __defaultmatherr;
|
extern int __defaultmatherr;
|
||||||
extern _CRTIMP void __cdecl _initterm(_PVFV *, _PVFV *);
|
extern _CRTIMP void __cdecl _initterm(_PVFV *, _PVFV *);
|
||||||
|
|
||||||
|
@ -62,6 +62,7 @@ extern _CRTALLOC(".CRT$XIZ") _PIFV __xi_z[];
|
||||||
extern _CRTALLOC(".CRT$XCA") _PVFV __xc_a[];
|
extern _CRTALLOC(".CRT$XCA") _PVFV __xc_a[];
|
||||||
extern _CRTALLOC(".CRT$XCZ") _PVFV __xc_z[];
|
extern _CRTALLOC(".CRT$XCZ") _PVFV __xc_z[];
|
||||||
|
|
||||||
|
/* TLS initialization hook. */
|
||||||
extern const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback;
|
extern const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback;
|
||||||
|
|
||||||
extern _PVFV *__onexitbegin;
|
extern _PVFV *__onexitbegin;
|
||||||
|
@ -179,7 +180,7 @@ __tmainCRTStartup (void)
|
||||||
{
|
{
|
||||||
_TCHAR *lpszCommandLine = NULL;
|
_TCHAR *lpszCommandLine = NULL;
|
||||||
STARTUPINFO StartupInfo;
|
STARTUPINFO StartupInfo;
|
||||||
BOOL inDoubleQuote = FALSE;
|
WINBOOL inDoubleQuote = FALSE;
|
||||||
memset (&StartupInfo, 0, sizeof (STARTUPINFO));
|
memset (&StartupInfo, 0, sizeof (STARTUPINFO));
|
||||||
|
|
||||||
if (mingw_app_type)
|
if (mingw_app_type)
|
||||||
|
|
2
reactos/lib/3rdparty/mingw/dll_argv.c
vendored
2
reactos/lib/3rdparty/mingw/dll_argv.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CRTDLL
|
#ifdef CRTDLL
|
||||||
|
|
2
reactos/lib/3rdparty/mingw/dllargv.c
vendored
2
reactos/lib/3rdparty/mingw/dllargv.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CRTDLL
|
#ifdef CRTDLL
|
||||||
|
|
2
reactos/lib/3rdparty/mingw/dllentry.c
vendored
2
reactos/lib/3rdparty/mingw/dllentry.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <oscalls.h>
|
#include <oscalls.h>
|
||||||
|
|
2
reactos/lib/3rdparty/mingw/gccmain.c
vendored
2
reactos/lib/3rdparty/mingw/gccmain.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
394
reactos/lib/3rdparty/mingw/getopt.c
vendored
394
reactos/lib/3rdparty/mingw/getopt.c
vendored
|
@ -1,394 +0,0 @@
|
||||||
#include <assert.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <getopt.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#define REPLACE_GETOPT
|
|
||||||
|
|
||||||
#define _DIAGASSERT(x) do {} while (0)
|
|
||||||
|
|
||||||
#ifdef REPLACE_GETOPT
|
|
||||||
#ifdef __weak_alias
|
|
||||||
__weak_alias(getopt,_getopt)
|
|
||||||
#endif
|
|
||||||
int opterr = 1;
|
|
||||||
int optind = 1;
|
|
||||||
int optopt = '?';
|
|
||||||
int optreset;
|
|
||||||
char *optarg;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __weak_alias
|
|
||||||
__weak_alias(getopt_long,_getopt_long)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __CYGWIN__
|
|
||||||
#define __progname __argv[0]
|
|
||||||
#else
|
|
||||||
extern char __declspec(dllimport) *__progname;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define IGNORE_FIRST (*options == '-' || *options == '+')
|
|
||||||
#define PRINT_ERROR ((opterr) && ((*options != ':') || (IGNORE_FIRST && options[1] != ':')))
|
|
||||||
|
|
||||||
#ifndef IS_POSIXLY_CORRECT
|
|
||||||
#define IS_POSIXLY_CORRECT (getenv("POSIXLY_CORRECT") != NULL)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PERMUTE (!IS_POSIXLY_CORRECT && !IGNORE_FIRST)
|
|
||||||
|
|
||||||
#define IN_ORDER (!IS_POSIXLY_CORRECT && *options == '-')
|
|
||||||
|
|
||||||
#define BADCH (int)'?'
|
|
||||||
#define BADARG ((IGNORE_FIRST && options[1] == ':') || (*options == ':') ? (int)':' : (int)'?')
|
|
||||||
#define INORDER (int)1
|
|
||||||
|
|
||||||
static char EMSG[1];
|
|
||||||
|
|
||||||
static int getopt_internal (int,char * const *,const char *);
|
|
||||||
static int gcd (int,int);
|
|
||||||
static void permute_args (int,int,int,char * const *);
|
|
||||||
|
|
||||||
static char *place = EMSG;
|
|
||||||
|
|
||||||
static int nonopt_start = -1;
|
|
||||||
static int nonopt_end = -1;
|
|
||||||
|
|
||||||
static const char recargchar[] = "option requires an argument -- %c";
|
|
||||||
static const char recargstring[] = "option requires an argument -- %s";
|
|
||||||
static const char ambig[] = "ambiguous option -- %.*s";
|
|
||||||
static const char noarg[] = "option doesn't take an argument -- %.*s";
|
|
||||||
static const char illoptchar[] = "unknown option -- %c";
|
|
||||||
static const char illoptstring[] = "unknown option -- %s";
|
|
||||||
|
|
||||||
static void
|
|
||||||
_vwarnx(const char *fmt,va_list ap)
|
|
||||||
{
|
|
||||||
(void)fprintf(stderr,"%s: ",__progname);
|
|
||||||
if (fmt != NULL)
|
|
||||||
(void)vfprintf(stderr,fmt,ap);
|
|
||||||
(void)fprintf(stderr,"\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
warnx(const char *fmt,...)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
va_start(ap,fmt);
|
|
||||||
_vwarnx(fmt,ap);
|
|
||||||
va_end(ap);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
gcd(a,b)
|
|
||||||
int a;
|
|
||||||
int b;
|
|
||||||
{
|
|
||||||
int c;
|
|
||||||
|
|
||||||
c = a % b;
|
|
||||||
while (c != 0) {
|
|
||||||
a = b;
|
|
||||||
b = c;
|
|
||||||
c = a % b;
|
|
||||||
}
|
|
||||||
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
permute_args(panonopt_start,panonopt_end,opt_end,nargv)
|
|
||||||
int panonopt_start;
|
|
||||||
int panonopt_end;
|
|
||||||
int opt_end;
|
|
||||||
char * const *nargv;
|
|
||||||
{
|
|
||||||
int cstart,cyclelen,i,j,ncycle,nnonopts,nopts,pos;
|
|
||||||
char *swap;
|
|
||||||
|
|
||||||
_DIAGASSERT(nargv != NULL);
|
|
||||||
|
|
||||||
nnonopts = panonopt_end - panonopt_start;
|
|
||||||
nopts = opt_end - panonopt_end;
|
|
||||||
ncycle = gcd(nnonopts,nopts);
|
|
||||||
cyclelen = (opt_end - panonopt_start) / ncycle;
|
|
||||||
|
|
||||||
for (i = 0; i < ncycle; i++) {
|
|
||||||
cstart = panonopt_end+i;
|
|
||||||
pos = cstart;
|
|
||||||
for (j = 0; j < cyclelen; j++) {
|
|
||||||
if (pos >= panonopt_end)
|
|
||||||
pos -= nnonopts;
|
|
||||||
else
|
|
||||||
pos += nopts;
|
|
||||||
swap = nargv[pos];
|
|
||||||
|
|
||||||
((char **) nargv)[pos] = nargv[cstart];
|
|
||||||
|
|
||||||
((char **)nargv)[cstart] = swap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
getopt_internal(nargc,nargv,options)
|
|
||||||
int nargc;
|
|
||||||
char * const *nargv;
|
|
||||||
const char *options;
|
|
||||||
{
|
|
||||||
char *oli;
|
|
||||||
int optchar;
|
|
||||||
|
|
||||||
_DIAGASSERT(nargv != NULL);
|
|
||||||
_DIAGASSERT(options != NULL);
|
|
||||||
|
|
||||||
optarg = NULL;
|
|
||||||
|
|
||||||
if (optind == 0)
|
|
||||||
optind = 1;
|
|
||||||
|
|
||||||
if (optreset)
|
|
||||||
nonopt_start = nonopt_end = -1;
|
|
||||||
start:
|
|
||||||
if (optreset || !*place) {
|
|
||||||
optreset = 0;
|
|
||||||
if (optind >= nargc) {
|
|
||||||
place = EMSG;
|
|
||||||
if (nonopt_end != -1) {
|
|
||||||
|
|
||||||
permute_args(nonopt_start,nonopt_end,optind,nargv);
|
|
||||||
optind -= nonopt_end - nonopt_start;
|
|
||||||
}
|
|
||||||
else if (nonopt_start != -1) {
|
|
||||||
|
|
||||||
optind = nonopt_start;
|
|
||||||
}
|
|
||||||
nonopt_start = nonopt_end = -1;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if ((*(place = nargv[optind]) != '-')
|
|
||||||
|| (place[1] == '\0')) {
|
|
||||||
place = EMSG;
|
|
||||||
if (IN_ORDER) {
|
|
||||||
|
|
||||||
optarg = nargv[optind++];
|
|
||||||
return INORDER;
|
|
||||||
}
|
|
||||||
if (!PERMUTE) {
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nonopt_start == -1)
|
|
||||||
nonopt_start = optind;
|
|
||||||
else if (nonopt_end != -1) {
|
|
||||||
permute_args(nonopt_start,nonopt_end,optind,nargv);
|
|
||||||
nonopt_start = optind -
|
|
||||||
(nonopt_end - nonopt_start);
|
|
||||||
nonopt_end = -1;
|
|
||||||
}
|
|
||||||
optind++;
|
|
||||||
|
|
||||||
goto start;
|
|
||||||
}
|
|
||||||
if (nonopt_start != -1 && nonopt_end == -1)
|
|
||||||
nonopt_end = optind;
|
|
||||||
if (place[1] && *++place == '-') {
|
|
||||||
place++;
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((optchar = (int)*place++) == (int)':' ||
|
|
||||||
(oli = strchr(options + (IGNORE_FIRST ? 1 : 0),optchar)) == NULL) {
|
|
||||||
|
|
||||||
if (!*place)
|
|
||||||
++optind;
|
|
||||||
if (PRINT_ERROR)
|
|
||||||
warnx(illoptchar,optchar);
|
|
||||||
optopt = optchar;
|
|
||||||
return BADCH;
|
|
||||||
}
|
|
||||||
if (optchar == 'W' && oli[1] == ';') {
|
|
||||||
|
|
||||||
if (*place)
|
|
||||||
return -2;
|
|
||||||
|
|
||||||
if (++optind >= nargc) {
|
|
||||||
place = EMSG;
|
|
||||||
if (PRINT_ERROR)
|
|
||||||
warnx(recargchar,optchar);
|
|
||||||
optopt = optchar;
|
|
||||||
return BADARG;
|
|
||||||
} else
|
|
||||||
place = nargv[optind];
|
|
||||||
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
if (*++oli != ':') {
|
|
||||||
if (!*place)
|
|
||||||
++optind;
|
|
||||||
} else {
|
|
||||||
optarg = NULL;
|
|
||||||
if (*place)
|
|
||||||
optarg = place;
|
|
||||||
|
|
||||||
else if (oli[1] != ':') {
|
|
||||||
if (++optind >= nargc) {
|
|
||||||
place = EMSG;
|
|
||||||
if (PRINT_ERROR)
|
|
||||||
warnx(recargchar,optchar);
|
|
||||||
optopt = optchar;
|
|
||||||
return BADARG;
|
|
||||||
} else
|
|
||||||
optarg = nargv[optind];
|
|
||||||
}
|
|
||||||
place = EMSG;
|
|
||||||
++optind;
|
|
||||||
}
|
|
||||||
|
|
||||||
return optchar;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef REPLACE_GETOPT
|
|
||||||
|
|
||||||
int
|
|
||||||
getopt(nargc,nargv,options)
|
|
||||||
int nargc;
|
|
||||||
char * const *nargv;
|
|
||||||
const char *options;
|
|
||||||
{
|
|
||||||
int retval;
|
|
||||||
|
|
||||||
_DIAGASSERT(nargv != NULL);
|
|
||||||
_DIAGASSERT(options != NULL);
|
|
||||||
|
|
||||||
if ((retval = getopt_internal(nargc,nargv,options)) == -2) {
|
|
||||||
++optind;
|
|
||||||
|
|
||||||
if (nonopt_end != -1) {
|
|
||||||
permute_args(nonopt_start,nonopt_end,optind,nargv);
|
|
||||||
optind -= nonopt_end - nonopt_start;
|
|
||||||
}
|
|
||||||
nonopt_start = nonopt_end = -1;
|
|
||||||
retval = -1;
|
|
||||||
}
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
|
||||||
getopt_long(nargc,nargv,options,long_options,idx)
|
|
||||||
int nargc;
|
|
||||||
char * const *nargv;
|
|
||||||
const char *options;
|
|
||||||
const struct option *long_options;
|
|
||||||
int *idx;
|
|
||||||
{
|
|
||||||
int retval;
|
|
||||||
|
|
||||||
_DIAGASSERT(nargv != NULL);
|
|
||||||
_DIAGASSERT(options != NULL);
|
|
||||||
_DIAGASSERT(long_options != NULL);
|
|
||||||
|
|
||||||
if ((retval = getopt_internal(nargc,nargv,options)) == -2) {
|
|
||||||
char *current_argv,*has_equal;
|
|
||||||
size_t current_argv_len;
|
|
||||||
int i,match;
|
|
||||||
|
|
||||||
current_argv = place;
|
|
||||||
match = -1;
|
|
||||||
|
|
||||||
optind++;
|
|
||||||
place = EMSG;
|
|
||||||
|
|
||||||
if (*current_argv == '\0') {
|
|
||||||
|
|
||||||
if (nonopt_end != -1) {
|
|
||||||
permute_args(nonopt_start,nonopt_end,optind,nargv);
|
|
||||||
optind -= nonopt_end - nonopt_start;
|
|
||||||
}
|
|
||||||
nonopt_start = nonopt_end = -1;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if ((has_equal = strchr(current_argv,'=')) != NULL) {
|
|
||||||
|
|
||||||
current_argv_len = has_equal - current_argv;
|
|
||||||
has_equal++;
|
|
||||||
} else
|
|
||||||
current_argv_len = strlen(current_argv);
|
|
||||||
|
|
||||||
for (i = 0; long_options[i].name; i++) {
|
|
||||||
|
|
||||||
if (strncmp(current_argv,long_options[i].name,current_argv_len))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (strlen(long_options[i].name) ==
|
|
||||||
(unsigned)current_argv_len) {
|
|
||||||
|
|
||||||
match = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (match == -1)
|
|
||||||
match = i;
|
|
||||||
else {
|
|
||||||
|
|
||||||
if (PRINT_ERROR)
|
|
||||||
warnx(ambig,(int)current_argv_len,current_argv);
|
|
||||||
optopt = 0;
|
|
||||||
return BADCH;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (match != -1) {
|
|
||||||
if (long_options[match].has_arg == no_argument
|
|
||||||
&& has_equal) {
|
|
||||||
if (PRINT_ERROR)
|
|
||||||
warnx(noarg,(int)current_argv_len,current_argv);
|
|
||||||
|
|
||||||
if (long_options[match].flag == NULL)
|
|
||||||
optopt = long_options[match].val;
|
|
||||||
else
|
|
||||||
optopt = 0;
|
|
||||||
return BADARG;
|
|
||||||
}
|
|
||||||
if (long_options[match].has_arg == required_argument ||
|
|
||||||
long_options[match].has_arg == optional_argument) {
|
|
||||||
if (has_equal)
|
|
||||||
optarg = has_equal;
|
|
||||||
else if (long_options[match].has_arg ==
|
|
||||||
required_argument) {
|
|
||||||
|
|
||||||
optarg = nargv[optind++];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((long_options[match].has_arg == required_argument)
|
|
||||||
&& (optarg == NULL)) {
|
|
||||||
|
|
||||||
if (PRINT_ERROR)
|
|
||||||
warnx(recargstring,current_argv);
|
|
||||||
|
|
||||||
if (long_options[match].flag == NULL)
|
|
||||||
optopt = long_options[match].val;
|
|
||||||
else
|
|
||||||
optopt = 0;
|
|
||||||
--optind;
|
|
||||||
return BADARG;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (PRINT_ERROR)
|
|
||||||
warnx(illoptstring,current_argv);
|
|
||||||
optopt = 0;
|
|
||||||
return BADCH;
|
|
||||||
}
|
|
||||||
if (long_options[match].flag) {
|
|
||||||
*long_options[match].flag = long_options[match].val;
|
|
||||||
retval = 0;
|
|
||||||
} else
|
|
||||||
retval = long_options[match].val;
|
|
||||||
if (idx)
|
|
||||||
*idx = match;
|
|
||||||
}
|
|
||||||
return retval;
|
|
||||||
}
|
|
12
reactos/lib/3rdparty/mingw/gs_support.c
vendored
12
reactos/lib/3rdparty/mingw/gs_support.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
@ -112,22 +112,12 @@ __report_gsfailure (ULONGLONG StackCookie)
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef __GNUC__
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
GS_ContextRecord.Rip = (ULONGLONG) __builtin_return_address (0);
|
GS_ContextRecord.Rip = (ULONGLONG) __builtin_return_address (0);
|
||||||
GS_ContextRecord.Rsp = (ULONGLONG) __builtin_frame_address (0) + 8;
|
GS_ContextRecord.Rsp = (ULONGLONG) __builtin_frame_address (0) + 8;
|
||||||
#else
|
#else
|
||||||
GS_ContextRecord.Eip = (DWORD) __builtin_return_address (0);
|
GS_ContextRecord.Eip = (DWORD) __builtin_return_address (0);
|
||||||
GS_ContextRecord.Esp = (DWORD) __builtin_frame_address (0) + 4;
|
GS_ContextRecord.Esp = (DWORD) __builtin_frame_address (0) + 4;
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#ifdef _WIN64
|
|
||||||
GS_ContextRecord.Rip = (ULONGLONG) _ReturnAddress();
|
|
||||||
GS_ContextRecord.Rsp = (ULONGLONG) _AddressOfReturnAddress();
|
|
||||||
#else
|
|
||||||
GS_ContextRecord.Eip = (DWORD) _ReturnAddress();
|
|
||||||
GS_ContextRecord.Esp = (DWORD) _AddressOfReturnAddress();
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
reactos/lib/3rdparty/mingw/isascii.c
vendored
Normal file
16
reactos/lib/3rdparty/mingw/isascii.c
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#undef isascii
|
||||||
|
int isascii (int);
|
||||||
|
|
||||||
|
int
|
||||||
|
isascii (int c)
|
||||||
|
{
|
||||||
|
return __isascii(c);
|
||||||
|
}
|
16
reactos/lib/3rdparty/mingw/iscsym.c
vendored
Normal file
16
reactos/lib/3rdparty/mingw/iscsym.c
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#undef iscsym
|
||||||
|
|
||||||
|
int iscsym (int);
|
||||||
|
|
||||||
|
int
|
||||||
|
iscsym (int c)
|
||||||
|
{
|
||||||
|
return __iscsym(c);
|
||||||
|
}
|
16
reactos/lib/3rdparty/mingw/iscsymf.c
vendored
Normal file
16
reactos/lib/3rdparty/mingw/iscsymf.c
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#undef iscsymf
|
||||||
|
|
||||||
|
int iscsymf (int);
|
||||||
|
|
||||||
|
int
|
||||||
|
iscsymf (int c)
|
||||||
|
{
|
||||||
|
return __iscsymf(c);
|
||||||
|
}
|
2
reactos/lib/3rdparty/mingw/merr.c
vendored
2
reactos/lib/3rdparty/mingw/merr.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <internal.h>
|
#include <internal.h>
|
||||||
|
|
9
reactos/lib/3rdparty/mingw/mingw.rbuild
vendored
9
reactos/lib/3rdparty/mingw/mingw.rbuild
vendored
|
@ -3,6 +3,10 @@
|
||||||
<group>
|
<group>
|
||||||
<module name="mingw_common" type="staticlibrary" isstartuplib="true" crt="dll">
|
<module name="mingw_common" type="staticlibrary" isstartuplib="true" crt="dll">
|
||||||
<define name="_CRTBLD" />
|
<define name="_CRTBLD" />
|
||||||
|
|
||||||
|
<!-- This is to prevent from using data imports directly -->
|
||||||
|
<define name="_M_CEE_PURE" />
|
||||||
|
|
||||||
<importlibrary definition="moldname-msvcrt.def" dllname="msvcrt.dll" />
|
<importlibrary definition="moldname-msvcrt.def" dllname="msvcrt.dll" />
|
||||||
<include base="ReactOS">include/reactos/mingw-w64</include>
|
<include base="ReactOS">include/reactos/mingw-w64</include>
|
||||||
<if property="USERMODE" value="1">
|
<if property="USERMODE" value="1">
|
||||||
|
@ -18,19 +22,18 @@
|
||||||
<file>CRT_glob.c</file>
|
<file>CRT_glob.c</file>
|
||||||
<file>crt_handler.c</file>
|
<file>crt_handler.c</file>
|
||||||
<file>dllentry.c</file>
|
<file>dllentry.c</file>
|
||||||
<file>dummy_mingwthrd.c</file>
|
|
||||||
<file>gccmain.c</file>
|
<file>gccmain.c</file>
|
||||||
<file>getopt.c</file>
|
|
||||||
<file>gs_support.c</file>
|
<file>gs_support.c</file>
|
||||||
<file>merr.c</file>
|
<file>merr.c</file>
|
||||||
<!-- file>mingw_custom.c</file -->
|
<!-- file>mingw_custom.c</file -->
|
||||||
<file>mingw_helpers.c</file>
|
<file>mingw_helpers.c</file>
|
||||||
<file>mingwthrd_nomt.c</file>
|
|
||||||
<file>natstart.c</file>
|
<file>natstart.c</file>
|
||||||
<file>pesect.c</file>
|
<file>pesect.c</file>
|
||||||
<file>pseudo-reloc.c</file>
|
<file>pseudo-reloc.c</file>
|
||||||
<file>pseudo-reloc-list.c</file>
|
<file>pseudo-reloc-list.c</file>
|
||||||
|
<file>tlsmcrt.c</file>
|
||||||
<file>tlssup.c</file>
|
<file>tlssup.c</file>
|
||||||
|
<file>tlsthrd.c</file>
|
||||||
<file>txtmode.c</file>
|
<file>txtmode.c</file>
|
||||||
<file>wildcard.c</file>
|
<file>wildcard.c</file>
|
||||||
<file>xncommod.c</file>
|
<file>xncommod.c</file>
|
||||||
|
|
2
reactos/lib/3rdparty/mingw/mingw_custom.c
vendored
2
reactos/lib/3rdparty/mingw/mingw_custom.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <_mingw.h>
|
#include <_mingw.h>
|
||||||
|
|
2
reactos/lib/3rdparty/mingw/mingw_helpers.c
vendored
2
reactos/lib/3rdparty/mingw/mingw_helpers.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <oscalls.h>
|
#include <oscalls.h>
|
||||||
|
|
30
reactos/lib/3rdparty/mingw/mingwthrd_nomt.c
vendored
30
reactos/lib/3rdparty/mingw/mingwthrd_nomt.c
vendored
|
@ -1,30 +0,0 @@
|
||||||
#ifndef WIN32_LEAN_AND_MEAN
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#endif
|
|
||||||
#include <windows.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/* We support TLS cleanup code in any case. If shared version of libgcc is used _CRT_MT has value 1, otherwise
|
|
||||||
we do tls cleanup in runtime and _CRT_MT has value 2. */
|
|
||||||
int _CRT_MT = 2;
|
|
||||||
|
|
||||||
int __mingwthr_key_dtor (DWORD key, void (*dtor)(void *));
|
|
||||||
int __mingwthr_remove_key_dtor (DWORD key);
|
|
||||||
|
|
||||||
extern int ___w64_mingwthr_remove_key_dtor (DWORD key);
|
|
||||||
extern int ___w64_mingwthr_add_key_dtor (DWORD key, void (*dtor)(void *));
|
|
||||||
|
|
||||||
int
|
|
||||||
__mingwthr_remove_key_dtor (DWORD key)
|
|
||||||
{
|
|
||||||
return ___w64_mingwthr_remove_key_dtor (key);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
__mingwthr_key_dtor (DWORD key, void (*dtor)(void *))
|
|
||||||
{
|
|
||||||
if (dtor)
|
|
||||||
return ___w64_mingwthr_add_key_dtor (key, dtor);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
2
reactos/lib/3rdparty/mingw/natstart.c
vendored
2
reactos/lib/3rdparty/mingw/natstart.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <crtdefs.h>
|
#include <crtdefs.h>
|
||||||
|
|
19
reactos/lib/3rdparty/mingw/pesect.c
vendored
19
reactos/lib/3rdparty/mingw/pesect.c
vendored
|
@ -1,15 +1,24 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
BOOL _ValidateImageBase (PBYTE);
|
#if defined (_WIN64) && defined (__ia64__)
|
||||||
|
#error FIXME: Unsupported __ImageBase implementation.
|
||||||
|
#else
|
||||||
|
/* Hack, for bug in ld. Will be removed soon. */
|
||||||
|
#define __ImageBase __MINGW_LSYMBOL(_image_base__)
|
||||||
|
/* This symbol is defined by the linker. */
|
||||||
|
extern IMAGE_DOS_HEADER __ImageBase;
|
||||||
|
#endif
|
||||||
|
|
||||||
BOOL
|
WINBOOL _ValidateImageBase (PBYTE);
|
||||||
|
|
||||||
|
WINBOOL
|
||||||
_ValidateImageBase (PBYTE pImageBase)
|
_ValidateImageBase (PBYTE pImageBase)
|
||||||
{
|
{
|
||||||
PIMAGE_DOS_HEADER pDOSHeader;
|
PIMAGE_DOS_HEADER pDOSHeader;
|
||||||
|
@ -122,9 +131,9 @@ _GetPEImageBase (void)
|
||||||
return pImageBase;
|
return pImageBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL _IsNonwritableInCurrentImage (PBYTE);
|
WINBOOL _IsNonwritableInCurrentImage (PBYTE);
|
||||||
|
|
||||||
BOOL
|
WINBOOL
|
||||||
_IsNonwritableInCurrentImage (PBYTE pTarget)
|
_IsNonwritableInCurrentImage (PBYTE pTarget)
|
||||||
{
|
{
|
||||||
PBYTE pImageBase;
|
PBYTE pImageBase;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char __RUNTIME_PSEUDO_RELOC_LIST_END__ = 0;
|
char __RUNTIME_PSEUDO_RELOC_LIST_END__ = 0;
|
||||||
|
|
246
reactos/lib/3rdparty/mingw/pseudo-reloc.c
vendored
246
reactos/lib/3rdparty/mingw/pseudo-reloc.c
vendored
|
@ -1,27 +1,71 @@
|
||||||
/**
|
/* pseudo-reloc.c
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
|
||||||
* This file is part of the w64 mingw-runtime package.
|
Contributed by Egor Duda <deo@logos-m.ru>
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
Modified by addition of runtime_pseudo_reloc version 2
|
||||||
*
|
by Kai Tietz <kai.tietz@onevision.com>
|
||||||
* Contributed by Egor Duda <deo@logos-m.ru>
|
|
||||||
* Modified by addition of runtime_pseudo_reloc version 2
|
THIS SOFTWARE IS NOT COPYRIGHTED
|
||||||
* by Kai Tietz <kai.tietz@onevision.com>
|
|
||||||
|
This source code is offered for use in the public domain. You may
|
||||||
|
use, modify or distribute it freely.
|
||||||
|
|
||||||
|
This code is distributed in the hope that it will be useful but
|
||||||
|
WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||||
|
DISCLAMED. This includes but is not limited to warrenties of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <assert.h>
|
|
||||||
|
#if defined(__CYGWIN__)
|
||||||
|
#include <wchar.h>
|
||||||
|
#include <ntdef.h>
|
||||||
|
#include <sys/cygwin.h>
|
||||||
|
/* copied from winsup.h */
|
||||||
|
# define NO_COPY __attribute__((nocommon)) __attribute__((section(".data_cygwin_nocopy")))
|
||||||
|
/* custom status code: */
|
||||||
|
#define STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION ((NTSTATUS) 0xe0000269)
|
||||||
|
#define SHORT_MSG_BUF_SZ 128
|
||||||
|
#else
|
||||||
|
# define NO_COPY
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define ATTRIBUTE_NORETURN __attribute__ ((noreturn))
|
||||||
|
#else
|
||||||
|
#define ATTRIBUTE_NORETURN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __MINGW_LSYMBOL
|
||||||
|
#define __MINGW_LSYMBOL(sym) sym
|
||||||
|
#endif
|
||||||
|
|
||||||
extern char __RUNTIME_PSEUDO_RELOC_LIST__;
|
extern char __RUNTIME_PSEUDO_RELOC_LIST__;
|
||||||
extern char __RUNTIME_PSEUDO_RELOC_LIST_END__;
|
extern char __RUNTIME_PSEUDO_RELOC_LIST_END__;
|
||||||
|
extern char __MINGW_LSYMBOL(_image_base__);
|
||||||
|
|
||||||
|
void _pei386_runtime_relocator (void);
|
||||||
|
|
||||||
|
/* v1 relocation is basically:
|
||||||
|
* *(base + .target) += .addend
|
||||||
|
* where (base + .target) is always assumed to point
|
||||||
|
* to a DWORD (4 bytes).
|
||||||
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
DWORD addend;
|
DWORD addend;
|
||||||
DWORD target;
|
DWORD target;
|
||||||
} runtime_pseudo_reloc_item_v1;
|
} runtime_pseudo_reloc_item_v1;
|
||||||
|
|
||||||
|
/* v2 relocation is more complex. In effect, it is
|
||||||
|
* *(base + .target) += *(base + .sym) - (base + .sym)
|
||||||
|
* with care taken in both reading, sign extension, and writing
|
||||||
|
* because .flags may indicate that (base + .target) may point
|
||||||
|
* to a BYTE, WORD, DWORD, or QWORD (w64).
|
||||||
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
DWORD sym;
|
DWORD sym;
|
||||||
DWORD target;
|
DWORD target;
|
||||||
|
@ -34,19 +78,118 @@ typedef struct {
|
||||||
DWORD version;
|
DWORD version;
|
||||||
} runtime_pseudo_reloc_v2;
|
} runtime_pseudo_reloc_v2;
|
||||||
|
|
||||||
|
static void ATTRIBUTE_NORETURN
|
||||||
|
__report_error (const char *msg, ...)
|
||||||
|
{
|
||||||
|
#ifdef __CYGWIN__
|
||||||
|
/* This function is used to print short error messages
|
||||||
|
* to stderr, which may occur during DLL initialization
|
||||||
|
* while fixing up 'pseudo' relocations. This early, we
|
||||||
|
* may not be able to use cygwin stdio functions, so we
|
||||||
|
* use the win32 WriteFile api. This should work with both
|
||||||
|
* normal win32 console IO handles, redirected ones, and
|
||||||
|
* cygwin ptys.
|
||||||
|
*/
|
||||||
|
char buf[SHORT_MSG_BUF_SZ];
|
||||||
|
wchar_t module[MAX_PATH];
|
||||||
|
char * posix_module = NULL;
|
||||||
|
static const char UNKNOWN_MODULE[] = "<unknown module>: ";
|
||||||
|
static const size_t UNKNOWN_MODULE_LEN = sizeof (UNKNOWN_MODULE) - 1;
|
||||||
|
static const char CYGWIN_FAILURE_MSG[] = "Cygwin runtime failure: ";
|
||||||
|
static const size_t CYGWIN_FAILURE_MSG_LEN = sizeof (CYGWIN_FAILURE_MSG) - 1;
|
||||||
|
DWORD len;
|
||||||
|
DWORD done;
|
||||||
|
va_list args;
|
||||||
|
HANDLE errh = GetStdHandle (STD_ERROR_HANDLE);
|
||||||
|
ssize_t modulelen = GetModuleFileNameW (NULL, module, sizeof (module));
|
||||||
|
|
||||||
|
if (errh == INVALID_HANDLE_VALUE)
|
||||||
|
cygwin_internal (CW_EXIT_PROCESS,
|
||||||
|
STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION,
|
||||||
|
1);
|
||||||
|
|
||||||
|
if (modulelen > 0)
|
||||||
|
posix_module = cygwin_create_path (CCP_WIN_W_TO_POSIX, module);
|
||||||
|
|
||||||
|
va_start (args, msg);
|
||||||
|
len = (DWORD) vsnprintf (buf, SHORT_MSG_BUF_SZ, msg, args);
|
||||||
|
va_end (args);
|
||||||
|
buf[SHORT_MSG_BUF_SZ-1] = '\0'; /* paranoia */
|
||||||
|
|
||||||
|
if (posix_module)
|
||||||
|
{
|
||||||
|
WriteFile (errh, (PCVOID)CYGWIN_FAILURE_MSG,
|
||||||
|
CYGWIN_FAILURE_MSG_LEN, &done, NULL);
|
||||||
|
WriteFile (errh, (PCVOID)posix_module,
|
||||||
|
strlen(posix_module), &done, NULL);
|
||||||
|
WriteFile (errh, (PCVOID)": ", 2, &done, NULL);
|
||||||
|
WriteFile (errh, (PCVOID)buf, len, &done, NULL);
|
||||||
|
free (posix_module);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WriteFile (errh, (PCVOID)CYGWIN_FAILURE_MSG,
|
||||||
|
CYGWIN_FAILURE_MSG_LEN, &done, NULL);
|
||||||
|
WriteFile (errh, (PCVOID)UNKNOWN_MODULE,
|
||||||
|
UNKNOWN_MODULE_LEN, &done, NULL);
|
||||||
|
WriteFile (errh, (PCVOID)buf, len, &done, NULL);
|
||||||
|
}
|
||||||
|
WriteFile (errh, (PCVOID)"\n", 1, &done, NULL);
|
||||||
|
|
||||||
|
cygwin_internal (CW_EXIT_PROCESS,
|
||||||
|
STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION,
|
||||||
|
1);
|
||||||
|
/* not reached, but silences noreturn warning */
|
||||||
|
abort ();
|
||||||
|
#else
|
||||||
|
va_list argp;
|
||||||
|
va_start (argp, msg);
|
||||||
|
# ifdef __MINGW64_VERSION_MAJOR
|
||||||
|
fprintf (stderr, "Mingw-w64 runtime failure:\n");
|
||||||
|
# else
|
||||||
|
fprintf (stderr, "Mingw runtime failure:\n");
|
||||||
|
# endif
|
||||||
|
vfprintf (stderr, msg, argp);
|
||||||
|
va_end (argp);
|
||||||
|
abort ();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This function temporarily marks the page containing addr
|
||||||
|
* writable, before copying len bytes from *src to *addr, and
|
||||||
|
* then restores the original protection settings to the page.
|
||||||
|
*
|
||||||
|
* Using this function eliminates the requirement with older
|
||||||
|
* pseudo-reloc implementations, that sections containing
|
||||||
|
* pseudo-relocs (such as .text and .rdata) be permanently
|
||||||
|
* marked writable. This older behavior sabotaged any memory
|
||||||
|
* savings achieved by shared libraries on win32 -- and was
|
||||||
|
* slower, too. However, on cygwin as of binutils 2.20 the
|
||||||
|
* .text section is still marked writable, and the .rdata section
|
||||||
|
* is folded into the (writable) .data when --enable-auto-import.
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
__write_memory (void *addr, const void *src, size_t len)
|
__write_memory (void *addr, const void *src, size_t len)
|
||||||
{
|
{
|
||||||
MEMORY_BASIC_INFORMATION b;
|
MEMORY_BASIC_INFORMATION b;
|
||||||
DWORD oldprot;
|
DWORD oldprot;
|
||||||
|
|
||||||
if (!len)
|
if (!len)
|
||||||
return;
|
return;
|
||||||
assert (VirtualQuery (addr, &b, sizeof(b)));
|
|
||||||
|
if (!VirtualQuery (addr, &b, sizeof(b)))
|
||||||
|
{
|
||||||
|
__report_error (" VirtualQuery failed for %d bytes at address %p",
|
||||||
|
(int) sizeof(b), addr);
|
||||||
|
}
|
||||||
|
|
||||||
/* Temporarily allow write access to read-only protected memory. */
|
/* Temporarily allow write access to read-only protected memory. */
|
||||||
if (b.Protect != PAGE_EXECUTE_READWRITE && b.Protect != PAGE_READWRITE)
|
if (b.Protect != PAGE_EXECUTE_READWRITE && b.Protect != PAGE_READWRITE)
|
||||||
VirtualProtect (b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE,
|
VirtualProtect (b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE,
|
||||||
&oldprot);
|
&oldprot);
|
||||||
|
/* write the data. */
|
||||||
memcpy (addr, src, len);
|
memcpy (addr, src, len);
|
||||||
|
/* Restore original protection. */
|
||||||
if (b.Protect != PAGE_EXECUTE_READWRITE && b.Protect != PAGE_READWRITE)
|
if (b.Protect != PAGE_EXECUTE_READWRITE && b.Protect != PAGE_READWRITE)
|
||||||
VirtualProtect (b.BaseAddress, b.RegionSize, oldprot, &oldprot);
|
VirtualProtect (b.BaseAddress, b.RegionSize, oldprot, &oldprot);
|
||||||
}
|
}
|
||||||
|
@ -62,17 +205,56 @@ do_pseudo_reloc (void *start, void *end, void *base)
|
||||||
runtime_pseudo_reloc_v2 *v2_hdr = (runtime_pseudo_reloc_v2 *) start;
|
runtime_pseudo_reloc_v2 *v2_hdr = (runtime_pseudo_reloc_v2 *) start;
|
||||||
runtime_pseudo_reloc_item_v2 *r;
|
runtime_pseudo_reloc_item_v2 *r;
|
||||||
|
|
||||||
|
/* A valid relocation list will contain at least one entry, and
|
||||||
|
* one v1 data structure (the smallest one) requires two DWORDs.
|
||||||
|
* So, if the relocation list is smaller than 8 bytes, bail.
|
||||||
|
*/
|
||||||
if (reloc_target < 8)
|
if (reloc_target < 8)
|
||||||
return;
|
return;
|
||||||
/* Check if this is old version pseudo relocation version. */
|
|
||||||
|
/* Check if this is the old pseudo relocation version. */
|
||||||
|
/* There are two kinds of v1 relocation lists:
|
||||||
|
* 1) With a (v2-style) version header. In this case, the
|
||||||
|
* first entry in the list is a 3-DWORD structure, with
|
||||||
|
* value:
|
||||||
|
* { 0, 0, RP_VERSION_V1 }
|
||||||
|
* In this case, we skip to the next entry in the list,
|
||||||
|
* knowing that all elements after the head item can
|
||||||
|
* be cast to runtime_pseudo_reloc_item_v1.
|
||||||
|
* 2) Without a (v2-style) version header. In this case, the
|
||||||
|
* first element in the list IS an actual v1 relocation
|
||||||
|
* record, which is two DWORDs. Because there will never
|
||||||
|
* be a case where a v1 relocation record has both
|
||||||
|
* addend == 0 and target == 0, this case will not be
|
||||||
|
* confused with the prior one.
|
||||||
|
* All current binutils, when generating a v1 relocation list,
|
||||||
|
* use the second (e.g. original) form -- that is, without the
|
||||||
|
* v2-style version header.
|
||||||
|
*/
|
||||||
if (reloc_target >= 12
|
if (reloc_target >= 12
|
||||||
&& v2_hdr->magic1 == 0 && v2_hdr->magic2 == 0
|
&& v2_hdr->magic1 == 0 && v2_hdr->magic2 == 0
|
||||||
&& v2_hdr->version == RP_VERSION_V1)
|
&& v2_hdr->version == RP_VERSION_V1)
|
||||||
|
{
|
||||||
|
/* We have a list header item indicating that the rest
|
||||||
|
* of the list contains v1 entries. Move the pointer to
|
||||||
|
* the first true v1 relocation record. By definition,
|
||||||
|
* that v1 element will not have both addend == 0 and
|
||||||
|
* target == 0 (and thus, when interpreted as a
|
||||||
|
* runtime_pseudo_reloc_v2, it will not have both
|
||||||
|
* magic1 == 0 and magic2 == 0).
|
||||||
|
*/
|
||||||
v2_hdr++;
|
v2_hdr++;
|
||||||
|
}
|
||||||
|
|
||||||
if (v2_hdr->magic1 != 0 || v2_hdr->magic2 != 0)
|
if (v2_hdr->magic1 != 0 || v2_hdr->magic2 != 0)
|
||||||
{
|
{
|
||||||
|
/*************************
|
||||||
|
* Handle v1 relocations *
|
||||||
|
*************************/
|
||||||
runtime_pseudo_reloc_item_v1 * o;
|
runtime_pseudo_reloc_item_v1 * o;
|
||||||
for (o = (runtime_pseudo_reloc_item_v1 *) v2_hdr; o < (runtime_pseudo_reloc_item_v1 *)end; o++)
|
for (o = (runtime_pseudo_reloc_item_v1 *) v2_hdr;
|
||||||
|
o < (runtime_pseudo_reloc_item_v1 *)end;
|
||||||
|
o++)
|
||||||
{
|
{
|
||||||
DWORD newval;
|
DWORD newval;
|
||||||
reloc_target = (ptrdiff_t) base + o->target;
|
reloc_target = (ptrdiff_t) base + o->target;
|
||||||
|
@ -81,24 +263,41 @@ do_pseudo_reloc (void *start, void *end, void *base)
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If we got this far, then we have relocations of version 2 or newer */
|
||||||
|
|
||||||
/* Check if this is a known version. */
|
/* Check if this is a known version. */
|
||||||
if (v2_hdr->version != RP_VERSION_V2)
|
if (v2_hdr->version != RP_VERSION_V2)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
__report_error (" Unknown pseudo relocation protocol version %d.\n",
|
||||||
fprintf (stderr, "pseudo_relocation protocol version %d is unknown to this runtime.\n",
|
|
||||||
(int) v2_hdr->version);
|
(int) v2_hdr->version);
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*************************
|
||||||
|
* Handle v2 relocations *
|
||||||
|
*************************/
|
||||||
|
|
||||||
/* Walk over header. */
|
/* Walk over header. */
|
||||||
r = (runtime_pseudo_reloc_item_v2 *) &v2_hdr[1];
|
r = (runtime_pseudo_reloc_item_v2 *) &v2_hdr[1];
|
||||||
|
|
||||||
for (; r < (runtime_pseudo_reloc_item_v2 *) end; r++)
|
for (; r < (runtime_pseudo_reloc_item_v2 *) end; r++)
|
||||||
{
|
{
|
||||||
|
/* location where new address will be written */
|
||||||
reloc_target = (ptrdiff_t) base + r->target;
|
reloc_target = (ptrdiff_t) base + r->target;
|
||||||
|
|
||||||
|
/* get sym pointer. It points either to the iat entry
|
||||||
|
* of the referenced element, or to the stub function.
|
||||||
|
*/
|
||||||
addr_imp = (ptrdiff_t) base + r->sym;
|
addr_imp = (ptrdiff_t) base + r->sym;
|
||||||
addr_imp = *((ptrdiff_t *) addr_imp);
|
addr_imp = *((ptrdiff_t *) addr_imp);
|
||||||
|
|
||||||
|
/* read existing relocation value from image, casting to the
|
||||||
|
* bitsize indicated by the 8 LSBs of flags. If the value is
|
||||||
|
* negative, manually sign-extend to ptrdiff_t width. Raise an
|
||||||
|
* error if the bitsize indicated by the 8 LSBs of flags is not
|
||||||
|
* supported.
|
||||||
|
*/
|
||||||
switch ((r->flags & 0xff))
|
switch ((r->flags & 0xff))
|
||||||
{
|
{
|
||||||
case 8:
|
case 8:
|
||||||
|
@ -125,13 +324,16 @@ do_pseudo_reloc (void *start, void *end, void *base)
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
reldata=0;
|
reldata=0;
|
||||||
#ifdef DEBUG
|
__report_error (" Unknown pseudo relocation bit size %d.\n",
|
||||||
fprintf(stderr, "Unknown pseudo relocation bit size %d\n",(int) (r->flags & 0xff));
|
(int) (r->flags & 0xff));
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Adjust the relocation value */
|
||||||
reldata -= ((ptrdiff_t) base + r->sym);
|
reldata -= ((ptrdiff_t) base + r->sym);
|
||||||
reldata += addr_imp;
|
reldata += addr_imp;
|
||||||
|
|
||||||
|
/* Write the new relocation value back to *reloc_target */
|
||||||
switch ((r->flags & 0xff))
|
switch ((r->flags & 0xff))
|
||||||
{
|
{
|
||||||
case 8:
|
case 8:
|
||||||
|
@ -152,14 +354,14 @@ do_pseudo_reloc (void *start, void *end, void *base)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _pei386_runtime_relocator (void);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_pei386_runtime_relocator (void)
|
_pei386_runtime_relocator (void)
|
||||||
{
|
{
|
||||||
static int was_init = 0;
|
static NO_COPY int was_init = 0;
|
||||||
if (was_init)
|
if (was_init)
|
||||||
return;
|
return;
|
||||||
++was_init;
|
++was_init;
|
||||||
do_pseudo_reloc (&__RUNTIME_PSEUDO_RELOC_LIST__,&__RUNTIME_PSEUDO_RELOC_LIST_END__,&__ImageBase);
|
do_pseudo_reloc (&__RUNTIME_PSEUDO_RELOC_LIST__,
|
||||||
|
&__RUNTIME_PSEUDO_RELOC_LIST_END__,
|
||||||
|
&__MINGW_LSYMBOL(_image_base__));
|
||||||
}
|
}
|
||||||
|
|
16
reactos/lib/3rdparty/mingw/strcasecmp.c
vendored
Normal file
16
reactos/lib/3rdparty/mingw/strcasecmp.c
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define __CRT__NO_INLINE
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#undef strcasecmp
|
||||||
|
int strcasecmp (const char *, const char *);
|
||||||
|
int
|
||||||
|
strcasecmp (const char *sz1, const char *sz2)
|
||||||
|
{
|
||||||
|
return _stricmp (sz1,sz2);
|
||||||
|
}
|
17
reactos/lib/3rdparty/mingw/strncasecmp.c
vendored
Normal file
17
reactos/lib/3rdparty/mingw/strncasecmp.c
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define __CRT__NO_INLINE
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#undef strncasecmp
|
||||||
|
int strncasecmp (const char *, const char *, size_t);
|
||||||
|
|
||||||
|
int
|
||||||
|
strncasecmp (const char *sz1,const char *sz2,size_t sizeMaxCompare)
|
||||||
|
{
|
||||||
|
return _strnicmp (sz1,sz2,sizeMaxCompare);
|
||||||
|
}
|
13
reactos/lib/3rdparty/mingw/tlsmcrt.c
vendored
Normal file
13
reactos/lib/3rdparty/mingw/tlsmcrt.c
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* Written by Kai Tietz <kai.tietz@onevision.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* We support TLS cleanup code in any case. If shared version of libgcc is used _CRT_MT has value 1,
|
||||||
|
otherwise
|
||||||
|
we do tls cleanup in runtime and _CRT_MT has value 2. */
|
||||||
|
int _CRT_MT = 2;
|
||||||
|
|
59
reactos/lib/3rdparty/mingw/tlsmthread.c
vendored
Normal file
59
reactos/lib/3rdparty/mingw/tlsmthread.c
vendored
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* Written by Kai Tietz <kai.tietz@onevision.com>
|
||||||
|
*/
|
||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
|
#include <windows.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int __mingwthr_key_dtor (DWORD key, void (*dtor)(void *));
|
||||||
|
int __mingwthr_remove_key_dtor (DWORD key);
|
||||||
|
|
||||||
|
extern int ___w64_mingwthr_remove_key_dtor (DWORD key);
|
||||||
|
extern int ___w64_mingwthr_add_key_dtor (DWORD key, void (*dtor)(void *));
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _WIN64
|
||||||
|
#define MINGWM10_DLL "mingwm10.dll"
|
||||||
|
typedef int (*fMTRemoveKeyDtor)(DWORD key);
|
||||||
|
typedef int (*fMTKeyDtor)(DWORD key, void (*dtor)(void *));
|
||||||
|
extern fMTRemoveKeyDtor __mingw_gMTRemoveKeyDtor;
|
||||||
|
extern fMTKeyDtor __mingw_gMTKeyDtor;
|
||||||
|
extern int __mingw_usemthread_dll;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int
|
||||||
|
__mingwthr_remove_key_dtor (DWORD key)
|
||||||
|
{
|
||||||
|
#ifndef _WIN64
|
||||||
|
if (!__mingw_usemthread_dll)
|
||||||
|
#endif
|
||||||
|
return ___w64_mingwthr_remove_key_dtor (key);
|
||||||
|
#ifndef _WIN64
|
||||||
|
if (__mingw_gMTRemoveKeyDtor)
|
||||||
|
return (*__mingw_gMTRemoveKeyDtor) (key);
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
__mingwthr_key_dtor (DWORD key, void (*dtor)(void *))
|
||||||
|
{
|
||||||
|
if (dtor)
|
||||||
|
{
|
||||||
|
#ifndef _WIN64
|
||||||
|
if (!__mingw_usemthread_dll)
|
||||||
|
#endif
|
||||||
|
return ___w64_mingwthr_add_key_dtor (key, dtor);
|
||||||
|
#ifndef _WIN64
|
||||||
|
if (__mingw_gMTKeyDtor)
|
||||||
|
return (*__mingw_gMTKeyDtor) (key, dtor);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
56
reactos/lib/3rdparty/mingw/tlssup.c
vendored
56
reactos/lib/3rdparty/mingw/tlssup.c
vendored
|
@ -1,20 +1,32 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
|
*
|
||||||
|
* Written by Kai Tietz <kai.tietz@onevision.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CRTDLL
|
#ifdef CRTDLL
|
||||||
#undef CRTDLL
|
#undef CRTDLL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <internal.h>
|
|
||||||
#include <sect_attribs.h>
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <memory.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <crtdbg.h>
|
|
||||||
|
|
||||||
extern BOOL __mingw_TLScallback (HANDLE hDllHandle, DWORD reason, LPVOID reserved);
|
#ifndef _CRTALLOC
|
||||||
|
#define _CRTALLOC(x) __attribute__ ((section (x) ))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __INTERNAL_FUNC_DEFINED
|
||||||
|
#define __INTERNAL_FUNC_DEFINED
|
||||||
|
typedef void (__cdecl *_PVFV)(void);
|
||||||
|
typedef int (__cdecl *_PIFV)(void);
|
||||||
|
typedef void (__cdecl *_PVFI)(int);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern WINBOOL __mingw_TLScallback (HANDLE hDllHandle, DWORD reason, LPVOID reserved);
|
||||||
|
|
||||||
#define FUNCS_PER_NODE 30
|
#define FUNCS_PER_NODE 30
|
||||||
|
|
||||||
|
@ -66,6 +78,16 @@ static __CRT_THREAD TlsDtorNode dtor_list_head;
|
||||||
|
|
||||||
extern int _CRT_MT;
|
extern int _CRT_MT;
|
||||||
|
|
||||||
|
#ifndef _WIN64
|
||||||
|
#define MINGWM10_DLL "mingwm10.dll"
|
||||||
|
typedef int (*fMTRemoveKeyDtor)(DWORD key);
|
||||||
|
typedef int (*fMTKeyDtor)(DWORD key, void (*dtor)(void *));
|
||||||
|
fMTRemoveKeyDtor __mingw_gMTRemoveKeyDtor;
|
||||||
|
fMTKeyDtor __mingw_gMTKeyDtor;
|
||||||
|
int __mingw_usemthread_dll;
|
||||||
|
static HANDLE __mingw_mthread_hdll;
|
||||||
|
#endif
|
||||||
|
|
||||||
BOOL WINAPI __dyn_tls_init (HANDLE, DWORD, LPVOID);
|
BOOL WINAPI __dyn_tls_init (HANDLE, DWORD, LPVOID);
|
||||||
|
|
||||||
BOOL WINAPI
|
BOOL WINAPI
|
||||||
|
@ -73,6 +95,30 @@ __dyn_tls_init (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
|
||||||
{
|
{
|
||||||
_PVFV *pfunc;
|
_PVFV *pfunc;
|
||||||
|
|
||||||
|
#ifndef _WIN64
|
||||||
|
if (_winmajor < 4)
|
||||||
|
{
|
||||||
|
__mingw_usemthread_dll = 1;
|
||||||
|
__mingw_mthread_hdll = LoadLibrary (MINGWM10_DLL);
|
||||||
|
if (__mingw_mthread_hdll != NULL)
|
||||||
|
{
|
||||||
|
__mingw_gMTRemoveKeyDtor = (fMTRemoveKeyDtor) GetProcAddress (__mingw_mthread_hdll, "__mingwthr_remove_key_dtor");
|
||||||
|
__mingw_gMTKeyDtor = (fMTKeyDtor) GetProcAddress (__mingw_mthread_hdll, "__mingwthr_key_dtor");
|
||||||
|
}
|
||||||
|
if (__mingw_mthread_hdll == NULL || !__mingw_gMTRemoveKeyDtor || !__mingw_gMTKeyDtor)
|
||||||
|
{
|
||||||
|
__mingw_gMTKeyDtor = NULL;
|
||||||
|
__mingw_gMTRemoveKeyDtor = NULL;
|
||||||
|
if (__mingw_mthread_hdll)
|
||||||
|
FreeLibrary (__mingw_mthread_hdll);
|
||||||
|
__mingw_mthread_hdll = NULL;
|
||||||
|
_CRT_MT = 0;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
_CRT_MT = 1;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
/* We don't let us trick here. */
|
/* We don't let us trick here. */
|
||||||
if (_CRT_MT != 2)
|
if (_CRT_MT != 2)
|
||||||
_CRT_MT = 2;
|
_CRT_MT = 2;
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
/*
|
/**
|
||||||
* mthr_stub.c
|
* 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.
|
||||||
*
|
*
|
||||||
* Implement Mingw-w64 thread-support.
|
* Written by Kai Tietz <kai.tietz@onevision.com>
|
||||||
*
|
*
|
||||||
* This file is used by if gcc is built with --enable-threads=win32.
|
* This file is used by if gcc is built with --enable-threads=win32.
|
||||||
*
|
*
|
||||||
|
@ -15,7 +17,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
BOOL __mingw_TLScallback (HANDLE hDllHandle, DWORD reason, LPVOID reserved);
|
WINBOOL __mingw_TLScallback (HANDLE hDllHandle, DWORD reason, LPVOID reserved);
|
||||||
int ___w64_mingwthr_remove_key_dtor (DWORD key);
|
int ___w64_mingwthr_remove_key_dtor (DWORD key);
|
||||||
int ___w64_mingwthr_add_key_dtor (DWORD key, void (*dtor)(void *));
|
int ___w64_mingwthr_add_key_dtor (DWORD key, void (*dtor)(void *));
|
||||||
|
|
||||||
|
@ -42,12 +44,10 @@ ___w64_mingwthr_add_key_dtor (DWORD key, void (*dtor)(void *))
|
||||||
|
|
||||||
if (__mingwthr_cs_init == 0)
|
if (__mingwthr_cs_init == 0)
|
||||||
return 0;
|
return 0;
|
||||||
new_key = (__mingwthr_key_t *)malloc(sizeof (__mingwthr_key_t));
|
new_key = (__mingwthr_key_t *) calloc (1, sizeof (__mingwthr_key_t));
|
||||||
|
|
||||||
if (new_key == NULL)
|
if (new_key == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
memset(new_key, 0,sizeof (__mingwthr_key_t));
|
|
||||||
new_key->key = key;
|
new_key->key = key;
|
||||||
new_key->dtor = dtor;
|
new_key->dtor = dtor;
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ __mingwthr_run_key_dtors (void)
|
||||||
LeaveCriticalSection (&__mingwthr_cs);
|
LeaveCriticalSection (&__mingwthr_cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL
|
WINBOOL
|
||||||
__mingw_TLScallback (HANDLE hDllHandle __attribute__ ((__unused__)),
|
__mingw_TLScallback (HANDLE hDllHandle __attribute__ ((__unused__)),
|
||||||
DWORD reason,
|
DWORD reason,
|
||||||
LPVOID reserved __attribute__ ((__unused__)))
|
LPVOID reserved __attribute__ ((__unused__)))
|
17
reactos/lib/3rdparty/mingw/toascii.c
vendored
Normal file
17
reactos/lib/3rdparty/mingw/toascii.c
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#undef toascii
|
||||||
|
|
||||||
|
int toascii (int);
|
||||||
|
|
||||||
|
int
|
||||||
|
toascii (int c)
|
||||||
|
{
|
||||||
|
return __toascii(c);
|
||||||
|
}
|
2
reactos/lib/3rdparty/mingw/txtmode.c
vendored
2
reactos/lib/3rdparty/mingw/txtmode.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
14
reactos/lib/3rdparty/mingw/ucrtexe.c
vendored
Normal file
14
reactos/lib/3rdparty/mingw/ucrtexe.c
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
/**
|
||||||
|
* 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 UNICODE
|
||||||
|
#define UNICODE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define WPRFLAG 1
|
||||||
|
|
||||||
|
#include "crtexe.c"
|
||||||
|
|
14
reactos/lib/3rdparty/mingw/udll_argv.c
vendored
Normal file
14
reactos/lib/3rdparty/mingw/udll_argv.c
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
/**
|
||||||
|
* 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 UNICODE
|
||||||
|
#define UNICODE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define WPRFLAG 1
|
||||||
|
|
||||||
|
#include "dll_argv.c"
|
||||||
|
|
14
reactos/lib/3rdparty/mingw/udllargc.c
vendored
Normal file
14
reactos/lib/3rdparty/mingw/udllargc.c
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
/**
|
||||||
|
* 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 UNICODE
|
||||||
|
#define UNICODE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define WPRFLAG 1
|
||||||
|
|
||||||
|
#include "dllargv.c"
|
||||||
|
|
17
reactos/lib/3rdparty/mingw/wcscmpi.c
vendored
Normal file
17
reactos/lib/3rdparty/mingw/wcscmpi.c
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define __CRT__NO_INLINE
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#undef wcscmpi
|
||||||
|
int wcscmpi (const wchar_t *, const wchar_t *);
|
||||||
|
|
||||||
|
int
|
||||||
|
wcscmpi (const wchar_t * ws1,const wchar_t * ws2)
|
||||||
|
{
|
||||||
|
return _wcsicmp (ws1,ws2);
|
||||||
|
}
|
18
reactos/lib/3rdparty/mingw/wildcard.c
vendored
18
reactos/lib/3rdparty/mingw/wildcard.c
vendored
|
@ -1,19 +1,33 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* _dowildcard is an int that controls the globbing of the command line.
|
/* _dowildcard is an int that controls the globbing of the command line.
|
||||||
* If _dowildcard is non-zero, the command line will be globbed: *.*
|
* If _dowildcard is non-zero, the command line will be globbed: *.*
|
||||||
* will be expanded to be all files in the startup directory.
|
* will be expanded to be all files in the startup directory.
|
||||||
|
*
|
||||||
* In the mingw-w64 library the _dowildcard variable is defined as being
|
* In the mingw-w64 library the _dowildcard variable is defined as being
|
||||||
* 0, therefore command line globbing is DISABLED by default. To turn it
|
* 0, therefore command line globbing is DISABLED by default. To turn it
|
||||||
* on and to leave wildcard command line processing MS's globbing code,
|
* on and to leave wildcard command line processing MS's globbing code,
|
||||||
* include a line in one of your source modules defining _dowildcard and
|
* include a line in one of your source modules defining _dowildcard and
|
||||||
* setting it to -1, like so:
|
* setting it to -1, like so:
|
||||||
* int _dowildcard = -1;
|
* int _dowildcard = -1;
|
||||||
|
*
|
||||||
|
* Alternatively, the mingw-w64 library can be configured using the
|
||||||
|
* --enable-wildcard option and compiled thusly upon which the resulting
|
||||||
|
* library will have _dowildcard as -1 and command line globbing will be
|
||||||
|
* enabled by default.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int _dowildcard = 0;
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __ENABLE_GLOBBING
|
||||||
|
#define __ENABLE_GLOBBING 0 /* -1 */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int _dowildcard = __ENABLE_GLOBBING;
|
||||||
|
|
||||||
|
|
2
reactos/lib/3rdparty/mingw/xncommod.c
vendored
2
reactos/lib/3rdparty/mingw/xncommod.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int _commode = 0;
|
int _commode = 0;
|
||||||
|
|
2
reactos/lib/3rdparty/mingw/xthdloc.c
vendored
2
reactos/lib/3rdparty/mingw/xthdloc.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int __globallocalestatus = ~0x1;
|
int __globallocalestatus = ~0x1;
|
||||||
|
|
2
reactos/lib/3rdparty/mingw/xtxtmode.c
vendored
2
reactos/lib/3rdparty/mingw/xtxtmode.c
vendored
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* This file has no copyright assigned and is placed in the Public Domain.
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
* This file is part of the w64 mingw-runtime package.
|
* This file is part of the w64 mingw-runtime package.
|
||||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int _fmode = 0;
|
int _fmode = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue