How can I get volume name for EFI system partition?

大城市里の小女人 提交于 2019-12-23 23:12:42

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/35102053/how-can-i-get-volume-name-for-efi-system-partition

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!