简体   繁体   中英

How can I get volume name for EFI system partition?

I have a Windows machine with GPT drives.
I have a DOS device name of EFI system partition as output from bcdedit.
I want to open handle for this partition and get DOS name by QueryDosDevice() to compare with DOS name which I already have.
I tried to use FindFirstVolume/FindNextVolume to find volume name to get DOS name from QueryDosDevice, but I didn't find volume for EFI system partition. WMI also doesn't have volume for this partition.

How can I get volume name of EFI system partition from C++ code to use it in QueryDosDevice?

Try this. Download and install WinObj (from MS technet). Look through the \\Device directory for the logical device name of the EFI system partition. Note that logical device names in the \\Device directory are of the form \\Device\\Harddisk<N>\\Partition<M> where N is the harddisk number and M is the partition number. Note M equal to zero means whole harddisk, and M > 0 refers to individual partitions. THe number N is the same number you will see in disk manager (diskmgmt.msc) and in diskpart.

Once you get the logical device name look in the \\GLOBAL?? directory for an alias to that name. If you find an alias, then you're good to go. If you don't find an alias, then you'll need to use a Win32 API that can access \\Device names. I think there is at least one such API, because I wrote a program many years ago that took \\Device names as an argument.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM