Reformatted.

This commit is contained in:
2016-04-19 02:11:47 +01:00
parent 6a8499f8ed
commit f8bc81d4f5
149 changed files with 6983 additions and 6970 deletions

View File

@@ -68,13 +68,13 @@ namespace DiscImageChef.PartPlugins
ulong apm_entries;
uint sector_size;
if (imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448)
if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448)
sector_size = 2048;
else
sector_size = imagePlugin.GetSectorSize();
partitions = new List<CommonTypes.Partition>();
AppleMapBootEntry APMB = new AppleMapBootEntry();
AppleMapPartitionEntry APMEntry;
@@ -106,19 +106,19 @@ namespace DiscImageChef.PartPlugins
ulong first_sector = 0;
if (APMB.signature == APM_MAGIC) // APM boot block found, APM starts in next sector
if(APMB.signature == APM_MAGIC) // APM boot block found, APM starts in next sector
first_sector = 1;
// Read first entry
byte[] APMEntry_sector;
bool APMFromHDDOnCD = false;
if (sector_size == 2048)
if(sector_size == 2048)
{
APMEntry_sector = Read2048SectorAs512(imagePlugin, first_sector);
APMEntry = DecodeAPMEntry(APMEntry_sector);
if (APMEntry.signature == APM_ENTRY || APMEntry.signature == APM_OLDENT)
if(APMEntry.signature == APM_ENTRY || APMEntry.signature == APM_OLDENT)
{
sector_size = 512;
APMFromHDDOnCD = true;
@@ -129,7 +129,7 @@ namespace DiscImageChef.PartPlugins
APMEntry_sector = imagePlugin.ReadSector(first_sector);
APMEntry = DecodeAPMEntry(APMEntry_sector);
if (APMEntry.signature != APM_ENTRY && APMEntry.signature != APM_OLDENT)
if(APMEntry.signature != APM_ENTRY && APMEntry.signature != APM_OLDENT)
return false;
}
}
@@ -138,16 +138,16 @@ namespace DiscImageChef.PartPlugins
APMEntry_sector = imagePlugin.ReadSector(first_sector);
APMEntry = DecodeAPMEntry(APMEntry_sector);
if (APMEntry.signature != APM_ENTRY && APMEntry.signature != APM_OLDENT)
if(APMEntry.signature != APM_ENTRY && APMEntry.signature != APM_OLDENT)
return false;
}
if (APMEntry.entries <= 1)
if(APMEntry.entries <= 1)
return false;
apm_entries = APMEntry.entries;
for (ulong i = 0; i < apm_entries; i++) // For each partition
for(ulong i = 0; i < apm_entries; i++) // For each partition
{
if(APMFromHDDOnCD)
APMEntry_sector = Read2048SectorAs512(imagePlugin, first_sector + i);
@@ -156,11 +156,11 @@ namespace DiscImageChef.PartPlugins
APMEntry = DecodeAPMEntry(APMEntry_sector);
if (APMEntry.signature == APM_ENTRY || APMEntry.signature == APM_OLDENT) // It should have partition entry signature
if(APMEntry.signature == APM_ENTRY || APMEntry.signature == APM_OLDENT) // It should have partition entry signature
{
CommonTypes.Partition _partition = new CommonTypes.Partition();
StringBuilder sb = new StringBuilder();
_partition.PartitionSequence = i;
_partition.PartitionType = APMEntry.type;
_partition.PartitionName = APMEntry.name;
@@ -168,24 +168,24 @@ namespace DiscImageChef.PartPlugins
_partition.PartitionLength = APMEntry.sectors * sector_size;
_partition.PartitionStartSector = APMEntry.start;
_partition.PartitionSectors = APMEntry.sectors;
sb.AppendLine("Partition flags:");
if ((APMEntry.status & 0x01) == 0x01)
if((APMEntry.status & 0x01) == 0x01)
sb.AppendLine("Partition is valid.");
if ((APMEntry.status & 0x02) == 0x02)
if((APMEntry.status & 0x02) == 0x02)
sb.AppendLine("Partition entry is not available.");
if ((APMEntry.status & 0x04) == 0x04)
if((APMEntry.status & 0x04) == 0x04)
sb.AppendLine("Partition is mounted.");
if ((APMEntry.status & 0x08) == 0x08)
if((APMEntry.status & 0x08) == 0x08)
sb.AppendLine("Partition is bootable.");
if ((APMEntry.status & 0x10) == 0x10)
if((APMEntry.status & 0x10) == 0x10)
sb.AppendLine("Partition is readable.");
if ((APMEntry.status & 0x20) == 0x20)
if((APMEntry.status & 0x20) == 0x20)
sb.AppendLine("Partition is writable.");
if ((APMEntry.status & 0x40) == 0x40)
if((APMEntry.status & 0x40) == 0x40)
sb.AppendLine("Partition's boot code is position independent.");
if ((APMEntry.status & 0x08) == 0x08)
if((APMEntry.status & 0x08) == 0x08)
{
sb.AppendFormat("First boot sector: {0}", APMEntry.first_boot_block).AppendLine();
sb.AppendFormat("Boot is {0} bytes.", APMEntry.boot_size).AppendLine();
@@ -194,15 +194,15 @@ namespace DiscImageChef.PartPlugins
sb.AppendFormat("Boot code checksum: 0x{0:X8}", APMEntry.checksum).AppendLine();
sb.AppendFormat("Processor: {0}", APMEntry.processor).AppendLine();
}
_partition.PartitionDescription = sb.ToString();
if ((APMEntry.status & 0x01) == 0x01)
if (APMEntry.type != "Apple_partition_map")
partitions.Add(_partition);
if((APMEntry.status & 0x01) == 0x01)
if(APMEntry.type != "Apple_partition_map")
partitions.Add(_partition);
}
}
return true;
}

View File

