Can I uniquely identify a DVDR (W) (+/-) environment from .NET?

I would like to identify DVDR media from .NET code. Is it possible and how?

Some library that calls the Windows API.

UPDATE

I have many DVDRs, and I need to identify each one, but it does not depend on the contents or the name of the disc. Some kind of serial number for each DVDR that a DVDR ends up in the factory.

+5
source share
2 answers

You can achieve this using the IMAPI v2 API.

Once you have the correct links in your .NET project, as well as the various enumerations defined in this API (and there are quite a few!), The code is relatively simple. Something like (pseudo-code):

IDiscRecorder2 discRecorder = (IDiscRecorder2)[*cd/dvd drive*];
discFormatData.Recorder = discRecorder;
IMAPI_MEDIA_PHYSICAL_TYPE mediaType = discFormatData.CurrentPhysicalMediaType;
string mediaTypeString = GetMediaTypeString(mediaType);

where:
IMAPI_MEDIA_PHYSICAL_TYPE is an enum such like:

public enum IMAPI_MEDIA_PHYSICAL_TYPE
{
    IMAPI_MEDIA_TYPE_UNKNOWN = 0,
    IMAPI_MEDIA_TYPE_CDROM = 1,
    IMAPI_MEDIA_TYPE_CDR = 2,
    IMAPI_MEDIA_TYPE_CDRW = 3,
    IMAPI_MEDIA_TYPE_DVDROM = 4,
    IMAPI_MEDIA_TYPE_DVDRAM = 5,
    [not the complete enum...snipped for brevity!]
}

and the "GetMediaTypeString" function simply gives a friendly string
representation of the enum name.

- CodeProject, :

CD/DVD/Blu-ray # IMAPI2

, (, !), / .

:

, MsftDiscFormat2Data Recorder. IDiscFormat2Data CurrentPhysicalMediaType.

, , MsftFileSystemImage ChooseImageDefaultsForMediaType .

+2
+1

All Articles