开发者

How to get total disc sectors in medium?

开发者 https://www.devze.com 2023-02-09 06:32 出处:网络
I would like to get the number of total sectors on a medium inserted in CD-ROM drive. Is there method for this in C#? I\'ve checked the Management class in .NET but tha开发者_开发百科t does not seem t

I would like to get the number of total sectors on a medium inserted in CD-ROM drive. Is there method for this in C#? I've checked the Management class in .NET but tha开发者_开发百科t does not seem to have a method.


The Windows API function DeviceIoControl will get that information for you. Unfortunately, there's no simple wrapper for it in the .NET libraries.

This sample shows how to do what you want in C. Translating that to C# is non-trivial, but you might find some helpful pointers here: Calling DeviceIoControl from C# with IOCTL_DVD_* Control Codes

0

精彩评论

暂无评论...
验证码 换一张
取 消