DavidXanatos / DiskCryptor

A fork of the DiskCryptor full disk encryption tool
https://www.diskcryptor.org/
459 stars 98 forks source link

Regression? : EFI bootloader can't find correct boot partition when boot method is set to "First partition with appropriate password" #92

Open RadarNyan opened 10 months ago

RadarNyan commented 10 months ago

I had once achieved booting different Windows installations with different passwords using the DiskCryptor EFI bootloader before, but after many trials and errors, I'm still unable to repeat that with build v1.3 beta.

The partition layout is the same as I once used:

1 2 3 4 5 6
DiskCryptor ESP (unencrypted) MSR (unencrypted) Windows 1 ESP (encrypted, password 1) Windows 1 System Partition (encrypted, password 1) Windows 2 ESP (encrypted, password 2) Windows 2 System Partition (encrypted, password 2)

With debug message enabled, when I input password 1, it shows:

Found Encrypted Partition 3 on disk 1
Found Encrypted Partition 4 on disk 1

While inputting password 2 results in partition 5 & 6, those are correct results.

However, the next step of selecting the boot partition doesn't work as expected. No matter which password I input, it always selects partition 58203017-D5CE-4C71-BD0E-BFCECCE3BA5 (which I later confirmed with the DiskCryptor GUI is the GUID of partition 5). As a result, only password 2 is able to boot Windows 2. If I set the partition type of partition 5 to something else, then the bootloader would select partition 3 instead and boot Windows 1.


https://github.com/DavidXanatos/DiskCryptor/blob/a5bc29b31338a0db2a5b2a5a1d5ff9d898b9c9d0/DcsPkg/Library/DiskCryptorLib/DcsDiskCryptor.c#L550-L562

This part of the code seems to exclude partitions that are not mounted, but it doesn't work for me as it always finds the last ESP, despite the fact that only the second ESP (Windows 1 ESP) is mounted when password 1 is inputted.

Also: if I set the boot method to "Specified partition", the bootloader would just crash no matter which partition I select.