With this commit the following functions were implemented: - _mbsupr_s_l - converts multibyte string to uppercase, by using specified locale that's passed in. - _mbslwr_s_l - converts multibyte string to lowercase, by using specified locale that's passed in. - _mbctolower_l - converts multibyte uppercase character to lowercase character, by using specified locale that's passed in. - _mbctoupper_l - converts multibyte lowercase character to uppercase character, by using specified locale that's passed in.
More information about these methods are available at: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/strupr-s-s...
After applying the patch the crash of the ChessBase application was fixed. More information: https://bugs.winehq.org/show_bug.cgi?id=45273
-- v7: msvcrt: implement missing CRT functions to fix ChessBase 14 crash
From: Bartosz Kosiorek gang65@poczta.onet.pl
With this commit the following functions were implemented: - _mbsupr_s_l - converts multibyte string to uppercase, by using specified locale that's passed in. - _mbslwr_s_l - converts multibyte string to lowercase, by using specified locale that's passed in. - _mbctolower_l - converts multibyte uppercase character to lowercase character, by using specified locale that's passed in. - _mbctoupper_l - converts multibyte lowercase character to uppercase character, by using specified locale that's passed in.
More information about these methods are available at: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/strupr-s-s...
After applying patch the crash of the ChessBase application was fixed. More information: https://bugs.winehq.org/show_bug.cgi?id=45273 --- dlls/msvcr100/msvcr100.spec | 8 +-- dlls/msvcr110/msvcr110.spec | 8 +-- dlls/msvcr120/msvcr120.spec | 8 +-- dlls/msvcr80/msvcr80.spec | 8 +-- dlls/msvcr90/msvcr90.spec | 8 +-- dlls/msvcrt/mbcs.c | 87 +++++++++++++++++------- dlls/msvcrt/msvcrt.spec | 8 +-- dlls/msvcrt/tests/string.c | 131 ++++++++++++++++++++++++++++++++++-- dlls/ucrtbase/ucrtbase.spec | 8 +-- 9 files changed, 215 insertions(+), 59 deletions(-)
diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index c0bbbc5b86d..b051cf6a77f 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -1088,11 +1088,11 @@ @ cdecl _mbctokata(long) @ stub _mbctokata_l @ cdecl _mbctolower(long) -@ stub _mbctolower_l +@ cdecl _mbctolower_l(long ptr) @ cdecl _mbctombb(long) @ stub _mbctombb_l @ cdecl _mbctoupper(long) -@ stub _mbctoupper_l +@ cdecl _mbctoupper_l(long ptr) @ extern _mbctype MSVCRT_mbctype @ stub _mblen_l @ cdecl _mbsbtype(str long) @@ -1122,7 +1122,7 @@ @ cdecl _mbslwr(str) @ stub _mbslwr_l @ cdecl _mbslwr_s(str long) -@ stub _mbslwr_s_l +@ cdecl _mbslwr_s_l(str long ptr) @ cdecl _mbsnbcat(str str long) @ stub _mbsnbcat_l @ cdecl _mbsnbcat_s(str long ptr long) @@ -1202,7 +1202,7 @@ @ cdecl _mbsupr(str) @ stub _mbsupr_l @ cdecl _mbsupr_s(str long) -@ stub _mbsupr_s_l +@ cdecl _mbsupr_s_l(str long ptr) @ cdecl _mbtowc_l(ptr str long ptr) @ cdecl _memccpy(ptr ptr long long) @ cdecl _memicmp(str str long) diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index a272ae98a1c..593df178536 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -1445,11 +1445,11 @@ @ cdecl _mbctokata(long) @ stub _mbctokata_l @ cdecl _mbctolower(long) -@ stub _mbctolower_l +@ cdecl _mbctolower_l(long ptr) @ cdecl _mbctombb(long) @ stub _mbctombb_l @ cdecl _mbctoupper(long) -@ stub _mbctoupper_l +@ cdecl _mbctoupper_l(long ptr) @ extern _mbctype MSVCRT_mbctype @ stub _mblen_l @ cdecl _mbsbtype(str long) @@ -1479,7 +1479,7 @@ @ cdecl _mbslwr(str) @ stub _mbslwr_l @ cdecl _mbslwr_s(str long) -@ stub _mbslwr_s_l +@ cdecl _mbslwr_s_l(str long ptr) @ cdecl _mbsnbcat(str str long) @ stub _mbsnbcat_l @ cdecl _mbsnbcat_s(str long ptr long) @@ -1559,7 +1559,7 @@ @ cdecl _mbsupr(str) @ stub _mbsupr_l @ cdecl _mbsupr_s(str long) -@ stub _mbsupr_s_l +@ cdecl _mbsupr_s_l(str long ptr) @ cdecl _mbtowc_l(ptr str long ptr) @ cdecl _memccpy(ptr ptr long long) @ cdecl _memicmp(str str long) diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index d16316e7e05..cd92da9a8d7 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -1456,11 +1456,11 @@ @ cdecl _mbctokata(long) @ stub _mbctokata_l @ cdecl _mbctolower(long) -@ stub _mbctolower_l +@ cdecl _mbctolower_l(long ptr) @ cdecl _mbctombb(long) @ stub _mbctombb_l @ cdecl _mbctoupper(long) -@ stub _mbctoupper_l +@ cdecl _mbctoupper_l(long ptr) @ extern _mbctype MSVCRT_mbctype @ stub _mblen_l @ cdecl _mbsbtype(str long) @@ -1490,7 +1490,7 @@ @ cdecl _mbslwr(str) @ stub _mbslwr_l @ cdecl _mbslwr_s(str long) -@ stub _mbslwr_s_l +@ cdecl _mbslwr_s_l(str long ptr) @ cdecl _mbsnbcat(str str long) @ stub _mbsnbcat_l @ cdecl _mbsnbcat_s(str long ptr long) @@ -1570,7 +1570,7 @@ @ cdecl _mbsupr(str) @ stub _mbsupr_l @ cdecl _mbsupr_s(str long) -@ stub _mbsupr_s_l +@ cdecl _mbsupr_s_l(str long ptr) @ cdecl _mbtowc_l(ptr str long ptr) @ cdecl _memccpy(ptr ptr long long) @ cdecl _memicmp(str str long) diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 371d17ecc21..de0da8e26e9 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -760,11 +760,11 @@ @ cdecl _mbctokata(long) @ stub _mbctokata_l @ cdecl _mbctolower(long) -@ stub _mbctolower_l +@ cdecl _mbctolower_l(long ptr) @ cdecl _mbctombb(long) @ stub _mbctombb_l @ cdecl _mbctoupper(long) -@ stub _mbctoupper_l +@ cdecl _mbctoupper_l(long ptr) @ extern _mbctype MSVCRT_mbctype @ stub _mblen_l @ cdecl _mbsbtype(str long) @@ -794,7 +794,7 @@ @ cdecl _mbslwr(str) @ stub _mbslwr_l @ cdecl _mbslwr_s(str long) -@ stub _mbslwr_s_l +@ cdecl _mbslwr_s_l(str long ptr) @ cdecl _mbsnbcat(str str long) @ stub _mbsnbcat_l @ cdecl _mbsnbcat_s(str long ptr long) @@ -874,7 +874,7 @@ @ cdecl _mbsupr(str) @ stub _mbsupr_l @ cdecl _mbsupr_s(str long) -@ stub _mbsupr_s_l +@ cdecl _mbsupr_s_l(str long ptr) @ cdecl _mbtowc_l(ptr str long ptr) @ cdecl _memccpy(ptr ptr long long) @ cdecl _memicmp(str str long) diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index dc9d4ae097b..d5f94a65f78 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -738,11 +738,11 @@ @ cdecl _mbctokata(long) @ stub _mbctokata_l @ cdecl _mbctolower(long) -@ stub _mbctolower_l +@ cdecl _mbctolower_l(long ptr) @ cdecl _mbctombb(long) @ stub _mbctombb_l @ cdecl _mbctoupper(long) -@ stub _mbctoupper_l +@ cdecl _mbctoupper_l(long ptr) @ extern _mbctype MSVCRT_mbctype @ stub _mblen_l @ cdecl _mbsbtype(str long) @@ -772,7 +772,7 @@ @ cdecl _mbslwr(str) @ stub _mbslwr_l @ cdecl _mbslwr_s(str long) -@ stub _mbslwr_s_l +@ cdecl _mbslwr_s_l(str long ptr) @ cdecl _mbsnbcat(str str long) @ stub _mbsnbcat_l @ cdecl _mbsnbcat_s(str long ptr long) @@ -852,7 +852,7 @@ @ cdecl _mbsupr(str) @ stub _mbsupr_l @ cdecl _mbsupr_s(str long) -@ stub _mbsupr_s_l +@ cdecl _mbsupr_s_l(str long ptr) @ cdecl _mbtowc_l(ptr str long ptr) @ cdecl _memccpy(ptr ptr long long) @ cdecl _memicmp(str str long) diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c index dc9abca1b44..1b08c383cc8 100644 --- a/dlls/msvcrt/mbcs.c +++ b/dlls/msvcrt/mbcs.c @@ -25,6 +25,7 @@
#include <stdio.h> #include <limits.h> +#include <locale.h> #include <mbctype.h> #include <mbstring.h>
@@ -447,29 +448,47 @@ unsigned int CDECL _mbsnextc(const unsigned char* str) }
/********************************************************************* - * _mbctolower(MSVCRT.@) + * _mbctolower_l(MSVCRT.@) + * converts multibyte uppercase character to lowercase character, by using specified locale that's passed in. */ -unsigned int CDECL _mbctolower(unsigned int c) +unsigned int CDECL _mbctolower_l(unsigned int c, _locale_t locale) { - if (_ismbblead(c)) + if (_ismbblead_l(c, locale)) { FIXME("Handle MBC chars\n"); return c; } - return _tolower_l(c, NULL); /* ASCII CP or SB char */ + return _tolower_l(c, locale); /* ASCII CP or SB char */ }
/********************************************************************* - * _mbctoupper(MSVCRT.@) + * _mbctolower(MSVCRT.@) */ -unsigned int CDECL _mbctoupper(unsigned int c) +unsigned int CDECL _mbctolower(unsigned int c) { - if (_ismbblead(c)) + return _mbctolower_l(c, NULL); +} + +/********************************************************************* + * _mbctoupper_l(MSVCRT.@) + * converts multibyte lowercase character to uppercase character, by using specified locale that's passed in. + */ +unsigned int CDECL _mbctoupper_l(unsigned int c, _locale_t locale) +{ + if (_ismbblead_l(c, locale)) { FIXME("Handle MBC chars\n"); return c; } - return _toupper_l(c, NULL); /* ASCII CP or SB char */ + return _toupper_l(c, locale); /* ASCII CP or SB char */ +} + +/********************************************************************* + * _mbctoupper(MSVCRT.@) + */ +unsigned int CDECL _mbctoupper(unsigned int c) +{ + return _mbctoupper_l(c, NULL); }
/********************************************************************* @@ -2049,17 +2068,17 @@ unsigned char* CDECL _mbslwr(unsigned char* s) return ret; }
- /********************************************************************* - * _mbslwr_s(MSVCRT.@) + * _mbslwr_s_l(MSVCRT.@) + * converts multibyte string to lowercase, by using specified locale that's passed in. */ -int CDECL _mbslwr_s(unsigned char* s, size_t len) +int CDECL _mbslwr_s_l(unsigned char* str, size_t len, _locale_t locale) { - if (!s && !len) + if (!str && !len) { return 0; } - else if (!s || !len) + else if (!str || !len) { *_errno() = EINVAL; return EINVAL; @@ -2067,28 +2086,37 @@ int CDECL _mbslwr_s(unsigned char* s, size_t len) if (get_mbcinfo()->ismbcodepage) { unsigned int c; - for ( ; *s && len > 0; len--) + for ( ; *str && len > 0; len--) { - c = _mbctolower(_mbsnextc(s)); + c = _mbctolower_l(_mbsnextc_l(str, locale), locale); /* Note that I assume that the size of the character is unchanged */ if (c > 255) { - *s++=(c>>8); + *str++=(c>>8); c=c & 0xff; } - *s++=c; + *str++=c; } } - else for ( ; *s && len > 0; s++, len--) *s = _tolower_l(*s, NULL); - if (*s) + else + for ( ; *str && len > 0; str++, len--) + *str = _tolower_l(*str, locale); + if (*str) { - *s = '\0'; + *str = '\0'; *_errno() = EINVAL; return EINVAL; } return 0; }
+/********************************************************************* + * _mbslwr_s(MSVCRT.@) + */ +int CDECL _mbslwr_s(unsigned char* str, size_t len) +{ + return _mbslwr_s_l(str, len, NULL); +}
/********************************************************************* * _mbsupr(MSVCRT.@) @@ -2119,9 +2147,10 @@ unsigned char* CDECL _mbsupr(unsigned char* s)
/********************************************************************* - * _mbsupr_s(MSVCRT.@) + * _mbsupr_s_l(MSVCRT.@) + * converts multibyte string to uppercase, by using specified locale that's passed in. */ -int CDECL _mbsupr_s(unsigned char* s, size_t len) +int CDECL _mbsupr_s_l(unsigned char* s, size_t len, _locale_t locale) { if (!s && !len) { @@ -2137,7 +2166,7 @@ int CDECL _mbsupr_s(unsigned char* s, size_t len) unsigned int c; for ( ; *s && len > 0; len--) { - c = _mbctoupper(_mbsnextc(s)); + c = _mbctoupper_l(_mbsnextc_l(s, locale), locale); /* Note that I assume that the size of the character is unchanged */ if (c > 255) { @@ -2147,7 +2176,9 @@ int CDECL _mbsupr_s(unsigned char* s, size_t len) *s++=c; } } - else for ( ; *s && len > 0; s++, len--) *s = _toupper_l(*s, NULL); + else + for ( ; *s && len > 0; s++, len--) + *s = _toupper_l(*s, locale); if (*s) { *s = '\0'; @@ -2157,6 +2188,14 @@ int CDECL _mbsupr_s(unsigned char* s, size_t len) return 0; }
+/********************************************************************* + * _mbsupr_s(MSVCRT.@) + */ +int CDECL _mbsupr_s(unsigned char* s, size_t len) +{ + return _mbsupr_s_l(s, len, NULL); +} + /********************************************************************* * _mbsspn_l (MSVCRT.@) */ diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 3aab3600e1d..308f295dd0d 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -705,11 +705,11 @@ @ cdecl _mbctokata(long) # stub _mbctokata_l(long ptr) @ cdecl _mbctolower(long) -# stub _mbctolower_l(long ptr) +@ cdecl _mbctolower_l(long ptr) @ cdecl _mbctombb(long) # stub _mbctombb_l(long ptr) @ cdecl _mbctoupper(long) -# stub _mbctoupper_l(long ptr) +@ cdecl _mbctoupper_l(long ptr) @ extern _mbctype MSVCRT_mbctype # stub _mblen_l(str long ptr) @ cdecl _mbsbtype(str long) @@ -743,7 +743,7 @@ @ cdecl _mbslwr(str) # stub _mbslwr_l(str ptr) @ cdecl _mbslwr_s(str long) -# stub _mbslwr_s_l(str long ptr) +@ cdecl _mbslwr_s_l(str long ptr) @ cdecl _mbsnbcat(str str long) # stub _mbsnbcat_l(str str long ptr) @ cdecl _mbsnbcat_s(str long ptr long) @@ -823,7 +823,7 @@ @ cdecl _mbsupr(str) # stub _mbsupr_l(str ptr) @ cdecl _mbsupr_s(str long) -# stub _mbsupr_s_l(str long ptr) +# cdecl _mbsupr_s_l(str long ptr) @ cdecl _mbtowc_l(ptr str long ptr) @ cdecl _memccpy(ptr ptr long long) @ cdecl _memicmp(str str long) diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c index 4e525193ced..15db21e2455 100644 --- a/dlls/msvcrt/tests/string.c +++ b/dlls/msvcrt/tests/string.c @@ -92,7 +92,9 @@ static errno_t (__cdecl *p_ultoa_s)(__msvcrt_ulong,char*,size_t,int); static int *p__mb_cur_max; static unsigned char *p_mbctype; static int (__cdecl *p_wcslwr_s)(wchar_t*,size_t); +static errno_t (__cdecl *p_mbsupr_s_l)(unsigned char *str, size_t numberOfElements, _locale_t locale); static errno_t (__cdecl *p_mbsupr_s)(unsigned char *str, size_t numberOfElements); +static errno_t (__cdecl *p_mbslwr_s_l)(unsigned char *str, size_t numberOfElements, _locale_t locale); static errno_t (__cdecl *p_mbslwr_s)(unsigned char *str, size_t numberOfElements); static int (__cdecl *p_wctob)(wint_t); static wint_t (__cdecl *p_btowc)(int); @@ -133,13 +135,13 @@ static void test_swab( void ) { char expected1[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ@#"; char expected2[] = "ABCDEFGHIJKLMNOPQRSTUVWX$"; char expected3[] = "$"; - + char from[30]; char to[30]; - + int testsize; - - /* Test 1 - normal even case */ + + /* Test 1 - normal even case */ memset(to,'$', sizeof(to)); memset(from,'@', sizeof(from)); testsize = 26; @@ -147,7 +149,7 @@ static void test_swab( void ) { _swab( from, to, testsize ); ok(memcmp(to,expected1,testsize) == 0, "Testing even size %d returned '%*.*s'\n", testsize, testsize, testsize, to);
- /* Test 2 - uneven case */ + /* Test 2 - uneven case */ memset(to,'$', sizeof(to)); memset(from,'@', sizeof(from)); testsize = 25; @@ -155,7 +157,7 @@ static void test_swab( void ) { _swab( from, to, testsize ); ok(memcmp(to,expected2,testsize) == 0, "Testing odd size %d returned '%*.*s'\n", testsize, testsize, testsize, to);
- /* Test 3 - from = to */ + /* Test 3 - from = to */ memset(to,'$', sizeof(to)); memset(from,'@', sizeof(from)); testsize = 26; @@ -163,7 +165,7 @@ static void test_swab( void ) { _swab( to, to, testsize ); ok(memcmp(to,expected1,testsize) == 0, "Testing overlapped size %d returned '%*.*s'\n", testsize, testsize, testsize, to);
- /* Test 4 - 1 bytes */ + /* Test 4 - 1 bytes */ memset(to,'$', sizeof(to)); memset(from,'@', sizeof(from)); testsize = 1; @@ -2835,6 +2837,62 @@ static void test__mbsnbcat_s(void) "Expected the output buffer string to be "\0inosaurdu" without ending null terminator\n"); }
+static void test__mbsupr_s_l(void) +{ + errno_t ret; + unsigned char buffer[20]; + + if (!p_mbsupr_s_l) + { + win_skip("Skipping _mbsupr_s_l tests\n"); + return; + } + + errno = EBADF; + ret = p_mbsupr_s_l(NULL, 0, NULL); + ok(ret == 0, "Expected _mbsupr_s_l to return 0, got %d\n", ret); + + errno = EBADF; + ret = p_mbsupr_s_l(NULL, sizeof(buffer), NULL); + ok(ret == EINVAL, "Expected _mbsupr_s_l to return EINVAL, got %d\n", ret); + ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno); + + errno = EBADF; + ret = p_mbsupr_s_l(buffer, 0, NULL); + ok(ret == EINVAL, "Expected _mbsupr_s_l to return EINVAL, got %d\n", ret); + ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno); + + memcpy(buffer, "abcdefgh", sizeof("abcdefgh")); + errno = EBADF; + ret = p_mbsupr_s_l(buffer, sizeof("abcdefgh"), NULL); + ok(ret == 0, "Expected _mbsupr_s_l to return 0, got %d\n", ret); + ok(!memcmp(buffer, "ABCDEFGH", sizeof("ABCDEFGH")), + "Expected the output buffer to be "ABCDEFGH", got "%s"\n", + buffer); + + memcpy(buffer, "abcdefgh", sizeof("abcdefgh")); + errno = EBADF; + ret = p_mbsupr_s_l(buffer, sizeof(buffer), NULL); + ok(ret == 0, "Expected _mbsupr_s_l to return 0, got %d\n", ret); + ok(!memcmp(buffer, "ABCDEFGH", sizeof("ABCDEFGH")), + "Expected the output buffer to be "ABCDEFGH", got "%s"\n", + buffer); + + memcpy(buffer, "abcdefgh", sizeof("abcdefgh")); + errno = EBADF; + ret = p_mbsupr_s_l(buffer, 4, NULL); + ok(ret == EINVAL, "Expected _mbsupr_s_l to return EINVAL, got %d\n", ret); + ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno); + + memcpy(buffer, "abcdefgh\0ijklmnop", sizeof("abcdefgh\0ijklmnop")); + errno = EBADF; + ret = p_mbsupr_s_l(buffer, sizeof(buffer), NULL); + ok(ret == 0, "Expected _mbsupr_s_l to return 0, got %d\n", ret); + ok(!memcmp(buffer, "ABCDEFGH\0ijklmnop", sizeof("ABCDEFGH\0ijklmnop")), + "Expected the output buffer to be "ABCDEFGH\0ijklmnop", got "%s"\n", + buffer); +} + static void test__mbsupr_s(void) { errno_t ret; @@ -2889,7 +2947,62 @@ static void test__mbsupr_s(void) ok(!memcmp(buffer, "ABCDEFGH\0ijklmnop", sizeof("ABCDEFGH\0ijklmnop")), "Expected the output buffer to be "ABCDEFGH\0ijklmnop", got "%s"\n", buffer); +} + +static void test__mbslwr_s_l(void) +{ + errno_t ret; + unsigned char buffer[20]; + + if (!p_mbslwr_s_l) + { + win_skip("Skipping _mbslwr_s_l tests\n"); + return; + } + + errno = EBADF; + ret = p_mbslwr_s_l(NULL, 0, NULL); + ok(ret == 0, "Expected _mbslwr_s_l to return 0, got %d\n", ret); + + errno = EBADF; + ret = p_mbslwr_s_l(NULL, sizeof(buffer), NULL); + ok(ret == EINVAL, "Expected _mbslwr_s_l to return EINVAL, got %d\n", ret); + ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno); + + errno = EBADF; + ret = p_mbslwr_s_l(buffer, 0, NULL); + ok(ret == EINVAL, "Expected _mbslwr_s_l to return EINVAL, got %d\n", ret); + ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno); + + memcpy(buffer, "ABCDEFGH", sizeof("ABCDEFGH")); + errno = EBADF; + ret = p_mbslwr_s_l(buffer, sizeof("ABCDEFGH"), NULL); + ok(ret == 0, "Expected _mbslwr_s_l to return 0, got %d\n", ret); + ok(!memcmp(buffer, "abcdefgh", sizeof("abcdefgh")), + "Expected the output buffer to be "abcdefgh", got "%s"\n", + buffer); + + memcpy(buffer, "ABCDEFGH", sizeof("ABCDEFGH")); + errno = EBADF; + ret = p_mbslwr_s_l(buffer, sizeof(buffer), NULL); + ok(ret == 0, "Expected _mbslwr_s_l to return 0, got %d\n", ret); + ok(!memcmp(buffer, "abcdefgh", sizeof("abcdefgh")), + "Expected the output buffer to be "abcdefgh", got "%s"\n", + buffer); + + memcpy(buffer, "ABCDEFGH", sizeof("ABCDEFGH")); + errno = EBADF; + ret = p_mbslwr_s_l(buffer, 4, NULL); + ok(ret == EINVAL, "Expected _mbslwr_s_l to return EINVAL, got %d\n", ret); + ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
+ memcpy(buffer, "ABCDEFGH\0IJKLMNOP", sizeof("ABCDEFGH\0IJKLMNOP")); + errno = EBADF; + ret = p_mbslwr_s_l(buffer, sizeof(buffer), NULL); + ok(ret == 0, "Expected _mbslwr_s_l to return 0, got %d\n", ret); + ok(!memcmp(buffer, "abcdefgh\0IJKLMNOP", sizeof("abcdefgh\0IJKLMNOP")), + "Expected the output buffer to be "abcdefgh\0IJKLMNOP", got "%s"\n", + buffer); }
static void test__mbslwr_s(void) @@ -4639,7 +4752,9 @@ START_TEST(string) p_strlwr_s = (void *)GetProcAddress(hMsvcrt, "_strlwr_s"); p_ultoa_s = (void *)GetProcAddress(hMsvcrt, "_ultoa_s"); p_wcslwr_s = (void*)GetProcAddress(hMsvcrt, "_wcslwr_s"); + p_mbsupr_s_l = (void*)GetProcAddress(hMsvcrt, "_mbsupr_s_l"); p_mbsupr_s = (void*)GetProcAddress(hMsvcrt, "_mbsupr_s"); + p_mbslwr_s_l = (void*)GetProcAddress(hMsvcrt, "_mbslwr_s_l"); p_mbslwr_s = (void*)GetProcAddress(hMsvcrt, "_mbslwr_s"); p_btowc = (void*)GetProcAddress(hMsvcrt, "btowc"); p_wctob = (void*)GetProcAddress(hMsvcrt, "wctob"); @@ -4720,7 +4835,9 @@ START_TEST(string) test__mbsnbcat_s(); test__ultoa_s(); test__wcslwr_s(); + test__mbsupr_s_l(); test__mbsupr_s(); + test__mbslwr_s_l(); test__mbslwr_s(); test_wctob(); test_btowc(); diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec index a4acf724d2f..3e3fd8d6965 100644 --- a/dlls/ucrtbase/ucrtbase.spec +++ b/dlls/ucrtbase/ucrtbase.spec @@ -603,11 +603,11 @@ @ cdecl _mbctokata(long) @ stub _mbctokata_l @ cdecl _mbctolower(long) -@ stub _mbctolower_l +@ cdecl _mbctolower_l(long ptr) @ cdecl _mbctombb(long) @ stub _mbctombb_l @ cdecl _mbctoupper(long) -@ stub _mbctoupper_l +@ cdecl _mbctoupper_l(long ptr) @ stub _mblen_l @ cdecl _mbsbtype(str long) @ stub _mbsbtype_l @@ -637,7 +637,7 @@ @ cdecl _mbslwr(str) @ stub _mbslwr_l @ cdecl _mbslwr_s(str long) -@ stub _mbslwr_s_l +@ cdecl _mbslwr_s_l(str long ptr) @ cdecl _mbsnbcat(str str long) @ stub _mbsnbcat_l @ cdecl _mbsnbcat_s(str long ptr long) @@ -717,7 +717,7 @@ @ cdecl _mbsupr(str) @ stub _mbsupr_l @ cdecl _mbsupr_s(str long) -@ stub _mbsupr_s_l +@ cdecl _mbsupr_s_l(str long ptr) @ cdecl _mbtowc_l(ptr str long ptr) @ cdecl _memccpy(ptr ptr long long) @ cdecl _memicmp(str str long)
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=125082
Your paranoid android.
=== debian11 (32 bit report) ===
d3drm: d3drm.c:5561: Test failed: Cannot create IM device, skipping tests.
ddraw: ddraw7.c:15663: Test failed: Expected unsynchronised map for flags 0x1000. ddraw7.c:15663: Test failed: Expected unsynchronised map for flags 0x3000.
dmime: performance: Timeout
msvcrt: string.c:2847: Test failed: Skipping _mbsupr_s_l tests
quartz: filtergraph.c:524: Test marked flaky: didn't get EOS filtergraph.c:529: Test marked flaky: expected 1243c8, got 0
=== debian11 (32 bit ar:MA report) ===
msvcrt: string.c:2847: Test failed: Skipping _mbsupr_s_l tests
=== debian11 (32 bit de report) ===
msvcrt: string.c:2847: Test failed: Skipping _mbsupr_s_l tests
=== debian11 (32 bit fr report) ===
msvcrt: string.c:2847: Test failed: Skipping _mbsupr_s_l tests
=== debian11 (32 bit he:IL report) ===
msvcrt: string.c:2847: Test failed: Skipping _mbsupr_s_l tests
=== debian11 (32 bit hi:IN report) ===
msvcrt: string.c:2847: Test failed: Skipping _mbsupr_s_l tests
=== debian11 (32 bit ja:JP report) ===
msvcrt: string.c:2847: Test failed: Skipping _mbsupr_s_l tests
=== debian11 (32 bit zh:CN report) ===
msvcrt: string.c:2847: Test failed: Skipping _mbsupr_s_l tests
=== debian11 (build log) ===
0624:err:winediag:d3d_device_create The application wants to create a Direct3D device, but the current DirectDrawRenderer does not support this. 0624:err:winediag:d3d_device_create The application wants to create a Direct3D device, but the current DirectDrawRenderer does not support this. 0624:err:winediag:d3d_device_create The application wants to create a Direct3D device, but the current DirectDrawRenderer does not support this.
=== debian11 (build log) ===
Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24753. Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24753. Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24753.
=== debian11 (32 bit WoW report) ===
msvcrt: string.c:2847: Test failed: Skipping _mbsupr_s_l tests
=== debian11 (64 bit WoW report) ===
msvcrt: string.c:2847: Test failed: Skipping _mbsupr_s_l tests
Hi, @gang65 . Usual approach is to have one commit per implemented function.
This merge request was closed by Bartosz Kosiorek.