Author: pschweitzer Date: Sun Apr 21 20:34:17 2013 New Revision: 58818
URL: http://svn.reactos.org/svn/reactos?rev=58818&view=rev Log: [NTOSKRNL] Nearly properly reimplement DOT_STAR in FsRtlIs*InExpression. Should fix tests broken by hackfix
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 Apr 21 20:34:17 2013 @@ -218,14 +218,47 @@ /* Check DOS_STAR */ else if (Expression->Buffer[ExpressionPosition] == ANSI_DOS_STAR) { - MatchingChars = NamePosition; - while (MatchingChars < Name->Length) - { - if (Name->Buffer[MatchingChars] == '.') + /* We can only consume dot if that's not the last one + * Otherwise, we null match + */ + if (Name->Buffer[NamePosition] == '.') + { + MatchingChars = NamePosition + 1; + while (MatchingChars < Name->Length) { - NamePosition = MatchingChars; + if (Name->Buffer[MatchingChars] == '.') + { + NamePosition++; + break; + } + MatchingChars++; } - 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++; + } } ExpressionPosition++; }
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 Apr 21 20:34:17 2013 @@ -153,14 +153,47 @@ /* Check DOS_STAR */ else if (Expression->Buffer[ExpressionPosition] == DOS_STAR) { - MatchingChars = NamePosition; - while (MatchingChars < Name->Length / sizeof(WCHAR)) - { - if (Name->Buffer[MatchingChars] == L'.') + /* We can only consume dot if that's not the last one + * Otherwise, we null match + */ + if (Name->Buffer[NamePosition] == L'.') + { + MatchingChars = NamePosition + 1; + while (MatchingChars < Name->Length / sizeof(WCHAR)) { - NamePosition = MatchingChars; + if (Name->Buffer[MatchingChars] == L'.') + { + NamePosition++; + break; + } + MatchingChars++; } - 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++; + } } ExpressionPosition++; }