如何知道磁盘是基本磁盘还是动态磁盘? [英] how to know whether disk is basic or dynamic?

查看:77
本文介绍了如何知道磁盘是基本磁盘还是动态磁盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在windows中是否有可能通过c/c++程序知道我们正在处理的磁盘类型?忘记gpt或mbr,如何知道它是基本的还是动态的?程序输入可以是驱动器号或任何与磁盘相关的信息,输出应该是动态的或基本的.不需要直接的方法,即使是漫长的过程,也没关系.我在 msdn 中找不到太多内容.请帮帮我.

In windows is it possible to know what kind of disk we are dealing with from a c/c++ program? forget about gpt or mbr, how to know whether it is basic or dynamic? Program input can be drive letter or any info related to disk, output should be dynamic or basic. No need of a direct way of doing, even if it is lengthy process, its okay. I couldn't find much in msdn. Please help me out.

推荐答案

windows 中有一个方法,但不是直截了当的.

There is a way in windows, but it's not straight forward.

没有直接的 API 来确定磁盘是基本磁盘还是动态磁盘,但是所有动态磁盘都将具有 LDM 信息.

There is no direct API to determine if a disk is Basic or Dynamic, however all dynamic disks will have LDM Information.

因此,如果一个驱动器的分区上有 LDM 信息,那么它将是一个动态磁盘.

So if a drive has a partion with LDM information on it, then it's going to be a dynamic disk.

带有 IOCTL_DISK_GET_DRIVE_LAYOUT_EX 控制代码的 DeviceIoControl() 方法可用于获取此信息.

the DeviceIoControl() method with the IOCTL_DISK_GET_DRIVE_LAYOUT_EX control code can be used to get this information.

这是一篇包含示例控制台应用程序的帖子你要的.

这篇关于如何知道磁盘是基本磁盘还是动态磁盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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