[ros-diffs] [pschweitzer] 37263: Fix pierre-fsd branch (and cdfs.sys): FsRtlIsNameInExpression needs Expression to be uppercase if IgnoreCase is set to TRUE

pschweitzer at svn.reactos.org pschweitzer at svn.reactos.org
Sun Nov 9 16:55:13 CET 2008


Author: pschweitzer
Date: Sun Nov  9 09:55:13 2008
New Revision: 37263

URL: http://svn.reactos.org/svn/reactos?rev=37263&view=rev
Log:
Fix pierre-fsd branch (and cdfs.sys): FsRtlIsNameInExpression needs Expression to be uppercase if IgnoreCase is set to TRUE

Modified:
    branches/pierre-fsd/drivers/filesystems/cdfs/dirctl.c
    branches/pierre-fsd/drivers/filesystems/cdfs/fcb.c

Modified: branches/pierre-fsd/drivers/filesystems/cdfs/dirctl.c
URL: http://svn.reactos.org/svn/reactos/branches/pierre-fsd/drivers/filesystems/cdfs/dirctl.c?rev=37263&r1=37262&r2=37263&view=diff
==============================================================================
--- branches/pierre-fsd/drivers/filesystems/cdfs/dirctl.c [iso-8859-1] (original)
+++ branches/pierre-fsd/drivers/filesystems/cdfs/dirctl.c [iso-8859-1] Sun Nov  9 09:55:13 2008
@@ -166,6 +166,7 @@
   UNICODE_STRING TempString;
   UNICODE_STRING ShortName;
   UNICODE_STRING LongName;
+  UNICODE_STRING FileToFindUpcase;
   PVOID Block;
   NTSTATUS Status;
   ULONG len;
@@ -264,6 +265,14 @@
       Record = (PDIR_RECORD)((ULONG_PTR)Record + Record->RecordLength);
     }
 
+  /* FsRtlIsNameInExpression need the searched string to be upcase,
+	* even if IgnoreCase is specified */
+	Status = RtlUpcaseUnicodeString(&FileToFindUpcase, FileToFind, TRUE);
+	if (!NT_SUCCESS(Status))
+	{
+		return Status;
+	}
+
   while(TRUE)
     {
       DPRINT("RecordLength %u  ExtAttrRecordLength %u  NameLength %u\n",
@@ -309,8 +318,8 @@
 
       _SEH_TRY
       {
-        Found = FsRtlIsNameInExpression(FileToFind, &LongName, TRUE, NULL) ||
-                FsRtlIsNameInExpression(FileToFind, &ShortName, TRUE, NULL);
+        Found = FsRtlIsNameInExpression(&FileToFindUpcase, &LongName, TRUE, NULL) ||
+                FsRtlIsNameInExpression(&FileToFindUpcase, &ShortName, TRUE, NULL);
       }
       _SEH_HANDLE
       {
@@ -319,6 +328,7 @@
       _SEH_END;
       if (!NT_SUCCESS(Status))
       {
+        RtlFreeUnicodeString(&FileToFindUpcase);
         CcUnpinData(Context);
         return Status;
       }
@@ -361,6 +371,7 @@
 	  DPRINT("FindFile: new Pathname %S, new Objectname %S, DirIndex %d\n",
 		 Fcb->PathName, Fcb->ObjectName, DirIndex);
 
+    RtlFreeUnicodeString(&FileToFindUpcase);
 	  CcUnpinData(Context);
 
 	  return STATUS_SUCCESS;
@@ -371,6 +382,7 @@
       DirIndex++;
     }
 
+  RtlFreeUnicodeString(&FileToFindUpcase);
   CcUnpinData(Context);
 
   if (pDirIndex)

Modified: branches/pierre-fsd/drivers/filesystems/cdfs/fcb.c
URL: http://svn.reactos.org/svn/reactos/branches/pierre-fsd/drivers/filesystems/cdfs/fcb.c?rev=37263&r1=37262&r2=37263&view=diff
==============================================================================
--- branches/pierre-fsd/drivers/filesystems/cdfs/fcb.c [iso-8859-1] (original)
+++ branches/pierre-fsd/drivers/filesystems/cdfs/fcb.c [iso-8859-1] Sun Nov  9 09:55:13 2008
@@ -463,6 +463,7 @@
   WCHAR ShortNameBuffer[13];
   UNICODE_STRING ShortName;
   UNICODE_STRING LongName;
+  UNICODE_STRING FileToFindUpcase;
   GENERATE_NAME_CONTEXT NameContext;
 
 
@@ -500,6 +501,15 @@
   Offset = 0;
   BlockOffset = 0;
   Record = (PDIR_RECORD)Block;
+
+  /* FsRtlIsNameInExpression need the searched string to be upcase,
+	* even if IgnoreCase is specified */
+	Status = RtlUpcaseUnicodeString(&FileToFindUpcase, FileToFind, TRUE);
+	if (!NT_SUCCESS(Status))
+	{
+		return Status;
+	}
+
   while(TRUE)
     {
       if (Record->RecordLength == 0)
@@ -542,8 +552,8 @@
 
       _SEH_TRY
         {
-          Found = FsRtlIsNameInExpression(FileToFind, &LongName, TRUE, NULL) ||
-                  FsRtlIsNameInExpression(FileToFind, &ShortName, TRUE, NULL);
+          Found = FsRtlIsNameInExpression(&FileToFindUpcase, &LongName, TRUE, NULL) ||
+                  FsRtlIsNameInExpression(&FileToFindUpcase, &ShortName, TRUE, NULL);
         }
       _SEH_HANDLE
         {
@@ -552,6 +562,7 @@
       _SEH_END;
       if (!NT_SUCCESS(Status))
         {
+          RtlFreeUnicodeString(&FileToFindUpcase);
           CcUnpinData(Context);
           return Status;
         }
@@ -567,6 +578,7 @@
                                            Offset,
                                            FoundFCB);
 
+          RtlFreeUnicodeString(&FileToFindUpcase);
           CcUnpinData(Context);
 
           return(Status);
@@ -589,6 +601,7 @@
                          &Context, &Block))
             {
               DPRINT("CcMapData() failed\n");
+              RtlFreeUnicodeString(&FileToFindUpcase);
               return(STATUS_UNSUCCESSFUL);
             }
           Record = (PDIR_RECORD)((ULONG_PTR)Block + BlockOffset);
@@ -598,6 +611,7 @@
         break;
     }
 
+  RtlFreeUnicodeString(&FileToFindUpcase);
   CcUnpinData(Context);
 
   return Status;



More information about the Ros-diffs mailing list