Author: pschweitzer Date: Wed Aug 20 05:06:06 2008 New Revision: 35474
URL: http://svn.reactos.org/svn/reactos?rev=35474&view=rev Log: First implementation of FsRtlIsDbcsInExpression. It will probably need more work. Now, all the Dbcs functions are implemented.
Modified: branches/pierre-fsd/ntoskrnl/fsrtl/dbcsname.c
Modified: branches/pierre-fsd/ntoskrnl/fsrtl/dbcsname.c URL: http://svn.reactos.org/svn/reactos/branches/pierre-fsd/ntoskrnl/fsrtl/dbcsna... ============================================================================== --- branches/pierre-fsd/ntoskrnl/fsrtl/dbcsname.c [iso-8859-1] (original) +++ branches/pierre-fsd/ntoskrnl/fsrtl/dbcsname.c [iso-8859-1] Wed Aug 20 05:06:06 2008 @@ -138,17 +138,17 @@
/*++ * @name FsRtlIsDbcsInExpression - * @unimplemented - * - * FILLME + * @implemented + * + * Check if the Name string is in the Expression string. * * @param Expression - * FILLME + * The string in which we've to find Name. It can contains wildcards * * @param Name - * FILLME - * - * @return None + * The string to find. It cannot contain wildcards. + * + * @return TRUE if Name is found in Expression, FALSE otherwise * * @remarks None * @@ -158,7 +158,50 @@ FsRtlIsDbcsInExpression(IN PANSI_STRING Expression, IN PANSI_STRING Name) { - KEBUGCHECK(0); + ULONG ExpressionPosition, NamePosition, MatchingChars = 0; + + 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 / sizeof(CHAR); ExpressionPosition++) + { + 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'))) + { + MatchingChars++; + } + else if (Expression->Buffer[ExpressionPosition] == '*') + { + MatchingChars = Name->Length / sizeof(CHAR); + } + else if (Expression->Buffer[ExpressionPosition] == ANSI_DOS_STAR) + { + for (NamePosition = MatchingChars; NamePosition < Name->Length / sizeof(CHAR); NamePosition++) + { + if (Name->Buffer[NamePosition] == '.') + { + MatchingChars = NamePosition; + } + } + } + else + { + MatchingChars = 0; + } + if (MatchingChars == Name->Length / sizeof(CHAR)) + { + return TRUE; + } + } + return FALSE; }