* DiscImageChef.Filters/PCExchange.cs:

Removed debug messages.

	* DiscImageChef.Filesystems/FAT.cs:
	  Corrected syntax bug.

	* DiscImageChef.Filters/Filters.cs:
	  Corrected handling of "No filter".

	* DiscImageChef.Filesystems/AmigaDOS.cs:
	  Corrected detection of FFS on hard disks and FFS with block
	  sizes > sector size.
This commit is contained in:
2016-09-13 14:52:31 +01:00
parent 6b70265a5d
commit 59799daccf
4 changed files with 49 additions and 17 deletions

View File

@@ -200,9 +200,14 @@ namespace DiscImageChef.Filesystems
ulong root_ptr = BigEndianBitConverter.ToUInt32(sector, 0x08); ulong root_ptr = BigEndianBitConverter.ToUInt32(sector, 0x08);
DicConsole.DebugWriteLine("AmigaDOS plugin", "Bootblock points to {0} as Rootblock", root_ptr); DicConsole.DebugWriteLine("AmigaDOS plugin", "Bootblock points to {0} as Rootblock", root_ptr);
root_ptr = (partitionEnd - partitionStart) / 2 + partitionStart + 1; if(root_ptr == 0)
{
root_ptr = (partitionEnd - partitionStart) / 2 + partitionStart;
DicConsole.DebugWriteLine("AmigaDOS plugin", "Nonetheless, going to block {0} for Rootblock", root_ptr); DicConsole.DebugWriteLine("AmigaDOS plugin", "Nonetheless, going to block {0} for Rootblock", root_ptr);
}
else
root_ptr += partitionStart;
if(root_ptr >= partitionEnd) if(root_ptr >= partitionEnd)
return false; return false;
@@ -212,8 +217,15 @@ namespace DiscImageChef.Filesystems
uint type = BigEndianBitConverter.ToUInt32(sector, 0x00); uint type = BigEndianBitConverter.ToUInt32(sector, 0x00);
uint hashTableSize = BigEndianBitConverter.ToUInt32(sector, 0x0C); uint hashTableSize = BigEndianBitConverter.ToUInt32(sector, 0x0C);
if((0x18 + hashTableSize * 4 + 196) > sector.Length) uint blockSize = 0x18 + hashTableSize * 4 + 196;
return false; uint sectorsPerBlock = (uint)(blockSize / sector.Length);
if(blockSize % sector.Length > 0)
sectorsPerBlock++;
sector = imagePlugin.ReadSectors(root_ptr, sectorsPerBlock);
//if((0x18 + hashTableSize * 4 + 196) > sector.Length)
// return false;
uint sec_type = BigEndianBitConverter.ToUInt32(sector, (int)(0x18 + hashTableSize * 4 + 196)); uint sec_type = BigEndianBitConverter.ToUInt32(sector, (int)(0x18 + hashTableSize * 4 + 196));
@@ -225,7 +237,30 @@ namespace DiscImageChef.Filesystems
StringBuilder sbInformation = new StringBuilder(); StringBuilder sbInformation = new StringBuilder();
byte[] BootBlockSectors = imagePlugin.ReadSectors(0 + partitionStart, 2); byte[] BootBlockSectors = imagePlugin.ReadSectors(0 + partitionStart, 2);
byte[] RootBlockSector = imagePlugin.ReadSector((partitionEnd - partitionStart) / 2 + partitionStart + 1);
ulong root_ptr = BigEndianBitConverter.ToUInt32(BootBlockSectors, 0x08);
DicConsole.DebugWriteLine("AmigaDOS plugin", "Bootblock points to {0} as Rootblock", root_ptr);
if(root_ptr == 0)
{
root_ptr = (partitionEnd - partitionStart) / 2 + partitionStart;
DicConsole.DebugWriteLine("AmigaDOS plugin", "Nonetheless, going to block {0} for Rootblock", root_ptr);
}
else
root_ptr += partitionStart;
byte[] RootBlockSector = imagePlugin.ReadSector(root_ptr);
uint hashTableSize = BigEndianBitConverter.ToUInt32(RootBlockSector, 0x0C);
uint blockSize = 0x18 + hashTableSize * 4 + 196;
uint sectorsPerBlock = (uint)(blockSize / RootBlockSector.Length);
if(blockSize % RootBlockSector.Length > 0)
sectorsPerBlock++;
RootBlockSector = imagePlugin.ReadSectors(root_ptr, sectorsPerBlock);
byte[] diskName = new byte[32]; byte[] diskName = new byte[32];
BootBlock bootBlk = new BootBlock(); BootBlock bootBlk = new BootBlock();

