using System; using System.Threading; using System.Collections; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using System.Runtime.InteropServices.ComTypes; using System.Runtime.InteropServices.CustomMarshalers; using System.Text.RegularExpressions; namespace Storage.Interop.IMAPIv2 { #region Interfaces /// Use this interface to enumerate the CD and DVD devices installed on the computer. [ ComImport, Guid("27354130-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual) ] public interface IDiscMaster2 : IEnumerable { /// Retrieves a list of type5 devices installed on the computer. /// list of the type5 devices installed [DispId(-4)] [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(EnumeratorToEnumVariantMarshaler))] new IEnumerator GetEnumerator(); /// Retrieves the unique identifier of the specified disc device. /// Zero based index /// Recorder's unique id [DispId(0)] String this[int index] { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Retrieves the number of the CD and DVD disc devices installed on the computer. [DispId(1)] int Count { get; } /// Retrieves a value that determines if the environment contains one or more optical devices /// and the execution context has permission to access the devices. [DispId(2)] bool IsSupportedEnvironment { [return: MarshalAs(UnmanagedType.VariantBool)] get; } } /// This interface represents a physical device. /// You use this interface to retrieve information about a CD and DVD device installed on the computer and to /// perform operations such as closing the tray or eject the media. /// To write data to media, you need to attach a recorder to a format writer, for example, to attach the /// recorder to a data writer, call the method. /// Several properties of this interface return packet data defined by Multimedia Command (MMC). /// For information on the format of the packet data, see the latest revision of the MMC specification at /// ftp://ftp.t10.org/t10/drafts/mmc5/. [ ComImport, Guid("27354133-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual) ] public interface IDiscRecorder2 { /// Ejects the media (if any) and opens the tray [DispId(256)] void EjectMedia(); /// Close the media tray and load any media in the tray. /// Some drives, such as those with slot-loading mechanisms, do not support this method. /// To determine if the device supports this method, call /// property. [DispId(257)] void CloseTray(); /// Acquires exclusive access to device. May be called multiple times. /// You should not have to call this method to acquire the lock yourself because the write /// operations, such as , acquires the lock for you. /// Each recorder has a lock count. /// The first call to a recorder locks the device for exclusive access. Applications can use the /// AcquireExclusiveAccess method multiple times to apply multiple locks on a device. Each call increments /// the lock count by one.When unlocking a recorder, the lock count must reach zero to free the /// device for other clients. Calling the method /// decrements the lock count by one. /// An equal number of calls to the AcquireExclusiveAccess and /// methods are needed to /// free a device. Should the application exit unexpectedly or crash while holding the exclusive access, the /// CDROM.SYS driver will automatically release these exclusive locks.If the device is already /// locked, you can call to retrieve the name of the client /// application that currently has exclusive access. /// Set to true to gain exclusive access to the volume whether the file system volume /// can or cannot be dismounted. /// If false, this method gains exclusive access only when there is no file system mounted on the volume. /// String that contains the friendly name of the client application requesting /// exclusive access. Cannot be NULL or a zero-length string. The string must conform to the restrictions /// for the IOCTL_CDROM_EXCLUSIVE_ACCESS control code found in the DDK. [DispId(258)] void AcquireExclusiveAccess([MarshalAs(UnmanagedType.VariantBool)] bool force, [MarshalAs(UnmanagedType.BStr)] String clientName); /// Releases exclusive access to device. Call once per /// . /// Each recorder has a lock count. The first call to a recorder locks the device for exclusive access. /// Applications can use the method multiple times to /// apply multiple locks on a device. /// Each call increments the lock count by one. When unlocking a recorder, the lock count /// must reach zero to free the device for other clients. Calling the ReleaseExclusiveAccess method decrements /// the lock count by one. An equal number of calls to the /// and ReleaseExclusiveAccess methods are needed to free a device. /// When the lock count reaches zero, recording device is free; the last lock has been removed. [DispId(259)] void ReleaseExclusiveAccess(); /// Disables Media Change Notification (MCN) for the device. /// MCN is the CD-ROM device driver's method of detecting media change and state changes in the /// CD-ROM device. For example, when you change the media in a CD-ROM device, a MCN message is sent to /// trigger media features, such as Autoplay. To disable the features, call this method. To enable /// notifications, call the method. If the application crashes or closes /// unexpectedly, then MCN is automatically re-enabled by the driver. Note that DisableMcn increments a /// reference count each time it is called. The EnableMcn method decrements the count. The device is enabled /// when the reference count is zero. [DispId(260)] void DisableMcn(); /// Enables Media Change Notification (MCN) for the device. /// MCN is the CD-ROM device driver's method of detecting media change and state changes in the /// CD-ROM device. For example, when you change the media in a CD-ROM device, a MCN message is sent to /// trigger media features, such as Autoplay. MCN is enabled by default. Call this method to enable /// notifications when the notifications have been disabled using . /// Note that increments a reference count each time it is called. /// The EnableMcn method decrements the count. The device is enabled when the reference count is zero. [DispId(261)] void EnableMcn(); /// Associates the object with the specified disc device. /// You must initialize the recorder before calling any of the methods of this interface. /// To retrieve a list of devices on the computer and their unique identifiers, call the /// method. This method will not fail on a drive that is exclusively /// locked. However, if the drive is exclusively locked, several of the methods of this interface may return /// E_IMAPI_RECORDER_LOCKED. To determine who has exclusive access, call the /// method. /// String that contains the unique identifier for the device. [DispId(262)] void InitializeDiscRecorder([MarshalAs(UnmanagedType.BStr)] String recorderUniqueId); /// Retrieves the unique identifier used to initialize the disc device. [DispId(0)] String ActiveDiscRecorder { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Retrieves the vendor ID for the device. [DispId(513)] String VendorId { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Retrieves the product ID of the device. [DispId(514)] String ProductId { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Retrieves the product revision code of the device. [DispId(515)] String ProductRevision { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Retrieves the unique volume name associated with the device. /// To retrieve the drive letter assignment, call the /// method. [DispId(516)] String VolumeName { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Retrieves a list of drive letters and NTFS mount points for the device. [DispId(517)] String[] VolumePathNames { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType=VarEnum.VT_VARIANT)] get; } /// Determines if the device can eject and subsequently reload media. /// Drives that use a tray design can reload media by closing the tray after ejecting the media. /// In contrast, caddy-based or cartridge-based drives cannot reload ejected media. [DispId(518)] bool DeviceCanLoadMedia { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the legacy device number for a CD or DVD device. [DispId(519)] int LegacyDeviceNumber { get; } /// Retrieves the list of features that the device supports. [DispId(520)] Enum[] SupportedFeaturePages { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] get; } /// Retrieves the list of feature pages of the device that are marked as current. [DispId(521)] Enum[] CurrentFeaturePages { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] get; } /// Retrieves the list of MMC profiles that the device supports. [DispId(522)] Enum[] SupportedProfiles { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] get; } /// Retrieves all MMC profiles of the device that are marked as current. [DispId(523)] Enum[] CurrentProfiles { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] get; } /// Retrieves the list of MMC mode pages that the device supports. [DispId(524)] Enum[] SupportedModePages { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] get; } /// Retrieves the name of the client application that has exclusive access to the device. /// This property returns the current exclusive access owner of the device. /// This value comes directly from CDROM.SYS and should be queried anytime an operation fails with error /// E_IMAPI_RECORDER_LOCKED. [DispId(525)] String ExclusiveAccessOwner { [return: MarshalAs(UnmanagedType.BStr)] get; } } /// This interface represents a physical device. You use this interface to retrieve information about a /// CD and DVD device installed on the computer and to perform operations such as closing the tray or ejecting /// the media. This interface retrieves information not available through interface, /// and provides easier access to some of the same property values in . /// To get an instance of this interface, create an instance of the interface and /// then cast it to IDiscRecorder2Ex interface. /// To write data to media, you need to attach this recorder to the data /// writer, using the method. [ ComImport, Guid("27354132-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown) ] public interface IDiscRecorder2Ex { /// Sends a MMC command to the recording device. Use this function when no data buffer /// is sent to nor received from the device. /// For details of the contents of the command packet and sense data, see the latest revision of the /// MMC specification at ftp://ftp.t10.org/t10/drafts/mmc5/. /// Client-defined commands (CDBs) used with this method must be between 6 and 16 bytes in length. /// In addition, the size of each command must match the size defined by the operation code as defined in the /// following table. /// /// /// CDB group /// CDB operation code range /// Required CDB size /// /// /// 0 /// 0x00 — 0x1F /// 6 bytes /// /// /// 1 /// 0x20 — 0x3F /// 10 bytes /// /// /// 2 /// 0x40 — 0x5F /// 10 bytes /// /// /// 3 /// 0x60 — 0x7F /// TBD - will enforce standard-specified size requirements for this opcode range in the future. /// /// /// 4 /// 0x80 — 0x9F /// 16 bytes /// /// /// 5 /// 0xA0 — 0xBF /// 12 bytes /// /// /// 6 /// 0xC0 — 0xDF /// Vendor Unique - Any size allowed /// /// /// 7 /// 0xE0 — 0xFF /// Vendor Unique - Any size allowed /// /// /// Some very early devices used vendor-unique opcodes and therefore some opcodes cannot be validated /// in this manner. The following opcodes are still valid and only verify that the size is between 6 and 16 /// bytes:0x02, 0x05, 0x06, 0x09, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x13, 0x14, 0x19, 0x20, 0x21, 0x22, /// 0x23, 0x24, 0x26, 0x27, 0x29, 0x2C, 0x2D /// Command packet to send to the device. /// Size, in bytes, of the command packet to send. Must be between /// 6 and 16 bytes. /// Sense data returned by the recording device. /// Time limit, in seconds, allowed for the send command to receive /// a result. void SendCommandNoData([MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 1)] Byte[] cdb, uint cdbSize, [MarshalAs(UnmanagedType.LPArray, SizeConst = 18)] Byte[] senseBuffer, uint timeout); /// Sends a MMC command and its associated data buffer to the recording device. /// Command packet to send to the device. /// Size, in bytes, of the command packet to send. Must be between /// 6 and 16 bytes. /// Sense data returned by the recording device. /// Time limit, in seconds, allowed for the send command to receive /// a result. /// Buffer containing data associated with the send command. /// Must not be NULL. /// Size, in bytes, of the data buffer to send. Must not be zero. void SendCommandSendDataToDevice([MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 1)] Byte[] cdb, uint cdbSize, [MarshalAs(UnmanagedType.LPArray, SizeConst = 18)] Byte[] senseBuffer, uint timeout, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 5)] Byte[] buffer, uint bufferSize); /// Sends a MMC command to the recording device requesting data from the device. /// Command packet to send to the device. /// Size, in bytes, of the command packet to send. Must be between /// 6 and 16 bytes. /// Sense data returned by the recording device. /// Time limit, in seconds, allowed for the send command to receive /// a result. /// Application-allocated data buffer that will receive data associated /// with the send command. Must not be NULL. /// Size, in bytes, of the Buffer data buffer. Must not be zero. /// Size, in bytes, of the data returned in the Buffer data buffer. void SendCommandGetDataFromDevice([MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 1)] Byte[] cdb, uint cdbSize, [MarshalAs(UnmanagedType.LPArray, SizeConst = 18)] Byte[] senseBuffer, uint timeout, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 5)] Byte[] buffer, uint bufferSize, ref uint bufferFetched); /// Read a DVD Structure from the media /// Format field of the command packet. /// Acceptable values range from zero to 0xFF. /// Address field of the command packet. /// Layer field of the command packet. /// Authentication grant ID (AGID) field of the command packet. /// Data buffer that contains the DVD structure. /// For details of the contents of the data buffer, see the READ DISC STRUCTURE command in the /// latest revision of the MMC specification at ftp://ftp.t10.org/t10/drafts/mmc5/. /// This method removes headers from the buffer. /// When done, free the memory. /// void ReadDvdStructure(uint format, uint address, uint layer, uint agid, out IntPtr dvdStructurePtr, ref uint count); /// Read a DVD Structure from the media /// Format field of the command packet. /// Acceptable values range from zero to 0xFF. /// Data buffer that contains the DVD structure to send to the media. /// Do not include a header; this method generates and prepends a header to the DVD structure. /// Size, in bytes, of the data buffer. void SendDvdStructure(uint format, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 2)] Byte[] dvdStructure, uint count); /// Retrieves the adapter descriptor for the device (via IOCTL_STORAGE_QUERY_PROPERTY). /// Data buffer that contains the descriptor of the storage adapter. /// For details of the contents of the data buffer, see the STORAGE_ADAPTER_DESCRIPTOR structure in the DDK. /// When done, free the memory. /// Size, in bytes, of the data buffer. void GetAdapterDescriptor(out IntPtr adapterDescriptorPtr, ref uint byteSize); /// Retrieves the device descriptor for the device (via IOCTL_STORAGE_QUERY_PROPERTY). /// Data buffer that contains the descriptor of the storage device. /// For details of the contents of the data buffer, see the STORAGE_DEVICE_DESCRIPTOR structure in the DDK. /// When done, call the CoTaskMemFree function to free the memory. /// Size, in bytes, of the data buffer. void GetDeviceDescriptor(out IntPtr deviceDescriptorPtr, ref uint byteSize); /// Retrieves the disc information from the media (via READ_DISC_INFORMATION). /// Data buffer that contains disc information from the media. /// For details of the contents of the data buffer, see the READ DISC INFORMATION command in the latest /// revision of the MMC specification at ftp://ftp.t10.org/t10/drafts/mmc5/. /// When done, free the memory. /// Size, in bytes, of the data buffer. void GetDiscInformation(out IntPtr discInformationPtr, ref uint byteSize); /// Retrieves the track information from the media (via READ_TRACK_INFORMATION). /// Address field. The addressType parameter provides additional context for /// this parameter. /// Type of address specified in the address parameter, for example, /// if this is an LBA address or a track number. For possible values, see the ReadTrackAddressType /// enumeration type. /// Data buffer that contains the track information. /// For details of the contents of the data buffer, see the READ TRACK INFORMATION command in the /// latest revision of the MMC specification at ftp://ftp.t10.org/t10/drafts/mmc5/. /// When done, free the memory. /// Size, in bytes, of the trackInformation data buffer. void GetTrackInformation(uint address, ReadTrackAddressType addressType, out IntPtr trackInformationPtr, ref uint byteSize); /// Retrieves the specified feature page from the device (via GET_CONFIGURATION). /// Feature page to retrieve. For possible values, see the /// FeaturePageType enumeration type. /// Set to True to retrieve the feature page only when it is the current /// feature page. Otherwise, False to retrieve the feature page regardless of it being the current feature /// page. /// Data buffer that contains the feature page. For details of the contents of the /// data buffer, see the GET CONFIGURATION command in the latest revision of the MMC specification at /// ftp://ftp.t10.org/t10/drafts/mmc5/. /// This method removes header information and other non-feature data before filling and sending this buffer. /// When done, free the memory. /// Size, in bytes, of the featureData data buffer. void GetFeaturePage(FeaturePageType requestedFeature, [MarshalAs(UnmanagedType.U1)] bool currentFeatureOnly, out IntPtr featureDataPtr, ref uint byteSize); /// Retrieves the specified mode page from the device (via MODE_SENSE10) /// Mode page to retrieve. /// For possible values, see the ModePageType enumeration type. /// Type of mode page data to retrieve, for example, the current settings or /// the settings that are write enabled. For possible values, see the ModePageRequestType /// enumeration type. /// Data buffer that contains the mode page. /// For details of the contents of the data buffer, see the MODE SENSE (10) command in the latest revision /// of the MMC specification at ftp://ftp.t10.org/t10/drafts/mmc5/. /// This method removes header information and other non-page data before returning the buffer. /// When done, free the memory. /// Size, in bytes, of the modePageData data buffer. void GetModePage(ModePageType requestedModePage, ModePageRequestType requestType, out IntPtr modePageDataPtr, ref uint byteSize); /// Sets the mode page data for the device (via MODE_SELECT10). /// Type of mode page data to send. /// For possible values, see the ModePageRequestType enumeration type. /// Data buffer that contains the mode page data to send to the media. /// Do not include a header; this method generates and prepends a header to the mode page data. /// For details on specifying the fields of the mode page data, see the MODE SELECT (10) command in the /// latest revision of the MMC specification at ftp://ftp.t10.org/t10/drafts/mmc5/. /// Size, in bytes, of the data buffer. void SetModePage(ModePageRequestType requestType, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 2)] Byte[] modePage, uint byteSize); /// Retrieves the list of supported feature pages or the current feature pages of the device. /// Set to True to retrieve only current feature pages. /// Otherwise, False to retrieve all feature pages that the device supports. /// Data buffer that contains one or more feature page types. /// For possible values, see the FeaturePageType enumeration type. /// To get the feature page data associated with the feature page type, call the /// IDiscRecorder2Ex.GetFeaturePage method. /// When done, free the memory. /// Number of supported feature pages in the featureData data buffer. void GetSupportedFeaturePages([MarshalAs(UnmanagedType.U1)] bool currentFeatureOnly, out IntPtr featureDataPtr, ref uint byteSize); /// Retrieves the supported profiles or the current profiles of the device. /// Set to True to retrieve the current profiles. /// Otherwise, False to return all supported profiles of the device. /// Data buffer that contains one or more profile types. /// For possible values, see the ProfileType enumeration type. /// When done, free the memory. /// Number of supported profiles in the profileTypes data buffer. void GetSupportedProfiles([MarshalAs(UnmanagedType.U1)] bool currentOnly, out IntPtr profileTypesPtr, ref uint validProfiles); /// Retrieves the supported mode pages for the device. /// Type of mode page data to retrieve, for example, /// the current settings or the settings that are write enabled. /// For possible values, see the ModePageRequestType enumeration type. /// Data buffer that contains one or more mode page types. /// For possible values, see the ModePageType enumeration type. /// To get the mode page data associated with the mode page type, call the IDiscRecorder2Ex.GetModePage /// method. /// When done, call the CoTaskMemFree function to free the memory. /// Number of mode pages in the data buffer. void GetSupportedModePages(ModePageRequestType requestType, out IntPtr modePageTypesPtr, ref uint validPages); /// Retrieves the byte alignment mask for the device. /// Byte alignment mask that you use to determine if the buffer is aligned to the correct byte /// boundary for the device. The byte alignment value is always a number that is a power of 2. uint GetByteAlignmentMask(); /// Retrieves the maximum non-page-aligned transfer size for the device. /// Maximum size, in bytes, of a non-page-aligned buffer. uint GetMaximumNonPageAlignedTransferSize(); /// Retrieves the maximum page-aligned transfer size for the device. /// Maximum size, in bytes, of a page-aligned buffer. uint GetMaximumPageAlignedTransferSize(); } /// /// /// [ ComImport, Guid("27354152-8F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual), ] public interface IDiskFormat2 { /// /// Determines if the recorder object supports the given format /// /// /// [DispId(2048)] [return: MarshalAs(UnmanagedType.VariantBool)] bool IsRecorderSupported(IDiscRecorder2 Recorder); /// /// Determines if the current media in a supported recorder object /// supports the given format /// /// /// [DispId(2049)] [return: MarshalAs(UnmanagedType.VariantBool)] bool IsCurrentMediaSupported(IDiscRecorder2 Recorder); /// /// Determines if the current media is reported as physically blank /// by the drive /// [DispId(1792)] bool MediaPhysicallyBlank { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// /// Attempts to determine if the media is blank using heuristics /// (mainly for DVD+RW and DVD-RAM media) /// [DispId(1793)] bool MediaHeuristicallyBlank { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// /// Supported media types /// [DispId(1794)] MediaPhysicalType[] SupportedMediaTypes { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] get; } } /// /// /// [ ComImport, Guid("27354153-9F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual) ] public interface IDiscFormat2Data : IDiskFormat2 { // IDiscFormat2 /// /// Determines if the recorder object supports the given format /// /// /// [DispId(2048)] [return: MarshalAs(UnmanagedType.VariantBool)] new bool IsRecorderSupported(IDiscRecorder2 Recorder); /// /// Determines if the current media in a supported recorder object /// supports the given format /// /// /// [DispId(2049)] [return: MarshalAs(UnmanagedType.VariantBool)] new bool IsCurrentMediaSupported(IDiscRecorder2 Recorder); /// /// Determines if the current media is reported as physically blank /// by the drive /// [DispId(1792)] new bool MediaPhysicallyBlank { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// /// Attempts to determine if the media is blank using heuristics /// (mainly for DVD+RW and DVD-RAM media) /// [DispId(1793)] new bool MediaHeuristicallyBlank { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// /// Supported media types /// [DispId(1794)] new MediaPhysicalType[] SupportedMediaTypes { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] get; } // IDiscFormat2Data /// /// The disc recorder to use /// [DispId(256)] IDiscRecorder2 Recorder { set; [return: MarshalAs(UnmanagedType.Interface)] get; } /// /// Buffer Underrun Free recording should be disabled /// [DispId(257)] bool BufferUnderrunFreeDisabled { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// /// Postgap is included in image /// [DispId(260)] bool PostgapAlreadyInImage { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// /// The state (usability) of the current media /// [DispId(262)] Format2DataMediaState CurrentMediaStatus { get; } /// /// The write protection state of the current media. /// [DispId(263)] MediaWriteProtectState WriteProtectStatus { get; } /// /// Total sectors available on the media (used + free). /// [DispId(264)] int TotalSectorsOnMedia { get; } /// /// Free sectors available on the media. /// [DispId(265)] int FreeSectorsOnMedia { get; } /// /// Next writable address on the media (also used sectors). /// [DispId(266)] int NextWritableAddress { get; } /// /// The first sector in the previous session on the media. /// [DispId(267)] int StartAddressOfPreviousSession { get; } /// /// The last sector in the previous session on the media. /// [DispId(268)] int LastWrittenAddressOfPreviousSession { get; } /// /// Prevent further additions to the file system /// [DispId(269)] bool ForceMediaToBeClosed { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// /// Default is to maximize compatibility with DVD-ROM. /// May be disabled to reduce time to finish writing the disc or /// increase usable space on the media for later writing. /// [DispId(270)] bool DisableConsumerDvdCompatibilityMode { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// /// Get the current physical media type. /// [DispId(271)] MediaPhysicalType CurrentPhysicalMediaType { get; } /// /// The friendly name of the client /// (used to determine recorder reservation conflicts). /// [DispId(272)] String ClientName { set; [return: MarshalAs(UnmanagedType.BStr)] get; } /// /// The last requested write speed. /// [DispId(273)] int RequestedWriteSpeed { get; } /// /// The last requested rotation type. /// [DispId(274)] bool RequestedRotationTypeIsPureCAV { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// /// The drive's current write speed. /// [DispId(275)] int CurrentWriteSpeed { get; } /// /// The drive's current rotation type. /// [DispId(276)] bool CurrentRotationTypeIsPureCAV { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// /// Gets an array of the write speeds supported for the /// attached disc recorder and current media /// [DispId(277)] uint[] SupportedWriteSpeeds { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] get; } /// /// Gets an array of the detailed write configurations /// supported for the attached disc recorder and current media /// [DispId(278)] IWriteSpeedDescriptor[] SupportedWriteSpeedDescriptors { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] get; } /// /// Forces the Datawriter to overwrite the disc on overwritable media types /// [DispId(279)] bool ForceOverwrite { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// /// Returns the array of available multi-session interfaces. /// The array shall not be empty /// [DispId(280)] IMultisessionSequential[] MultisessionInterfaces { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] get; } /// /// Writes all the data provided in the IStream to the device /// /// [DispId(512)] void Write([In, MarshalAs(UnmanagedType.Interface)] IStream data); /// /// Cancels the current write operation /// [DispId(513)] void CancelWrite(); /// /// Sets the write speed (in sectors per second) of the attached disc recorder /// /// /// [DispId(514)] void SetWriteSpeed(int RequestedSectorsPerSecond, [In, MarshalAs(UnmanagedType.VariantBool)] bool RotationTypeIsPureCAV); } [ ComImport, Guid("27354156-8F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual) ] public interface IDiscFormat2Erase : IDiskFormat2 { // IDiscFormat2 /// /// Determines if the recorder object supports the given format /// /// /// [DispId(2048)] [return: MarshalAs(UnmanagedType.VariantBool)] new bool IsRecorderSupported(IDiscRecorder2 Recorder); /// /// Determines if the current media in a supported recorder object /// supports the given format /// /// /// [DispId(2049)] [return: MarshalAs(UnmanagedType.VariantBool)] new bool IsCurrentMediaSupported(IDiscRecorder2 Recorder); /// /// Determines if the current media is reported as physically blank /// by the drive /// [DispId(1792)] new bool MediaPhysicallyBlank { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// /// Attempts to determine if the media is blank using heuristics /// (mainly for DVD+RW and DVD-RAM media) /// [DispId(1793)] new bool MediaHeuristicallyBlank { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// /// Supported media types /// [DispId(1794)] new MediaPhysicalType[] SupportedMediaTypes { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] get; } // IDiscFormat2Erase [DispId(0x100)] IDiscRecorder2 Recorder { set; [return: MarshalAs(UnmanagedType.Interface)] get; } [DispId(0x101)] bool FullErase { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } [DispId(0x102)] MediaPhysicalType CurrentPhysicalMediaType { get; } [DispId(0x103)] String ClientName { set; [return: MarshalAs(UnmanagedType.BStr)] get; } [DispId(0x201)] void EraseMedia(); } [ ComImport, Guid("27354144-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual) ] public interface IWriteSpeedDescriptor { [DispId(0x101)] MediaPhysicalType MediaType { get; } [DispId(0x102)] bool RotationTypeIsPureCAV { [return: MarshalAs(UnmanagedType.VariantBool)] get; } [DispId(0x103)] int WriteSpeed { get; } } [ ComImport, Guid("27354150-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual) ] public interface IMultisession { [DispId(0x100)] bool IsSupportedOnCurrentMediaState { [return: MarshalAs(UnmanagedType.VariantBool)] get; } [DispId(0x101)] bool InUse { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } [DispId(0x102)] IDiscRecorder2 ImportRecorder { [return: MarshalAs(UnmanagedType.Interface)] get; } } [ ComImport, Guid("27354151-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual) ] public interface IMultisessionSequential : IMultisession { [DispId(0x200)] bool IsFirstDataSession { [return: MarshalAs(UnmanagedType.VariantBool)] get; } [DispId(0x201)] int StartAddressOfPreviousSession { get; } [DispId(0x202)] int LastWrittenAddressOfPreviousSession { get; } [DispId(0x203)] int NextWritableAddress { get; } [DispId(0x204)] int FreeSectorsOnMedia { get; } } [ ComImport, Guid("27354154-8F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual) ] public interface IDiscFormat2TrackAtOnce : IDiskFormat2 { // IDiscFormat2 /// /// Determines if the recorder object supports the given format /// /// /// [DispId(2048)] [return: MarshalAs(UnmanagedType.VariantBool)] new bool IsRecorderSupported(IDiscRecorder2 Recorder); /// /// Determines if the current media in a supported recorder object /// supports the given format /// /// /// [DispId(2049)] [return: MarshalAs(UnmanagedType.VariantBool)] new bool IsCurrentMediaSupported(IDiscRecorder2 Recorder); /// /// Determines if the current media is reported as physically blank /// by the drive /// [DispId(1792)] new bool MediaPhysicallyBlank { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// /// Attempts to determine if the media is blank using heuristics /// (mainly for DVD+RW and DVD-RAM media) /// [DispId(1793)] new bool MediaHeuristicallyBlank { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// /// Supported media types /// [DispId(1794)] new MediaPhysicalType[] SupportedMediaTypes { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] get; } // IDiscFormat2TrackAtOnce [DispId(0x200)] void PrepareMedia(); [DispId(0x201)] void AddAudioTrack(IStream data); [DispId(0x202)] void CancelAddTrack(); [DispId(0x203)] void ReleaseMedia(); [DispId(0x204)] void SetWriteSpeed(int requestedSectorsPerSecond, [MarshalAs(UnmanagedType.VariantBool)] bool rotationTypeIsPureCAV); [DispId(0x100)] IDiscRecorder2 Recorder { set; [return: MarshalAs(UnmanagedType.Interface)] get; } [DispId(0x102)] bool BufferUnderrunFreeDisabled { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } [DispId(0x103)] int NumberOfExistingTracks { get; } [DispId(0x104)] int TotalSectorsOnMedia { get; } [DispId(0x105)] int FreeSectorsOnMedia { get; } [DispId(0x106)] int UsedSectorsOnMedia { get; } [DispId(0x107)] bool DoNotFinalizeMedia { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } [DispId(0x10A)] Array ExpectedTableOfContents { [return: MarshalAs(UnmanagedType.SafeArray)] get; } [DispId(0x10B)] MediaPhysicalType CurrentPhysicalMediaType { get; } [DispId(0x10E)] String ClientName { set; [return: MarshalAs(UnmanagedType.BStr)] get; } [DispId(0x10F)] int RequestedWriteSpeed { get; } [DispId(0x110)] bool RequestedRotationTypeIsPureCAV { [return: MarshalAs(UnmanagedType.VariantBool)] get; } [DispId(0x111)] int CurrentWriteSpeed { get; } [DispId(0x112)] bool CurrentRotationTypeIsPureCAV { [return: MarshalAs(UnmanagedType.VariantBool)] get; } [DispId(0x113)] uint[] SupportedWriteSpeeds { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] get; } [DispId(0x114)] IWriteSpeedDescriptor[] SupportedWriteSpeedDescriptors { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] get; } } [ ComImport, Guid("27354155-8F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual) ] public interface IDiscFormat2RawCD : IDiskFormat2 { // IDiscFormat2 /// /// Determines if the recorder object supports the given format /// /// /// [DispId(2048)] [return: MarshalAs(UnmanagedType.VariantBool)] new bool IsRecorderSupported(IDiscRecorder2 Recorder); /// /// Determines if the current media in a supported recorder object /// supports the given format /// /// /// [DispId(2049)] [return: MarshalAs(UnmanagedType.VariantBool)] new bool IsCurrentMediaSupported(IDiscRecorder2 Recorder); /// /// Determines if the current media is reported as physically blank /// by the drive /// [DispId(1792)] new bool MediaPhysicallyBlank { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// /// Attempts to determine if the media is blank using heuristics /// (mainly for DVD+RW and DVD-RAM media) /// [DispId(1793)] new bool MediaHeuristicallyBlank { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// /// Supported media types /// [DispId(1794)] new MediaPhysicalType[] SupportedMediaTypes { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] get; } // IDiscFormat2RawCD [DispId(0x200)] void PrepareMedia(); [DispId(0x201)] void WriteMedia(IStream data); [DispId(0x202)] void WriteMedia2(IStream data, int streamLeadInSectors); [DispId(0x203)] void CancelWrite(); [DispId(0x204)] void ReleaseMedia(); [DispId(0x205)] void SetWriteSpeed(int requestedSectorsPerSecond, [MarshalAs(UnmanagedType.VariantBool)] bool rotationTypeIsPureCAV); [DispId(0x100)] IDiscRecorder2 Recorder { set; [return: MarshalAs(UnmanagedType.Interface)] get; } [DispId(0x102)] bool BufferUnderrunFreeDisabled { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } [DispId(0x103)] int StartOfNextSession { get; } [DispId(0x104)] int LastPossibleStartOfLeadout { get; } [DispId(0x105)] MediaPhysicalType CurrentPhysicalMediaType { get; } [DispId(0x108)] String[] SupportedSectorTypes { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] get; } [DispId(0x109)] Format2RawCDDataSectorType RequestedSectorType { set; get; } [DispId(0x10A)] String ClientName { set; [return: MarshalAs(UnmanagedType.BStr)] get; } [DispId(0x10B)] int RequestedWriteSpeed { get; } [DispId(0x10C)] bool RequestedRotationTypeIsPureCAV { [return: MarshalAs(UnmanagedType.VariantBool)] get; } [DispId(0x10D)] int CurrentWriteSpeed { get; } [DispId(0x10E)] bool CurrentRotationTypeIsPureCAV { [return: MarshalAs(UnmanagedType.VariantBool)] get; } [DispId(0x10F)] uint[] SupportedWriteSpeeds { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] get; } [DispId(0x110)] IWriteSpeedDescriptor[] SupportedWriteSpeedDescriptors { [return: MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] get; } } /// /// /// [ ComImport, Guid("27354136-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual) ] public interface IWriteEngine2EventArgs { /// /// The starting logical block address for the current write operation. /// [DispId(0x100)] int StartLba { get; } /// /// The number of sectors being written for the current write operation. /// [DispId(0x101)] int SectorCount { get; } /// /// The last logical block address of data read for the current write operation. /// [DispId(0x102)] int LastReadLba { get; } /// /// The last logical block address of data written for the current write operation /// [DispId(0x103)] int LastWrittenLba { get; } /// /// The total bytes available in the system's cache buffer /// [DispId(0x106)] int TotalSystemBuffer { get; } /// /// The used bytes in the system's cache buffer /// [DispId(0x107)] int UsedSystemBuffer { get; } /// /// The free bytes in the system's cache buffer /// [DispId(0x108)] int FreeSystemBuffer { get; } } /// /// /// [ ComImport, Guid("2735413D-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual) ] public interface IDiscFormat2DataEventArgs : IWriteEngine2EventArgs { // IWriteEngine2EventArgs /// /// The starting logical block address for the current write operation. /// [DispId(256)] new int StartLba { get; } /// /// The number of sectors being written for the current write operation. /// [DispId(257)] new int SectorCount { get; } /// /// The last logical block address of data read for the current write operation. /// [DispId(258)] new int LastReadLba { get; } /// /// The last logical block address of data written for the current write operation /// [DispId(259)] new int LastWrittenLba { get; } /// /// The total bytes available in the system's cache buffer /// [DispId(262)] new int TotalSystemBuffer { get; } /// /// The used bytes in the system's cache buffer /// [DispId(263)] new int UsedSystemBuffer { get; } /// /// The free bytes in the system's cache buffer /// [DispId(264)] new int FreeSystemBuffer { get; } // IDiscFormat2DataEventArgs /// /// The total elapsed time for the current write operation. /// [DispId(768)] int ElapsedTime { get; } /// /// The estimated time remaining for the write operation. /// [DispId(769)] int RemainingTime { get; } /// /// The estimated total time for the write operation. /// [DispId(770)] int TotalTime { get; } /// /// The current write action. /// [DispId(771)] Format2DataWriteAction CurrentAction { get; } } /// /// /// [ ComImport, Guid("2735413C-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual) ] public interface DDiscFormat2DataEvents { [DispId(0x200)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void Update([In, MarshalAs(UnmanagedType.IDispatch)] IDiscFormat2Data sender, [In, MarshalAs(UnmanagedType.IDispatch)] IDiscFormat2DataEventArgs progress); } [ ComImport, Guid("27354131-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual) ] public interface DDiscMaster2Events { [DispId(0x100)] [ MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime) ] void NotifyDeviceAdded([In, MarshalAs(UnmanagedType.IDispatch)] IDiscMaster2 sender, [In, MarshalAs(UnmanagedType.BStr)] String uniqueId); [DispId(0x101)] [ MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime) ] void NotifyDeviceRemoved([In, MarshalAs(UnmanagedType.IDispatch)] IDiscMaster2 sender, [In, MarshalAs(UnmanagedType.BStr)] String uniqueId); } [ ComImport, Guid("2735413A-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual) ] public interface DDiscFormat2EraseEvents { [DispId(0x200)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void Update([In, MarshalAs(UnmanagedType.IDispatch)] IDiscFormat2Erase sender, int elapsedSeconds, int estimatedTotalSeconds); } [ ComImport, Guid("27354140-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual) ] public interface IDiscFormat2TrackAtOnceEventArgs : IWriteEngine2EventArgs { // IWriteEngine2EventArgs /// /// The starting logical block address for the current write operation. /// [DispId(256)] new int StartLba { get; } /// /// The number of sectors being written for the current write operation. /// [DispId(257)] new int SectorCount { get; } /// /// The last logical block address of data read for the current write operation. /// [DispId(258)] new int LastReadLba { get; } /// /// The last logical block address of data written for the current write operation /// [DispId(259)] new int LastWrittenLba { get; } /// /// The total bytes available in the system's cache buffer /// [DispId(262)] new int TotalSystemBuffer { get; } /// /// The used bytes in the system's cache buffer /// [DispId(263)] new int UsedSystemBuffer { get; } /// /// The free bytes in the system's cache buffer /// [DispId(264)] new int FreeSystemBuffer { get; } // IDiscFormat2TrackAtOnceEventArgs [DispId(0x300)] int CurrentTrackNumber { get; } [DispId(0x301)] Format2TAOWriteAction CurrentAction { get; } [DispId(0x302)] int ElapsedTime { get; } [DispId(0x303)] int RemainingTime { get; } } [ ComImport, Guid("2735413F-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual) ] public interface DDiscFormat2TrackAtOnceEvents { [DispId(0x200)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void Update([In, MarshalAs(UnmanagedType.IDispatch)] IDiscFormat2TrackAtOnce sender, [In, MarshalAs(UnmanagedType.IDispatch)] IDiscFormat2TrackAtOnceEventArgs progress); } [ ComImport, Guid("27354143-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual) ] public interface IDiscFormat2RawCDEventArgs : IWriteEngine2EventArgs { // IWriteEngine2EventArgs /// /// The starting logical block address for the current write operation. /// [DispId(256)] new int StartLba { get; } /// /// The number of sectors being written for the current write operation. /// [DispId(257)] new int SectorCount { get; } /// /// The last logical block address of data read for the current write operation. /// [DispId(258)] new int LastReadLba { get; } /// /// The last logical block address of data written for the current write operation /// [DispId(259)] new int LastWrittenLba { get; } /// /// The total bytes available in the system's cache buffer /// [DispId(262)] new int TotalSystemBuffer { get; } /// /// The used bytes in the system's cache buffer /// [DispId(263)] new int UsedSystemBuffer { get; } /// /// The free bytes in the system's cache buffer /// [DispId(264)] new int FreeSystemBuffer { get; } // IDiscFormat2RawCDEventArgs [DispId(0x301)] Format2RawCDWriteAction CurrentAction { get; } [DispId(0x302)] int ElapsedTime { get; } [DispId(0x303)] int RemainingTime { get; } } [ ComImport, Guid("27354142-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual) ] public interface DDiscFormat2RawCDEvents { [DispId(0x200)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void Update([In, MarshalAs(UnmanagedType.IDispatch)] IDiscFormat2RawCD sender, [In, MarshalAs(UnmanagedType.IDispatch)] IDiscFormat2RawCDEventArgs progress); } [ ComImport, Guid("27354137-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual) // Provides notification of the progress of the WriteEngine2 writing. ] public interface DWriteEngine2Events { [DispId(0x100)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void Update([In, MarshalAs(UnmanagedType.IDispatch)] IWriteEngine2 sender, [In, MarshalAs(UnmanagedType.IDispatch)] IWriteEngine2EventArgs progress); } [ ComImport, Guid("D2FFD834-958B-426d-8470-2A13879C6A91"), InterfaceType(ComInterfaceType.InterfaceIsDual) ] public interface IBurnVerification { [DispId(0x400)] BurnVerificationLevel BurnVerificationLevel { [return: MarshalAs(UnmanagedType.Interface)] get; set;} } [ ComImport, Guid("27354135-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual) ] public interface IWriteEngine2 { [DispId(0x200)] void WriteSection([In, MarshalAs(UnmanagedType.Interface)] IStream data, int startingBlockAddress, int numberOfBlocks); [DispId(0x201)] void CancelWrite(); [DispId(0x100)] IDiscRecorder2Ex Recorder { [return: MarshalAs(UnmanagedType.Interface)] get; set; } [DispId(0x101)] bool UseStreamingWrite12 { [return: MarshalAs(UnmanagedType.VariantBool)] get; set; } [DispId(0x102)] int StartingSectorsPerSecond { get; set; } [DispId(0x103)] int EndingSectorsPerSecond { get; set; } [DispId(0x104)] int BytesPerSector { get; set;} [DispId(0x105)] bool WriteInProgress { [return: MarshalAs(UnmanagedType.VariantBool)] get;} } #endregion Interfaces #region Events [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void IMAPIEventHandlerDelegate(TSender sender, TArgs args) where TSender : class; [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void IMAPIEventHandlerDelegate(TSender sender, TArg1 arg1, TArg2 arg2) where TSender : class; #region DiscMaster2 [ ComVisible(false), ComEventInterface(typeof(DDiscMaster2Events), typeof(DiscMaster2Events_EventProvider)) ] public interface IDiscMaster2_Events { event IMAPIEventHandlerDelegate NotifyDeviceAdded; event IMAPIEventHandlerDelegate NotifyDeviceRemoved; } [ TypeLibType(TypeLibTypeFlags.FHidden), ClassInterface(ClassInterfaceType.None) ] public sealed class DiscMaster2Events_SinkHelper : DDiscMaster2Events { public void NotifyDeviceAdded([In, MarshalAs(UnmanagedType.IDispatch)] IDiscMaster2 sender, [In, MarshalAs(UnmanagedType.BStr)] String uniqueId) { // Invoke the corresponding delegate(s) if (NotifyDeviceAddedDelegate != null) { NotifyDeviceAddedDelegate(sender, uniqueId); } } public void NotifyDeviceRemoved([In, MarshalAs(UnmanagedType.IDispatch)] IDiscMaster2 sender, [In, MarshalAs(UnmanagedType.BStr)] String uniqueId) { // Invoke the corresponding delegate(s) if (NotifyDeviceRemovedDelegate != null) { NotifyDeviceRemovedDelegate(sender, uniqueId); } } public int Cookie; public IMAPIEventHandlerDelegate NotifyDeviceAddedDelegate; public IMAPIEventHandlerDelegate NotifyDeviceRemovedDelegate; } [ClassInterface(ClassInterfaceType.None)] internal sealed class DiscMaster2Events_EventProvider : IDiscMaster2_Events, IDisposable { // Ctor public DiscMaster2Events_EventProvider(Object pointContainer) { lock (this) { if (m_ConnectionPoint == null) { Guid eventsGuid = typeof(DDiscMaster2Events).GUID; IConnectionPointContainer connectionPointContainer = pointContainer as IConnectionPointContainer; connectionPointContainer.FindConnectionPoint(ref eventsGuid, out m_ConnectionPoint); } } } // Event #1: NotifyDeviceAdded public event IMAPIEventHandlerDelegate NotifyDeviceAdded { add { lock (this) { // Call Advise on a new sink helper, initializing its cookie if (m_SinkHelper == null) { m_SinkHelper = new DiscMaster2Events_SinkHelper(); } // Add the passed-in value to the sink helper's delegate list m_SinkHelper.NotifyDeviceAddedDelegate += value; if (m_NeedsAdvise) { m_ConnectionPoint.Advise(m_SinkHelper, out m_SinkHelper.Cookie); m_NeedsAdvise = false; } } } remove { lock (this) { if (m_SinkHelper == null || m_SinkHelper.NotifyDeviceAddedDelegate == null) { // TODO: ERROR, cannot remove w/o adding } else { m_SinkHelper.NotifyDeviceAddedDelegate -= value; if (m_SinkHelper.NotifyDeviceAddedDelegate == null && m_SinkHelper.NotifyDeviceRemovedDelegate == null) { m_ConnectionPoint.Unadvise(m_SinkHelper.Cookie); m_NeedsAdvise = true; } } } } } // Event #2: NotifyDeviceRemoved public event IMAPIEventHandlerDelegate NotifyDeviceRemoved { add { lock (this) { // Call Advise on a new sink helper, initializing its cookie if (m_SinkHelper == null) { m_SinkHelper = new DiscMaster2Events_SinkHelper(); } // Add the passed-in value to the sink helper's delegate list m_SinkHelper.NotifyDeviceRemovedDelegate += value; if (m_NeedsAdvise) { m_ConnectionPoint.Advise(m_SinkHelper, out m_SinkHelper.Cookie); m_NeedsAdvise = false; } } } remove { lock (this) { if (m_SinkHelper == null || m_SinkHelper.NotifyDeviceRemovedDelegate == null) { // TODO: ERROR, cannot remove w/o adding } else { m_SinkHelper.NotifyDeviceAddedDelegate -= value; if (m_SinkHelper.NotifyDeviceAddedDelegate == null && m_SinkHelper.NotifyDeviceRemovedDelegate == null) { m_ConnectionPoint.Unadvise(m_SinkHelper.Cookie); m_NeedsAdvise = true; } } } } } // Implementation of IDisposable.Dispose public void Dispose() { Cleanup(); // It is no longer necessary for the GC to call the finalizer GC.SuppressFinalize(this); } // Finalizer ~DiscMaster2Events_EventProvider() { Cleanup(); } // Called to unhook all events private void Cleanup() { lock (this) { if (!m_NeedsAdvise) { m_ConnectionPoint.Unadvise(m_SinkHelper.Cookie); m_NeedsAdvise = true; } m_SinkHelper = null; m_ConnectionPoint = null; } } private bool m_NeedsAdvise = true; private IConnectionPoint m_ConnectionPoint = null; private DiscMaster2Events_SinkHelper m_SinkHelper = null; } #endregion DiscMaster2 #region DiscFormat2Data [ ComEventInterface(typeof(DDiscFormat2DataEvents), typeof(DiscFormat2Data_EventsProvider)), TypeLibType(TypeLibTypeFlags.FHidden) ] public interface IDiscFormat2Data_Events { event IMAPIEventHandlerDelegate Update; } [ TypeLibType(TypeLibTypeFlags.FHidden), ClassInterface(ClassInterfaceType.None) ] public sealed class DiscFormat2Data_SinkHelper : DDiscFormat2DataEvents { public void Update([In, MarshalAs(UnmanagedType.IDispatch)] IDiscFormat2Data sender, [In, MarshalAs(UnmanagedType.IDispatch)] IDiscFormat2DataEventArgs args) { UpdateDelegate(sender, args); } public int Cookie; public IMAPIEventHandlerDelegate UpdateDelegate; } [ClassInterface(ClassInterfaceType.None)] internal sealed class DiscFormat2Data_EventsProvider : IDiscFormat2Data_Events, IDisposable { public DiscFormat2Data_EventsProvider(Object pointContainer) { lock (this) { if (m_ConnectionPoint == null) { Guid eventsGuid = typeof(DDiscFormat2DataEvents).GUID; IConnectionPointContainer connectionPointContainer = pointContainer as IConnectionPointContainer; connectionPointContainer.FindConnectionPoint(ref eventsGuid, out m_ConnectionPoint); } } } public event IMAPIEventHandlerDelegate Update { add { lock (this) { if (m_SinkHelper == null) { m_SinkHelper = new DiscFormat2Data_SinkHelper(); } // Add the passed-in value to the sink helper's delegate list m_SinkHelper.UpdateDelegate += value; // Call Advise on a new sink helper, initializing its cookie if (m_NeedsAdvise) { m_ConnectionPoint.Advise(m_SinkHelper, out m_SinkHelper.Cookie); m_NeedsAdvise = false; } } } remove { lock (this) { if (m_SinkHelper == null || m_SinkHelper.UpdateDelegate == null) //.GetInvocationList().Length == 0) { // TODO: ERROR, cannot remove w/o adding } else { m_SinkHelper.UpdateDelegate -= value; if (m_SinkHelper.UpdateDelegate == null) //m_SinkHelper.UpdateDelegate.GetInvocationList().Length == 0) { m_ConnectionPoint.Unadvise(m_SinkHelper.Cookie); m_NeedsAdvise = true; } } } } } // Implementation of IDisposable.Dispose public void Dispose() { Cleanup(); // It is no longer necessary for the GC to call the finalizer GC.SuppressFinalize(this); } // Finalizer ~DiscFormat2Data_EventsProvider() { Cleanup(); } // Called to unhook all events private void Cleanup() { lock (this) { if (!m_NeedsAdvise) { m_ConnectionPoint.Unadvise(m_SinkHelper.Cookie); m_NeedsAdvise = true; } m_SinkHelper = null; m_ConnectionPoint = null; } } private bool m_NeedsAdvise = true; private IConnectionPoint m_ConnectionPoint = null; private DiscFormat2Data_SinkHelper m_SinkHelper = null; } #endregion DiscFormat2Data #region DiscFormat2Erase [ ComEventInterface(typeof(DDiscFormat2EraseEvents), typeof(DiscFormat2Erase_EventsProvider)), TypeLibType(TypeLibTypeFlags.FHidden) ] public interface IDiscFormat2Erase_Events { event IMAPIEventHandlerDelegate Update; } [ TypeLibType(TypeLibTypeFlags.FHidden), ClassInterface(ClassInterfaceType.None) ] public sealed class DiscFormat2Erase_SinkHelper : DDiscFormat2EraseEvents { public void Update([In, MarshalAs(UnmanagedType.IDispatch)] IDiscFormat2Erase sender, int elapsedSeconds, int estimatedTotalSeconds) { UpdateDelegate(sender, elapsedSeconds, estimatedTotalSeconds); } public int Cookie; public IMAPIEventHandlerDelegate UpdateDelegate; } [ClassInterface(ClassInterfaceType.None)] internal sealed class DiscFormat2Erase_EventsProvider : IDiscFormat2Erase_Events, IDisposable { public DiscFormat2Erase_EventsProvider(Object pointContainer) { lock (this) { if (m_ConnectionPoint == null) { Guid eventsGuid = typeof(DDiscFormat2EraseEvents).GUID; IConnectionPointContainer connectionPointContainer = pointContainer as IConnectionPointContainer; connectionPointContainer.FindConnectionPoint(ref eventsGuid, out m_ConnectionPoint); } } } public event IMAPIEventHandlerDelegate Update { add { lock (this) { if (m_SinkHelper == null) { m_SinkHelper = new DiscFormat2Erase_SinkHelper(); } // Add the passed-in value to the sink helper's delegate list m_SinkHelper.UpdateDelegate += value; // Call Advise on a new sink helper, initializing its cookie if (m_NeedsAdvise) { m_ConnectionPoint.Advise(m_SinkHelper, out m_SinkHelper.Cookie); m_NeedsAdvise = false; } } } remove { lock (this) { if (m_SinkHelper == null || m_SinkHelper.UpdateDelegate == null) //.GetInvocationList().Length == 0) { // TODO: ERROR, cannot remove w/o adding } else { m_SinkHelper.UpdateDelegate -= value; if (m_SinkHelper.UpdateDelegate == null) //m_SinkHelper.UpdateDelegate.GetInvocationList().Length == 0) { m_ConnectionPoint.Unadvise(m_SinkHelper.Cookie); m_NeedsAdvise = true; } } } } } // Implementation of IDisposable.Dispose public void Dispose() { Cleanup(); // It is no longer necessary for the GC to call the finalizer GC.SuppressFinalize(this); } // Finalizer ~DiscFormat2Erase_EventsProvider() { Cleanup(); } // Called to unhook all events private void Cleanup() { lock (this) { if (!m_NeedsAdvise) { m_ConnectionPoint.Unadvise(m_SinkHelper.Cookie); m_NeedsAdvise = true; } m_SinkHelper = null; m_ConnectionPoint = null; } } private bool m_NeedsAdvise = true; private IConnectionPoint m_ConnectionPoint = null; private DiscFormat2Erase_SinkHelper m_SinkHelper = null; } #endregion DiscFormat2Erase #region DiscFormat2TrackAtOnce [ ComEventInterface(typeof(DDiscFormat2TrackAtOnceEvents), typeof(DiscFormat2TrackAtOnce_EventsProvider)), TypeLibType(TypeLibTypeFlags.FHidden) ] public interface IDiscFormat2TrackAtOnce_Events { event IMAPIEventHandlerDelegate Update; } [ TypeLibType(TypeLibTypeFlags.FHidden), ClassInterface(ClassInterfaceType.None) ] public sealed class DiscFormat2TrackAtOnce_SinkHelper : DDiscFormat2TrackAtOnceEvents { public void Update([In, MarshalAs(UnmanagedType.IDispatch)] IDiscFormat2TrackAtOnce sender, [In, MarshalAs(UnmanagedType.IDispatch)] IDiscFormat2TrackAtOnceEventArgs args) { UpdateDelegate(sender, args); } public int Cookie; public IMAPIEventHandlerDelegate UpdateDelegate; } [ClassInterface(ClassInterfaceType.None)] internal sealed class DiscFormat2TrackAtOnce_EventsProvider : IDiscFormat2TrackAtOnce_Events, IDisposable { public DiscFormat2TrackAtOnce_EventsProvider(Object pointContainer) { lock (this) { if (m_ConnectionPoint == null) { Guid eventsGuid = typeof(DDiscFormat2TrackAtOnceEvents).GUID; IConnectionPointContainer connectionPointContainer = pointContainer as IConnectionPointContainer; connectionPointContainer.FindConnectionPoint(ref eventsGuid, out m_ConnectionPoint); } } } public event IMAPIEventHandlerDelegate Update { add { lock (this) { if (m_SinkHelper == null) { m_SinkHelper = new DiscFormat2TrackAtOnce_SinkHelper(); } // Add the passed-in value to the sink helper's delegate list m_SinkHelper.UpdateDelegate += value; // Call Advise on a new sink helper, initializing its cookie if (m_NeedsAdvise) { m_ConnectionPoint.Advise(m_SinkHelper, out m_SinkHelper.Cookie); m_NeedsAdvise = false; } } } remove { lock (this) { if (m_SinkHelper == null || m_SinkHelper.UpdateDelegate == null) //.GetInvocationList().Length == 0) { // TODO: ERROR, cannot remove w/o adding } else { m_SinkHelper.UpdateDelegate -= value; if (m_SinkHelper.UpdateDelegate == null) //m_SinkHelper.UpdateDelegate.GetInvocationList().Length == 0) { m_ConnectionPoint.Unadvise(m_SinkHelper.Cookie); m_NeedsAdvise = true; } } } } } // Implementation of IDisposable.Dispose public void Dispose() { Cleanup(); // It is no longer necessary for the GC to call the finalizer GC.SuppressFinalize(this); } // Finalizer ~DiscFormat2TrackAtOnce_EventsProvider() { Cleanup(); } // Called to unhook all events private void Cleanup() { lock (this) { if (!m_NeedsAdvise) { m_ConnectionPoint.Unadvise(m_SinkHelper.Cookie); m_NeedsAdvise = true; } m_SinkHelper = null; m_ConnectionPoint = null; } } private bool m_NeedsAdvise = true; private IConnectionPoint m_ConnectionPoint = null; private DiscFormat2TrackAtOnce_SinkHelper m_SinkHelper = null; } #endregion DiscFormat2TrackAtOnce #region DiscFormat2RawCD [ ComEventInterface(typeof(DDiscFormat2RawCDEvents), typeof(DiscFormat2RawCD_EventsProvider)), TypeLibType(TypeLibTypeFlags.FHidden) ] public interface IDiscFormat2RawCD_Events { event IMAPIEventHandlerDelegate Update; } [ TypeLibType(TypeLibTypeFlags.FHidden), ClassInterface(ClassInterfaceType.None) ] public sealed class DiscFormat2RawCD_SinkHelper : DDiscFormat2RawCDEvents { public void Update([In, MarshalAs(UnmanagedType.IDispatch)] IDiscFormat2RawCD sender, [In, MarshalAs(UnmanagedType.IDispatch)] IDiscFormat2RawCDEventArgs args) { UpdateDelegate(sender, args); } public int Cookie; public IMAPIEventHandlerDelegate UpdateDelegate; } [ClassInterface(ClassInterfaceType.None)] internal sealed class DiscFormat2RawCD_EventsProvider : IDiscFormat2RawCD_Events, IDisposable { public DiscFormat2RawCD_EventsProvider(Object pointContainer) { lock (this) { if (m_ConnectionPoint == null) { Guid eventsGuid = typeof(DDiscFormat2RawCDEvents).GUID; IConnectionPointContainer connectionPointContainer = pointContainer as IConnectionPointContainer; connectionPointContainer.FindConnectionPoint(ref eventsGuid, out m_ConnectionPoint); } } } public event IMAPIEventHandlerDelegate Update { add { lock (this) { if (m_SinkHelper == null) { m_SinkHelper = new DiscFormat2RawCD_SinkHelper(); } // Add the passed-in value to the sink helper's delegate list m_SinkHelper.UpdateDelegate += value; // Call Advise on a new sink helper, initializing its cookie if (m_NeedsAdvise) { m_ConnectionPoint.Advise(m_SinkHelper, out m_SinkHelper.Cookie); m_NeedsAdvise = false; } } } remove { lock (this) { if (m_SinkHelper == null || m_SinkHelper.UpdateDelegate == null) //.GetInvocationList().Length == 0) { // TODO: ERROR, cannot remove w/o adding } else { m_SinkHelper.UpdateDelegate -= value; if (m_SinkHelper.UpdateDelegate == null) //m_SinkHelper.UpdateDelegate.GetInvocationList().Length == 0) { m_ConnectionPoint.Unadvise(m_SinkHelper.Cookie); m_NeedsAdvise = true; } } } } } // Implementation of IDisposable.Dispose public void Dispose() { Cleanup(); // It is no longer necessary for the GC to call the finalizer GC.SuppressFinalize(this); } // Finalizer ~DiscFormat2RawCD_EventsProvider() { Cleanup(); } // Called to unhook all events private void Cleanup() { lock (this) { if (!m_NeedsAdvise) { m_ConnectionPoint.Unadvise(m_SinkHelper.Cookie); m_NeedsAdvise = true; } m_SinkHelper = null; m_ConnectionPoint = null; } } private bool m_NeedsAdvise = true; private IConnectionPoint m_ConnectionPoint = null; private DiscFormat2RawCD_SinkHelper m_SinkHelper = null; } #endregion DiscFormat2RawCD #region WriteEngine2 [ ComEventInterface(typeof(DWriteEngine2Events), typeof(WriteEngine2_EventsProvider)), TypeLibType(TypeLibTypeFlags.FHidden) ] public interface IWriteEngine2_Events { event IMAPIEventHandlerDelegate Update; } [ TypeLibType(TypeLibTypeFlags.FHidden), ClassInterface(ClassInterfaceType.None) ] public sealed class WriteEngine2_SinkHelper : DWriteEngine2Events { public void Update([In, MarshalAs(UnmanagedType.IDispatch)] IWriteEngine2 sender, [In, MarshalAs(UnmanagedType.IDispatch)] IWriteEngine2EventArgs args) { UpdateDelegate(sender, args); } public int Cookie; public IMAPIEventHandlerDelegate UpdateDelegate; } [ClassInterface(ClassInterfaceType.None)] internal sealed class WriteEngine2_EventsProvider : IWriteEngine2_Events, IDisposable { public WriteEngine2_EventsProvider(Object pointContainer) { lock (this) { if (m_ConnectionPoint == null) { Guid eventsGuid = typeof(DWriteEngine2Events).GUID; IConnectionPointContainer connectionPointContainer = pointContainer as IConnectionPointContainer; connectionPointContainer.FindConnectionPoint(ref eventsGuid, out m_ConnectionPoint); } } } public event IMAPIEventHandlerDelegate Update { add { lock (this) { if (m_SinkHelper == null) { m_SinkHelper = new WriteEngine2_SinkHelper(); } // Add the passed-in value to the sink helper's delegate list m_SinkHelper.UpdateDelegate += value; // Call Advise on a new sink helper, initializing its cookie if (m_NeedsAdvise) { m_ConnectionPoint.Advise(m_SinkHelper, out m_SinkHelper.Cookie); m_NeedsAdvise = false; } } } remove { lock (this) { if (m_SinkHelper == null || m_SinkHelper.UpdateDelegate == null) //.GetInvocationList().Length == 0) { // TODO: ERROR, cannot remove w/o adding } else { m_SinkHelper.UpdateDelegate -= value; if (m_SinkHelper.UpdateDelegate == null) //m_SinkHelper.UpdateDelegate.GetInvocationList().Length == 0) { m_ConnectionPoint.Unadvise(m_SinkHelper.Cookie); m_NeedsAdvise = true; } } } } } // Implementation of IDisposable.Dispose public void Dispose() { Cleanup(); // It is no longer necessary for the GC to call the finalizer GC.SuppressFinalize(this); } // Finalizer ~WriteEngine2_EventsProvider() { Cleanup(); } // Called to unhook all events private void Cleanup() { lock (this) { if (!m_NeedsAdvise) { m_ConnectionPoint.Unadvise(m_SinkHelper.Cookie); m_NeedsAdvise = true; } m_SinkHelper = null; m_ConnectionPoint = null; } } private bool m_NeedsAdvise = true; private IConnectionPoint m_ConnectionPoint = null; private WriteEngine2_SinkHelper m_SinkHelper = null; } #endregion WriteEngine2 #endregion Events #region CoClass /// /// /// [ ComImport, Guid("27354130-7F64-5B0F-8F00-5D77AFBE261E"), CoClass(typeof(MsftDiscMaster2Class)) ] public interface MsftDiscMaster2 : IDiscMaster2, IDiscMaster2_Events { } [ ComImport, Guid("27354132-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(MsftDiscRecorder2XClass)), ] public interface MsftDiscRecorder2Ex : IDiscRecorder2Ex { } [ ComImport, Guid("27354133-7F64-5B0F-8F00-5D77AFBE261E"), CoClass(typeof(MsftDiscRecorder2XClass)) ] public interface MsftDiscRecorder2 : IDiscRecorder2 { } [ ComImport, Guid("27354151-7F64-5B0F-8F00-5D77AFBE261E"), CoClass(typeof(MsftMultisessionSequentialClass)) ] public interface MsftMultisessionSequential : IMultisessionSequential { } [ ComImport, Guid("27354153-9F64-5B0F-8F00-5D77AFBE261E"), CoClass(typeof(MsftDiscFormat2DataClass)) ] public interface MsftDiscFormat2Data : IDiscFormat2Data, IDiscFormat2Data_Events, IBurnVerification { } [ ComImport, Guid("27354154-8F64-5B0F-8F00-5D77AFBE261E"), CoClass(typeof(MsftDiscFormat2TrackAtOnceClass)) ] public interface MsftDiscFormat2TrackAtOnce : IDiscFormat2TrackAtOnce, IDiscFormat2TrackAtOnce_Events, IBurnVerification { } [ ComImport, Guid("27354156-8F64-5B0F-8F00-5D77AFBE261E"), CoClass(typeof(MsftDiscFormat2EraseClass)) ] public interface MsftDiscFormat2Erase : IDiscFormat2Erase, IDiscFormat2Erase_Events { } [ ComImport, Guid("27354155-8F64-5B0F-8F00-5D77AFBE261E"), CoClass(typeof(MsftDiscFormat2RawCDClass)) ] public interface MsftDiscFormat2RawCD : IDiscFormat2RawCD, IDiscFormat2RawCD_Events { } [ ComImport, Guid("27354135-7F64-5B0F-8F00-5D77AFBE261E"), CoClass(typeof(MsftWriteEngine2Class)) ] public interface MsftWriteEngine2 : IWriteEngine2, IWriteEngine2_Events { } #endregion CoClass #region Class /// /// /// [ ComImport, Guid("27354122-7F64-5B0F-8F00-5D77AFBE261E"), ClassInterface(ClassInterfaceType.None), TypeLibType(TypeLibTypeFlags.FCanCreate) ] public class MsftMultisessionSequentialClass { } [ ComImport, Guid("2735412E-7F64-5B0F-8F00-5D77AFBE261E"), ComSourceInterfaces("DDiscMaster2Events\0"), ClassInterface(ClassInterfaceType.None), TypeLibType(TypeLibTypeFlags.FCanCreate) ] public class MsftDiscMaster2Class { } [ ComImport, Guid("2735412D-7F64-5B0F-8F00-5D77AFBE261E"), ClassInterface(ClassInterfaceType.None), TypeLibType(TypeLibTypeFlags.FCanCreate) ] public class MsftDiscRecorder2Class { } [ ComImport, Guid("2735412A-7F64-5B0F-8F00-5D77AFBE261E"), ComSourceInterfaces("DDiscFormat2DataEvents\0"), ClassInterface(ClassInterfaceType.None), TypeLibType(TypeLibTypeFlags.FCanCreate), ] public class MsftDiscFormat2DataClass { } [ ComImport, Guid("2735412B-7F64-5B0F-8F00-5D77AFBE261E"), ComSourceInterfaces("DDiscFormat2EraseEvents\0"), ClassInterface(ClassInterfaceType.None), TypeLibType(TypeLibTypeFlags.FCanCreate), ] public class MsftDiscFormat2EraseClass { } [ ComImport, Guid("27354129-7F64-5B0F-8F00-5D77AFBE261E"), ComSourceInterfaces("DDiscFormat2TrackAtOnceEvents\0"), ClassInterface(ClassInterfaceType.None), TypeLibType(TypeLibTypeFlags.FCanCreate), ] public class MsftDiscFormat2TrackAtOnceClass { } [ ComImport, Guid("27354128-7F64-5B0F-8F00-5D77AFBE261E"), ComSourceInterfaces("DDiscFormat2RawCDEvents\0"), ClassInterface(ClassInterfaceType.None), TypeLibType(TypeLibTypeFlags.FCanCreate), ] public class MsftDiscFormat2RawCDClass { } [ ComImport, Guid("2735412C-7F64-5B0F-8F00-5D77AFBE261E"), ComSourceInterfaces("DWriteEngine2Events\0"), ClassInterface(ClassInterfaceType.None), TypeLibType(TypeLibTypeFlags.FCanCreate), ] public class MsftWriteEngine2Class { } #endregion Class #region Enumerators [Serializable] public enum FeaturePageType :int { ProfileList = 0, Core = 0x01, Morphing = 0x02, RemovableMedium = 0x03, Write_Protect = 0x04, RandomlyReadable = 0x10, CD_Multiread = 0x1D, CD_Read = 0x1E, DVD_Read = 0x1F, RandomlyWritable = 0x20, IncrementalStreamingWritable = 0x21, SectorErasable = 0x22, Formattable = 0x23, HardwareDefectManagement = 0x24, WriteOnce = 0x25, RestrictedOverwrite = 0x26, CDRW_CAV_Write = 0x27, MRW = 0x28, EnhancedDefectReporting = 0x29, DVDPlusRW = 0x2A, DVDPlusR = 0x2B, RigidRestrictedOverwrite = 0x2C, CD_TrackAtOnce = 0x2D, CD_Mastering = 0x2E, DVDDash_Write = 0x2F, LayerJumpRecording = 0x33, CDRW_MediaWriteSupport = 0x37, BD_PseudoOverwrite = 0x38, DVDPlusRWDualLayer = 0x3a, DVDPlusRDualLayer = 0x3b, BD_Read = 0x40, BD_Write = 0x41, HDDVD_Read = 0x50, HDDVD_Write = 0x51, PowerManagement = 0x100, Smart = 0x101, EmbeddedChanger = 0x102, CD_AnalogPlay = 0x103, MicrocodeUpdate = 0x104, Timeout = 0x105, DVD_CSS = 0x106, RealTimeStreaming = 0x107, LogicalUnitSerialNumber = 0x108, MediaSerialNumber = 0x109, DiscControlBlocks = 0x10A, DVD_CPRM = 0x10B, FirmwareInformation = 0x10C, AACS = 0x10D, VCPS = 0x110, } [Serializable] public enum ModePageType { ReadWriteErrorRecovery = 1, MRW = 3, WriteParameters = 5, Caching = 8, PowerCondition = 26, InformationalExceptions = 28, TimeoutAnd_Protect = 29, LegacyCapabilities = 42, } [Serializable] public enum ModePageRequestType { CurrentValues = 0, ChangableValues = 1, DefaultValues = 2, SavedValues = 3, } [Serializable] public enum ReadTrackAddressType { LBA = 0, Track = 1, Session = 2, } [Serializable] public enum MediaPhysicalType { Unknown = 0, CDROM = 1, CDR = 2, CDRW = 3, DVDROM = 4, DVDRAM = 5, DVDPlusR = 6, DVDPlusRW = 7, DVDPlusRDualLayer = 8, DVDDashR = 9, DVDDashRW = 10, DVDDashRDualLayer = 11, Disk = 12, DVDPlusRWDualLayer = 13, HDDVDROM = 14, HDDVDR = 15, HDDVDRAM = 16, BDROM = 17, BDR = 18, BDRE = 19, } [Flags] [Serializable] public enum MediaWriteProtectState { UntilPowerdown = 0x00001, ByCartridge = 0x00002, ByMediaSpecificReason = 0x00004, BySoftwareWriteProtect = 0x00008, ByDiscControlBlock = 0x00010, ReadOnlyMedia = 0x04000, } [Serializable] public enum ProfileType { Invalid = 0x0000, NonRemovableDisk = 0x0001, RemovableDisk = 0x0002, MO_Erasable = 0x0003, MO_WriteOnce = 0x0004, AS_MO = 0x0005, // Reserved 0x0006 - 0x0007 CDROM = 0x0008, CDRecordable = 0x0009, CDRewritable = 0x000A, // Reserved 0x000B - 0x000F DVDROM = 0x0010, DVDDashRecordable = 0x0011, DVDRAM = 0x0012, DVDDashRewritable = 0x0013, DVDDashRWSequential = 0x0014, DVDDashRDualSequential = 0x0015, DVDDashRDualLayerJump = 0x0016, // Reserved 0x0017 - 0x0019 DVDPlusRW = 0x001A, DVDPlusR = 0x001B, // Reserved 0x001B - 001F DDCDROM = 0x0020, DDCDRecordable = 0x0021, DDCDRewritable = 0x0022, // Reserved 0x0023 - 0x0029 DVDPlusRWDualLayer = 0x002A, DVDPlusRDualLayer = 0x002B, // Reserved 0x002C - 0x003F BDROM = 0x0040, BDRSequential = 0x0041, BDRRandomRecording = 0x0042, BDRewritable = 0x0043, // Reserved 0x0044 - 0x004F HDDVDROM = 0x0050, HDDVDRecordable = 0x0051, HDDVDRAM = 0x0052, HDDVDRW = 0x0053, // Reserved 0x0054 - 0xFFFE NonStandard = 0xFFFF } [Flags] [Serializable] public enum Format2DataMediaState { [TypeLibVar(TypeLibVarFlags.FHidden)] Unknown = 0x0000, OverwriteOnly = 0x0001, RandomlyWritable = 0x0001, // deprecated, need to replace usage Blank = 0x0002, Appendable = 0x0004, FinalSession = 0x0008, InformationalMask = 0x000F, Damaged = 0x0400, EraseRequired = 0x0800, NonEmptySession = 0x1000, WriteProtected = 0x2000, Finalized = 0x4000, UnsupportedMedia = 0x8000, UnsupportedMask = 0xFC00, } [Serializable] public enum Format2DataWriteAction { ValidatingMedia = 0, FormattingMedia = 1, InitializingHardware = 2, CalibratingPower = 3, WritingData = 4, Finalization = 5, Completed = 6, } [Serializable] public enum Format2TAOWriteAction { [TypeLibVar(TypeLibVarFlags.FHidden)] Unknown = 0, Preparing = 1, Writing = 2, Finishing = 3 } [Serializable] public enum Format2RawCDDataSectorType { SubcodePQOnly = 0x0001, SubcodeIsCooked = 0x0002, SubcodeIsRaw = 0x0003, } [Serializable] public enum Format2RawCDWriteAction { Unknown = 0x0000, Preparing = 0x0001, Writing = 0x0002, Finishing = 0x0003, } [Serializable] public enum BurnVerificationLevel { None = 0x0000, Quick = 0x0001, Full = 0x0002, } #endregion }