using System; using System.Collections; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using System.Runtime.InteropServices.ComTypes; using System.Runtime.InteropServices.CustomMarshalers; namespace Storage.Interop.IMAPIv2FileSystem { // Interfaces #region IFileSystemImage [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [Guid("2C941FE1-975B-59BE-A960-9A2A262853A5")] public interface IFileSystemImage { /// /// Root directory item /// [DispId(0)] IFsiDirectoryItem Root { get; } /// /// Disc start block for the image /// [DispId(1)] int SessionStartBlock { get; set; } /// /// Maximum number of blocks available for the image /// [DispId(2)] int FreeMediaBlocks { get; set; } /// /// Set maximum number of blocks available based on the recorder supported discs. /// 0 for unknown maximum may be set. /// /// [DispId(36)] void SetMaxMediaBlocksFromDevice(Storage.Interop.IMAPIv2.IDiscRecorder2 discRecorder); /// /// Number of blocks in use /// [DispId(3)] int UsedBlocks { get; } /// /// Volume name /// [DispId(4)] string VolumeName { get; set; } /// /// Imported Volume name /// [DispId(5)] string ImportedVolumeName { get; } /// /// Boot image and boot options /// [DispId(6)] IBootOptions BootImageOptions { get; set; } /// /// Number of files in the image /// [DispId(7)] int FileCount { get; } /// /// Number of directories in the image /// [DispId(8)] int DirectoryCount { get; } /// /// Temp directory for stash files /// [DispId(9)] string WorkingDirectory { get; set; } /// /// Change point identifier /// [DispId(10)] int ChangePoint { get; } /// /// Strict file system compliance option /// [DispId(11)] bool StrictFileSystemCompliance { get; set; } /// /// If true, indicates restricted character set is being used for file and directory names /// [DispId(12)] bool UseRestrictedCharacterSet { get; set; } /// /// File systems to create /// [DispId(13)] FileSystems FileSystemsToCreate { get; set; } /// /// File systems supported /// [DispId(14)] FileSystems FileSystemsSupported { get; } /// /// UDF revision /// [DispId(37)] int UDFRevision { set; get; } /// /// UDF revision(s) supported /// [DispId(31)] Array UDFRevisionsSupported { get; } /// /// Select filesystem types and image size based on the current media /// /// [DispId(32)] void ChooseImageDefaults(Storage.Interop.IMAPIv2.IDiscRecorder2 discRecorder); /// /// Select filesystem types and image size based on the media type /// /// [DispId(33)] void ChooseImageDefaultsForMediaType(Storage.Interop.IMAPIv2.MediaPhysicalType value); /// /// ISO compatibility level to create /// [DispId(34)] int ISO9660InterchangeLevel { set; get; } /// /// ISO compatibility level(s) supported /// [DispId(38)] Array ISO9660InterchangeLevelsSupported { get; } /// /// Create result image stream /// /// [DispId(15)] IFileSystemImageResult CreateResultImage(); /// /// Check for existance an item in the file system /// /// /// [DispId(16)] FSItemType Exists(string FullPath); /// /// Return a string useful for identifying the current disc /// /// [DispId(18)] string CalculateDiscIdentifier(); /// /// Identify file systems on a given disc /// /// /// [DispId(19)] FileSystems IdentifyFileSystemsOnDisc(Storage.Interop.IMAPIv2.IDiscRecorder2 discRecorder); /// /// Identify which of the specified file systems would be imported by default /// /// /// [DispId(20)] FileSystems GetDefaultFileSystemForImport(FileSystems fileSystems); /// /// Import the default file system on the current disc /// /// [DispId(21)] FileSystems ImportFileSystem(); /// /// Import a specific file system on the current disc /// /// [DispId(22)] void ImportSpecificFileSystem(FileSystems fileSystemToUse); /// /// Roll back to the specified change point /// /// [DispId(23)] void RollbackToChangePoint(int ChangePoint); /// /// Lock in changes /// [DispId(24)] void LockInChangePoint(); /// /// Create a directory item with the specified name /// /// /// [DispId(25)] IFsiDirectoryItem CreateDirectoryItem(string Name); /// /// Create a file item with the specified name /// /// /// [DispId(26)] IFsiFileItem CreateFileItem(string Name); /// /// Volume name /// [DispId(27)] string VolumeNameUDF { get; } /// /// Volume name /// [DispId(28)] string VolumeNameJoliet { get; } /// /// Volume name /// [DispId(29)] string VolumeNameISO9660 { get; } /// /// Indicates whether or not IMAPI should stage the filesystem before the burn. /// Set to false to force IMAPI to not stage the filesystem prior to the burn. /// [DispId(30)] bool StageFiles { get; set; } /// /// available multi-session interfaces. /// [DispId(40)] Object[] MultisessionInterfaces { get; set; } } [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [Guid("D7644B2C-1537-4767-B62F-F1387B02DDFD")] public interface IFileSystemImage2 { /// /// Root directory item /// [DispId(0)] IFsiDirectoryItem Root { get; } /// /// Disc start block for the image /// [DispId(1)] int SessionStartBlock { get; set; } /// /// Maximum number of blocks available for the image /// [DispId(2)] int FreeMediaBlocks { get; set; } /// /// Set maximum number of blocks available based on the recorder supported discs. /// 0 for unknown maximum may be set. /// /// [DispId(36)] void SetMaxMediaBlocksFromDevice(Storage.Interop.IMAPIv2.IDiscRecorder2 discRecorder); /// /// Number of blocks in use /// [DispId(3)] int UsedBlocks { get; } /// /// Volume name /// [DispId(4)] string VolumeName { get; set; } /// /// Imported Volume name /// [DispId(5)] string ImportedVolumeName { get; } /// /// Boot image and boot options /// [DispId(6)] IBootOptions BootImageOptions { get; set; } /// /// Number of files in the image /// [DispId(7)] int FileCount { get; } /// /// Number of directories in the image /// [DispId(8)] int DirectoryCount { get; } /// /// Temp directory for stash files /// [DispId(9)] string WorkingDirectory { get; set; } /// /// Change point identifier /// [DispId(10)] int ChangePoint { get; } /// /// Strict file system compliance option /// [DispId(11)] bool StrictFileSystemCompliance { get; set; } /// /// If true, indicates restricted character set is being used for file and directory names /// [DispId(12)] bool UseRestrictedCharacterSet { get; set; } /// /// File systems to create /// [DispId(13)] FileSystems FileSystemsToCreate { get; set; } /// /// File systems supported /// [DispId(14)] FileSystems FileSystemsSupported { get; } /// /// UDF revision /// [DispId(37)] int UDFRevision { set; get; } /// /// UDF revision(s) supported /// [DispId(31)] Array UDFRevisionsSupported { get; } /// /// Select filesystem types and image size based on the current media /// /// [DispId(32)] void ChooseImageDefaults(Storage.Interop.IMAPIv2.IDiscRecorder2 discRecorder); /// /// Select filesystem types and image size based on the media type /// /// [DispId(33)] void ChooseImageDefaultsForMediaType(Storage.Interop.IMAPIv2.MediaPhysicalType value); /// /// ISO compatibility level to create /// [DispId(34)] int ISO9660InterchangeLevel { set; get; } /// /// ISO compatibility level(s) supported /// [DispId(38)] Array ISO9660InterchangeLevelsSupported { get; } /// /// Create result image stream /// /// [DispId(15)] IFileSystemImageResult CreateResultImage(); /// /// Check for existance an item in the file system /// /// /// [DispId(16)] FSItemType Exists(string FullPath); /// /// Return a string useful for identifying the current disc /// /// [DispId(18)] string CalculateDiscIdentifier(); /// /// Identify file systems on a given disc /// /// /// [DispId(19)] FileSystems IdentifyFileSystemsOnDisc(Storage.Interop.IMAPIv2.IDiscRecorder2 discRecorder); /// /// Identify which of the specified file systems would be imported by default /// /// /// [DispId(20)] FileSystems GetDefaultFileSystemForImport(FileSystems fileSystems); /// /// Import the default file system on the current disc /// /// [DispId(21)] FileSystems ImportFileSystem(); /// /// Import a specific file system on the current disc /// /// [DispId(22)] void ImportSpecificFileSystem(FileSystems fileSystemToUse); /// /// Roll back to the specified change point /// /// [DispId(23)] void RollbackToChangePoint(int ChangePoint); /// /// Lock in changes /// [DispId(24)] void LockInChangePoint(); /// /// Create a directory item with the specified name /// /// /// [DispId(25)] IFsiDirectoryItem CreateDirectoryItem(string Name); /// /// Create a file item with the specified name /// /// /// [DispId(26)] IFsiFileItem CreateFileItem(string Name); /// /// Volume name /// [DispId(27)] string VolumeNameUDF { get; } /// /// Volume name /// [DispId(28)] string VolumeNameJoliet { get; } /// /// Volume name /// [DispId(29)] string VolumeNameISO9660 { get; } /// /// Indicates whether or not IMAPI should stage the filesystem before the burn. /// Set to false to force IMAPI to not stage the filesystem prior to the burn. /// [DispId(30)] bool StageFiles { get; set; } /// /// available multi-session interfaces. /// [DispId(40)] Object[] MultisessionInterfaces { get; set; } // IFileSystemImage2 /// /// Get or Set boot options array for supporting multi-boot /// [DispId(60)] Object[] BootImageOptionsArray { get; set; } } [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [Guid("7CFF842C-7E97-4807-8304-910DD8F7C051")] public interface IFileSystemImage3 { /// /// Root directory item /// [DispId(0)] IFsiDirectoryItem Root { get; } /// /// Disc start block for the image /// [DispId(1)] int SessionStartBlock { get; set; } /// /// Maximum number of blocks available for the image /// [DispId(2)] int FreeMediaBlocks { get; set; } /// /// Set maximum number of blocks available based on the recorder supported discs. /// 0 for unknown maximum may be set. /// /// [DispId(36)] void SetMaxMediaBlocksFromDevice(Storage.Interop.IMAPIv2.IDiscRecorder2 discRecorder); /// /// Number of blocks in use /// [DispId(3)] int UsedBlocks { get; } /// /// Volume name /// [DispId(4)] string VolumeName { get; set; } /// /// Imported Volume name /// [DispId(5)] string ImportedVolumeName { get; } /// /// Boot image and boot options /// [DispId(6)] IBootOptions BootImageOptions { get; set; } /// /// Number of files in the image /// [DispId(7)] int FileCount { get; } /// /// Number of directories in the image /// [DispId(8)] int DirectoryCount { get; } /// /// Temp directory for stash files /// [DispId(9)] string WorkingDirectory { get; set; } /// /// Change point identifier /// [DispId(10)] int ChangePoint { get; } /// /// Strict file system compliance option /// [DispId(11)] bool StrictFileSystemCompliance { get; set; } /// /// If true, indicates restricted character set is being used for file and directory names /// [DispId(12)] bool UseRestrictedCharacterSet { get; set; } /// /// File systems to create /// [DispId(13)] FileSystems FileSystemsToCreate { get; set; } /// /// File systems supported /// [DispId(14)] FileSystems FileSystemsSupported { get; } /// /// UDF revision /// [DispId(37)] int UDFRevision { set; get; } /// /// UDF revision(s) supported /// [DispId(31)] Array UDFRevisionsSupported { get; } /// /// Select filesystem types and image size based on the current media /// /// [DispId(32)] void ChooseImageDefaults(Storage.Interop.IMAPIv2.IDiscRecorder2 discRecorder); /// /// Select filesystem types and image size based on the media type /// /// [DispId(33)] void ChooseImageDefaultsForMediaType(Storage.Interop.IMAPIv2.MediaPhysicalType value); /// /// ISO compatibility level to create /// [DispId(34)] int ISO9660InterchangeLevel { set; get; } /// /// ISO compatibility level(s) supported /// [DispId(38)] Array ISO9660InterchangeLevelsSupported { get; } /// /// Create result image stream /// /// [DispId(15)] IFileSystemImageResult CreateResultImage(); /// /// Check for existance an item in the file system /// /// /// [DispId(16)] FSItemType Exists(string FullPath); /// /// Return a string useful for identifying the current disc /// /// [DispId(18)] string CalculateDiscIdentifier(); /// /// Identify file systems on a given disc /// /// /// [DispId(19)] FileSystems IdentifyFileSystemsOnDisc(Storage.Interop.IMAPIv2.IDiscRecorder2 discRecorder); /// /// Identify which of the specified file systems would be imported by default /// /// /// [DispId(20)] FileSystems GetDefaultFileSystemForImport(FileSystems fileSystems); /// /// Import the default file system on the current disc /// /// [DispId(21)] FileSystems ImportFileSystem(); /// /// Import a specific file system on the current disc /// /// [DispId(22)] void ImportSpecificFileSystem(FileSystems fileSystemToUse); /// /// Roll back to the specified change point /// /// [DispId(23)] void RollbackToChangePoint(int ChangePoint); /// /// Lock in changes /// [DispId(24)] void LockInChangePoint(); /// /// Create a directory item with the specified name /// /// /// [DispId(25)] IFsiDirectoryItem CreateDirectoryItem(string Name); /// /// Create a file item with the specified name /// /// /// [DispId(26)] IFsiFileItem CreateFileItem(string Name); /// /// Volume name /// [DispId(27)] string VolumeNameUDF { get; } /// /// Volume name /// [DispId(28)] string VolumeNameJoliet { get; } /// /// Volume name /// [DispId(29)] string VolumeNameISO9660 { get; } /// /// Indicates whether or not IMAPI should stage the filesystem before the burn. /// Set to false to force IMAPI to not stage the filesystem prior to the burn. /// [DispId(30)] bool StageFiles { get; set; } /// /// available multi-session interfaces. /// [DispId(40)] object[] MultisessionInterfaces { get; set; } // IFileSystemImage2 /// /// Get or Set boot options array for supporting multi-boot /// [DispId(60)] object[] BootImageOptionsArray { get; set; } // IFileSystemImage3 /// /// Set CreateRedundantUdfMetadataFiles property /// If true, indicates that UDF Metadata and Metadata Mirror /// files are truly redundant, i.e. reference different extents /// [DispId(61)] bool CreateRedundantUdfMetadataFiles { [return: MarshalAs(UnmanagedType.VariantBool)] get; set; } /// /// Probe if a specific file system on the disc is appendable through IMAPI /// [DispId(70)] bool ProbeSpecificFileSystem(FileSystems fileSystemToProbe); } #endregion [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [Guid("2C941FD8-975B-59BE-A960-9A2A262853A5")] public interface IFileSystemImageResult { /// /// Image stream /// [DispId(1)] IStream ImageStream { get; } /// /// Progress item block mapping collection /// [DispId(2)] IProgressItems ProgressItems { get; } /// /// Number of blocks in the result image /// [DispId(3)] int TotalBlocks { get; } /// /// Number of bytes in a block /// [DispId(4)] int BlockSize { get; } /// /// Disc Identifier (for identifing imported session of multi-session disc) /// [DispId(5)] string DiscId { get; } } [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [Guid("2C941FD4-975B-59BE-A960-9A2A262853A5")] public interface IBootOptions { /// /// Get boot image data stream /// [DispId(1)] IStream BootImage { get; } /// /// Get boot manufacturer /// [DispId(2)] string Manufacturer { get; set; } /// /// Get boot platform identifier /// [DispId(3)] PlatformId PlatformId { get; set; } /// /// Get boot emulation type /// [DispId(4)] EmulationType Emulation { get; set; } /// /// Get boot image size /// [DispId(5)] uint ImageSize { get; } /// /// Set the boot image data stream, emulation type, and image size /// /// [DispId(20)] void AssignBootImage(IStream newVal); } [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [Guid("2C941FD9-975B-59BE-A960-9A2A262853A5")] public interface IFsiItem { /// /// Item name /// [DispId(11)] string Name { get; } /// /// Path /// [DispId(12)] string FullPath { get; } /// /// Date and time of creation /// [DispId(13)] DateTime CreationTime { get; set; } /// /// Date and time of last access /// [DispId(14)] DateTime LastAccessedTime { get; set; } /// /// Date and time of last modification /// [DispId(15)] DateTime LastModifiedTime { get; set; } /// /// Flag indicating if item is hidden /// [DispId(16)] bool IsHidden { get; set; } /// /// Name of item in the specified file system /// /// /// [DispId(17)] string FileSystemName(FileSystems fileSystem); /// /// Name of item in the specified file system /// /// /// [DispId(18)] string FileSystemPath(FileSystems fileSystem); } [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [Guid("2C941FDB-975B-59BE-A960-9A2A262853A5")] public interface IFsiFileItem { // IFsiItem /// /// Item name /// [DispId(11)] string Name { get; } /// /// Path /// [DispId(12)] string FullPath { get; } /// /// Date and time of creation /// [DispId(13)] DateTime CreationTime { get; set; } /// /// Date and time of last access /// [DispId(14)] DateTime LastAccessedTime { get; set; } /// /// Date and time of last modification /// [DispId(15)] DateTime LastModifiedTime { get; set; } /// /// Flag indicating if item is hidden /// [DispId(16)] bool IsHidden { get; set; } /// /// Name of item in the specified file system /// /// /// [DispId(17)] string FileSystemName(FileSystems fileSystem); /// /// Name of item in the specified file system /// /// /// [DispId(18)] string FileSystemPath(FileSystems fileSystem); // IFsiFileItem /// /// Data byte count /// [DispId(41)] long DataSize { get; } /// /// Lower 32 bits of the data byte count /// [DispId(42)] int DataSize32BitLow { get; } /// /// Upper 32 bits of the data byte count /// [DispId(43)] int DataSize32BitHigh { get; } /// /// Data stream /// [DispId(44)] IStream Data { get; set; } } [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [Guid("199D0C19-11E1-40eb-8EC2-C8C822A07792")] public interface IFsiFileItem2 { // IFsiItem /// /// Item name /// [DispId(11)] string Name { get; } /// /// Path /// [DispId(12)] string FullPath { get; } /// /// Date and time of creation /// [DispId(13)] DateTime CreationTime { get; set; } /// /// Date and time of last access /// [DispId(14)] DateTime LastAccessedTime { get; set; } /// /// Date and time of last modification /// [DispId(15)] DateTime LastModifiedTime { get; set; } /// /// Flag indicating if item is hidden /// [DispId(16)] bool IsHidden { get; set; } /// /// Name of item in the specified file system /// /// /// [DispId(17)] string FileSystemName(FileSystems fileSystem); /// /// Name of item in the specified file system /// /// /// [DispId(18)] string FileSystemPath(FileSystems fileSystem); // IFsiFileItem /// /// Data byte count /// [DispId(41)] long DataSize { get; } /// /// Lower 32 bits of the data byte count /// [DispId(42)] int DataSize32BitLow { get; } /// /// Upper 32 bits of the data byte count /// [DispId(43)] int DataSize32BitHigh { get; } /// /// Data stream /// [DispId(44)] IStream Data { get; set; } // IFsiFileItem2 /// /// Get the list of the named streams of the file /// [DispId(45)] IFsiNamedStreams FsiNamedStreams { get;} /// /// Flag indicating if file item is a named stream of a file /// [DispId(46)] bool IsNamedStream { get;} /// /// Add a new named stream to the collection /// [DispId(47)] void AddStream(string name, IStream streamData); /// /// Remove a specific named stream of the collection /// [DispId(48)] void RemoveStream(string name); /// /// Flag indicating if file is Real-Time /// [DispId(49)] bool IsRealTime { get; set;} }; [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [Guid("ED79BA56-5294-4250-8D46-F9AECEE23459")] public interface IFsiNamedStreams : IEnumerable { /// /// Get an enumerator for the collection /// /// [DispId(-4)] [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(EnumeratorToEnumVariantMarshaler))] new IEnumerator GetEnumerator(); /// /// Get a named stream from the collection /// /// /// [DispId(0)] IFsiFileItem2 this[int index] { [return: MarshalAs(UnmanagedType.Interface)] get; } /// /// Number of named streams in the collection /// [DispId(81)] int Count { get; } /// /// Get a non-variant enumerator for the named stream collection /// [DispId(82)] IEnumFsiItems EnumNamedStreams { [return: MarshalAs(UnmanagedType.Interface)] get; } }; [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [Guid("2C941FDC-975B-59BE-A960-9A2A262853A5")] public interface IFsiDirectoryItem { // IFsiItem /// /// Item name /// [DispId(11)] string Name { get; } /// /// Path /// [DispId(12)] string FullPath { get; } /// /// Date and time of creation /// [DispId(13)] DateTime CreationTime { get; set; } /// /// Date and time of last access /// [DispId(14)] DateTime LastAccessedTime { get; set; } /// /// Date and time of last modification /// [DispId(15)] DateTime LastModifiedTime { get; set; } /// /// Flag indicating if item is hidden /// [DispId(16)] bool IsHidden { get; set; } /// /// Name of item in the specified file system /// /// /// [DispId(17)] string FileSystemName(FileSystems fileSystem); /// /// Name of item in the specified file system /// /// /// [DispId(18)] string FileSystemPath(FileSystems fileSystem); // IFsiDirectoryItem /// /// Get an enumerator for the collection /// /// [DispId(-4)] [TypeLibFunc(65)] IEnumerator GetEnumerator(); /// /// Get the item with the given relative path /// /// /// [DispId(0)] IFsiItem this[string path] { get; } /// /// Number of items in the collection /// [DispId(1)] int Count { get; } /// /// Get a non-variant enumerator /// [DispId(2)] IEnumFsiItems EnumFsiItems { get; } /// /// Add a directory with the specified relative path /// /// [DispId(30)] void AddDirectory(string path); /// /// Add a file with the specified relative path and data /// /// /// [DispId(31)] void AddFile(string path, IStream fileData); /// /// Add files and directories from the specified source directory /// /// /// [DispId(32)] void AddTree(string sourceDirectory, bool includeBaseDirectory); /// /// Add an item /// /// [DispId(33)] void Add(IFsiItem Item); /// /// Remove an item with the specified relative path /// /// [DispId(34)] void Remove(string path); /// /// Remove a subtree with the specified relative path /// /// [DispId(35)] void RemoveTree(string path); } [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [Guid("F7FB4B9B-6D96-4d7b-9115-201B144811EF")] public interface IFsiDirectoryItem2 { // IFsiItem /// /// Item name /// [DispId(11)] string Name { get; } /// /// Path /// [DispId(12)] string FullPath { get; } /// /// Date and time of creation /// [DispId(13)] DateTime CreationTime { get; set; } /// /// Date and time of last access /// [DispId(14)] DateTime LastAccessedTime { get; set; } /// /// Date and time of last modification /// [DispId(15)] DateTime LastModifiedTime { get; set; } /// /// Flag indicating if item is hidden /// [DispId(16)] bool IsHidden { get; set; } /// /// Name of item in the specified file system /// /// /// [DispId(17)] string FileSystemName(FileSystems fileSystem); /// /// Name of item in the specified file system /// /// /// [DispId(18)] string FileSystemPath(FileSystems fileSystem); // IFsiDirectoryItem /// /// Get an enumerator for the collection /// /// [DispId(-4)] [TypeLibFunc(65)] IEnumerator GetEnumerator(); /// /// Get the item with the given relative path /// /// /// [DispId(0)] IFsiItem this[string path] { get; } /// /// Number of items in the collection /// [DispId(1)] int Count { get; } /// /// Get a non-variant enumerator /// [DispId(2)] IEnumFsiItems EnumFsiItems { get; } /// /// Add a directory with the specified relative path /// /// [DispId(30)] void AddDirectory(string path); /// /// Add a file with the specified relative path and data /// /// /// [DispId(31)] void AddFile(string path, IStream fileData); /// /// Add files and directories from the specified source directory /// /// /// [DispId(32)] void AddTree(string sourceDirectory, bool includeBaseDirectory); /// /// Add an item /// /// [DispId(33)] void Add(IFsiItem Item); /// /// Remove an item with the specified relative path /// /// [DispId(34)] void Remove(string path); /// /// Remove a subtree with the specified relative path /// /// [DispId(35)] void RemoveTree(string path); // IFsiDirectoryItem2 /// /// Add files and directories from the specified source directory /// including named streams /// [DispId(36)] void AddTreeWithNamedStreams(string sourceDirectory, bool includeBaseDirectory); }; [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [Guid("2C941FDA-975B-59BE-A960-9A2A262853A5")] public interface IEnumFsiItems { /// /// Get next items in the enumeration /// /// /// /// void Next(uint celt, out IFsiItem rgelt, out uint pceltFetched); /// /// Remoting support for Next (allow NULL pointer for item count when /// requesting single item) /// /// /// /// void RemoteNext(uint celt, out IFsiItem rgelt, out uint pceltFetched); /// /// Skip items in the enumeration /// /// void Skip(uint celt); /// /// Reset the enumerator /// void Reset(); /// /// Make a copy of the enumerator /// /// void Clone(out IEnumFsiItems ppEnum); } [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [Guid("2C941FD7-975B-59BE-A960-9A2A262853A5")] public interface IProgressItems { /// /// Get an enumerator for the collection /// /// [DispId(-4)] [TypeLibFunc(65)] IEnumerator GetEnumerator(); /// /// Find the block mapping from the specified index /// /// /// [DispId(0)] IProgressItem this[int Index] { get; } /// /// Number of items in the collection /// [DispId(1)] int Count { get; } /// /// Find the block mapping from the specified block /// /// /// [DispId(2)] IProgressItem ProgressItemFromBlock(uint block); /// /// Find the block mapping from the specified item description /// /// /// [DispId(3)] IProgressItem ProgressItemFromDescription(string Description); /// /// Get a non-variant enumerator /// [DispId(4)] IEnumProgressItems EnumProgressItems { get; } } [TypeLibType(TypeLibTypeFlags.FDual | TypeLibTypeFlags.FDispatchable | TypeLibTypeFlags.FNonExtensible)] [Guid("2C941FD5-975B-59BE-A960-9A2A262853A5")] public interface IProgressItem { /// /// Progress item description /// [DispId(1)] string Description { get; } /// /// First block in the range of blocks used by the progress item /// [DispId(2)] uint FirstBlock { get; } /// /// Last block in the range of blocks used by the progress item /// [DispId(3)] uint LastBlock { get; } /// /// Number of blocks used by the progress item /// [DispId(4)] uint BlockCount { get; } } [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [Guid("2C941FD6-975B-59BE-A960-9A2A262853A5")] public interface IEnumProgressItems { /// /// Get next items in the enumeration /// /// /// /// void Next(uint celt, out IProgressItem rgelt, out uint pceltFetched); /// /// Remoting support for Next (allow NULL pointer for item count when /// requesting single item) /// /// /// /// void RemoteNext(uint celt, out IProgressItem rgelt, out uint pceltFetched); /// /// Skip items in the enumeration /// /// void Skip(uint celt); /// /// Reset the enumerator /// void Reset(); /// /// Make a copy of the enumerator /// /// void Clone(out IEnumProgressItems ppEnum); } // CoClass - Specifies the class identifier of a coclass // imported from a type library. #region MsftFileSystemImage [CoClass(typeof(MsftFileSystemImageClass)), ComImport] [Guid("2C941FE1-975B-59BE-A960-9A2A262853A5")] public interface MsftFileSystemImage : IFileSystemImage, DFileSystemImage_Events { } [CoClass(typeof(MsftFileSystemImageClass)), ComImport] [Guid("D7644B2C-1537-4767-B62F-F1387B02DDFD")] public interface MsftFileSystemImage2 : IFileSystemImage2, DFileSystemImage_Events { } [CoClass(typeof(MsftFileSystemImageClass)), ComImport] [Guid("7CFF842C-7E97-4807-8304-910DD8F7C051")] public interface MsftFileSystemImage3 : IFileSystemImage3, DFileSystemImage_Events, DFileSystemImageImport_Events { } #endregion #region DFileSystemImageEvents [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void IMAPIEventHandlerDelegate(TSender sender, TArg1 arg1, TArg2 arg2, TArg3 arg3) where TSender : class; [ ComEventInterface(typeof(DFileSystemImageEvents), typeof(DFileSystemImage_EventsProvider)), TypeLibType(TypeLibTypeFlags.FHidden) ] public interface DFileSystemImage_Events { event IMAPIEventHandlerDelegate Update; } [ ComImport, Guid("2C941FDF-975B-59BE-A960-9A2A262853A5"), InterfaceType(ComInterfaceType.InterfaceIsDual) ] public interface DFileSystemImageEvents { [DispId(0x100)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void Update([In, MarshalAs(UnmanagedType.IDispatch)] IFileSystemImage sender, [In, MarshalAs(UnmanagedType.BStr)] String currentFile, long copiedSectors, long totalSectors); } [ TypeLibType(TypeLibTypeFlags.FHidden), ClassInterface(ClassInterfaceType.None) ] public sealed class DFileSystemImage_SinkHelper : DFileSystemImageEvents { public void Update([In, MarshalAs(UnmanagedType.IDispatch)] IFileSystemImage sender, [In, MarshalAs(UnmanagedType.BStr)] String currentFile, long copiedSectors, long totalSectors) { UpdateDelegate(sender, currentFile, copiedSectors, totalSectors); } public int Cookie; public IMAPIEventHandlerDelegate UpdateDelegate; } [ClassInterface(ClassInterfaceType.None)] internal sealed class DFileSystemImage_EventsProvider : DFileSystemImage_Events, IDisposable { public DFileSystemImage_EventsProvider(Object pointContainer) { lock (this) { if (m_ConnectionPoint == null) { Guid eventsGuid = typeof(DFileSystemImageEvents).GUID; IConnectionPointContainer connectionPointContainer = pointContainer as IConnectionPointContainer; connectionPointContainer.FindConnectionPoint(ref eventsGuid, out m_ConnectionPoint); } } } public event IMAPIEventHandlerDelegate Update { add { lock (this) { if (m_SinkHelper == null) { m_SinkHelper = new DFileSystemImage_SinkHelper(); } // Add the passed-in value to the sink helper's delegate list m_SinkHelper.UpdateDelegate += value; // Call Advise on a new sink helper, initializing its cookie if (m_NeedsAdvise) { m_ConnectionPoint.Advise(m_SinkHelper, out m_SinkHelper.Cookie); m_NeedsAdvise = false; } } } remove { lock (this) { if (m_SinkHelper == null || m_SinkHelper.UpdateDelegate == null) //.GetInvocationList().Length == 0) { // TODO: ERROR, cannot remove w/o adding } else { m_SinkHelper.UpdateDelegate -= value; if (m_SinkHelper.UpdateDelegate == null) //m_SinkHelper.UpdateDelegate.GetInvocationList().Length == 0) { m_ConnectionPoint.Unadvise(m_SinkHelper.Cookie); m_NeedsAdvise = true; } } } } } // Implementation of IDisposable.Dispose public void Dispose() { Cleanup(); // It is no longer necessary for the GC to call the finalizer GC.SuppressFinalize(this); } // Finalizer ~DFileSystemImage_EventsProvider() { Cleanup(); } // Called to unhook all events private void Cleanup() { lock (this) { if (!m_NeedsAdvise) { m_ConnectionPoint.Unadvise(m_SinkHelper.Cookie); m_NeedsAdvise = true; } m_SinkHelper = null; m_ConnectionPoint = null; } } private bool m_NeedsAdvise = true; private IConnectionPoint m_ConnectionPoint = null; private DFileSystemImage_SinkHelper m_SinkHelper = null; } #endregion #region DFileSystemImageImportEvents [UnmanagedFunctionPointer(CallingConvention.StdCall)] public delegate void IMAPIImportEventHandlerDelegate(TSender sender, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5, TArg6 arg6) where TSender : class; [ ComEventInterface(typeof(DFileSystemImageImportEvents), typeof(DFileSystemImageImport_EventsProvider)), TypeLibType(TypeLibTypeFlags.FHidden) ] public interface DFileSystemImageImport_Events { event IMAPIImportEventHandlerDelegate UpdateImport; } [ ComImport, Guid("D25C30F9-4087-4366-9E24-E55BE286424B"), InterfaceType(ComInterfaceType.InterfaceIsDual) ] public interface DFileSystemImageImportEvents { [DispId(0x101)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)] void UpdateImport([In, MarshalAs(UnmanagedType.IDispatch)] IFileSystemImage sender, [In, MarshalAs(UnmanagedType.I4)] FileSystems fileSystem, [In, MarshalAs(UnmanagedType.BStr)] String currentItem, long importedDirectoryItems, long totalDirectoryItems, long importedFileItems, long totalFileItems); } [ TypeLibType(TypeLibTypeFlags.FHidden), ClassInterface(ClassInterfaceType.None) ] public sealed class DFileSystemImageImport_SinkHelper : DFileSystemImageImportEvents { public void UpdateImport([In, MarshalAs(UnmanagedType.IDispatch)] IFileSystemImage sender, [In, MarshalAs(UnmanagedType.I4)] FileSystems fileSystem, [In, MarshalAs(UnmanagedType.BStr)] String currentItem, long importedDirectoryItems, long totalDirectoryItems, long importedFileItems, long totalFileItems) { UpdateImportDelegate(sender, fileSystem, currentItem, importedDirectoryItems, totalDirectoryItems, importedFileItems, totalFileItems); } public int Cookie; public IMAPIImportEventHandlerDelegate UpdateImportDelegate; } [ClassInterface(ClassInterfaceType.None)] internal sealed class DFileSystemImageImport_EventsProvider : DFileSystemImageImport_Events, IDisposable { public DFileSystemImageImport_EventsProvider(Object pointContainer) { lock (this) { if (m_ConnectionPoint == null) { Guid eventsGuid = typeof(DFileSystemImageImportEvents).GUID; IConnectionPointContainer connectionPointContainer = pointContainer as IConnectionPointContainer; connectionPointContainer.FindConnectionPoint(ref eventsGuid, out m_ConnectionPoint); } } } public event IMAPIImportEventHandlerDelegate UpdateImport { add { lock (this) { if (m_SinkHelper == null) { m_SinkHelper = new DFileSystemImageImport_SinkHelper(); } // Add the passed-in value to the sink helper's delegate list m_SinkHelper.UpdateImportDelegate += value; // Call Advise on a new sink helper, initializing its cookie if (m_NeedsAdvise) { m_ConnectionPoint.Advise(m_SinkHelper, out m_SinkHelper.Cookie); m_NeedsAdvise = false; } } } remove { lock (this) { if (m_SinkHelper == null || m_SinkHelper.UpdateImportDelegate == null) //.GetInvocationList().Length == 0) { // TODO: ERROR, cannot remove w/o adding } else { m_SinkHelper.UpdateImportDelegate -= value; if (m_SinkHelper.UpdateImportDelegate == null) //m_SinkHelper.UpdateDelegate.GetInvocationList().Length == 0) { m_ConnectionPoint.Unadvise(m_SinkHelper.Cookie); m_NeedsAdvise = true; } } } } } // Implementation of IDisposable.Dispose public void Dispose() { Cleanup(); // It is no longer necessary for the GC to call the finalizer GC.SuppressFinalize(this); } // Finalizer ~DFileSystemImageImport_EventsProvider() { Cleanup(); } // Called to unhook all events private void Cleanup() { lock (this) { if (!m_NeedsAdvise) { m_ConnectionPoint.Unadvise(m_SinkHelper.Cookie); m_NeedsAdvise = true; } m_SinkHelper = null; m_ConnectionPoint = null; } } private bool m_NeedsAdvise = true; private IConnectionPoint m_ConnectionPoint = null; private DFileSystemImageImport_SinkHelper m_SinkHelper = null; } #endregion // Class [TypeLibType(TypeLibTypeFlags.FCanCreate)] [ClassInterface(ClassInterfaceType.None)] [ComSourceInterfaces("DFileSystemImageEvents\0")] [Guid("2C941FC5-975B-59BE-A960-9A2A262853A5"), ComImport] public class MsftFileSystemImageClass { } [CoClass(typeof(MsftBootOptionsClass)), ComImport] [Guid("2C941FD4-975B-59BE-A960-9A2A262853A5")] public interface MsftBootOptions : IBootOptions { } [TypeLibType(TypeLibTypeFlags.FCanCreate)] [ClassInterface(ClassInterfaceType.None)] [Guid("2C941FCE-975B-59BE-A960-9A2A262853A5"), ComImport] public class MsftBootOptionsClass { } #region IIsoImageManager [ ComImport, Guid("6CA38BE5-FBBB-4800-95A1-A438865EB0D4"), InterfaceType(ComInterfaceType.InterfaceIsDual) // ISO Image Manager: Helper object for ISO image file manipulation ] public interface IIsoImageManager { [DispId(0x100)] // Path to the ISO image file String Path { [return: MarshalAs(UnmanagedType.BStr)] get;} [DispId(0x101)] // Stream from the ISO image IStream Stream { [return: MarshalAs(UnmanagedType.Interface)] get;} [DispId(0x200)] // Set path to the ISO image file, overwrites stream void SetPath([In, MarshalAs(UnmanagedType.BStr)] String Val); [DispId(0x201)] // Set stream from the ISO image, overwrites path void SetStream([In, MarshalAs(UnmanagedType.Interface)] IStream data); [DispId(0x202)] // Validate if the ISO image file is a valid file void IsValid(); } [CoClass(typeof(MsftIsoImageManagerClass)), ComImport] [Guid("6CA38BE5-FBBB-4800-95A1-A438865EB0D4")] public interface MsftIsoImageManager : IIsoImageManager { } [TypeLibType(TypeLibTypeFlags.FCanCreate)] [ClassInterface(ClassInterfaceType.None)] [Guid("CEEE3B62-8F56-4056-869B-EF16917E3EFC"), ComImport] public class MsftIsoImageManagerClass { } #endregion IIsoImageManager #region Enumerators public enum EmulationType { None = 0, Floppy12M = 1, Floppy144M = 2, Floppy288M = 3, HardDisk = 4, } public enum PlatformId { x86 = 0, PowerPC = 1, Mac = 2, EFI = 0xef, } [Flags] public enum FileSystems { None = 0x000000000, ISO9660 = 0x000000001, Joliet = 0x000000002, UDF = 0x000000004, Unknown = 0x040000000 } public enum FSItemType { NotFound = 0, Directory = 1, File = 2, } #endregion Enumerators }