Mert Sevinc
Mert Sevinc

Reputation: 1027

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 that does not seem to have a method.

Upvotes: 1

Views: 740

Answers (1)

Jim Mischel
Jim Mischel

Reputation: 133995

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

Upvotes: 2

Related Questions