reactos/sdk/lib/crt
Bișoc George 8266f62ff6
[CRT][STDLIB] Wine-sync _mbtowc_l function code
The current _mbtowc_l code directly passes the string count size argument to cbMultiByte argument parameter to MultiByteToWideChar(). As the size of lpMultiByteStr expressed in bytes by cbMultiByte is dependent of the actual given string, the size of lpWideCharStr expressed in characters by cchWideChar is always 1.

The resulting parameters to MultiByteToWideChar() will lead to a failure as lpWideCharStr cannot accommodate the converted string if the size pointed by lpMultiByteStr is larger than the buffer wide string to receive the converted output, a Win32 error code of ERROR_INSUFFICIENT_BUFFER in other words. The fact that _mbtowc_l never fails without WINE Gecko package installed is because the codepage pointed by lc_codepage is CP_ACP and the converted output is directly given to the destination wide string parameter thus never calling MultiByteToWideChar(). Installing WINE Gecko merely unhides this problem.

As _mbtowc_l is imported from WINE and that they have updated their code (which at the same time this fixes the aforementioned problem), the following commit syncs the updated code from WINE.

CORE-16885
2020-04-28 22:41:57 +02:00
..
conio Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
direct Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
except [CRT] Implement __chkstk function for ARM (#1595) 2020-04-26 19:58:53 +03:00
float Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
include [CRT] Import wine exception handling code 2020-02-09 15:56:30 +01:00
locale Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
math [SDK] Use HEX macro, like elsewhere in the file 2020-01-22 20:57:04 +01:00
mbstring [CRT] Fix two obvious typos in _mbbtype(). 2018-10-07 22:56:14 +02:00
mem Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
misc [CRT] Implement _CrtDbgReport and _CrtDbgReportW 2020-04-04 19:55:24 +02:00
printf [CRT][USER32] fix wsprintf additional argument (%*s) (#1470) 2019-04-05 16:33:18 +09:00
process [CRT] spawn: define a unicode environment when needed 2018-10-13 20:30:07 +02:00
search Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
setjmp Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
signal Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
startup [CRT] ARM & ARM64 Windows do not have initenv in their CRTs (#1597) 2020-04-26 19:56:34 +03:00
stdio [MSVCRT] Export __acrt_iob_func to fix GCC build with latest RosBE 2.2 (#1835) 2019-10-20 12:44:17 +02:00
stdlib [CRT][STDLIB] Wine-sync _mbtowc_l function code 2020-04-28 22:41:57 +02:00
string [MSVCRT] Add _snwscanf 2020-03-15 13:12:20 +01:00
sys_stat Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
time [CRT] Correctly share get_ioinfo()/release_ioinfo() functions between code units 2019-04-01 11:38:32 +02:00
wine [CRT] Import wine exception handling code 2020-02-09 15:56:30 +01:00
wstring Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
CMakeLists.txt [CMAKE] Replace custom functions to built-in ones 2020-04-16 15:59:38 +03:00
crt.cmake [CMAKE] Replace custom functions to built-in ones 2020-04-16 15:59:38 +03:00
libcntpr.cmake [CMAKE] Replace custom functions to built-in ones 2020-04-16 15:59:38 +03:00
moldname-msvcrt.def Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
msvcrtex.cmake [CMAKE] Replace custom functions to built-in ones 2020-04-16 15:59:38 +03:00
oldnames-msvcrt.S Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
oldnames.cmake Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
precomp.h Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
README.txt Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00

Big chunks of this CRT library are taken from Wine's msvcrt implementation,
you can find a list of synced files in README.WINE file.

Notes:
1. When syncing, omit MSVCRT_ prefix where possible, Wine has to keep this
because they are linking with *both* original crt, and ms crt implementation.
ReactOS has the only CRT, so no need to make distinct functions.
2. ReactOS compiles two versions of the CRT library, one for usermode
(called just "crt"), and one version for kernelmode usage (called "libcntpr").
In order to separate the code, you can use #ifdef _LIBCNT_ for libcntpr code.