diff --git a/reactos/sdk/lib/rtl/unicode.c b/reactos/sdk/lib/rtl/unicode.c index 655c04d16c3..7bca567ba91 100644 --- a/reactos/sdk/lib/rtl/unicode.c +++ b/reactos/sdk/lib/rtl/unicode.c @@ -1307,11 +1307,6 @@ RtlIsTextUnicode(CONST VOID* buf, INT len, INT* pf) } } - if (lo_byte_diff < 127 && !hi_byte_diff) - { - out_flags |= IS_TEXT_UNICODE_ASCII16; - } - if (NlsMbCodePageTag) { for (i = 0; i < len; i++) @@ -1333,9 +1328,27 @@ RtlIsTextUnicode(CONST VOID* buf, INT len, INT* pf) weight = 2; else weight = 1; + + if (*pf && (*pf & IS_TEXT_UNICODE_DBCS_LEADBYTE)) + out_flags |= IS_TEXT_UNICODE_DBCS_LEADBYTE; } } + if (lo_byte_diff < 127 && !hi_byte_diff) + { + out_flags |= IS_TEXT_UNICODE_ASCII16; + } + + if (hi_byte_diff && !lo_byte_diff) + { + out_flags |= IS_TEXT_UNICODE_REVERSE_ASCII16; + } + + if ((weight * lo_byte_diff) < hi_byte_diff) + { + out_flags |= IS_TEXT_UNICODE_REVERSE_STATISTICS; + } + /* apply some statistical analysis */ if ((flags & IS_TEXT_UNICODE_STATISTICS) && ((weight * hi_byte_diff) < lo_byte_diff)) @@ -1378,16 +1391,6 @@ RtlIsTextUnicode(CONST VOID* buf, INT len, INT* pf) break; } } - - if (hi_byte_diff && !lo_byte_diff) - { - out_flags |= IS_TEXT_UNICODE_REVERSE_ASCII16; - } - - if ((weight * lo_byte_diff) < hi_byte_diff) - { - out_flags |= IS_TEXT_UNICODE_REVERSE_STATISTICS; - } } if (pf)