Author: tkreuzer
Date: Thu Aug 5 12:23:23 2010
New Revision: 48461
URL:
http://svn.reactos.org/svn/reactos?rev=48461&view=rev
Log:
[NTOSKRNL]
- Fixed FsRtlIsNameInExpression to make it properly handle * in expressions
- Fix formatting
- Patch by Pierre Schweitzer
- Fixes everything
See issue #5541 for more details.
Modified:
trunk/reactos/ntoskrnl/fsrtl/name.c
Modified: trunk/reactos/ntoskrnl/fsrtl/name.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fsrtl/name.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/fsrtl/name.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/fsrtl/name.c [iso-8859-1] Thu Aug 5 12:23:23 2010
@@ -28,59 +28,58 @@
while (i < Name->Length / sizeof(WCHAR) && k < Expression->Length
/ sizeof(WCHAR))
{
- if ((Expression->Buffer[k] == (IgnoreCase ? UpcaseTable[Name->Buffer[i]] :
Name->Buffer[i])) ||
- (Expression->Buffer[k] == L'?') || (Expression->Buffer[k] == DOS_QM) ||
- (Expression->Buffer[k] == DOS_DOT && (Name->Buffer[i] == L'.' ||
Name->Buffer[i] == L'0')))
- {
- i++;
- k++;
- }
- else if (Expression->Buffer[k] == L'*')
- {
- if (k < Expression->Length / sizeof(WCHAR))
- {
- if (Expression->Buffer[k+1] != L'*' && Expression->Buffer[k+1]
!= L'?' &&
+ if ((Expression->Buffer[k] == (IgnoreCase ? UpcaseTable[Name->Buffer[i]] :
Name->Buffer[i])) ||
+ (Expression->Buffer[k] == L'?') || (Expression->Buffer[k] ==
DOS_QM) ||
+ (Expression->Buffer[k] == DOS_DOT && (Name->Buffer[i] ==
L'.' || Name->Buffer[i] == L'0')))
+ {
+ i++;
+ k++;
+ }
+ else if (Expression->Buffer[k] == L'*')
+ {
+ if (k < (Expression->Length / sizeof(WCHAR) - 1))
+ {
+ if (Expression->Buffer[k+1] != L'*' &&
Expression->Buffer[k+1] != L'?' &&
Expression->Buffer[k+1] != DOS_DOT && Expression->Buffer[k+1]
!= DOS_QM &&
- Expression->Buffer[k+1] != DOS_STAR)
- {
- while ((IgnoreCase ? UpcaseTable[Name->Buffer[i]] : Name->Buffer[i]) !=
Expression->Buffer[k+1] &&
- i <= Name->Length / sizeof(WCHAR)) i++;
- }
- else
- {
- if (!(Expression->Buffer[k+1] != DOS_DOT && (Name->Buffer[i] ==
L'.' || Name->Buffer[i] == L'0')))
- {
- i++;
- }
- }
- }
- else
- {
- i = Name->Length / sizeof(WCHAR);
- }
- k++;
- }
- else if (Expression->Buffer[k] == DOS_STAR)
- {
- j = i;
- while (j <= Name->Length / sizeof(WCHAR))
- {
- if (Name->Buffer[j] == L'.')
- {
- i = j;
- }
- j++;
- }
- k++;
- }
- else
- {
- i++;
- k = 0;
- }
- }
-
- return (k == Expression->Length / sizeof(WCHAR));
+ Expression->Buffer[k+1] != DOS_STAR)
+ {
+ while ((IgnoreCase ? UpcaseTable[Name->Buffer[i]] : Name->Buffer[i]) !=
Expression->Buffer[k+1] &&
+ i < Name->Length / sizeof(WCHAR)) i++;
+ }
+ else
+ {
+ if (!(Expression->Buffer[k+1] != DOS_DOT && (Name->Buffer[i] ==
L'.' || Name->Buffer[i] == L'0')))
+ {
+ i++;
+ }
+ }
+ }
+ else
+ {
+ i = Name->Length / sizeof(WCHAR);
+ }
+ k++;
+ }
+ else if (Expression->Buffer[k] == DOS_STAR)
+ {
+ j = i;
+ while (j < Name->Length / sizeof(WCHAR))
+ {
+ if (Name->Buffer[j] == L'.')
+ {
+ i = j;
+ }
+ j++;
+ }
+ k++;
+ }
+ else
+ {
+ i = Name->Length / sizeof(WCHAR);
+ }
+ }
+
+ return (k == Expression->Length / sizeof(WCHAR) && i == Name->Length /
sizeof(WCHAR));
}
/* PUBLIC FUNCTIONS **********************************************************/