Author: pschweitzer
Date: Thu Sep 25 10:57:29 2008
New Revision: 36512
URL:
http://svn.reactos.org/svn/reactos?rev=36512&view=rev
Log:
Get back recursive FsRtlIsNameInExpresion and leave non recursive one commented out.
This fixes pierre-fsd branch
Modified:
branches/pierre-fsd/ntoskrnl/fsrtl/name.c
Modified: branches/pierre-fsd/ntoskrnl/fsrtl/name.c
URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/ntoskrnl/fsrtl/name.…
==============================================================================
--- branches/pierre-fsd/ntoskrnl/fsrtl/name.c [iso-8859-1] (original)
+++ branches/pierre-fsd/ntoskrnl/fsrtl/name.c [iso-8859-1] Thu Sep 25 10:57:29 2008
@@ -268,7 +268,8 @@
* rewritten to avoid recursion and better wildcard handling
* should be implemented (see FsRtlDoesNameContainWildCards).
*
- *--*/
+ *--*/
+#if 0
BOOLEAN
NTAPI
FsRtlIsNameInExpression(IN PUNICODE_STRING Expression,
@@ -316,4 +317,95 @@
return FALSE;
}
-
+#endif
+BOOLEAN
+NTAPI
+FsRtlIsNameInExpression(IN PUNICODE_STRING Expression,
+ IN PUNICODE_STRING Name,
+ IN BOOLEAN IgnoreCase,
+ IN PWCHAR UpcaseTable OPTIONAL)
+{
+ USHORT ExpressionPosition, NamePosition;
+ UNICODE_STRING TempExpression, TempName;
+
+ ExpressionPosition = 0;
+ NamePosition = 0;
+ while (ExpressionPosition < (Expression->Length / sizeof(WCHAR)) &&
+ NamePosition < (Name->Length / sizeof(WCHAR)))
+ {
+ if (Expression->Buffer[ExpressionPosition] == L'*')
+ {
+ ExpressionPosition++;
+ if (ExpressionPosition == (Expression->Length / sizeof(WCHAR)))
+ {
+ return TRUE;
+ }
+ while (NamePosition < (Name->Length / sizeof(WCHAR)))
+ {
+ TempExpression.Length =
+ TempExpression.MaximumLength =
+ Expression->Length - (ExpressionPosition * sizeof(WCHAR));
+ TempExpression.Buffer = Expression->Buffer + ExpressionPosition;
+ TempName.Length =
+ TempName.MaximumLength =
+ Name->Length - (NamePosition * sizeof(WCHAR));
+ TempName.Buffer = Name->Buffer + NamePosition;
+ /* FIXME: Rewrite to get rid of recursion */
+ if (FsRtlIsNameInExpression(&TempExpression, &TempName,
+ IgnoreCase, UpcaseTable))
+ {
+ return TRUE;
+ }
+ NamePosition++;
+ }
+ }
+ else
+ {
+ if (Expression->Buffer[ExpressionPosition] == L'?' || (
+ IgnoreCase && !UpcaseTable &&
+ RtlUpcaseUnicodeChar(Expression->Buffer[ExpressionPosition]) ==
+ RtlUpcaseUnicodeChar(Name->Buffer[NamePosition])) ||
+ (!IgnoreCase && Expression->Buffer[ExpressionPosition] ==
+ Name->Buffer[NamePosition]))
+ {
+ NamePosition++;
+
+ ExpressionPosition++;
+ }
+ else if (IgnoreCase && UpcaseTable)
+ {
+ if (UpcaseTable[Expression->Buffer[ExpressionPosition]] ==
+ UpcaseTable[Name->Buffer[NamePosition]])
+ {
+ NamePosition++;
+ ExpressionPosition++;
+ }
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+ }
+
+ /* Handle matching of "f0_*.*" expression to "f0_000" file name.
*/
+ if (ExpressionPosition < (Expression->Length / sizeof(WCHAR)) &&
+ Expression->Buffer[ExpressionPosition] == L'.')
+ {
+ while (ExpressionPosition < (Expression->Length / sizeof(WCHAR))
&&
+ (Expression->Buffer[ExpressionPosition] == L'.' ||
+ Expression->Buffer[ExpressionPosition] == L'*' ||
+ Expression->Buffer[ExpressionPosition] == L'?'))
+ {
+ ExpressionPosition++;
+ }
+ }
+
+ if (ExpressionPosition == (Expression->Length / sizeof(WCHAR)) &&
+ NamePosition == (Name->Length / sizeof(WCHAR)))
+ {
+ return TRUE;
+ }
+
+ return FALSE;
+}