Author: pschweitzer Date: Fri Sep 4 15:52:19 2015 New Revision: 69001
URL: http://svn.reactos.org/svn/reactos?rev=69001&view=rev Log: [NTFS] Don't bother comparing names if they have null length
Modified: trunk/reactos/drivers/filesystems/ntfs/mft.c
Modified: trunk/reactos/drivers/filesystems/ntfs/mft.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/mf... ============================================================================== --- trunk/reactos/drivers/filesystems/ntfs/mft.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/ntfs/mft.c [iso-8859-1] Fri Sep 4 15:52:19 2015 @@ -87,22 +87,36 @@ ULONG NameLength, PNTFS_ATTR_CONTEXT * AttrCtx) { + BOOLEAN Found; NTSTATUS Status; FIND_ATTR_CONTXT Context; PNTFS_ATTR_RECORD Attribute;
DPRINT("FindAttribute(%p, %p, 0x%x, %S, %u, %p)\n", Vcb, MftRecord, Type, Name, NameLength, AttrCtx);
+ Found = FALSE; Status = FindFirstAttribute(&Context, Vcb, MftRecord, FALSE, &Attribute); while (NT_SUCCESS(Status)) { if (Attribute->Type == Type && Attribute->NameLength == NameLength) { - PWCHAR AttrName; - - AttrName = (PWCHAR)((PCHAR)Attribute + Attribute->NameOffset); - DPRINT("%.*S, %.*S\n", Attribute->NameLength, AttrName, NameLength, Name); - if (RtlCompareMemory(AttrName, Name, NameLength << 1) == (NameLength << 1)) + if (NameLength != 0) + { + PWCHAR AttrName; + + AttrName = (PWCHAR)((PCHAR)Attribute + Attribute->NameOffset); + DPRINT("%.*S, %.*S\n", Attribute->NameLength, AttrName, NameLength, Name); + if (RtlCompareMemory(AttrName, Name, NameLength << 1) == (NameLength << 1)) + { + Found = TRUE; + } + } + else + { + Found = TRUE; + } + + if (Found) { /* Found it, fill up the context and return. */ DPRINT("Found context\n");