Author: pschweitzer Date: Sun Feb 13 08:43:48 2011 New Revision: 50680
URL: http://svn.reactos.org/svn/reactos?rev=50680&view=rev Log: [NTOSKRNL] For both FsRtlIsNameInExpression & FsRtlIsDbcsInExpression: - Get back "useless checks" (tests show they weren't that useless) - Prevent code redundancy
This fixes 4 failing kmtest tests added in r50679
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?r... ============================================================================== --- trunk/reactos/ntoskrnl/fsrtl/dbcsname.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/fsrtl/dbcsname.c [iso-8859-1] Sun Feb 13 08:43:48 2011 @@ -184,40 +184,37 @@ else if (Expression->Buffer[ExpressionPosition] == '*') { StarFound = ExpressionPosition++; - if (StarFound < (Expression->Length - 1)) + if (ExpressionPosition == Expression->Length) + { + NamePosition = Name->Length; + } + } + else if (Expression->Buffer[ExpressionPosition] == ANSI_DOS_STAR) + { + StarFound = MAXUSHORT; + MatchingChars = NamePosition; + while (MatchingChars < Name->Length) + { + if (Name->Buffer[MatchingChars] == '.') + { + NamePosition = MatchingChars; + } + MatchingChars++; + } + ExpressionPosition++; + } + 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++; } - } - else - { - NamePosition = Name->Length; - } - } - else if (Expression->Buffer[ExpressionPosition] == ANSI_DOS_STAR) - { - StarFound = MAXUSHORT; - MatchingChars = NamePosition; - while (MatchingChars < Name->Length) - { - if (Name->Buffer[MatchingChars] == '.') - { - NamePosition = MatchingChars; - } - MatchingChars++; - } - ExpressionPosition++; - } - else if (StarFound != MAXUSHORT) - { - ExpressionPosition = StarFound + 1; - 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=5... ============================================================================== --- trunk/reactos/ntoskrnl/fsrtl/name.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/fsrtl/name.c [iso-8859-1] Sun Feb 13 08:43:48 2011 @@ -44,40 +44,37 @@ else if (Expression->Buffer[ExpressionPosition] == L'*') { StarFound = ExpressionPosition++; - if (StarFound < (Expression->Length / sizeof(WCHAR) - 1)) + if (ExpressionPosition == Expression->Length / sizeof(WCHAR)) + { + NamePosition = Name->Length / sizeof(WCHAR); + } + } + else if (Expression->Buffer[ExpressionPosition] == DOS_STAR) + { + StarFound = MAXUSHORT; + MatchingChars = NamePosition; + while (MatchingChars < Name->Length / sizeof(WCHAR)) + { + if (Name->Buffer[MatchingChars] == L'.') + { + NamePosition = MatchingChars; + } + MatchingChars++; + } + ExpressionPosition++; + } + 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++; } - } - else - { - NamePosition = Name->Length / sizeof(WCHAR); - } - } - else if (Expression->Buffer[ExpressionPosition] == DOS_STAR) - { - StarFound = MAXUSHORT; - MatchingChars = NamePosition; - while (MatchingChars < Name->Length / sizeof(WCHAR)) - { - if (Name->Buffer[MatchingChars] == L'.') - { - NamePosition = MatchingChars; - } - MatchingChars++; - } - ExpressionPosition++; - } - else if (StarFound != MAXUSHORT) - { - ExpressionPosition = StarFound + 1; - while ((IgnoreCase ? UpcaseTable[Name->Buffer[NamePosition]] : Name->Buffer[NamePosition]) != Expression->Buffer[ExpressionPosition] && - NamePosition < Name->Length / sizeof(WCHAR)) - { - NamePosition++; } } else