From 4efe1428b95dddec761d1b1c050132fa3233f70e Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Wed, 24 Apr 2013 16:59:23 +0000 Subject: [PATCH] [NTOSKRNL] Really implement support for DOS_QM in FsRtlIs*InExpression() Should fix some tests svn path=/trunk/; revision=58844 --- reactos/ntoskrnl/fsrtl/dbcsname.c | 32 ++++++++++++++++++++++++++++++- reactos/ntoskrnl/fsrtl/name.c | 32 ++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/reactos/ntoskrnl/fsrtl/dbcsname.c b/reactos/ntoskrnl/fsrtl/dbcsname.c index c17203b0153..533be7a9ac7 100644 --- a/reactos/ntoskrnl/fsrtl/dbcsname.c +++ b/reactos/ntoskrnl/fsrtl/dbcsname.c @@ -184,7 +184,7 @@ FsRtlIsDbcsInExpression(IN PANSI_STRING Expression, ExpressionPosition++; } /* Check cases that eat one char */ - else if ((Expression->Buffer[ExpressionPosition] == '?') || (Expression->Buffer[ExpressionPosition] == ANSI_DOS_QM)) + else if (Expression->Buffer[ExpressionPosition] == '?') { NamePosition++; ExpressionPosition++; @@ -311,6 +311,36 @@ FsRtlIsDbcsInExpression(IN PANSI_STRING Expression, break; } } + /* Check DOS_QM */ + else if (Expression->Buffer[ExpressionPosition] == ANSI_DOS_QM) + { + /* Check whether we are upon a dot */ + MatchingChars = 0; + while (MatchingChars < NamePosition) + { + if (Name->Buffer[MatchingChars] == '.') + { + break; + } + MatchingChars++; + } + + /* If not, we match a single char */ + if (MatchingChars == NamePosition && Name->Buffer[NamePosition] != '.') + { + NamePosition++; + ExpressionPosition++; + } + else + { + /* If we are, we just go through QMs */ + while (ExpressionPosition < Expression->Length && + Expression->Buffer[ExpressionPosition] == ANSI_DOS_QM) + { + ExpressionPosition++; + } + } + } /* If nothing match, try to backtrack */ else if (StarFound >= 0) { diff --git a/reactos/ntoskrnl/fsrtl/name.c b/reactos/ntoskrnl/fsrtl/name.c index 881b9c0e594..16acb0e3e1f 100644 --- a/reactos/ntoskrnl/fsrtl/name.c +++ b/reactos/ntoskrnl/fsrtl/name.c @@ -113,7 +113,7 @@ FsRtlIsNameInExpressionPrivate(IN PUNICODE_STRING Expression, ExpressionPosition++; } /* Check cases that eat one char */ - else if (Expression->Buffer[ExpressionPosition] == L'?' || (Expression->Buffer[ExpressionPosition] == DOS_QM)) + else if (Expression->Buffer[ExpressionPosition] == L'?') { NamePosition++; ExpressionPosition++; @@ -242,6 +242,36 @@ FsRtlIsNameInExpressionPrivate(IN PUNICODE_STRING Expression, break; } } + /* Check DOS_QM */ + else if (Expression->Buffer[ExpressionPosition] == DOS_QM) + { + /* Check whether we are upon a dot */ + MatchingChars = 0; + while (MatchingChars < NamePosition) + { + if (Name->Buffer[MatchingChars] == L'.') + { + break; + } + MatchingChars++; + } + + /* If not, we match a single char */ + if (MatchingChars == NamePosition && Name->Buffer[NamePosition] != L'.') + { + NamePosition++; + ExpressionPosition++; + } + else + { + /* If we are, we just go through QMs */ + while (ExpressionPosition < Expression->Length / sizeof(WCHAR) && + Expression->Buffer[ExpressionPosition] == DOS_QM) + { + ExpressionPosition++; + } + } + } /* If nothing match, try to backtrack */ else if (StarFound >= 0) {