{
ULONG FirstPosition, i;
ULONG SkipFirstSlash = 0;
+ PAGED_CODE();
/* Zero the strings before continuing */
RtlZeroMemory(FirstPart, sizeof(ANSI_STRING));
FsRtlDoesDbcsContainWildCards(IN PANSI_STRING Name)
{
ULONG i;
+ PAGED_CODE();
/* Check every character */
for (i = 0; i < Name->Length; i++)
*
* @return TRUE if Name is found in Expression, FALSE otherwise
*
- * @remarks None
+ * @remarks
*
*--*/
BOOLEAN
FsRtlIsDbcsInExpression(IN PANSI_STRING Expression,
IN PANSI_STRING Name)
{
- ULONG ExpressionPosition, NamePosition, MatchingChars = 0;
+ USHORT ExpressionPosition = 0, NamePosition = 0, MatchingChars, StarFound = MAXUSHORT;
+ PAGED_CODE();
+ ASSERT(Name->Length);
+ ASSERT(Expression->Length);
ASSERT(!FsRtlDoesDbcsContainWildCards(Name));
- /* One can't be null, both can be */
- if (!Expression->Length || !Name->Length)
- {
- return !(Expression->Length ^ Name->Length);
- }
-
- for (ExpressionPosition = 0; ExpressionPosition < Expression->Length; ExpressionPosition++)
+ while (NamePosition < Name->Length && ExpressionPosition < Expression->Length)
{
- if ((Expression->Buffer[ExpressionPosition] == Name->Buffer[MatchingChars]) ||
- (Expression->Buffer[ExpressionPosition] == '?') ||
- (Expression->Buffer[ExpressionPosition] == ANSI_DOS_QM) ||
- (Expression->Buffer[ExpressionPosition] == ANSI_DOS_DOT &&
- (Name->Buffer[MatchingChars] == '.' || Name->Buffer[MatchingChars] == '0')))
+ if ((Expression->Buffer[ExpressionPosition] == Name->Buffer[NamePosition]))
+ {
+ NamePosition++;
+ ExpressionPosition++;
+ }
+ else if ((Expression->Buffer[ExpressionPosition] == '?') || (Expression->Buffer[ExpressionPosition] == ANSI_DOS_QM) ||
+ (Expression->Buffer[ExpressionPosition] == ANSI_DOS_DOT && Name->Buffer[NamePosition] == '.'))
{
- MatchingChars++;
+ NamePosition++;
+ ExpressionPosition++;
+ StarFound = MAXUSHORT;
}
else if (Expression->Buffer[ExpressionPosition] == '*')
{
- MatchingChars = Name->Length;
+ StarFound = ExpressionPosition++;
+ if (StarFound < (Expression->Length - 1))
+ {
+ while (Name->Buffer[NamePosition] != Expression->Buffer[ExpressionPosition] &&
+ NamePosition < Name->Length)
+ {
+ NamePosition++;
+ }
+ }
+ else
+ {
+ NamePosition = Name->Length;
+ }
}
else if (Expression->Buffer[ExpressionPosition] == ANSI_DOS_STAR)
{
- for (NamePosition = MatchingChars; NamePosition < Name->Length; NamePosition++)
+ StarFound = MAXUSHORT;
+ MatchingChars = NamePosition;
+ while (MatchingChars < Name->Length)
{
- if (Name->Buffer[NamePosition] == '.')
+ if (Name->Buffer[MatchingChars] == '.')
{
- MatchingChars = NamePosition;
- break;
+ NamePosition = MatchingChars;
}
+ MatchingChars++;
}
+ ExpressionPosition++;
}
- else
+ else if (StarFound != MAXUSHORT)
{
- MatchingChars = 0;
+ ExpressionPosition = StarFound + 1;
+ while (Name->Buffer[NamePosition] != Expression->Buffer[ExpressionPosition] &&
+ NamePosition < Name->Length)
+ {
+ NamePosition++;
+ }
}
- if (MatchingChars == Name->Length)
+ else
{
- return TRUE;
+ NamePosition = Name->Length;
}
}
+ if (ExpressionPosition + 1 == Expression->Length && NamePosition == Name->Length &&
+ Expression->Buffer[ExpressionPosition] == ANSI_DOS_DOT)
+ {
+ ExpressionPosition++;
+ }
- return FALSE;
+ return (ExpressionPosition == Expression->Length && NamePosition == Name->Length);
}
/*++
ANSI_STRING FirstPart, RemainingPart, Name;
BOOLEAN LastDot;
ULONG i;
+ PAGED_CODE();
/* Just quit if the string is empty */
if (!DbcsName.Length)
{
ANSI_STRING FirstPart, RemainingPart, Name;
ULONG i;
+ PAGED_CODE();
/* Just quit if the string is empty */
if (!DbcsName.Length)