diff --git a/reactos/ntoskrnl/fsrtl/dbcsname.c b/reactos/ntoskrnl/fsrtl/dbcsname.c index cd2e9126e5d..443c472a0e0 100644 --- a/reactos/ntoskrnl/fsrtl/dbcsname.c +++ b/reactos/ntoskrnl/fsrtl/dbcsname.c @@ -218,14 +218,47 @@ FsRtlIsDbcsInExpression(IN PANSI_STRING Expression, /* Check DOS_STAR */ else if (Expression->Buffer[ExpressionPosition] == ANSI_DOS_STAR) { - MatchingChars = NamePosition; - while (MatchingChars < Name->Length) + /* We can only consume dot if that's not the last one + * Otherwise, we null match + */ + if (Name->Buffer[NamePosition] == '.') { - if (Name->Buffer[MatchingChars] == '.') + MatchingChars = NamePosition + 1; + while (MatchingChars < Name->Length) { - NamePosition = MatchingChars; + if (Name->Buffer[MatchingChars] == '.') + { + NamePosition++; + break; + } + 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++; } - MatchingChars++; } ExpressionPosition++; } diff --git a/reactos/ntoskrnl/fsrtl/name.c b/reactos/ntoskrnl/fsrtl/name.c index 88fc898656f..d25c0ea0893 100644 --- a/reactos/ntoskrnl/fsrtl/name.c +++ b/reactos/ntoskrnl/fsrtl/name.c @@ -153,14 +153,47 @@ FsRtlIsNameInExpressionPrivate(IN PUNICODE_STRING Expression, /* Check DOS_STAR */ else if (Expression->Buffer[ExpressionPosition] == DOS_STAR) { - MatchingChars = NamePosition; - while (MatchingChars < Name->Length / sizeof(WCHAR)) + /* We can only consume dot if that's not the last one + * Otherwise, we null match + */ + if (Name->Buffer[NamePosition] == L'.') { - if (Name->Buffer[MatchingChars] == L'.') + MatchingChars = NamePosition + 1; + while (MatchingChars < Name->Length / sizeof(WCHAR)) { - NamePosition = MatchingChars; + if (Name->Buffer[MatchingChars] == L'.') + { + NamePosition++; + break; + } + 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++; } - MatchingChars++; } ExpressionPosition++; }