Skip to content

Commit 157773c

Browse files
committed
[FREELDR] Make the NTFS filename comparison conforming to the NTLDR/BOOTMGR
1 parent c477928 commit 157773c

File tree

1 file changed

+9
-13
lines changed
  • boot/freeldr/freeldr/lib/fs

1 file changed

+9
-13
lines changed

boot/freeldr/freeldr/lib/fs/ntfs.c

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -525,19 +525,15 @@ static BOOLEAN NtfsCompareFileName(PCHAR FileName, PNTFS_INDEX_ENTRY IndexEntry)
525525
if (strlen(FileName) != EntryFileNameLength)
526526
return FALSE;
527527

528-
/* Do case-sensitive compares for Posix file names. */
529-
if (IndexEntry->FileName.FileNameType == NTFS_FILE_NAME_POSIX)
530-
{
531-
for (i = 0; i < EntryFileNameLength; i++)
532-
if (EntryFileName[i] != FileName[i])
533-
return FALSE;
534-
}
535-
else
536-
{
537-
for (i = 0; i < EntryFileNameLength; i++)
538-
if (tolower(EntryFileName[i]) != tolower(FileName[i]))
539-
return FALSE;
540-
}
528+
/* Always do case-insensitive compares for file names.
529+
* Why is this necessary?
530+
* Because when modifying an Windows ntfs partition formatted with Windows itself
531+
* on Linux the ntldr/bootmgr will boot normally ignoring the case of the path
532+
* so let's do the same.
533+
*/
534+
for (i = 0; i < EntryFileNameLength; i++)
535+
if (tolower(EntryFileName[i]) != tolower(FileName[i]))
536+
return FALSE;
541537

542538
return TRUE;
543539
}

0 commit comments

Comments
 (0)