diff --git a/boot/freeldr/freeldr/include/fs/ntfs.h b/boot/freeldr/freeldr/include/fs/ntfs.h index b1915e79619..9aad54904d7 100644 --- a/boot/freeldr/freeldr/include/fs/ntfs.h +++ b/boot/freeldr/freeldr/include/fs/ntfs.h @@ -65,6 +65,8 @@ #define NTFS_FILE_NAME_DOS 2 #define NTFS_FILE_NAME_WIN32_AND_DOS 3 +#define NTFS_MFT_MASK 0x0000FFFFFFFFFFFFULL + #include typedef struct { @@ -115,6 +117,8 @@ typedef struct ULONG BytesAllocated; ULONGLONG BaseMFTRecord; USHORT NextAttributeInstance; + USHORT Padding; // Align to 4 UCHAR boundary (NTFS 3.1+ (Windows XP and above)) + ULONG MFTRecordNumber; // Number of this MFT Record (NTFS 3.1+ (Windows XP and above)) } NTFS_MFT_RECORD, *PNTFS_MFT_RECORD; typedef struct @@ -185,7 +189,7 @@ typedef struct USHORT Reserved; UCHAR FileNameLength; UCHAR FileNameType; - WCHAR FileName[0]; + WCHAR FileName[1]; } NTFS_FILE_NAME_ATTR, *PNTFS_FILE_NAME_ATTR; typedef struct @@ -197,7 +201,7 @@ typedef struct ULONGLONG StartingVCN; ULONGLONG BaseFileRef; USHORT AttrId; - PWCHAR Name; + WCHAR Name[1]; } NTFS_ATTR_LIST_ATTR, *PNTFS_ATTR_LIST_ATTR; typedef struct diff --git a/boot/freeldr/freeldr/lib/fs/ntfs.c b/boot/freeldr/freeldr/lib/fs/ntfs.c index 233a2e5ac23..c7e41c23ef8 100644 --- a/boot/freeldr/freeldr/lib/fs/ntfs.c +++ b/boot/freeldr/freeldr/lib/fs/ntfs.c @@ -505,7 +505,7 @@ VOID NtfsPrintFile(PNTFS_INDEX_ENTRY IndexEntry) AnsiFileName[i] = (CHAR)FileName[i]; AnsiFileName[i] = 0; - TRACE("- %s (%x)\n", AnsiFileName, IndexEntry->Data.Directory.IndexedFile); + TRACE("- %s (%x)\n", AnsiFileName, (IndexEntry->Data.Directory.IndexedFile & NTFS_MFT_MASK)); } #endif @@ -596,7 +596,7 @@ static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONGLONG MFTIndex, P { if (NtfsCompareFileName(FileName, IndexEntry)) { - *OutMFTIndex = IndexEntry->Data.Directory.IndexedFile; + *OutMFTIndex = (IndexEntry->Data.Directory.IndexedFile & NTFS_MFT_MASK); FrLdrTempFree(IndexRecord, TAG_NTFS_INDEX_REC); FrLdrTempFree(MftRecord, TAG_NTFS_MFT); return TRUE; @@ -680,7 +680,7 @@ static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONGLONG MFTIndex, P if (NtfsCompareFileName(FileName, IndexEntry)) { TRACE("File found\n"); - *OutMFTIndex = IndexEntry->Data.Directory.IndexedFile; + *OutMFTIndex = (IndexEntry->Data.Directory.IndexedFile & NTFS_MFT_MASK); FrLdrTempFree(BitmapData, TAG_NTFS_BITMAP); FrLdrTempFree(IndexRecord, TAG_NTFS_INDEX_REC); FrLdrTempFree(MftRecord, TAG_NTFS_MFT);