mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 12:23:31 +00:00
Handle matching of "f0_*.*" expression to "f0_000" file name in FsRtlIsNameInExpression and add relevant regression test.
svn path=/trunk/; revision=10783
This commit is contained in:
+33
-16
@@ -1,4 +1,4 @@
|
||||
/* $Id: name.c,v 1.10 2004/08/18 02:32:00 navaraf Exp $
|
||||
/* $Id: name.c,v 1.11 2004/09/04 15:02:00 navaraf Exp $
|
||||
*
|
||||
* reactos/ntoskrnl/fs/name.c
|
||||
*
|
||||
@@ -168,7 +168,9 @@ FsRtlDoesNameContainWildCards (IN PUNICODE_STRING Name)
|
||||
* RETURN VALUE
|
||||
*
|
||||
* NOTE
|
||||
* From Bo Branten's ntifs.h v12.
|
||||
* From Bo Branten's ntifs.h v12. This function should be rewritten
|
||||
* to avoid recursion and better wildcard handling should be
|
||||
* implemented (see FsRtlDoesNameContainWildCards).
|
||||
*
|
||||
* @implemented
|
||||
*/
|
||||
@@ -212,22 +214,37 @@ FsRtlIsNameInExpression (IN PUNICODE_STRING Expression,
|
||||
NamePosition++;
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: Take UpcaseTable into account! */
|
||||
if (Expression->Buffer[ExpressionPosition] == L'?' ||
|
||||
(IgnoreCase &&
|
||||
RtlUpcaseUnicodeChar(Expression->Buffer[ExpressionPosition]) ==
|
||||
RtlUpcaseUnicodeChar(Name->Buffer[NamePosition])) ||
|
||||
(!IgnoreCase &&
|
||||
Expression->Buffer[ExpressionPosition] ==
|
||||
Name->Buffer[NamePosition]))
|
||||
{
|
||||
NamePosition++;
|
||||
ExpressionPosition++;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
/* FIXME: Take UpcaseTable into account! */
|
||||
if (Expression->Buffer[ExpressionPosition] == L'?' ||
|
||||
(IgnoreCase &&
|
||||
RtlUpcaseUnicodeChar(Expression->Buffer[ExpressionPosition]) ==
|
||||
RtlUpcaseUnicodeChar(Name->Buffer[NamePosition])) ||
|
||||
(!IgnoreCase &&
|
||||
Expression->Buffer[ExpressionPosition] ==
|
||||
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++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ddk/ntifs.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "regtests.h"
|
||||
|
||||
static int
|
||||
RunTest(char *Buffer)
|
||||
{
|
||||
UNICODE_STRING Expression, Name;
|
||||
|
||||
RtlInitUnicodeString(&Expression, L"f0_*.*");
|
||||
RtlInitUnicodeString(&Name, L"F0_000");
|
||||
FAIL_IF_FALSE(FsRtlDoesNameContainWildCards(&Expression),
|
||||
"FsRtlDoesNameContainWildCards didn't recognize valid expression");
|
||||
FAIL_IF_FALSE(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL),
|
||||
"FsRtlIsNameInExpression failed to recognize valid match");
|
||||
FAIL_IF_TRUE(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL),
|
||||
"FsRtlIsNameInExpression fails to enforce case sensitivity rules");
|
||||
|
||||
return TS_OK;
|
||||
}
|
||||
|
||||
DISPATCHER(Fs_1Test, "Kernel File System Runtime Library API")
|
||||
Reference in New Issue
Block a user