diff --git a/PInvoke/IMAPI/IMAPIv2.Enums.cs b/PInvoke/IMAPI/IMAPIv2.Enums.cs
index a2746223..aec1fce4 100644
--- a/PInvoke/IMAPI/IMAPIv2.Enums.cs
+++ b/PInvoke/IMAPI/IMAPIv2.Enums.cs
@@ -429,6 +429,14 @@ namespace Vanara.PInvoke
IMAPI_FEATURE_PAGE_TYPE_VCPS = 0x110,
}
+ /// Reports information (but not errors) about the media state.
+ [Description("Mask of 'supported/informational' media flags")]
+ public const IMAPI_FORMAT2_DATA_MEDIA_STATE IMAPI_FORMAT2_DATA_MEDIA_STATE_INFORMATIONAL_MASK = (IMAPI_FORMAT2_DATA_MEDIA_STATE)0x000F;
+
+ /// Reports an unsupported media state.
+ [Description("Mask of 'not supported' media flags")]
+ public const IMAPI_FORMAT2_DATA_MEDIA_STATE IMAPI_FORMAT2_DATA_MEDIA_STATE_UNSUPPORTED_MASK = (IMAPI_FORMAT2_DATA_MEDIA_STATE)0xFC00;
+
/// Defines values for the possible media states.
///
/// This enumeration should be treated as a bitmask. Nearly all of the values set one bit set to one and the other bits to zero. Three
@@ -451,14 +459,6 @@ namespace Vanara.PInvoke
[Description("Unknown")]
IMAPI_FORMAT2_DATA_MEDIA_STATE_UNKNOWN = 0x0,
- /// Reports information (but not errors) about the media state.
- [Description("Mask of 'supported/informational' media flags")]
- IMAPI_FORMAT2_DATA_MEDIA_STATE_INFORMATIONAL_MASK = 0x000F,
-
- /// Reports an unsupported media state.
- [Description("Mask of 'not supported' media flags")]
- IMAPI_FORMAT2_DATA_MEDIA_STATE_UNSUPPORTED_MASK = 0xFC00,
-
/// Write operations can occur on used portions of the disc.
[Description("Media may only be overwritten")]
IMAPI_FORMAT2_DATA_MEDIA_STATE_OVERWRITE_ONLY = 0x0001,
diff --git a/PInvoke/IMAPI/IMAPIv2.cs b/PInvoke/IMAPI/IMAPIv2.cs
index 45cd4bc7..71f2c093 100644
--- a/PInvoke/IMAPI/IMAPIv2.cs
+++ b/PInvoke/IMAPI/IMAPIv2.cs
@@ -489,9 +489,28 @@ namespace Vanara.PInvoke
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 : IDiskFormat2
+ public interface IDiscFormat2Data : IDiscFormat2
{
/// Determines if the recorder supports the given format.
/// An IDiscRecorder2 interface of the recorder to test.
@@ -1122,7 +1141,7 @@ namespace Vanara.PInvoke
// 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 : IDiskFormat2
+ public interface IDiscFormat2Erase : IDiscFormat2
{
/// Determines if the recorder supports the given format.
/// An IDiscRecorder2 interface of the recorder to test.
@@ -1286,7 +1305,7 @@ namespace Vanara.PInvoke
// 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 : IDiskFormat2
+ public interface IDiscFormat2RawCD : IDiscFormat2
{
/// Determines if the recorder supports the given format.
/// An IDiscRecorder2 interface of the recorder to test.
@@ -1794,7 +1813,7 @@ namespace Vanara.PInvoke
// 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 : IDiskFormat2
+ public interface IDiscFormat2TrackAtOnce : IDiscFormat2
{
/// Determines if the recorder supports the given format.
/// An IDiscRecorder2 interface of the recorder to test.
@@ -2325,15 +2344,34 @@ namespace Vanara.PInvoke
///
/// 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 DDiscMaster2Events interface.
+ /// 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
{
- /// Returns an enumerator that iterates through a collection.
- /// An object that can be used to iterate through the collection.
+ /// 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();
@@ -3177,6 +3215,34 @@ namespace Vanara.PInvoke
uint GetMaximumPageAlignedTransferSize();
}
+ /// 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.
+ ///
+ ///
+ /// 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:
///
@@ -3197,7 +3263,7 @@ namespace Vanara.PInvoke
// 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 IDiskFormat2
+ public interface IDiscFormat2
{
/// Determines if the recorder supports the given format.
/// An IDiscRecorder2 interface of the recorder to test.
@@ -3259,6 +3325,18 @@ namespace Vanara.PInvoke
IMAPI_MEDIA_PHYSICAL_TYPE[] SupportedMediaTypes { [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SafeArrayMarshaler))] get; }
}
+ public static IMAPI_MEDIA_PHYSICAL_TYPE GetCurrentPhysicalMediaType(this IDiscFormat2 formatter) =>
+ (IMAPI_MEDIA_PHYSICAL_TYPE)formatter.GetType().InvokeMember("CurrentPhysicalMediaType", System.Reflection.BindingFlags.GetProperty, null, formatter, null);
+
+ public static IDiscRecorder2 GetRecorder(this IDiscFormat2 formatter) =>
+ (IDiscRecorder2)formatter.GetType().InvokeMember("Recorder", System.Reflection.BindingFlags.GetProperty, null, formatter, null);
+
+ public static void SetRecorder(this IDiscFormat2 formatter, IDiscRecorder2 recorder) =>
+ formatter.GetType().InvokeMember("Recorder", System.Reflection.BindingFlags.SetProperty, null, formatter, new object[] { recorder });
+
+ public static void SetClientName(this IDiscFormat2 formatter, string clientName) =>
+ formatter.GetType().InvokeMember("ClientName", System.Reflection.BindingFlags.SetProperty, null, formatter, new object[] { clientName });
+
///
/// Base interface containing properties common to derived multisession interfaces.
///
@@ -3394,7 +3472,6 @@ namespace Vanara.PInvoke
int TotalSectorsOnMedia { get; }
}
-
///
///
/// Use this interface to retrieve information about the previous import session on a sequentially recorded media, if the media