@@ -72,7 +72,7 @@ namespace DiscImageChef.PartPlugins
{
partitions = new List<CommonTypes.Partition>();
if (imagePlugin.GetSectorSize() < 512)
if(imagePlugin.GetSectorSize() < 512)
return false;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
@@ -87,7 +87,7 @@ namespace DiscImageChef.PartPlugins
Array.Copy(sector, 0, table.boot, 0, 342);
for (int i = 0; i < 8; i++)
for(int i = 0; i < 8; i++)
{
table.icdEntries[i].type = BigEndianBitConverter.ToUInt32(sector, 342 + i * 12 + 0);
table.icdEntries[i].start = BigEndianBitConverter.ToUInt32(sector, 342 + i * 12 + 4);
@@ -98,7 +98,7 @@ namespace DiscImageChef.PartPlugins
table.size = BigEndianBitConverter.ToUInt32(sector, 450);
for (int i = 0; i < 4; i++)
for(int i = 0; i < 4; i++)
{
table.entries[i].type = BigEndianBitConverter.ToUInt32(sector, 454 + i * 12 + 0);
table.entries[i].start = BigEndianBitConverter.ToUInt32(sector, 454 + i * 12 + 4);
@@ -114,7 +114,7 @@ namespace DiscImageChef.PartPlugins
sha1Ctx.Update(table.boot);
DicConsole.DebugWriteLine("Atari partition plugin", "Boot code SHA1: {0}", sha1Ctx.End());
for (int i = 0; i < 8; i++)
for(int i = 0; i < 8; i++)
{
DicConsole.DebugWriteLine("Atari partition plugin", "table.icdEntries[{0}].flag = 0x{1:X2}", i, (table.icdEntries[i].type & 0xFF000000) >> 24);
DicConsole.DebugWriteLine("Atari partition plugin", "table.icdEntries[{0}].type = 0x{1:X6}", i, (table.icdEntries[i].type & 0x00FFFFFF));
@@ -124,7 +124,7 @@ namespace DiscImageChef.PartPlugins
DicConsole.DebugWriteLine("Atari partition plugin", "table.size = {0}", table.size);
for (int i = 0; i < 4; i++)
for(int i = 0; i < 4; i++)
{
DicConsole.DebugWriteLine("Atari partition plugin", "table.entries[{0}].flag = 0x{1:X2}", i, (table.entries[i].type & 0xFF000000) >> 24);
DicConsole.DebugWriteLine("Atari partition plugin", "table.entries[{0}].type = 0x{1:X6}", i, (table.entries[i].type & 0x00FFFFFF));
@@ -138,24 +138,24 @@ namespace DiscImageChef.PartPlugins
bool validTable = false;
ulong partitionSequence = 0;
for (int i = 0; i < 4; i++)
for(int i = 0; i < 4; i++)
{
UInt32 type = table.entries[i].type & 0x00FFFFFF;
if (type == TypeGEMDOS || type == TypeBigGEMDOS || type == TypeLinux ||
if(type == TypeGEMDOS || type == TypeBigGEMDOS || type == TypeLinux ||
type == TypeSwap || type == TypeRAW || type == TypeNetBSD ||
type == TypeNetBSDSwap || type == TypeSysV || type == TypeMac ||
type == TypeMinix || type == TypeMinix2)
{
validTable = true;
if (table.entries[i].start <= imagePlugin.GetSectors())
if(table.entries[i].start <= imagePlugin.GetSectors())
{
if ((table.entries[i].start + table.entries[i].length) > imagePlugin.GetSectors())
if((table.entries[i].start + table.entries[i].length) > imagePlugin.GetSectors())
DicConsole.DebugWriteLine("Atari partition plugin", "WARNING: End of partition goes beyond device size");
ulong sectorSize = imagePlugin.GetSectorSize();
if (sectorSize == 2448 || sectorSize == 2352)
if(sectorSize == 2448 || sectorSize == 2352)
sectorSize = 2048;
CommonTypes.Partition part = new CommonTypes.Partition();
@@ -172,7 +172,7 @@ namespace DiscImageChef.PartPlugins
partType[2] = (byte)(type & 0x0000FF);
part.PartitionType = Encoding.ASCII.GetString(partType);
switch (type)
switch(type)
{
case TypeGEMDOS:
part.PartitionDescription = "Atari GEMDOS partition";
@@ -215,36 +215,36 @@ namespace DiscImageChef.PartPlugins
}
}
if (type == TypeExtended)
if(type == TypeExtended)
{
byte[] extendedSector = imagePlugin.ReadSector(table.entries[i].start);
AtariTable extendedTable = new AtariTable();
extendedTable.entries = new AtariEntry[4];
for (int j = 0; j < 4; j++)
for(int j = 0; j < 4; j++)
{
extendedTable.entries[j].type = BigEndianBitConverter.ToUInt32(extendedSector, 454 + j * 12 + 0);
extendedTable.entries[j].start = BigEndianBitConverter.ToUInt32(extendedSector, 454 + j * 12 + 4);
extendedTable.entries[j].length = BigEndianBitConverter.ToUInt32(extendedSector, 454 + j * 12 + 8);
}
for (int j = 0; j < 4; j++)
for(int j = 0; j < 4; j++)
{
UInt32 extendedType = extendedTable.entries[j].type & 0x00FFFFFF;
if (extendedType == TypeGEMDOS || extendedType == TypeBigGEMDOS || extendedType == TypeLinux ||
if(extendedType == TypeGEMDOS || extendedType == TypeBigGEMDOS || extendedType == TypeLinux ||
extendedType == TypeSwap || extendedType == TypeRAW || extendedType == TypeNetBSD ||
extendedType == TypeNetBSDSwap || extendedType == TypeSysV || extendedType == TypeMac ||
extendedType == TypeMinix || extendedType == TypeMinix2)
{
validTable = true;
if (extendedTable.entries[j].start <= imagePlugin.GetSectors())
if(extendedTable.entries[j].start <= imagePlugin.GetSectors())
{
if ((extendedTable.entries[j].start + extendedTable.entries[j].length) > imagePlugin.GetSectors())
if((extendedTable.entries[j].start + extendedTable.entries[j].length) > imagePlugin.GetSectors())
DicConsole.DebugWriteLine("Atari partition plugin", "WARNING: End of partition goes beyond device size");
ulong sectorSize = imagePlugin.GetSectorSize();
if (sectorSize == 2448 || sectorSize == 2352)
if(sectorSize == 2448 || sectorSize == 2352)
sectorSize = 2048;
CommonTypes.Partition part = new CommonTypes.Partition();
@@ -261,7 +261,7 @@ namespace DiscImageChef.PartPlugins
partType[2] = (byte)(extendedType & 0x0000FF);
part.PartitionType = Encoding.ASCII.GetString(partType);
switch (extendedType)
switch(extendedType)
{
case TypeGEMDOS:
part.PartitionDescription = "Atari GEMDOS partition";
@@ -286,14 +286,14 @@ namespace DiscImageChef.PartPlugins
break;
case TypeSysV:
part.PartitionDescription = "Atari UNIX partition";
break;
break;
case TypeMac:
part.PartitionDescription = "Macintosh partition";
break;
break;
case TypeMinix:
case TypeMinix2:
part.PartitionDescription = "MINIX partition";
break;
break;
default:
part.PartitionDescription = "Unknown partition type";
break;
@@ -307,24 +307,24 @@ namespace DiscImageChef.PartPlugins
}
}
if (validTable)
if(validTable)
{
for (int i = 0; i < 8; i++)
for(int i = 0; i < 8; i++)
{
UInt32 type = table.icdEntries[i].type & 0x00FFFFFF;
if (type == TypeGEMDOS || type == TypeBigGEMDOS || type == TypeLinux ||
if(type == TypeGEMDOS || type == TypeBigGEMDOS || type == TypeLinux ||
type == TypeSwap || type == TypeRAW || type == TypeNetBSD ||
type == TypeNetBSDSwap || type == TypeSysV || type == TypeMac ||
type == TypeMinix || type == TypeMinix2)
{
if (table.icdEntries[i].start <= imagePlugin.GetSectors())
if(table.icdEntries[i].start <= imagePlugin.GetSectors())
{
if ((table.icdEntries[i].start + table.icdEntries[i].length) > imagePlugin.GetSectors())
if((table.icdEntries[i].start + table.icdEntries[i].length) > imagePlugin.GetSectors())
DicConsole.DebugWriteLine("Atari partition plugin", "WARNING: End of partition goes beyond device size");
ulong sectorSize = imagePlugin.GetSectorSize();
if (sectorSize == 2448 || sectorSize == 2352)
if(sectorSize == 2448 || sectorSize == 2352)
sectorSize = 2048;
CommonTypes.Partition part = new CommonTypes.Partition();
@@ -341,7 +341,7 @@ namespace DiscImageChef.PartPlugins
partType[2] = (byte)(type & 0x0000FF);
part.PartitionType = Encoding.ASCII.GetString(partType);
switch (type)
switch(type)
{
case TypeGEMDOS:
part.PartitionDescription = "Atari GEMDOS partition";
@@ -366,14 +366,14 @@ namespace DiscImageChef.PartPlugins
break;
case TypeSysV:
part.PartitionDescription = "Atari UNIX partition";
break;
break;
case TypeMac:
part.PartitionDescription = "Macintosh partition";
break;
break;
case TypeMinix:
case TypeMinix2:
part.PartitionDescription = "MINIX partition";
break;
break;
default:
part.PartitionDescription = "Unknown partition type";
break;

View File

@@ -41,7 +41,7 @@ using System.Runtime.InteropServices;
using DiscImageChef.Console;
namespace DiscImageChef.PartPlugins
{
{
class GuidPartitionTable : PartPlugin
{
const ulong GptMagic = 0x5452415020494645;
@@ -65,7 +65,7 @@ namespace DiscImageChef.PartPlugins
GCHandle handle = GCHandle.Alloc(hdrBytes, GCHandleType.Pinned);
hdr = (GptHeader)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(GptHeader));
handle.Free();
}
}
catch
{
return false;
@@ -86,10 +86,10 @@ namespace DiscImageChef.PartPlugins
DicConsole.DebugWriteLine("GPT Plugin", "hdr.entriesSize = {0}", hdr.entriesSize);
DicConsole.DebugWriteLine("GPT Plugin", "hdr.entriesCrc = 0x{0:X8}", hdr.entriesCrc);
if (hdr.signature != GptMagic)
if(hdr.signature != GptMagic)
return false;
if (hdr.myLBA != 1)
if(hdr.myLBA != 1)
return false;
uint totalEntriesSectors = (hdr.entries * hdr.entriesSize) / imagePlugin.GetSectorSize();
@@ -97,7 +97,7 @@ namespace DiscImageChef.PartPlugins
byte[] entriesBytes = imagePlugin.ReadSectors(hdr.entryLBA, totalEntriesSectors);
List<GptEntry> entries = new List<GptEntry>();
for (int i = 0; i < hdr.entries; i++)
for(int i = 0; i < hdr.entries; i++)
{
try
{
@@ -113,14 +113,14 @@ namespace DiscImageChef.PartPlugins
}
}
if (entries.Count == 0)
if(entries.Count == 0)
return false;
ulong pseq = 0;
foreach (GptEntry entry in entries)
foreach(GptEntry entry in entries)
{
if (entry.partitionType != Guid.Empty && entry.partitionId != Guid.Empty)
if(entry.partitionType != Guid.Empty && entry.partitionId != Guid.Empty)
{
DicConsole.DebugWriteLine("GPT Plugin", "entry.partitionType = {0}", entry.partitionType);
DicConsole.DebugWriteLine("GPT Plugin", "entry.partitionId = {0}", entry.partitionId);
@@ -129,7 +129,7 @@ namespace DiscImageChef.PartPlugins
DicConsole.DebugWriteLine("GPT Plugin", "entry.attributes = 0x{0:X16}", entry.attributes);
DicConsole.DebugWriteLine("GPT Plugin", "entry.name = {0}", entry.name);
if (entry.startLBA > imagePlugin.GetSectors() || entry.endLBA > imagePlugin.GetSectors())
if(entry.startLBA > imagePlugin.GetSectors() || entry.endLBA > imagePlugin.GetSectors())
return false;
CommonTypes.Partition part = new CommonTypes.Partition();
@@ -152,7 +152,7 @@ namespace DiscImageChef.PartPlugins
public string GetGuidTypeName(Guid type)
{
string strType = type.ToString().ToUpperInvariant();
switch (strType)
switch(strType)
{
case "024DEE41-33E7-11D3-9D69-0008C781F39F":
return "MBR scheme";

View File

@@ -58,23 +58,23 @@ namespace DiscImageChef.PartPlugins
byte cyl_sect1, cyl_sect2; // For decoding cylinder and sector
UInt16 signature;
ulong counter = 0;
partitions = new List<CommonTypes.Partition>();
if (imagePlugin.GetSectorSize() < 512)
if(imagePlugin.GetSectorSize() < 512)
return false;
byte[] sector = imagePlugin.ReadSector(0);
signature = BitConverter.ToUInt16(sector, 0x1FE);
if (signature != MBRSignature)
if(signature != MBRSignature)
return false; // Not MBR
for (int i = 0; i < 4; i++)
for(int i = 0; i < 4; i++)
{
MBRPartitionEntry entry = new MBRPartitionEntry();
entry.status = sector[0x1BE + 16 * i + 0x00];
entry.start_head = sector[0x1BE + 16 * i + 0x01];
@@ -83,36 +83,36 @@ namespace DiscImageChef.PartPlugins
entry.start_sector = (byte)(cyl_sect1 & 0x3F);
entry.start_cylinder = (ushort)(((cyl_sect1 & 0xC0) << 2) | cyl_sect2);
entry.type = sector[0x1BE + 16 * i + 0x04];
entry.end_head = sector[0x1BE + 16 * i + 0x05];
cyl_sect1 = sector[0x1BE + 16 * i + 0x06];
cyl_sect2 = sector[0x1BE + 16 * i + 0x07];
entry.end_sector = (byte)(cyl_sect1 & 0x3F);
entry.end_cylinder = (ushort)(((cyl_sect1 & 0xC0) << 2) | cyl_sect2);
entry.lba_start = BitConverter.ToUInt32(sector, 0x1BE + 16 * i + 0x08);
entry.lba_sectors = BitConverter.ToUInt32(sector, 0x1BE + 16 * i + 0x0C);
// Let's start the fun...
bool valid = true;
bool extended = false;
bool disklabel = false;
if (entry.status != 0x00 && entry.status != 0x80)
if(entry.status != 0x00 && entry.status != 0x80)
return false; // Maybe a FAT filesystem
valid &= entry.type != 0x00;
if (entry.type == 0xEE || entry.type == 0xEF)
if(entry.type == 0xEE || entry.type == 0xEF)
return false; // This is a GPT
if (entry.type == 0x05 || entry.type == 0x0F || entry.type == 0x85)
if(entry.type == 0x05 || entry.type == 0x0F || entry.type == 0x85)
{
valid = false;
extended = true; // Extended partition
}
if (entry.type == 0x82 || entry.type == 0xBF || entry.type == 0xA5 || entry.type == 0xA6 || entry.type == 0xA9 ||
if(entry.type == 0x82 || entry.type == 0xBF || entry.type == 0xA5 || entry.type == 0xA6 || entry.type == 0xA9 ||
entry.type == 0xB7 || entry.type == 0x81 || entry.type == 0x63)
{
valid = false;
@@ -120,24 +120,24 @@ namespace DiscImageChef.PartPlugins
}
valid &= entry.lba_start != 0 || entry.lba_sectors != 0 || entry.start_cylinder != 0 || entry.start_head != 0 || entry.start_sector != 0 || entry.end_cylinder != 0 || entry.end_head != 0 || entry.end_sector != 0;
if (entry.lba_start == 0 && entry.lba_sectors == 0 && valid)
if(entry.lba_start == 0 && entry.lba_sectors == 0 && valid)
{
entry.lba_start = CHStoLBA(entry.start_cylinder, entry.start_head, entry.start_sector);
entry.lba_sectors = CHStoLBA(entry.end_cylinder, entry.end_head, entry.end_sector) - entry.lba_start;
}
if (entry.lba_start > imagePlugin.GetSectors() || entry.lba_start + entry.lba_sectors > imagePlugin.GetSectors())
if(entry.lba_start > imagePlugin.GetSectors() || entry.lba_start + entry.lba_sectors > imagePlugin.GetSectors())
{
valid = false;
disklabel = false;
extended = false;
}
if (disklabel)
if(disklabel)
{
byte[] disklabel_sector = imagePlugin.ReadSector(entry.lba_start);
switch (entry.type)
switch(entry.type)
{
case 0xA5:
case 0xA6:
@@ -145,13 +145,13 @@ namespace DiscImageChef.PartPlugins
case 0xB7: // BSD disklabels
{
UInt32 magic = BitConverter.ToUInt32(disklabel_sector, 0);
if (magic == 0x82564557)
if(magic == 0x82564557)
{
UInt16 no_parts = BitConverter.ToUInt16(disklabel_sector, 126);
// TODO: Handle disklabels bigger than 1 sector or search max no_parts
for (int j = 0; j < no_parts; j++)
for(int j = 0; j < no_parts; j++)
{
CommonTypes.Partition part = new CommonTypes.Partition();
byte bsd_type;
@@ -164,11 +164,11 @@ namespace DiscImageChef.PartPlugins
part.PartitionType = String.Format("BSD: {0}", bsd_type);
part.PartitionName = decodeBSDType(bsd_type);
part.PartitionSequence = counter;
part.PartitionDescription = "Partition inside a BSD disklabel.";
if (bsd_type != 0)
if(bsd_type != 0)
{
partitions.Add(part);
counter++;
@@ -185,7 +185,7 @@ namespace DiscImageChef.PartPlugins
byte[] unix_dl_sector = imagePlugin.ReadSector(entry.lba_start + 29); // UNIX disklabel starts on sector 29 of partition
magic = BitConverter.ToUInt32(unix_dl_sector, 4);
if (magic == UNIXDiskLabel_MAGIC)
if(magic == UNIXDiskLabel_MAGIC)
{
UNIXDiskLabel dl = new UNIXDiskLabel();
UNIXVTOC vtoc = new UNIXVTOC(); // old/new
@@ -193,7 +193,7 @@ namespace DiscImageChef.PartPlugins
int vtocoffset = 0;
vtoc.magic = BitConverter.ToUInt32(unix_dl_sector, 172);
if (vtoc.magic == UNIXVTOC_MAGIC)
if(vtoc.magic == UNIXVTOC_MAGIC)
{
isNewDL = true;
vtocoffset = 72;
@@ -201,7 +201,7 @@ namespace DiscImageChef.PartPlugins
else
{
vtoc.magic = BitConverter.ToUInt32(unix_dl_sector, 172);
if (vtoc.magic != UNIXDiskLabel_MAGIC)
if(vtoc.magic != UNIXDiskLabel_MAGIC)
{
valid = true;
break;
@@ -220,8 +220,8 @@ namespace DiscImageChef.PartPlugins
//dl.unknown1 = br.ReadBytes(48); // 44
dl.alt_tbl = BitConverter.ToUInt32(unix_dl_sector, 92); // 92
dl.alt_len = BitConverter.ToUInt32(unix_dl_sector, 96); // 96
if (isNewDL) // Old version VTOC starts here
if(isNewDL) // Old version VTOC starts here
{
dl.phys_cyl = BitConverter.ToUInt32(unix_dl_sector, 100); // 100
dl.phys_trk = BitConverter.ToUInt32(unix_dl_sector, 104); // 104
@@ -231,8 +231,8 @@ namespace DiscImageChef.PartPlugins
dl.unknown3 = BitConverter.ToUInt32(unix_dl_sector, 120); // 120
//dl.pad = br.ReadBytes(48); // 124
}
if (vtoc.magic == UNIXVTOC_MAGIC)
if(vtoc.magic == UNIXVTOC_MAGIC)
{
vtoc.version = BitConverter.ToUInt32(unix_dl_sector, 104 + vtocoffset); // 104/176
byte[] vtoc_name = new byte[8];
@@ -240,10 +240,10 @@ namespace DiscImageChef.PartPlugins
vtoc.name = StringHandlers.CToString(vtoc_name); // 108/180
vtoc.slices = BitConverter.ToUInt16(unix_dl_sector, 116 + vtocoffset); // 116/188
vtoc.unknown = BitConverter.ToUInt16(unix_dl_sector, 118 + vtocoffset); // 118/190
//vtoc.reserved = br.ReadBytes(40); // 120/192
//vtoc.reserved = br.ReadBytes(40); // 120/192
// TODO: What if number of slices overlaps sector (>23)?
for (int j = 0; j < vtoc.slices; j++)
for(int j = 0; j < vtoc.slices; j++)
{
UNIXVTOCEntry vtoc_ent = new UNIXVTOCEntry();
@@ -252,7 +252,7 @@ namespace DiscImageChef.PartPlugins
vtoc_ent.start = BitConverter.ToUInt32(unix_dl_sector, 160 + vtocoffset + j * 12 + 6); // 166/238 + j*12
vtoc_ent.length = BitConverter.ToUInt32(unix_dl_sector, 160 + vtocoffset + j * 12 + 10); // 170/242 + j*12
if ((vtoc_ent.flags & 0x200) == 0x200 && vtoc_ent.tag != UNIX_TAG_EMPTY && vtoc_ent.tag != UNIX_TAG_WHOLE)
if((vtoc_ent.flags & 0x200) == 0x200 && vtoc_ent.tag != UNIX_TAG_EMPTY && vtoc_ent.tag != UNIX_TAG_WHOLE)
{
CommonTypes.Partition part = new CommonTypes.Partition();
// TODO: Check if device bps == disklabel bps
@@ -265,13 +265,13 @@ namespace DiscImageChef.PartPlugins
string info = "";
if ((vtoc_ent.flags & 0x01) == 0x01)
if((vtoc_ent.flags & 0x01) == 0x01)
info += " (do not mount)";
if ((vtoc_ent.flags & 0x10) == 0x10)
if((vtoc_ent.flags & 0x10) == 0x10)
info += " (do not mount)";
part.PartitionDescription = "UNIX slice" + info + ".";
partitions.Add(part);
counter++;
}
@@ -288,9 +288,9 @@ namespace DiscImageChef.PartPlugins
UInt32 magic = BitConverter.ToUInt32(disklabel_sector, 12); // 12
UInt32 version = BitConverter.ToUInt32(disklabel_sector, 16); // 16
if (magic == 0x600DDEEE && version == 1)
if(magic == 0x600DDEEE && version == 1)
{
for (int j = 0; j < 16; j++)
for(int j = 0; j < 16; j++)
{
CommonTypes.Partition part = new CommonTypes.Partition();
part.PartitionStartSector = BitConverter.ToUInt32(disklabel_sector, 68 + j * 12 + 4);
@@ -298,10 +298,10 @@ namespace DiscImageChef.PartPlugins
part.PartitionStart = part.PartitionStartSector * imagePlugin.GetSectorSize(); // 68+4+j*12
part.PartitionLength = part.PartitionSectors * imagePlugin.GetSectorSize(); // 68+8+j*12
part.PartitionDescription = "Solaris slice.";
part.PartitionSequence = counter;
if (part.PartitionLength > 0)
if(part.PartitionLength > 0)
{
partitions.Add(part);
counter++;
@@ -316,12 +316,12 @@ namespace DiscImageChef.PartPlugins
{
bool minix_subs = false;
byte type;
for (int j = 0; j < 4; j++)
for(int j = 0; j < 4; j++)
{
type = disklabel_sector[0x1BE + j * 16 + 4];
if (type == 0x81)
if(type == 0x81)
{
CommonTypes.Partition part = new CommonTypes.Partition();
minix_subs = true;
@@ -337,7 +337,7 @@ namespace DiscImageChef.PartPlugins
}
}
valid |= !minix_subs;
break;
}
default:
@@ -345,41 +345,41 @@ namespace DiscImageChef.PartPlugins
break;
}
}
if (valid)
if(valid)
{
CommonTypes.Partition part = new CommonTypes.Partition();
if (entry.lba_start > 0 && entry.lba_sectors > 0)
if(entry.lba_start > 0 && entry.lba_sectors > 0)
{
part.PartitionStartSector = entry.lba_start;
part.PartitionSectors = entry.lba_sectors;
part.PartitionStart = part.PartitionStartSector * imagePlugin.GetSectorSize();
part.PartitionLength = part.PartitionSectors * imagePlugin.GetSectorSize();
}
/* else if(entry.start_head < 255 && entry.end_head < 255 &&
entry.start_sector > 0 && entry.start_sector < 64 &&
entry.end_sector > 0 && entry.end_sector < 64 &&
entry.start_cylinder < 1024 && entry.end_cylinder < 1024)
{
} */ // As we don't know the maxium cyl, head or sect of the device we need LBA
else
/* else if(entry.start_head < 255 && entry.end_head < 255 &&
entry.start_sector > 0 && entry.start_sector < 64 &&
entry.end_sector > 0 && entry.end_sector < 64 &&
entry.start_cylinder < 1024 && entry.end_cylinder < 1024)
{
} */ // As we don't know the maxium cyl, head or sect of the device we need LBA
else
valid = false;
if (valid)
if(valid)
{
part.PartitionType = String.Format("0x{0:X2}", entry.type);
part.PartitionName = decodeMBRType(entry.type);
part.PartitionSequence = counter;
part.PartitionDescription = entry.status == 0x80 ? "Partition is bootable." : "";
counter++;
partitions.Add(part);
}
}
if (extended) // Let's extend the fun
if(extended) // Let's extend the fun
{
bool ext_valid = true;
bool ext_disklabel = false;
@@ -387,46 +387,46 @@ namespace DiscImageChef.PartPlugins
sector = imagePlugin.ReadSector(entry.lba_start);
while (processing_extended)
while(processing_extended)
{
for (int l = 0; l < 2; l++)
for(int l = 0; l < 2; l++)
{
bool ext_extended = false;
MBRPartitionEntry entry2 = new MBRPartitionEntry();
entry2.status = sector[0x1BE + 16 * i + 0x00];
entry2.start_head = sector[0x1BE + 16 * i + 0x01];
cyl_sect1 = sector[0x1BE + 16 * i + 0x02];
cyl_sect2 = sector[0x1BE + 16 * i + 0x03];
entry2.start_sector = (byte)(cyl_sect1 & 0x3F);
entry2.start_cylinder = (ushort)(((cyl_sect1 & 0xC0) << 2) | cyl_sect2);
entry2.type = sector[0x1BE + 16 * i + 0x04];
entry2.end_head = sector[0x1BE + 16 * i + 0x05];
cyl_sect1 = sector[0x1BE + 16 * i + 0x06];
cyl_sect2 = sector[0x1BE + 16 * i + 0x07];
entry2.end_sector = (byte)(cyl_sect1 & 0x3F);
entry2.end_cylinder = (ushort)(((cyl_sect1 & 0xC0) << 2) | cyl_sect2);
entry2.lba_start = BitConverter.ToUInt32(sector, 0x1BE + 16 * i + 0x08);
entry2.lba_sectors = BitConverter.ToUInt32(sector, 0x1BE + 16 * i + 0x0C);
// Let's start the fun...
ext_valid &= entry2.status == 0x00 || entry2.status == 0x80;
valid &= entry2.type != 0x00;
if (entry2.type == 0x82 || entry2.type == 0xBF || entry2.type == 0xA5 || entry2.type == 0xA6 ||
if(entry2.type == 0x82 || entry2.type == 0xBF || entry2.type == 0xA5 || entry2.type == 0xA6 ||
entry2.type == 0xA9 || entry2.type == 0xB7 || entry2.type == 0x81 || entry2.type == 0x63)
{
ext_valid = false;
ext_disklabel = true;
}
if (entry2.type == 0x05 || entry2.type == 0x0F || entry2.type == 0x85)
if(entry2.type == 0x05 || entry2.type == 0x0F || entry2.type == 0x85)
{
ext_valid = false;
ext_disklabel = false;
@@ -434,12 +434,12 @@ namespace DiscImageChef.PartPlugins
}
else
processing_extended &= l != 1;
if (ext_disklabel)
if(ext_disklabel)
{
byte[] disklabel_sector = imagePlugin.ReadSector(entry2.lba_start);
switch (entry2.type)
switch(entry2.type)
{
case 0xA5:
case 0xA6:
@@ -447,30 +447,30 @@ namespace DiscImageChef.PartPlugins
case 0xB7: // BSD disklabels
{
UInt32 magic = BitConverter.ToUInt32(disklabel_sector, 0);
if (magic == 0x82564557)
if(magic == 0x82564557)
{
UInt16 no_parts = BitConverter.ToUInt16(disklabel_sector, 126);
// TODO: Handle disklabels bigger than 1 sector or search max no_parts
for (int j = 0; j < no_parts; j++)
for(int j = 0; j < no_parts; j++)
{
CommonTypes.Partition part = new CommonTypes.Partition();
byte bsd_type;
part.PartitionSectors = BitConverter.ToUInt32(disklabel_sector, 134 + j * 16 + 4);
part.PartitionStartSector = BitConverter.ToUInt32(disklabel_sector, 134 + j * 16 + 0);
part.PartitionLength = part.PartitionSectors * imagePlugin.GetSectorSize();
part.PartitionStart = part.PartitionStartSector * imagePlugin.GetSectorSize();
bsd_type = disklabel_sector[134 + j * 16 + 8];
part.PartitionType = String.Format("BSD: {0}", bsd_type);
part.PartitionName = decodeBSDType(bsd_type);
part.PartitionSequence = counter;
part.PartitionDescription = "Partition inside a BSD disklabel.";
if (bsd_type != 0)
if(bsd_type != 0)
{
partitions.Add(part);
counter++;
@@ -487,7 +487,7 @@ namespace DiscImageChef.PartPlugins
byte[] unix_dl_sector = imagePlugin.ReadSector(entry.lba_start + 29); // UNIX disklabel starts on sector 29 of partition
magic = BitConverter.ToUInt32(unix_dl_sector, 4);
if (magic == UNIXDiskLabel_MAGIC)
if(magic == UNIXDiskLabel_MAGIC)
{
UNIXDiskLabel dl = new UNIXDiskLabel();
UNIXVTOC vtoc = new UNIXVTOC(); // old/new
@@ -495,7 +495,7 @@ namespace DiscImageChef.PartPlugins
int vtocoffset = 0;
vtoc.magic = BitConverter.ToUInt32(unix_dl_sector, 172);
if (vtoc.magic == UNIXVTOC_MAGIC)
if(vtoc.magic == UNIXVTOC_MAGIC)
{
isNewDL = true;
vtocoffset = 72;
@@ -503,7 +503,7 @@ namespace DiscImageChef.PartPlugins
else
{
vtoc.magic = BitConverter.ToUInt32(unix_dl_sector, 172);
if (vtoc.magic != UNIXDiskLabel_MAGIC)
if(vtoc.magic != UNIXDiskLabel_MAGIC)
{
valid = true;
break;
@@ -523,7 +523,7 @@ namespace DiscImageChef.PartPlugins
dl.alt_tbl = BitConverter.ToUInt32(unix_dl_sector, 92); // 92
dl.alt_len = BitConverter.ToUInt32(unix_dl_sector, 96); // 96
if (isNewDL) // Old version VTOC starts here
if(isNewDL) // Old version VTOC starts here
{
dl.phys_cyl = BitConverter.ToUInt32(unix_dl_sector, 100); // 100
dl.phys_trk = BitConverter.ToUInt32(unix_dl_sector, 104); // 104
@@ -534,7 +534,7 @@ namespace DiscImageChef.PartPlugins
//dl.pad = br.ReadBytes(48); // 124
}
if (vtoc.magic == UNIXVTOC_MAGIC)
if(vtoc.magic == UNIXVTOC_MAGIC)
{
vtoc.version = BitConverter.ToUInt32(unix_dl_sector, 104 + vtocoffset); // 104/176
byte[] vtoc_name = new byte[8];
@@ -545,7 +545,7 @@ namespace DiscImageChef.PartPlugins
//vtoc.reserved = br.ReadBytes(40); // 120/192
// TODO: What if number of slices overlaps sector (>23)?
for (int j = 0; j < vtoc.slices; j++)
for(int j = 0; j < vtoc.slices; j++)
{
UNIXVTOCEntry vtoc_ent = new UNIXVTOCEntry();
@@ -554,7 +554,7 @@ namespace DiscImageChef.PartPlugins
vtoc_ent.start = BitConverter.ToUInt32(unix_dl_sector, 160 + vtocoffset + j * 12 + 6); // 166/238 + j*12
vtoc_ent.length = BitConverter.ToUInt32(unix_dl_sector, 160 + vtocoffset + j * 12 + 10); // 170/242 + j*12
if ((vtoc_ent.flags & 0x200) == 0x200 && vtoc_ent.tag != UNIX_TAG_EMPTY && vtoc_ent.tag != UNIX_TAG_WHOLE)
if((vtoc_ent.flags & 0x200) == 0x200 && vtoc_ent.tag != UNIX_TAG_EMPTY && vtoc_ent.tag != UNIX_TAG_WHOLE)
{
CommonTypes.Partition part = new CommonTypes.Partition();
// TODO: Check if device bps == disklabel bps
@@ -567,9 +567,9 @@ namespace DiscImageChef.PartPlugins
string info = "";
if ((vtoc_ent.flags & 0x01) == 0x01)
if((vtoc_ent.flags & 0x01) == 0x01)
info += " (do not mount)";
if ((vtoc_ent.flags & 0x10) == 0x10)
if((vtoc_ent.flags & 0x10) == 0x10)
info += " (do not mount)";
part.PartitionDescription = "UNIX slice" + info + ".";
@@ -590,9 +590,9 @@ namespace DiscImageChef.PartPlugins
UInt32 magic = BitConverter.ToUInt32(disklabel_sector, 12); // 12
UInt32 version = BitConverter.ToUInt32(disklabel_sector, 16); // 16
if (magic == 0x600DDEEE && version == 1)
if(magic == 0x600DDEEE && version == 1)
{
for (int j = 0; j < 16; j++)
for(int j = 0; j < 16; j++)
{
CommonTypes.Partition part = new CommonTypes.Partition();
part.PartitionStartSector = BitConverter.ToUInt32(disklabel_sector, 68 + j * 12 + 4);
@@ -603,7 +603,7 @@ namespace DiscImageChef.PartPlugins
part.PartitionSequence = counter;
if (part.PartitionLength > 0)
if(part.PartitionLength > 0)
{
partitions.Add(part);
counter++;
@@ -619,11 +619,11 @@ namespace DiscImageChef.PartPlugins
bool minix_subs = false;
byte type;
for (int j = 0; j < 4; j++)
for(int j = 0; j < 4; j++)
{
type = disklabel_sector[0x1BE + j * 16 + 4];
if (type == 0x81)
if(type == 0x81)
{
CommonTypes.Partition part = new CommonTypes.Partition();
minix_subs = true;
@@ -639,50 +639,50 @@ namespace DiscImageChef.PartPlugins
}
}
ext_valid |= !minix_subs;
break;
}
default:
ext_valid = true;
break;
}
}
if (ext_valid)
if(ext_valid)
{
CommonTypes.Partition part = new CommonTypes.Partition();
if (entry2.lba_start > 0 && entry2.lba_sectors > 0)
if(entry2.lba_start > 0 && entry2.lba_sectors > 0)
{
part.PartitionStartSector = entry2.lba_start;
part.PartitionSectors = entry2.lba_sectors;
part.PartitionStart = part.PartitionStartSector * imagePlugin.GetSectorSize();
part.PartitionLength = part.PartitionSectors * imagePlugin.GetSectorSize();
}
/* else if(entry2.start_head < 255 && entry2.end_head < 255 &&
entry2.start_sector > 0 && entry2.start_sector < 64 &&
entry2.end_sector > 0 && entry2.end_sector < 64 &&
entry2.start_cylinder < 1024 && entry2.end_cylinder < 1024)
{
} */ // As we don't know the maxium cyl, head or sect of the device we need LBA
else
/* else if(entry2.start_head < 255 && entry2.end_head < 255 &&
entry2.start_sector > 0 && entry2.start_sector < 64 &&
entry2.end_sector > 0 && entry2.end_sector < 64 &&
entry2.start_cylinder < 1024 && entry2.end_cylinder < 1024)
{
} */ // As we don't know the maxium cyl, head or sect of the device we need LBA
else
ext_valid = false;
if (ext_valid)
if(ext_valid)
{
part.PartitionType = String.Format("0x{0:X2}", entry2.type);
part.PartitionName = decodeMBRType(entry2.type);
part.PartitionSequence = counter;
part.PartitionDescription = entry2.status == 0x80 ? "Partition is bootable." : "";
counter++;
partitions.Add(part);
}
}
if (ext_extended)
if(ext_extended)
{
break;
}
@@ -690,7 +690,7 @@ namespace DiscImageChef.PartPlugins
}
}
}
// An empty MBR may exist, NeXT creates one and then hardcodes its disklabel
return partitions.Count != 0;
}
@@ -702,7 +702,7 @@ namespace DiscImageChef.PartPlugins
static string decodeBSDType(byte type)
{
switch (type)
switch(type)
{
case 1:
return "Swap";
@@ -739,7 +739,7 @@ namespace DiscImageChef.PartPlugins
static string decodeMBRType(byte type)
{
switch (type)
switch(type)
{
case 0x01:
return "FAT12";
@@ -1198,7 +1198,7 @@ namespace DiscImageChef.PartPlugins
// volume mgt private partition
static string decodeUNIXTAG(UInt16 type, bool isNew)
{
switch (type)
switch(type)
{
case UNIX_TAG_EMPTY:
return "Unused";

View File

@@ -67,50 +67,50 @@ namespace DiscImageChef.PartPlugins
byte[] cString;
bool magic_found;
byte[] entry_sector;
UInt32 magic;
UInt32 sector_size;
UInt16 front_porch;
if (imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448)
if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448)
sector_size = 2048;
else
sector_size = imagePlugin.GetSectorSize();
partitions = new List<CommonTypes.Partition>();
entry_sector = imagePlugin.ReadSector(0); // Starts on sector 0 on NeXT machines, CDs and floppies
magic = BigEndianBitConverter.ToUInt32(entry_sector, 0x00);
if (magic == NEXT_MAGIC1 || magic == NEXT_MAGIC2 || magic == NEXT_MAGIC3)
if(magic == NEXT_MAGIC1 || magic == NEXT_MAGIC2 || magic == NEXT_MAGIC3)
magic_found = true;
else
{
entry_sector = imagePlugin.ReadSector(15); // Starts on sector 15 on MBR machines
magic = BigEndianBitConverter.ToUInt32(entry_sector, 0x00);
if (magic == NEXT_MAGIC1 || magic == NEXT_MAGIC2 || magic == NEXT_MAGIC3)
if(magic == NEXT_MAGIC1 || magic == NEXT_MAGIC2 || magic == NEXT_MAGIC3)
magic_found = true;
else
{
if (sector_size == 2048)
if(sector_size == 2048)
entry_sector = imagePlugin.ReadSector(4); // Starts on sector 4 on RISC CDs
else
entry_sector = imagePlugin.ReadSector(16); // Starts on sector 16 on RISC disks
magic = BigEndianBitConverter.ToUInt32(entry_sector, 0x00);
if (magic == NEXT_MAGIC1 || magic == NEXT_MAGIC2 || magic == NEXT_MAGIC3)
if(magic == NEXT_MAGIC1 || magic == NEXT_MAGIC2 || magic == NEXT_MAGIC3)
magic_found = true;
else
return false;
}
}
front_porch = BigEndianBitConverter.ToUInt16(entry_sector, 0x6A);
if (magic_found)
if(magic_found)
{
for (int i = 0; i < 8; i++)
for(int i = 0; i < 8; i++)
{
NeXTEntry entry = new NeXTEntry();
@@ -131,11 +131,11 @@ namespace DiscImageChef.PartPlugins
Array.Copy(entry_sector, disktabStart + disktabEntrySize * i + 0x24, cString, 0, 8);
entry.type = StringHandlers.CToString(cString);
if (entry.sectors > 0 && entry.sectors < 0xFFFFFFFF && entry.start < 0xFFFFFFFF)
if(entry.sectors > 0 && entry.sectors < 0xFFFFFFFF && entry.start < 0xFFFFFFFF)
{
CommonTypes.Partition part = new CommonTypes.Partition();
StringBuilder sb = new StringBuilder();
part.PartitionLength = (ulong)entry.sectors * sector_size;
part.PartitionStart = ((ulong)entry.start + front_porch) * sector_size;
part.PartitionType = entry.type;
@@ -143,29 +143,29 @@ namespace DiscImageChef.PartPlugins
part.PartitionName = entry.mount_point;
part.PartitionSectors = (ulong)entry.sectors;
part.PartitionStartSector = ((ulong)entry.start + front_porch);
sb.AppendFormat("{0} bytes per block", entry.block_size).AppendLine();
sb.AppendFormat("{0} bytes per fragment", entry.frag_size).AppendLine();
if (entry.optimization == 's')
if(entry.optimization == 's')
sb.AppendLine("Space optimized");
else if (entry.optimization == 't')
else if(entry.optimization == 't')
sb.AppendLine("Time optimized");
else
sb.AppendFormat("Unknown optimization {0:X2}", entry.optimization).AppendLine();
sb.AppendFormat("{0} cylinders per group", entry.cpg).AppendLine();
sb.AppendFormat("{0} bytes per inode", entry.bpi).AppendLine();
sb.AppendFormat("{0}% of space must be free at minimum", entry.freemin).AppendLine();
if (entry.newfs != 1) // Seems to indicate newfs has been already run
sb.AppendLine("Filesystem should be formatted at start");
if (entry.automount == 1)
if(entry.newfs != 1) // Seems to indicate newfs has been already run
sb.AppendLine("Filesystem should be formatted at start");
if(entry.automount == 1)
sb.AppendLine("Filesystem should be automatically mounted");
part.PartitionDescription = sb.ToString();
partitions.Add(part);
}
}
return true;
}
return false;

View File

@@ -897,9 +897,9 @@ namespace DiscImageChef.PartPlugins
ulong RDBBlock = 0;
bool foundRDB = false;
while (RDBBlock < 16 && !foundRDB)
while(RDBBlock < 16 && !foundRDB)
{
if (imagePlugin.GetSectors() <= RDBBlock)
if(imagePlugin.GetSectors() <= RDBBlock)
return false;
byte[] tmpSector = imagePlugin.ReadSector(RDBBlock);
@@ -907,18 +907,18 @@ namespace DiscImageChef.PartPlugins
DicConsole.DebugWriteLine("Amiga RDB plugin", "Possible magic at block {0} is 0x{1:X8}", RDBBlock, magic);
if (magic == RigidDiskBlockMagic)
if(magic == RigidDiskBlockMagic)
{
DicConsole.DebugWriteLine("Amiga RDB plugin", "Found RDB magic at block {0}", RDBBlock);
foundRDB = true;
break;
}
RDBBlock++;
}
if (!foundRDB)
if(!foundRDB)
return false;
byte[] sector;
@@ -1061,14 +1061,14 @@ namespace DiscImageChef.PartPlugins
// Reading BadBlock list
List<BadBlockList> BadBlockChain = new List<BadBlockList>();
nextBlock = RDB.badblock_ptr;
while (nextBlock != 0xFFFFFFFF)
while(nextBlock != 0xFFFFFFFF)
{
DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a BadBlock block", nextBlock);
sector = imagePlugin.ReadSector(nextBlock);
UInt32 magic = BigEndianBitConverter.ToUInt32(sector, 0);
if (magic != BadBlockListMagic)
if(magic != BadBlockListMagic)
break;
DicConsole.DebugWriteLine("Amiga RDB plugin", "Found BadBlock block");
@@ -1091,7 +1091,7 @@ namespace DiscImageChef.PartPlugins
DicConsole.DebugWriteLine("Amiga RDB plugin", "chainEntry.next_ptr = {0}", chainEntry.next_ptr);
DicConsole.DebugWriteLine("Amiga RDB plugin", "chainEntry.reserved = 0x{0:X8}", chainEntry.reserved);
for (ulong i = 0; i < entries; i++)
for(ulong i = 0; i < entries; i++)
{
chainEntry.blockPairs[i].badBlock = BigEndianBitConverter.ToUInt32(sector, (int)(0x18 + i * 8 + 0));
chainEntry.blockPairs[i].goodBlock = BigEndianBitConverter.ToUInt32(sector, (int)(0x18 + i * 8 + 4));
@@ -1107,14 +1107,14 @@ namespace DiscImageChef.PartPlugins
// Reading BadBlock list
List<PartitionEntry> PartitionEntries = new List<PartitionEntry>();
nextBlock = RDB.partition_ptr;
while (nextBlock != 0xFFFFFFFF)
while(nextBlock != 0xFFFFFFFF)
{
DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a PartitionEntry block", nextBlock);
sector = imagePlugin.ReadSector(nextBlock);
UInt32 magic = BigEndianBitConverter.ToUInt32(sector, 0);
if (magic != PartitionBlockMagic)
if(magic != PartitionBlockMagic)
break;
DicConsole.DebugWriteLine("Amiga RDB plugin", "Found PartitionEntry block");
@@ -1227,14 +1227,14 @@ namespace DiscImageChef.PartPlugins
List<FileSystemHeader> FSHDEntries = new List<FileSystemHeader>();
List<LoadSegment> SegmentEntries = new List<LoadSegment>();
nextBlock = RDB.fsheader_ptr;
while (nextBlock != 0xFFFFFFFF)
while(nextBlock != 0xFFFFFFFF)
{
DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a FileSystemHeader block", nextBlock);
sector = imagePlugin.ReadSector(nextBlock);
UInt32 magic = BigEndianBitConverter.ToUInt32(sector, 0);
if (magic != FilesystemHeaderMagic)
if(magic != FilesystemHeaderMagic)
break;
DicConsole.DebugWriteLine("Amiga RDB plugin", "Found FileSystemHeader block");
@@ -1290,14 +1290,14 @@ namespace DiscImageChef.PartPlugins
bool thereAreLoadSegments = false;
Checksums.SHA1Context sha1Ctx = new Checksums.SHA1Context();
sha1Ctx.Init();
while (nextBlock != 0xFFFFFFFF)
while(nextBlock != 0xFFFFFFFF)
{
DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a LoadSegment block", nextBlock);
sector = imagePlugin.ReadSector(nextBlock);
UInt32 magicSeg = BigEndianBitConverter.ToUInt32(sector, 0);
if (magicSeg != LoadSegMagic)
if(magicSeg != LoadSegMagic)
break;
DicConsole.DebugWriteLine("Amiga RDB plugin", "Found LoadSegment block");
@@ -1323,7 +1323,7 @@ namespace DiscImageChef.PartPlugins
sha1Ctx.Update(loadSeg.loadData);
}
if (thereAreLoadSegments)
if(thereAreLoadSegments)
{
string loadSegSHA1 = sha1Ctx.End();
DicConsole.DebugWriteLine("Amiga RDB plugin", "LoadSegment data SHA1: {0}", loadSegSHA1);
@@ -1334,7 +1334,7 @@ namespace DiscImageChef.PartPlugins
}
ulong sequence = 0;
foreach (PartitionEntry RDBEntry in PartitionEntries)
foreach(PartitionEntry RDBEntry in PartitionEntries)
{
CommonTypes.Partition entry = new CommonTypes.Partition();
@@ -1356,7 +1356,7 @@ namespace DiscImageChef.PartPlugins
static string AmigaDOSTypeToDescriptionString(UInt32 AmigaDOSType)
{
switch (AmigaDOSType)
switch(AmigaDOSType)
{
case TypeIDOFS:
@@ -1443,35 +1443,35 @@ namespace DiscImageChef.PartPlugins
default:
{
if ((AmigaDOSType & TypeIDOFS) == TypeIDOFS)
if((AmigaDOSType & TypeIDOFS) == TypeIDOFS)
return String.Format("Unknown Amiga DOS filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType));
if ((AmigaDOSType & TypeIDAMIXSysV) == TypeIDAMIXSysV)
if((AmigaDOSType & TypeIDAMIXSysV) == TypeIDAMIXSysV)
return String.Format("Unknown Amiga UNIX filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType));
if ((AmigaDOSType & 0x50465300) == 0x50465300 ||
if((AmigaDOSType & 0x50465300) == 0x50465300 ||
(AmigaDOSType & 0x41465300) == 0x41465300)
return String.Format("Unknown ProfessionalFileSystem type {0}", AmigaDOSTypeToString(AmigaDOSType));
if ((AmigaDOSType & TypeIDSFS) == TypeIDSFS)
if((AmigaDOSType & TypeIDSFS) == TypeIDSFS)
return String.Format("Unknown SmartFileSystem type {0}", AmigaDOSTypeToString(AmigaDOSType));
if ((AmigaDOSType & TypeIDmuOFS) == TypeIDmuOFS)
if((AmigaDOSType & TypeIDmuOFS) == TypeIDmuOFS)
return String.Format("Unknown Amiga DOS multi-user filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType));
if ((AmigaDOSType & TypeIDOldBSDUnused) == TypeIDOldBSDUnused)
if((AmigaDOSType & TypeIDOldBSDUnused) == TypeIDOldBSDUnused)
return String.Format("Unknown BSD filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType));
if ((AmigaDOSType & TypeIDNetBSDRootUnused) == TypeIDNetBSDRootUnused)
if((AmigaDOSType & TypeIDNetBSDRootUnused) == TypeIDNetBSDRootUnused)
return String.Format("Unknown NetBSD root filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType));
if ((AmigaDOSType & TypeIDNetBSDUserUnused) == TypeIDNetBSDUserUnused)
if((AmigaDOSType & TypeIDNetBSDUserUnused) == TypeIDNetBSDUserUnused)
return String.Format("Unknown NetBSD user filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType));
if ((AmigaDOSType & TypeIDNetBSDSwap) == TypeIDNetBSDSwap)
if((AmigaDOSType & TypeIDNetBSDSwap) == TypeIDNetBSDSwap)
return String.Format("Unknown NetBSD swap filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType));
if ((AmigaDOSType & TypeIDLinux) == TypeIDLinux ||
if((AmigaDOSType & TypeIDLinux) == TypeIDLinux ||
(AmigaDOSType & TypeIDLinuxSwap) == TypeIDLinuxSwap)
return String.Format("Unknown Linux filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType));

View File

@@ -102,18 +102,18 @@ namespace DiscImageChef.PartPlugins
Array.Copy(sunSector, 0x80 + 0x04, tmpString, 0, 8);
sdl.vtoc.volname = StringHandlers.CToString(tmpString);
sdl.vtoc.nparts = BigEndianBitConverter.ToUInt16(sunSector, 0x80 + 0x0C);
for (int i = 0; i < 8; i++)
for(int i = 0; i < 8; i++)
{
sdl.vtoc.infos[i] = new SunInfo();
sdl.vtoc.infos[i].id = BigEndianBitConverter.ToUInt16(sunSector, 0x80 + 0x0E + i * 4 + 0x00);
sdl.vtoc.infos[i].flags = BigEndianBitConverter.ToUInt16(sunSector, 0x80 + 0x0E + i * 4 + 0x02);
}
sdl.vtoc.padding = BigEndianBitConverter.ToUInt16(sunSector, 0x80 + 0x2E);
for (int i = 0; i < 3; i++)
for(int i = 0; i < 3; i++)
sdl.vtoc.bootinfo[i] = BigEndianBitConverter.ToUInt32(sunSector, 0x80 + 0x30 + i * 4);
sdl.vtoc.sanity = BigEndianBitConverter.ToUInt32(sunSector, 0x80 + 0x3C);
Array.Copy(sunSector, 0x80 + 0x40, sdl.vtoc.reserved, 0, 40);
for (int i = 0; i < 8; i++)
for(int i = 0; i < 8; i++)
sdl.vtoc.timestamp[i] = BigEndianBitConverter.ToUInt32(sunSector, 0x80 + 0x68 + i * 4);
sdl.write_reinstruct = BigEndianBitConverter.ToUInt32(sunSector, 0x108);
@@ -132,7 +132,7 @@ namespace DiscImageChef.PartPlugins
sdl.bhead = BigEndianBitConverter.ToUInt16(sunSector, 0x1B8);
sdl.ppart = BigEndianBitConverter.ToUInt16(sunSector, 0x1BA);
for (int i = 0; i < 8; i++)
for(int i = 0; i < 8; i++)
{
sdl.partitions[i] = new SunPartition();
sdl.partitions[i].start_cylinder = BigEndianBitConverter.ToUInt32(sunSector, 0x1BC + i * 8 + 0x00);
@@ -143,23 +143,23 @@ namespace DiscImageChef.PartPlugins
sdl.csum = BigEndianBitConverter.ToUInt16(sunSector, 0x1FE);
ushort csum = 0;
for (int i = 0; i < 510; i += 2)
for(int i = 0; i < 510; i += 2)
csum ^= BigEndianBitConverter.ToUInt16(sunSector, i);
DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.info = {0}", sdl.info);
DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.version = {0}", sdl.vtoc.version);
DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.volname = {0}", sdl.vtoc.volname);
DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.nparts = {0}", sdl.vtoc.nparts);
for (int i = 0; i < 8; i++)
for(int i = 0; i < 8; i++)
{
DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.infos[{1}].id = 0x{0:X4}", sdl.vtoc.infos[i].id, i);
DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.infos[{1}].flags = 0x{0:X4}", sdl.vtoc.infos[i].flags, i);
}
DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.padding = 0x{0:X4}", sdl.vtoc.padding);
for (int i = 0; i < 3; i++)
for(int i = 0; i < 3; i++)
DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.bootinfo[{1}].id = 0x{0:X8}", sdl.vtoc.bootinfo[i], i);
DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.sanity = 0x{0:X8}", sdl.vtoc.sanity);
for (int i = 0; i < 8; i++)
for(int i = 0; i < 8; i++)
DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.timestamp[{1}] = 0x{0:X8}", sdl.vtoc.timestamp[i], i);
DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.rspeed = {0}", sdl.rspeed);
DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.pcylcount = {0}", sdl.pcylcount);
@@ -173,7 +173,7 @@ namespace DiscImageChef.PartPlugins
DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.nsect = {0}", sdl.nsect);
DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.bhead = {0}", sdl.bhead);
DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.ppart = {0}", sdl.ppart);
for (int i = 0; i < 8; i++)
for(int i = 0; i < 8; i++)
{
DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.partitions[{1}].start_cylinder = {0}", sdl.partitions[i].start_cylinder, i);
DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.partitions[{1}].num_sectors = {0}", sdl.partitions[i].num_sectors, i);
@@ -184,12 +184,12 @@ namespace DiscImageChef.PartPlugins
ulong sectorsPerCylinder = (ulong)(sdl.nsect * sdl.ntrks);
if (sectorsPerCylinder == 0 || sectorsPerCylinder * sdl.pcylcount > imagePlugin.GetSectors() || sdl.magic != SUN_MAGIC)
if(sectorsPerCylinder == 0 || sectorsPerCylinder * sdl.pcylcount > imagePlugin.GetSectors() || sdl.magic != SUN_MAGIC)
return false;
for (int i = 0; i < 8; i++)
for(int i = 0; i < 8; i++)
{
if ((SunTypes)sdl.vtoc.infos[i].id != SunTypes.SunWholeDisk && sdl.partitions[i].num_sectors > 0)
if((SunTypes)sdl.vtoc.infos[i].id != SunTypes.SunWholeDisk && sdl.partitions[i].num_sectors > 0)
{
CommonTypes.Partition part = new CommonTypes.Partition();
part.PartitionDescription = SunFlagsToString((SunFlags)sdl.vtoc.infos[i].flags);
@@ -201,7 +201,7 @@ namespace DiscImageChef.PartPlugins
part.PartitionStartSector = sdl.partitions[i].start_cylinder * sectorsPerCylinder;
part.PartitionType = SunIdToString((SunTypes)sdl.vtoc.infos[i].id);
if (part.PartitionStartSector > imagePlugin.GetSectors() || (part.PartitionStartSector + part.PartitionSectors) > imagePlugin.GetSectors())
if(part.PartitionStartSector > imagePlugin.GetSectors() || (part.PartitionStartSector + part.PartitionSectors) > imagePlugin.GetSectors())
return false;
partitions.Add(part);
@@ -214,21 +214,21 @@ namespace DiscImageChef.PartPlugins
public static string SunFlagsToString(SunFlags flags)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
if (flags.HasFlag(SunFlags.NoMount))
if(flags.HasFlag(SunFlags.NoMount))
sb.AppendLine("Unmountable");
if (flags.HasFlag(SunFlags.ReadOnly))
if(flags.HasFlag(SunFlags.ReadOnly))
sb.AppendLine("Read-only");
return sb.ToString();
}
public static string SunIdToString(SunTypes id)
{
switch (id)
switch(id)
{
case SunTypes.Linux:
return "Linux";
case SunTypes.LinuxRaid:
return "Linux RAID";
return "Linux RAID";
case SunTypes.LinuxSwap:
return "Linux swap";
case SunTypes.LVM: