Author: fireball
Date: Thu Nov 20 14:24:10 2008
New Revision: 37490
URL:
http://svn.reactos.org/svn/reactos?rev=37490&view=rev
Log:
- Upcase a search expression when calling RtlIsNameInExpression with case-insensitive
option (a merge of 37263 from Pierre's branch with changed comments).
Modified:
trunk/reactos/drivers/filesystems/cdfs/dirctl.c
trunk/reactos/drivers/filesystems/cdfs/fcb.c
Modified: trunk/reactos/drivers/filesystems/cdfs/dirctl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/cdfs/d…
==============================================================================
--- trunk/reactos/drivers/filesystems/cdfs/dirctl.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/cdfs/dirctl.c [iso-8859-1] Thu Nov 20 14:24:10 2008
@@ -166,6 +166,7 @@
UNICODE_STRING TempString;
UNICODE_STRING ShortName;
UNICODE_STRING LongName;
+ UNICODE_STRING FileToFindUpcase;
PVOID Block;
NTSTATUS Status;
ULONG len;
@@ -263,6 +264,13 @@
Record = (PDIR_RECORD)((ULONG_PTR)Record + Record->RecordLength);
}
+ /* Upper case the expression for FsRtlIsNameInExpression */
+ Status = RtlUpcaseUnicodeString(&FileToFindUpcase, FileToFind, TRUE);
+ if (!NT_SUCCESS(Status))
+ {
+ return Status;
+ }
+
while(TRUE)
{
DPRINT("RecordLength %u ExtAttrRecordLength %u NameLength %u\n",
@@ -307,8 +315,8 @@
DPRINT("ShortName '%wZ'\n", &ShortName);
- if (FsRtlIsNameInExpression(FileToFind, &LongName, TRUE, NULL) ||
- FsRtlIsNameInExpression(FileToFind, &ShortName, TRUE, NULL))
+ if (FsRtlIsNameInExpression(&FileToFindUpcase, &LongName, TRUE, NULL) ||
+ FsRtlIsNameInExpression(&FileToFindUpcase, &ShortName, TRUE, NULL))
{
if (Parent && Parent->PathName)
{
@@ -347,6 +355,7 @@
DPRINT("FindFile: new Pathname %S, new Objectname %S, DirIndex %d\n",
Fcb->PathName, Fcb->ObjectName, DirIndex);
+ RtlFreeUnicodeString(&FileToFindUpcase);
CcUnpinData(Context);
return STATUS_SUCCESS;
@@ -357,6 +366,7 @@
DirIndex++;
}
+ RtlFreeUnicodeString(&FileToFindUpcase);
CcUnpinData(Context);
if (pDirIndex)
Modified: trunk/reactos/drivers/filesystems/cdfs/fcb.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/cdfs/f…
==============================================================================
--- trunk/reactos/drivers/filesystems/cdfs/fcb.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/cdfs/fcb.c [iso-8859-1] Thu Nov 20 14:24:10 2008
@@ -464,6 +464,7 @@
WCHAR ShortNameBuffer[13];
UNICODE_STRING ShortName;
UNICODE_STRING LongName;
+ UNICODE_STRING FileToFindUpcase;
BOOLEAN HasSpaces;
GENERATE_NAME_CONTEXT NameContext;
@@ -502,6 +503,14 @@
Offset = 0;
BlockOffset = 0;
Record = (PDIR_RECORD)Block;
+
+ /* Upper case the expression for FsRtlIsNameInExpression */
+ Status = RtlUpcaseUnicodeString(&FileToFindUpcase, FileToFind, TRUE);
+ if (!NT_SUCCESS(Status))
+ {
+ return Status;
+ }
+
while(TRUE)
{
if (Record->RecordLength == 0)
@@ -543,8 +552,8 @@
DPRINT("ShortName '%wZ'\n", &ShortName);
- if (FsRtlIsNameInExpression(FileToFind, &LongName, TRUE, NULL) ||
- FsRtlIsNameInExpression(FileToFind, &ShortName, TRUE, NULL))
+ if (FsRtlIsNameInExpression(&FileToFindUpcase, &LongName, TRUE, NULL) ||
+ FsRtlIsNameInExpression(&FileToFindUpcase, &ShortName, TRUE, NULL))
{
DPRINT("Match found, %S\n", Name);
Status = CdfsMakeFCBFromDirEntry(DeviceExt,
@@ -556,6 +565,7 @@
Offset,
FoundFCB);
+ RtlFreeUnicodeString(&FileToFindUpcase);
CcUnpinData(Context);
return(Status);
@@ -578,6 +588,7 @@
&Context, &Block))
{
DPRINT("CcMapData() failed\n");
+ RtlFreeUnicodeString(&FileToFindUpcase);
return(STATUS_UNSUCCESSFUL);
}
Record = (PDIR_RECORD)((ULONG_PTR)Block + BlockOffset);
@@ -587,6 +598,7 @@
break;
}
+ RtlFreeUnicodeString(&FileToFindUpcase);
CcUnpinData(Context);
return(STATUS_OBJECT_NAME_NOT_FOUND);