How to get total disc sectors in medium?
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
精彩评论