Beispiel #1
0
static int __cdecl
pre_c_init (void)
{
  managedapp = check_managed_app ();
  if (mingw_app_type)
    __set_app_type(_GUI_APP);
  else
    __set_app_type (_CONSOLE_APP);
  __onexitbegin = __onexitend = (_PVFV *) _encode_pointer ((_PVFV *)(-1));

  * __MINGW_IMP_SYMBOL(_fmode) = _fmode;
  * __MINGW_IMP_SYMBOL(_commode) = _commode;

#ifdef WPRFLAG
  _wsetargv();
#else
  _setargv();
#endif
  if (_MINGW_INSTALL_DEBUG_MATHERR)
    {
      if (! __defaultmatherr)
	{
	  __setusermatherr (_matherr);
	  __defaultmatherr = 1;
	}
    }

  if (__globallocalestatus == -1)
    {
    }
  return 0;
}
Beispiel #2
0
void __cdecl _tzset(void)
{
  __MINGW_IMP_SYMBOL(_tzset)();
  // Redirect the __imp_ pointers to the actual data provided by the UCRT.
  // From this point, the exposed values should stay in sync.
  __MINGW_IMP_SYMBOL(tzname) = _tzname;
  __MINGW_IMP_SYMBOL(timezone) = __timezone();
  __MINGW_IMP_SYMBOL(daylight) = __daylight();
}
Beispiel #3
0
static int __cdecl
_stub (char *_DstBuf, size_t _Size, const char *_Format, va_list _ArgList)
{
  int __cdecl (*f)(char *, size_t, const char *, va_list) = __MINGW_IMP_SYMBOL(vsprintf_s);

  if (f == _stub)
    {
	f = (int __cdecl (*)(char *, size_t, const char *, va_list))
	    GetProcAddress (__mingw_get_msvcrt_handle (), "vsprintf_s");
	if (!f)
	  f = _int_vsprintf_s;
	__MINGW_IMP_SYMBOL(vsprintf_s) = f;
    }
  return (*f)(_DstBuf, _Size, _Format, _ArgList);
}
static errno_t __cdecl
_stub (struct tm *ptm, const __time32_t *pt)
{
  errno_t __cdecl (*f)(struct tm *, const __time32_t *) = __MINGW_IMP_SYMBOL(_localtime32_s);

  if (f == _stub)
    {
	f = (errno_t __cdecl (*)(struct tm *, const __time32_t *))
	    GetProcAddress (__mingw_get_msvcrt_handle (), "_localtime32_s");
	if (!f)
	  f = _int_localtime32_s;
	__MINGW_IMP_SYMBOL(_localtime32_s) = f;
    }
  return (*f)(ptm, pt);
}
Beispiel #5
0
static errno_t __cdecl
_stub (int* pfh, const char *filename, int oflag, int shflag, int pmode)
{
    errno_t __cdecl (*f)(int *, const char *, int, int, int) = __MINGW_IMP_SYMBOL(_sopen_s);

    if (f == _stub) {
        f = (errno_t __cdecl (*)(int *, const char *, int, int, int))
            GetProcAddress (__mingw_get_msvcrt_handle (), "_sopen_s");
        if (f == NULL)
            f = _int_sopen_s;
        __MINGW_IMP_SYMBOL(_sopen_s) = f;
    }

    return (*f)(pfh, filename, oflag, shflag, pmode);
}
Beispiel #6
0
static errno_t __cdecl
_stub (const char *s, int m)
{
  errno_t __cdecl (*f)(const char *, int) = __MINGW_IMP_SYMBOL(_access_s);

  if (f == _stub)
    {
	f = (errno_t __cdecl (*)(const char *, int))
	    GetProcAddress (__mingw_get_msvcrt_handle (), "_access_s");
	if (!f)
	  f = _int_access_s;
	__MINGW_IMP_SYMBOL(_access_s) = f;
    }
  return (*f)(s, m);
}
Beispiel #7
0
static errno_t __cdecl
_stub (char *s, size_t l, size_t *r_len)
{
  errno_t __cdecl (*f)(char *, size_t, size_t *) = __MINGW_IMP_SYMBOL(_cgets_s);

  if (f == _stub)
    {
	f = (errno_t __cdecl (*)(char *, size_t, size_t *))
	    GetProcAddress (__mingw_get_msvcrt_handle (), "_cgets_s");
	if (!f)
	  f = _int_cgets_s;
	__MINGW_IMP_SYMBOL(_cgets_s) = f;
    }
  return (*f)(s, l, r_len);
}
Beispiel #8
0
static errno_t __cdecl
_stub (wchar_t *d, size_t dn, const wchar_t *s, size_t n)
{
  errno_t __cdecl (*f)(wchar_t *, size_t, const wchar_t *, size_t) = __MINGW_IMP_SYMBOL(wmemmove_s);

  if (f == _stub)
    {
 f = (errno_t __cdecl (*)(wchar_t *, size_t, const wchar_t *, size_t))
    GetProcAddress (__mingw_get_msvcrt_handle (), "wmemmove_s");
 if (!f)
  f = _int_wmemmove_s;
 __MINGW_IMP_SYMBOL(wmemmove_s) = f;
    }
  return (*f)(d, dn, s, n);
}
Beispiel #9
0
static errno_t __cdecl
_stub (char *d, size_t dn)
{
  errno_t __cdecl (*f)(char *, size_t) = __MINGW_IMP_SYMBOL(_strdate_s);

  if (f == _stub)
    {
	f = (errno_t __cdecl (*)(char *, size_t))
	    GetProcAddress (__mingw_get_msvcrt_handle (), "_strdate_s");
	if (!f)
	  f = _int_strdate_s;
	__MINGW_IMP_SYMBOL(_strdate_s) = f;
    }
  return (*f)(d, dn);
}
Beispiel #10
0
static int __cdecl
_stub (const char *s, _locale_t loc, va_list argp)
{
  int __cdecl (*f)(const char *, _locale_t, va_list) = __MINGW_IMP_SYMBOL(_vcprintf_s_l);

  if (f == _stub)
    {
	f = (int __cdecl (*)(const char *, _locale_t, va_list))
	    GetProcAddress (__mingw_get_msvcrt_handle (), "_vcprintf_s_l");
	if (!f)
	  f = _int_vcprintf_s_l;
	__MINGW_IMP_SYMBOL(_vcprintf_s_l) = f;
    }
  return (*f)(s, loc, argp);
}
Beispiel #11
0
static errno_t __cdecl
_stub (char *d, size_t dn, const __time32_t *pt)
{
  errno_t __cdecl (*f)(char *, size_t, const __time32_t *) = __MINGW_IMP_SYMBOL(_ctime32_s);

  if (f == _stub)
    {
	f = (errno_t __cdecl (*)(char *, size_t, const __time32_t *))
	    GetProcAddress (__mingw_get_msvcrt_handle (), "_ctime32_s");
	if (!f)
	  f = _int_ctime32_s;
	__MINGW_IMP_SYMBOL(_ctime32_s) = f;
    }
  return (*f)(d, dn, pt);
}
Beispiel #12
0
static unsigned int init_get_output_format(void)
{
  f_get_output_format gof;

  gof = (f_get_output_format) GetProcAddress (__mingw_get_msvcrt_handle(), "_get_output_format");
  if(!gof)
      gof = fake_get_output_format;

  return (__MINGW_IMP_SYMBOL(_get_output_format) = gof)();
}
Beispiel #13
0
static unsigned int init_set_output_format(unsigned int format)
{
  f_set_output_format sof;

  sof = (f_set_output_format) GetProcAddress (__mingw_get_msvcrt_handle(), "_set_output_format");
  if(!sof)
      sof = fake_set_output_format;

  return (__MINGW_IMP_SYMBOL(_set_output_format) = sof)(format);
}
Beispiel #14
0
static void __cdecl init_wassert(const wchar_t *message, const wchar_t *file, unsigned line)
{
    void *func;

    func = (void*)GetProcAddress(__mingw_get_msvcrt_handle(), "_wassert");
    if(!func)
        func = mingw_wassert;

    return (__MINGW_IMP_SYMBOL(_wassert) = func)(message, file, line);
}
Beispiel #15
0
_onexit_t __cdecl mingw_onexit(_onexit_t func)
{
  _PVFV *onexitbegin;
  _PVFV *onexitend;
  _onexit_t retval;

  onexitbegin = (_PVFV *) _decode_pointer (__onexitbegin);

  if (onexitbegin == (_PVFV *) -1)
    return (* __MINGW_IMP_SYMBOL(_onexit)) (func);
  _lock (_EXIT_LOCK1);
  onexitbegin = (_PVFV *) _decode_pointer (__onexitbegin);
  onexitend = (_PVFV *) _decode_pointer (__onexitend);
  
  retval = __dllonexit (func, &onexitbegin, &onexitend);

  __onexitbegin = (_PVFV *) _encode_pointer (onexitbegin);
  __onexitend = (_PVFV *) _encode_pointer (onexitend);
  _unlock (_EXIT_LOCK1);
  return retval;
}
Beispiel #16
0
void _fpreset (void)
{
  (* __MINGW_IMP_SYMBOL(_fpreset))();
}
Beispiel #17
0
unsigned int _get_output_format(void)
{
    return __MINGW_IMP_SYMBOL(_get_output_format)();
}
Beispiel #18
0
unsigned int _set_output_format(unsigned int format)
{
    return __MINGW_IMP_SYMBOL(_set_output_format)(format);
}