[MSVCRT] Add some missing exports

- Add _mbcasemap, __p__mbcasemap, _fileinfo, __p__fileinfo, _get_fileinfo, _set_fileinfo, _get_winver
- Add strtoll and strtoull import symbols
- Add CrtDbgReport*
- Enable a few stubs
This commit is contained in:
Timo Kreuzer
2025-05-08 10:50:26 +03:00
parent 4d20df2fd5
commit 1106678cc0
5 changed files with 110 additions and 20 deletions

View File

@@ -144,10 +144,10 @@
@ cdecl -arch=i386 _CItanh()
@ stub -version=0x600+ _CrtCheckMemory
# stub -version=0x600+ _CrtDbgBreak
# stub -version=0x600+ _CrtDbgReport
# stub -version=0x600+ _CrtDbgReportV
# stub -version=0x600+ _CrtDbgReportW
# stub -version=0x600+ _CrtDbgReportWV
@ cdecl -version=0x600+ _CrtDbgReport(long str long str str)
@ cdecl -version=0x600+ _CrtDbgReportV(long str long str str ptr)
@ cdecl -version=0x600+ _CrtDbgReportW(long wstr long wstr wstr)
@ cdecl -version=0x600+ _CrtDbgReportWV(long wstr long wstr wstr ptr)
# stub -version=0x600+ _CrtDoForAllClientObjects
# stub -version=0x600+ _CrtDumpMemoryLeaks
# stub -version=0x600+ _CrtIsMemoryBlock
@@ -163,10 +163,10 @@
# stub -version=0x600+ _CrtSetDbgBlockType
# stub -version=0x600+ _CrtSetDbgFlag
# stub -version=0x600+ _CrtSetDumpClient
# stub -version=0x600+ _CrtSetReportFile
@ cdecl -version=0x600+ _CrtSetReportFile(long ptr)
# stub -version=0x600+ _CrtSetReportHook
# stub -version=0x600+ _CrtSetReportHook2
@ cdecl -stub -version=0x600+ _CrtSetReportMode(long long)
@ cdecl -version=0x600+ _CrtSetReportMode(long long)
@ stdcall _CxxThrowException(ptr ptr)
@ cdecl -arch=i386 -norelay _EH_prolog()
@ cdecl _Getdays()
@@ -261,10 +261,10 @@
@ cdecl -arch=i386 __p__daylight()
@ cdecl -arch=i386 __p__dstbias()
@ cdecl -arch=i386 __p__environ()
@ stub -arch=i386 __p__fileinfo()
@ cdecl -arch=i386 __p__fileinfo()
@ cdecl -arch=i386 __p__fmode()
@ cdecl -arch=i386 __p__iob() __iob_func
@ stub -arch=i386 __p__mbcasemap()
@ cdecl -arch=i386 __p__mbcasemap()
@ cdecl -arch=i386 __p__mbctype()
@ cdecl -arch=i386 __p__osver()
@ cdecl -arch=i386 __p__pctype()
@@ -397,10 +397,10 @@
@ cdecl _cwait(ptr long long)
@ varargs _cwprintf(wstr)
@ varargs -version=0x600+ _cwprintf_l(wstr ptr)
# stub -version=0x600+ _cwprintf_p(wstr)
# stub -version=0x600+ _cwprintf_p_l(wstr ptr)
# stub -version=0x600+ _cwprintf_s(wstr)
# stub -version=0x600+ _cwprintf_s_l(wstr ptr)
@ stub -version=0x600+ _cwprintf_p
@ stub -version=0x600+ _cwprintf_p_l
@ stub -version=0x600+ _cwprintf_s
@ stub -version=0x600+ _cwprintf_s_l
@ varargs _cwscanf(wstr)
@ varargs -version=0x600+ _cwscanf_l(wstr ptr)
@ varargs -version=0x600+ _cwscanf_s(wstr)
@@ -439,7 +439,7 @@
@ cdecl _fgetchar()
@ cdecl _fgetwchar()
@ cdecl _filbuf(ptr)
# extern _fileinfo
@ extern -arch=i386,x86_64 _fileinfo
@ cdecl _filelength(long)
@ cdecl -ret64 _filelengthi64(long)
@ cdecl _fileno(ptr)
@@ -508,7 +508,7 @@
@ cdecl -version=0x600+ _get_doserrno(ptr)
@ cdecl -version=0x600+ _get_environ(ptr)
@ cdecl -version=0x600+ _get_errno(ptr)
# stub -version=0x600+ _get_fileinfo(ptr)
@ cdecl -version=0x600+ _get_fileinfo(ptr)
@ cdecl -version=0x600+ _get_fmode(ptr)
@ cdecl _get_heap_handle()
@ cdecl _get_osfhandle(long)
@@ -520,7 +520,7 @@
@ cdecl -version=0x600+ _get_wenviron(ptr)
@ cdecl -version=0x600+ _get_winmajor(ptr)
@ cdecl -version=0x600+ _get_winminor(ptr)
# stub -version=0x600+ _get_winver(ptr)
@ cdecl -version=0x600+ _get_winver(ptr)
@ cdecl -version=0x600+ _get_wpgmptr(ptr)
@ cdecl _get_terminate()
@ cdecl _get_tzname(ptr str long long)
@@ -686,12 +686,12 @@
@ cdecl _ltow(long ptr long)
@ cdecl -version=0x600+ _ltow_s(long ptr long long)
@ cdecl _makepath(ptr str str str str)
@ cdecl -version=0x600+ _makepath_s(ptr long str str str str)
# stub -version=0x600+ _malloc_dbg(long long str long)
@ cdecl -version=0x600+ _makepath_s(str long str)
@ stub -version=0x600+ _malloc_dbg
@ cdecl _mbbtombc(long)
@ cdecl -version=0x600+ _mbbtombc_l(long ptr)
@ cdecl _mbbtype(long long)
# extern _mbcasemap
@ extern _mbcasemap
@ cdecl _mbccpy(ptr ptr)
@ cdecl -version=0x600+ _mbccpy_l(ptr ptr ptr)
@ cdecl -version=0x600+ _mbccpy_s(ptr long ptr ptr)
@@ -901,7 +901,7 @@
@ cdecl -version=0x600+ _set_doserrno(long)
@ cdecl -version=0x600+ _set_errno(long)
@ cdecl _set_error_mode(long)
# stub -version=0x600+ _set_fileinfo(long)
@ cdecl -version=0x600+ _set_fileinfo(long)
@ cdecl -version=0x600+ _set_fmode(long)
@ cdecl -version=0x600+ _set_output_format(long)
@ cdecl _set_sbh_threshold(long)
@@ -1008,7 +1008,7 @@
@ cdecl _tell(long)
@ cdecl -ret64 _telli64(long)
@ cdecl _tempnam(str str)
# stub -version=0x600+ _tempnam_dbg(str str long str long)
@ stub -version=0x600+ _tempnam_dbg(str str long str long)
@ cdecl -version=0x600+ _time32(ptr)
@ cdecl _time64(ptr)
@ extern _timezone MSVCRT___timezone
@@ -1456,7 +1456,9 @@
@ cdecl strtok(str str)
@ cdecl -version=0x600+ strtok_s(ptr str ptr)
@ cdecl strtol(str ptr long)
@ cdecl -impsym strtoll(str ptr long) _strtoi64
@ cdecl strtoul(str ptr long)
@ cdecl -impsym strtoull(str ptr long) _strtoui64
@ cdecl strxfrm(ptr str long)
@ varargs swprintf(ptr wstr) _swprintf
@ varargs -version=0x600+ swprintf_s(ptr long wstr)

