diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c index 6546ede81c9..2e5310eca9e 100644 --- a/dlls/msvcrt/mbcs.c +++ b/dlls/msvcrt/mbcs.c @@ -26,6 +26,7 @@ #include "msvcrt.h" #include "wine/unicode.h" #include "wine/debug.h" +#include "msvcrt/mbctype.h" WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); @@ -739,6 +740,31 @@ unsigned int CDECL _mbbtombc(unsigned int c) return c; /* ASCII CP or no MB char */ } +/********************************************************************* + * _mbbtype(MSVCRT.@) + */ +int CDECL _mbbtype(unsigned char c, int type) +{ + if (type == 1) + { + if ((c >= 0x20 && c <= 0x7e) || (c >= 0xa1 && c <= 0xdf)) + return _MBC_SINGLE; + else if ((c >= 0x40 && c <= 0x7e) || (c >= 0x80 && c <= 0xfc)) + return _MBC_TRAIL; + else + return _MBC_ILLEGAL; + } + else + { + if ((c >= 0x20 && c <= 0x7e) || (c >= 0xa1 && c <= 0xdf)) + return _MBC_SINGLE; + else if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xfc)) + return _MBC_LEAD; + else + return _MBC_ILLEGAL; + } +} + /********************************************************************* * _ismbbkana(MSVCRT.@) */ diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 91303220e69..9cdee2c023d 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -338,7 +338,7 @@ @ cdecl _makepath(str str str str str) @ cdecl _matherr(ptr) MSVCRT__matherr @ cdecl _mbbtombc(long) -@ stub _mbbtype #(long long) +@ cdecl _mbbtype(long long) # extern _mbcasemap @ cdecl _mbccpy (str str) @ stub _mbcjistojms #(long)