mirror of
https://github.com/reactos/reactos.git
synced 2026-06-01 08:50:24 +08:00
[CRTDLL] Build from msvcrt sources
This commit is contained in:
@@ -3,23 +3,21 @@ spec2def(crtdll.dll crtdll.spec ADD_IMPORTLIB)
|
||||
|
||||
add_definitions(
|
||||
-DUSE_MSVCRT_PREFIX
|
||||
-D_MSVCRT_LIB_
|
||||
-D_MSVCRT_
|
||||
-DCRTDLL
|
||||
-D_CTYPE_DISABLE_MACROS
|
||||
-D_NO_INLINING
|
||||
-D__MINGW_IMPORT="")
|
||||
-DCRTDLL)
|
||||
|
||||
include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/crt/include)
|
||||
|
||||
list(APPEND SOURCE
|
||||
dllmain.c
|
||||
crtdll.rc
|
||||
${CMAKE_CURRENT_BINARY_DIR}/crtdll_stubs.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/crtdll.def)
|
||||
|
||||
add_library(crtdll MODULE ${SOURCE})
|
||||
set_module_type(crtdll win32dll ENTRYPOINT DllMain 12)
|
||||
target_link_libraries(crtdll crt vcruntime wine ${PSEH_LIB})
|
||||
target_link_libraries(crtdll msvcrt_static crtmath vcruntime chkstk wine ${PSEH_LIB})
|
||||
add_dependencies(crtdll psdk)
|
||||
|
||||
add_importlibs(crtdll kernel32 ntdll)
|
||||
add_importlibs(crtdll kernel32 kernel32_vista ntdll)
|
||||
add_delay_importlibs(crtdll user32)
|
||||
add_cd_file(TARGET crtdll DESTINATION reactos/system32 FOR all)
|
||||
|
||||
@@ -22,22 +22,22 @@
|
||||
@ extern _HUGE_dll _HUGE
|
||||
@ cdecl _XcptFilter()
|
||||
@ cdecl __GetMainArgs(ptr ptr ptr long)
|
||||
@ extern __argc_dll __argc
|
||||
@ extern __argv_dll __argv
|
||||
@ extern __argc_dll MSVCRT___argc
|
||||
@ extern __argv_dll MSVCRT___argv
|
||||
@ cdecl __dllonexit(ptr ptr ptr)
|
||||
@ cdecl __doserrno()
|
||||
@ cdecl __fpecode()
|
||||
@ cdecl __isascii(long)
|
||||
@ cdecl __iscsym(long)
|
||||
@ cdecl __iscsymf(long)
|
||||
@ extern __mb_cur_max_dll __mb_cur_max
|
||||
@ extern __mb_cur_max_dll MSVCRT___mb_cur_max
|
||||
@ cdecl __pxcptinfoptrs()
|
||||
@ cdecl __threadhandle()
|
||||
@ cdecl __threadid()
|
||||
@ cdecl __threadhandle() kernel32.GetCurrentThread
|
||||
@ cdecl __threadid() kernel32.GetCurrentThreadId
|
||||
@ cdecl __toascii(long)
|
||||
@ cdecl _abnormal_termination()
|
||||
@ cdecl -arch=i386 _abnormal_termination() __intrinsic_abnormal_termination
|
||||
@ cdecl _access(str long)
|
||||
@ extern _acmdln_dll _acmdln
|
||||
@ extern _acmdln_dll MSVCRT__acmdln
|
||||
@ extern _aexit_rtn_dll _aexit_rtn
|
||||
@ cdecl _amsg_exit(long)
|
||||
@ cdecl _assert(str str long)
|
||||
@@ -58,7 +58,7 @@
|
||||
@ cdecl _clearfp()
|
||||
@ cdecl _close(long)
|
||||
@ cdecl _commit(long)
|
||||
@ extern _commode_dll _commode
|
||||
@ extern _commode MSVCRT__commode
|
||||
@ cdecl _control87(long long)
|
||||
@ cdecl _controlfp(long long)
|
||||
@ cdecl _copysign( double double )
|
||||
@@ -67,14 +67,14 @@
|
||||
@ cdecl _cputs(str)
|
||||
@ cdecl _creat(str long)
|
||||
@ varargs _cscanf(str)
|
||||
@ extern _ctype
|
||||
@ extern _ctype MSVCRT__ctype
|
||||
@ cdecl _cwait(ptr long long)
|
||||
@ extern _daylight_dll _daylight
|
||||
@ extern _daylight_dll MSVCRT___daylight
|
||||
@ cdecl _dup(long)
|
||||
@ cdecl _dup2(long long)
|
||||
@ cdecl _ecvt( double long ptr ptr)
|
||||
@ cdecl _endthread()
|
||||
@ extern _environ_dll _environ
|
||||
@ extern _environ_dll MSVCRT__environ
|
||||
@ cdecl _eof(long)
|
||||
@ cdecl _errno()
|
||||
@ cdecl _except_handler2(ptr ptr ptr ptr)
|
||||
@@ -103,7 +103,7 @@
|
||||
@ cdecl _finite( double )
|
||||
@ cdecl _flsbuf(long ptr)
|
||||
@ cdecl _flushall()
|
||||
@ extern _fmode_dll _fmode
|
||||
@ extern _fmode MSVCRT__fmode
|
||||
@ cdecl _fpclass(double)
|
||||
@ cdecl _fpieee_flt(long ptr ptr)
|
||||
@ cdecl _fpreset()
|
||||
@@ -111,10 +111,10 @@
|
||||
@ cdecl _fputwchar(long)
|
||||
@ cdecl _fsopen(str str long)
|
||||
@ cdecl _fstat(long ptr) CRTDLL__fstat
|
||||
@ cdecl _ftime(ptr)
|
||||
@ cdecl _ftime(ptr) _ftime32
|
||||
@ cdecl -ret64 _ftol()
|
||||
@ cdecl _fullpath(ptr str long)
|
||||
@ cdecl _futime(long ptr)
|
||||
@ cdecl _futime(long ptr) _futime32
|
||||
@ cdecl _gcvt( double long str)
|
||||
@ cdecl _get_osfhandle(long)
|
||||
@ cdecl _getch()
|
||||
@@ -124,9 +124,9 @@
|
||||
@ cdecl _getdiskfree(long ptr)
|
||||
@ cdecl _getdllprocaddr(long str long)
|
||||
@ cdecl _getdrive()
|
||||
@ cdecl _getdrives()
|
||||
@ cdecl _getdrives() kernel32.GetLogicalDrives
|
||||
@ cdecl _getpid()
|
||||
@ cdecl _getsystime(ptr)
|
||||
@ cdecl -stub _getsystime(ptr)
|
||||
@ cdecl _getw(ptr)
|
||||
@ cdecl _global_unwind2(ptr)
|
||||
@ cdecl _heapchk()
|
||||
@@ -135,18 +135,18 @@
|
||||
@ cdecl _heapwalk(ptr)
|
||||
@ cdecl _hypot(double double)
|
||||
@ cdecl _initterm(ptr ptr)
|
||||
@ extern _iob
|
||||
@ extern _iob MSVCRT__iob
|
||||
@ cdecl _isatty(long)
|
||||
@ cdecl _isctype(long long)
|
||||
@ cdecl _ismbbalnum(long)
|
||||
@ cdecl _ismbbalpha(long)
|
||||
@ cdecl _ismbbgraph(long)
|
||||
@ cdecl _ismbbkalnum(long)
|
||||
@ stub _ismbbalnum(long)
|
||||
@ stub _ismbbalpha(long)
|
||||
@ stub _ismbbgraph(long)
|
||||
@ stub _ismbbkalnum(long)
|
||||
@ cdecl _ismbbkana(long)
|
||||
@ cdecl _ismbbkpunct(long)
|
||||
@ stub _ismbbkpunct(long)
|
||||
@ cdecl _ismbblead(long)
|
||||
@ cdecl _ismbbprint(long)
|
||||
@ cdecl _ismbbpunct(long)
|
||||
@ stub _ismbbprint(long)
|
||||
@ stub _ismbbpunct(long)
|
||||
@ cdecl _ismbbtrail(long)
|
||||
@ cdecl _ismbcalpha(long)
|
||||
@ cdecl _ismbcdigit(long)
|
||||
@@ -175,13 +175,13 @@
|
||||
@ cdecl _local_unwind2(ptr long)
|
||||
@ cdecl _locking(long long long)
|
||||
@ cdecl _logb( double )
|
||||
@ cdecl _lrotl(long long)
|
||||
@ cdecl _lrotr(long long)
|
||||
@ cdecl _lsearch(ptr ptr long long ptr)
|
||||
@ cdecl _lrotl(long long) MSVCRT__lrotl
|
||||
@ cdecl _lrotr(long long) MSVCRT__lrotr
|
||||
@ cdecl _lsearch(ptr ptr ptr long ptr)
|
||||
@ cdecl _lseek(long long long)
|
||||
@ cdecl _ltoa(long ptr long)
|
||||
@ cdecl _ltow(long ptr long)
|
||||
@ cdecl _makepath(str str str str str)
|
||||
@ cdecl _makepath(ptr str str str str)
|
||||
@ cdecl _matherr(ptr)
|
||||
@ cdecl _mbbtombc(long)
|
||||
@ cdecl _mbbtype(long long)
|
||||
@@ -194,7 +194,7 @@
|
||||
@ cdecl _mbctolower(long)
|
||||
@ cdecl _mbctombb(long)
|
||||
@ cdecl _mbctoupper(long)
|
||||
@ extern _mbctype
|
||||
@ extern _mbctype MSVCRT_mbctype
|
||||
@ cdecl _mbsbtype(str long)
|
||||
@ cdecl _mbscat(str str)
|
||||
@ cdecl _mbschr(str long)
|
||||
@@ -202,18 +202,18 @@
|
||||
@ cdecl _mbscpy(ptr str)
|
||||
@ cdecl _mbscspn(str str)
|
||||
@ cdecl _mbsdec(ptr ptr)
|
||||
@ cdecl _mbsdup(str)
|
||||
@ cdecl _mbsdup(str) _strdup
|
||||
@ cdecl _mbsicmp(str str)
|
||||
@ cdecl _mbsinc(str)
|
||||
@ cdecl _mbslen(str)
|
||||
@ cdecl _mbslwr(str)
|
||||
@ cdecl _mbsnbcat(str str long)
|
||||
@ cdecl _mbsnbcat(str str long) CRTDLL__mbsnbcat
|
||||
@ cdecl _mbsnbcmp(str str long)
|
||||
@ cdecl _mbsnbcnt(ptr long)
|
||||
@ cdecl _mbsnbcpy(ptr str long)
|
||||
@ cdecl _mbsnbicmp(str str long)
|
||||
@ cdecl _mbsnbset(str long long)
|
||||
@ cdecl _mbsncat(str str long)
|
||||
@ cdecl _mbsncat(str str long) CRTDLL__mbsncat
|
||||
@ cdecl _mbsnccnt(str long)
|
||||
@ cdecl _mbsncmp(str str long)
|
||||
@ cdecl _mbsncpy(str str long)
|
||||
@@ -227,7 +227,7 @@
|
||||
@ cdecl _mbsset(str long)
|
||||
@ cdecl _mbsspn(str str)
|
||||
@ cdecl _mbsspnp(str str)
|
||||
@ cdecl _mbsstr(str str)
|
||||
@ cdecl _mbsstr(str str) CRTDLL__mbsstr
|
||||
@ cdecl _mbstok(str str)
|
||||
@ cdecl _mbstrlen(str)
|
||||
@ cdecl _mbsupr(str)
|
||||
@@ -243,31 +243,31 @@
|
||||
@ extern _osmajor_dll CRTDLL__osmajor_dll
|
||||
@ extern _osminor_dll CRTDLL__osminor_dll
|
||||
@ extern _osmode_dll CRTDLL__osmode_dll
|
||||
@ extern _osver_dll _osver
|
||||
@ extern _osver_dll MSVCRT__osver
|
||||
@ extern _osversion_dll CRTDLL__osversion_dll
|
||||
@ cdecl _pclose(ptr)
|
||||
@ extern _pctype_dll _pctype
|
||||
@ extern _pgmptr_dll _pgmptr
|
||||
@ extern _pctype_dll MSVCRT__pctype
|
||||
@ extern _pgmptr_dll MSVCRT__pgmptr
|
||||
@ cdecl _pipe(ptr long long)
|
||||
@ cdecl _popen(str str)
|
||||
@ cdecl _purecall()
|
||||
@ cdecl _putch(long)
|
||||
@ cdecl _putenv(str)
|
||||
@ cdecl _putw(long ptr)
|
||||
@ extern _pwctype_dll _pwctype
|
||||
@ extern _pwctype_dll MSVCRT__pwctype
|
||||
@ cdecl _read(long ptr long)
|
||||
@ cdecl _rmdir(str)
|
||||
@ cdecl _rmtmp()
|
||||
@ cdecl _rotl(long long)
|
||||
@ cdecl _rotr(long long)
|
||||
@ cdecl _rotl(long long) MSVCRT__rotl
|
||||
@ cdecl _rotr(long long) MSVCRT__rotr
|
||||
@ cdecl _scalb( double long)
|
||||
@ cdecl _searchenv(str str ptr)
|
||||
@ cdecl _seterrormode(long)
|
||||
@ cdecl -i386 _setjmp(ptr)
|
||||
@ cdecl _setmode(long long)
|
||||
@ cdecl _setsystime(ptr long)
|
||||
@ stub _setsystime(ptr long)
|
||||
@ cdecl _sleep(long)
|
||||
@ varargs _snprintf(str long str)
|
||||
@ varargs _snprintf(str long str) CRTDLL__snprintf
|
||||
@ varargs _snwprintf(wstr long wstr)
|
||||
@ varargs _sopen(str long long)
|
||||
@ varargs _spawnl(long str str)
|
||||
@@ -301,14 +301,14 @@
|
||||
@ cdecl _strtime(ptr)
|
||||
@ cdecl _strupr(str)
|
||||
@ cdecl _swab(str str long)
|
||||
@ extern _sys_errlist
|
||||
@ extern _sys_nerr_dll _sys_nerr
|
||||
@ extern _sys_errlist MSVCRT__sys_errlist
|
||||
@ extern _sys_nerr_dll MSVCRT__sys_nerr
|
||||
@ cdecl _tell(long)
|
||||
@ cdecl _tempnam(str str)
|
||||
@ extern _timezone_dll _timezone
|
||||
@ extern _timezone_dll MSVCRT___timezone
|
||||
@ cdecl _tolower(long)
|
||||
@ cdecl _toupper(long)
|
||||
@ extern _tzname
|
||||
@ extern _tzname MSVCRT__tzname
|
||||
@ cdecl _tzset()
|
||||
@ cdecl _ultoa(long ptr long)
|
||||
@ cdecl _ultow(long ptr long)
|
||||
@@ -316,9 +316,9 @@
|
||||
@ cdecl _ungetch(long)
|
||||
@ cdecl _unlink(str)
|
||||
@ cdecl _unloaddll(long)
|
||||
@ cdecl _utime(str ptr)
|
||||
@ cdecl _vsnprintf(ptr long ptr ptr)
|
||||
@ cdecl _vsnwprintf(ptr long wstr long)
|
||||
@ cdecl _utime(str ptr) _utime32
|
||||
@ cdecl _vsnprintf(ptr long ptr ptr) CRTDLL__vsnprintf
|
||||
@ cdecl _vsnwprintf(ptr long wstr long) CRTDLL__vsnwprintf
|
||||
@ cdecl _wcsdup(wstr)
|
||||
@ cdecl _wcsicmp(wstr wstr)
|
||||
@ cdecl _wcsicoll(wstr wstr)
|
||||
@@ -328,9 +328,9 @@
|
||||
@ cdecl _wcsrev(wstr)
|
||||
@ cdecl _wcsset(wstr long)
|
||||
@ cdecl _wcsupr(wstr)
|
||||
@ extern _winmajor_dll _winmajor
|
||||
@ extern _winminor_dll _winminor
|
||||
@ extern _winver_dll _winver
|
||||
@ extern _winmajor_dll MSVCRT__winmajor
|
||||
@ extern _winminor_dll MSVCRT__winminor
|
||||
@ extern _winver_dll MSVCRT__winver
|
||||
@ cdecl _write(long ptr long)
|
||||
@ cdecl _wtoi(wstr)
|
||||
@ cdecl _wtol(wstr)
|
||||
@@ -344,7 +344,7 @@
|
||||
@ cdecl asin(double)
|
||||
@ cdecl atan(double)
|
||||
@ cdecl atan2(double double)
|
||||
@ cdecl atexit(ptr)
|
||||
@ cdecl -private atexit(ptr) MSVCRT_atexit # not imported to avoid conflicts with Mingw
|
||||
@ cdecl atof(str)
|
||||
@ cdecl atoi(str)
|
||||
@ cdecl atol(str)
|
||||
@@ -355,8 +355,8 @@
|
||||
@ cdecl clock()
|
||||
@ cdecl cos(double)
|
||||
@ cdecl cosh(double)
|
||||
@ cdecl ctime(ptr)
|
||||
@ cdecl difftime(long long)
|
||||
@ cdecl ctime(ptr) _ctime32
|
||||
@ cdecl difftime(long long) _difftime32
|
||||
@ cdecl div(long long)
|
||||
@ cdecl exit(long)
|
||||
@ cdecl exp(double)
|
||||
@@ -391,8 +391,8 @@
|
||||
@ cdecl getchar()
|
||||
@ cdecl getenv(str)
|
||||
@ cdecl gets(str)
|
||||
@ cdecl gmtime(ptr)
|
||||
@ cdecl is_wctype(long long)
|
||||
@ cdecl gmtime(ptr) _gmtime32
|
||||
@ cdecl is_wctype(long long) iswctype
|
||||
@ cdecl isalnum(long)
|
||||
@ cdecl isalpha(long)
|
||||
@ cdecl iscntrl(long)
|
||||
@@ -419,10 +419,10 @@
|
||||
@ cdecl iswxdigit(long)
|
||||
@ cdecl isxdigit(long)
|
||||
@ cdecl labs(long)
|
||||
@ cdecl ldexp( double long)
|
||||
@ cdecl ldiv(long long)
|
||||
@ cdecl ldexp(double long)
|
||||
@ cdecl -ret64 ldiv(long long)
|
||||
@ cdecl localeconv()
|
||||
@ cdecl localtime(ptr)
|
||||
@ cdecl localtime(ptr) _localtime32
|
||||
@ cdecl log(double)
|
||||
@ cdecl log10(double)
|
||||
@ cdecl -i386 longjmp(ptr long)
|
||||
@@ -435,7 +435,7 @@
|
||||
@ cdecl memcpy(ptr ptr long)
|
||||
@ cdecl memmove(ptr ptr long)
|
||||
@ cdecl memset(ptr long long)
|
||||
@ cdecl mktime(ptr)
|
||||
@ cdecl mktime(ptr) _mktime32
|
||||
@ cdecl modf(double ptr)
|
||||
@ cdecl perror(str)
|
||||
@ cdecl pow(double double)
|
||||
@@ -457,7 +457,7 @@
|
||||
@ cdecl signal(long long)
|
||||
@ cdecl sin(double)
|
||||
@ cdecl sinh(double)
|
||||
@ varargs sprintf(ptr str)
|
||||
@ varargs sprintf(ptr str) CRTDLL_sprintf
|
||||
@ cdecl sqrt(double)
|
||||
@ cdecl srand(long)
|
||||
@ varargs sscanf(str str)
|
||||
@@ -480,14 +480,14 @@
|
||||
@ cdecl strtod(str ptr)
|
||||
@ cdecl strtok(str str)
|
||||
@ cdecl strtol(str ptr long)
|
||||
@ cdecl strtoul(str ptr long)
|
||||
@ cdecl strtoul(str ptr long) CRTDLL_strtoul
|
||||
@ cdecl strxfrm(ptr str long)
|
||||
@ varargs swprintf(wstr wstr)
|
||||
@ varargs swscanf(wstr wstr)
|
||||
@ cdecl system(str)
|
||||
@ cdecl system(str) CRTDLL_system
|
||||
@ cdecl tan(double)
|
||||
@ cdecl tanh(double)
|
||||
@ cdecl time(ptr)
|
||||
@ cdecl time(ptr) _time32
|
||||
@ cdecl tmpfile()
|
||||
@ cdecl tmpnam(str)
|
||||
@ cdecl tolower(long)
|
||||
@@ -500,7 +500,7 @@
|
||||
@ cdecl vfwprintf(ptr wstr long)
|
||||
@ cdecl vprintf(str long)
|
||||
@ cdecl vsprintf(ptr str ptr)
|
||||
@ cdecl vswprintf(ptr wstr long)
|
||||
@ cdecl vswprintf(ptr wstr ptr) _vswprintf
|
||||
@ cdecl vwprintf(wstr long)
|
||||
@ cdecl wcscat(wstr wstr)
|
||||
@ cdecl wcschr(wstr long)
|
||||
@@ -521,7 +521,7 @@
|
||||
@ cdecl wcstok(wstr wstr)
|
||||
@ cdecl wcstol(wstr ptr long)
|
||||
@ cdecl wcstombs(ptr ptr long)
|
||||
@ cdecl wcstoul(wstr ptr long)
|
||||
@ cdecl wcstoul(wstr ptr long) CRTDLL_wcstoul
|
||||
@ cdecl wcsxfrm(ptr wstr long)
|
||||
@ cdecl wctomb(ptr long)
|
||||
@ varargs wprintf(wstr)
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
#include <mbctype.h>
|
||||
#include <sys/stat.h>
|
||||
#include <internal/wine/msvcrt.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <mbstring.h>
|
||||
|
||||
#include <wine/debug.h>
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(crtdll);
|
||||
@@ -29,11 +33,6 @@ extern void __getmainargs( int *argc, char ***argv, char ***envp,
|
||||
|
||||
/* EXTERNAL PROTOTYPES ********************************************************/
|
||||
|
||||
BOOL crt_process_init(void);
|
||||
|
||||
extern void FreeEnvironment(char **environment);
|
||||
|
||||
|
||||
unsigned int CRTDLL__basemajor_dll = 0;
|
||||
unsigned int CRTDLL__baseminor_dll = 0;
|
||||
unsigned int CRTDLL__baseversion_dll = 0;
|
||||
@@ -84,75 +83,6 @@ static void convert_struct_stat( struct crtdll_stat *dst, const struct _stat *sr
|
||||
dst->st_ctime = src->st_ctime;
|
||||
}
|
||||
|
||||
/* LIBRARY ENTRY POINT ********************************************************/
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved)
|
||||
{
|
||||
DWORD version;
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
version = GetVersion();
|
||||
|
||||
/* initialize version info */
|
||||
CRTDLL__basemajor_dll = (version >> 24) & 0xFF;
|
||||
CRTDLL__baseminor_dll = (version >> 16) & 0xFF;
|
||||
CRTDLL__baseversion_dll = (version >> 16);
|
||||
CRTDLL__cpumode_dll = 1; /* FIXME */
|
||||
CRTDLL__osmajor_dll = (version >>8) & 0xFF;
|
||||
CRTDLL__osminor_dll = (version & 0xFF);
|
||||
CRTDLL__osmode_dll = 1; /* FIXME */
|
||||
CRTDLL__osversion_dll = (version & 0xFFFF);
|
||||
|
||||
if (!crt_process_init())
|
||||
{
|
||||
ERR("crt_init() failed!\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
TRACE("Attach done\n");
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
break;
|
||||
|
||||
case DLL_THREAD_DETACH:
|
||||
msvcrt_free_tls_mem();
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
TRACE("Detach\n");
|
||||
/* Deinit of the WINE code */
|
||||
msvcrt_free_io();
|
||||
if (reserved) break;
|
||||
msvcrt_free_popen_data();
|
||||
msvcrt_free_mt_locks();
|
||||
//msvcrt_free_console();
|
||||
//msvcrt_free_args();
|
||||
//msvcrt_free_signals();
|
||||
msvcrt_free_tls_mem();
|
||||
if (!msvcrt_free_tls())
|
||||
return FALSE;
|
||||
//MSVCRT__free_locale(MSVCRT_locale);
|
||||
|
||||
if (__winitenv && __winitenv != _wenviron)
|
||||
FreeEnvironment((char**)__winitenv);
|
||||
if (_wenviron)
|
||||
FreeEnvironment((char**)_wenviron);
|
||||
|
||||
if (__initenv && __initenv != _environ)
|
||||
FreeEnvironment(__initenv);
|
||||
if (_environ)
|
||||
FreeEnvironment(_environ);
|
||||
|
||||
TRACE("Detach done\n");
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* __GetMainArgs (CRTDLL.@)
|
||||
@@ -247,4 +177,148 @@ char *_strspnp( const char *str1, const char *str2)
|
||||
return *str1 ? (char*)str1 : NULL;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* _mbsstr (CRTDLL.@)
|
||||
*/
|
||||
unsigned char* CRTDLL__mbsstr(const unsigned char* Str, const unsigned char* Substr)
|
||||
{
|
||||
if (!*Str && !*Substr)
|
||||
return NULL;
|
||||
return (unsigned char*)strstr((const char*)Str, (const char*)Substr);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* sprintf (CRTDLL.@)
|
||||
*/
|
||||
int CRTDLL_sprintf(char* buffer, const char* format, ...)
|
||||
{
|
||||
va_list args;
|
||||
int ret;
|
||||
|
||||
/* Access both buffers to emulate CRTDLL exception behavior */
|
||||
(void)*(volatile char*)buffer;
|
||||
(void)*(volatile char*)format;
|
||||
|
||||
va_start(args, format);
|
||||
ret = vsprintf(buffer, format, args);
|
||||
va_end(args);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* strtoul (CRTDLL.@)
|
||||
*/
|
||||
unsigned long CRTDLL_strtoul(const char* nptr, char** endptr, int base)
|
||||
{
|
||||
/* Access nptr to emulate CRTDLL exception behavior */
|
||||
(void)*(volatile char*)nptr;
|
||||
return strtoul(nptr, endptr, base);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* wcstoul (CRTDLL.@)
|
||||
*/
|
||||
unsigned long CRTDLL_wcstoul(const wchar_t* nptr, wchar_t** endptr, int base)
|
||||
{
|
||||
/* Access nptr to emulate CRTDLL exception behavior */
|
||||
(void)*(volatile wchar_t*)nptr;
|
||||
return wcstoul(nptr, endptr, base);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* system (CRTDLL.@)
|
||||
*/
|
||||
int CRTDLL_system(const char* command)
|
||||
{
|
||||
if (command != NULL)
|
||||
{
|
||||
errno = 0;
|
||||
}
|
||||
return system(command);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* _mbsnbcat (CRTDLL.@)
|
||||
*/
|
||||
unsigned char* CRTDLL__mbsnbcat(unsigned char* dest, const unsigned char* src, size_t n)
|
||||
{
|
||||
if (n)
|
||||
{
|
||||
/* Access both buffers to emulate CRTDLL exception behavior */
|
||||
(void)*(volatile char*)dest;
|
||||
(void)*(volatile char*)src;
|
||||
}
|
||||
|
||||
return _mbsnbcat(dest, src, n);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* _mbsncat (CRTDLL.@)
|
||||
*/
|
||||
unsigned char* CRTDLL__mbsncat(unsigned char* dest, const unsigned char* src, size_t n)
|
||||
{
|
||||
if (n)
|
||||
{
|
||||
/* Access both buffers to emulate CRTDLL exception behavior */
|
||||
(void)*(volatile char*)dest;
|
||||
(void)*(volatile char*)src;
|
||||
}
|
||||
|
||||
return _mbsncat(dest, src, n);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* _vsnprintf (CRTDLL.@)
|
||||
*/
|
||||
int CRTDLL__vsnprintf(char* buffer, size_t count, const char* format, va_list argptr)
|
||||
{
|
||||
(void)*(volatile char*)format;
|
||||
if (count)
|
||||
{
|
||||
(void)*(volatile char*)buffer;
|
||||
}
|
||||
int ret = _vsnprintf(buffer, count, format, argptr);
|
||||
if (ret > (int)count)
|
||||
ret = -1;
|
||||
errno = 0;;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* _snprintf (CRTDLL.@)
|
||||
*/
|
||||
int CRTDLL__snprintf(char* buffer, size_t count, const char* format, ...)
|
||||
{
|
||||
va_list args;
|
||||
int ret;
|
||||
va_start(args, format);
|
||||
ret = CRTDLL__vsnprintf(buffer, count, format, args);
|
||||
va_end(args);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* _vsnwprintf (CRTDLL.@)
|
||||
*/
|
||||
int CRTDLL__vsnwprintf(wchar_t* buffer, size_t count, const wchar_t* format, va_list argptr)
|
||||
{
|
||||
(void)*(volatile wchar_t*)format;
|
||||
int ret = _vsnwprintf(buffer, count, format, argptr);
|
||||
if ((ret > (int)count) || !buffer)
|
||||
ret = -1;
|
||||
errno = 0;;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* Dummy for rand_s, not used. */
|
||||
BOOLEAN
|
||||
WINAPI
|
||||
SystemFunction036(PVOID pbBuffer, ULONG dwLen)
|
||||
{
|
||||
assert(FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
||||
Reference in New Issue
Block a user