如何确定cdrom驱动器是可写的? [英] How to determine a cdrom drive is writable?
问题描述
您好,伙计们
我使用GetDriveType函数来确定计算机中的CD-ROM驱动器,但我想检测可写的,使用Windows API,我搜索了DeviceIoControl函数,但文档非常全面,我无法得到我的答案。任何人都可以帮助我吗?
提前致谢
mr.abzadeh
编辑:我发现了DEVICE_MEDIA_INFO结构包含一个
DWORD MediaCharacteristics;
成员,它清楚地指定媒体是否可写,我找不到哪个函数返回它。
编辑:我得到了CD-ROM和CD-RW的DEVICE_MEDIA_INFO结构并检查了MediaCharacteristics成员,显示没有区别,因此DEVICE_MEDIA_INFO可能不包含cd-rom驱动器的可写特性。
可能您可以使用 IMAPI
,即 IDiscRecorder :: QueryMediaType [ ^ ]方法。另请参见使用IMAPI进行CD刻录和设备发现 [ ^ ]
我刚刚在我的网站上对此进行了测试系统,它显示安装可写CD / DVD时驱动器的正确特性。请注意GET_MEDIA_TYPES
[ ^ ]结构包含数组 aa363241(v = vs.85).aspx>DEVICE_MEDIA_INFO
[ ^ ]条目,因此您需要迭代列表以获取正确的条目。
Hello, guys
I use GetDriveType function to determine CD-ROM drives in a computer, but I want to detect the writable ones, using windows API, I searched DeviceIoControl function but the documentation was very comprehensive and I was unable to get my answer. Can anyone help me?
Thanks in advance
mr.abzadeh
EDIT: I found that the DEVICE_MEDIA_INFO structure contains a
DWORD MediaCharacteristics;
member that clearly specifies if the media is Writable, by I can not find which function returns it.
EDIT: I got the DEVICE_MEDIA_INFO structure for both CD-ROM and CD-RW and examined the MediaCharacteristics member, showing no difference, so DEVICE_MEDIA_INFO may not contain writable characteristic of a cd-rom drive.
Possibly you may use IMAPI
, namely IDiscRecorder::QueryMediaType[^] method. See also CD Burning and Device Discovery with IMAPI[^]
I just tested this on my system and it shows the correct characteristics for the drive when a Writable CD/DVD is mounted. Note that theGET_MEDIA_TYPES
[^] structure contains an array ofDEVICE_MEDIA_INFO
[^] entries, so you need to iterate the list for the correct entry.
这篇关于如何确定cdrom驱动器是可写的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!