[fastfat_new]
authorAleksey Bragin <aleksey@reactos.org>
Wed, 7 Oct 2009 12:21:13 +0000 (12:21 +0000)
committerAleksey Bragin <aleksey@reactos.org>
Wed, 7 Oct 2009 12:21:13 +0000 (12:21 +0000)
- Implement FatiQueryNameInformation. It doesn't work right now due to missing file names in the FCB record.
- Make a stub for FatSetFcbNames.

svn path=/trunk/; revision=43324

reactos/drivers/filesystems/fastfat_new/fastfat.h
reactos/drivers/filesystems/fastfat_new/fcb.c
reactos/drivers/filesystems/fastfat_new/finfo.c

index e60b9d6..cd1751c 100644 (file)
@@ -304,6 +304,10 @@ VOID NTAPI
 FatSetFullNameInFcb(PFCB Fcb,
                     PUNICODE_STRING Name);
 
 FatSetFullNameInFcb(PFCB Fcb,
                     PUNICODE_STRING Name);
 
+VOID NTAPI
+FatSetFcbNames(IN PFAT_IRP_CONTEXT IrpContext,
+               IN PFCB Fcb);
+
 /*  ------------------------------------------------------------  rw.c  */
 
 NTSTATUS NTAPI
 /*  ------------------------------------------------------------  rw.c  */
 
 NTSTATUS NTAPI
index eee2097..d2961b7 100644 (file)
@@ -149,6 +149,9 @@ FatCreateFcb(IN PFAT_IRP_CONTEXT IrpContext,
     Fcb->Header.ValidDataLength.LowPart = FileHandle->Filesize;
     Fcb->FatHandle = FileHandle;
 
     Fcb->Header.ValidDataLength.LowPart = FileHandle->Filesize;
     Fcb->FatHandle = FileHandle;
 
+    /* Set names */
+    FatSetFcbNames(IrpContext, Fcb);
+
     return Fcb;
 }
 
     return Fcb;
 }
 
@@ -241,4 +244,13 @@ FatSetFullNameInFcb(PFCB Fcb,
     }
 }
 
     }
 }
 
+VOID
+NTAPI
+FatSetFcbNames(IN PFAT_IRP_CONTEXT IrpContext,
+               IN PFCB Fcb)
+{
+    // Set the short name first
+    UNIMPLEMENTED;
+}
+
 /* EOF */
 /* EOF */
index a8005ea..ead0842 100644 (file)
@@ -61,10 +61,51 @@ NTAPI
 FatiQueryNameInformation(IN PFAT_IRP_CONTEXT IrpContext,
                              IN PFCB Fcb,
                              IN PFILE_OBJECT FileObject,
 FatiQueryNameInformation(IN PFAT_IRP_CONTEXT IrpContext,
                              IN PFCB Fcb,
                              IN PFILE_OBJECT FileObject,
-                             IN OUT PFILE_INTERNAL_INFORMATION Buffer,
+                             IN OUT PFILE_NAME_INFORMATION Buffer,
                              IN OUT PLONG Length)
 {
                              IN OUT PLONG Length)
 {
-    UNIMPLEMENTED;
+    ULONG ByteSize;
+    ULONG Trim = 0;
+    BOOLEAN Overflow = FALSE;
+
+    /* Deduct the minimum written length */
+    *Length -= FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0]);
+
+    // Build full name if needed
+    //if (!Fcb->FullFileName.Buffer)
+
+    DPRINT1("FullFileName %wZ\n", &Fcb->FullFileName);
+
+    if (*Length < Fcb->FullFileName.Length - Trim)
+    {
+        /* Buffer can't fit all data */
+        ByteSize = *Length;
+        Overflow = TRUE;
+    }
+    else
+    {
+        /* Deduct the amount of bytes we are going to write */
+        ByteSize = Fcb->FullFileName.Length - Trim;
+        *Length -= ByteSize;
+    }
+
+    /* Copy the name */
+    RtlCopyMemory(Buffer->FileName,
+                  Fcb->FullFileName.Buffer,
+                  ByteSize);
+
+    /* Set the length */
+    Buffer->FileNameLength = Fcb->FullFileName.Length - Trim;
+
+    /* Is this a shortname query? */
+    if (Trim)
+    {
+        /* Yes, not supported atm */
+        ASSERT(FALSE);
+    }
+
+    /* Indicate overflow by passing -1 as the length */
+    if (Overflow) *Length = -1;
 }
 
 NTSTATUS
 }
 
 NTSTATUS