Current Windows BCD Store file path.

I need to get the currently Windows using BCD Store file path in user-mode.
I know the current BCD Store registry is loaded under HKEY_LOCAL_MACHINE\BCD00000000 but I couldn’t find any WinAPI to get the file path of a loaded key.
Usually the volume containing the BCD file is not mounted so I also finding an API that results the disk index and partition index of the BCD file.

I’m trying to distinguish BCD files that exist on multiple partitions and to delete partitions not being used.

Did you even TRY to Google this? A Google query for “where is the bcd store located” produces very clear answers in much less time than waiting for this forum.

  • BIOS-based operating systems. The BCD registry file is located in the \Boot\Bcd directory of the active partition.
  • EFI–based operating systems. The BCD registry file is located on the EFI system partition.

Thank you for all answers. I guess I couldn’t explain in detail.
As ThatsBerkan mentioned it, I know the sub directory path containing a BCD file but I cannot determine “which partition” contains the current BCD file.
My test computer has multiple “MBR active partitions” or has multiple “GPT EFI system partitions”.

There is not “path”, you have to mount it by assigning the volume/partition a letter, then you have your “path”.
In this case, if you’re using diskpart, you can use the assign letter=X:. A quicker command would be to open CMD as Administrator and use: mountvol X: /S to mount the system partiton (which is the partition you want).

Note that explorer.exe does not run as Administrator on Windows 10, therefore you wont be able to see the files from there. You have to open a program like notepad as Administrator, click on “Open file”, and look at the newly mounted partition from there.

Programmatically, I’ve never done something like mounting a volume. But you can use an IOCTL to enumerate and retrieve each volume/partition information.

You might as well use the BCD commands to get the volume path of the system partition:

Thank you for reply. Yes I know the system partition is not mounted automatically and it can be mounted with diskpart or mount api function. The problem is that WHICH PARTITION OF WHICH DISK contains the current BCD store file? Let’s assume there are two disks and each disk has an active partition or an efi system partition. So there are totally two system partitions on the system. Now how can I figure out which system partition is currently used by Windows? I’m sorry I couldn’t explain at once.

I saw your last comment right now. Does bootmgr or bootx64.efi always uses the BCD file of same partition?

No. I am sure of that, because I made a config that doesn’t this week, by
accident :slight_smile:

I found it!

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\hivelist]
\REGISTRY\MACHINE\BCD00000000 → \Device\HarddiskVolume2\EFI\Microsoft\Boot\BCD