using System; using System.Collections; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; using System.Runtime.InteropServices.CustomMarshalers; using Vanara.InteropServices; using static Vanara.PInvoke.OleAut32; namespace Vanara.PInvoke { /// Interfaces and constants for IMAPI v1 and v2. public static partial class IMAPI { /// Implement this interface to receive notifications of the current write operation. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-ddiscformat2dataevents [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.DDiscFormat2DataEvents")] [ComImport, Guid("2735413C-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual)] #pragma warning disable IDE1006 // Naming Styles public interface DDiscFormat2DataEvents { /// Implement this method to receive progress notification of the current write operation. /// /// The IDiscFormat2Data interface that initiated the write operation. /// This parameter is a MsftDiscFormat2Data object in script. /// /// /// An IDiscFormat2DataEventArgs interface that you use to determine the progress of the write operation. /// This parameter is a MsftDiscFormat2Data object in script. /// /// Return values are ignored. /// /// Notifications are sent in response to calling the IDiscFormat2Data::Write method. /// Notification is sent when the current action changes: /// /// /// Once when initializing the hardware /// /// /// Once when calibrating the power /// /// /// Once when formatting the media, if required by the media type /// /// /// Every 0.5 seconds during the write operation /// /// /// Once after the operation completes /// /// /// To stop the write process, call the IDiscFormat2Data::CancelWrite method. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-ddiscformat2dataevents-update HRESULT Update( IDispatch // *object, IDispatch *progress ); [DispId(0x200)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void Update([In, MarshalAs(UnmanagedType.IDispatch)] IDiscFormat2Data @object, [In, MarshalAs(UnmanagedType.IDispatch)] IDiscFormat2DataEventArgs progress); } /// Receive notifications of the current write operation. /// [ClassInterface(ClassInterfaceType.None)] public class DDiscFormat2DataEventsSink : DDiscFormat2DataEvents { /// Initializes a new instance of the class. /// The update. public DDiscFormat2DataEventsSink(Action onUpdate) { if (onUpdate is not null) Update += onUpdate; } /// Occurs when the current write operation sends a progress notification. /// /// Notifications are sent in response to calling the IDiscFormat2Data::Write method. /// Notification is sent when the current action changes: /// /// /// Once when initializing the hardware /// /// /// Once when calibrating the power /// /// /// Once when formatting the media, if required by the media type /// /// /// Every 0.5 seconds during the write operation /// /// /// Once after the operation completes /// /// /// To stop the write process, call the IDiscFormat2Data::CancelWrite method. /// public event Action Update; void DDiscFormat2DataEvents.Update(IDiscFormat2Data @object, IDiscFormat2DataEventArgs progress) => Update?.Invoke(@object, progress); } /// Implement this interface to receive notifications of the current erase operation. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-ddiscformat2eraseevents [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.DDiscFormat2EraseEvents")] [ComImport, Guid("2735413A-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface DDiscFormat2EraseEvents { /// Implement this method to receive progress notification of the current erase operation. /// /// The IDiscFormat2Erase interface that initiated the erase operation. /// This parameter is a MsftDiscFormat2Erase object in script. /// /// Elapsed time, in seconds, of the erase operation. /// Estimated time, in seconds, to complete the erase operation. /// Return values are ignored. /// /// Notifications are sent in response to calling the IDiscFormat2Erase::EraseMedia method. /// Notification is sent every 0.5 or 1.0 seconds depending on the method required to blank the media. /// /// Total time estimates for a single erasure can vary as the operation progresses. The drive provides updated information that /// can affect the projected duration of the erasure. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-ddiscformat2eraseevents-update HRESULT Update( IDispatch // *object, LONG elapsedSeconds, LONG estimatedTotalSeconds ); [DispId(0x200)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void Update([In, MarshalAs(UnmanagedType.IDispatch)] IDiscFormat2Erase @object, int elapsedSeconds, int estimatedTotalSeconds); } /// Receive notifications of the current erase operation. [ClassInterface(ClassInterfaceType.None)] public class DDiscFormat2EraseEventsSink : DDiscFormat2EraseEvents { /// Initializes a new instance of the class. /// The on update. public DDiscFormat2EraseEventsSink(Action onUpdate) { if (onUpdate is not null) Update += onUpdate; } /// Implement this method to receive progress notification of the current erase operation. /// /// Notifications are sent in response to calling the IDiscFormat2Erase::EraseMedia method. /// Notification is sent every 0.5 or 1.0 seconds depending on the method required to blank the media. /// /// Total time estimates for a single erasure can vary as the operation progresses. The drive provides updated information that /// can affect the projected duration of the erasure. /// /// public event Action Update; void DDiscFormat2EraseEvents.Update(IDiscFormat2Erase @object, int elapsedSeconds, int estimatedTotalSeconds) => Update?.Invoke(@object, elapsedSeconds, estimatedTotalSeconds); } /// Implement this interface to receive notifications of the current raw-image write operation. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-ddiscformat2rawcdevents [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.DDiscFormat2RawCDEvents")] [ComImport, Guid("27354142-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface DDiscFormat2RawCDEvents { /// Implement this method to receive progress notification of the current raw-image write operation. /// /// The IDiscFormat2RawCD interface that initiated the write operation. /// This parameter is a MsftDiscFormat2RawCD object in script. /// /// /// An IDiscFormat2RawCDEventArgs interface that you use to determine the progress of the write operation. /// This parameter is a MsftDiscFormat2RawCD object in script. /// /// Return values are ignored. /// /// /// Notifications are sent in response to calling the IDiscFormat2RawCD::WriteMedia or IDiscFormat2RawCD::WriteMedia2 method. /// /// To stop the write process, call the IDiscFormat2RawCD::CancelWrite method. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-ddiscformat2rawcdevents-update HRESULT Update( IDispatch // *object, IDispatch *progress ); [DispId(0x200)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void Update([In, MarshalAs(UnmanagedType.IDispatch)] IDiscFormat2RawCD @object, [In, MarshalAs(UnmanagedType.IDispatch)] IDiscFormat2RawCDEventArgs progress); } /// Receive notifications of the current raw-image write operation. [ClassInterface(ClassInterfaceType.None)] public class DDiscFormat2RawCDEventsSink : DDiscFormat2RawCDEvents { /// Initializes a new instance of the class. /// The on update. public DDiscFormat2RawCDEventsSink(Action onUpdate) { if (onUpdate is not null) Update += onUpdate; } /// Implement this method to receive progress notification of the current raw-image write operation. /// /// /// Notifications are sent in response to calling the IDiscFormat2RawCD::WriteMedia or IDiscFormat2RawCD::WriteMedia2 method. /// /// To stop the write process, call the IDiscFormat2RawCD::CancelWrite method. /// public event Action Update; void DDiscFormat2RawCDEvents.Update(IDiscFormat2RawCD @object, IDiscFormat2RawCDEventArgs progress) => Update?.Invoke(@object, progress); } /// Implement this interface to receive notifications of the current track-writing operation. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-ddiscformat2trackatonceevents [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.DDiscFormat2TrackAtOnceEvents")] [ComImport, Guid("2735413F-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface DDiscFormat2TrackAtOnceEvents { /// Implement this method to receive progress notification of the current track-writing operation. /// /// The IDiscFormat2TrackAtOnce interface that initiated the write operation. /// This parameter is a MsftDiscFormat2TrackAtOnce object in script. /// /// /// An IDiscFormat2TrackAtOnceEventArgs interface that you use to determine the progress of the write operation. /// This parameter is a MsftDiscFormat2TrackAtOnce object in script. /// /// Return values are ignored. /// /// Notifications are sent in response to calling the IDiscFormat2TrackAtOnce::AddAudioTrack method. /// To stop the write process, call the IDiscFormat2TrackAtOnce::CancelAddTrack method. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-ddiscformat2trackatonceevents-update HRESULT Update( // IDispatch *object, IDispatch *progress ); [DispId(0x200)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void Update([In, MarshalAs(UnmanagedType.IDispatch)] IDiscFormat2TrackAtOnce @object, [In, MarshalAs(UnmanagedType.IDispatch)] IDiscFormat2TrackAtOnceEventArgs progress); } /// Receive notifications of the current track-writing operation. [ClassInterface(ClassInterfaceType.None)] public class DDiscFormat2TrackAtOnceEventsSink : DDiscFormat2TrackAtOnceEvents { /// Initializes a new instance of the class. /// The on update. public DDiscFormat2TrackAtOnceEventsSink(Action onUpdate) { if (onUpdate is not null) Update += onUpdate; } /// Implement this method to receive progress notification of the current track-writing operation. /// /// Notifications are sent in response to calling the IDiscFormat2TrackAtOnce::AddAudioTrack method. /// To stop the write process, call the IDiscFormat2TrackAtOnce::CancelAddTrack method. /// public event Action Update; void DDiscFormat2TrackAtOnceEvents.Update(IDiscFormat2TrackAtOnce @object, IDiscFormat2TrackAtOnceEventArgs progress) => Update?.Invoke(@object, progress); } /// Implement this interface to receive notification when a CD or DVD device is added to or removed from the computer. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-ddiscmaster2events [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.DDiscMaster2Events")] [ComImport, Guid("27354131-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface DDiscMaster2Events { /// Receives notification when an optical media device is added to the computer. /// /// An IDiscMaster2 interface that you can use to enumerate the devices on the computer. /// This parameter is a MsftDiscMaster2 object in script. /// /// /// String that contains an identifier that uniquely identifies the optical media device that was added to the computer. /// /// Return values are ignored. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-ddiscmaster2events-notifydeviceadded HRESULT // NotifyDeviceAdded( IDispatch *object, BSTR uniqueId ); [DispId(0x100)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void NotifyDeviceAdded([In, MarshalAs(UnmanagedType.IDispatch)] IDiscMaster2 @object, [In, MarshalAs(UnmanagedType.BStr)] string uniqueId); /// Receives notification when an optical media device is removed from the computer. /// /// An IDiscMaster2 interface that you can use to enumerate the devices on the computer. /// This parameter is a MsftDiscMaster2 object in script. /// /// /// String that contains an identifier that uniquely identifies the optical media device that was added to the computer. /// /// Return values are ignored. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-ddiscmaster2events-notifydeviceremoved HRESULT // NotifyDeviceRemoved( IDispatch *object, BSTR uniqueId ); [DispId(0x101)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void NotifyDeviceRemoved([In, MarshalAs(UnmanagedType.IDispatch)] IDiscMaster2 @object, [In, MarshalAs(UnmanagedType.BStr)] string uniqueId); } /// Receive notifications of the current track-writing operation. [ClassInterface(ClassInterfaceType.None)] public class DDiscMaster2EventsSink : DDiscMaster2Events { /// Initializes a new instance of the class. /// The delegate to call when a device is added. /// The delegate to call when a device is removed. public DDiscMaster2EventsSink(Action onAdded, Action onRemoved) { if (onAdded is not null) NotifyDeviceAdded += onAdded; if (onRemoved is not null) NotifyDeviceRemoved += onRemoved; } /// Receives notification when an optical media device is added to the computer. public event Action NotifyDeviceAdded; /// Receives notification when an optical media device is removed from the computer. public event Action NotifyDeviceRemoved; void DDiscMaster2Events.NotifyDeviceAdded(IDiscMaster2 @object, string uniqueId) => NotifyDeviceAdded?.Invoke(@object, uniqueId); void DDiscMaster2Events.NotifyDeviceRemoved(IDiscMaster2 @object, string uniqueId) => NotifyDeviceRemoved?.Invoke(@object, uniqueId); } /// Implement this interface to receive notifications of the current write operation. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-dwriteengine2events [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.DWriteEngine2Events")] [ComImport, Guid("27354137-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface DWriteEngine2Events { /// Implement this method to receive progress notification of the current write operation. /// /// The IWriteEngine2 interface that initiated the write operation. /// This parameter is a MsftWriteEngine2 object in script. /// /// /// An IWriteEngine2EventArgs interface that you use to determine the progress of the write operation. /// This parameter is a MsftWriteEngine2 object in script. /// /// Return values are ignored. /// /// Notifications are sent in response to calling the IWriteEngine2::WriteSection method. /// Notification is sent: /// /// /// Once before the operation begins /// /// /// Every 0.5 seconds during the write operation /// /// /// Once after the operation completes /// /// /// To stop the write process, call the IWriteEngine2::CancelWrite method. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-dwriteengine2events-update HRESULT Update( IDispatch // *object, IDispatch *progress ); [DispId(0x100)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void Update([In, MarshalAs(UnmanagedType.IDispatch)] IWriteEngine2 @object, [In, MarshalAs(UnmanagedType.IDispatch)] IWriteEngine2EventArgs progress); } /// Receive notifications of the current write operation. /// [ClassInterface(ClassInterfaceType.None)] public class DWriteEngine2EventsSink : DWriteEngine2Events { /// Initializes a new instance of the class. /// The on update. public DWriteEngine2EventsSink(Action onUpdate) { if (onUpdate is not null) Update += onUpdate; } /// Implement this method to receive progress notification of the current write operation. /// /// Notifications are sent in response to calling the IWriteEngine2::WriteSection method. /// Notification is sent: /// /// /// Once before the operation begins /// /// /// Every 0.5 seconds during the write operation /// /// /// Once after the operation completes /// /// /// To stop the write process, call the IWriteEngine2::CancelWrite method. /// public event Action Update; void DWriteEngine2Events.Update(IWriteEngine2 @object, IWriteEngine2EventArgs progress) => Update?.Invoke(@object, progress); } #pragma warning restore IDE1006 // Naming Styles /// /// Use this interface to retrieve information about a single continuous range of sectors on the media. This interface is typically /// used together with the IBlockRangeList interface to describe a collection of sector ranges. /// /// /// The values returned by the IBlockRange::get_StartLba and IBlockRange::get_EndLba methods define an inclusive range, i.e. both /// the start and end sectors belong to the range. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-iblockrange [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IBlockRange")] [ComImport, Guid("B507CA25-2204-11DD-966A-001AA01BBC58"), InterfaceType(ComInterfaceType.InterfaceIsDual), CoClass(typeof(BlockRange))] public interface IBlockRange { /// Retrieves the start sector of the range described by IBlockRange. /// The start sector of the range. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iblockrange-get_startlba // HRESULT get_StartLba( LONG *value ); [DispId(0x100)] int StartLba { get; } /// Retrieves the end sector of the range specified by the IBlockRange interface. /// The end sector of the range. /// The sector number returned by this method is included in the range. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iblockrange-get_endlba // HRESULT get_EndLba( LONG *value ); [DispId(0x101)] int EndLba { get; } } /// /// Use this interface to retrieve a list of continuous sector ranges on the media. This interface is used to describe the sectors /// that need to be updated on a rewritable disc when a new logical session is recorded. /// /// /// /// IBlockRangeList is returned by the IFileSystemImageResult2::ModifiedBlocks method. Alternatively, /// IUnknown::QueryInterface can be called on the object returned by IFileSystemImageResult::get_ImageStream to get the list of /// modified sectors in the result image represented by that object. /// /// /// The order of sector ranges in IBlockRangeList is taken into account during burning. The sector ranges having lower /// indexes in the safe array returned by IBlockRangeList::get_BlockRanges are written before those with higher indexes. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-iblockrangelist [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IBlockRangeList")] [ComImport, Guid("B507CA26-2204-11DD-966A-001AA01BBC58"), InterfaceType(ComInterfaceType.InterfaceIsDual), CoClass(typeof(BlockRangeList))] public interface IBlockRangeList { /// Returns the list of sector ranges in the form of a safe array of variants of type VT_Dispatch. /// /// List of sector ranges. Each element of the list is a VARIANT of type VT_Dispatch. Query the pdispVal member of the variant /// for the IBlockRange interface. /// /// /// The order of sector ranges in IBlockRangeList is taken into account during burning. The sector ranges having lower indexes /// in the safe array returned by IBlockRangeList::get_BlockRanges are written before those with higher indexes. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iblockrangelist-get_blockranges // HRESULT get_BlockRanges( SAFEARRAY **value ); [DispId(0x100)] IBlockRange[] BlockRanges { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; } } /// /// Use this interface with IDiscFormat2Data or IDiscFormat2TrackAtOnce to get or set the Burn Verification Level property which /// dictates how burned media is verified for integrity after the write operation. /// /// /// /// The following example function demonstrates how the burn verification level defined by IMAPI_BURN_VERIFICATION_LEVEL, can be /// implemented. Burn verification level should be set prior to a burn operation. /// /// /// #include <imapi2.h> HRESULT setBurnVerification( IDiscFormat2Data *DataWriter, IMAPI_BURN_VERIFICATION_LEVEL VerificationLevel ) { HRESULT hr = S_OK; IBurnVerification *burnVerifier = NULL; hr = DataWriter->QueryInterface(IID_PPV_ARGS(&burnVerifier)); if (SUCCEEDED(hr)) { hr = burnVerifier->put_BurnVerificationLevel(VerificationLevel); } if (burnVerifier != NULL) { burnVerifier->Release(); burnVerifier = NULL; } return hr; } /// /// /// This interface is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 and /// Windows Server 2008 R2. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-iburnverification [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IBurnVerification")] [ComImport, Guid("D2FFD834-958B-426d-8470-2A13879C6A91"), InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface IBurnVerification { /// Retrieves the current Burn Verification Level. /// Pointer to an IMAPI_BURN_VERIFICATION_LEVEL enumeration that specifies the current the Burn Verification Level. /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iburnverification-get_burnverificationlevel HRESULT // get_BurnVerificationLevel( IMAPI_BURN_VERIFICATION_LEVEL *value ); [DispId(0x400)] IMAPI_BURN_VERIFICATION_LEVEL BurnVerificationLevel { set; get; } } /// /// Use this interface to write a data stream to a disc. /// /// To create an instance of this interface, call the CoCreateInstance function. Use__uuidof(MsftDiscFormat2Data) for the /// class identifier and __uuidof(IDiscFormat2Data) for the interface identifier. /// /// /// /// /// To create the MsftDiscFormat2Data object in a script, use IMAPI2.MsftDiscFormat2Data as the program identifier when /// calling CreateObject. /// /// /// It is possible for a power state transition to take place during a burn operation (i.e. user log-off or system suspend) which /// leads to the interruption of the burn process and possible data loss. For programming considerations, see Preventing Logoff or /// Suspend During a Burn. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-idiscformat2data [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IDiscFormat2Data")] [ComImport, Guid("27354153-9F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual), CoClass(typeof(MsftDiscFormat2Data))] public interface IDiscFormat2Data : IDiscFormat2 { /// Determines if the recorder supports the given format. /// An IDiscRecorder2 interface of the recorder to test. /// Is VARIANT_TRUE if the recorder supports the given format; otherwise, VARIANT_FALSE. /// /// When implemented by the IDiscFormat2RawCD interface, this method will return E_IMAPI_DF2RAW_MEDIA_IS_NOT_SUPPORTED in the event /// the recorder does not support the given format. It is important to note that in this specific scenario the value does not /// indicate that an error has occurred, but rather the result of a successful operation. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-isrecordersupported HRESULT IsRecorderSupported( // IDiscRecorder2 *recorder, VARIANT_BOOL *value ); [DispId(2048)] [return: MarshalAs(UnmanagedType.VariantBool)] new bool IsRecorderSupported(IDiscRecorder2 recorder); /// Determines if the current media in a supported recorder supports the given format. /// An IDiscRecorder2 interface of the recorder to test. /// /// Is VARIANT_TRUE if the media in the recorder supports the given format; otherwise, VARIANT_FALSE. /// Note VARIANT_TRUE also implies that the result from IsDiscRecorderSupported is VARIANT_TRUE. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-iscurrentmediasupported HRESULT // IsCurrentMediaSupported( IDiscRecorder2 *recorder, VARIANT_BOOL *value ); [DispId(2049)] [return: MarshalAs(UnmanagedType.VariantBool)] new bool IsCurrentMediaSupported(IDiscRecorder2 recorder); /// Determines if the current media is reported as physically blank by the drive. /// Is VARIANT_TRUE if the disc is physically blank; otherwise, VARIANT_FALSE. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-get_mediaphysicallyblank HRESULT // get_MediaPhysicallyBlank( VARIANT_BOOL *value ); [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). /// Is VARIANT_TRUE if the disc is likely to be blank; otherwise; VARIANT_FALSE. /// /// /// This method checks, for example, for a mounted file system on the device, verifying the first and last 2MB of the disc are /// filled with zeros, and other media-specific checks. These checks can help to determine if the media may have files on it for /// media that cannot be erased physically to a blank status. /// /// For a positive check that a disc is blank, call the IDiscFormat2::get_MediaPhysicallyBlank method. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-get_mediaheuristicallyblank HRESULT // get_MediaHeuristicallyBlank( VARIANT_BOOL *value ); [DispId(1793)] new bool MediaHeuristicallyBlank { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the media types that are supported by the current implementation of the IDiscFormat2 interface. /// /// List of media types supported by the current implementation of the IDiscFormat2 interface. Each element of the array is a /// VARIANT of type VT_I4. The lVal member of VARIANT contains the media type. For a list of media /// types, see the IMAPI_MEDIA_PHYSICAL_TYPE enumeration type. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-get_supportedmediatypes HRESULT // get_SupportedMediaTypes( SAFEARRAY **value ); [DispId(1794)] new IMAPI_MEDIA_PHYSICAL_TYPE[] SupportedMediaTypes { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; } /// Sets the recording device to use for the write operation. /// An IDiscRecorder2 interface that identifies the recording device to use in the write operation. /// /// The recorder must be compatible with the format defined by this interface. To determine compatibility, call the /// IDiscFormat2::IsRecorderSupported method. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-put_recorder HRESULT put_Recorder( // IDiscRecorder2 *value ); [DispId(256)] IDiscRecorder2 Recorder { set; [return: MarshalAs(UnmanagedType.Interface)] get; } /// Determines if Buffer Underrun Free recording is enabled. /// /// Set to VARIANT_TRUE to disable Buffer Underrun Free recording; otherwise, VARIANT_FALSE. The default is VARIANT_FALSE (enabled). /// /// /// Buffer underrun can be an issue if the data stream does not enter the buffer fast enough to keep the device continuously /// writing. In turn, the stop and start action of writing can cause data on the disc to be unusable. Buffer Underrun Free (BUF) /// recording allows the laser to start and stop without damaging data already written to the disc. Disabling of BUF recording is /// possible only on CD-R/RW media. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-put_bufferunderrunfreedisabled HRESULT // put_BufferUnderrunFreeDisabled( VARIANT_BOOL value ); [DispId(257)] bool BufferUnderrunFreeDisabled { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Determines if the data stream contains post-writing gaps. /// Set to VARIANT_TRUE if the data stream contains post-writing gaps; otherwise, VARIANT_FALSE. The default is VARIANT_FALSE. /// /// Note that writing to CD-R/RW media will automatically append a post-gap of 150 sectors, unless this property is explicitly disabled. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-put_postgapalreadyinimage HRESULT // put_PostgapAlreadyInImage( VARIANT_BOOL value ); [DispId(260)] bool PostgapAlreadyInImage { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the current state of the media in the device. /// /// State of the media in the disc device. For possible values, see the IMAPI_FORMAT2_DATA_MEDIA_STATE enumeration type. Note that /// more than one state can be set. /// /// For an example that uses this property, see Checking Media Support. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-get_currentmediastatus HRESULT // get_CurrentMediaStatus( IMAPI_FORMAT2_DATA_MEDIA_STATE *value ); [DispId(262)] IMAPI_FORMAT2_DATA_MEDIA_STATE CurrentMediaStatus { get; } /// Retrieves the current write protect state of the media in the device. /// /// /// The current write protect state of the media in the device. For possible values, see the IMAPI_MEDIA_WRITE_PROTECT_STATE /// enumeration type. /// /// Note that more than one state can be set. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-get_writeprotectstatus HRESULT // get_WriteProtectStatus( IMAPI_MEDIA_WRITE_PROTECT_STATE *value ); [DispId(263)] IMAPI_MEDIA_WRITE_PROTECT_STATE WriteProtectStatus { get; } /// Retrieves the number of sectors on the media in the device. /// Number of sectors on the media in the device. The number includes free sectors, used sectors, and the boot sector. /// This value does not necessarily reflect the total usable sectors on the media, not even for a blank disc. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-get_totalsectorsonmedia HRESULT // get_TotalSectorsOnMedia( LONG *value ); [DispId(264)] int TotalSectorsOnMedia { get; } /// Retrieves the number of free sectors on the disc for incremental recording (without overwriting existing data). /// Number of free sectors on the media in the device. /// /// /// The value of this property is effectively the number of sectors available on disc for the write operation. The value filters /// sectors consumed in managing the disc space and data quality, such as run-out blocks and postgaps. /// /// /// Note For overwritable discs, which have only one physical session, the number of free sectors indicated by value will /// always be the total number of sectors on the disc. /// /// /// If IDiscFormat2Data::put_ForceOverwrite is set to VARIANT_TRUE, use the IDiscFormat2Data::get_TotalSectorsOnMedia property instead. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-get_freesectorsonmedia HRESULT // get_FreeSectorsOnMedia( LONG *value ); [DispId(265)] int FreeSectorsOnMedia { get; } /// Retrieves the location for the next write operation. /// Address where the next write operation begins. /// /// Blank media begin writing at location zero. /// In multi-session writing, the next writable address is useful for setting up a correct file system. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-get_nextwritableaddress HRESULT // get_NextWritableAddress( LONG *value ); [DispId(266)] int NextWritableAddress { get; } /// Retrieves the first sector of the previous write session. /// /// Address where the previous write operation began. /// /// The value is -1 if the media is blank or does not support multi-session writing (indicates that no previous session could be detected). /// /// /// /// Note This property should not be used. Instead, you should use an interface derived from IMultisession, such as /// IMultisessionSequential, for importing file data from the previous session. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-get_startaddressofprevioussession HRESULT // get_StartAddressOfPreviousSession( LONG *value ); [DispId(267)] int StartAddressOfPreviousSession { get; } /// Retrieves the last sector of the previous write session. /// /// Address where the previous write operation ended. /// /// The value is -1 if the media is blank or does not support multi-session writing (indicates that no previous session could be detected). /// /// /// /// Note This property should not be used. Instead, you should use an interface derived from IMultisession, such as /// IMultisessionSequential, for importing file data from the previous session. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-get_lastwrittenaddressofprevioussession // HRESULT get_LastWrittenAddressOfPreviousSession( LONG *value ); [DispId(268)] int LastWrittenAddressOfPreviousSession { get; } /// Determines if further additions to the file system are prevented. /// /// Set to VARIANT_TRUE to mark the disc as closed to prohibit additional writes when the next write session ends. /// Set to VARIANT_FALSE to keep the disc open for subsequent write sessions. The default is VARIANT_FALSE. /// /// /// /// When the free space on a disc reaches 2% or less, the write process marks the disc closed, regardless of the value of this /// property. This action ensures that a disc has enough free space to record a file system in a write session. /// /// You can erase a rewritable disc that is marked closed. /// /// Note that the IDiscFormat2Data::put_DisableConsumerDvdCompatibilityMode property may supersede this property. Please refer to /// put_DisableConsumerDvdCompatibilityMode for details. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-put_forcemediatobeclosed HRESULT // put_ForceMediaToBeClosed( VARIANT_BOOL value ); [DispId(269)] bool ForceMediaToBeClosed { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Determines if a DVD recording session includes tasks that can increase the chance that a device can play the DVD. /// /// /// Set to VARIANT_TRUE to skip the tasks that allow the disc to play on more consumer devices. Removing compatibility reduces the /// recording session time and the need for less free space on disc. /// /// Set to VARIANT_FALSE to increase the chance that a device can play the DVD. The default is VARIANT_FALSE. /// /// /// This property has no affect on CD media and DVD dash media. /// For DVD+R and DVD+DL media, this property will also affect the media closing operation. /// /// /// Value of DisableConsumerDvdCompatibilityMode /// Value of ForceMediaToBeClosed /// Closure operation /// /// /// False /// True /// Closes the disc in compatible mode /// /// /// Fale /// False /// Closes the disc in compatible mode /// /// /// True /// True /// Closes the disc normally /// /// /// True /// False /// Closes the session for DVD+RCloses disc normally for DVD+R DL /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-put_disableconsumerdvdcompatibilitymode // HRESULT put_DisableConsumerDvdCompatibilityMode( VARIANT_BOOL value ); [DispId(270)] bool DisableConsumerDvdCompatibilityMode { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the type of media in the disc device. /// Type of media in the disc device. For possible values, see the IMAPI_MEDIA_PHYSICAL_TYPEenumeration type. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-get_currentphysicalmediatype HRESULT // get_CurrentPhysicalMediaType( IMAPI_MEDIA_PHYSICAL_TYPE *value ); [DispId(271)] IMAPI_MEDIA_PHYSICAL_TYPE CurrentPhysicalMediaType { get; } /// Sets the friendly name of the client. /// Name of the client application. Cannot be NULL or an empty string. /// /// /// The name is used when the write operation requests exclusive access to the device. The IDiscRecorder2::get_ExclusiveAccessOwner /// property contains the name of the client that has the lock. /// /// /// Because any application with read/write access to the CDROM device during the write operation can use the /// IOCTL_CDROM_EXCLUSIVE_ACCESS (query) control code (see the Microsoft Windows Driver Development Kit (DDK)) to access the name, /// it is important that the name identify the program that is using this interface to write to the media. The name is restricted to /// the same character set as required by the IOCTL_CDROM_EXCLUSIVE_ACCESS control code. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-put_clientname HRESULT put_ClientName( BSTR // value ); [DispId(272)] string ClientName { set; [return: MarshalAs(UnmanagedType.BStr)] get; } /// Retrieves the requested write speed. /// /// Requested write speed measured in disc sectors per second. /// A value of 0xFFFFFFFF (-1) requests that the write occurs using the fastest supported speed for the media. /// /// This is the value specified in the most recent call to the IDiscFormat2Data::SetWriteSpeed method. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-get_requestedwritespeed HRESULT // get_RequestedWriteSpeed( LONG *value ); [DispId(273)] int RequestedWriteSpeed { get; } /// Retrieves the requested rotational-speed control type. /// /// Requested rotational-speed control type. Is VARIANT_TRUE for constant angular velocity (CAV) rotational-speed control type. /// Otherwise, is VARIANT_FALSE for any other rotational-speed control type that the recorder supports. /// /// This is the value specified in the most recent call to the IDiscFormat2Data::SetWriteSpeed method. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-get_requestedrotationtypeispurecav HRESULT // get_RequestedRotationTypeIsPureCAV( VARIANT_BOOL *value ); [DispId(274)] bool RequestedRotationTypeIsPureCAV { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the drive's current write speed. /// The write speed of the current media, measured in sectors per second. /// /// To retrieve the requested write speed, call the IDiscFormat2Data::get_RequestedWriteSpeed method. /// /// To retrieve a list of the write speeds that the recorder and current media supports, call the /// IDiscFormat2Data::get_SupportedWriteSpeeds method. /// /// /// Note that the write speed is based on the media write speeds. The value of this property can change when a media change occurs. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-get_currentwritespeed HRESULT // get_CurrentWriteSpeed( LONG *value ); [DispId(275)] int CurrentWriteSpeed { get; } /// Retrieves the current rotational-speed control used by the recorder. /// /// Is VARIANT_TRUE if constant angular velocity (CAV) rotational-speed control is in use. Otherwise, VARIANT_FALSE to indicate that /// another rotational-speed control that the recorder supports is in use. /// /// /// To retrieve the requested rotational-speed control, call the IDiscFormat2Data::get_RequestedRotationTypeIsPureCAV method. /// Rotational-speed control types include the following: /// /// /// CLV (Constant Linear Velocity). The disc is written at a constant speed. Standard rotational control. /// /// /// CAV (Constant Angular Velocity). The disc is written at a constantly increasing speed. /// /// /// /// ZCAV (Zone Constant Linear Velocity). The disc is divided into zones. After each zone, the write speed increases. This is an /// impure form of CAV. /// /// /// /// /// PCAV (Partial Constant Angular Velocity). The disc speed increases up to a specified velocity. Once reached, the disc spins at /// the specified velocity for the duration of the disc writing. /// /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-get_currentrotationtypeispurecav HRESULT // get_CurrentRotationTypeIsPureCAV( VARIANT_BOOL *value ); [DispId(276)] bool CurrentRotationTypeIsPureCAV { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves a list of the write speeds supported by the disc recorder and current media. /// /// List of the write speeds supported by the disc recorder and current media. Each element of the array is a VARIANT of type /// VT_UI4. The ulVal member of the variant contains the number of sectors written per second. /// /// /// You can use a speed from the list to set the write speed when calling the IDiscFormat2Data::SetWriteSpeed method. /// /// To retrieve a list of the write configurations that the recorder and current media supports, call the /// IDiscFormat2Data::get_SupportedWriteSpeedDescriptors method. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-get_supportedwritespeeds HRESULT // get_SupportedWriteSpeeds( SAFEARRAY **supportedSpeeds ); [DispId(277)] uint[] SupportedWriteSpeeds { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; } /// Retrieves a list of the detailed write configurations supported by the disc recorder and current media. /// /// List of the detailed write configurations supported by the disc recorder and current media. Each element of the array is a /// VARIANT of type VT_Dispatch. Query the pdispVal member of the variant for the IWriteSpeedDescriptor /// interface, which contains the media type, write speed, rotational-speed control type. /// /// /// To retrieve a list of the write speeds that the recorder and current media supports, call the /// IDiscFormat2Data::get_SupportedWriteSpeeds method. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-get_supportedwritespeeddescriptors HRESULT // get_SupportedWriteSpeedDescriptors( SAFEARRAY **supportedSpeedDescriptors ); [DispId(278)] IWriteSpeedDescriptor[] SupportedWriteSpeedDescriptors { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; } /// Determines if the data writer must overwrite the disc on overwritable media types. /// /// Is VARIANT_TRUE if the data writer must overwrite the disc on overwritable media types; otherwise, VARIANT_FALSE. The default is VARIANT_FALSE. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-put_forceoverwrite HRESULT // put_ForceOverwrite( VARIANT_BOOL value ); [DispId(279)] bool ForceOverwrite { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves a list of available multi-session interfaces. /// /// List of available multi-session interfaces. Each element of the array is a VARIANT of type VT_DISPATCH. Query the /// pdispVal member of the variant for any interface that inherits from IMultisession interface, for example, IMultisessionSequential. /// /// The array will always contain at least one element. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-get_multisessioninterfaces HRESULT // get_MultisessionInterfaces( SAFEARRAY **value ); [DispId(280)] IMultisession[] MultisessionInterfaces { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; } /// Writes the data stream to the device. /// An IStream interface of the data stream to write. /// /// Before calling this method, you must call the following methods: /// /// /// IDiscFormat2Data::put_Recorder /// /// /// IDiscFormat2Data::put_ClientName /// /// /// You should also consider calling the following methods if their default values are not appropriate for your application: /// /// /// IDiscFormat2Data::put_BufferUnderrunFreeDisabled /// /// /// IDiscFormat2Data::put_DisableConsumerDvdCompatibilityMode /// /// /// IDiscFormat2Data::put_ForceMediaToBeClosed /// /// /// IDiscFormat2Data::put_ForceOverwrite /// /// /// IDiscFormat2Data::put_PostgapAlreadyInImage /// /// /// IDiscFormat2Data::SetWriteSpeed /// /// /// /// This method is synchronous, which means that control is not returned until the provided IStream is recorded to the media. /// To determine the progress of the write operation, you must implement the DDiscFormat2DataEvents interface. For examples that /// show how to implement an event handler in a script, see Monitoring Progress With Events. /// /// /// On sequentially recorded discs, the provided IStream is recorded as a new session. On rewritable discs, the provided /// IStream is always recorded starting from sector 0, but the object providing the IStream interface can also provide /// the IBlockRangeList interface listing the sectors that need to be recorded. The IBlockRangeList interface is used to /// avoid rewriting of sectors that have not changed in multisession scenarios. If the object providing IStream does not /// provide IBlockRangeList, it is assumed that the entire IStream needs to be recorded. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-write HRESULT Write( IStream *data ); [DispId(512)] void Write([In, MarshalAs(UnmanagedType.Interface)] IStream data); /// Cancels the current write operation. /// /// /// To cancel the write operation, you must call this method from the DDiscFormat2DataEvents::Update event handler that you implemented. /// /// /// Note that calling this method does not immediately cancel the write operation on all media due to media-specific requirements. /// For example, when writing to a CD, the write operation can continue for up to three more minutes. /// /// /// This method leaves the media in an indeterminate state. For rewriteable media, you should call the IDiscFormat2Erase::EraseMedia /// method after calling this method to prepare the media for future use. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-cancelwrite HRESULT CancelWrite(); [DispId(513)] void CancelWrite(); /// Sets the write speed of the disc recorder. /// /// Requested write speed measured in disc sectors per second. /// /// A value of 0xFFFFFFFF (-1) requests that the write occurs using the fastest supported speed for the media. This is the default. /// /// /// /// Requested rotational-speed control type. Set to VARIANT_TRUE to request constant angular velocity (CAV) rotational-speed control /// type. Set to VARIANT_FALSE to use another rotational-speed control type that the recorder supports. The default is VARIANT_FALSE. /// /// /// /// This method sets the write speed and type of rotational-speed control for a recorder. Requested values might differ from the /// values set in the recorder. To specify the recorder, call the IDiscFormat2Data::put_Recorder method. /// /// /// If the recorder supports the requested write speed, the disc device uses the requested value. If the recorder does not support /// the requested write speed, the recorder uses a write speed that it does support that is closest to the requested value. The /// IDiscFormat2Data::get_CurrentWriteSpeed property contains the value used by the recorder. /// /// /// To retrieve a list of the write speeds that the recorder and current media supports, call the /// IDiscFormat2Data::get_SupportedWriteSpeeds method. /// /// /// If you request constant angular velocity (CAV) for rotational-speed control type and the recorder does not support CAV, the disc /// device uses another type of rotational-speed control type that it supports. The /// IDiscFormat2Data::get_CurrentRotationTypeIsPureCAV property indicates the value used by the recorder. /// /// /// To retrieve the requested values, call the IDiscFormat2Data::get_RequestedWriteSpeed and /// IDiscFormat2Data::get_RequestedRotationTypeIsPureCAV methods. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-setwritespeed HRESULT SetWriteSpeed( LONG // RequestedSectorsPerSecond, VARIANT_BOOL RotationTypeIsPureCAV ); [DispId(514)] void SetWriteSpeed(int RequestedSectorsPerSecond, [In, MarshalAs(UnmanagedType.VariantBool)] bool RotationTypeIsPureCAV); } /// /// Use this interface to retrieve information about the current write operation. /// This interface is passed to the DDiscFormat2DataEvents::Update method that you implement. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-idiscformat2dataeventargs [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IDiscFormat2DataEventArgs")] [ComImport, Guid("2735413D-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface IDiscFormat2DataEventArgs : IWriteEngine2EventArgs { /// Retrieves the starting logical block address (LBA) of the current write operation. /// Starting logical block address of the write operation. Negative values for LBAs are supported. /// This is the same value passed to the IWriteEngine2::WriteSection method. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_startlba HRESULT get_StartLba( // LONG *value ); [DispId(0x100)] new int StartLba { get; } /// Retrieves the number of sectors to write to the device in the current write operation. /// The number of sectors to write in the current write operation. /// This is the same value passed to the IWriteEngine2::WriteSection method. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_sectorcount HRESULT // get_SectorCount( LONG *value ); [DispId(0x101)] new int SectorCount { get; } /// Retrieves the address of the sector most recently read from the burn image. /// Logical block address of the sector most recently read from the input data stream. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_lastreadlba HRESULT // get_LastReadLba( LONG *value ); [DispId(0x102)] new int LastReadLba { get; } /// Retrieves the address of the sector most recently written to the device. /// Logical block address of the sector most recently written to the device. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_lastwrittenlba HRESULT // get_LastWrittenLba( LONG *value ); [DispId(0x103)] new int LastWrittenLba { get; } /// Retrieves the size of the internal data buffer that is used for writing to disc. /// Size, in bytes, of the internal data buffer that is used for writing to disc. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_totalsystembuffer HRESULT // get_TotalSystemBuffer( LONG *value ); [DispId(0x106)] new int TotalSystemBuffer { get; } /// Retrieves the number of used bytes in the internal data buffer that is used for writing to disc. /// Size, in bytes, of the used portion of the internal data buffer that is used for writing to disc. /// This value increases as data is read into the buffer and decreases as data is written to disc. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_usedsystembuffer HRESULT // get_UsedSystemBuffer( LONG *value ); [DispId(0x107)] new int UsedSystemBuffer { get; } /// Retrieves the number of unused bytes in the internal data buffer that is used for writing to disc. /// Size, in bytes, of the unused portion of the internal data buffer that is used for writing to disc. /// This method returns the same value as if you subtracted IWriteEngine2EventArgs::get_UsedSystemBuffer from IWriteEngine2EventArgs::get_TotalSystemBuffer. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_freesystembuffer HRESULT // get_FreeSystemBuffer( LONG *value ); [DispId(0x108)] new int FreeSystemBuffer { get; } /// Retrieves the total elapsed time of the write operation. /// Elapsed time, in seconds, of the write operation. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2dataeventargs-get_elapsedtime HRESULT // get_ElapsedTime( LONG *value ); [DispId(768)] int ElapsedTime { get; } /// Retrieves the estimated remaining time of the write operation. /// Estimated time, in seconds, needed for the remainder of the write operation. /// /// The estimate for a single write operation can vary as the operation progresses. The drive provides updated information that can /// affect the projected duration of the write operation. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2dataeventargs-get_remainingtime HRESULT // get_RemainingTime( LONG *value ); [DispId(769)] int RemainingTime { get; } /// Retrieves the estimated total time for write operation. /// Estimated time, in seconds, for write operation. /// /// The estimate for a single write operation can vary as the operation progresses. The drive provides updated information that can /// affect the projected duration of the write operation. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2dataeventargs-get_totaltime HRESULT // get_TotalTime( LONG *value ); [DispId(770)] int TotalTime { get; } /// Retrieves the current write action being performed. /// /// Current write action being performed. For a list of possible actions, see the IMAPI_FORMAT2_DATA_WRITE_ACTION enumeration type. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2dataeventargs-get_currentaction HRESULT // get_CurrentAction( IMAPI_FORMAT2_DATA_WRITE_ACTION *value ); [DispId(771)] IMAPI_FORMAT2_DATA_WRITE_ACTION CurrentAction { get; } } /// /// Use this interface to erase data from a disc. /// /// To create an instance of this interface, call the CoCreateInstance function. Use__uuidof(MsftDiscFormat2Erase) for the class /// identifier and __uuidof(IDiscFormat2Erase) for the interface identifier. /// /// /// /// To create the MsftDiscFormat2Erase object in a script, use IMAPI2.MsftDiscFormat2Erase as the program identifier when calling CreateObject. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-idiscformat2erase [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IDiscFormat2Erase")] [ComImport, Guid("27354156-8F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual), CoClass(typeof(MsftDiscFormat2Erase))] public interface IDiscFormat2Erase : IDiscFormat2 { /// Determines if the recorder supports the given format. /// An IDiscRecorder2 interface of the recorder to test. /// Is VARIANT_TRUE if the recorder supports the given format; otherwise, VARIANT_FALSE. /// /// When implemented by the IDiscFormat2RawCD interface, this method will return E_IMAPI_DF2RAW_MEDIA_IS_NOT_SUPPORTED in the event /// the recorder does not support the given format. It is important to note that in this specific scenario the value does not /// indicate that an error has occurred, but rather the result of a successful operation. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-isrecordersupported HRESULT IsRecorderSupported( // IDiscRecorder2 *recorder, VARIANT_BOOL *value ); [DispId(2048)] [return: MarshalAs(UnmanagedType.VariantBool)] new bool IsRecorderSupported(IDiscRecorder2 recorder); /// Determines if the current media in a supported recorder supports the given format. /// An IDiscRecorder2 interface of the recorder to test. /// /// Is VARIANT_TRUE if the media in the recorder supports the given format; otherwise, VARIANT_FALSE. /// Note VARIANT_TRUE also implies that the result from IsDiscRecorderSupported is VARIANT_TRUE. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-iscurrentmediasupported HRESULT // IsCurrentMediaSupported( IDiscRecorder2 *recorder, VARIANT_BOOL *value ); [DispId(2049)] [return: MarshalAs(UnmanagedType.VariantBool)] new bool IsCurrentMediaSupported(IDiscRecorder2 recorder); /// Determines if the current media is reported as physically blank by the drive. /// Is VARIANT_TRUE if the disc is physically blank; otherwise, VARIANT_FALSE. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-get_mediaphysicallyblank HRESULT // get_MediaPhysicallyBlank( VARIANT_BOOL *value ); [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). /// Is VARIANT_TRUE if the disc is likely to be blank; otherwise; VARIANT_FALSE. /// /// /// This method checks, for example, for a mounted file system on the device, verifying the first and last 2MB of the disc are /// filled with zeros, and other media-specific checks. These checks can help to determine if the media may have files on it for /// media that cannot be erased physically to a blank status. /// /// For a positive check that a disc is blank, call the IDiscFormat2::get_MediaPhysicallyBlank method. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-get_mediaheuristicallyblank HRESULT // get_MediaHeuristicallyBlank( VARIANT_BOOL *value ); [DispId(1793)] new bool MediaHeuristicallyBlank { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the media types that are supported by the current implementation of the IDiscFormat2 interface. /// /// List of media types supported by the current implementation of the IDiscFormat2 interface. Each element of the array is a /// VARIANT of type VT_I4. The lVal member of VARIANT contains the media type. For a list of media /// types, see the IMAPI_MEDIA_PHYSICAL_TYPE enumeration type. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-get_supportedmediatypes HRESULT // get_SupportedMediaTypes( SAFEARRAY **value ); [DispId(1794)] new IMAPI_MEDIA_PHYSICAL_TYPE[] SupportedMediaTypes { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; } /// Sets the recording device to use in the erase operation. /// An IDiscRecorder2 interface that identifies the recording device to use in the erase operation. /// /// The recorder must be compatible with the format defined by this interface. To determine compatibility, call the /// IDiscFormat2::IsRecorderSupported method. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2erase-put_recorder HRESULT put_Recorder( // IDiscRecorder2 *value ); [DispId(0x100)] IDiscRecorder2 Recorder { set; [return: MarshalAs(UnmanagedType.Interface)] get; } /// Determines the quality of the disc erasure. /// /// Set to VARIANT_TRUE to fully erase the disc by overwriting the entire medium at least once. /// /// Set to VARIANT_FALSE to overwrite the directory tracks, but not the entire disc. This option requires less time to perform than /// the full erase option. /// /// The default is VARIANT_FALSE. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2erase-put_fullerase HRESULT put_FullErase( // VARIANT_BOOL value ); [DispId(0x101)] bool FullErase { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the type of media in the disc device. /// Type of media in the disc device. For possible values, see the IMAPI_MEDIA_PHYSICAL_TYPEenumeration type. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2erase-get_currentphysicalmediatype HRESULT // get_CurrentPhysicalMediaType( IMAPI_MEDIA_PHYSICAL_TYPE *value ); [DispId(0x102)] IMAPI_MEDIA_PHYSICAL_TYPE CurrentPhysicalMediaType { get; } /// Sets the friendly name of the client. /// Name of the client application. /// /// /// The name is used when the write operation requests exclusive access to the device. The IDiscRecorder2::get_ExclusiveAccessOwner /// property contains the name of the client that has the lock. /// /// /// Because any application with read/write access to the CDROM device during the erase operation can use the /// IOCTL_CDROM_EXCLUSIVE_ACCESS (query) control code (see the Microsoft Windows Driver Development Kit (DDK)) to access the name, /// it is important that the name identify the program that is using this interface to erase to the media. The name is restricted to /// the same character set as required by the IOCTL_CDROM_EXCLUSIVE_ACCESS control code. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2erase-put_clientname HRESULT put_ClientName( BSTR // value ); [DispId(0x103)] string ClientName { set; [return: MarshalAs(UnmanagedType.BStr)] get; } /// Erases the media in the active disc recorder. /// /// Synchronously erases the media. Progress can be reported by calling into registered events of type DDiscFormat2EraseEvents. /// Before calling this method, you must call the following methods: /// /// /// IDiscFormat2Erase::put_Recorder /// /// /// IDiscFormat2Erase::put_ClientName /// /// /// /// You should also consider calling the IDiscFormat2Erase::put_FullErase method if its default value is not appropriate for your application. /// /// /// This method is synchronous. To determine the progress of the erase operation, you must implement the DDiscFormat2EraseEvents /// interface. For examples that show how to implement an event handler in a script, see Monitoring Progress With Events. /// /// /// Currently, the E_IMAPI_ERASE_TOOK_LONGER_THAN_ONE_HOUR value is returned if an attempt to perform an erase on CD-RW or DVD-RW /// media via the IDiscFormat2Erase interface fails as a result of the media being bad or a drive failure. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2erase-erasemedia HRESULT EraseMedia(); [DispId(0x201)] void EraseMedia(); } /// /// /// Use this interface to write raw images to a disc device using Disc At Once (DAO) mode (also known as uninterrupted recording). For /// information on DAO mode, see the latest revision of the MMC specification at ftp://ftp.t10.org/t10/drafts/mmc5. /// /// /// To create an instance of this interface, call the CoCreateInstance function. Use__uuidof(MsftDiscFormat2RawCD) for the class /// identifier and __uuidof(IDiscFormat2RawCD) for the interface identifier. /// /// /// /// /// To create the MsftDiscFormat2RawCD object in a script, use IMAPI2.MsftDiscFormat2RawCD as the program identifier when calling CreateObject. /// /// /// It is possible for a power state transition to take place during a burn operation (i.e. user log-off or system suspend) which leads /// to the interruption of the burn process and possible data loss. For programming considerations, see Preventing Logoff or Suspend /// During a Burn. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-idiscformat2rawcd [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IDiscFormat2RawCD")] [ComImport, Guid("27354155-8F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual), CoClass(typeof(MsftDiscFormat2RawCD))] public interface IDiscFormat2RawCD : IDiscFormat2 { /// Determines if the recorder supports the given format. /// An IDiscRecorder2 interface of the recorder to test. /// Is VARIANT_TRUE if the recorder supports the given format; otherwise, VARIANT_FALSE. /// /// When implemented by the IDiscFormat2RawCD interface, this method will return E_IMAPI_DF2RAW_MEDIA_IS_NOT_SUPPORTED in the event /// the recorder does not support the given format. It is important to note that in this specific scenario the value does not /// indicate that an error has occurred, but rather the result of a successful operation. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-isrecordersupported HRESULT IsRecorderSupported( // IDiscRecorder2 *recorder, VARIANT_BOOL *value ); [DispId(2048)] [return: MarshalAs(UnmanagedType.VariantBool)] new bool IsRecorderSupported(IDiscRecorder2 recorder); /// Determines if the current media in a supported recorder supports the given format. /// An IDiscRecorder2 interface of the recorder to test. /// /// Is VARIANT_TRUE if the media in the recorder supports the given format; otherwise, VARIANT_FALSE. /// Note VARIANT_TRUE also implies that the result from IsDiscRecorderSupported is VARIANT_TRUE. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-iscurrentmediasupported HRESULT // IsCurrentMediaSupported( IDiscRecorder2 *recorder, VARIANT_BOOL *value ); [DispId(2049)] [return: MarshalAs(UnmanagedType.VariantBool)] new bool IsCurrentMediaSupported(IDiscRecorder2 recorder); /// Determines if the current media is reported as physically blank by the drive. /// Is VARIANT_TRUE if the disc is physically blank; otherwise, VARIANT_FALSE. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-get_mediaphysicallyblank HRESULT // get_MediaPhysicallyBlank( VARIANT_BOOL *value ); [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). /// Is VARIANT_TRUE if the disc is likely to be blank; otherwise; VARIANT_FALSE. /// /// /// This method checks, for example, for a mounted file system on the device, verifying the first and last 2MB of the disc are /// filled with zeros, and other media-specific checks. These checks can help to determine if the media may have files on it for /// media that cannot be erased physically to a blank status. /// /// For a positive check that a disc is blank, call the IDiscFormat2::get_MediaPhysicallyBlank method. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-get_mediaheuristicallyblank HRESULT // get_MediaHeuristicallyBlank( VARIANT_BOOL *value ); [DispId(1793)] new bool MediaHeuristicallyBlank { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the media types that are supported by the current implementation of the IDiscFormat2 interface. /// /// List of media types supported by the current implementation of the IDiscFormat2 interface. Each element of the array is a /// VARIANT of type VT_I4. The lVal member of VARIANT contains the media type. For a list of media /// types, see the IMAPI_MEDIA_PHYSICAL_TYPE enumeration type. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-get_supportedmediatypes HRESULT // get_SupportedMediaTypes( SAFEARRAY **value ); [DispId(1794)] new IMAPI_MEDIA_PHYSICAL_TYPE[] SupportedMediaTypes { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; } /// Locks the current media for exclusive access. /// /// Before calling this method, you must call the IDiscFormat2RawCD::put_ClientName method. /// /// Also, you must call the IDiscFormat2RawCD::PrepareMedia method before calling either the IDiscFormat2RawCD::WriteMedia or /// IDiscFormat2RawCD::WriteMedia2 method. /// /// /// After the write is complete or you cancel the write operation, you must call the IDiscFormat2RawCD::ReleaseMedia method to /// release the lock. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcd-preparemedia HRESULT PrepareMedia(); [DispId(0x200)] void PrepareMedia(); /// Writes a DAO-96 raw image to the blank media using MSF 95:00:00 as the starting address. /// An IStream interface of the data stream to write. /// /// Before calling this method, you must call the IDiscFormat2RawCD::put_Recorder and IDiscFormat2RawCD::PrepareMedia methods. /// You should also consider calling the following methods if their default values are not appropriate for your application: /// /// /// IDiscFormat2RawCD::put_BufferUnderrunFreeDisabled /// /// /// IDiscFormat2RawCD::put_ClientName /// /// /// IDiscFormat2RawCD::put_RequestedSectorType /// /// /// IDiscFormat2RawCD::SetWriteSpeed /// /// /// /// This method is synchronous. To determine the progress of the write operation, you must implement the DDiscFormat2RawCDEvents /// interface. For examples that show how to implement an event handler in a script, see Monitoring Progress With Events. /// /// /// The first sector of the raw image is written at MSF 95:00:00. If your RAW image has a different first sector, please use the /// IDiscFormat2RawCD::WriteMedia2 method. /// /// /// This method uses the IStream::Seek method to reach the appropriate starting location in the image for the current media. /// If the IStream::Seek method fails, the method will call the IStream::Read method repeatedly until reaching the /// starting sector. /// /// /// The DAO-96 standard allows writing of any type of data to CD media. One common usage is to write audio CDs without a 2-second /// gap between tracks. /// /// DAO-96 also supports variations in the subcode content, such as CD+G and CD-Text. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcd-writemedia HRESULT WriteMedia( IStream // *data ); [DispId(0x201)] void WriteMedia(IStream data); /// Writes a DAO-96 raw image to the blank media using a specified starting address. /// An IStream interface of the data stream to write. /// Starting address at which to begin writing the data stream. /// /// This method is identical in function to the IDiscFormat2RawCD::WriteMedia method, except that it allows for a starting /// time other than 95:00:00. For details, please see the IDiscFormat2RawCD::WriteMedia method. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcd-writemedia2 HRESULT WriteMedia2( IStream // *data, LONG streamLeadInSectors ); [DispId(0x202)] void WriteMedia2(IStream data, int streamLeadInSectors); /// Cancels the current write operation. /// /// /// To cancel the write operation, you must call this method from the DDiscFormat2RawCDEvents::Update event handler that you implemented. /// /// You must also call the IDiscFormat2RawCD::ReleaseMedia method after calling this method. /// /// Note that calling this method does not immediately cancel the write operation on all media due to media-specific requirements. /// For example, when writing to a CD, the write operation can continue for up to three more minutes. /// /// /// This method leaves the media in an indeterminate state. For rewriteable media, you should call the IDiscFormat2Erase::EraseMedia /// method after calling this method to prepare the media for future use. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcd-cancelwrite HRESULT CancelWrite(); [DispId(0x203)] void CancelWrite(); /// Closes a Disc-At-Once (DAO) writing session of a raw image and releases the lock. /// /// This method release the lock set when you called the IDiscFormat2RawCD::PrepareMedia method. You must call this method after the /// write operation completes or after calling IDiscFormat2RawCD::CancelWrite to cancel a writing operation. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcd-releasemedia HRESULT ReleaseMedia(); [DispId(0x204)] void ReleaseMedia(); /// Sets the write speed of the disc recorder. /// /// Requested write speed measured in disc sectors per second. /// /// A value of 0xFFFFFFFF (-1) requests that the write occurs using the fastest supported speed for the media. This is the default. /// /// /// /// Requested rotational-speed control type. Set to VARIANT_TRUE to request constant angular velocity (CAV) rotational-speed control /// type. Set to VARIANT_FALSE to use another rotational-speed control type that the recorder supports. The default is VARIANT_FALSE. /// /// /// /// This method sets the write speed and type of rotational-speed control for a recorder. Requested values might differ from the /// values set in the recorder. To specify the recorder, call the IDiscFormat2RawCD::put_Recorder method. /// /// /// If the recorder supports the requested write speed, the disc device uses the requested value. If the recorder does not support /// the requested write speed, the recorder uses a write speed that it does support that is closest to the requested value. The /// IDiscFormat2RawCD::get_CurrentWriteSpeed property contains the value used by the recorder. /// /// /// To retrieve a list of the write speeds that the recorder and current media supports, call the /// IDiscFormat2RawCD::get_SupportedWriteSpeeds method. /// /// /// If you request constant angular velocity (CAV) for rotational-speed control type and the recorder does not support CAV, the disc /// device uses another type of rotational-speed control type that it supports. The /// IDiscFormat2RawCD::get_CurrentRotationTypeIsPureCAV property indicates the value used by the recorder. /// /// /// To retrieve the requested values, call the IDiscFormat2RawCD::get_RequestedWriteSpeed and /// IDiscFormat2RawCD::get_RequestedRotationTypeIsPureCAV methods. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcd-setwritespeed HRESULT SetWriteSpeed( LONG // RequestedSectorsPerSecond, VARIANT_BOOL RotationTypeIsPureCAV ); [DispId(0x205)] void SetWriteSpeed(int RequestedSectorsPerSecond, [MarshalAs(UnmanagedType.VariantBool)] bool RotationTypeIsPureCAV); /// Retrieves the recording device to use for the write operation. /// An IDiscRecorder2 interface that identifies the recording device to use in the write operation. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcd-get_recorder HRESULT get_Recorder( // IDiscRecorder2 **value ); [DispId(0x100)] IDiscRecorder2 Recorder { set; [return: MarshalAs(UnmanagedType.Interface)] get; } /// Determines if Buffer Underrun Free recording is enabled. /// /// Set to VARIANT_TRUE to disable Buffer Underrun Free recording; otherwise, VARIANT_FALSE. The default is VARIANT_FALSE (enabled). /// /// /// Buffer underrun can be an issue if the data stream does not enter the buffer fast enough to keep the device continuously /// writing. In turn, the stop and start action of writing can cause data on the disc to be unusable. Buffer Underrun Free (BUF) /// recording allows the laser to start and stop without damaging data already written to the disc. Disabling of BUF recording is /// possible only on CD-R/RW media. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcd-put_bufferunderrunfreedisabled HRESULT // put_BufferUnderrunFreeDisabled( VARIANT_BOOL value ); [DispId(0x102)] bool BufferUnderrunFreeDisabled { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the first sector of the next session. /// Sector number for the start of the next write operation. This value can be negative for blank media. /// /// The client application that creates an image must provide appropriately sized lead-in and lead-out data. The application /// developer using the IDiscFormat2RawCD interface must understand the formats of lead-in and lead-out for the first and subsequent /// sessions. Note that lead-in LBA for the first session is negative. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcd-get_startofnextsession HRESULT // get_StartOfNextSession( LONG *value ); [DispId(0x103)] int StartOfNextSession { get; } /// Retrieves the last possible starting position for the leadout area. /// Sector address of the starting position for the leadout area. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcd-get_lastpossiblestartofleadout HRESULT // get_LastPossibleStartOfLeadout( LONG *value ); [DispId(0x104)] int LastPossibleStartOfLeadout { get; } /// Retrieves the type of media in the disc device. /// Type of media in the disc device. For possible values, see the IMAPI_MEDIA_PHYSICAL_TYPEenumeration type. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcd-get_currentphysicalmediatype HRESULT // get_CurrentPhysicalMediaType( IMAPI_MEDIA_PHYSICAL_TYPE *value ); [DispId(0x105)] IMAPI_MEDIA_PHYSICAL_TYPE CurrentPhysicalMediaType { get; } /// Retrieves the supported data sector types for the current recorder. /// /// /// List of data sector types for the current recorder. Each element of the list is a VARIANT of type VT_UI4. The /// ulVal member of the variant contains the data sector type. /// /// For a list of values of supported sector types, see IMAPI_FORMAT2_RAW_CD_DATA_SECTOR_TYPE. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcd-get_supportedsectortypes HRESULT // get_SupportedSectorTypes( SAFEARRAY **value ); [DispId(0x108)] IMAPI_FORMAT2_RAW_CD_DATA_SECTOR_TYPE[] SupportedSectorTypes { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; } /// Sets the requested data sector to use for writing the stream. /// /// Data sector to use for writing the stream. For possible values, see the IMAPI_FORMAT2_RAW_CD_DATA_SECTOR_TYPE enumeration type. /// The default is IMAPI_FORMAT2_RAW_CD_SUBCODE_IS_COOKED. /// /// For a list of supported data sector types, call the IDiscFormat2RawCD::get_SupportedSectorTypes method. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcd-put_requestedsectortype HRESULT // put_RequestedSectorType( IMAPI_FORMAT2_RAW_CD_DATA_SECTOR_TYPE value ); [DispId(0x109)] IMAPI_FORMAT2_RAW_CD_DATA_SECTOR_TYPE RequestedSectorType { set; get; } /// Sets the friendly name of the client. /// Name of the client application. Cannot be NULL or an empty string. /// /// /// The name is used when the write operation requests exclusive access to the device. The IDiscRecorder2::get_ExclusiveAccessOwner /// property contains the name of the client that has the lock. /// /// /// Because any application with read/write access to the CDROM device during the write operation can use the /// IOCTL_CDROM_EXCLUSIVE_ACCESS (query) control code (see the Microsoft Windows Driver Development Kit (DDK)) to access the name, /// it is important that the name identify the program that is using this interface to write to the media. The name is restricted to /// the same character set as required by the IOCTL_CDROM_EXCLUSIVE_ACCESS control code. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcd-put_clientname HRESULT put_ClientName( BSTR // value ); [DispId(0x10A)] string ClientName { set; [return: MarshalAs(UnmanagedType.BStr)] get; } /// Retrieves the requested write speed. /// /// Requested write speed measured in disc sectors per second. /// A value of 0xFFFFFFFF (-1) requests that the write occurs using the fastest supported speed for the media. /// /// This is the value specified in the most recent call to the IDiscFormat2RawCD::SetWriteSpeed method. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcd-get_requestedwritespeed HRESULT // get_RequestedWriteSpeed( LONG *value ); [DispId(0x10B)] int RequestedWriteSpeed { get; } /// Retrieves the requested rotational-speed control type. /// /// Requested rotational-speed control type. Is VARIANT_TRUE for constant angular velocity (CAV) rotational-speed control type. /// Otherwise, is VARIANT_FALSE for any other rotational-speed control type that the recorder supports. /// /// This is the value specified in the most recent call to the IDiscFormat2RawCD::SetWriteSpeed method. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcd-get_requestedrotationtypeispurecav HRESULT // get_RequestedRotationTypeIsPureCAV( VARIANT_BOOL *value ); [DispId(0x10C)] bool RequestedRotationTypeIsPureCAV { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the drive's current write speed. /// The write speed of the current media, measured in sectors per second. /// /// To retrieve the requested write speed, call the IDiscFormat2RawCD::get_RequestedWriteSpeed method. /// /// To retrieve a list of the write speeds that the recorder and current media supports, call the /// IDiscFormat2RawCD::get_SupportedWriteSpeeds method. /// /// /// Note that the write speed is based on the media write speeds. The value of this property can change when a media change occurs. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcd-get_currentwritespeed HRESULT // get_CurrentWriteSpeed( LONG *value ); [DispId(0x10D)] int CurrentWriteSpeed { get; } /// Retrieves the current rotational-speed control used by the recorder. /// /// Is VARIANT_TRUE if constant angular velocity (CAV) rotational-speed control is in use. Otherwise, VARIANT_FALSE to indicate that /// another rotational-speed control that the recorder supports is in use. /// /// /// To retrieve the requested rotational-speed control, call the IDiscFormat2RawCD::get_RequestedRotationTypeIsPureCAV method. /// Rotational-speed control types include the following: /// /// /// CLV (Constant Linear Velocity). The disc is written at a constant speed. Standard rotational control. /// /// /// CAV (Constant Angular Velocity). The disc is written at a constantly increasing speed. /// /// /// /// ZCAV (Zone Constant Linear Velocity). The disc is divided into zones. After each zone, the write speed increases. This is an /// impure form of CAV. /// /// /// /// /// PCAV (Partial Constant Angular Velocity). The disc speed increases up to a specified velocity. Once reached, the disc spins at /// the specified velocity for the duration of the disc writing. /// /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcd-get_currentrotationtypeispurecav HRESULT // get_CurrentRotationTypeIsPureCAV( VARIANT_BOOL *value ); [DispId(0x10E)] bool CurrentRotationTypeIsPureCAV { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves a list of the write speeds supported by the disc recorder and current media. /// /// List of the write speeds supported by the disc recorder and current media. Each element of the list is a VARIANT of type /// VT_UI4. The ulVal member of the variant contains the number of sectors written per second. /// /// /// You can use a speed from the list to set the write speed when calling the IDiscFormat2RawCD::SetWriteSpeed method. /// /// To retrieve a list of the write configurations that the recorder and current media supports, call the /// IDiscFormat2RawCD::get_SupportedWriteSpeedDescriptors method. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcd-get_supportedwritespeeds HRESULT // get_SupportedWriteSpeeds( SAFEARRAY **supportedSpeeds ); [DispId(0x10F)] uint[] SupportedWriteSpeeds { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; } /// Retrieves a list of the detailed write configurations supported by the disc recorder and current media. /// /// List of the detailed write configurations supported by the disc recorder and current media. Each element of the list is a /// VARIANT of type VT_Dispatch. Query the pdispVal member of the variant for the IWriteSpeedDescriptor /// interface, which contains the media type, write speed, rotational-speed control type. /// /// /// To retrieve a list of the write speeds that the recorder and current media supports, call the /// IDiscFormat2RawCD::get_SupportedWriteSpeeds method. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcd-get_supportedwritespeeddescriptors HRESULT // get_SupportedWriteSpeedDescriptors( SAFEARRAY **supportedSpeedDescriptors ); [DispId(0x110)] IWriteSpeedDescriptor[] SupportedWriteSpeedDescriptors { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; } } /// /// Use this interface to retrieve information about the current write operation. /// This interface is passed to the DDiscFormat2RawCDEvents::Update method that you implement. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-idiscformat2rawcdeventargs [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IDiscFormat2RawCDEventArgs")] [ComImport, Guid("27354143-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface IDiscFormat2RawCDEventArgs : IWriteEngine2EventArgs { /// Retrieves the starting logical block address (LBA) of the current write operation. /// Starting logical block address of the write operation. Negative values for LBAs are supported. /// This is the same value passed to the IWriteEngine2::WriteSection method. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_startlba HRESULT get_StartLba( // LONG *value ); [DispId(0x100)] new int StartLba { get; } /// Retrieves the number of sectors to write to the device in the current write operation. /// The number of sectors to write in the current write operation. /// This is the same value passed to the IWriteEngine2::WriteSection method. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_sectorcount HRESULT // get_SectorCount( LONG *value ); [DispId(0x101)] new int SectorCount { get; } /// Retrieves the address of the sector most recently read from the burn image. /// Logical block address of the sector most recently read from the input data stream. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_lastreadlba HRESULT // get_LastReadLba( LONG *value ); [DispId(0x102)] new int LastReadLba { get; } /// Retrieves the address of the sector most recently written to the device. /// Logical block address of the sector most recently written to the device. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_lastwrittenlba HRESULT // get_LastWrittenLba( LONG *value ); [DispId(0x103)] new int LastWrittenLba { get; } /// Retrieves the size of the internal data buffer that is used for writing to disc. /// Size, in bytes, of the internal data buffer that is used for writing to disc. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_totalsystembuffer HRESULT // get_TotalSystemBuffer( LONG *value ); [DispId(0x106)] new int TotalSystemBuffer { get; } /// Retrieves the number of used bytes in the internal data buffer that is used for writing to disc. /// Size, in bytes, of the used portion of the internal data buffer that is used for writing to disc. /// This value increases as data is read into the buffer and decreases as data is written to disc. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_usedsystembuffer HRESULT // get_UsedSystemBuffer( LONG *value ); [DispId(0x107)] new int UsedSystemBuffer { get; } /// Retrieves the number of unused bytes in the internal data buffer that is used for writing to disc. /// Size, in bytes, of the unused portion of the internal data buffer that is used for writing to disc. /// This method returns the same value as if you subtracted IWriteEngine2EventArgs::get_UsedSystemBuffer from IWriteEngine2EventArgs::get_TotalSystemBuffer. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_freesystembuffer HRESULT // get_FreeSystemBuffer( LONG *value ); [DispId(0x108)] new int FreeSystemBuffer { get; } /// Retrieves the current write action being performed. /// /// Current write action being performed. For a list of possible actions, see the IMAPI_FORMAT2_RAW_CD_WRITE_ACTION enumeration type. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcdeventargs-get_currentaction HRESULT // get_CurrentAction( IMAPI_FORMAT2_RAW_CD_WRITE_ACTION *value ); [DispId(0x301)] IMAPI_FORMAT2_RAW_CD_WRITE_ACTION CurrentAction { get; } /// Retrieves the total elapsed time of the write operation. /// Elapsed time, in seconds, of the write operation. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcdeventargs-get_elapsedtime HRESULT // get_ElapsedTime( LONG *value ); [DispId(0x302)] int ElapsedTime { get; } /// Retrieves the estimated remaining time of the write operation. /// Estimated time, in seconds, needed for the remainder of the write operation. /// /// The estimate for a single write operation can vary as the operation progresses. The drive provides updated information that can /// affect the projected duration of the write operation. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2rawcdeventargs-get_remainingtime HRESULT // get_RemainingTime( LONG *value ); [DispId(0x303)] int RemainingTime { get; } } /// /// Use this interface to write audio to blank CD-R or CD-RW media in Track-At-Once mode. /// /// To create an instance of this interface, call the CoCreateInstance function. Use__uuidof(MsftDiscFormat2TrackAtOnce) for the /// class identifier and __uuidof(IDiscFormat2TrackAtOnce) for the interface identifier. /// /// /// /// /// To create the MsftDiscFormat2TrackAtOnce object in a script, use IMAPI2.MsftDiscFormat2TrackAtOnce as the program identifier /// when calling CreateObject. /// /// /// It is possible for a power state transition to take place during a burn operation (i.e. user log-off or system suspend) which leads /// to the interruption of the burn process and possible data loss. For programming considerations, see Preventing Logoff or Suspend /// During a Burn. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-idiscformat2trackatonce [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IDiscFormat2TrackAtOnce")] [ComImport, Guid("27354154-8F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual), CoClass(typeof(MsftDiscFormat2TrackAtOnce))] public interface IDiscFormat2TrackAtOnce : IDiscFormat2 { /// Determines if the recorder supports the given format. /// An IDiscRecorder2 interface of the recorder to test. /// Is VARIANT_TRUE if the recorder supports the given format; otherwise, VARIANT_FALSE. /// /// When implemented by the IDiscFormat2RawCD interface, this method will return E_IMAPI_DF2RAW_MEDIA_IS_NOT_SUPPORTED in the event /// the recorder does not support the given format. It is important to note that in this specific scenario the value does not /// indicate that an error has occurred, but rather the result of a successful operation. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-isrecordersupported HRESULT IsRecorderSupported( // IDiscRecorder2 *recorder, VARIANT_BOOL *value ); [DispId(2048)] [return: MarshalAs(UnmanagedType.VariantBool)] new bool IsRecorderSupported(IDiscRecorder2 recorder); /// Determines if the current media in a supported recorder supports the given format. /// An IDiscRecorder2 interface of the recorder to test. /// /// Is VARIANT_TRUE if the media in the recorder supports the given format; otherwise, VARIANT_FALSE. /// Note VARIANT_TRUE also implies that the result from IsDiscRecorderSupported is VARIANT_TRUE. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-iscurrentmediasupported HRESULT // IsCurrentMediaSupported( IDiscRecorder2 *recorder, VARIANT_BOOL *value ); [DispId(2049)] [return: MarshalAs(UnmanagedType.VariantBool)] new bool IsCurrentMediaSupported(IDiscRecorder2 recorder); /// Determines if the current media is reported as physically blank by the drive. /// Is VARIANT_TRUE if the disc is physically blank; otherwise, VARIANT_FALSE. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-get_mediaphysicallyblank HRESULT // get_MediaPhysicallyBlank( VARIANT_BOOL *value ); [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). /// Is VARIANT_TRUE if the disc is likely to be blank; otherwise; VARIANT_FALSE. /// /// /// This method checks, for example, for a mounted file system on the device, verifying the first and last 2MB of the disc are /// filled with zeros, and other media-specific checks. These checks can help to determine if the media may have files on it for /// media that cannot be erased physically to a blank status. /// /// For a positive check that a disc is blank, call the IDiscFormat2::get_MediaPhysicallyBlank method. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-get_mediaheuristicallyblank HRESULT // get_MediaHeuristicallyBlank( VARIANT_BOOL *value ); [DispId(1793)] new bool MediaHeuristicallyBlank { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the media types that are supported by the current implementation of the IDiscFormat2 interface. /// /// List of media types supported by the current implementation of the IDiscFormat2 interface. Each element of the array is a /// VARIANT of type VT_I4. The lVal member of VARIANT contains the media type. For a list of media /// types, see the IMAPI_MEDIA_PHYSICAL_TYPE enumeration type. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-get_supportedmediatypes HRESULT // get_SupportedMediaTypes( SAFEARRAY **value ); [DispId(1794)] new IMAPI_MEDIA_PHYSICAL_TYPE[] SupportedMediaTypes { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; } /// Locks the current media for exclusive access. /// /// Before calling this method, you must call the IDiscFormat2TrackAtOnce::put_ClientName method. /// /// Also, you must call the IDiscFormat2TrackAtOnce::PrepareMedia method before calling the /// IDiscFormat2TrackAtOnce::AddAudioTrack method. /// /// /// After the write is complete or you cancel the write operation, you must call the IDiscFormat2TrackAtOnce::ReleaseMedia method to /// release the lock. /// /// /// Note that Media Change Notification (MCN) and the IDiscFormat2TrackAtOnce::put_DoNotFinalizeMedia property become read-only /// until the session is closed. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonce-preparemedia HRESULT PrepareMedia(); [DispId(0x200)] void PrepareMedia(); /// Writes the data stream to the current media as a new track. /// /// An IStream interface of the audio data to write as the next track on the media. /// /// The data format contains 44.1KHz, 16-bit stereo, raw audio samples. This is the same format used by the audio samples in a /// Microsoft WAV audio file (without the header). /// /// /// /// /// Before calling this method, you must call the IDiscFormat2TrackAtOnce::put_Recorder and IDiscFormat2TrackAtOnce::PrepareMedia methods. /// /// You should also consider calling the following methods if their default values are not appropriate for your application: /// /// /// IDiscFormat2TrackAtOnce::put_BufferUnderrunFreeDisabled /// /// /// IDiscFormat2TrackAtOnce::put_ClientName /// /// /// IDiscFormat2TrackAtOnce::put_DoNotFinalizeMedia /// /// /// /// To determine the progress of the write operation, you must implement the DDiscFormat2TrackAtOnceEvents interface. For examples /// that show how to implement an event handler in a script, see Monitoring Progress With Events. /// /// The media can accommodate 99 tracks of audio data. Track numbering starts at 1. The last track is 99. /// Silence, or data samples containing zeroes, will be added to the track-writing operation in the following ways: /// /// /// The minimum track size is 4 seconds and if needed, the track data will be enlarged to meet this requirement. /// /// /// /// Due to the nature of track-at-once recording, a two-second gap is added between successive audio tracks. This gap is normally /// hidden by PC-based players, but may be noticeable on some consumer electronics equipment. /// /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonce-addaudiotrack HRESULT AddAudioTrack( // IStream *data ); [DispId(0x201)] void AddAudioTrack(IStream data); /// Cancels the current write operation. /// /// /// To cancel the write operation, you must call this method from the DDiscFormat2TrackAtOnceEvents::Update event handler that you implemented. /// /// You must also call the IDiscFormat2TrackAtOnce::ReleaseMedia method after calling this method. /// /// Note that calling this method does not immediately cancel the write operation on all media due to media-specific requirements. /// For example, when writing to a CD, the write operation can continue for up to three more minutes. /// /// /// This method may result in a partial audio track having already been recorded. The method will attempt to keep the media in a /// usable state and will simply treat the canceled track as being shorter than originally described by the IStream. Callers /// should query the number of tracks and track sizes after canceling to determine the disc state. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonce-canceladdtrack HRESULT CancelAddTrack(); [DispId(0x202)] void CancelAddTrack(); /// Closes the track-writing session and releases the lock. /// /// This method release the lock set when you called the IDiscFormat2TrackAtOnce::PrepareMedia method. You must call this method to /// close a writing session or after calling the IDiscFormat2TrackAtOnce::CancelAddTrack method. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonce-releasemedia HRESULT ReleaseMedia(); [DispId(0x203)] void ReleaseMedia(); /// Sets the write speed of the disc recorder. /// /// Requested write speed measured in disc sectors per second. /// /// A value of 0xFFFFFFFF (-1) requests that the write occurs using the fastest supported speed for the media. This is the default. /// /// /// /// Requested rotational-speed control type. Set to VARIANT_TRUE to request constant angular velocity (CAV) rotational-speed control /// type. Set to VARIANT_FALSE to use another rotational-speed control type that the recorder supports. The default is VARIANT_FALSE. /// /// /// /// This method sets the write speed and type of rotational-speed control for a recorder. Requested values might differ from the /// values set in the recorder. To specify the recorder, call the IDiscFormat2TrackAtOnce::put_Recorder method. /// /// /// If the recorder supports the requested write speed, the disc device uses the requested value. If the recorder does not support /// the requested write speed, the recorder uses a write speed that it does support that is closest to the requested value. The /// IDiscFormat2TrackAtOnce::get_CurrentWriteSpeed property contains the value used by the recorder. /// /// /// To retrieve a list of the write speeds that the recorder and current media supports, call the /// IDiscFormat2TrackAtOnce::get_SupportedWriteSpeeds method. /// /// /// If you request constant angular velocity (CAV) for rotational-speed control type and the recorder does not support CAV, the disc /// device uses another type of rotational-speed control type that it supports. The /// IDiscFormat2TrackAtOnce::get_CurrentRotationTypeIsPureCAV property indicates the value used by the recorder. /// /// /// To retrieve the requested values, call the IDiscFormat2TrackAtOnce::get_RequestedWriteSpeed and /// IDiscFormat2TrackAtOnce::get_RequestedRotationTypeIsPureCAV methods. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonce-setwritespeed HRESULT SetWriteSpeed( // LONG RequestedSectorsPerSecond, VARIANT_BOOL RotationTypeIsPureCAV ); [DispId(0x204)] void SetWriteSpeed(int RequestedSectorsPerSecond, [MarshalAs(UnmanagedType.VariantBool)] bool RotationTypeIsPureCAV); /// Sets the recording device to use for the write operation. /// An IDiscRecorder2 interface that identifies the recording device to use in the write operation. /// /// The recorder must be compatible with the format defined by this interface. To determine compatibility, call the /// IDiscFormat2::IsRecorderSupported method. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonce-put_recorder HRESULT put_Recorder( // IDiscRecorder2 *value ); [DispId(0x100)] IDiscRecorder2 Recorder { set; [return: MarshalAs(UnmanagedType.Interface)] get; } /// Determines if Buffer Underrun Free Recording is enabled. /// /// Set to VARIANT_TRUE to disable Buffer Underrun Free Recording; otherwise, VARIANT_FALSE. The default is VARIANT_FALSE (enabled). /// /// /// Buffer underrun can be an issue if the data stream does not enter the buffer fast enough to keep the device continuously /// writing. In turn, the stop and start action of writing can cause data on the disc to be unusable. Buffer Underrun Free (BUF) /// recording allows the laser to start and stop without damaging data already written to the disc. Disabling of BUF recording is /// possible only on CD-R/RW media. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonce-put_bufferunderrunfreedisabled // HRESULT put_BufferUnderrunFreeDisabled( VARIANT_BOOL value ); [DispId(0x102)] bool BufferUnderrunFreeDisabled { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the number of existing audio tracks on the media. /// Number of completed tracks written to disc, not including the track currently being added. /// /// The value is zero if: /// /// /// The media is blank /// /// /// You call this method outside a writing session /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonce-get_numberofexistingtracks HRESULT // get_NumberOfExistingTracks( LONG *value ); [DispId(0x103)] int NumberOfExistingTracks { get; } /// Retrieves the total sectors available on the media if writing one continuous audio track. /// Number of all sectors on the media that can be used for audio if one continuous audio track was recorded. /// This property can be retrieved at any time; however, during writing, the value is cached. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonce-get_totalsectorsonmedia HRESULT // get_TotalSectorsOnMedia( LONG *value ); [DispId(0x104)] int TotalSectorsOnMedia { get; } /// Retrieves the number of sectors available for adding a new track to the media. /// Number of available sectors on the media that can be used for writing audio. /// /// If called during an AddAudioTrack operation, the available sectors do not reflect the sectors used in writing the current audio /// track. Instead, the reported value is the number of available sectors immediately preceding the call to AddAudioTrack. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonce-get_freesectorsonmedia HRESULT // get_FreeSectorsOnMedia( LONG *value ); [DispId(0x105)] int FreeSectorsOnMedia { get; } /// Retrieves the total number of used sectors on the media. /// Number of used sectors on the media, including audio tracks and overhead that exists between tracks. /// If you call this method from your event handler, the number reflects the sectors used before the write began. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonce-get_usedsectorsonmedia HRESULT // get_UsedSectorsOnMedia( LONG *value ); [DispId(0x106)] int UsedSectorsOnMedia { get; } /// Determines if the media is left open for writing after writing the audio track. /// /// Set to VARIANT_TRUE to leave the media open for writing after writing the audio track; otherwise, VARIANT_FALSE. The default is VARIANT_FALSE. /// /// /// /// You can set this property before calling the IDiscFormat2TrackAtOnce::PrepareMedia method or after calling the /// IDiscFormat2TrackAtOnce::ReleaseMedia method; you cannot set it during a track-writing session. /// /// This property is useful to create a multi-session CD with audio in the first session and data in the second session. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonce-put_donotfinalizemedia HRESULT // put_DoNotFinalizeMedia( VARIANT_BOOL value ); [DispId(0x107)] bool DoNotFinalizeMedia { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the table of content for the audio tracks that were laid on the media within the track-writing session. /// /// Table of contents for the audio tracks that were laid on the media within the track-writing session. Each element of the list is /// a VARIANT of type VT_BYREF|VT_UI1. The pbVal member of the variant contains a binary blob. For details of /// the blob, see the READ TOC command at ftp://ftp.t10.org/t10/drafts/mmc5/mmc5r03.pdf. /// /// The property is not accessible outside a track-writing session. Nor is the property accessible if the disc is blank. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonce-get_expectedtableofcontents HRESULT // get_ExpectedTableOfContents( SAFEARRAY **value ); [DispId(0x10A)] IntPtr[] ExpectedTableOfContents { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; } /// Retrieves the type of media in the disc device. /// Type of media in the disc device. For possible values, see the IMAPI_MEDIA_PHYSICAL_TYPEenumeration type. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonce-get_currentphysicalmediatype HRESULT // get_CurrentPhysicalMediaType( IMAPI_MEDIA_PHYSICAL_TYPE *value ); [DispId(0x10B)] IMAPI_MEDIA_PHYSICAL_TYPE CurrentPhysicalMediaType { get; } /// Sets the friendly name of the client. /// Name of the client application. /// /// /// The name is used when the write operation requests exclusive access to the device. The IDiscRecorder2::get_ExclusiveAccessOwner /// property contains the name of the client that has the lock. /// /// /// Because any application with read/write access to the CDROM device during the write operation can use the /// IOCTL_CDROM_EXCLUSIVE_ACCESS (query) control code (see the Microsoft Windows Driver Development Kit (DDK)) to access the name, /// it is important that the name identify the program that is using this interface to write to the media. The name is restricted to /// the same character set as required by the IOCTL_CDROM_EXCLUSIVE_ACCESS control code. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonce-put_clientname HRESULT // put_ClientName( BSTR value ); [DispId(0x10E)] string ClientName { set; [return: MarshalAs(UnmanagedType.BStr)] get; } /// Retrieves the requested write speed. /// /// Requested write speed measured in disc sectors per second. /// A value of 0xFFFFFFFF (-1) requests that the write occurs using the fastest supported speed for the media. /// /// This is the value specified in the most recent call to the IDiscFormat2TrackAtOnce::SetWriteSpeed method. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonce-get_requestedwritespeed HRESULT // get_RequestedWriteSpeed( LONG *value ); [DispId(0x10F)] int RequestedWriteSpeed { get; } /// Retrieves the requested rotational-speed control type. /// /// Requested rotational-speed control type. Is VARIANT_TRUE for constant angular velocity (CAV) rotational-speed control type. /// Otherwise, is VARIANT_FALSE for any other rotational-speed control type that the recorder supports. /// /// This is the value specified in the most recent call to the IDiscFormat2TrackAtOnce::SetWriteSpeed method. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonce-get_requestedrotationtypeispurecav // HRESULT get_RequestedRotationTypeIsPureCAV( VARIANT_BOOL *value ); [DispId(0x110)] bool RequestedRotationTypeIsPureCAV { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the drive's current write speed. /// The write speed of the current media, measured in sectors per second. /// /// To retrieve the requested write speed, call the IDiscFormat2TrackAtOnce::get_RequestedWriteSpeed method. /// /// To retrieve a list of the write speeds that the recorder and current media supports, call the /// IDiscFormat2TrackAtOnce::get_SupportedWriteSpeeds method. /// /// /// Note that the write speed is based on the media write speeds. The value of this property can change when a media change occurs. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonce-get_currentwritespeed HRESULT // get_CurrentWriteSpeed( LONG *value ); [DispId(0x111)] int CurrentWriteSpeed { get; } /// Retrieves the current rotational-speed control used by the recorder. /// /// Is VARIANT_TRUE if constant angular velocity (CAV) rotational-speed control is in use. Otherwise, VARIANT_FALSE to indicate that /// another rotational-speed control that the recorder supports is in use. /// /// /// /// To retrieve the requested rotational-speed control, call the IDiscFormat2TrackAtOnce::get_RequestedRotationTypeIsPureCAV method. /// /// Rotational-speed control types include the following: /// /// /// CLV (Constant Linear Velocity). The disc is written at a constant speed. Standard rotational control. /// /// /// CAV (Constant Angular Velocity). The disc is written at a constantly increasing speed. /// /// /// /// ZCAV (Zone Constant Angular Velocity). The disc is divided into zones. After each zone, the write speed increases. This is an /// impure form of CAV. /// /// /// /// /// PCAV (Partial Constant Angular Velocity). The disc speed increases up to a specified velocity. Once reached, the disc spins at /// the specified velocity for the duration of the disc writing. /// /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonce-get_currentrotationtypeispurecav // HRESULT get_CurrentRotationTypeIsPureCAV( VARIANT_BOOL *value ); [DispId(0x112)] bool CurrentRotationTypeIsPureCAV { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves a list of the write speeds supported by the disc recorder and current media. /// /// List of the write speeds supported by the disc recorder and current media. Each element of the list is a VARIANT of type /// VT_UI4. The ulVal member of the variant contains the number of sectors written per second. /// /// /// You can use a speed from the list to set the write speed when calling the IDiscFormat2TrackAtOnce::SetWriteSpeed method. /// /// To retrieve a list of the write configurations that the recorder and current media supports, call the /// IDiscFormat2TrackAtOnce::get_SupportedWriteSpeedDescriptors method. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonce-get_supportedwritespeeds HRESULT // get_SupportedWriteSpeeds( SAFEARRAY **supportedSpeeds ); [DispId(0x113)] uint[] SupportedWriteSpeeds { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; } /// Retrieves a list of the detailed write configurations supported by the disc recorder and current media. /// List of the detailed write configurations supported by the disc recorder and current media. Each element of the list is a VARIANT of type VT_Dispatch. Query the pdispVal member of the variant for the IWriteSpeedDescriptor interface, which contains the media type, write speed, rotational-speed control type. /// To retrieve a list of the write speeds that the recorder and current media supports, call the IDiscFormat2TrackAtOnce::get_SupportedWriteSpeeds method. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonce-get_supportedwritespeeddescriptors // HRESULT get_SupportedWriteSpeedDescriptors( SAFEARRAY **supportedSpeedDescriptors ); [DispId(0x114)] IWriteSpeedDescriptor[] SupportedWriteSpeedDescriptors { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; } } /// /// Use this interface to retrieve information about the current write operation. /// This interface is passed to the DDiscFormat2TrackAtOnceEvents::Update method that you implement. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-idiscformat2trackatonceeventargs [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IDiscFormat2TrackAtOnceEventArgs")] [ComImport, Guid("27354140-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface IDiscFormat2TrackAtOnceEventArgs : IWriteEngine2EventArgs { /// Retrieves the starting logical block address (LBA) of the current write operation. /// Starting logical block address of the write operation. Negative values for LBAs are supported. /// This is the same value passed to the IWriteEngine2::WriteSection method. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_startlba HRESULT get_StartLba( // LONG *value ); [DispId(0x100)] new int StartLba { get; } /// Retrieves the number of sectors to write to the device in the current write operation. /// The number of sectors to write in the current write operation. /// This is the same value passed to the IWriteEngine2::WriteSection method. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_sectorcount HRESULT // get_SectorCount( LONG *value ); [DispId(0x101)] new int SectorCount { get; } /// Retrieves the address of the sector most recently read from the burn image. /// Logical block address of the sector most recently read from the input data stream. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_lastreadlba HRESULT // get_LastReadLba( LONG *value ); [DispId(0x102)] new int LastReadLba { get; } /// Retrieves the address of the sector most recently written to the device. /// Logical block address of the sector most recently written to the device. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_lastwrittenlba HRESULT // get_LastWrittenLba( LONG *value ); [DispId(0x103)] new int LastWrittenLba { get; } /// Retrieves the size of the internal data buffer that is used for writing to disc. /// Size, in bytes, of the internal data buffer that is used for writing to disc. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_totalsystembuffer HRESULT // get_TotalSystemBuffer( LONG *value ); [DispId(0x106)] new int TotalSystemBuffer { get; } /// Retrieves the number of used bytes in the internal data buffer that is used for writing to disc. /// Size, in bytes, of the used portion of the internal data buffer that is used for writing to disc. /// This value increases as data is read into the buffer and decreases as data is written to disc. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_usedsystembuffer HRESULT // get_UsedSystemBuffer( LONG *value ); [DispId(0x107)] new int UsedSystemBuffer { get; } /// Retrieves the number of unused bytes in the internal data buffer that is used for writing to disc. /// Size, in bytes, of the unused portion of the internal data buffer that is used for writing to disc. /// This method returns the same value as if you subtracted IWriteEngine2EventArgs::get_UsedSystemBuffer from IWriteEngine2EventArgs::get_TotalSystemBuffer. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_freesystembuffer HRESULT // get_FreeSystemBuffer( LONG *value ); [DispId(0x108)] new int FreeSystemBuffer { get; } /// Retrieves the current track number being written to the media. /// Track number, ranging from 1 through 99. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonceeventargs-get_currenttracknumber // HRESULT get_CurrentTrackNumber( LONG *value ); [DispId(0x300)] int CurrentTrackNumber { get; } /// Retrieves the current write action being performed. /// /// Current write action being performed. For a list of possible actions, see the IMAPI_FORMAT2_TAO_WRITE_ACTION enumeration type. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonceeventargs-get_currentaction HRESULT // get_CurrentAction( IMAPI_FORMAT2_TAO_WRITE_ACTION *value ); [DispId(0x301)] IMAPI_FORMAT2_TAO_WRITE_ACTION CurrentAction { get; } /// Retrieves the total elapsed time of the write operation. /// Elapsed time, in seconds, of the write operation. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonceeventargs-get_elapsedtime HRESULT // get_ElapsedTime( LONG *value ); [DispId(0x302)] int ElapsedTime { get; } /// Retrieves the estimated remaining time of the write operation. /// Estimated time, in seconds, needed for the remainder of the write operation. /// /// The estimate for a single write operation can vary as the operation progresses. The drive provides updated information that can /// affect the projected duration of the write operation. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2trackatonceeventargs-get_remainingtime HRESULT // get_RemainingTime( LONG *value ); [DispId(0x303)] int RemainingTime { get; } } /// /// Use this interface to enumerate the CD and DVD devices installed on the computer. /// /// To create an instance of this interface, call the CoCreateInstance function. Use__uuidof(MsftDiscMaster2) for the class /// identifier and __uuidof(IDiscMaster2) for the interface identifier. /// /// /// /// /// To create the MsftDiscMaster2 object in a script, use IMAPI2.MsftDiscMaster2 as the program identifier when calling CreateObject. /// /// To receive notification when a device is added or removed from the computer, implement the interface. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-idiscmaster2 [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IDiscMaster2")] [ComImport, Guid("27354130-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual), CoClass(typeof(MsftDiscMaster2))] public interface IDiscMaster2 : IEnumerable { /// Retrieves a list of the CD and DVD devices installed on the computer. /// /// An IEnumVariant interface that you use to enumerate the CD and DVD devices installed on the computer. The items of /// the enumeration are variants whose type is VT_BSTR. Use the bstrVal member to retrieve the unique identifier /// of the device. /// /// /// /// The enumeration is a snapshot of the devices on the computer at the time of the call and will not reflect devices that are /// added and removed. To receive notification when a device is added or removed from the computer, implement the /// DDiscMaster2Events interface. /// /// To retrieve a single identifier, see the IDiscMaster2::get_Item property. /// /// The device identifier is guaranteed to be unique and static for a given device as recognized by Windows Plug and Play. You /// can use the identifier as a key value for saving the user's default burner, and can also be used to cache other /// device-specific static information (for example, VendorID and ProductID) by an advanced application. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscmaster2-get__newenum // HRESULT get__NewEnum( IEnumVARIANT **ppunk ); [DispId(-4)] [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(EnumeratorToEnumVariantMarshaler))] new IEnumerator GetEnumerator(); /// Retrieves the unique identifier of the specified disc device. /// /// Zero-based index of the device whose unique identifier you want to retrieve. /// The index value can change during PNP activity when devices are added or removed from the computer, or across boot sessions. /// /// String that contains the unique identifier of the disc device associated with the specified index. /// /// To enumerate all identifiers, call the IDiscMaster2::get__NewEnum method. /// /// The following sample demonstrates how to re-enumerate optical drives in order to accurately account for drives added or removed /// after the initial creation of the IDiscMaster2 object. This is accomplished via the IDiscMaster2::get_Item and /// IDiscMaster2::get_Count methods: /// /// /// #include <windows.h> #include <tchar.h> #include <imapi2.h> #include <objbase.h> #include <stdio.h> #pragma comment(lib, "ole32.lib") #pragma comment(lib, "user32.lib") int __cdecl _tmain(int argc, TCHAR* argv[]) { BSTR bstrDeviceName; HRESULT hr = S_OK; BOOL bComInitialised; IDiscMaster2* discMaster; UINT iCounter = 0; LONG lValue = 0; bComInitialised = SUCCEEDED(CoInitializeEx(0, COINIT_MULTITHREADED)); // Create an object of IDiscMaster2 if (SUCCEEDED(hr)){ CoCreateInstance( CLSID_MsftDiscMaster2, NULL, CLSCTX_ALL, IID_PPV_ARGS(&discMaster) ); if(FAILED(hr)){ _tprintf(TEXT("\nUnsuccessful in creating an instance of CLSID_MsftDiscMaster2.\n\nError returned: 0x%x\n"), hr); return 0; } } // // Loop twice and get the optical drives attached to the system, // first time just get the current configuration and second time // prompt the user to change the configuration and then get the // altered configuration. // do{ // Get the number of drives if (SUCCEEDED(hr)){ hr = discMaster->get_Count(&lValue); if (SUCCEEDED(hr)){ _tprintf(TEXT("\nTotal number of drives = %d\n"), lValue); } } // Print all the optical drives attached to the system if (SUCCEEDED(hr)){ for(LONG iCount = 0; iCount < lValue; iCount++) { hr = discMaster->get_Item(iCount, &bstrDeviceName); _tprintf(TEXT("\nUnique identifier of the disc device associated with index %d is: %s\n"), iCount, bstrDeviceName); } } // Prompt the user to unhook or add drives if (iCounter < 1){ MessageBox(NULL,TEXT("Please un-hook or add drives and hit OK"), TEXT("Manual Action"), MB_OK); _tprintf(TEXT("\nGetting the altered configuration ... \n")); } iCounter++; }while(iCounter < 2); discMaster->Release(); CoUninitialize(); bComInitialised = FALSE; return 0; /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscmaster2-get_item HRESULT get_Item( LONG index, BSTR // *value ); [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. /// Number of CD and DVD disc devices installed on the computer. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscmaster2-get_count HRESULT get_Count( LONG *value ); [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. /// /// /// Is VARIANT_TRUE if the environment contains one or more optical devices and the execution context has permission to access the /// devices; otherwise, VARIANT_FALSE. /// /// /// /// This method loops through all the strings in IDiscMaster2 and attempts to use each string to initialize a DiscRecorder2 object. /// If any of the recorders on the system succeed the initialization, this method returns TRUE. /// /// The environment must contain at least one type-5 optical device. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscmaster2-get_issupportedenvironment HRESULT // get_IsSupportedEnvironment( VARIANT_BOOL *value ); [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 create an instance of this interface, call the CoCreateInstance function. Use__uuidof(MsftDiscRecorder2) for the class /// identifier and __uuidof(IDiscRecorder2) for the interface identifier. /// /// /// /// /// To create the MsftDiscRecorder2 object in a script, use IMAPI2.MsftDiscRecorder2 as the program identifier when calling CreateObject. /// /// /// 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 IDiscFormat2Data::put_Recorder 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. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-idiscrecorder2 [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IDiscRecorder2")] [ComImport, Guid("27354133-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual), CoClass(typeof(MsftDiscRecorder2))] public interface IDiscRecorder2 { /// Ejects media from the device. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2-ejectmedia HRESULT EjectMedia(); [DispId(256)] void EjectMedia(); /// Closes the media tray. /// /// Note Some drives, such as those with slot-loading mechanisms, do not support this method. To determine if the device /// supports this method, call the IDiscRecorder2::get_DeviceCanLoadMedia property. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2-closetray HRESULT CloseTray(); [DispId(257)] void CloseTray(); /// Acquires exclusive access to the device. /// /// Set to VARIANT_TRUE to gain exclusive access to the volume whether the file system volume can or cannot be dismounted. If /// VARIANT_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. /// /// /// /// You should not have to call this method to acquire the lock yourself because the write operations, such as /// IDiscFormat2Data::Write, 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 /// IDiscRecorder2::ReleaseExclusiveAccess method decrements the lock count by one. /// /// /// An equal number of calls to the AcquireExclusiveAccess and ReleaseExclusiveAccess 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 IDiscRecorder2::get_ExclusiveAccessOwner to retrieve the name of the client /// application that currently has exclusive access. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2-acquireexclusiveaccess HRESULT // AcquireExclusiveAccess( VARIANT_BOOL force, BSTR __MIDL__IDiscRecorder20000 ); [DispId(258)] void AcquireExclusiveAccess([MarshalAs(UnmanagedType.VariantBool)] bool force, [MarshalAs(UnmanagedType.BStr)] string clientName); /// Releases exclusive access to the device. /// /// /// Each recorder has a lock count. The first call to a recorder locks the device for exclusive access. Applications can use the /// IDiscRecorder2::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 /// ReleaseExclusiveAccess method decrements the lock count by one. /// /// /// An equal number of calls to the AcquireExclusiveAccess 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. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2-releaseexclusiveaccess HRESULT ReleaseExclusiveAccess(); [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 IDiscRecorder2::EnableMcn 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. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2-disablemcn HRESULT DisableMcn(); [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 IDiscRecorder2::DisableMcn. /// /// /// 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. /// /// // https://docs.microsoft.com/ja-jp/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2-enablemcn HRESULT EnableMcn(); [DispId(261)] void EnableMcn(); /// Associates the object with the specified disc device. /// String that contains the unique identifier for the 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 IDiscMaster2::get__NewEnum 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 /// IDiscRecorder2::get_ExclusiveAccessOwner method. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2-initializediscrecorder HRESULT // InitializeDiscRecorder( BSTR recorderUniqueId ); [DispId(262)] void InitializeDiscRecorder([MarshalAs(UnmanagedType.BStr)] string recorderUniqueId); /// Retrieves the unique identifier used to initialize the disc device. /// Unique identifier for the device. This is the identifier you specified when calling IDiscRecorder2::InitializeDiscRecorder. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2-get_activediscrecorder HRESULT // get_ActiveDiscRecorder( BSTR *value ); [DispId(0)] string ActiveDiscRecorder { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Retrieves the vendor ID for the device. /// String that contains the vendor ID for the device. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2-get_vendorid HRESULT get_VendorId( BSTR *value ); [DispId(513)] string VendorId { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Retrieves the product ID of the device. /// String that contains the product ID of the device. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2-get_productid HRESULT get_ProductId( BSTR // *value ); [DispId(514)] string ProductId { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Retrieves the product revision code of the device. /// String that contains the product revision code of the device. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2-get_productrevision HRESULT // get_ProductRevision( BSTR *value ); [DispId(515)] string ProductRevision { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Retrieves the unique volume name associated with the device. /// String that contains the unique volume name associated with the device. /// To retrieve the drive letter assignment, call the IDiscRecorder2::get_VolumePathNames method. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2-get_volumename HRESULT get_VolumeName( BSTR // *value ); [DispId(516)] string VolumeName { [return: MarshalAs(UnmanagedType.BStr)] get; } /// Retrieves a list of drive letters and NTFS mount points for the device. /// /// List of drive letters and NTFS mount points for the device. Each element of the list is a VARIANT of type VT_BSTR. /// The bstrVal member of the variant contains the path. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2-get_volumepathnames HRESULT // get_VolumePathNames( SAFEARRAY **value ); [DispId(517)] string[] VolumePathNames { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; } /// Determines if the device can eject and subsequently reload media. /// /// Is VARIANT_TRUE if the device can eject and subsequently reload media. If VARIANT_FALSE, loading media must be done manually. /// /// Note For slim drives or laptop drives, which utilize a manual tray-loading mechanism, this parameter can indicate an /// incorrect value of VARIANT_TRUE. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2-get_devicecanloadmedia HRESULT // get_DeviceCanLoadMedia( VARIANT_BOOL *value ); [DispId(518)] bool DeviceCanLoadMedia { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the legacy device number for a CD or DVD device. /// /// Zero-based index number of the device, based on the order the device was installed on the computer. /// /// This value can change during PNP activity when devices are added or removed from the computer, or across boot sessions and /// should not be considered a unique identifier for the device. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2-get_legacydevicenumber HRESULT // get_LegacyDeviceNumber( LONG *legacyDeviceNumber ); [DispId(519)] int LegacyDeviceNumber { get; } /// Retrieves the list of features that the device supports. /// /// List of features that the device supports. Each element of the list is a VARIANT of type VT_I4. The lVal /// member of the variant contains the feature page type value. For possible values, see the IMAPI_FEATURE_PAGE_TYPE enumeration type. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2-get_supportedfeaturepages HRESULT // get_SupportedFeaturePages( SAFEARRAY **value ); [DispId(520)] IMAPI_FEATURE_PAGE_TYPE[] SupportedFeaturePages { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; } /// Retrieves the list of feature pages of the device that are marked as current. /// /// List of supported feature pages that are marked as current for the device. Each element of the list is a VARIANT of type /// VT_I4. The lVal member of the variant contains the feature page type. For possible values, see the /// IMAPI_FEATURE_PAGE_TYPE enumeration. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2-get_currentfeaturepages HRESULT // get_CurrentFeaturePages( SAFEARRAY **value ); [DispId(521)] IMAPI_FEATURE_PAGE_TYPE[] CurrentFeaturePages { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; } /// Retrieves the list of MMC profiles that the device supports. /// /// List of MMC profiles that the device supports. Each element of the list is a VARIANT of type VT_I4. The /// lVal member of the variant contains the profile type value. For possible values, see the IMAPI_PROFILE_TYPE enumeration type. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2-get_supportedprofiles HRESULT // get_SupportedProfiles( SAFEARRAY **value ); [DispId(522)] IMAPI_PROFILE_TYPE[] SupportedProfiles { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; } /// Retrieves all MMC profiles of the device that are marked as current. /// /// List of supported profiles that are marked as current for the device. Each element of the list is a VARIANT of type /// VT_I4. The lVal member of the variant contains the profile type. For possible values, see the IMAPI_PROFILE_TYPE enumeration. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2-get_currentprofiles HRESULT // get_CurrentProfiles( SAFEARRAY **value ); [DispId(523)] IMAPI_PROFILE_TYPE[] CurrentProfiles { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; } /// Retrieves the list of MMC mode pages that the device supports. /// /// List of MMC mode pages that the device supports. Each element of the list is a VARIANT of type VT_I4. The /// lVal member of the variant contains the mode page type value. For possible values, see the IMAPI_MODE_PAGE_TYPE /// enumeration type. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2-get_supportedmodepages HRESULT // get_SupportedModePages( SAFEARRAY **value ); [DispId(524)] IMAPI_MODE_PAGE_TYPE[] SupportedModePages { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; } /// Retrieves the name of the client application that has exclusive access to the device. /// String that contains 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. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2-get_exclusiveaccessowner HRESULT // get_ExclusiveAccessOwner( BSTR *value ); [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 IDiscRecorder2 interface, and provides easier access to some of the same property values in IDiscRecorder2. /// /// /// To get an instance of this interface, create an instance of the IDiscRecorder2 interface and then call the /// IDiscRecorder2::QueryInterface method to retrieve the IDiscRecorder2Ex interface. /// /// Note that you cannot access this functionality from script. /// /// /// To write data to media, you need to attach this recorder to the IWriteEngine2 data writer, using the IWriteEngine2::put_Recorder method. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-idiscrecorder2ex [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IDiscRecorder2Ex")] [ComImport, Guid("27354132-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), CoClass(typeof(MsftDiscRecorder2))] 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. /// /// 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. /// /// /// 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 operation code range /// CDB group /// Required CDB size /// /// /// 0x00 — 0x1F /// 0 /// 6 bytes /// /// /// 0x20 — 0x3F /// 1 /// 10 bytes /// /// /// 0x40 — 0x5F /// 2 /// 10 bytes /// /// /// 0x60 — 0x7F /// 3 /// Will enforce standard-specified size requirements for this opcode range in the future. /// /// /// 0x80 — 0x9F /// 4 /// 16 bytes /// /// /// 0xA0 — 0xBF /// 5 /// 12 bytes /// /// /// 0xC0 — 0xDF /// 6 /// Vendor Unique - Any size allowed /// /// /// 0xE0 — 0xFF /// 7 /// 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 /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2ex-sendcommandnodata HRESULT SendCommandNoData( // BYTE *Cdb, ULONG CdbSize, BYTE [18] SenseBuffer, ULONG Timeout ); 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. /// /// /// For details of the contents of the command packet, sense data, and input data buffer, 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 operation code range /// CDB group /// Required CDB size /// /// /// 0x00 — 0x1F /// 0 /// 6 bytes /// /// /// 0x20 — 0x3F /// 1 /// 10 bytes /// /// /// 0x40 — 0x5F /// 2 /// 10 bytes /// /// /// 0x60 — 0x7F /// 3 /// Will enforce standard-specified size requirements for this opcode range in the future. /// /// /// 0x80 — 0x9F /// 4 /// 16 bytes /// /// /// 0xA0 — 0xBF /// 5 /// 12 bytes /// /// /// 0xC0 — 0xDF /// 6 /// Vendor Unique - Any size allowed /// /// /// 0xE0 — 0xFF /// 7 /// 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 /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2ex-sendcommandsenddatatodevice HRESULT // SendCommandSendDataToDevice( BYTE *Cdb, ULONG CdbSize, BYTE [18] SenseBuffer, ULONG Timeout, BYTE *Buffer, ULONG_IMAPI2_NONZERO // BufferSize ); 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. /// /// /// For details of the contents of the command packet, sense data, and output data buffer, 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 operation code range /// CDB group /// Required CDB size /// /// /// 0x00 — 0x1F /// 0 /// 6 bytes /// /// /// 0x20 — 0x3F /// 1 /// 10 bytes /// /// /// 0x40 — 0x5F /// 2 /// 10 bytes /// /// /// 0x60 — 0x7F /// 3 /// Will enforce standard-specified size requirements for this opcode range in the future. /// /// /// 0x80 — 0x9F /// 4 /// 16 bytes /// /// /// 0xA0 — 0xBF /// 5 /// 12 bytes /// /// /// 0xC0 — 0xDF /// 6 /// Vendor Unique - Any size allowed /// /// /// 0xE0 — 0xFF /// 7 /// 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 /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2ex-sendcommandgetdatafromdevice HRESULT // SendCommandGetDataFromDevice( BYTE *Cdb, ULONG CdbSize, BYTE [18] SenseBuffer, ULONG Timeout, BYTE *Buffer, ULONG_IMAPI2_NONZERO // BufferSize, ULONG_IMAPI2_NOT_NEGATIVE *BufferFetched ); 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, out uint BufferFetched); /// Reads a DVD structure from the media. /// /// Format field of the command packet. Acceptable values range from zero to 0xFF. /// Note This value is truncated to UCHAR. /// /// 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, call the CoTaskMemFree function to free the memory. /// /// Size, in bytes, of the data buffer. /// /// This method removes the complexity of working with the READ DISC STRUCTURE command. For details on the values to specify for the /// format, address, layer, and agid parameters, see their field descriptions for the READ DISC STRUCTURE command in the latest /// revision of the MMC specification at ftp://ftp.t10.org/t10/drafts/mmc5. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2ex-readdvdstructure HRESULT ReadDvdStructure( // ULONG format, ULONG address, ULONG layer, ULONG agid, BYTE **data, ULONG_IMAPI2_DVD_STRUCTURE *count ); void ReadDvdStructure(uint format, uint address, uint layer, uint agid, out SafeCoTaskMemHandle data, out uint count); /// Sends a DVD structure to 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. /// /// For details on specifying the fields of the structure, see the SEND DISC STRUCTURE command in the latest revision of the MMC /// specification at ftp://ftp.t10.org/t10/drafts/mmc5. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2ex-senddvdstructure HRESULT SendDvdStructure( // ULONG format, BYTE *data, ULONG_IMAPI2_DVD_STRUCTURE count ); void SendDvdStructure(uint format, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 2)] byte[] data, int count); /// Retrieves the adapter descriptor for the device. /// /// /// 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, call the CoTaskMemFree function to free the memory. /// /// Size, in bytes, of the data buffer. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2ex-getadapterdescriptor HRESULT // GetAdapterDescriptor( BYTE **data, ULONG_IMAPI2_ADAPTER_DESCRIPTOR *byteSize ); void GetAdapterDescriptor(out SafeCoTaskMemHandle data, out uint byteSize); /// Retrieves the device descriptor for the device. /// /// /// 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. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2ex-getdevicedescriptor HRESULT // GetDeviceDescriptor( BYTE **data, ULONG_IMAPI2_DEVICE_DESCRIPTOR *byteSize ); void GetDeviceDescriptor(out SafeCoTaskMemHandle data, out uint byteSize); /// Retrieves the disc information from the media. /// /// /// 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, call the CoTaskMemFree function to free the memory. /// /// Size, in bytes, of the data buffer. /// See the MMC specification for details regarding how to interpret the returned data. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2ex-getdiscinformation HRESULT // GetDiscInformation( BYTE **discInformation, ULONG_IMAPI2_DISC_INFORMATION *byteSize ); void GetDiscInformation(out SafeCoTaskMemHandle discInformation, out uint byteSize); /// Retrieves the track information from the media. /// 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 IMAPI_READ_TRACK_ADDRESS_TYPE 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, call the CoTaskMemFree function to free the memory. /// /// Size, in bytes, of the trackInformation data buffer. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2ex-gettrackinformation HRESULT // GetTrackInformation( ULONG address, IMAPI_READ_TRACK_ADDRESS_TYPE addressType, BYTE **trackInformation, // ULONG_IMAPI2_TRACK_INFORMATION *byteSize ); void GetTrackInformation(uint address, IMAPI_READ_TRACK_ADDRESS_TYPE addressType, out SafeCoTaskMemHandle trackInformation, out uint byteSize); /// Retrieves the specified feature page from the device. /// Feature page to retrieve. For possible values, see the IMAPI_FEATURE_PAGE_TYPE 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, call the CoTaskMemFree function to free the memory. /// /// Size, in bytes, of the featureData data buffer. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2ex-getfeaturepage HRESULT GetFeaturePage( // IMAPI_FEATURE_PAGE_TYPE requestedFeature, BOOLEAN currentFeatureOnly, BYTE **featureData, ULONG_IMAPI2_FEATURE_PAGE *byteSize ); void GetFeaturePage(IMAPI_FEATURE_PAGE_TYPE requestedFeature, [MarshalAs(UnmanagedType.U1)] bool currentFeatureOnly, out SafeCoTaskMemHandle featureData, out uint byteSize); /// Retrieves the specified mode page from the device. /// Mode page to retrieve. For possible values, see the IMAPI_MODE_PAGE_TYPE 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 IMAPI_MODE_PAGE_REQUEST_TYPE 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, call the CoTaskMemFree function to free the memory. /// /// Size, in bytes, of the modePageData data buffer. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2ex-getmodepage HRESULT GetModePage( // IMAPI_MODE_PAGE_TYPE requestedModePage, IMAPI_MODE_PAGE_REQUEST_TYPE requestType, BYTE **modePageData, ULONG_IMAPI2_MODE_PAGE // *byteSize ); void GetModePage(IMAPI_MODE_PAGE_TYPE requestedModePage, IMAPI_MODE_PAGE_REQUEST_TYPE requestType, out SafeCoTaskMemHandle modePageData, out uint byteSize); /// Sets the mode page data for the device. /// /// Type of mode page data to send. For possible values, see the IMAPI_MODE_PAGE_REQUEST_TYPE 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. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2ex-setmodepage HRESULT SetModePage( // IMAPI_MODE_PAGE_REQUEST_TYPE requestType, BYTE *data, ULONG_IMAPI2_MODE_PAGE byteSize ); void SetModePage(IMAPI_MODE_PAGE_REQUEST_TYPE requestType, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U1, SizeParamIndex = 2)] byte[] data, 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 IMAPI_FEATURE_PAGE_TYPE enumeration type. /// /// To get the feature page data associated with the feature page type, call the IDiscRecorder2Ex::GetFeaturePage method. /// When done, call the CoTaskMemFree function to free the memory. /// /// Number of supported feature pages in the featureData data buffer. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2ex-getsupportedfeaturepages HRESULT // GetSupportedFeaturePages( BOOLEAN currentFeatureOnly, IMAPI_FEATURE_PAGE_TYPE **featureData, ULONG_IMAPI2_ALL_FEATURE_PAGES // *byteSize ); void GetSupportedFeaturePages([MarshalAs(UnmanagedType.U1)] bool currentFeatureOnly, out SafeCoTaskMemHandle featureData, out 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 IMAPI_PROFILE_TYPE enumeration type. /// When done, call the CoTaskMemFree function to free the memory. /// /// Number of supported profiles in the profileTypes data buffer. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2ex-getsupportedprofiles HRESULT // GetSupportedProfiles( BOOLEAN currentOnly, IMAPI_PROFILE_TYPE **profileTypes, ULONG_IMAPI2_ALL_PROFILES *validProfiles ); void GetSupportedProfiles([MarshalAs(UnmanagedType.U1)] bool currentOnly, out SafeCoTaskMemHandle profileTypes, out 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 IMAPI_MODE_PAGE_REQUEST_TYPE enumeration type. /// /// /// Data buffer that contains one or more mode page types. For possible values, see the IMAPI_MODE_PAGE_TYPE 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. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2ex-getsupportedmodepages HRESULT // GetSupportedModePages( IMAPI_MODE_PAGE_REQUEST_TYPE requestType, IMAPI_MODE_PAGE_TYPE **modePageTypes, // ULONG_IMAPI2_ALL_MODE_PAGES *validPages ); void GetSupportedModePages(IMAPI_MODE_PAGE_REQUEST_TYPE requestType, out SafeCoTaskMemHandle modePageTypes, out 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. /// /// /// /// The data buffer for IDiscRecorder2Ex::SendCommandSendDataToDevice and IDiscRecorder2Ex::SendCommandGetDataFromDevice must /// aligned to the correct byte boundary. To determine if the buffer is on the correct byte boundary, perform a bitwise logical AND /// of the bitmask with the address of the data buffer. For example, if the address of the buffer is 0x3840958, you can test for /// correct alignment using the following statement: /// /// /// if (0x3840958 & (value - 1) == 0) { // The alignment is correct } /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2ex-getbytealignmentmask HRESULT // GetByteAlignmentMask( ULONG *value ); uint GetByteAlignmentMask(); /// Retrieves the maximum non-page-aligned transfer size for the device. /// Maximum size, in bytes, of a non-page-aligned buffer. /// /// This is the maximum buffer size that a device can accept for a single command. Buffers of this size provide the maximum exchange /// of data. The buffer does not need to begin on a physical memory page boundary. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2ex-getmaximumnonpagealignedtransfersize HRESULT // GetMaximumNonPageAlignedTransferSize( ULONG *value ); uint GetMaximumNonPageAlignedTransferSize(); /// Retrieves the maximum page-aligned transfer size for the device. /// Maximum size, in bytes, of a page-aligned buffer. /// /// Maximum page-aligned buffer size that a device can accept for a single command. The buffer for this transfer size must begin on /// a physical memory page boundary. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2ex-getmaximumpagealignedtransfersize HRESULT // GetMaximumPageAlignedTransferSize( ULONG *value ); uint GetMaximumPageAlignedTransferSize(); } /// Reads a DVD structure from the media. /// The instance. /// /// Format field of the command packet. Acceptable values range from zero to 0xFF. /// Note This value is truncated to UCHAR. /// /// 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. /// /// /// This method removes the complexity of working with the READ DISC STRUCTURE command. For details on the values to specify for the /// format, address, layer, and agid parameters, see their field descriptions for the READ DISC STRUCTURE command in the latest /// revision of the MMC specification at ftp://ftp.t10.org/t10/drafts/mmc5. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscrecorder2ex-readdvdstructure HRESULT ReadDvdStructure( // ULONG format, ULONG address, ULONG layer, ULONG agid, BYTE **data, ULONG_IMAPI2_DVD_STRUCTURE *count ); public static byte[] ReadDvdStructure(this IDiscRecorder2Ex obj, byte format, uint address, uint layer, uint agid) { obj.ReadDvdStructure(format, address, layer, agid, out var mem, out var sz); return mem.GetBytes(0, (int)sz); } /// /// This is a base interface. Use the following interfaces which inherit this interface: /// /// /// IDiscFormat2Data /// /// /// IDiscFormat2Erase /// /// /// IDiscFormat2TrackAtOnce /// /// /// IDiscFormat2RawCD /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-idiscformat2 [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IDiscFormat2")] [ComImport, Guid("27354152-8F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface IDiscFormat2 { /// Determines if the recorder supports the given format. /// An IDiscRecorder2 interface of the recorder to test. /// Is VARIANT_TRUE if the recorder supports the given format; otherwise, VARIANT_FALSE. /// /// When implemented by the IDiscFormat2RawCD interface, this method will return E_IMAPI_DF2RAW_MEDIA_IS_NOT_SUPPORTED in the event /// the recorder does not support the given format. It is important to note that in this specific scenario the value does not /// indicate that an error has occurred, but rather the result of a successful operation. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-isrecordersupported HRESULT IsRecorderSupported( // IDiscRecorder2 *recorder, VARIANT_BOOL *value ); [DispId(2048)] [return: MarshalAs(UnmanagedType.VariantBool)] bool IsRecorderSupported(IDiscRecorder2 recorder); /// Determines if the current media in a supported recorder supports the given format. /// An IDiscRecorder2 interface of the recorder to test. /// /// Is VARIANT_TRUE if the media in the recorder supports the given format; otherwise, VARIANT_FALSE. /// Note VARIANT_TRUE also implies that the result from IsDiscRecorderSupported is VARIANT_TRUE. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-iscurrentmediasupported HRESULT // IsCurrentMediaSupported( IDiscRecorder2 *recorder, VARIANT_BOOL *value ); [DispId(2049)] [return: MarshalAs(UnmanagedType.VariantBool)] bool IsCurrentMediaSupported(IDiscRecorder2 recorder); /// Determines if the current media is reported as physically blank by the drive. /// Is VARIANT_TRUE if the disc is physically blank; otherwise, VARIANT_FALSE. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-get_mediaphysicallyblank HRESULT // get_MediaPhysicallyBlank( VARIANT_BOOL *value ); [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). /// Is VARIANT_TRUE if the disc is likely to be blank; otherwise; VARIANT_FALSE. /// /// /// This method checks, for example, for a mounted file system on the device, verifying the first and last 2MB of the disc are /// filled with zeros, and other media-specific checks. These checks can help to determine if the media may have files on it for /// media that cannot be erased physically to a blank status. /// /// For a positive check that a disc is blank, call the IDiscFormat2::get_MediaPhysicallyBlank method. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-get_mediaheuristicallyblank HRESULT // get_MediaHeuristicallyBlank( VARIANT_BOOL *value ); [DispId(1793)] bool MediaHeuristicallyBlank { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the media types that are supported by the current implementation of the IDiscFormat2 interface. /// /// List of media types supported by the current implementation of the IDiscFormat2 interface. Each element of the array is a /// VARIANT of type VT_I4. The lVal member of VARIANT contains the media type. For a list of media /// types, see the IMAPI_MEDIA_PHYSICAL_TYPE enumeration type. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-idiscformat2-get_supportedmediatypes HRESULT // get_SupportedMediaTypes( SAFEARRAY **value ); [DispId(1794)] IMAPI_MEDIA_PHYSICAL_TYPE[] SupportedMediaTypes { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; } } /// /// Base interface containing properties common to derived multisession interfaces. /// /// You can derive from this interface to implement a new multi-session mechanism that is different from IMultisessionSequential and /// IMultisessionRandomWrite. For example, you could implement a mechanism for BD-R Pseudo-Overwrite. /// /// /// To access media-specific properties of a multisession interface, use the IMultisessionSequential and IMultisessionRandomWrite interface. /// /// /// /// If more than one multi-session interface exist, the application can let IFileSystemImage choose a compatible multi-session interface /// to use or the application can specify the multi-session interface to use by setting the put_InUse property to VARIANT_TRUE. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-imultisession [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IMultisession")] [ComImport, Guid("27354150-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface IMultisession { /// Determines if the multi-session type can write to the current optical media. /// /// Is VARIANT_TRUE if the multi-session interface can write to the current optical media in its current state. Otherwise, VARIANT_FALSE. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisession-get_issupportedoncurrentmediastate HRESULT // get_IsSupportedOnCurrentMediaState( VARIANT_BOOL *value ); [DispId(0x100)] bool IsSupportedOnCurrentMediaState { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Determines if this multi-session interface is the one you should use on the current media. /// /// Set to VARIANT_TRUE if this multi-session interface is the one you should use to write to the current media. Otherwise, VARIANT_FALSE. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisession-put_inuse HRESULT put_InUse( VARIANT_BOOL value ); [DispId(0x101)] bool InUse { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the disc recorder to use to import one or more previous sessions. /// An IDiscRecorder2 interface that identifies the device that contains one or more session images to import. /// The import recorder reads session content from the optical media and provides it to IFileSystemImage. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisession-get_importrecorder HRESULT get_ImportRecorder( // IDiscRecorder2 **value ); [DispId(0x102)] IDiscRecorder2 ImportRecorder { [return: MarshalAs(UnmanagedType.Interface)] get; } } /// /// /// Use this interface to retrieve information about the current state of media allowing random writes and not supporting the concept of /// physical sessions. /// /// The following methods return a collection of IMultisession interfaces representing all supported multisession types. /// /// /// IDiscFormat2Data::get_MultisessionInterfaces /// /// /// IFileSystemImage::get_MultisessionInterfaces /// /// /// /// You can then call the IUnknown::QueryInterface method on each element in the collection to query for the /// IMultisessionRandomWrite interface. /// /// /// /// /// If more than one multi-session interface exist, the application can let IFileSystemImage choose a compatible multi-session interface /// to use or the application can specify the multi-session interface to use by setting the put_InUse property to VARIANT_TRUE. /// /// /// A file system creator would use the address properties to import the content of the previous session on the disc and to compute the /// position of the next session it will create. These properties will return the same values as the properties of the same name of the /// IDiscFormat2Data interface. This is a MsftMultisessionRandomWrite object in script. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-imultisessionrandomwrite [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IMultisessionRandomWrite")] [ComImport, Guid("B507CA23-2204-11DD-966A-001AA01BBC58"), InterfaceType(ComInterfaceType.InterfaceIsDual), CoClass(typeof(MsftMultisessionRandomWrite))] public interface IMultisessionRandomWrite : IMultisession { /// Determines if the multi-session type can write to the current optical media. /// /// Is VARIANT_TRUE if the multi-session interface can write to the current optical media in its current state. Otherwise, VARIANT_FALSE. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisession-get_issupportedoncurrentmediastate HRESULT // get_IsSupportedOnCurrentMediaState( VARIANT_BOOL *value ); [DispId(0x100)] new bool IsSupportedOnCurrentMediaState { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Determines if this multi-session interface is the one you should use on the current media. /// /// Set to VARIANT_TRUE if this multi-session interface is the one you should use to write to the current media. Otherwise, VARIANT_FALSE. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisession-put_inuse HRESULT put_InUse( VARIANT_BOOL value ); [DispId(0x101)] new bool InUse { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the disc recorder to use to import one or more previous sessions. /// An IDiscRecorder2 interface that identifies the device that contains one or more session images to import. /// The import recorder reads session content from the optical media and provides it to IFileSystemImage. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisession-get_importrecorder HRESULT get_ImportRecorder( // IDiscRecorder2 **value ); [DispId(0x102)] new IDiscRecorder2 ImportRecorder { [return: MarshalAs(UnmanagedType.Interface)] get; } /// Retrieves the size of a writeable unit on the media. /// The size of a writeable unit on the media. /// /// Each write performed to the disc must start from an LBA that is a multiple of the writeable unit size. The number of recorded /// sectors must also be a multiple of the writeable unit size. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisessionrandomwrite-get_writeunitsize HRESULT // get_WriteUnitSize( LONG *value ); [DispId(0x205)] int WriteUnitSize { get; } /// Retrieves the last written address on the media. /// The last written address on the media. /// /// This property can be used for wear-out leveling on the media. The property is retrieved from the drive and may not be provided /// for some media types. If the drive does not provide the required information, this property access method returns E_NOTIMPL. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisessionrandomwrite-get_lastwrittenaddress HRESULT // get_LastWrittenAddress( LONG *value ); [DispId(0x206)] int LastWrittenAddress { get; } /// Retrieves the total number of sectors on the media. /// The total number of sectors on the media. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisessionrandomwrite-get_totalsectorsonmedia HRESULT // get_TotalSectorsOnMedia( LONG *value ); [DispId(0x207)] int TotalSectorsOnMedia { get; } } /// /// /// Use this interface to retrieve information about the previous import session on a sequentially recorded media, if the media /// contains a previous session. /// /// The following methods return a collection of IMultisession interfaces representing all supported multisession types. /// /// /// IDiscFormat2Data::get_MultisessionInterfaces /// /// /// IFileSystemImage::get_MultisessionInterfaces /// /// /// /// The IMultisession::QueryInterface method can be called on each element in the collection to query for the /// IMultisessionSequential interface. /// /// /// /// /// If more than one multi-session interface exist, the application can let IFileSystemImage choose a compatible multi-session /// interface to use or the application can specify the multi-session interface to use by setting the put_InUse property to VARIANT_TRUE. /// /// /// A file system creator would use the address properties to import the content of the previous session on the disc and to compute /// the position of the next session it will create. These properties will return the same values as the properties of the same name /// of the IDiscFormat2Data interface. /// /// This is a MsftMultisessionSequential object in script. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-imultisessionsequential [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IMultisessionSequential")] [ComImport, Guid("27354151-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual), CoClass(typeof(MsftMultisessionSequential))] public interface IMultisessionSequential : IMultisession { /// Determines if the multi-session type can write to the current optical media. /// /// Is VARIANT_TRUE if the multi-session interface can write to the current optical media in its current state. Otherwise, VARIANT_FALSE. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisession-get_issupportedoncurrentmediastate HRESULT // get_IsSupportedOnCurrentMediaState( VARIANT_BOOL *value ); [DispId(0x100)] new bool IsSupportedOnCurrentMediaState { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Determines if this multi-session interface is the one you should use on the current media. /// /// Set to VARIANT_TRUE if this multi-session interface is the one you should use to write to the current media. Otherwise, VARIANT_FALSE. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisession-put_inuse HRESULT put_InUse( VARIANT_BOOL value ); [DispId(0x101)] new bool InUse { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the disc recorder to use to import one or more previous sessions. /// An IDiscRecorder2 interface that identifies the device that contains one or more session images to import. /// The import recorder reads session content from the optical media and provides it to IFileSystemImage. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisession-get_importrecorder HRESULT get_ImportRecorder( // IDiscRecorder2 **value ); [DispId(0x102)] new IDiscRecorder2 ImportRecorder { [return: MarshalAs(UnmanagedType.Interface)] get; } /// Determines if this session is the first data session on the media. /// Is VARIANT_TRUE if the session is the first data session on the media. Otherwise, the value is VARIANT_FALSE. /// /// This property is relevant on CD media that combine audio and data tracks/sessions, such as CD Extra and Mixed-Mode CD. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisessionsequential-get_isfirstdatasession HRESULT // get_IsFirstDataSession( VARIANT_BOOL *value ); [DispId(0x200)] bool IsFirstDataSession { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the first sector written in the previous session on the media. /// Sector number that identifies the starting point of the previous write session. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisessionsequential-get_startaddressofprevioussession // HRESULT get_StartAddressOfPreviousSession( LONG *value ); [DispId(0x201)] int StartAddressOfPreviousSession { get; } /// Retrieves the last sector of the previous write session. /// /// Address where the previous write operation ended. /// /// The value is -1 if the media is blank or does not support multi-session writing (indicates that no previous session could be detected). /// /// /// /// Note This property should not be used. Instead, you should use an interface derived from IMultisession, such as /// IMultisessionSequential, for importing file data from the previous session. /// // https://docs.microsoft.com/th-th/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-get_lastwrittenaddressofprevioussession // HRESULT get_LastWrittenAddressOfPreviousSession( LONG *value ); [DispId(0x202)] int LastWrittenAddressOfPreviousSession { get; } /// Retrieves the next writable address on the media, including used sectors. /// Sector number that identifies the next available sector that can record data or audio. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisessionsequential-get_nextwritableaddress HRESULT // get_NextWritableAddress( LONG *value ); [DispId(0x203)] int NextWritableAddress { get; } /// Retrieves the number of free sectors available on the media. /// Number of sectors on the disc that are available for use. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisessionsequential-get_freesectorsonmedia HRESULT // get_FreeSectorsOnMedia( LONG *value ); [DispId(0x204)] int FreeSectorsOnMedia { get; } } /// Use this interface to retrieve information about the size of a writeable unit on sequentially recorded media. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-imultisessionsequential2 [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IMultisessionSequential2")] [ComImport, Guid("27354151-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual), CoClass(typeof(MsftMultisessionSequential))] public interface IMultisessionSequential2 : IMultisessionSequential { /// Determines if the multi-session type can write to the current optical media. /// /// Is VARIANT_TRUE if the multi-session interface can write to the current optical media in its current state. Otherwise, VARIANT_FALSE. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisession-get_issupportedoncurrentmediastate HRESULT // get_IsSupportedOnCurrentMediaState( VARIANT_BOOL *value ); [DispId(0x100)] new bool IsSupportedOnCurrentMediaState { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Determines if this multi-session interface is the one you should use on the current media. /// /// Set to VARIANT_TRUE if this multi-session interface is the one you should use to write to the current media. Otherwise, VARIANT_FALSE. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisession-put_inuse HRESULT put_InUse( VARIANT_BOOL value ); [DispId(0x101)] new bool InUse { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the disc recorder to use to import one or more previous sessions. /// An IDiscRecorder2 interface that identifies the device that contains one or more session images to import. /// The import recorder reads session content from the optical media and provides it to IFileSystemImage. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisession-get_importrecorder HRESULT get_ImportRecorder( // IDiscRecorder2 **value ); [DispId(0x102)] new IDiscRecorder2 ImportRecorder { [return: MarshalAs(UnmanagedType.Interface)] get; } /// Determines if this session is the first data session on the media. /// Is VARIANT_TRUE if the session is the first data session on the media. Otherwise, the value is VARIANT_FALSE. /// /// This property is relevant on CD media that combine audio and data tracks/sessions, such as CD Extra and Mixed-Mode CD. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisessionsequential-get_isfirstdatasession HRESULT // get_IsFirstDataSession( VARIANT_BOOL *value ); [DispId(0x200)] new bool IsFirstDataSession { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the first sector written in the previous session on the media. /// Sector number that identifies the starting point of the previous write session. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisessionsequential-get_startaddressofprevioussession // HRESULT get_StartAddressOfPreviousSession( LONG *value ); [DispId(0x201)] new int StartAddressOfPreviousSession { get; } /// Retrieves the last sector of the previous write session. /// /// Address where the previous write operation ended. /// /// The value is -1 if the media is blank or does not support multi-session writing (indicates that no previous session could be detected). /// /// /// /// Note This property should not be used. Instead, you should use an interface derived from IMultisession, such as /// IMultisessionSequential, for importing file data from the previous session. /// // https://docs.microsoft.com/th-th/windows/win32/api/imapi2/nf-imapi2-idiscformat2data-get_lastwrittenaddressofprevioussession // HRESULT get_LastWrittenAddressOfPreviousSession( LONG *value ); [DispId(0x202)] new int LastWrittenAddressOfPreviousSession { get; } /// Retrieves the next writable address on the media, including used sectors. /// Sector number that identifies the next available sector that can record data or audio. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisessionsequential-get_nextwritableaddress HRESULT // get_NextWritableAddress( LONG *value ); [DispId(0x203)] new int NextWritableAddress { get; } /// Retrieves the number of free sectors available on the media. /// Number of sectors on the disc that are available for use. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisessionsequential-get_freesectorsonmedia HRESULT // get_FreeSectorsOnMedia( LONG *value ); [DispId(0x204)] new int FreeSectorsOnMedia { get; } /// Retrieves the size of a writeable unit on the media. /// The size of a writeable unit on the media in sectors. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-imultisessionsequential2-get_writeunitsize // HRESULT get_WriteUnitSize( LONG *value ); [DispId(0x205)] int WriteUnitSize { get; } } /// /// /// Use this interface to create a RAW CD image for use in writing to CD media in Disc-at-Once (DAO) mode. Images created with this /// interface can be written to CD media using the IDiscFormat2RawCD interface. /// /// /// To create an instance of this interface, call the CoCreateInstance function. Use__uuidof(MsftRawCDImageCreator) for the class /// identifier and __uuidof(IRawCDImageCreator) for the interface identifier. /// /// /// /// /// Images created with this interface can be written to persistent storage for later use, or can be provided directly to the /// IDiscFormat2RawCD interface for writing to CD media. /// /// DVD media does not support this type of writing. /// /// This interface is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 and /// Windows Server 2008 R2. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-irawcdimagecreator [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IRawCDImageCreator")] [ComImport, Guid("25983550-9D65-49CE-B335-40630D901227"), InterfaceType(ComInterfaceType.InterfaceIsDual), CoClass(typeof(MsftRawCDImageCreator))] public interface IRawCDImageCreator { /// Creates the final IStream object based on the current settings. /// Pointer to the finalized IStream object. /// /// /// IRawCDImageCreator::CreateResultImage can only be called once, and will result in the object becoming read-only. All /// properties associated with this object can be read but not modified. The resulting IStream object will be a disc image /// which starts at MSF 95:00:00, to allow writing of a single image to media with multiple starting addresses. /// /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagecreator-createresultimage HRESULT // CreateResultImage( IStream **resultStream ); [DispId(0x200)] IStream CreateResultImage(); /// Accepts the provided IStream object and saves the interface pointer as the next track in the image. /// /// A value, defined by IMAPI_CD_SECTOR_TYPE, that indicates the type of data. IMAPI_CD_SECTOR_AUDIO is the only value /// supported by the IRawCDImageCreator::AddTrack method. /// /// Pointer to the provided IStream object. /// A LONG value within a 1 to 99 range that will be associated with the new track. /// /// /// Any additional tracks must be compatible with all existing tracks. See the IMAPI_CD_SECTOR_TYPE enumeration for information on limitations. /// /// /// The data stream must be at least 4 seconds (300 sectors) long. Data stream may not cause final sector to exceed LBA 398,099 (MSF /// 88:29:74), as leadout would then exceed the MSF 89:59:74 maximum. /// /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagecreator-addtrack HRESULT AddTrack( // IMAPI_CD_SECTOR_TYPE dataType, IStream *data, LONG *trackIndex ); [DispId(0x201)] int AddTrack(IMAPI_CD_SECTOR_TYPE dataType, IStream data); /// /// Accepts the provided IStream object and saves the associated pointer to be used as data for the pre-gap for track 1. /// /// Pointer to the provided IStream object. /// /// /// This method can only be called prior to adding any tracks to the image. The data stream must be at least 2 seconds (or 150 /// sectors) long. /// /// /// The data stream should not result final sector exceeding LBA 397,799 (MSF 88:25:74), as the minimal-sized track plus leadout /// would then exceed the MSF 89:59:74 maximum. Additionally, it is recommended that the IMAPI_CD_SECTOR_TYPE value for the first /// track is implicitly defined as "Audio". The resulting audio can then only be heard by playing the first track and "rewinding" /// back to the start of the audio disc. /// /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagecreator-addspecialpregap HRESULT AddSpecialPregap( // IStream *data ); [DispId(0x202)] void AddSpecialPregap(IStream data); /// /// Allows the addition of custom R-W subcode, provided by the IStream. The provided object must have a size equal to the /// number of sectors in the raw disc image * 96 bytes when the final image is created. /// /// /// The subcode data (with 96 bytes per sector), where the 2 most significant bits must always be zero (as they are the P/Q bits). /// /// /// /// May be added anytime prior to calling IRawCDImageCreator::CreateResultImage. If IRawCDImageCreator::put_ResultingImageType is /// set to return PQ only, then this call will fail as no RW subcode will be used in the resulting image. /// /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagecreator-addsubcoderwgenerator HRESULT // AddSubcodeRWGenerator( IStream *subcode ); [DispId(0x203)] void AddSubcodeRWGenerator(IStream subcode); /// Gets or sets the value that defines the type of image file that will be generated. /// An IMAPI_FORMAT2_RAW_CD_DATA_SECTOR_TYPE enumeration that defines the type of image file. /// /// /// If the value set via IRawCDImageCreator::AddSubcodeRWGenerator is not NULL, then the PQ_ONLY type defined by /// IMAPI_FORMAT2_RAW_CD_DATA_SECTOR_TYPE is not a valid choice, as subcode would not be generated by the resulting image. /// /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagecreator-put_resultingimagetype HRESULT // put_ResultingImageType( IMAPI_FORMAT2_RAW_CD_DATA_SECTOR_TYPE value ); [DispId(0x100)] IMAPI_FORMAT2_RAW_CD_DATA_SECTOR_TYPE ResultingImageType { set; get; } /// /// Retrieves the value that defines the LBA for the start of the Leadout. This method can be utilized to determine if the image can /// be written to a piece of media by comparing it against the LastPossibleStartOfLeadout for the media. /// /// Pointer to a LONG value that represents the LBA for the start of the Leadout. /// /// Use of this method requires that at least 1 track has been added to the image. /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagecreator-get_startofleadout HRESULT // get_StartOfLeadout( LONG *value ); [DispId(0x101)] int StartOfLeadout { get; } /// /// Gets or sets the StartOfLeadoutLimit property value. This value specifies if the resulting image is required to fit on a piece /// of media with a StartOfLeadout greater than or equal to the LBA specified. /// /// Pointer to a LONG value that represents the current StartOfLeadoutLimit. /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagecreator-put_startofleadoutlimit HRESULT // put_StartOfLeadoutLimit( LONG value ); [DispId(0x102)] int StartOfLeadoutLimit { set; get; } /// /// Gets or sets the value that specifies if "Gapless Audio" recording is disabled. This property defaults to a value of /// VARIANT_FALSE, which disables the use of "gapless" recording between consecutive audio tracks. /// /// /// A VARIANT_BOOL value that specifies if "Gapless Audio" is disabled. Setting a value of VARIANT_FALSE disables /// "Gapless Audio", while VARIANT_TRUE enables it. /// /// /// /// When disabled, by default, the audio tracks will have the standard 2-second (150 sector) silent gap between tracks. When /// enabled, the last 2 seconds of audio data from the previous audio track are encoded in the pregap area of the next audio track, /// enabling seamless transitions between tracks. /// /// /// It is recommended that this property value is only set before the process of adding tracks to the image has begun as any changes /// afterwards could result in adverse effects to other image properties. /// /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagecreator-put_disablegaplessaudio HRESULT // put_DisableGaplessAudio( VARIANT_BOOL value ); [DispId(0x103)] bool DisableGaplessAudio { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Gets or sets the Media Catalog Number (MCN) for the entire audio disc. /// A BSTR value that represents the MCN to associate with the audio disc. /// /// /// The returned MCN is formatted as a 13-digit decimal number and must also be provided in the same form. Additionally, the /// provided MCN value must have a valid checksum digit (least significant digit), or it will be rejected. For improved /// compatibility with scripting, leading zeros may be excluded. For example, "0123456789012" can be expressed as "123456789012". /// /// Please refer to the MMC specification for details regarding the MCN value. /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagecreator-put_mediacatalognumber HRESULT // put_MediaCatalogNumber( BSTR value ); [DispId(0x104)] string MediaCatalogNumber { set; [return: MarshalAs(UnmanagedType.BStr)] get; } /// Gets or sets the starting track number. /// A LONG value that represents the starting track number. /// /// /// This property value can only be set before the addition of tracks. If this property is set to a value other than 1, all tracks /// added to the image must be audio tracks. /// /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagecreator-put_startingtracknumber HRESULT // put_StartingTrackNumber( LONG value ); [DispId(0x105)] int StartingTrackNumber { set; get; } /// /// Retrieves an indexed property, which takes a LONG value with a range of 1 to 99 as the index to determine which track the /// user is querying. The returned object is then queried/set for the particular per-track property of interest. /// /// A LONG value within a 1 to 99 range that is used to specify which track is queried. /// /// A pointer to a pointer to an IRawCDImageTrackInfo object that contains information about the track associated with the specified /// trackInfo index value. /// /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagecreator-get_trackinfo HRESULT get_TrackInfo( LONG // trackIndex, IRawCDImageTrackInfo **value ); [DispId(0x106)] IRawCDImageTrackInfo get_TrackInfo(int trackIndex); /// Retrieves the number of existing audio tracks on the media. /// Pointer to a LONG value that indicates the number of audio tracks that currently exist on the media. /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagecreator-get_numberofexistingtracks HRESULT // get_NumberOfExistingTracks( LONG *value ); [DispId(0x107)] int NumberOfExistingTracks { get; } /// Retrieves the number of total used sectors on the current media, including any overhead between existing tracks. /// Pointer to a LONG value that indicates the number of total used sectors on the media. /// /// /// This value represents the LBA of the last sector with data that is considered part of a track, and does not include the overhead /// of the leadin, leadout, or the two-seconds between MSF 00:00:00 and MSF 00:02:00. /// /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagecreator-get_lastusedusersectorinimage HRESULT // get_LastUsedUserSectorInImage( LONG *value ); [DispId(0x108)] int LastUsedUserSectorInImage { get; } /// Gets the SCSI-form table of contents for the resulting disc. /// /// The SCSI-form table of contents for the resulting disc. Accuracy of this value depends on /// IRawCDImageCreator::get_ExpectedTableOfContents being called after all image properties have been set. /// /// /// This method can only be called after at least one track has been added to the image. /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagecreator-get_expectedtableofcontents HRESULT // get_ExpectedTableOfContents( SAFEARRAY **value ); [DispId(0x109)] object[] ExpectedTableOfContents { get; } } /// Use this interface to track per-track properties that are applied to CD media. /// /// This interface is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 and /// Windows Server 2008 R2. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-irawcdimagetrackinfo [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IRawCDImageTrackInfo")] [ComImport, Guid("25983551-9D65-49CE-B335-40630D901227"), InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface IRawCDImageTrackInfo { /// Retrieves the LBA of the first user sectors in this track. /// The LBA of the first user sectors in this track. /// /// Most tracks also include a pregap and postgap, which are not included in this value. /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagetrackinfo-get_startinglba HRESULT get_StartingLba( // LONG *value ); [DispId(0x100)] int StartingLba { get; } /// Retrieves the number of user sectors in this track. /// The number of user sectors in this track. /// /// /// The end of the track is typically the StartingLBA plus the SectorCount. The start of the next track includes both /// of these properties plus any required pregap or postgap. /// /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagetrackinfo-get_sectorcount HRESULT get_SectorCount( // LONG *value ); [DispId(0x101)] int SectorCount { get; } /// Retrieves the track number for this track. /// The track number for this track. /// /// /// While this value is often identical to the TrackIndex property, it is possible for pure audio discs to start with a track /// other than track number 1. This means that the more general formula is that this value is ( TrackIndex + FirstTrackNumber - 1). /// /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagetrackinfo-get_tracknumber HRESULT get_TrackNumber( // LONG *value ); [DispId(0x102)] int TrackNumber { get; } /// /// Retrieves the type of data provided for the sectors in this track. For more detail on the possible sector types, see IMAPI_CD_SECTOR_TYPE. /// /// /// A pointer to a IMAPI_CD_SECTOR_TYPE enumeration that specifies the type of data provided for the sectors on the track. /// /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagetrackinfo-get_sectortype HRESULT get_SectorType( // IMAPI_CD_SECTOR_TYPE *value ); [DispId(0x103)] IMAPI_CD_SECTOR_TYPE SectorType { get; } /// /// Gets or sets the International Standard Recording Code (ISRC) currently associated with the track. This property value defaults /// to NULL (or a zero-length string) and may only be set for tracks containing audio data. /// /// The ISRC to associate with the track. /// /// /// The format of the ISRC is provided to the caller formatted per ISRC standards (DIN-31-621) recommendations, such as /// "US-K7Y-98-12345". When set, the provided string may optionally exclude all the '-' characters. /// /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagetrackinfo-put_isrc HRESULT put_ISRC( BSTR value ); [DispId(0x104)] bool ISRC { set; [return: MarshalAs(UnmanagedType.BStr)] get; } /// /// Sets the digital audio copy "Allowed" bit to one of three values on the resulting media. Please see the /// IMAPI_CD_TRACK_DIGITAL_COPY_SETTING enumeration for additional information on each possible value. /// /// The digital audio copy setting value to assign. /// /// This property may only be set for tracks containing audio data. /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagetrackinfo-put_digitalaudiocopysetting HRESULT // put_DigitalAudioCopySetting( IMAPI_CD_TRACK_DIGITAL_COPY_SETTING value ); [DispId(0x105)] IMAPI_CD_TRACK_DIGITAL_COPY_SETTING DigitalAudioCopySetting { set; get; } /// /// Sets the value that specifies if an audio track has an additional pre-emphasis added to the audio data prior to being written to CD. /// /// Value that specifies if an audio track has an additional pre-emphasis added to the audio data. /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagetrackinfo-put_audiohaspreemphasis HRESULT // put_AudioHasPreemphasis( VARIANT_BOOL value ); [DispId(0x106)] bool AudioHasPreemphasis { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the one-based index of the tracks on the disc. /// The one-based index associated with this track. /// /// This method is supported in Windows Server 2003 with Service Pack 1 (SP1), Windows XP with Service Pack 2 (SP2), and Windows /// Vista via the Windows Feature Pack for Storage. All features provided by this update package are supported natively in Windows 7 /// and Windows Server 2008 R2. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-irawcdimagetrackinfo-get_trackindexes HRESULT // get_TrackIndexes( SAFEARRAY **value ); [DispId(0x107)] int[] TrackIndexes { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; } /// Add the specified LBA (relative to the start of the track) as an index. /// The LBA to add. This must be a value in the range of 0 and 0x7FFFFFFF. [DispId(0x200)] void AddTrackIndex(int lbaOffset); /// Removes the specified LBA (relative to the start of the track) as an index. /// The LBA to remove. This must be a value in the range of 0 and 0x7FFFFFFF. [DispId(0x201)] void ClearTrackIndex(int lbaOffset); } /// /// Use this interface to write a data stream to a device. /// /// This interface should be used by those developing support for new media types or formats. Writing to media typically includes the /// following steps: /// /// /// /// Preparing the hardware by setting mode pages for the media. /// /// /// Querying the hardware to verify that the media is large enough. /// /// /// Initializing the write, for example, by formatting the media or setting OPC. /// /// /// Performing the actual WRITE commands. /// /// /// Finishing the write by stopping the formatting or closing the session or track. /// /// /// /// When developing support for new media types, you can implement steps 1, 2, 3, and 5, and use this interface to perform step 4. Note /// that all the IDiscFormat2* interfaces use this interface to perform the write operation. /// /// Most client applications should use the IDiscFormat2Data interface to write images to a device. /// /// To create an instance of this interface, call the CoCreateInstance function. Use__uuidof(MsftWriteEngine2) for the class /// identifier and __uuidof(IWriteEngine2) for the interface identifier. /// /// /// /// /// To create the MsftWriteEngine2 object in a script, use IMAPI2.MsftWriteEngine2 as the program identifier when calling CreateObject. /// /// /// It is possible for a power state transition to take place during a burn operation (i.e. user log-off or system suspend) which leads /// to the interruption of the burn process and possible data loss. For programming considerations, see Preventing Logoff or Suspend /// During a Burn. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-iwriteengine2 [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IWriteEngine2")] [ComImport, Guid("27354135-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual), CoClass(typeof(MsftWriteEngine2))] public interface IWriteEngine2 { /// Writes a data stream to the current recorder. /// An IStream interface of the data stream to write to the recorder. /// Starting logical block address (LBA) of the write operation. Negative values are supported. /// Number of blocks from the data stream to write. /// /// /// Before calling this method, you must call the IWriteEngine2::put_Recorder method to specify the recording device and the /// IWriteEngine2::put_BytesPerSector method to specify the number of bytes to use for each sector during writing. /// /// You should also consider calling the following methods if their default values are not appropriate for your application: /// /// /// IWriteEngine2::put_EndingSectorsPerSecond /// /// /// IWriteEngine2::put_StartingSectorsPerSecond /// /// /// IWriteEngine2::put_UseStreamingWrite12 /// /// /// /// This method is synchronous. To determine the progress of the write operation, you must implement the DWriteEngine2Events /// interface. For examples that show how to implement an event handler in a script, see Monitoring Progress With Events. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2-writesection HRESULT WriteSection( IStream // *data, LONG startingBlockAddress, LONG numberOfBlocks ); [DispId(0x200)] void WriteSection([In, MarshalAs(UnmanagedType.Interface)] IStream data, int startingBlockAddress, int numberOfBlocks); /// Cancels a write operation that is in progress. /// /// To cancel the write operation, you must call this method from the DWriteEngine2Events::Update event handler that you implemented. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2-cancelwrite HRESULT CancelWrite(); [DispId(0x201)] void CancelWrite(); /// Retrieves the recording device to use in the write operation. /// An IDiscRecorder2Ex interface that identifies the recording device to use in the write operation. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2-get_recorder HRESULT get_Recorder( // IDiscRecorder2Ex **value ); [DispId(0x100)] IDiscRecorder2Ex Recorder { set; [return: MarshalAs(UnmanagedType.Interface)] get; } /// Sets a value that indicates if the write operations use the WRITE12 or WRITE10 command. /// /// Set to VARIANT_TRUE to use the WRITE12 command with the streaming bit set to one when writing to disc. Otherwise, set /// VARIANT_FALSE to use the WRITE10 command. The default is VARIANT_FALSE. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2-put_usestreamingwrite12 HRESULT // put_UseStreamingWrite12( VARIANT_BOOL value ); [DispId(0x101)] bool UseStreamingWrite12 { set; [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// /// Sets the estimated number of sectors per second that the recording device can write to the media at the start of the writing process. /// /// /// Approximate number of sectors per second that the recording device can write to the media at the start of the writing process. /// The default is -1 for maximum speed. /// /// This is used to optimize sleep time in the write engine. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2-put_startingsectorspersecond HRESULT // put_StartingSectorsPerSecond( LONG value ); [DispId(0x102)] int StartingSectorsPerSecond { set; get; } /// /// Retrieves the estimated number of sectors per second that the recording device can write to the media at the end of the writing process. /// /// /// Approximate number of sectors per second that the recording device can write to the media at the end of the writing process. /// A value of -1 indicates maximum speed. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2-get_endingsectorspersecond HRESULT // get_EndingSectorsPerSecond( LONG *value ); [DispId(0x103)] int EndingSectorsPerSecond { set; get; } /// Sets the number of bytes to use for each sector during writing. /// /// Number of bytes to use for each sector during writing. The minimum size is 1 byte and the maximum is MAXLONG bytes. Typically, /// this value is 2,048 bytes for CD media, although any arbitrary size is supported (such as 2352 or 2448). This value is limited /// to the IDiscRecorder2Ex::GetMaximumPageAlignedTransferSize, which is typically 65,536 (64K) bytes. /// /// You must specify a logical block size. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2-put_bytespersector HRESULT put_BytesPerSector( // LONG value ); [DispId(0x104)] int BytesPerSector { set; get; } /// Retrieves a value that indicates whether the recorder is currently writing data to the disc. /// /// If VARIANT_TRUE, the recorder is currently writing data to the disc. Otherwise, if VARIANT_FALSE, the recorder is not currently /// writing to disc. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2-get_writeinprogress HRESULT // get_WriteInProgress( VARIANT_BOOL *value ); [DispId(0x105)] bool WriteInProgress { [return: MarshalAs(UnmanagedType.VariantBool)] get; } } /// /// Use this interface to retrieve information about the current write operation. This interface is passed to the /// DWriteEngine2Events::Update method that you implement. /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-iwriteengine2eventargs [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IWriteEngine2EventArgs")] [ComImport, Guid("27354136-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual)] public interface IWriteEngine2EventArgs { /// Retrieves the starting logical block address (LBA) of the current write operation. /// Starting logical block address of the write operation. Negative values for LBAs are supported. /// This is the same value passed to the IWriteEngine2::WriteSection method. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_startlba HRESULT get_StartLba( // LONG *value ); [DispId(0x100)] int StartLba { get; } /// Retrieves the number of sectors to write to the device in the current write operation. /// The number of sectors to write in the current write operation. /// This is the same value passed to the IWriteEngine2::WriteSection method. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_sectorcount HRESULT // get_SectorCount( LONG *value ); [DispId(0x101)] int SectorCount { get; } /// Retrieves the address of the sector most recently read from the burn image. /// Logical block address of the sector most recently read from the input data stream. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_lastreadlba HRESULT // get_LastReadLba( LONG *value ); [DispId(0x102)] int LastReadLba { get; } /// Retrieves the address of the sector most recently written to the device. /// Logical block address of the sector most recently written to the device. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_lastwrittenlba HRESULT // get_LastWrittenLba( LONG *value ); [DispId(0x103)] int LastWrittenLba { get; } /// Retrieves the size of the internal data buffer that is used for writing to disc. /// Size, in bytes, of the internal data buffer that is used for writing to disc. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_totalsystembuffer HRESULT // get_TotalSystemBuffer( LONG *value ); [DispId(0x106)] int TotalSystemBuffer { get; } /// Retrieves the number of used bytes in the internal data buffer that is used for writing to disc. /// Size, in bytes, of the used portion of the internal data buffer that is used for writing to disc. /// This value increases as data is read into the buffer and decreases as data is written to disc. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_usedsystembuffer HRESULT // get_UsedSystemBuffer( LONG *value ); [DispId(0x107)] int UsedSystemBuffer { get; } /// Retrieves the number of unused bytes in the internal data buffer that is used for writing to disc. /// Size, in bytes, of the unused portion of the internal data buffer that is used for writing to disc. /// This method returns the same value as if you subtracted IWriteEngine2EventArgs::get_UsedSystemBuffer from IWriteEngine2EventArgs::get_TotalSystemBuffer. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwriteengine2eventargs-get_freesystembuffer HRESULT // get_FreeSystemBuffer( LONG *value ); [DispId(0x108)] int FreeSystemBuffer { get; } } /// /// /// Use this interface retrieve detailed write configurations supported by the disc recorder and current media, for example, the media /// type, write speed, rotational-speed control type. /// /// To get this interface, call one of the following methods: /// /// /// IDiscFormat2Data::get_SupportedWriteSpeedDescriptors /// /// /// IDiscFormat2RawCD::get_SupportedWriteSpeedDescriptors /// /// /// IDiscFormat2TrackAtOnce::get_SupportedWriteSpeedDescriptors /// /// /// /// This is a MsftWriteSpeedDescriptor object in script. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nn-imapi2-iwritespeeddescriptor [PInvokeData("imapi2.h", MSDNShortId = "NN:imapi2.IWriteSpeedDescriptor")] [ComImport, Guid("27354144-7F64-5B0F-8F00-5D77AFBE261E"), InterfaceType(ComInterfaceType.InterfaceIsDual), CoClass(typeof(MsftWriteSpeedDescriptor))] public interface IWriteSpeedDescriptor { /// Retrieves type of media in the current drive. /// Type of media in the current drive. For possible values, see the IMAPI_MEDIA_PHYSICAL_TYPE enumeration type. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwritespeeddescriptor-get_mediatype HRESULT get_MediaType( // IMAPI_MEDIA_PHYSICAL_TYPE *value ); [DispId(0x101)] IMAPI_MEDIA_PHYSICAL_TYPE MediaType { get; } /// Retrieves the supported rotational-speed control used by the recorder for the current media. /// /// Is VARIANT_TRUE if constant angular velocity (CAV) rotational-speed control is in use. Otherwise, VARIANT_FALSE to indicate that /// another rotational-speed control that the recorder supports is in use. /// /// /// Rotational-speed control types include the following: /// /// /// CLV (Constant Linear Velocity). The disc is written at a constant speed. Standard rotational control. /// /// /// CAV (Constant Angular Velocity). The disc is written at a constantly increasing speed. /// /// /// /// ZCAV (Zone Constant Linear Velocity). The disc is divided into zones. After each zone, the write speed increases. This is an /// impure form of CAV. /// /// /// /// /// PCAV (Partial Constant Angular Velocity). The disc speed increases up to a specified velocity. Once reached, the disc spins at /// the specified velocity for the duration of the disc writing. /// /// /// /// // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwritespeeddescriptor-get_rotationtypeispurecav HRESULT // get_RotationTypeIsPureCAV( VARIANT_BOOL *value ); [DispId(0x102)] bool RotationTypeIsPureCAV { [return: MarshalAs(UnmanagedType.VariantBool)] get; } /// Retrieves the supported write speed for writing to the media. /// Write speed of the current media, measured in sectors per second. /// The write speed is based on the media write speeds. The value of this property can change when a media change occurs. // https://docs.microsoft.com/en-us/windows/win32/api/imapi2/nf-imapi2-iwritespeeddescriptor-get_writespeed HRESULT get_WriteSpeed( // LONG *value ); [DispId(0x103)] int WriteSpeed { get; } } /// CLSID_MsftDiscFormat2Data [ComImport, Guid("2735412A-7F64-5B0F-8F00-5D77AFBE261E"), ClassInterface(ClassInterfaceType.None)] public class MsftDiscFormat2Data { } /// CLSID_MsftDiscFormat2Erase [ComImport, Guid("2735412B-7F64-5B0F-8F00-5D77AFBE261E"), ClassInterface(ClassInterfaceType.None)] public class MsftDiscFormat2Erase { } /// CLSID_MsftDiscFormat2RawCD [ComImport, Guid("27354128-7F64-5B0F-8F00-5D77AFBE261E"), ClassInterface(ClassInterfaceType.None)] public class MsftDiscFormat2RawCD { } /// CLSID_MsftDiscFormat2TrackAtOnce [ComImport, Guid("27354129-7F64-5B0F-8F00-5D77AFBE261E"), ClassInterface(ClassInterfaceType.None)] public class MsftDiscFormat2TrackAtOnce { } /// CLSID_MsftDiscMaster2 [ComImport, Guid("2735412E-7F64-5B0F-8F00-5D77AFBE261E"), ClassInterface(ClassInterfaceType.None)] public class MsftDiscMaster2 { } /// CLSID_MsftDiscRecorder2 [ComImport, Guid("2735412D-7F64-5B0F-8F00-5D77AFBE261E"), ClassInterface(ClassInterfaceType.None)] public class MsftDiscRecorder2 { } /// CLSID_MsftMultisessionRandomWrite [ComImport, Guid("B507CA24-2204-11DD-966A-001AA01BBC58"), ClassInterface(ClassInterfaceType.None)] public class MsftMultisessionRandomWrite { } /// CLSID_MsftMultisessionSequential [ComImport, Guid("27354122-7F64-5B0F-8F00-5D77AFBE261E"), ClassInterface(ClassInterfaceType.None)] public class MsftMultisessionSequential { } /// CLSID_MsftRawCDImageCreator [ComImport, Guid("25983561-9D65-49CE-B335-40630D901227"), ClassInterface(ClassInterfaceType.None)] public class MsftRawCDImageCreator { } /// CLSID_MsftWriteEngine2 [ComImport, Guid("2735412C-7F64-5B0F-8F00-5D77AFBE261E"), ClassInterface(ClassInterfaceType.None)] public class MsftWriteEngine2 { } /// CLSID_MsftWriteSpeedDescriptor [ComImport, Guid("27354123-7F64-5B0F-8F00-5D77AFBE261E"), ClassInterface(ClassInterfaceType.None)] public class MsftWriteSpeedDescriptor { } } }