public bool Identify(IMediaImage imagePlugin, Partition partition) { if (imagePlugin.Info.SectorSize < 512) { return(false); } byte[] sector; ulong magic; if (partition.Start + 31 < partition.End) { sector = imagePlugin.ReadSector(partition.Start + 31); magic = BitConverter.ToUInt64(sector, 0x1D8); if (magic == ZEC_MAGIC || magic == ZEC_CIGAM) { return(true); } } if (partition.Start + 16 >= partition.End) { return(false); } sector = imagePlugin.ReadSector(partition.Start + 16); magic = BitConverter.ToUInt64(sector, 0x1D8); return(magic == ZEC_MAGIC || magic == ZEC_CIGAM); }
public bool Identify(IMediaImage imagePlugin, Partition partition) { if (2 + partition.Start >= partition.End) { return(false); } byte[] sbSector = imagePlugin.ReadSector(0 + partition.Start); uint magic = BitConverter.ToUInt32(sbSector, 0x20); uint magicBe = BigEndianBitConverter.ToUInt32(sbSector, 0x20); if (magic == BEFS_MAGIC1 || magicBe == BEFS_MAGIC1) { return(true); } if (sbSector.Length >= 0x400) { magic = BitConverter.ToUInt32(sbSector, 0x220); magicBe = BigEndianBitConverter.ToUInt32(sbSector, 0x220); } if (magic == BEFS_MAGIC1 || magicBe == BEFS_MAGIC1) { return(true); } sbSector = imagePlugin.ReadSector(1 + partition.Start); magic = BitConverter.ToUInt32(sbSector, 0x20); magicBe = BigEndianBitConverter.ToUInt32(sbSector, 0x20); return(magic == BEFS_MAGIC1 || magicBe == BEFS_MAGIC1); }
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { // Technically everything on Plan 9 from Bell Labs is in UTF-8 Encoding = Encoding.UTF8; information = ""; if (imagePlugin.Info.SectorSize < 512) { return; } ulong hdrSector = HEADER_POS / imagePlugin.Info.SectorSize; byte[] sector = imagePlugin.ReadSector(partition.Start + hdrSector); FossilHeader hdr = Marshal.ByteArrayToStructureBigEndian <FossilHeader>(sector); DicConsole.DebugWriteLine("Fossil plugin", "magic at 0x{0:X8} (expected 0x{1:X8})", hdr.magic, FOSSIL_HDR_MAGIC); StringBuilder sb = new StringBuilder(); sb.AppendLine("Fossil"); sb.AppendFormat("Filesystem version {0}", hdr.version).AppendLine(); sb.AppendFormat("{0} bytes per block", hdr.blockSize).AppendLine(); sb.AppendFormat("Superblock resides in block {0}", hdr.super).AppendLine(); sb.AppendFormat("Labels resides in block {0}", hdr.label).AppendLine(); sb.AppendFormat("Data starts at block {0}", hdr.data).AppendLine(); sb.AppendFormat("Volume has {0} blocks", hdr.end).AppendLine(); ulong sbLocation = hdr.super * (hdr.blockSize / imagePlugin.Info.SectorSize) + partition.Start; XmlFsType = new FileSystemType { Type = "Fossil filesystem", ClusterSize = hdr.blockSize, Clusters = hdr.end }; if (sbLocation <= partition.End) { sector = imagePlugin.ReadSector(sbLocation); FossilSuperBlock fsb = Marshal.ByteArrayToStructureBigEndian <FossilSuperBlock>(sector); DicConsole.DebugWriteLine("Fossil plugin", "magic 0x{0:X8} (expected 0x{1:X8})", fsb.magic, FOSSIL_SB_MAGIC); if (fsb.magic == FOSSIL_SB_MAGIC) { sb.AppendFormat("Epoch low {0}", fsb.epochLow).AppendLine(); sb.AppendFormat("Epoch high {0}", fsb.epochHigh).AppendLine(); sb.AppendFormat("Next QID {0}", fsb.qid).AppendLine(); sb.AppendFormat("Active root block {0}", fsb.active).AppendLine(); sb.AppendFormat("Next root block {0}", fsb.next).AppendLine(); sb.AppendFormat("Curren root block {0}", fsb.current).AppendLine(); sb.AppendFormat("Volume label: \"{0}\"", StringHandlers.CToString(fsb.name, Encoding)).AppendLine(); XmlFsType.VolumeName = StringHandlers.CToString(fsb.name, Encoding); } } information = sb.ToString(); }
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { Encoding = new PETSCII(); byte[] sector; StringBuilder sbInformation = new StringBuilder(); sbInformation.AppendLine("Commodore file system"); XmlFsType = new FileSystemType { Type = "Commodore file system", Clusters = imagePlugin.Info.Sectors, ClusterSize = 256 }; if (imagePlugin.Info.Sectors == 3200) { sector = imagePlugin.ReadSector(1560); CommodoreHeader cbmHdr = Marshal.ByteArrayToStructureLittleEndian <CommodoreHeader>(sector); sbInformation.AppendFormat("Directory starts at track {0} sector {1}", cbmHdr.directoryTrack, cbmHdr.directorySector).AppendLine(); sbInformation .AppendFormat("Disk DOS Version: {0}", Encoding.ASCII.GetString(new[] { cbmHdr.diskDosVersion })) .AppendLine(); sbInformation.AppendFormat("DOS Version: {0}", Encoding.ASCII.GetString(new[] { cbmHdr.dosVersion })) .AppendLine(); sbInformation.AppendFormat("Disk Version: {0}", Encoding.ASCII.GetString(new[] { cbmHdr.diskVersion })) .AppendLine(); sbInformation.AppendFormat("Disk ID: {0}", cbmHdr.diskId).AppendLine(); sbInformation.AppendFormat("Disk name: {0}", StringHandlers.CToString(cbmHdr.name, Encoding)) .AppendLine(); XmlFsType.VolumeName = StringHandlers.CToString(cbmHdr.name, Encoding); XmlFsType.VolumeSerial = $"{cbmHdr.diskId}"; } else { sector = imagePlugin.ReadSector(357); CommodoreBam cbmBam = Marshal.ByteArrayToStructureLittleEndian <CommodoreBam>(sector); sbInformation.AppendFormat("Directory starts at track {0} sector {1}", cbmBam.directoryTrack, cbmBam.directorySector).AppendLine(); sbInformation.AppendFormat("Disk DOS type: {0}", Encoding.ASCII.GetString(BitConverter.GetBytes(cbmBam.dosType))) .AppendLine(); sbInformation.AppendFormat("DOS Version: {0}", Encoding.ASCII.GetString(new[] { cbmBam.dosVersion })) .AppendLine(); sbInformation.AppendFormat("Disk ID: {0}", cbmBam.diskId).AppendLine(); sbInformation.AppendFormat("Disk name: {0}", StringHandlers.CToString(cbmBam.name, Encoding)) .AppendLine(); XmlFsType.VolumeName = StringHandlers.CToString(cbmBam.name, Encoding); XmlFsType.VolumeSerial = $"{cbmBam.diskId}"; } information = sbInformation.ToString(); }
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { Encoding = new Radix50(); information = ""; StringBuilder sb = new StringBuilder(); byte[] hbSector = imagePlugin.ReadSector(1 + partition.Start); GCHandle handle = GCHandle.Alloc(hbSector, GCHandleType.Pinned); RT11HomeBlock homeblock = (RT11HomeBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(RT11HomeBlock)); handle.Free(); /* 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 = 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 = new CommodoreHeader(); IntPtr cbmHdrPtr = Marshal.AllocHGlobal(Marshal.SizeOf(cbmHdr)); Marshal.Copy(sector, 0, cbmHdrPtr, Marshal.SizeOf(cbmHdr)); cbmHdr = (CommodoreHeader)Marshal.PtrToStructure(cbmHdrPtr, typeof(CommodoreHeader)); Marshal.FreeHGlobal(cbmHdrPtr); if (cbmHdr.diskDosVersion == 0x44 && cbmHdr.dosVersion == 0x33 && cbmHdr.diskVersion == 0x44) { return(true); } } else { sector = imagePlugin.ReadSector(357); CommodoreBAM cbmBam = new CommodoreBAM(); IntPtr cbmBamPtr = Marshal.AllocHGlobal(Marshal.SizeOf(cbmBam)); Marshal.Copy(sector, 0, cbmBamPtr, Marshal.SizeOf(cbmBam)); cbmBam = (CommodoreBAM)Marshal.PtrToStructure(cbmBamPtr, typeof(CommodoreBAM)); Marshal.FreeHGlobal(cbmBamPtr); if (cbmBam.dosVersion == 0x41 && (cbmBam.doubleSided == 0x00 || cbmBam.doubleSided == 0x80) && cbmBam.unused1 == 0x00 && cbmBam.directoryTrack == 0x12) { return(true); } } return(false); }
public bool GetInformation(IMediaImage imagePlugin, out List <Partition> partitions, ulong sectorOffset) { partitions = new List <Partition>(); if (sectorOffset != 0) { return(false); } byte[] bootSector = imagePlugin.ReadSector(0); byte[] sector = imagePlugin.ReadSector(1); if (bootSector[^ 2] != 0x55 ||
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 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); BootBlock bb = Marshal.ByteArrayToStructureLittleEndian <BootBlock>(sector); return(bb.identifier.SequenceEqual(_identifier)); }
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1"); byte[] sector = imagePlugin.ReadSector(6); StringBuilder 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) { 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) { if (imagePlugin.Info.Sectors != 455 && imagePlugin.Info.Sectors != 560) { return(false); } if (partition.Start > 0 || imagePlugin.Info.SectorSize != 256) { return(false); } int spt = imagePlugin.Info.Sectors == 455 ? 13 : 16; byte[] vtocB = imagePlugin.ReadSector((ulong)(17 * spt)); vtoc = new Vtoc(); IntPtr vtocPtr = Marshal.AllocHGlobal(256); Marshal.Copy(vtocB, 0, vtocPtr, 256); vtoc = (Vtoc)Marshal.PtrToStructure(vtocPtr, typeof(Vtoc)); Marshal.FreeHGlobal(vtocPtr); return(vtoc.catalogSector < spt && vtoc.maxTrackSectorPairsPerSector <= 122 && vtoc.sectorsPerTrack == spt && vtoc.bytesPerSector == 256); }
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { Encoding = Encoding.UTF8; information = ""; if (imagePlugin.Info.SectorSize < 512) { return; } bool bigEndian = true; byte[] sector = imagePlugin.ReadSector(partition.Start); Superblock fatxSb = Marshal.ByteArrayToStructureBigEndian <Superblock>(sector); if (fatxSb.magic == FATX_CIGAM) { fatxSb = Marshal.ByteArrayToStructureLittleEndian <Superblock>(sector); bigEndian = false; } if (fatxSb.magic != FATX_MAGIC) { return; } int logicalSectorsPerPhysicalSectors = partition.Offset == 0 && !bigEndian ? 8 : 1; StringBuilder sb = new StringBuilder(); sb.AppendLine("FATX filesystem"); sb.AppendFormat("{0} logical sectors ({1} bytes) per physical sector", logicalSectorsPerPhysicalSectors, logicalSectorsPerPhysicalSectors * imagePlugin.Info.SectorSize).AppendLine(); sb.AppendFormat("{0} sectors ({1} bytes) per cluster", fatxSb.sectorsPerCluster, fatxSb.sectorsPerCluster * logicalSectorsPerPhysicalSectors * imagePlugin.Info.SectorSize) .AppendLine(); sb.AppendFormat("Root directory starts on cluster {0}", fatxSb.rootDirectoryCluster).AppendLine(); string volumeLabel = StringHandlers.CToString(fatxSb.volumeLabel, bigEndian ? Encoding.BigEndianUnicode : Encoding.Unicode, true); sb.AppendFormat("Volume label: {0}", volumeLabel).AppendLine(); sb.AppendFormat("Volume serial: {0:X8}", fatxSb.id).AppendLine(); information = sb.ToString(); XmlFsType = new FileSystemType { Type = "FATX filesystem", ClusterSize = (uint)(fatxSb.sectorsPerCluster * logicalSectorsPerPhysicalSectors * imagePlugin.Info.SectorSize), VolumeName = volumeLabel, VolumeSerial = $"{fatxSb.id:X8}" }; XmlFsType.Clusters = (partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / XmlFsType.ClusterSize; }
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 = new AODOS_BootBlock(); IntPtr bbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(bb)); Marshal.Copy(sector, 0, bbPtr, Marshal.SizeOf(bb)); bb = (AODOS_BootBlock)Marshal.PtrToStructure(bbPtr, typeof(AODOS_BootBlock)); Marshal.FreeHGlobal(bbPtr); 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); BootBlock bb = Marshal.ByteArrayToStructureLittleEndian <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 void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1"); byte[] sector = imagePlugin.ReadSector(6); StringBuilder sbInformation = new StringBuilder(); VolumeLabel vol = new VolumeLabel(); IntPtr volPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vol)); Marshal.Copy(sector, 0, volPtr, Marshal.SizeOf(vol)); vol = (VolumeLabel)Marshal.PtrToStructure(volPtr, typeof(VolumeLabel)); Marshal.FreeHGlobal(volPtr); 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 = (long)(partition.End - partition.Start + 1), VolumeName = Encoding.ASCII.GetString(vol.volumeIdentifier) }; information = sbInformation.ToString(); }
public bool Identify(IMediaImage imagePlugin, Partition partition) { if (2 + partition.Start >= partition.End) { return(false); } byte[] eigthBytes = new byte[8]; byte[] ntfsBpb = imagePlugin.ReadSector(0 + partition.Start); Array.Copy(ntfsBpb, 0x003, eigthBytes, 0, 8); string oemName = StringHandlers.CToString(eigthBytes); if (oemName != "NTFS ") { return(false); } byte fatsNo = ntfsBpb[0x010]; ushort spFat = BitConverter.ToUInt16(ntfsBpb, 0x016); ushort signature = BitConverter.ToUInt16(ntfsBpb, 0x1FE); if (fatsNo != 0) { return(false); } if (spFat != 0) { return(false); } return(signature == 0xAA55); }
public bool Identify(IMediaImage imagePlugin, Partition partition) { if (partition.Start > 0) { return(false); } if (partition.End < 8) { return(false); } byte[] sector = imagePlugin.ReadSector(6); if (sector.Length != 128) { return(false); } VolumeLabel vol = new VolumeLabel(); IntPtr volPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vol)); Marshal.Copy(sector, 0, volPtr, Marshal.SizeOf(vol)); vol = (VolumeLabel)Marshal.PtrToStructure(volPtr, typeof(VolumeLabel)); Marshal.FreeHGlobal(volPtr); return(ecma67_magic.SequenceEqual(vol.labelIdentifier) && vol.labelNumber == 1 && vol.recordLength == 0x31); }
public bool Identify(IMediaImage imagePlugin, Partition partition) { if (imagePlugin.Info.SectorSize < 512) { return(false); } ulong sbSectorOff = SB_POS / imagePlugin.Info.SectorSize; uint sbOff = SB_POS % imagePlugin.Info.SectorSize; if (sbSectorOff + partition.Start >= partition.End) { return(false); } byte[] sbSector = imagePlugin.ReadSector(sbSectorOff + partition.Start); byte[] sb = new byte[512]; if (sbOff + 512 > sbSector.Length) { return(false); } Array.Copy(sbSector, sbOff, sb, 0, 512); ushort magic = BitConverter.ToUInt16(sb, 0x038); return(magic == EXT_MAGIC); }
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1"); byte[] rootBlockSector = imagePlugin.ReadSector(partition.Start); RootBlock rootBlock = Marshal.ByteArrayToStructureBigEndian <RootBlock>(rootBlockSector); var sbInformation = new StringBuilder(); sbInformation.AppendLine("SmartFileSystem"); sbInformation.AppendFormat("Volume version {0}", rootBlock.version).AppendLine(); sbInformation.AppendFormat("Volume starts on device byte {0} and ends on byte {1}", rootBlock.firstbyte, rootBlock.lastbyte).AppendLine(); sbInformation. AppendFormat("Volume has {0} blocks of {1} bytes each", rootBlock.totalblocks, rootBlock.blocksize). AppendLine(); sbInformation.AppendFormat("Volume created on {0}", DateHandlers.UnixUnsignedToDateTime(rootBlock.datecreated).AddYears(8)). AppendLine(); sbInformation.AppendFormat("Bitmap starts in block {0}", rootBlock.bitmapbase).AppendLine(); sbInformation.AppendFormat("Admin space container starts in block {0}", rootBlock.adminspacecontainer). AppendLine(); sbInformation.AppendFormat("Root object container starts in block {0}", rootBlock.rootobjectcontainer). AppendLine(); sbInformation. AppendFormat("Root node of the extent B-tree resides in block {0}", rootBlock.extentbnoderoot). AppendLine(); sbInformation.AppendFormat("Root node of the object B-tree resides in block {0}", rootBlock.objectnoderoot). AppendLine(); if (rootBlock.bits.HasFlag(Flags.CaseSensitive)) { sbInformation.AppendLine("Volume is case sensitive"); } if (rootBlock.bits.HasFlag(Flags.RecycledFolder)) { sbInformation.AppendLine("Volume moves deleted files to a recycled folder"); } information = sbInformation.ToString(); XmlFsType = new FileSystemType { CreationDate = DateHandlers.UnixUnsignedToDateTime(rootBlock.datecreated).AddYears(8), CreationDateSpecified = true, Clusters = rootBlock.totalblocks, ClusterSize = rootBlock.blocksize, Type = "SmartFileSystem" }; }
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); information = ""; StringBuilder sb = new StringBuilder(); if (imagePlugin.Info.SectorSize < 512) { return; } ulong sbSectorOff = SB_POS / imagePlugin.Info.SectorSize; uint sbOff = SB_POS % imagePlugin.Info.SectorSize; if (sbSectorOff + partition.Start >= partition.End) { return; } byte[] sblock = imagePlugin.ReadSector(sbSectorOff + partition.Start); byte[] sbSector = new byte[512]; Array.Copy(sblock, sbOff, sbSector, 0, 512); extFSSuperBlock extSb = new extFSSuperBlock { inodes = BitConverter.ToUInt32(sbSector, 0x000), zones = BitConverter.ToUInt32(sbSector, 0x004), firstfreeblk = BitConverter.ToUInt32(sbSector, 0x008), freecountblk = BitConverter.ToUInt32(sbSector, 0x00C), firstfreeind = BitConverter.ToUInt32(sbSector, 0x010), freecountind = BitConverter.ToUInt32(sbSector, 0x014), firstdatazone = BitConverter.ToUInt32(sbSector, 0x018), logzonesize = BitConverter.ToUInt32(sbSector, 0x01C), maxsize = BitConverter.ToUInt32(sbSector, 0x020) }; sb.AppendLine("ext filesystem"); sb.AppendFormat("{0} zones on volume", extSb.zones); sb.AppendFormat("{0} free blocks ({1} bytes)", extSb.freecountblk, extSb.freecountblk * 1024); sb.AppendFormat("{0} inodes on volume, {1} free ({2}%)", extSb.inodes, extSb.freecountind, extSb.freecountind * 100 / extSb.inodes); sb.AppendFormat("First free inode is {0}", extSb.firstfreeind); sb.AppendFormat("First free block is {0}", extSb.firstfreeblk); sb.AppendFormat("First data zone is {0}", extSb.firstdatazone); sb.AppendFormat("Log zone size: {0}", extSb.logzonesize); sb.AppendFormat("Max zone size: {0}", extSb.maxsize); XmlFsType = new FileSystemType { Type = "ext", FreeClusters = extSb.freecountblk, FreeClustersSpecified = true, ClusterSize = 1024, Clusters = (long)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / 1024) }; information = sb.ToString(); }
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 bool Identify(IMediaImage imagePlugin, Partition partition) { if (2 + partition.Start >= partition.End) { return(false); } if (imagePlugin.Info.SectorSize < 512) { return(false); } byte[] magicB = new byte[12]; byte[] hbSector = imagePlugin.ReadSector(1 + partition.Start); Array.Copy(hbSector, 0x1F0, magicB, 0, 12); string magic = Encoding.ASCII.GetString(magicB); AaruConsole.DebugWriteLine("Files-11 plugin", "magic: \"{0}\"", magic); if (magic == "DECFILE11A " || magic == "DECFILE11B ") { return(true); } // Optical disc if (imagePlugin.Info.XmlMediaType != XmlMediaType.OpticalDisc) { return(false); } if (hbSector.Length < 0x400) { return(false); } hbSector = imagePlugin.ReadSector(partition.Start); Array.Copy(hbSector, 0x3F0, magicB, 0, 12); magic = Encoding.ASCII.GetString(magicB); AaruConsole.DebugWriteLine("Files-11 plugin", "unaligned magic: \"{0}\"", magic); return(magic == "DECFILE11A " || magic == "DECFILE11B "); }
internal static void DoPrintHex(PrintHexOptions options) { DicConsole.DebugWriteLine("PrintHex command", "--debug={0}", options.Debug); DicConsole.DebugWriteLine("PrintHex command", "--verbose={0}", options.Verbose); DicConsole.DebugWriteLine("PrintHex command", "--input={0}", options.InputFile); DicConsole.DebugWriteLine("PrintHex command", "--start={0}", options.StartSector); DicConsole.DebugWriteLine("PrintHex command", "--length={0}", options.Length); DicConsole.DebugWriteLine("PrintHex command", "--long-sectors={0}", options.LongSectors); DicConsole.DebugWriteLine("PrintHex command", "--WidthBytes={0}", options.WidthBytes); FiltersList filtersList = new FiltersList(); IFilter inputFilter = filtersList.GetFilter(options.InputFile); if (inputFilter == null) { DicConsole.ErrorWriteLine("Cannot open specified file."); return; } IMediaImage inputFormat = ImageFormat.Detect(inputFilter); if (inputFormat == null) { DicConsole.ErrorWriteLine("Unable to recognize image format, not verifying"); return; } inputFormat.Open(inputFilter); for (ulong i = 0; i < options.Length; i++) { DicConsole.WriteLine("Sector {0}", options.StartSector + i); if (inputFormat.Info.ReadableSectorTags == null) { DicConsole .WriteLine("Requested sectors with tags, unsupported by underlying image format, printing only user data."); options.LongSectors = false; } else { if (inputFormat.Info.ReadableSectorTags.Count == 0) { DicConsole .WriteLine("Requested sectors with tags, unsupported by underlying image format, printing only user data."); options.LongSectors = false; } } byte[] sector = options.LongSectors ? inputFormat.ReadSectorLong(options.StartSector + i) : inputFormat.ReadSector(options.StartSector + i); DiscImageChef.PrintHex.PrintHexArray(sector, options.WidthBytes); } Core.Statistics.AddCommand("print-hex"); }
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); GCHandle handle = GCHandle.Alloc(tblsector, GCHandleType.Pinned); Partable xnxtbl = (Partable)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Partable)); handle.Free(); DicConsole.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++) { DicConsole.DebugWriteLine("XENIX plugin", "xnxtbl.p[{0}].p_off = {1}", i, xnxtbl.p[i].p_off); DicConsole.DebugWriteLine("XENIX plugin", "xnxtbl.p[{0}].p_size = {1}", i, xnxtbl.p[i].p_size); if (xnxtbl.p[i].p_size <= 0) { continue; } CommonTypes.Partition 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(); byte[] bfsSbSector = imagePlugin.ReadSector(0 + partition.Start); byte[] sbStrings = new byte[6]; var bfsSb = new SuperBlock { s_magic = BitConverter.ToUInt32(bfsSbSector, 0x00), s_start = BitConverter.ToUInt32(bfsSbSector, 0x04), s_end = BitConverter.ToUInt32(bfsSbSector, 0x08), s_from = BitConverter.ToUInt32(bfsSbSector, 0x0C), s_to = BitConverter.ToUInt32(bfsSbSector, 0x10), s_bfrom = BitConverter.ToInt32(bfsSbSector, 0x14), s_bto = BitConverter.ToInt32(bfsSbSector, 0x18) }; Array.Copy(bfsSbSector, 0x1C, sbStrings, 0, 6); bfsSb.s_fsname = StringHandlers.CToString(sbStrings, Encoding); Array.Copy(bfsSbSector, 0x22, sbStrings, 0, 6); bfsSb.s_volume = StringHandlers.CToString(sbStrings, Encoding); AaruConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_magic: 0x{0:X8}", bfsSb.s_magic); AaruConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_start: 0x{0:X8}", bfsSb.s_start); AaruConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_end: 0x{0:X8}", bfsSb.s_end); AaruConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_from: 0x{0:X8}", bfsSb.s_from); AaruConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_to: 0x{0:X8}", bfsSb.s_to); AaruConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_bfrom: 0x{0:X8}", bfsSb.s_bfrom); AaruConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_bto: 0x{0:X8}", bfsSb.s_bto); AaruConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_fsname: 0x{0}", bfsSb.s_fsname); AaruConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_volume: 0x{0}", bfsSb.s_volume); sb.AppendLine("UNIX Boot filesystem"); sb.AppendFormat("Volume goes from byte {0} to byte {1}, for {2} bytes", bfsSb.s_start, bfsSb.s_end, bfsSb.s_end - bfsSb.s_start).AppendLine(); sb.AppendFormat("Filesystem name: {0}", bfsSb.s_fsname).AppendLine(); sb.AppendFormat("Volume name: {0}", bfsSb.s_volume).AppendLine(); XmlFsType = new FileSystemType { Type = "BFS", VolumeName = bfsSb.s_volume, ClusterSize = imagePlugin.Info.SectorSize, Clusters = (partition.End - partition.Start) + 1 }; information = sb.ToString(); }
public bool Identify(IMediaImage imagePlugin, Partition partition) { if (2 + partition.Start >= partition.End) { return(false); } uint magic = BitConverter.ToUInt32(imagePlugin.ReadSector(0 + partition.Start), 0); return(magic == BFS_MAGIC); }
static byte[] Read2048SectorAs512(IMediaImage imagePlugin, ulong lba) { ulong lba2K = lba / 4; int remainder = (int)(lba % 4); byte[] buffer = imagePlugin.ReadSector(lba2K); byte[] sector = new byte[512]; Array.Copy(buffer, remainder * 512, sector, 0, 512); return(sector); }
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); SuperBlock vxSb = Marshal.ByteArrayToStructureLittleEndian <SuperBlock>(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 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); }