From d7c9b59f0f9bce7949eae6df73400cac54782d30 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 21 Apr 2013 14:25:55 +0000 Subject: [PATCH] [NTOSKRNL] Allow ignoring all nullable matching wildcards at the end of the expression string when name is over in FsRtlIs*InExpression() This fixes a few tests svn path=/trunk/; revision=58806 --- reactos/ntoskrnl/fsrtl/dbcsname.c | 15 ++++++++++++--- reactos/ntoskrnl/fsrtl/name.c | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/reactos/ntoskrnl/fsrtl/dbcsname.c b/reactos/ntoskrnl/fsrtl/dbcsname.c index 883a76e70da..2aef01ebf72 100644 --- a/reactos/ntoskrnl/fsrtl/dbcsname.c +++ b/reactos/ntoskrnl/fsrtl/dbcsname.c @@ -247,10 +247,19 @@ FsRtlIsDbcsInExpression(IN PANSI_STRING Expression, ExpressionPosition = BackTracking[StarFound--]; } } - if (ExpressionPosition + 1 == Expression->Length && NamePosition == Name->Length && - (Expression->Buffer[ExpressionPosition] == ANSI_DOS_DOT || Expression->Buffer[ExpressionPosition] == '*')) + /* If we have nullable matching wc at the end of the string, eat them */ + if (ExpressionPosition != Expression->Length && NamePosition == Name->Length) { - ExpressionPosition++; + while (ExpressionPosition < Expression->Length) + { + if (Expression->Buffer[ExpressionPosition] != ANSI_DOS_DOT && + Expression->Buffer[ExpressionPosition] != '*' && + Expression->Buffer[ExpressionPosition] != ANSI_DOS_STAR) + { + break; + } + ExpressionPosition++; + } } if (BackTracking) diff --git a/reactos/ntoskrnl/fsrtl/name.c b/reactos/ntoskrnl/fsrtl/name.c index be1eb348082..cdd46757450 100644 --- a/reactos/ntoskrnl/fsrtl/name.c +++ b/reactos/ntoskrnl/fsrtl/name.c @@ -184,10 +184,19 @@ FsRtlIsNameInExpressionPrivate(IN PUNICODE_STRING Expression, ExpressionPosition = BackTracking[StarFound--]; } } - if (ExpressionPosition + 1 == Expression->Length / sizeof(WCHAR) && NamePosition == Name->Length / sizeof(WCHAR) && - (Expression->Buffer[ExpressionPosition] == DOS_DOT || Expression->Buffer[ExpressionPosition] == L'*')) + /* If we have nullable matching wc at the end of the string, eat them */ + if (ExpressionPosition != Expression->Length / sizeof(WCHAR) && NamePosition == Name->Length / sizeof(WCHAR)) { - ExpressionPosition++; + while (ExpressionPosition < Expression->Length / sizeof(WCHAR)) + { + if (Expression->Buffer[ExpressionPosition] != DOS_DOT && + Expression->Buffer[ExpressionPosition] != L'*' && + Expression->Buffer[ExpressionPosition] != DOS_STAR) + { + break; + } + ExpressionPosition++; + } } if (BackTracking) -- 2.17.1