[NTOSKRNL]
authorPierre Schweitzer <pierre@reactos.org>
Sun, 21 Apr 2013 20:34:17 +0000 (20:34 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Sun, 21 Apr 2013 20:34:17 +0000 (20:34 +0000)
Nearly properly reimplement DOT_STAR in FsRtlIs*InExpression.
Should fix tests broken by hackfix

svn path=/trunk/; revision=58818

reactos/ntoskrnl/fsrtl/dbcsname.c
reactos/ntoskrnl/fsrtl/name.c

index cd2e912..443c472 100644 (file)
@@ -218,14 +218,47 @@ FsRtlIsDbcsInExpression(IN PANSI_STRING Expression,
         /* Check DOS_STAR */
         else if (Expression->Buffer[ExpressionPosition] == ANSI_DOS_STAR)
         {
-            MatchingChars = NamePosition;
-            while (MatchingChars < Name->Length)
+            /* We can only consume dot if that's not the last one
+             * Otherwise, we null match
+             */
+            if (Name->Buffer[NamePosition] == '.')
             {
-                if (Name->Buffer[MatchingChars] == '.')
+                MatchingChars = NamePosition + 1;
+                while (MatchingChars < Name->Length)
                 {
-                    NamePosition = MatchingChars;
+                    if (Name->Buffer[MatchingChars] == '.')
+                    {
+                        NamePosition++;
+                        break;
+                    }
+                    MatchingChars++;
+                }
+            }
+            else
+            {
+                /* XXX: Eat everything till the end */
+                if (ExpressionPosition + 1 == Expression->Length)
+                {
+                    NamePosition = Name->Length;
+                }
+
+                /* Try to eat till the next matching char or . */
+                MatchingChars = NamePosition;
+                while (MatchingChars < Name->Length)
+                {
+                    if (ExpressionPosition + 1 < Expression->Length &&
+                        Name->Buffer[MatchingChars] == Expression->Buffer[ExpressionPosition + 1])
+                    {
+                        NamePosition = MatchingChars;
+                        break;
+                    }
+                    else if (Name->Buffer[MatchingChars] == '.')
+                    {
+                        NamePosition = MatchingChars + 1;
+                        break;
+                    }
+                    MatchingChars++;
                 }
-                MatchingChars++;
             }
             ExpressionPosition++;
         }
index 88fc898..d25c0ea 100644 (file)
@@ -153,14 +153,47 @@ FsRtlIsNameInExpressionPrivate(IN PUNICODE_STRING Expression,
         /* Check DOS_STAR */
         else if (Expression->Buffer[ExpressionPosition] == DOS_STAR)
         {
-            MatchingChars = NamePosition;
-            while (MatchingChars < Name->Length / sizeof(WCHAR))
+            /* We can only consume dot if that's not the last one
+             * Otherwise, we null match
+             */
+            if (Name->Buffer[NamePosition] == L'.')
             {
-                if (Name->Buffer[MatchingChars] == L'.')
+                MatchingChars = NamePosition + 1;
+                while (MatchingChars < Name->Length / sizeof(WCHAR))
                 {
-                    NamePosition = MatchingChars;
+                    if (Name->Buffer[MatchingChars] == L'.')
+                    {
+                        NamePosition++;
+                        break;
+                    }
+                    MatchingChars++;
+                }
+            }
+            else
+            {
+                /* XXX: Eat everything till the end */
+                if (ExpressionPosition + 1 == Expression->Length / sizeof(WCHAR))
+                {
+                    NamePosition = Name->Length;
+                }
+
+                /* Try to eat till the next matching char or . */
+                MatchingChars = NamePosition;
+                while (MatchingChars < Name->Length / sizeof(WCHAR))
+                {
+                    if (ExpressionPosition + 1 < Expression->Length / sizeof(WCHAR) &&
+                        Name->Buffer[MatchingChars] == Expression->Buffer[ExpressionPosition + 1])
+                    {
+                        NamePosition = MatchingChars;
+                        break;
+                    }
+                    else if (Name->Buffer[MatchingChars] == L'.')
+                    {
+                        NamePosition = MatchingChars + 1;
+                        break;
+                    }
+                    MatchingChars++;
                 }
-                MatchingChars++;
             }
             ExpressionPosition++;
         }