diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c index 1040a0c6dd0..2cedb28fd52 100644 --- a/dlls/msvcrt/mbcs.c +++ b/dlls/msvcrt/mbcs.c @@ -446,6 +446,7 @@ unsigned char* _mbschr(const unsigned char* str, unsigned int c) /********************************************************************* * _mbsnccnt(MSVCRT.@) + * 'c' is for 'character'. */ unsigned int _mbsnccnt(const unsigned char *str, unsigned int len) { @@ -468,6 +469,30 @@ unsigned int _mbsnccnt(const unsigned char *str, unsigned int len) return min(strlen(str), len); /* ASCII CP */ } +/********************************************************************* + * _mbsnbcnt(MSVCRT.@) + * 'b' is for byte count. + */ +unsigned int _mbsnbcnt(const unsigned char *str, unsigned int len) +{ + const unsigned char *xstr = str; + + if(MSVCRT___mb_cur_max > 1) + { + while(*xstr && len-- > 0) + { + if(MSVCRT_isleadbyte(*xstr)) + { + xstr++; + len--; + } + xstr++; + } + return xstr-str; + } + return min(strlen(str), len); /* ASCII CP */ +} + /********************************************************************* * _mbsncat(MSVCRT.@) diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 90904a36481..59476224509 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -367,7 +367,7 @@ debug_channels (msvcrt) @ cdecl _mbslwr(str) _mbslwr @ stub _mbsnbcat #(str str long) @ cdecl _mbsnbcmp(str str long) _mbsnbcmp -@ stub _mbsnbcnt #(ptr long) +@ cdecl _mbsnbcnt(ptr long) _mbsnbcnt @ stub _mbsnbcoll #(str str long) @ cdecl _mbsnbcpy(ptr str long) _mbsnbcpy @ stub _mbsnbicmp #(str str long) @@ -768,3 +768,5 @@ debug_channels (msvcrt) @ cdecl wctomb(ptr long) MSVCRT_wctomb @ varargs wprintf(wstr) MSVCRT_wprintf @ stub wscanf #(wstr) varargs +@ stub _Gettnames +@ stub __lc_collate_cp