View File

@@ -0,0 +1,7 @@
#include <intrin.h>
void _chkesp_failed(void)
{
__debugbreak();
}

View File

@@ -0,0 +1,66 @@
/*
* PROJECT: ReactOS msvcrt.dll
* LICENSE: MIT (https://spdx.org/licenses/MIT)
* PURPOSE: Miscellaneous functions and data
* COPYRIGHT: Copyright Timo Kreuzer <timo.kreuzer@reactos.org>
*/
#include <stdlib.h>
#include <errno.h>
#include <msvcrt.h>
extern unsigned int MSVCRT__winver;
unsigned char _mbcasemap[257] =
{
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 0x0, 0x0, 0x0, 0x0, 0x0,
};
int _fileinfo = -1;
unsigned char* __p__mbcasemap(void)
{
return _mbcasemap;
}
int* __p__fileinfo(void)
{
return &_fileinfo;
}
int _get_fileinfo(_Out_ int *_Value)
{
if (!MSVCRT_CHECK_PMT(_Value != NULL))
{
return EINVAL;
}
*_Value = _fileinfo;
return 0;
}
int _set_fileinfo(_In_ int _Value)
{
_fileinfo = _Value;
return 0;
}
errno_t
__cdecl
_get_winver(_Out_ unsigned int *_Value)
{
if (!MSVCRT_CHECK_PMT(_Value != NULL))
{
return EINVAL;
}
*_Value = MSVCRT__winver;
return 0;
}

View File

@@ -56,3 +56,10 @@ if(MSVC AND ARCH STREQUAL "i386")
set_target_properties(ftol2 PROPERTIES LINKER_LANGUAGE "C")
add_dependencies(ftol2 asm)
endif()
add_library(dbgrpt misc/dbgrpt.cpp)
target_link_libraries(dbgrpt chkstk ${PSEH_LIB})
target_compile_definitions(dbgrpt PRIVATE
_MT
_DEBUG)
add_dependencies(dbgrpt psdk asm)

View File

@@ -79,3 +79,11 @@ add_asm_files(chkstk_lib_asm ${CHKSTK_ASM_SOURCE})
add_library(chkstk ${CHKSTK_SOURCE} ${chkstk_lib_asm})
set_target_properties(chkstk PROPERTIES LINKER_LANGUAGE "C")
add_dependencies(chkstk asm)
# Temporary lib, until crt and vcruntime are cleaned up
if(ARCH STREQUAL "i386")
add_asm_files(chkesp_lib_asm except/i386/chkesp.s)
add_library(chkesp ${chkesp_lib_asm})
set_target_properties(chkesp PROPERTIES LINKER_LANGUAGE "C")
add_dependencies(chkesp asm)
endif()