View File

@@ -216,7 +216,7 @@ namespace DiscImageChef.Filesystems
if(fat32_signature == "FAT32 ") if(fat32_signature == "FAT32 ")
{ {
// TODO: Check with a real FAT+ to see where the version is set // TODO: Check with a real FAT+ to see where the version is set
if(bpb_sector[0x2A] == 1 || (bpb_sector[0x2B] == 1) if(bpb_sector[0x2A] == 1 || bpb_sector[0x2B] == 1)
{ {
sb.AppendLine("FAT+"); // Seems easy, check reading sb.AppendLine("FAT+"); // Seems easy, check reading
xmlFSType.Type = "FAT+"; xmlFSType.Type = "FAT+";

View File

@@ -73,7 +73,6 @@ namespace DiscImageChef.Filters
{ {
if(filter.UUID != new Guid("12345678-AAAA-BBBB-CCCC-123456789000")) if(filter.UUID != new Guid("12345678-AAAA-BBBB-CCCC-123456789000"))
{ {
System.Console.WriteLine("Trying filter {0}", filter.Name);
if(filter.Identify(path)) if(filter.Identify(path))
{ {
Filter foundFilter = (Filter)filter.GetType().GetConstructor(Type.EmptyTypes).Invoke(new object[] { }); Filter foundFilter = (Filter)filter.GetType().GetConstructor(Type.EmptyTypes).Invoke(new object[] { });
@@ -87,6 +86,14 @@ namespace DiscImageChef.Filters
noFilter = filter; noFilter = filter;
} }
if(noFilter.Identify(path))
{
noFilter.Open(path);
if(noFilter.IsOpened())
return noFilter;
}
return noFilter; return noFilter;
} }

View File

@@ -189,7 +189,6 @@ namespace DiscImageChef.Filters
public override bool Identify(byte[] buffer) public override bool Identify(byte[] buffer)
{ {
System.Console.WriteLine("parentFolder");
return false; return false;
} }
@@ -201,11 +200,8 @@ namespace DiscImageChef.Filters
public override bool Identify(string path) public override bool Identify(string path)
{ {
System.Console.WriteLine("parentFolder");
string parentFolder = Path.GetDirectoryName(path); string parentFolder = Path.GetDirectoryName(path);
System.Console.WriteLine("parentFolder {0}", parentFolder);
if(!File.Exists(Path.Combine(parentFolder, FinderInfo))) if(!File.Exists(Path.Combine(parentFolder, FinderInfo)))
return false; return false;
@@ -314,12 +310,6 @@ namespace DiscImageChef.Filters
dataLen = new FileInfo(dataPath).Length; dataLen = new FileInfo(dataPath).Length;
rsrcLen = new FileInfo(rsrcPath).Length; rsrcLen = new FileInfo(rsrcPath).Length;
System.Console.WriteLine("dataPath = {0}", dataPath);
System.Console.WriteLine("rsrcPath = {0}", rsrcPath);
System.Console.WriteLine("dataLen = {0}", dataLen);
System.Console.WriteLine("rsrcLen = {0}", rsrcLen);
System.Console.WriteLine("basePath = {0}", basePath);
basePath = path; basePath = path;
opened = true; opened = true;
} }