Author: pschweitzer
Date: Mon Dec 13 11:24:52 2010
New Revision: 50021
URL:
http://svn.reactos.org/svn/reactos?rev=50021&view=rev
Log:
[NTOSKRNL]
Rewritten FsRtlIsDbcsInExpression() using FsRtlIsNameInExpression() pattern.
This fixes all failing tests from kmtest.sys and make this function definitely tastier to
MS fastfat.sys
Modified:
trunk/reactos/ntoskrnl/fsrtl/dbcsname.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] Mon Dec 13 11:24:52 2010
@@ -160,55 +160,66 @@
FsRtlIsDbcsInExpression(IN PANSI_STRING Expression,
IN PANSI_STRING Name)
{
- ULONG ExpressionPosition, NamePosition, MatchingChars = 0;
+ USHORT ExpressionPosition = 0, NamePosition = 0, MatchingChars;
PAGED_CODE();
ASSERT(Name->Length);
ASSERT(Expression->Length);
ASSERT(!FsRtlDoesDbcsContainWildCards(Name));
- /* One can't be null, both can be */
- if (!Expression->Length || !Name->Length)
- {
- return !(Expression->Length ^ Name->Length);
- }
-
- for (ExpressionPosition = 0; ExpressionPosition < Expression->Length;
ExpressionPosition++)
- {
- if ((Expression->Buffer[ExpressionPosition] == Name->Buffer[MatchingChars])
||
- (Expression->Buffer[ExpressionPosition] == '?') ||
- (Expression->Buffer[ExpressionPosition] == ANSI_DOS_QM) ||
- (Expression->Buffer[ExpressionPosition] == ANSI_DOS_DOT &&
- (Name->Buffer[MatchingChars] == '.' ||
Name->Buffer[MatchingChars] == '0')))
- {
- MatchingChars++;
+ while (NamePosition < Name->Length && ExpressionPosition <
Expression->Length)
+ {
+ if ((Expression->Buffer[ExpressionPosition] == Name->Buffer[NamePosition])
||
+ (Expression->Buffer[ExpressionPosition] == '?') ||
(Expression->Buffer[ExpressionPosition] == ANSI_DOS_QM) ||
+ (Expression->Buffer[ExpressionPosition] == ANSI_DOS_DOT &&
Name->Buffer[NamePosition] == '.'))
+ {
+ NamePosition++;
+ ExpressionPosition++;
}
else if (Expression->Buffer[ExpressionPosition] == '*')
{
- MatchingChars = Name->Length;
+ if (ExpressionPosition < (Expression->Length - 1))
+ {
+ if (Expression->Buffer[ExpressionPosition+1] != '*' &&
Expression->Buffer[ExpressionPosition+1] != '?' &&
+ Expression->Buffer[ExpressionPosition+1] != ANSI_DOS_DOT
&&
+ Expression->Buffer[ExpressionPosition+1] != ANSI_DOS_QM
&&
+ Expression->Buffer[ExpressionPosition+1] != ANSI_DOS_STAR)
+ {
+ while (Name->Buffer[NamePosition] !=
Expression->Buffer[ExpressionPosition+1] &&
+ NamePosition < Name->Length) NamePosition++;
+ }
+ }
+ else
+ {
+ NamePosition = Name->Length;
+ }
+ ExpressionPosition++;
}
else if (Expression->Buffer[ExpressionPosition] == ANSI_DOS_STAR)
{
- for (NamePosition = MatchingChars; NamePosition < Name->Length;
NamePosition++)
- {
- if (Name->Buffer[NamePosition] == '.')
+ MatchingChars = NamePosition;
+ while (MatchingChars < Name->Length)
+ {
+ if (Name->Buffer[MatchingChars] == '.')
{
- MatchingChars = NamePosition;
- break;
+ NamePosition = MatchingChars;
}
- }
+ MatchingChars++;
+ }
+ ExpressionPosition++;
}
else
{
- MatchingChars = 0;
- }
- if (MatchingChars == Name->Length)
- {
- return TRUE;
- }
- }
-
- return FALSE;
+ NamePosition = Name->Length;
+ }
+ }
+ if (ExpressionPosition + 1 == Expression->Length && NamePosition ==
Name->Length &&
+ Expression->Buffer[ExpressionPosition] == ANSI_DOS_DOT)
+ {
+ ExpressionPosition++;
+ }
+
+ return (ExpressionPosition == Expression->Length && NamePosition ==
Name->Length);
}
/*++