如何获取 EFI 系统分区的卷名? [英] How can I get volume name for EFI system partition?

查看:70
本文介绍了如何获取 EFI 系统分区的卷名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台带有 GPT 驱动器的 Windows 机器.
我有一个 EFI 系统分区的 DOS 设备名称作为 bcdedit 的输出.
我想打开这个分区的句柄并通过 QueryDosDevice() 获取 DOS 名称以与我已有的 DOS 名称进行比较.
我尝试使用 FindFirstVolume/FindNextVolume 查找卷名以从 QueryDosDevice 获取 DOS 名称,但我没有找到 EFI 系统分区的卷.WMI 也没有此分区的卷.

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.

如何从 C++ 代码中获取 EFI 系统分区的卷名以在 QueryDosDevice 中使用它?

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

推荐答案

试试这个.下载并安装 WinObj(来自 MS technet).在 \Device 目录中查找 EFI 系统分区的逻辑设备名称.请注意,\Device 目录中的逻辑设备名称的格式为 \Device\Harddisk\Partition,其中 N 是硬盘编号,M 是分区编号.注意 M 等于 0 表示整个硬盘,M > 0 表示单个分区.数字 N 与您将在磁盘管理器 (diskmgmt.msc) 和 diskpart 中看到的数字相同.

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.

获得逻辑设备名称后,请查看 \GLOBAL??该名称的别名的目录.如果您找到别名,那么您就可以开始了.如果找不到别名,则需要使用可以访问 \Device 名称的 Win32 API.我认为至少有一个这样的 API,因为我多年前写了一个程序,将 \Device 名称作为参数.

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.

这篇关于如何获取 EFI 系统分区的卷名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