Author: hpoussin
Date: Sun Nov 2 20:18:27 2014
New Revision: 65195
URL:
http://svn.reactos.org/svn/reactos?rev=65195&view=rev
Log:
[NTFS] Optimize directory search initialization
Modified:
trunk/reactos/drivers/filesystems/ntfs/dirctl.c
Modified: trunk/reactos/drivers/filesystems/ntfs/dirctl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/d…
==============================================================================
--- trunk/reactos/drivers/filesystems/ntfs/dirctl.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/ntfs/dirctl.c [iso-8859-1] Sun Nov 2 20:18:27 2014
@@ -305,7 +305,6 @@
PNTFS_FCB Fcb;
PNTFS_CCB Ccb;
BOOLEAN First = FALSE;
- BOOLEAN WildCard;
PIO_STACK_LOCATION Stack;
PFILE_OBJECT FileObject;
NTSTATUS Status = STATUS_SUCCESS;
@@ -338,16 +337,23 @@
if (!Ccb->DirectorySearchPattern)
{
First = TRUE;
- Ccb->DirectorySearchPattern =
- ExAllocatePoolWithTag(NonPagedPool, SearchPattern->Length +
sizeof(WCHAR), TAG_NTFS);
+ Pattern.Length = 0;
+ Pattern.MaximumLength = SearchPattern->Length + sizeof(WCHAR);
+ Ccb->DirectorySearchPattern = Pattern.Buffer =
+ ExAllocatePoolWithTag(NonPagedPool, Pattern.MaximumLength, TAG_NTFS);
if (!Ccb->DirectorySearchPattern)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
- memcpy(Ccb->DirectorySearchPattern,
- SearchPattern->Buffer,
- SearchPattern->Length);
+ Status = RtlUpcaseUnicodeString(&Pattern, SearchPattern, FALSE);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("RtlUpcaseUnicodeString('%wZ') failed with status
0x%08lx\n", &Pattern, Status);
+ ExFreePoolWithTag(Ccb->DirectorySearchPattern, TAG_NTFS);
+ Ccb->DirectorySearchPattern = NULL;
+ return Status;
+ }
Ccb->DirectorySearchPattern[SearchPattern->Length / sizeof(WCHAR)] =
0;
}
}
@@ -365,19 +371,8 @@
}
RtlInitUnicodeString(&Pattern, Ccb->DirectorySearchPattern);
- WildCard = FsRtlDoesNameContainWildCards(&Pattern);
- if (WildCard)
- {
- Status = RtlUpcaseUnicodeString(&Pattern, &Pattern, FALSE);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("RtlUpcaseUnicodeString('%wZ') failed with status
0x%08lx\n", &Pattern, Status);
- return Status;
- }
- }
-
- DPRINT1("Search pattern '%S'\n", Ccb->DirectorySearchPattern);
- DPRINT1("In: '%S'\n", Fcb->PathName);
+ DPRINT("Search pattern '%S'\n", Ccb->DirectorySearchPattern);
+ DPRINT("In: '%S'\n", Fcb->PathName);
/* Determine directory index */
if (Stack->Flags & SL_INDEX_SPECIFIED)