mirror of
https://github.com/reactos/reactos.git
synced 2025-06-23 13:10:17 +00:00
[FREELDR] Make the NTFS filename comparison conforming to NTLDR/BOOTMGR (#8021)
When an NTFS partition is created with Windows and modified with Linux (see below), the NTLDR/BOOTMGR will compare the file names ignoring the case of the files, while FreeLdr does not and the same hack is on Btrfs file name comparison. This PR is necessary because the case of the file names on registry, etc. may not always be consistent! How to reproduce: - Try to install Windows with NTFS and install FreeLdr on it; - Try to modify Windows partition on Linux like creating/copying some new files; - Try to boot with FreeLdr (it will fail if the hive file path case is different than the actual file path); - Try to boot with NTLDR/BOOTMGR (it will work finally reaching the desktop).
This commit is contained in:
parent
2ab01e7302
commit
22d077f9f1
1 changed files with 9 additions and 11 deletions
|
@ -525,18 +525,16 @@ static BOOLEAN NtfsCompareFileName(PCHAR FileName, PNTFS_INDEX_ENTRY IndexEntry)
|
|||
if (strlen(FileName) != EntryFileNameLength)
|
||||
return FALSE;
|
||||
|
||||
/* Do case-sensitive compares for Posix file names. */
|
||||
if (IndexEntry->FileName.FileNameType == NTFS_FILE_NAME_POSIX)
|
||||
/*
|
||||
* Always perform case-insensitive comparison for file names.
|
||||
* This is necessary, because when modifying e.g. on Linux a Windows NTFS
|
||||
* partition formatted with Windows itself, the NTLDR/BOOTMGR will boot
|
||||
* normally ignoring the case of the paths.
|
||||
*/
|
||||
for (i = 0; i < EntryFileNameLength; i++)
|
||||
{
|
||||
for (i = 0; i < EntryFileNameLength; i++)
|
||||
if (EntryFileName[i] != FileName[i])
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < EntryFileNameLength; i++)
|
||||
if (tolower(EntryFileName[i]) != tolower(FileName[i]))
|
||||
return FALSE;
|
||||
if (tolower(EntryFileName[i]) != tolower(FileName[i]))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue