public bool Identify(IMediaImage imagePlugin, Partition partition) { uint sbSize = (uint)(Marshal.SizeOf <RefsVolumeHeader>() / imagePlugin.Info.SectorSize); if (Marshal.SizeOf <RefsVolumeHeader>() % imagePlugin.Info.SectorSize != 0) { sbSize++; } if (partition.Start + sbSize >= partition.End) { return(false); } byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize); if (sector.Length < Marshal.SizeOf <RefsVolumeHeader>()) { return(false); } RefsVolumeHeader refsVhdr = Marshal.ByteArrayToStructureLittleEndian <RefsVolumeHeader>(sector); return(refsVhdr.identifier == FSRS && ArrayHelpers.ArrayIsNullOrEmpty(refsVhdr.mustBeZero) && refsVhdr.signature.SequenceEqual(refsSignature)); }
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { Encoding = encoding ?? Encoding.GetEncoding("koi8-r"); information = ""; var sb = new StringBuilder(); byte[] bk0 = imagePlugin.ReadSector(0 + partition.Start); Block0 block0 = Marshal.ByteArrayToStructureLittleEndian <Block0>(bk0); sb.AppendLine("MicroDOS filesystem"); sb.AppendFormat("Volume has {0} blocks ({1} bytes)", block0.blocks, block0.blocks * 512).AppendLine(); sb.AppendFormat("Volume has {0} blocks used ({1} bytes)", block0.usedBlocks, block0.usedBlocks * 512). AppendLine(); sb.AppendFormat("Volume contains {0} files", block0.files).AppendLine(); sb.AppendFormat("First used block is {0}", block0.firstUsedBlock).AppendLine(); XmlFsType = new FileSystemType { Type = "MicroDOS", ClusterSize = 512, Clusters = block0.blocks, Files = block0.files, FilesSpecified = true, FreeClusters = (ulong)(block0.blocks - block0.usedBlocks), FreeClustersSpecified = true }; information = sb.ToString(); }
public bool Identify(IMediaImage imagePlugin, Partition partition) { // Does AO-DOS support hard disks? if (partition.Start > 0) { return(false); } // How is it really? if (imagePlugin.Info.SectorSize != 512) { return(false); } // Does AO-DOS support any other kind of disk? if (imagePlugin.Info.Sectors != 800 && imagePlugin.Info.Sectors != 1600) { return(false); } byte[] sector = imagePlugin.ReadSector(0); AODOS_BootBlock bb = Marshal.ByteArrayToStructureLittleEndian <AODOS_BootBlock>(sector); return(bb.identifier.SequenceEqual(AODOSIdentifier)); }
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { Encoding = Encoding.GetEncoding("koi8-r"); byte[] sector = imagePlugin.ReadSector(0); AODOS_BootBlock bb = Marshal.ByteArrayToStructureLittleEndian <AODOS_BootBlock>(sector); var sbInformation = new StringBuilder(); sbInformation.AppendLine("Alexander Osipov DOS file system"); XmlFsType = new FileSystemType { Type = "Alexander Osipov DOS file system", Clusters = imagePlugin.Info.Sectors, ClusterSize = imagePlugin.Info.SectorSize, Files = bb.files, FilesSpecified = true, FreeClusters = imagePlugin.Info.Sectors - bb.usedSectors, FreeClustersSpecified = true, VolumeName = StringHandlers.SpacePaddedToString(bb.volumeLabel, Encoding), Bootable = true }; sbInformation.AppendFormat("{0} files on volume", bb.files).AppendLine(); sbInformation.AppendFormat("{0} used sectors on volume", bb.usedSectors).AppendLine(); sbInformation.AppendFormat("Disk name: {0}", StringHandlers.CToString(bb.volumeLabel, Encoding)). AppendLine(); information = sbInformation.ToString(); }
public bool Identify(IMediaImage imagePlugin, Partition partition) { if (partition.Start >= partition.End) { return(false); } ulong sbSectorOff = 0x10000 / imagePlugin.Info.SectorSize; uint sbSectorSize = 0x1000 / imagePlugin.Info.SectorSize; if (sbSectorOff + partition.Start >= partition.End) { return(false); } byte[] sector = imagePlugin.ReadSectors(sbSectorOff + partition.Start, sbSectorSize); SuperBlock btrfsSb; try { btrfsSb = Marshal.ByteArrayToStructureLittleEndian <SuperBlock>(sector); } catch { return(false); } AaruConsole.DebugWriteLine("BTRFS Plugin", "sbSectorOff = {0}", sbSectorOff); AaruConsole.DebugWriteLine("BTRFS Plugin", "sbSectorSize = {0}", sbSectorSize); AaruConsole.DebugWriteLine("BTRFS Plugin", "partition.PartitionStartSector = {0}", partition.Start); AaruConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.magic = 0x{0:X16}", btrfsSb.magic); return(btrfsSb.magic == BTRFS_MAGIC); }
public bool GetInformation(IMediaImage imagePlugin, out List <Partition> partitions, ulong sectorOffset) { partitions = null; byte[] sector = imagePlugin.ReadSector(sectorOffset); if (sector.Length < 512) { return(false); } RioKarmaTable table = Marshal.ByteArrayToStructureLittleEndian <RioKarmaTable>(sector); if (table.magic != KARMA_MAGIC) { return(false); } ulong counter = 0; partitions = (from entry in table.entries let part = new Partition { Start = entry.offset, Offset = (ulong)(entry.offset * sector.Length), Size = entry.size, Length = (ulong)(entry.size * sector.Length), Type = "Rio Karma", Sequence = counter++, Scheme = Name } where entry.type == ENTRY_MAGIC select part).ToList(); return(true); }
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1"); byte[] sector = imagePlugin.ReadSector(6); var sbInformation = new StringBuilder(); VolumeLabel vol = Marshal.ByteArrayToStructureLittleEndian <VolumeLabel>(sector); sbInformation.AppendLine("ECMA-67"); sbInformation.AppendFormat("Volume name: {0}", Encoding.ASCII.GetString(vol.volumeIdentifier)).AppendLine(); sbInformation.AppendFormat("Volume owner: {0}", Encoding.ASCII.GetString(vol.owner)).AppendLine(); XmlFsType = new FileSystemType { Type = "ECMA-67", ClusterSize = 256, Clusters = (partition.End - partition.Start) + 1, VolumeName = Encoding.ASCII.GetString(vol.volumeIdentifier) }; information = sbInformation.ToString(); }
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { // Always Shift-JIS Encoding = Encoding.GetEncoding("shift_jis"); information = ""; byte[] sector = imagePlugin.ReadSectors(partition.Start, 2); PcfxHeader header = Marshal.ByteArrayToStructureLittleEndian <PcfxHeader>(sector); string date; DateTime dateTime = DateTime.MinValue; try { date = Encoding.GetString(header.date); int year = int.Parse(date.Substring(0, 4)); int month = int.Parse(date.Substring(4, 2)); int day = int.Parse(date.Substring(6, 2)); dateTime = new DateTime(year, month, day); } catch { date = null; } var sb = new StringBuilder(); sb.AppendLine("PC-FX executable:"); sb.AppendFormat("Identifier: {0}", StringHandlers.CToString(header.signature, Encoding)).AppendLine(); sb.AppendFormat("Copyright: {0}", StringHandlers.CToString(header.copyright, Encoding)).AppendLine(); sb.AppendFormat("Title: {0}", StringHandlers.CToString(header.title, Encoding)).AppendLine(); sb.AppendFormat("Maker ID: {0}", StringHandlers.CToString(header.makerId, Encoding)).AppendLine(); sb.AppendFormat("Maker name: {0}", StringHandlers.CToString(header.makerName, Encoding)).AppendLine(); sb.AppendFormat("Volume number: {0}", header.volumeNumber).AppendLine(); sb.AppendFormat("Country code: {0}", header.country).AppendLine(); sb.AppendFormat("Version: {0}.{1}", header.minorVersion, header.majorVersion).AppendLine(); if (date != null) { sb.AppendFormat("Dated {0}", dateTime).AppendLine(); } sb.AppendFormat("Load {0} sectors from sector {1}", header.loadCount, header.loadOffset).AppendLine(); sb.AppendFormat("Load at 0x{0:X8} and jump to 0x{1:X8}", header.loadAddress, header.entryPoint). AppendLine(); information = sb.ToString(); XmlFsType = new FileSystemType { Type = "PC-FX", Clusters = partition.Length, ClusterSize = 2048, Bootable = true, CreationDate = dateTime, CreationDateSpecified = date != null, PublisherIdentifier = StringHandlers.CToString(header.makerName, Encoding), VolumeName = StringHandlers.CToString(header.title, Encoding), SystemIdentifier = "PC-FX" }; }
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; if (imagePlugin.Info.SectorSize < 512) { return; } uint sbAddr = REISER4_SUPER_OFFSET / imagePlugin.Info.SectorSize; if (sbAddr == 0) { sbAddr = 1; } uint sbSize = (uint)(Marshal.SizeOf <Reiser4_Superblock>() / imagePlugin.Info.SectorSize); if (Marshal.SizeOf <Reiser4_Superblock>() % imagePlugin.Info.SectorSize != 0) { sbSize++; } byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize); if (sector.Length < Marshal.SizeOf <Reiser4_Superblock>()) { return; } Reiser4_Superblock reiserSb = Marshal.ByteArrayToStructureLittleEndian <Reiser4_Superblock>(sector); if (!reiser4_magic.SequenceEqual(reiserSb.magic)) { return; } var sb = new StringBuilder(); sb.AppendLine("Reiser 4 filesystem"); sb.AppendFormat("{0} bytes per block", reiserSb.blocksize).AppendLine(); sb.AppendFormat("Volume disk format: {0}", reiserSb.diskformat).AppendLine(); sb.AppendFormat("Volume UUID: {0}", reiserSb.uuid).AppendLine(); sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(reiserSb.label, Encoding)).AppendLine(); information = sb.ToString(); XmlFsType = new FileSystemType { Type = "Reiser 4 filesystem", ClusterSize = reiserSb.blocksize, Clusters = ((partition.End - partition.Start) * imagePlugin.Info.SectorSize) / reiserSb.blocksize, VolumeName = StringHandlers.CToString(reiserSb.label, Encoding), VolumeSerial = reiserSb.uuid.ToString() }; }
/// <summary>Decodes an IP.BIN sector in Saturn format</summary> /// <param name="ipbin_sector">IP.BIN sector</param> /// <returns>Decoded IP.BIN</returns> public static IPBin?DecodeIPBin(byte[] ipbin_sector) { if (ipbin_sector == null) { return(null); } if (ipbin_sector.Length < 512) { return(null); } IPBin ipbin = Marshal.ByteArrayToStructureLittleEndian <IPBin>(ipbin_sector); AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.maker_id = \"{0}\"", Encoding.ASCII.GetString(ipbin.maker_id)); AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.product_no = \"{0}\"", Encoding.ASCII.GetString(ipbin.product_no)); AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.product_version = \"{0}\"", Encoding.ASCII.GetString(ipbin.product_version)); AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.release_datedate = \"{0}\"", Encoding.ASCII.GetString(ipbin.release_date)); AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.saturn_media = \"{0}\"", Encoding.ASCII.GetString(ipbin.saturn_media)); AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.disc_no = {0}", (char)ipbin.disc_no); AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.disc_no_separator = \"{0}\"", (char)ipbin.disc_no_separator); AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.disc_total_nos = {0}", (char)ipbin.disc_total_nos); AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.release_date = \"{0}\"", Encoding.ASCII.GetString(ipbin.release_date)); AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.spare_space1 = \"{0}\"", Encoding.ASCII.GetString(ipbin.spare_space1)); AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.region_codes = \"{0}\"", Encoding.ASCII.GetString(ipbin.region_codes)); AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.peripherals = \"{0}\"", Encoding.ASCII.GetString(ipbin.peripherals)); AaruConsole.DebugWriteLine("Saturn IP.BIN Decoder", "saturn_ipbin.product_name = \"{0}\"", Encoding.ASCII.GetString(ipbin.product_name)); return(Encoding.ASCII.GetString(ipbin.SegaHardwareID) == "SEGA SEGASATURN " ? ipbin : (IPBin?)null); }
public bool GetInformation(IMediaImage imagePlugin, out List <CommonTypes.Partition> partitions, ulong sectorOffset) { partitions = new List <CommonTypes.Partition>(); if (42 + sectorOffset >= imagePlugin.Info.Sectors) { return(false); } byte[] tblsector = imagePlugin.ReadSector(42 + sectorOffset); Partable xnxtbl = Marshal.ByteArrayToStructureLittleEndian <Partable>(tblsector); AaruConsole.DebugWriteLine("XENIX plugin", "xnxtbl.p_magic = 0x{0:X4} (should be 0x{1:X4})", xnxtbl.p_magic, PAMAGIC); if (xnxtbl.p_magic != PAMAGIC) { return(false); } for (int i = 0; i < MAXPARTS; i++) { AaruConsole.DebugWriteLine("XENIX plugin", "xnxtbl.p[{0}].p_off = {1}", i, xnxtbl.p[i].p_off); AaruConsole.DebugWriteLine("XENIX plugin", "xnxtbl.p[{0}].p_size = {1}", i, xnxtbl.p[i].p_size); if (xnxtbl.p[i].p_size <= 0) { continue; } var part = new CommonTypes.Partition { Start = ((ulong)((xnxtbl.p[i].p_off + XENIX_OFFSET) * XENIX_BSIZE) / imagePlugin.Info.SectorSize) + sectorOffset, Length = (ulong)(xnxtbl.p[i].p_size * XENIX_BSIZE) / imagePlugin.Info.SectorSize, Offset = (ulong)((xnxtbl.p[i].p_off + XENIX_OFFSET) * XENIX_BSIZE) + (imagePlugin.Info.SectorSize * sectorOffset), Size = (ulong)(xnxtbl.p[i].p_size * XENIX_BSIZE), Sequence = (ulong)i, Type = "XENIX", Scheme = Name }; if (part.End < imagePlugin.Info.Sectors) { partitions.Add(part); } } return(partitions.Count > 0); }
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; var sb = new StringBuilder(); int sbSizeInBytes = Marshal.SizeOf <XiaSuperBlock>(); uint sbSizeInSectors = (uint)(sbSizeInBytes / imagePlugin.Info.SectorSize); if (sbSizeInBytes % imagePlugin.Info.SectorSize > 0) { sbSizeInSectors++; } byte[] sbSector = imagePlugin.ReadSectors(partition.Start, sbSizeInSectors); XiaSuperBlock supblk = Marshal.ByteArrayToStructureLittleEndian <XiaSuperBlock>(sbSector); sb.AppendFormat("{0} bytes per zone", supblk.s_zone_size).AppendLine(); sb.AppendFormat("{0} zones in volume ({1} bytes)", supblk.s_nzones, supblk.s_nzones * supblk.s_zone_size). AppendLine(); sb.AppendFormat("{0} inodes", supblk.s_ninodes).AppendLine(); sb.AppendFormat("{0} data zones ({1} bytes)", supblk.s_ndatazones, supblk.s_ndatazones * supblk.s_zone_size).AppendLine(); sb.AppendFormat("{0} imap zones ({1} bytes)", supblk.s_imap_zones, supblk.s_imap_zones * supblk.s_zone_size).AppendLine(); sb.AppendFormat("{0} zmap zones ({1} bytes)", supblk.s_zmap_zones, supblk.s_zmap_zones * supblk.s_zone_size).AppendLine(); sb.AppendFormat("First data zone: {0}", supblk.s_firstdatazone).AppendLine(); sb.AppendFormat("Maximum filesize is {0} bytes ({1} MiB)", supblk.s_max_size, supblk.s_max_size / 1048576). AppendLine(); sb.AppendFormat("{0} zones reserved for kernel images ({1} bytes)", supblk.s_kernzones, supblk.s_kernzones * supblk.s_zone_size).AppendLine(); sb.AppendFormat("First kernel zone: {0}", supblk.s_firstkernzone).AppendLine(); XmlFsType = new FileSystemType { Bootable = !ArrayHelpers.ArrayIsNullOrEmpty(supblk.s_boot_segment), Clusters = supblk.s_nzones, ClusterSize = supblk.s_zone_size, Type = "Xia filesystem" }; information = sb.ToString(); }
public bool Identify(IMediaImage imagePlugin, Partition partition) { if (partition.Start + 1 >= imagePlugin.Info.Sectors) { return(false); } byte[] sector = imagePlugin.ReadSector(partition.Start + 1); if (sector.Length < 512) { return(false); } QNX4_Superblock qnxSb = Marshal.ByteArrayToStructureLittleEndian <QNX4_Superblock>(sector); // Check root directory name if (!qnx4_rootDir_fname.SequenceEqual(qnxSb.rootDir.di_fname)) { return(false); } // Check sizes are multiple of blocks if (qnxSb.rootDir.di_size % 512 != 0 || qnxSb.inode.di_size % 512 != 0 || qnxSb.boot.di_size % 512 != 0 || qnxSb.altBoot.di_size % 512 != 0) { return(false); } // Check extents are not past device if (qnxSb.rootDir.di_first_xtnt.block + partition.Start >= partition.End || qnxSb.inode.di_first_xtnt.block + partition.Start >= partition.End || qnxSb.boot.di_first_xtnt.block + partition.Start >= partition.End || qnxSb.altBoot.di_first_xtnt.block + partition.Start >= partition.End) { return(false); } // Check inodes are in use if ((qnxSb.rootDir.di_status & 0x01) != 0x01 || (qnxSb.inode.di_status & 0x01) != 0x01 || (qnxSb.boot.di_status & 0x01) != 0x01) { return(false); } // All hail filesystems without identification marks return(true); }
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { Encoding = encoding ?? Encoding.UTF8; ulong vmfsSuperOff = VXFS_BASE / imagePlugin.Info.SectorSize; byte[] sector = imagePlugin.ReadSector(partition.Start + vmfsSuperOff); VxSuperBlock vxSb = Marshal.ByteArrayToStructureLittleEndian <VxSuperBlock>(sector); var sbInformation = new StringBuilder(); sbInformation.AppendLine("Veritas file system"); sbInformation.AppendFormat("Volume version {0}", vxSb.vs_version).AppendLine(); sbInformation.AppendFormat("Volume name {0}", StringHandlers.CToString(vxSb.vs_fname, Encoding)). AppendLine(); sbInformation.AppendFormat("Volume has {0} blocks of {1} bytes each", vxSb.vs_bsize, vxSb.vs_size). AppendLine(); sbInformation.AppendFormat("Volume has {0} inodes per block", vxSb.vs_inopb).AppendLine(); sbInformation.AppendFormat("Volume has {0} free inodes", vxSb.vs_ifree).AppendLine(); sbInformation.AppendFormat("Volume has {0} free blocks", vxSb.vs_free).AppendLine(); sbInformation.AppendFormat("Volume created on {0}", DateHandlers.UnixUnsignedToDateTime(vxSb.vs_ctime, vxSb.vs_cutime)).AppendLine(); sbInformation.AppendFormat("Volume last modified on {0}", DateHandlers.UnixUnsignedToDateTime(vxSb.vs_wtime, vxSb.vs_wutime)).AppendLine(); if (vxSb.vs_clean != 0) { sbInformation.AppendLine("Volume is dirty"); } information = sbInformation.ToString(); XmlFsType = new FileSystemType { Type = "Veritas file system", CreationDate = DateHandlers.UnixUnsignedToDateTime(vxSb.vs_ctime, vxSb.vs_cutime), CreationDateSpecified = true, ModificationDate = DateHandlers.UnixUnsignedToDateTime(vxSb.vs_wtime, vxSb.vs_wutime), ModificationDateSpecified = true, Clusters = (ulong)vxSb.vs_size, ClusterSize = (uint)vxSb.vs_bsize, Dirty = vxSb.vs_clean != 0, FreeClusters = (ulong)vxSb.vs_free, FreeClustersSpecified = true }; }
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { Encoding = new Radix50(); information = ""; var sb = new StringBuilder(); byte[] hbSector = imagePlugin.ReadSector(1 + partition.Start); RT11HomeBlock homeblock = Marshal.ByteArrayToStructureLittleEndian <RT11HomeBlock>(hbSector); /* TODO: Is this correct? * Assembler: * MOV address, R0 * CLR R1 * MOV #255., R2 * 10$: ADD (R0)+, R1 * SOB R2, 10$ * MOV 1,@R0 */ ushort check = 0; for (int i = 0; i < 512; i += 2) { check += BitConverter.ToUInt16(hbSector, i); } sb.AppendFormat("Volume format is {0}", StringHandlers.SpacePaddedToString(homeblock.format, Encoding.ASCII)).AppendLine(); sb.AppendFormat("{0} sectors per cluster ({1} bytes)", homeblock.cluster, homeblock.cluster * 512). AppendLine(); sb.AppendFormat("First directory segment starts at block {0}", homeblock.rootBlock).AppendLine(); sb.AppendFormat("Volume owner is \"{0}\"", Encoding.GetString(homeblock.ownername).TrimEnd()).AppendLine(); sb.AppendFormat("Volume label: \"{0}\"", Encoding.GetString(homeblock.volname).TrimEnd()).AppendLine(); sb.AppendFormat("Checksum: 0x{0:X4} (calculated 0x{1:X4})", homeblock.checksum, check).AppendLine(); byte[] bootBlock = imagePlugin.ReadSector(0); XmlFsType = new FileSystemType { Type = "RT-11", ClusterSize = (uint)(homeblock.cluster * 512), Clusters = homeblock.cluster, VolumeName = StringHandlers.SpacePaddedToString(homeblock.volname, Encoding), Bootable = !ArrayHelpers.ArrayIsNullOrEmpty(bootBlock) }; information = sb.ToString(); }
public bool Identify(IMediaImage imagePlugin, Partition partition) { if (partition.Start > 0) { return(false); } if (imagePlugin.Info.SectorSize != 256) { return(false); } if (imagePlugin.Info.Sectors != 683 && imagePlugin.Info.Sectors != 768 && imagePlugin.Info.Sectors != 1366 && imagePlugin.Info.Sectors != 3200) { return(false); } byte[] sector; if (imagePlugin.Info.Sectors == 3200) { sector = imagePlugin.ReadSector(1560); CommodoreHeader cbmHdr = Marshal.ByteArrayToStructureLittleEndian <CommodoreHeader>(sector); if (cbmHdr.diskDosVersion == 0x44 && cbmHdr.dosVersion == 0x33 && cbmHdr.diskVersion == 0x44) { return(true); } } else { sector = imagePlugin.ReadSector(357); CommodoreBam cbmBam = Marshal.ByteArrayToStructureLittleEndian <CommodoreBam>(sector); if (cbmBam.dosVersion == 0x41 && (cbmBam.doubleSided == 0x00 || cbmBam.doubleSided == 0x80) && cbmBam.unused1 == 0x00 && cbmBam.directoryTrack == 0x12) { return(true); } } return(false); }
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { Encoding = Encoding.UTF8; var sbInformation = new StringBuilder(); XmlFsType = new FileSystemType(); information = ""; if (partition.Start >= partition.End) { return; } byte[] sector = imagePlugin.ReadSector(partition.Start); ContainerSuperBlock nxSb; try { nxSb = Marshal.ByteArrayToStructureLittleEndian <ContainerSuperBlock>(sector); } catch { return; } if (nxSb.magic != APFS_CONTAINER_MAGIC) { return; } sbInformation.AppendLine("Apple File System"); sbInformation.AppendLine(); sbInformation.AppendFormat("{0} bytes per block", nxSb.blockSize).AppendLine(); sbInformation.AppendFormat("Container has {0} bytes in {1} blocks", nxSb.containerBlocks * nxSb.blockSize, nxSb.containerBlocks).AppendLine(); information = sbInformation.ToString(); XmlFsType = new FileSystemType { Bootable = false, Clusters = nxSb.containerBlocks, ClusterSize = nxSb.blockSize, Type = "Apple File System" }; }
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { Encoding = encoding ?? Encoding.UTF8; ulong vmfsSuperOff = VMFS_BASE / imagePlugin.Info.SectorSize; byte[] sector = imagePlugin.ReadSector(partition.Start + vmfsSuperOff); VolumeInfo volInfo = Marshal.ByteArrayToStructureLittleEndian <VolumeInfo>(sector); var sbInformation = new StringBuilder(); sbInformation.AppendLine("VMware file system"); uint ctimeSecs = (uint)(volInfo.ctime / 1000000); uint ctimeNanoSecs = (uint)(volInfo.ctime % 1000000); uint mtimeSecs = (uint)(volInfo.mtime / 1000000); uint mtimeNanoSecs = (uint)(volInfo.mtime % 1000000); sbInformation.AppendFormat("Volume version {0}", volInfo.version).AppendLine(); sbInformation.AppendFormat("Volume name {0}", StringHandlers.CToString(volInfo.name, Encoding)). AppendLine(); sbInformation.AppendFormat("Volume size {0} bytes", volInfo.size * 256).AppendLine(); sbInformation.AppendFormat("Volume UUID {0}", volInfo.uuid).AppendLine(); sbInformation. AppendFormat("Volume created on {0}", DateHandlers.UnixUnsignedToDateTime(ctimeSecs, ctimeNanoSecs)). AppendLine(); sbInformation.AppendFormat("Volume last modified on {0}", DateHandlers.UnixUnsignedToDateTime(mtimeSecs, mtimeNanoSecs)).AppendLine(); information = sbInformation.ToString(); XmlFsType = new FileSystemType { Type = "VMware file system", CreationDate = DateHandlers.UnixUnsignedToDateTime(ctimeSecs, ctimeNanoSecs), CreationDateSpecified = true, ModificationDate = DateHandlers.UnixUnsignedToDateTime(mtimeSecs, mtimeNanoSecs), ModificationDateSpecified = true, Clusters = (volInfo.size * 256) / imagePlugin.Info.SectorSize, ClusterSize = imagePlugin.Info.SectorSize, VolumeSerial = volInfo.uuid.ToString() }; }
public bool Identify(IMediaImage imagePlugin, Partition partition) { if (1 + partition.Start >= partition.End) { return(false); } if (imagePlugin.Info.SectorSize < 512) { return(false); } byte[] bk0 = imagePlugin.ReadSector(0 + partition.Start); Block0 block0 = Marshal.ByteArrayToStructureLittleEndian <Block0>(bk0); return(block0.label == MAGIC && block0.mklabel == MAGIC2); }
public bool Identify(IMediaImage imagePlugin, Partition partition) { if (12 + partition.Start >= partition.End) { return(false); } byte[] vbrSector = imagePlugin.ReadSector(0 + partition.Start); if (vbrSector.Length < 512) { return(false); } VolumeBootRecord vbr = Marshal.ByteArrayToStructureLittleEndian <VolumeBootRecord>(vbrSector); return(_signature.SequenceEqual(vbr.signature)); }
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); byte[] sector = imagePlugin.ReadSector(partition.Start); uint magic = BitConverter.ToUInt32(sector, 0x00); var crSb = new CramSuperBlock(); bool littleEndian = true; switch (magic) { case CRAM_MAGIC: crSb = Marshal.ByteArrayToStructureLittleEndian <CramSuperBlock>(sector); break; case CRAM_CIGAM: crSb = Marshal.ByteArrayToStructureBigEndian <CramSuperBlock>(sector); littleEndian = false; break; } var sbInformation = new StringBuilder(); sbInformation.AppendLine("Cram file system"); sbInformation.AppendLine(littleEndian ? "Little-endian" : "Big-endian"); sbInformation.AppendFormat("Volume edition {0}", crSb.edition).AppendLine(); sbInformation.AppendFormat("Volume name: {0}", StringHandlers.CToString(crSb.name, Encoding)).AppendLine(); sbInformation.AppendFormat("Volume has {0} bytes", crSb.size).AppendLine(); sbInformation.AppendFormat("Volume has {0} blocks", crSb.blocks).AppendLine(); sbInformation.AppendFormat("Volume has {0} files", crSb.files).AppendLine(); information = sbInformation.ToString(); XmlFsType = new FileSystemType { VolumeName = StringHandlers.CToString(crSb.name, Encoding), Type = "Cram file system", Clusters = crSb.blocks, Files = crSb.files, FilesSpecified = true, FreeClusters = 0, FreeClustersSpecified = true }; }
public bool Identify(IMediaImage imagePlugin, Partition partition) { if (16 + partition.Start >= partition.End) { return(false); } byte[] hpofsBpbSector = imagePlugin.ReadSector(0 + partition.Start); // Seek to BIOS parameter block, on logical sector 0 if (hpofsBpbSector.Length < 512) { return(false); } BiosParameterBlock bpb = Marshal.ByteArrayToStructureLittleEndian <BiosParameterBlock>(hpofsBpbSector); return(bpb.fs_type.SequenceEqual(hpofsType)); }
public bool Identify(IMediaImage imagePlugin, Partition partition) { if (imagePlugin.Info.SectorSize < 512) { return(false); } for (ulong location = 0; location <= 8; location++) { uint sbSize = (uint)(Marshal.SizeOf <Locus_Superblock>() / imagePlugin.Info.SectorSize); if (Marshal.SizeOf <Locus_Superblock>() % imagePlugin.Info.SectorSize != 0) { sbSize++; } if (partition.Start + location + sbSize >= imagePlugin.Info.Sectors) { break; } byte[] sector = imagePlugin.ReadSectors(partition.Start + location, sbSize); if (sector.Length < Marshal.SizeOf <Locus_Superblock>()) { return(false); } Locus_Superblock locusSb = Marshal.ByteArrayToStructureLittleEndian <Locus_Superblock>(sector); AaruConsole.DebugWriteLine("Locus plugin", "magic at {1} = 0x{0:X8}", locusSb.s_magic, location); if (locusSb.s_magic == LOCUS_MAGIC || locusSb.s_magic == LOCUS_CIGAM || locusSb.s_magic == LOCUS_MAGIC_OLD || locusSb.s_magic == LOCUS_CIGAM_OLD) { return(true); } } return(false); }
public bool GetInformation(IMediaImage imagePlugin, out List <CommonTypes.Partition> partitions, ulong sectorOffset) { partitions = new List <CommonTypes.Partition>(); if (31 + sectorOffset >= imagePlugin.Info.Sectors) { return(false); } byte[] sector = imagePlugin.ReadSector(31 + sectorOffset); if (sector.Length < 512) { return(false); } Label table = Marshal.ByteArrayToStructureLittleEndian <Label>(sector); if (table.pt_magic != PT_MAGIC || table.pt_valid != PT_VALID) { return(false); } ulong counter = 0; foreach (CommonTypes.Partition part in table.pt_part.Select(entry => new CommonTypes.Partition { Start = entry.pi_blkoff, Offset = (ulong)(entry.pi_blkoff * sector.Length), Size = (ulong)entry.pi_nblocks, Length = (ulong)(entry.pi_nblocks * sector.Length), Sequence = counter, Scheme = Name }).Where(part => part.Size > 0)) { partitions.Add(part); counter++; } return(true); }
public bool Identify(IMediaImage imagePlugin, Partition partition) { int sbSizeInBytes = Marshal.SizeOf <XiaSuperBlock>(); uint sbSizeInSectors = (uint)(sbSizeInBytes / imagePlugin.Info.SectorSize); if (sbSizeInBytes % imagePlugin.Info.SectorSize > 0) { sbSizeInSectors++; } if (sbSizeInSectors + partition.Start >= partition.End) { return(false); } byte[] sbSector = imagePlugin.ReadSectors(partition.Start, sbSizeInSectors); XiaSuperBlock supblk = Marshal.ByteArrayToStructureLittleEndian <XiaSuperBlock>(sbSector); return(supblk.s_magic == XIAFS_SUPER_MAGIC); }
public bool Identify(IMediaImage imagePlugin, Partition partition) { uint bootSectors = JFS_BOOT_BLOCKS_SIZE / imagePlugin.Info.SectorSize; if (partition.Start + bootSectors >= partition.End) { return(false); } byte[] sector = imagePlugin.ReadSector(partition.Start + bootSectors); if (sector.Length < 512) { return(false); } JfsSuperBlock jfsSb = Marshal.ByteArrayToStructureLittleEndian <JfsSuperBlock>(sector); return(jfsSb.s_magic == JFS_MAGIC); }
public bool Identify(IMediaImage imagePlugin, Partition partition) { if (partition.Start >= partition.End) { return(false); } byte[] sector = imagePlugin.ReadSector(partition.Start); ContainerSuperBlock nxSb; try { nxSb = Marshal.ByteArrayToStructureLittleEndian <ContainerSuperBlock>(sector); } catch { return(false); } return(nxSb.magic == APFS_CONTAINER_MAGIC); }
public bool Identify(IMediaImage imagePlugin, Partition partition) { if (imagePlugin.Info.SectorSize < 512) { return(false); } // It should be start of a tape or floppy or file if (partition.Start != 0) { return(false); } uint sbSize = (uint)(Marshal.SizeOf <s_spcl>() / imagePlugin.Info.SectorSize); if (Marshal.SizeOf <s_spcl>() % imagePlugin.Info.SectorSize != 0) { sbSize++; } byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize); if (sector.Length < Marshal.SizeOf <s_spcl>()) { return(false); } spcl16 oldHdr = Marshal.ByteArrayToStructureLittleEndian <spcl16>(sector); spcl_aix aixHdr = Marshal.ByteArrayToStructureLittleEndian <spcl_aix>(sector); s_spcl newHdr = Marshal.ByteArrayToStructureLittleEndian <s_spcl>(sector); AaruConsole.DebugWriteLine("dump(8) plugin", "old magic = 0x{0:X8}", oldHdr.c_magic); AaruConsole.DebugWriteLine("dump(8) plugin", "aix magic = 0x{0:X8}", aixHdr.c_magic); AaruConsole.DebugWriteLine("dump(8) plugin", "new magic = 0x{0:X8}", newHdr.c_magic); return(oldHdr.c_magic == OFS_MAGIC || aixHdr.c_magic == XIX_MAGIC || aixHdr.c_magic == XIX_CIGAM || newHdr.c_magic == OFS_MAGIC || newHdr.c_magic == NFS_MAGIC || newHdr.c_magic == OFS_CIGAM || newHdr.c_magic == NFS_CIGAM || newHdr.c_magic == UFS2_MAGIC || newHdr.c_magic == UFS2_CIGAM); }
public bool Identify(IMediaImage imagePlugin, Partition partition) { if (imagePlugin.Info.SectorSize < 512) { return(false); } uint sbAddr = REISER_SUPER_OFFSET / imagePlugin.Info.SectorSize; if (sbAddr == 0) { sbAddr = 1; } uint sbSize = (uint)(Marshal.SizeOf <Reiser_Superblock>() / imagePlugin.Info.SectorSize); if (Marshal.SizeOf <Reiser_Superblock>() % imagePlugin.Info.SectorSize != 0) { sbSize++; } if (partition.Start + sbAddr + sbSize >= partition.End) { return(false); } byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize); if (sector.Length < Marshal.SizeOf <Reiser_Superblock>()) { return(false); } Reiser_Superblock reiserSb = Marshal.ByteArrayToStructureLittleEndian <Reiser_Superblock>(sector); return(reiser35_magic.SequenceEqual(reiserSb.magic) || reiser36_magic.SequenceEqual(reiserSb.magic) || reiserJr_magic.SequenceEqual(reiserSb.magic)); }
public bool Identify(IMediaImage imagePlugin, Partition partition) { if (imagePlugin.Info.SectorSize < F2FS_MIN_SECTOR || imagePlugin.Info.SectorSize > F2FS_MAX_SECTOR) { return(false); } uint sbAddr = F2FS_SUPER_OFFSET / imagePlugin.Info.SectorSize; if (sbAddr == 0) { sbAddr = 1; } uint sbSize = (uint)(Marshal.SizeOf <F2FS_Superblock>() / imagePlugin.Info.SectorSize); if (Marshal.SizeOf <F2FS_Superblock>() % imagePlugin.Info.SectorSize != 0) { sbSize++; } if (partition.Start + sbAddr >= partition.End) { return(false); } byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize); if (sector.Length < Marshal.SizeOf <F2FS_Superblock>()) { return(false); } F2FS_Superblock f2fsSb = Marshal.ByteArrayToStructureLittleEndian <F2FS_Superblock>(sector); return(f2fsSb.magic == F2FS_MAGIC); }