Author: pschweitzer
Date: Wed Oct 8 19:32:21 2014
New Revision: 64617
URL:
http://svn.reactos.org/svn/reactos?rev=64617&view=rev
Log:
[NTFS]
- Add a directory entry into FCB which will be a copy of the $FILE_NAME attribute of the
FILE record. Though, it won't contain the name itself (in the FCB instead), so keep
first char NULL and length 0.
- Implement its support (which requires opening the FILE record 5 first) for root FCB
creation.
Modified:
trunk/reactos/drivers/filesystems/ntfs/fcb.c
trunk/reactos/drivers/filesystems/ntfs/ntfs.h
Modified: trunk/reactos/drivers/filesystems/ntfs/fcb.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/f…
==============================================================================
--- trunk/reactos/drivers/filesystems/ntfs/fcb.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/ntfs/fcb.c [iso-8859-1] Wed Oct 8 19:32:21 2014
@@ -275,19 +275,43 @@
NtfsMakeRootFCB(PNTFS_VCB Vcb)
{
PNTFS_FCB Fcb;
+ PFILE_RECORD_HEADER MftRecord;
+ PFILENAME_ATTRIBUTE FileName;
+
+ MftRecord = ExAllocatePoolWithTag(NonPagedPool,
+ Vcb->NtfsInfo.BytesPerFileRecord,
+ TAG_NTFS);
+ if (MftRecord == NULL)
+ {
+ return NULL;
+ }
+
+ if (!NT_SUCCESS(ReadFileRecord(Vcb, NTFS_FILE_ROOT, MftRecord)))
+ {
+ return NULL;
+ }
+
+ FileName = GetFileNameFromRecord(MftRecord);
+ if (!FileName)
+ {
+ return NULL;
+ }
Fcb = NtfsCreateFCB(L"\\", Vcb);
-
-// memset(Fcb->entry.Filename, ' ', 11);
-
-// Fcb->Entry.DataLengthL = Vcb->CdInfo.RootSize;
-// Fcb->Entry.ExtentLocationL = Vcb->CdInfo.RootStart;
-// Fcb->Entry.FileFlags = 0x02; // FILE_ATTRIBUTE_DIRECTORY;
+ if (!Fcb)
+ {
+ return NULL;
+ }
+
+ memcpy(&Fcb->Entry, FileName, FIELD_OFFSET(FILENAME_ATTRIBUTE, NameLength));
+ Fcb->Entry.NameType = FileName->NameType;
+ Fcb->Entry.NameLength = 0;
+ Fcb->Entry.Name[0] = UNICODE_NULL;
Fcb->RefCount = 1;
Fcb->DirIndex = 0;
- Fcb->RFCB.FileSize.QuadPart = PAGE_SIZE;//Vcb->CdInfo.RootSize;
- Fcb->RFCB.ValidDataLength.QuadPart = PAGE_SIZE;//Vcb->CdInfo.RootSize;
- Fcb->RFCB.AllocationSize.QuadPart = PAGE_SIZE;//Vcb->CdInfo.RootSize;
+ Fcb->RFCB.FileSize.QuadPart = FileName->DataSize;
+ Fcb->RFCB.ValidDataLength.QuadPart = FileName->DataSize;
+ Fcb->RFCB.AllocationSize.QuadPart = FileName->AllocatedSize;
Fcb->MFTIndex = NTFS_FILE_ROOT;
NtfsFCBInitializeCache(Vcb, Fcb);
@@ -390,6 +414,8 @@
return STATUS_INSUFFICIENT_RESOURCES;
}
+ memcpy(&rcFCB->Entry, FileName, FIELD_OFFSET(FILENAME_ATTRIBUTE,
NameLength));
+ rcFCB->Entry.NameType = FileName->NameType;
rcFCB->RFCB.FileSize.QuadPart = FileName->DataSize;
rcFCB->RFCB.ValidDataLength.QuadPart = FileName->DataSize;
rcFCB->RFCB.AllocationSize.QuadPart = FileName->AllocatedSize;
Modified: trunk/reactos/drivers/filesystems/ntfs/ntfs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/ntfs/n…
==============================================================================
--- trunk/reactos/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] Wed Oct 8 19:32:21 2014
@@ -107,43 +107,6 @@
NTFS_INFO NtfsInfo;
} DEVICE_EXTENSION, *PDEVICE_EXTENSION, NTFS_VCB, *PNTFS_VCB;
-
-
-#define FCB_CACHE_INITIALIZED 0x0001
-#define FCB_IS_VOLUME_STREAM 0x0002
-#define FCB_IS_VOLUME 0x0004
-#define MAX_PATH 260
-
-typedef struct _FCB
-{
- NTFSIDENTIFIER Identifier;
-
- FSRTL_COMMON_FCB_HEADER RFCB;
- SECTION_OBJECT_POINTERS SectionObjectPointers;
-
- PFILE_OBJECT FileObject;
- PNTFS_VCB Vcb;
-
- WCHAR *ObjectName; /* point on filename (250 chars max) in PathName */
- WCHAR PathName[MAX_PATH]; /* path+filename 260 max */
-
- ERESOURCE PagingIoResource;
- ERESOURCE MainResource;
-
- LIST_ENTRY FcbListEntry;
- struct _FCB* ParentFcb;
-
- ULONG DirIndex;
-
- LONG RefCount;
- ULONG Flags;
-
- ULONGLONG MFTIndex;
-
-// DIR_RECORD Entry;
-
-} NTFS_FCB, *PNTFS_FCB;
-
typedef struct
{
@@ -414,6 +377,41 @@
NTFS_ATTR_RECORD Record;
} NTFS_ATTR_CONTEXT, *PNTFS_ATTR_CONTEXT;
+#define FCB_CACHE_INITIALIZED 0x0001
+#define FCB_IS_VOLUME_STREAM 0x0002
+#define FCB_IS_VOLUME 0x0004
+#define MAX_PATH 260
+
+typedef struct _FCB
+{
+ NTFSIDENTIFIER Identifier;
+
+ FSRTL_COMMON_FCB_HEADER RFCB;
+ SECTION_OBJECT_POINTERS SectionObjectPointers;
+
+ PFILE_OBJECT FileObject;
+ PNTFS_VCB Vcb;
+
+ WCHAR *ObjectName; /* point on filename (250 chars max) in PathName */
+ WCHAR PathName[MAX_PATH]; /* path+filename 260 max */
+
+ ERESOURCE PagingIoResource;
+ ERESOURCE MainResource;
+
+ LIST_ENTRY FcbListEntry;
+ struct _FCB* ParentFcb;
+
+ ULONG DirIndex;
+
+ LONG RefCount;
+ ULONG Flags;
+
+ ULONGLONG MFTIndex;
+
+ FILENAME_ATTRIBUTE Entry;
+
+} NTFS_FCB, *PNTFS_FCB;
+
extern PNTFS_GLOBAL_DATA NtfsGlobalData;
//int CdfsStrcmpi( wchar_t *str1, wchar_t *str2 );