[RTL]
authorDmitry Chapyshev <dmitry@reactos.org>
Sun, 28 Aug 2016 16:08:25 +0000 (16:08 +0000)
committerDmitry Chapyshev <dmitry@reactos.org>
Sun, 28 Aug 2016 16:08:25 +0000 (16:08 +0000)
- Implement IS_TEXT_UNICODE_DBCS_LEADBYTE flag

* Fixes 4 new tests in advapi32_apitest

svn path=/trunk/; revision=72488

reactos/sdk/lib/rtl/unicode.c

index 655c04d..7bca567 100644 (file)
@@ -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)