Author: pschweitzer
Date: Sun Feb 13 20:23:03 2011
New Revision: 50685
URL:
http://svn.reactos.org/svn/reactos?rev=50685&view=rev
Log:
[NTOSKRNL]
Improved * WC handling for both FsRtlIsNameInExpression & FsRtlIsDbcsInExpression
This fixes all failing tests in kmtest
Modified:
trunk/reactos/ntoskrnl/fsrtl/dbcsname.c
trunk/reactos/ntoskrnl/fsrtl/name.c
Modified: trunk/reactos/ntoskrnl/fsrtl/dbcsname.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fsrtl/dbcsname.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/fsrtl/dbcsname.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/fsrtl/dbcsname.c [iso-8859-1] Sun Feb 13 20:23:03 2011
@@ -174,6 +174,45 @@
NamePosition++;
ExpressionPosition++;
}
+ else if (StarFound != MAXUSHORT && (Expression->Buffer[StarFound + 1]
== '*' ||
+ Expression->Buffer[StarFound + 1] == '?' ||
Expression->Buffer[StarFound + 1] == ANSI_DOS_DOT))
+ {
+ ExpressionPosition = StarFound + 1;
+ switch (Expression->Buffer[ExpressionPosition])
+ {
+ case '*':
+ StarFound = ExpressionPosition++;
+ break;
+
+ case '?':
+ ExpressionPosition++;
+ MatchingChars = NamePosition;
+ while (Name->Buffer[NamePosition] !=
Expression->Buffer[ExpressionPosition] &&
+ NamePosition < Name->Length)
+ {
+ NamePosition++;
+ }
+
+ if (NamePosition - MatchingChars > 0)
+ {
+ StarFound = MAXUSHORT;
+ }
+ break;
+
+ case ANSI_DOS_DOT:
+ while (Name->Buffer[NamePosition] != '.' &&
NamePosition < Name->Length)
+ {
+ NamePosition++;
+ }
+ ExpressionPosition++;
+ StarFound = MAXUSHORT;
+ break;
+
+ default:
+ /* Should never happen */
+ ASSERT(FALSE);
+ }
+ }
else if ((Expression->Buffer[ExpressionPosition] == '?') ||
(Expression->Buffer[ExpressionPosition] == ANSI_DOS_QM) ||
(Expression->Buffer[ExpressionPosition] == ANSI_DOS_DOT &&
Name->Buffer[NamePosition] == '.'))
{
@@ -206,15 +245,10 @@
else if (StarFound != MAXUSHORT)
{
ExpressionPosition = StarFound + 1;
- if (Expression->Buffer[ExpressionPosition] != '*' &&
Expression->Buffer[ExpressionPosition] != '?' &&
- Expression->Buffer[ExpressionPosition] != ANSI_DOS_DOT &&
Expression->Buffer[ExpressionPosition] != ANSI_DOS_QM &&
- Expression->Buffer[ExpressionPosition] != ANSI_DOS_STAR)
- {
- while (Name->Buffer[NamePosition] !=
Expression->Buffer[ExpressionPosition] &&
- NamePosition < Name->Length)
- {
- NamePosition++;
- }
+ while (Name->Buffer[NamePosition] !=
Expression->Buffer[ExpressionPosition] &&
+ NamePosition < Name->Length)
+ {
+ NamePosition++;
}
}
else
Modified: trunk/reactos/ntoskrnl/fsrtl/name.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fsrtl/name.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/fsrtl/name.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/fsrtl/name.c [iso-8859-1] Sun Feb 13 20:23:03 2011
@@ -34,6 +34,47 @@
NamePosition++;
ExpressionPosition++;
}
+ else if (StarFound != MAXUSHORT && (Expression->Buffer[StarFound + 1]
== L'*' ||
+ Expression->Buffer[StarFound + 1] == L'?' ||
Expression->Buffer[StarFound + 1] == DOS_DOT))
+ {
+ ExpressionPosition = StarFound + 1;
+ switch (Expression->Buffer[ExpressionPosition])
+ {
+ case L'*':
+ StarFound = ExpressionPosition++;
+ break;
+
+ case L'?':
+ ExpressionPosition++;
+ MatchingChars = NamePosition;
+ while ((IgnoreCase ? UpcaseTable[Name->Buffer[NamePosition]] :
+ Name->Buffer[NamePosition]) !=
Expression->Buffer[ExpressionPosition] &&
+ NamePosition < Name->Length / sizeof(WCHAR))
+ {
+ NamePosition++;
+ }
+
+ if (NamePosition - MatchingChars > 0)
+ {
+ StarFound = MAXUSHORT;
+ }
+ break;
+
+ case DOS_DOT:
+ while (Name->Buffer[NamePosition] != L'.' &&
+ NamePosition < Name->Length / sizeof(WCHAR))
+ {
+ NamePosition++;
+ }
+ ExpressionPosition++;
+ StarFound = MAXUSHORT;
+ break;
+
+ default:
+ /* Should never happen */
+ ASSERT(FALSE);
+ }
+ }
else if (Expression->Buffer[ExpressionPosition] == L'?' ||
(Expression->Buffer[ExpressionPosition] == DOS_QM) ||
(Expression->Buffer[ExpressionPosition] == DOS_DOT &&
Name->Buffer[NamePosition] == L'.'))
{
@@ -66,15 +107,11 @@
else if (StarFound != MAXUSHORT)
{
ExpressionPosition = StarFound + 1;
- if (Expression->Buffer[ExpressionPosition] != L'*' &&
Expression->Buffer[ExpressionPosition] != L'?' &&
- Expression->Buffer[ExpressionPosition] != DOS_DOT &&
Expression->Buffer[ExpressionPosition] != DOS_QM &&
- Expression->Buffer[ExpressionPosition] != DOS_STAR)
- {
- while ((IgnoreCase ? UpcaseTable[Name->Buffer[NamePosition]] :
Name->Buffer[NamePosition]) != Expression->Buffer[ExpressionPosition] &&
- NamePosition < Name->Length / sizeof(WCHAR))
- {
- NamePosition++;
- }
+ while ((IgnoreCase ? UpcaseTable[Name->Buffer[NamePosition]] :
+ Name->Buffer[NamePosition]) !=
Expression->Buffer[ExpressionPosition] &&
+ NamePosition < Name->Length / sizeof(WCHAR))
+ {
+ NamePosition++;
}
}
else