* FileSystemIDandChk/Main.cs:

partitionOffset should be the sector, not the byte

	* FileSystemIDandChk/PartPlugins/MBR.cs:
	  Corrected typos on field offsets

	* FileSystemIDandChk/Plugins/FAT.cs:
	* FileSystemIDandChk/Plugins/ISO9660.cs:
	  Corrected typo

	* FileSystemIDandChk/Plugins/ext2FS.cs:
	  Superblock block_size is shift of base block size (1024
	  bytes)
This commit is contained in:
2014-06-08 00:43:49 +01:00
parent a2f79a3295
commit 19d7d0b460
5 changed files with 25 additions and 26 deletions

View File

@@ -249,8 +249,8 @@ namespace FileSystemIDandChk
Console.WriteLine("Partition {0}:", partitions[i].PartitionSequence);
Console.WriteLine("Partition name: {0}", partitions[i].PartitionName);
Console.WriteLine("Partition type: {0}", partitions[i].PartitionType);
Console.WriteLine("Partition start: {0}", partitions[i].PartitionStart);
Console.WriteLine("Partition length: {0}", partitions[i].PartitionLength);
Console.WriteLine("Partition start: sector {0}, byte {1}", partitions[i].PartitionStartSector, partitions[i].PartitionStart);
Console.WriteLine("Partition length: {0} sectors, {1} bytes", partitions[i].PartitionSectors, partitions[i].PartitionLength);
Console.WriteLine("Partition description:");
Console.WriteLine(partitions[i].PartitionDescription);
@@ -258,7 +258,7 @@ namespace FileSystemIDandChk
{
Console.WriteLine("Identifying filesystem on partition");
Identify(_imageFormat, out id_plugins, partitions[i].PartitionStart);
Identify(_imageFormat, out id_plugins, partitions[i].PartitionStartSector);
if (id_plugins.Count == 0)
Console.WriteLine("Filesystem not identified");
else if (id_plugins.Count > 1)
@@ -270,7 +270,7 @@ namespace FileSystemIDandChk
if (plugins.PluginsList.TryGetValue(plugin_name, out _plugin))
{
Console.WriteLine(String.Format("As identified by {0}.", _plugin.Name));
_plugin.GetInformation(_imageFormat, partitions[i].PartitionStart, out information);
_plugin.GetInformation(_imageFormat, partitions[i].PartitionStartSector, out information);
Console.Write(information);
}
}
@@ -279,7 +279,7 @@ namespace FileSystemIDandChk
{
plugins.PluginsList.TryGetValue(id_plugins[0], out _plugin);
Console.WriteLine(String.Format("Identified by {0}.", _plugin.Name));
_plugin.GetInformation(_imageFormat, partitions[i].PartitionStart, out information);
_plugin.GetInformation(_imageFormat, partitions[i].PartitionStartSector, out information);
Console.Write(information);
}
}

View File

@@ -76,25 +76,25 @@ namespace FileSystemIDandChk.PartPlugins
MBRPartitionEntry entry = new MBRPartitionEntry();
entry.status = sector[0x1BE + 16 * i + 0x00];
entry.start_head = sector[0x1BE + 16 * i + 0x00];
entry.start_head = sector[0x1BE + 16 * i + 0x01];
cyl_sect1 = sector[0x1BE + 16 * i + 0x00];
cyl_sect2 = sector[0x1BE + 16 * i + 0x00];
cyl_sect1 = sector[0x1BE + 16 * i + 0x02];
cyl_sect2 = sector[0x1BE + 16 * i + 0x03];
entry.start_sector = (byte)(cyl_sect1 & 0x3F);
entry.start_cylinder = (ushort)(((cyl_sect1 & 0xC0) << 2) | cyl_sect2);
entry.type = sector[0x1BE + 16 * i + 0x00];
entry.end_head = sector[0x1BE + 16 * i + 0x00];
entry.type = sector[0x1BE + 16 * i + 0x04];
entry.end_head = sector[0x1BE + 16 * i + 0x05];
cyl_sect1 = sector[0x1BE + 16 * i + 0x00];
cyl_sect2 = sector[0x1BE + 16 * i + 0x00];
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 + 0x00);
entry.lba_sectors = BitConverter.ToUInt32(sector, 0x1BE + 16 * i + 0x00);
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...
@@ -396,25 +396,25 @@ namespace FileSystemIDandChk.PartPlugins
MBRPartitionEntry entry2 = new MBRPartitionEntry();
entry2.status = sector[0x1BE + 16 * i + 0x00];
entry2.start_head = sector[0x1BE + 16 * i + 0x00];
entry2.start_head = sector[0x1BE + 16 * i + 0x01];
cyl_sect1 = sector[0x1BE + 16 * i + 0x00];
cyl_sect2 = sector[0x1BE + 16 * i + 0x00];
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 + 0x00];
entry2.end_head = sector[0x1BE + 16 * i + 0x00];
entry2.type = sector[0x1BE + 16 * i + 0x04];
entry2.end_head = sector[0x1BE + 16 * i + 0x05];
cyl_sect1 = sector[0x1BE + 16 * i + 0x00];
cyl_sect2 = sector[0x1BE + 16 * i + 0x00];
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 + 0x00);
entry2.lba_sectors = BitConverter.ToUInt32(sector, 0x1BE + 16 * i + 0x00);
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...

View File

@@ -287,7 +287,7 @@ namespace FileSystemIDandChk.Plugins
sb.AppendFormat("{0} sectors per cluster.", BPB.spc).AppendLine();
sb.AppendFormat("{0} sectors reserved between BPB and FAT.", BPB.rsectors).AppendLine();
sb.AppendFormat("{0} FATs.", BPB.fats_no).AppendLine();
sb.AppendFormat("{0} entires on root directory.", BPB.root_ent).AppendLine();
sb.AppendFormat("{0} entries on root directory.", BPB.root_ent).AppendLine();
if (BPB.sectors == 0)
sb.AppendFormat("{0} sectors on volume ({1} bytes).", BPB.big_sectors, BPB.big_sectors * BPB.bps).AppendLine();
else

View File

@@ -45,7 +45,6 @@ using FileSystemIDandChk;
// TODO: Differentiate ISO Level 1, 2, 3 and ISO 9660:1999
// TODO: Apple extensiones, requires XA or advance RR interpretation.
// TODO: Needs a major rewrite
namespace FileSystemIDandChk.Plugins
{
class ISO9660Plugin : Plugin

View File

@@ -339,7 +339,7 @@ namespace FileSystemIDandChk.Plugins
if (supblk.block_size == 0) // Then it is 1024 bytes
supblk.block_size = 1024;
sb.AppendFormat("Volume has {0} blocks of {1} bytes, for a total of {2} bytes", blocks, supblk.block_size, blocks * supblk.block_size).AppendLine();
sb.AppendFormat("Volume has {0} blocks of {1} bytes, for a total of {2} bytes", blocks, 1024<<(int)supblk.block_size, blocks * (ulong)(1024<<(int)supblk.block_size)).AppendLine();
if (supblk.mount_t > 0 || supblk.mount_c > 0)
{
if (supblk.mount_t > 0)