Author: pschweitzer Date: Sun Apr 21 15:53:59 2013 New Revision: 58810
URL: http://svn.reactos.org/svn/reactos?rev=58810&view=rev Log: [NTOSKRNL] Reimplement (& fix) handling of DOS_DOT in FsRtlIs*InExpression(). This fixes lots of failing tests
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 15:53:59 2013 @@ -163,6 +163,7 @@ SHORT StarFound = -1; PUSHORT BackTracking = NULL; USHORT ExpressionPosition = 0, NamePosition = 0, MatchingChars; + BOOLEAN BeyondName; PAGED_CODE();
ASSERT(Name->Length); @@ -227,6 +228,41 @@ MatchingChars++; } ExpressionPosition++; + } + /* Check DOS_DOT */ + else if (Expression->Buffer[ExpressionPosition] == DOS_DOT) + { + /* First try to find whether we are beyond last dot (beyond name) */ + BeyondName = TRUE; + MatchingChars = NamePosition + 1; + while (MatchingChars < Name->Length) + { + if (Name->Buffer[MatchingChars] == '.') + { + BeyondName = FALSE; + break; + } + MatchingChars++; + } + + /* If we are beyond name, we null match */ + if (BeyondName) + { + ExpressionPosition++; + continue; + } + /* If not, we only match a dot */ + else if (Name->Buffer[NamePosition] == '.') + { + NamePosition++; + ExpressionPosition++; + continue; + } + /* Otherwise, fail */ + else + { + break; + } } /* If nothing match, try to backtrack */ else if (StarFound >= 0)
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 15:53:59 2013 @@ -28,6 +28,7 @@ UNICODE_STRING IntExpression; USHORT ExpressionPosition = 0, NamePosition = 0, MatchingChars; WCHAR CompareChar; + BOOLEAN BeyondName; PAGED_CODE();
/* Check if we were given strings at all */ @@ -112,8 +113,7 @@ ExpressionPosition++; } /* Check cases that eat one char */ - else if (Expression->Buffer[ExpressionPosition] == L'?' || (Expression->Buffer[ExpressionPosition] == DOS_QM) || - (Expression->Buffer[ExpressionPosition] == DOS_DOT && Name->Buffer[NamePosition] == L'.')) + else if (Expression->Buffer[ExpressionPosition] == L'?' || (Expression->Buffer[ExpressionPosition] == DOS_QM)) { NamePosition++; ExpressionPosition++; @@ -163,6 +163,41 @@ MatchingChars++; } ExpressionPosition++; + } + /* Check DOS_DOT */ + else if (Expression->Buffer[ExpressionPosition] == DOS_DOT) + { + /* First try to find whether we are beyond last dot (beyond name) */ + BeyondName = TRUE; + MatchingChars = NamePosition + 1; + while (MatchingChars < Name->Length / sizeof(WCHAR)) + { + if (Name->Buffer[MatchingChars] == L'.') + { + BeyondName = FALSE; + break; + } + MatchingChars++; + } + + /* If we are beyond name, we null match */ + if (BeyondName) + { + ExpressionPosition++; + continue; + } + /* If not, we only match a dot */ + else if (Name->Buffer[NamePosition] == L'.') + { + NamePosition++; + ExpressionPosition++; + continue; + } + /* Otherwise, fail */ + else + { + break; + } } /* If nothing match, try to backtrack */ else if (StarFound >= 0)