mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Use new little endian marshaller on filesystems.
This commit is contained in:
@@ -63,11 +63,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
if(imagePlugin.Info.Sectors != 800 && imagePlugin.Info.Sectors != 1600) return false;
|
if(imagePlugin.Info.Sectors != 800 && imagePlugin.Info.Sectors != 1600) return false;
|
||||||
|
|
||||||
byte[] sector = imagePlugin.ReadSector(0);
|
byte[] sector = imagePlugin.ReadSector(0);
|
||||||
AODOS_BootBlock bb = new AODOS_BootBlock();
|
AODOS_BootBlock bb = Helpers.Marshal.ByteArrayToStructureLittleEndian<AODOS_BootBlock>(sector);
|
||||||
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);
|
return bb.identifier.SequenceEqual(AODOSIdentifier);
|
||||||
}
|
}
|
||||||
@@ -77,11 +73,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
{
|
{
|
||||||
Encoding = Encoding.GetEncoding("koi8-r");
|
Encoding = Encoding.GetEncoding("koi8-r");
|
||||||
byte[] sector = imagePlugin.ReadSector(0);
|
byte[] sector = imagePlugin.ReadSector(0);
|
||||||
AODOS_BootBlock bb = new AODOS_BootBlock();
|
AODOS_BootBlock bb = Helpers.Marshal.ByteArrayToStructureLittleEndian<AODOS_BootBlock>(sector);
|
||||||
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);
|
|
||||||
|
|
||||||
StringBuilder sbInformation = new StringBuilder();
|
StringBuilder sbInformation = new StringBuilder();
|
||||||
|
|
||||||
|
|||||||
@@ -59,10 +59,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GCHandle handle = GCHandle.Alloc(sector, GCHandleType.Pinned);
|
nxSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<ApfsContainerSuperBlock>(sector);
|
||||||
nxSb = (ApfsContainerSuperBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(),
|
|
||||||
typeof(ApfsContainerSuperBlock));
|
|
||||||
handle.Free();
|
|
||||||
}
|
}
|
||||||
catch { return false; }
|
catch { return false; }
|
||||||
|
|
||||||
@@ -84,10 +81,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GCHandle handle = GCHandle.Alloc(sector, GCHandleType.Pinned);
|
nxSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<ApfsContainerSuperBlock>(sector);
|
||||||
nxSb = (ApfsContainerSuperBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(),
|
|
||||||
typeof(ApfsContainerSuperBlock));
|
|
||||||
handle.Free();
|
|
||||||
}
|
}
|
||||||
catch { return; }
|
catch { return; }
|
||||||
|
|
||||||
|
|||||||
@@ -94,22 +94,17 @@ namespace DiscImageChef.Filesystems
|
|||||||
if(imagePlugin.Info.SectorSize < 256) return false;
|
if(imagePlugin.Info.SectorSize < 256) return false;
|
||||||
|
|
||||||
byte[] sector;
|
byte[] sector;
|
||||||
GCHandle ptr;
|
|
||||||
|
|
||||||
// ADFS-S, ADFS-M, ADFS-L, ADFS-D without partitions
|
// ADFS-S, ADFS-M, ADFS-L, ADFS-D without partitions
|
||||||
if(partition.Start == 0)
|
if(partition.Start == 0)
|
||||||
{
|
{
|
||||||
sector = imagePlugin.ReadSector(0);
|
sector = imagePlugin.ReadSector(0);
|
||||||
byte oldChk0 = AcornMapChecksum(sector, 255);
|
byte oldChk0 = AcornMapChecksum(sector, 255);
|
||||||
ptr = GCHandle.Alloc(sector, GCHandleType.Pinned);
|
OldMapSector0 oldMap0 = Helpers.Marshal.ByteArrayToStructureLittleEndian<OldMapSector0>(sector);
|
||||||
OldMapSector0 oldMap0 =
|
|
||||||
(OldMapSector0)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(OldMapSector0));
|
|
||||||
|
|
||||||
sector = imagePlugin.ReadSector(1);
|
sector = imagePlugin.ReadSector(1);
|
||||||
byte oldChk1 = AcornMapChecksum(sector, 255);
|
byte oldChk1 = AcornMapChecksum(sector, 255);
|
||||||
ptr = GCHandle.Alloc(sector, GCHandleType.Pinned);
|
OldMapSector1 oldMap1 = Helpers.Marshal.ByteArrayToStructureLittleEndian<OldMapSector1>(sector);
|
||||||
OldMapSector1 oldMap1 =
|
|
||||||
(OldMapSector1)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(OldMapSector1));
|
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ADFS Plugin", "oldMap0.checksum = {0}", oldMap0.checksum);
|
DicConsole.DebugWriteLine("ADFS Plugin", "oldMap0.checksum = {0}", oldMap0.checksum);
|
||||||
DicConsole.DebugWriteLine("ADFS Plugin", "oldChk0 = {0}", oldChk0);
|
DicConsole.DebugWriteLine("ADFS Plugin", "oldChk0 = {0}", oldChk0);
|
||||||
@@ -121,8 +116,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] tmp = new byte[256];
|
byte[] tmp = new byte[256];
|
||||||
Array.Copy(sector, 256, tmp, 0, 256);
|
Array.Copy(sector, 256, tmp, 0, 256);
|
||||||
oldChk1 = AcornMapChecksum(tmp, 255);
|
oldChk1 = AcornMapChecksum(tmp, 255);
|
||||||
ptr = GCHandle.Alloc(tmp, GCHandleType.Pinned);
|
oldMap1 = Helpers.Marshal.ByteArrayToStructureLittleEndian<OldMapSector1>(tmp);
|
||||||
oldMap1 = (OldMapSector1)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(OldMapSector1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ADFS Plugin", "oldMap1.checksum = {0}", oldMap1.checksum);
|
DicConsole.DebugWriteLine("ADFS Plugin", "oldMap1.checksum = {0}", oldMap1.checksum);
|
||||||
@@ -144,9 +138,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
sector = tmp;
|
sector = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = GCHandle.Alloc(sector, GCHandleType.Pinned);
|
OldDirectory oldRoot = Helpers.Marshal.ByteArrayToStructureLittleEndian<OldDirectory>(sector);
|
||||||
OldDirectory oldRoot =
|
|
||||||
(OldDirectory)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(OldDirectory));
|
|
||||||
byte dirChk = AcornDirectoryChecksum(sector, (int)OLD_DIRECTORY_SIZE - 1);
|
byte dirChk = AcornDirectoryChecksum(sector, (int)OLD_DIRECTORY_SIZE - 1);
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ADFS Plugin", "oldRoot.header.magic at 0x200 = {0}",
|
DicConsole.DebugWriteLine("ADFS Plugin", "oldRoot.header.magic at 0x200 = {0}",
|
||||||
@@ -173,8 +165,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
sector = tmp;
|
sector = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = GCHandle.Alloc(sector, GCHandleType.Pinned);
|
oldRoot = Helpers.Marshal.ByteArrayToStructureLittleEndian<OldDirectory>(sector);
|
||||||
oldRoot = (OldDirectory)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(OldDirectory));
|
|
||||||
dirChk = AcornDirectoryChecksum(sector, (int)OLD_DIRECTORY_SIZE - 1);
|
dirChk = AcornDirectoryChecksum(sector, (int)OLD_DIRECTORY_SIZE - 1);
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ADFS Plugin", "oldRoot.header.magic at 0x400 = {0}",
|
DicConsole.DebugWriteLine("ADFS Plugin", "oldRoot.header.magic at 0x400 = {0}",
|
||||||
@@ -212,16 +203,12 @@ namespace DiscImageChef.Filesystems
|
|||||||
|
|
||||||
if(newChk == sector[0] && newChk != 0)
|
if(newChk == sector[0] && newChk != 0)
|
||||||
{
|
{
|
||||||
ptr = GCHandle.Alloc(sector, GCHandleType.Pinned);
|
NewMap nmap = Helpers.Marshal.ByteArrayToStructureLittleEndian<NewMap>(sector);
|
||||||
NewMap nmap = (NewMap)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(NewMap));
|
|
||||||
ptr.Free();
|
|
||||||
drSb = nmap.discRecord;
|
drSb = nmap.discRecord;
|
||||||
}
|
}
|
||||||
else if(bootChk == bootSector[0x1FF])
|
else if(bootChk == bootSector[0x1FF])
|
||||||
{
|
{
|
||||||
ptr = GCHandle.Alloc(bootSector, GCHandleType.Pinned);
|
BootBlock bBlock = Helpers.Marshal.ByteArrayToStructureLittleEndian<BootBlock>(bootSector);
|
||||||
BootBlock bBlock = (BootBlock)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(BootBlock));
|
|
||||||
ptr.Free();
|
|
||||||
drSb = bBlock.discRecord;
|
drSb = bBlock.discRecord;
|
||||||
}
|
}
|
||||||
else return false;
|
else return false;
|
||||||
@@ -262,7 +249,6 @@ namespace DiscImageChef.Filesystems
|
|||||||
ulong sbSector;
|
ulong sbSector;
|
||||||
byte[] sector;
|
byte[] sector;
|
||||||
uint sectorsToRead;
|
uint sectorsToRead;
|
||||||
GCHandle ptr;
|
|
||||||
ulong bytes;
|
ulong bytes;
|
||||||
|
|
||||||
// ADFS-S, ADFS-M, ADFS-L, ADFS-D without partitions
|
// ADFS-S, ADFS-M, ADFS-L, ADFS-D without partitions
|
||||||
@@ -270,15 +256,11 @@ namespace DiscImageChef.Filesystems
|
|||||||
{
|
{
|
||||||
sector = imagePlugin.ReadSector(0);
|
sector = imagePlugin.ReadSector(0);
|
||||||
byte oldChk0 = AcornMapChecksum(sector, 255);
|
byte oldChk0 = AcornMapChecksum(sector, 255);
|
||||||
ptr = GCHandle.Alloc(sector, GCHandleType.Pinned);
|
OldMapSector0 oldMap0 = Helpers.Marshal.ByteArrayToStructureLittleEndian<OldMapSector0>(sector);
|
||||||
OldMapSector0 oldMap0 =
|
|
||||||
(OldMapSector0)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(OldMapSector0));
|
|
||||||
|
|
||||||
sector = imagePlugin.ReadSector(1);
|
sector = imagePlugin.ReadSector(1);
|
||||||
byte oldChk1 = AcornMapChecksum(sector, 255);
|
byte oldChk1 = AcornMapChecksum(sector, 255);
|
||||||
ptr = GCHandle.Alloc(sector, GCHandleType.Pinned);
|
OldMapSector1 oldMap1 = Helpers.Marshal.ByteArrayToStructureLittleEndian<OldMapSector1>(sector);
|
||||||
OldMapSector1 oldMap1 =
|
|
||||||
(OldMapSector1)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(OldMapSector1));
|
|
||||||
|
|
||||||
// According to documentation map1 MUST start on sector 1. On ADFS-D it starts at 0x100, not on sector 1 (0x400)
|
// According to documentation map1 MUST start on sector 1. On ADFS-D it starts at 0x100, not on sector 1 (0x400)
|
||||||
if(oldMap0.checksum == oldChk0 && oldMap1.checksum != oldChk1 && sector.Length >= 512)
|
if(oldMap0.checksum == oldChk0 && oldMap1.checksum != oldChk1 && sector.Length >= 512)
|
||||||
@@ -287,8 +269,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] tmp = new byte[256];
|
byte[] tmp = new byte[256];
|
||||||
Array.Copy(sector, 256, tmp, 0, 256);
|
Array.Copy(sector, 256, tmp, 0, 256);
|
||||||
oldChk1 = AcornMapChecksum(tmp, 255);
|
oldChk1 = AcornMapChecksum(tmp, 255);
|
||||||
ptr = GCHandle.Alloc(tmp, GCHandleType.Pinned);
|
oldMap1 = Helpers.Marshal.ByteArrayToStructureLittleEndian<OldMapSector1>(tmp);
|
||||||
oldMap1 = (OldMapSector1)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(OldMapSector1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(oldMap0.checksum == oldChk0 && oldMap1.checksum == oldChk1 && oldMap0.checksum != 0 &&
|
if(oldMap0.checksum == oldChk0 && oldMap1.checksum == oldChk1 && oldMap0.checksum != 0 &&
|
||||||
@@ -325,9 +306,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
sector = tmp;
|
sector = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = GCHandle.Alloc(sector, GCHandleType.Pinned);
|
OldDirectory oldRoot = Helpers.Marshal.ByteArrayToStructureLittleEndian<OldDirectory>(sector);
|
||||||
OldDirectory oldRoot =
|
|
||||||
(OldDirectory)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(OldDirectory));
|
|
||||||
|
|
||||||
if(oldRoot.header.magic == OLD_DIR_MAGIC && oldRoot.tail.magic == OLD_DIR_MAGIC)
|
if(oldRoot.header.magic == OLD_DIR_MAGIC && oldRoot.tail.magic == OLD_DIR_MAGIC)
|
||||||
namebytes = oldRoot.tail.name;
|
namebytes = oldRoot.tail.name;
|
||||||
@@ -348,9 +327,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
sector = tmp;
|
sector = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = GCHandle.Alloc(sector, GCHandleType.Pinned);
|
oldRoot = Helpers.Marshal.ByteArrayToStructureLittleEndian<OldDirectory>(sector);
|
||||||
oldRoot = (OldDirectory)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(),
|
|
||||||
typeof(OldDirectory));
|
|
||||||
|
|
||||||
if(oldRoot.header.magic == OLD_DIR_MAGIC && oldRoot.tail.magic == OLD_DIR_MAGIC)
|
if(oldRoot.header.magic == OLD_DIR_MAGIC && oldRoot.tail.magic == OLD_DIR_MAGIC)
|
||||||
namebytes = oldRoot.tail.name;
|
namebytes = oldRoot.tail.name;
|
||||||
@@ -366,10 +343,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
sector = tmp;
|
sector = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = GCHandle.Alloc(sector, GCHandleType.Pinned);
|
NewDirectory newRoot = Helpers.Marshal.ByteArrayToStructureLittleEndian<NewDirectory>(sector);
|
||||||
NewDirectory newRoot =
|
|
||||||
(NewDirectory)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(),
|
|
||||||
typeof(NewDirectory));
|
|
||||||
if(newRoot.header.magic == NEW_DIR_MAGIC && newRoot.tail.magic == NEW_DIR_MAGIC)
|
if(newRoot.header.magic == NEW_DIR_MAGIC && newRoot.tail.magic == NEW_DIR_MAGIC)
|
||||||
namebytes = newRoot.tail.title;
|
namebytes = newRoot.tail.title;
|
||||||
}
|
}
|
||||||
@@ -418,16 +392,12 @@ namespace DiscImageChef.Filesystems
|
|||||||
|
|
||||||
if(newChk == sector[0] && newChk != 0)
|
if(newChk == sector[0] && newChk != 0)
|
||||||
{
|
{
|
||||||
ptr = GCHandle.Alloc(sector, GCHandleType.Pinned);
|
NewMap nmap = Helpers.Marshal.ByteArrayToStructureLittleEndian<NewMap>(sector);
|
||||||
NewMap nmap = (NewMap)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(NewMap));
|
|
||||||
ptr.Free();
|
|
||||||
drSb = nmap.discRecord;
|
drSb = nmap.discRecord;
|
||||||
}
|
}
|
||||||
else if(bootChk == bootSector[0x1FF])
|
else if(bootChk == bootSector[0x1FF])
|
||||||
{
|
{
|
||||||
ptr = GCHandle.Alloc(bootSector, GCHandleType.Pinned);
|
BootBlock bBlock = Helpers.Marshal.ByteArrayToStructureLittleEndian<BootBlock>(sector);
|
||||||
BootBlock bBlock = (BootBlock)Marshal.PtrToStructure(ptr.AddrOfPinnedObject(), typeof(BootBlock));
|
|
||||||
ptr.Free();
|
|
||||||
drSb = bBlock.discRecord;
|
drSb = bBlock.discRecord;
|
||||||
}
|
}
|
||||||
else return;
|
else return;
|
||||||
|
|||||||
@@ -98,10 +98,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
|||||||
if(debug) catalogMs.Write(catSectorB, 0, catSectorB.Length);
|
if(debug) catalogMs.Write(catSectorB, 0, catSectorB.Length);
|
||||||
|
|
||||||
// Read the catalog sector
|
// Read the catalog sector
|
||||||
IntPtr catPtr = Marshal.AllocHGlobal(256);
|
CatalogSector catSector = Helpers.Marshal.ByteArrayToStructureLittleEndian<CatalogSector>(catSectorB);
|
||||||
Marshal.Copy(catSectorB, 0, catPtr, 256);
|
|
||||||
CatalogSector catSector = (CatalogSector)Marshal.PtrToStructure(catPtr, typeof(CatalogSector));
|
|
||||||
Marshal.FreeHGlobal(catPtr);
|
|
||||||
|
|
||||||
foreach(FileEntry entry in catSector.entries.Where(entry => entry.extentTrack > 0))
|
foreach(FileEntry entry in catSector.entries.Where(entry => entry.extentTrack > 0))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -179,10 +179,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
|||||||
if(debug) tsListMs.Write(tsSectorB, 0, tsSectorB.Length);
|
if(debug) tsListMs.Write(tsSectorB, 0, tsSectorB.Length);
|
||||||
|
|
||||||
// Read the track/sector list sector
|
// Read the track/sector list sector
|
||||||
IntPtr tsPtr = Marshal.AllocHGlobal(256);
|
TrackSectorList tsSector = Helpers.Marshal.ByteArrayToStructureLittleEndian<TrackSectorList>(tsSectorB);
|
||||||
Marshal.Copy(tsSectorB, 0, tsPtr, 256);
|
|
||||||
TrackSectorList tsSector = (TrackSectorList)Marshal.PtrToStructure(tsPtr, typeof(TrackSectorList));
|
|
||||||
Marshal.FreeHGlobal(tsPtr);
|
|
||||||
|
|
||||||
if(tsSector.sectorOffset > expectedBlock)
|
if(tsSector.sectorOffset > expectedBlock)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -52,11 +52,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
|||||||
int spt = imagePlugin.Info.Sectors == 455 ? 13 : 16;
|
int spt = imagePlugin.Info.Sectors == 455 ? 13 : 16;
|
||||||
|
|
||||||
byte[] vtocB = imagePlugin.ReadSector((ulong)(17 * spt));
|
byte[] vtocB = imagePlugin.ReadSector((ulong)(17 * spt));
|
||||||
vtoc = new Vtoc();
|
vtoc = Helpers.Marshal.ByteArrayToStructureLittleEndian<Vtoc>(vtocB);
|
||||||
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 &&
|
return vtoc.catalogSector < spt && vtoc.maxTrackSectorPairsPerSector <= 122 &&
|
||||||
vtoc.sectorsPerTrack == spt && vtoc.bytesPerSector == 256;
|
vtoc.sectorsPerTrack == spt && vtoc.bytesPerSector == 256;
|
||||||
@@ -73,11 +69,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
|||||||
spt = imagePlugin.Info.Sectors == 455 ? 13 : 16;
|
spt = imagePlugin.Info.Sectors == 455 ? 13 : 16;
|
||||||
|
|
||||||
byte[] vtocB = imagePlugin.ReadSector((ulong)(17 * spt));
|
byte[] vtocB = imagePlugin.ReadSector((ulong)(17 * spt));
|
||||||
vtoc = new Vtoc();
|
vtoc = Helpers.Marshal.ByteArrayToStructureLittleEndian<Vtoc>(vtocB);
|
||||||
IntPtr vtocPtr = Marshal.AllocHGlobal(256);
|
|
||||||
Marshal.Copy(vtocB, 0, vtocPtr, 256);
|
|
||||||
vtoc = (Vtoc)Marshal.PtrToStructure(vtocPtr, typeof(Vtoc));
|
|
||||||
Marshal.FreeHGlobal(vtocPtr);
|
|
||||||
|
|
||||||
sb.AppendLine("Apple DOS File System");
|
sb.AppendLine("Apple DOS File System");
|
||||||
sb.AppendLine();
|
sb.AppendLine();
|
||||||
|
|||||||
@@ -77,11 +77,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
|||||||
|
|
||||||
// Read the VTOC
|
// Read the VTOC
|
||||||
vtocBlocks = device.ReadSector((ulong)(17 * sectorsPerTrack));
|
vtocBlocks = device.ReadSector((ulong)(17 * sectorsPerTrack));
|
||||||
vtoc = new Vtoc();
|
vtoc = Helpers.Marshal.ByteArrayToStructureLittleEndian<Vtoc>(vtocBlocks);
|
||||||
IntPtr vtocPtr = Marshal.AllocHGlobal(256);
|
|
||||||
Marshal.Copy(vtocBlocks, 0, vtocPtr, 256);
|
|
||||||
vtoc = (Vtoc)Marshal.PtrToStructure(vtocPtr, typeof(Vtoc));
|
|
||||||
Marshal.FreeHGlobal(vtocPtr);
|
|
||||||
|
|
||||||
track1UsedByFiles = false;
|
track1UsedByFiles = false;
|
||||||
track2UsedByFiles = false;
|
track2UsedByFiles = false;
|
||||||
|
|||||||
@@ -94,10 +94,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] sbSector = new byte[AFS_SUPERBLOCK_SIZE];
|
byte[] sbSector = new byte[AFS_SUPERBLOCK_SIZE];
|
||||||
Array.Copy(tmp, offset, sbSector, 0, AFS_SUPERBLOCK_SIZE);
|
Array.Copy(tmp, offset, sbSector, 0, AFS_SUPERBLOCK_SIZE);
|
||||||
|
|
||||||
GCHandle handle = GCHandle.Alloc(sbSector, GCHandleType.Pinned);
|
AtheosSuperBlock afsSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<AtheosSuperBlock>(sbSector);
|
||||||
AtheosSuperBlock afsSb =
|
|
||||||
(AtheosSuperBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(AtheosSuperBlock));
|
|
||||||
handle.Free();
|
|
||||||
|
|
||||||
sb.AppendLine("Atheos filesystem");
|
sb.AppendLine("Atheos filesystem");
|
||||||
|
|
||||||
|
|||||||
@@ -129,9 +129,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
|
|
||||||
if(littleEndian)
|
if(littleEndian)
|
||||||
{
|
{
|
||||||
GCHandle handle = GCHandle.Alloc(sbSector, GCHandleType.Pinned);
|
besb = Helpers.Marshal.ByteArrayToStructureLittleEndian<BeSuperBlock>(sbSector);
|
||||||
besb = (BeSuperBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(BeSuperBlock));
|
|
||||||
handle.Free();
|
|
||||||
}
|
}
|
||||||
else besb = Helpers.Marshal.ByteArrayToStructureBigEndian<BeSuperBlock>(sbSector);
|
else besb = Helpers.Marshal.ByteArrayToStructureBigEndian<BeSuperBlock>(sbSector);
|
||||||
|
|
||||||
|
|||||||
@@ -67,9 +67,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GCHandle handle = GCHandle.Alloc(sector, GCHandleType.Pinned);
|
btrfsSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<SuperBlock>(sector);
|
||||||
btrfsSb = (SuperBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(SuperBlock));
|
|
||||||
handle.Free();
|
|
||||||
}
|
}
|
||||||
catch { return false; }
|
catch { return false; }
|
||||||
|
|
||||||
@@ -94,9 +92,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
|
|
||||||
byte[] sector = imagePlugin.ReadSectors(sbSectorOff + partition.Start, sbSectorSize);
|
byte[] sector = imagePlugin.ReadSectors(sbSectorOff + partition.Start, sbSectorSize);
|
||||||
|
|
||||||
GCHandle handle = GCHandle.Alloc(sector, GCHandleType.Pinned);
|
SuperBlock btrfsSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<SuperBlock>(sector);
|
||||||
SuperBlock btrfsSb = (SuperBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(SuperBlock));
|
|
||||||
handle.Free();
|
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.checksum = {0}", btrfsSb.checksum);
|
DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.checksum = {0}", btrfsSb.checksum);
|
||||||
DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.uuid = {0}", btrfsSb.uuid);
|
DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.uuid = {0}", btrfsSb.uuid);
|
||||||
|
|||||||
@@ -63,11 +63,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
if(imagePlugin.Info.Sectors == 3200)
|
if(imagePlugin.Info.Sectors == 3200)
|
||||||
{
|
{
|
||||||
sector = imagePlugin.ReadSector(1560);
|
sector = imagePlugin.ReadSector(1560);
|
||||||
CommodoreHeader cbmHdr = new CommodoreHeader();
|
CommodoreHeader cbmHdr = Helpers.Marshal.ByteArrayToStructureLittleEndian<CommodoreHeader>(sector);
|
||||||
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)
|
if(cbmHdr.diskDosVersion == 0x44 && cbmHdr.dosVersion == 0x33 && cbmHdr.diskVersion == 0x44)
|
||||||
return true;
|
return true;
|
||||||
@@ -75,11 +71,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
sector = imagePlugin.ReadSector(357);
|
sector = imagePlugin.ReadSector(357);
|
||||||
CommodoreBam cbmBam = new CommodoreBam();
|
CommodoreBam cbmBam = Helpers.Marshal.ByteArrayToStructureLittleEndian<CommodoreBam>(sector);
|
||||||
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) &&
|
if(cbmBam.dosVersion == 0x41 && (cbmBam.doubleSided == 0x00 || cbmBam.doubleSided == 0x80) &&
|
||||||
cbmBam.unused1 == 0x00 && cbmBam.directoryTrack == 0x12) return true;
|
cbmBam.unused1 == 0x00 && cbmBam.directoryTrack == 0x12) return true;
|
||||||
@@ -106,11 +98,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
if(imagePlugin.Info.Sectors == 3200)
|
if(imagePlugin.Info.Sectors == 3200)
|
||||||
{
|
{
|
||||||
sector = imagePlugin.ReadSector(1560);
|
sector = imagePlugin.ReadSector(1560);
|
||||||
CommodoreHeader cbmHdr = new CommodoreHeader();
|
CommodoreHeader cbmHdr = Helpers.Marshal.ByteArrayToStructureLittleEndian<CommodoreHeader>(sector);
|
||||||
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);
|
|
||||||
|
|
||||||
sbInformation.AppendFormat("Directory starts at track {0} sector {1}", cbmHdr.directoryTrack,
|
sbInformation.AppendFormat("Directory starts at track {0} sector {1}", cbmHdr.directoryTrack,
|
||||||
cbmHdr.directorySector).AppendLine();
|
cbmHdr.directorySector).AppendLine();
|
||||||
@@ -131,11 +119,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
sector = imagePlugin.ReadSector(357);
|
sector = imagePlugin.ReadSector(357);
|
||||||
CommodoreBam cbmBam = new CommodoreBam();
|
CommodoreBam cbmBam = Helpers.Marshal.ByteArrayToStructureLittleEndian<CommodoreBam>(sector);
|
||||||
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);
|
|
||||||
|
|
||||||
sbInformation.AppendFormat("Directory starts at track {0} sector {1}", cbmBam.directoryTrack,
|
sbInformation.AppendFormat("Directory starts at track {0} sector {1}", cbmBam.directoryTrack,
|
||||||
cbmBam.directorySector).AppendLine();
|
cbmBam.directorySector).AppendLine();
|
||||||
|
|||||||
@@ -71,10 +71,8 @@ namespace DiscImageChef.Filesystems.CPM
|
|||||||
|
|
||||||
for(int off = 0; off < directory.Length; off += 32)
|
for(int off = 0; off < directory.Length; off += 32)
|
||||||
{
|
{
|
||||||
IntPtr dirPtr = Marshal.AllocHGlobal(32);
|
DirectoryEntry entry =
|
||||||
Marshal.Copy(directory, off, dirPtr, 32);
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<DirectoryEntry>(directory, off, 32);
|
||||||
DirectoryEntry entry = (DirectoryEntry)Marshal.PtrToStructure(dirPtr, typeof(DirectoryEntry));
|
|
||||||
Marshal.FreeHGlobal(dirPtr);
|
|
||||||
|
|
||||||
if((entry.statusUser & 0x7F) < 0x20)
|
if((entry.statusUser & 0x7F) < 0x20)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -180,11 +180,8 @@ namespace DiscImageChef.Filesystems.CPM
|
|||||||
if(sig1 == 0x4D2F5043 && sig2 == 0x004B5344 && sig3 == sig1) amsSbOffset = 0x80;
|
if(sig1 == 0x4D2F5043 && sig2 == 0x004B5344 && sig3 == sig1) amsSbOffset = 0x80;
|
||||||
|
|
||||||
// Read the superblock
|
// Read the superblock
|
||||||
IntPtr amsPtr = Marshal.AllocHGlobal(16);
|
|
||||||
Marshal.Copy(sector, amsSbOffset, amsPtr, 16);
|
|
||||||
AmstradSuperBlock amsSb =
|
AmstradSuperBlock amsSb =
|
||||||
(AmstradSuperBlock)Marshal.PtrToStructure(amsPtr, typeof(AmstradSuperBlock));
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<AmstradSuperBlock>(sector, amsSbOffset, 16);
|
||||||
Marshal.FreeHGlobal(amsPtr);
|
|
||||||
|
|
||||||
// Check that format byte and sidedness indicate the same number of sizes
|
// Check that format byte and sidedness indicate the same number of sizes
|
||||||
if(amsSb.format == 0 && (amsSb.sidedness & 0x02) == 0 ||
|
if(amsSb.format == 0 && (amsSb.sidedness & 0x02) == 0 ||
|
||||||
@@ -300,11 +297,8 @@ namespace DiscImageChef.Filesystems.CPM
|
|||||||
if(sum == 0)
|
if(sum == 0)
|
||||||
{
|
{
|
||||||
// Read the superblock
|
// Read the superblock
|
||||||
HardDiskSuperBlock hddSb = new HardDiskSuperBlock();
|
HardDiskSuperBlock hddSb =
|
||||||
IntPtr hddPtr = Marshal.AllocHGlobal(Marshal.SizeOf(hddSb));
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<HardDiskSuperBlock>(sector);
|
||||||
Marshal.Copy(sector, 0, hddPtr, Marshal.SizeOf(hddSb));
|
|
||||||
hddSb = (HardDiskSuperBlock)Marshal.PtrToStructure(hddPtr, typeof(HardDiskSuperBlock));
|
|
||||||
Marshal.FreeHGlobal(hddPtr);
|
|
||||||
|
|
||||||
// Calculate volume size
|
// Calculate volume size
|
||||||
sectorSize = (ulong)(hddSb.recordsPerSector * 128);
|
sectorSize = (ulong)(hddSb.recordsPerSector * 128);
|
||||||
|
|||||||
@@ -216,7 +216,6 @@ namespace DiscImageChef.Filesystems.CPM
|
|||||||
passwordCache = new Dictionary<string, byte[]>();
|
passwordCache = new Dictionary<string, byte[]>();
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("CP/M Plugin", "Traversing directory.");
|
DicConsole.DebugWriteLine("CP/M Plugin", "Traversing directory.");
|
||||||
IntPtr dirPtr;
|
|
||||||
|
|
||||||
// For each directory entry
|
// For each directory entry
|
||||||
for(int dOff = 0; dOff < directory.Length; dOff += 32)
|
for(int dOff = 0; dOff < directory.Length; dOff += 32)
|
||||||
@@ -224,11 +223,8 @@ namespace DiscImageChef.Filesystems.CPM
|
|||||||
if((directory[dOff] & 0x7F) < 0x10)
|
if((directory[dOff] & 0x7F) < 0x10)
|
||||||
if(allocationBlocks.Count > 256)
|
if(allocationBlocks.Count > 256)
|
||||||
{
|
{
|
||||||
dirPtr = Marshal.AllocHGlobal(32);
|
|
||||||
Marshal.Copy(directory, dOff, dirPtr, 32);
|
|
||||||
DirectoryEntry16 entry =
|
DirectoryEntry16 entry =
|
||||||
(DirectoryEntry16)Marshal.PtrToStructure(dirPtr, typeof(DirectoryEntry16));
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<DirectoryEntry16>(directory, dOff, 32);
|
||||||
Marshal.FreeHGlobal(dirPtr);
|
|
||||||
|
|
||||||
bool hidden = (entry.statusUser & 0x80) == 0x80;
|
bool hidden = (entry.statusUser & 0x80) == 0x80;
|
||||||
bool rdOnly = (entry.filename[0] & 0x80) == 0x80 || (entry.extension[0] & 0x80) == 0x80;
|
bool rdOnly = (entry.filename[0] & 0x80) == 0x80 || (entry.extension[0] & 0x80) == 0x80;
|
||||||
@@ -314,10 +310,8 @@ namespace DiscImageChef.Filesystems.CPM
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dirPtr = Marshal.AllocHGlobal(32);
|
DirectoryEntry entry =
|
||||||
Marshal.Copy(directory, dOff, dirPtr, 32);
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<DirectoryEntry>(directory, dOff, 32);
|
||||||
DirectoryEntry entry = (DirectoryEntry)Marshal.PtrToStructure(dirPtr, typeof(DirectoryEntry));
|
|
||||||
Marshal.FreeHGlobal(dirPtr);
|
|
||||||
|
|
||||||
bool hidden = (entry.statusUser & 0x80) == 0x80;
|
bool hidden = (entry.statusUser & 0x80) == 0x80;
|
||||||
bool rdOnly = (entry.filename[0] & 0x80) == 0x80 || (entry.extension[0] & 0x80) == 0x80;
|
bool rdOnly = (entry.filename[0] & 0x80) == 0x80 || (entry.extension[0] & 0x80) == 0x80;
|
||||||
@@ -404,10 +398,8 @@ namespace DiscImageChef.Filesystems.CPM
|
|||||||
// A password entry (or a file entry in PDOS, but this does not handle that case)
|
// A password entry (or a file entry in PDOS, but this does not handle that case)
|
||||||
else if((directory[dOff] & 0x7F) >= 0x10 && (directory[dOff] & 0x7F) < 0x20)
|
else if((directory[dOff] & 0x7F) >= 0x10 && (directory[dOff] & 0x7F) < 0x20)
|
||||||
{
|
{
|
||||||
dirPtr = Marshal.AllocHGlobal(32);
|
PasswordEntry entry =
|
||||||
Marshal.Copy(directory, dOff, dirPtr, 32);
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<PasswordEntry>(directory, dOff, 32);
|
||||||
PasswordEntry entry = (PasswordEntry)Marshal.PtrToStructure(dirPtr, typeof(PasswordEntry));
|
|
||||||
Marshal.FreeHGlobal(dirPtr);
|
|
||||||
|
|
||||||
int user = entry.userNumber & 0x0F;
|
int user = entry.userNumber & 0x0F;
|
||||||
|
|
||||||
@@ -450,11 +442,8 @@ namespace DiscImageChef.Filesystems.CPM
|
|||||||
switch(directory[dOff] & 0x7F)
|
switch(directory[dOff] & 0x7F)
|
||||||
{
|
{
|
||||||
case 0x20:
|
case 0x20:
|
||||||
LabelEntry labelEntry;
|
LabelEntry labelEntry =
|
||||||
dirPtr = Marshal.AllocHGlobal(32);
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<LabelEntry>(directory, dOff, 32);
|
||||||
Marshal.Copy(directory, dOff, dirPtr, 32);
|
|
||||||
labelEntry = (LabelEntry)Marshal.PtrToStructure(dirPtr, typeof(LabelEntry));
|
|
||||||
Marshal.FreeHGlobal(dirPtr);
|
|
||||||
|
|
||||||
// The volume label defines if one of the fields in CP/M 3 timestamp is a creation or an
|
// The volume label defines if one of the fields in CP/M 3 timestamp is a creation or an
|
||||||
// access time
|
// access time
|
||||||
@@ -486,10 +475,8 @@ namespace DiscImageChef.Filesystems.CPM
|
|||||||
if(directory[dOff + 10] == 0x00 && directory[dOff + 20] == 0x00 &&
|
if(directory[dOff + 10] == 0x00 && directory[dOff + 20] == 0x00 &&
|
||||||
directory[dOff + 30] == 0x00 && directory[dOff + 31] == 0x00)
|
directory[dOff + 30] == 0x00 && directory[dOff + 31] == 0x00)
|
||||||
{
|
{
|
||||||
dirPtr = Marshal.AllocHGlobal(32);
|
DateEntry dateEntry =
|
||||||
Marshal.Copy(directory, dOff, dirPtr, 32);
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<DateEntry>(directory, dOff, 32);
|
||||||
DateEntry dateEntry = (DateEntry)Marshal.PtrToStructure(dirPtr, typeof(DateEntry));
|
|
||||||
Marshal.FreeHGlobal(dirPtr);
|
|
||||||
|
|
||||||
FileEntryInfo fInfo;
|
FileEntryInfo fInfo;
|
||||||
|
|
||||||
@@ -541,11 +528,9 @@ namespace DiscImageChef.Filesystems.CPM
|
|||||||
// However, if this byte is 0, timestamp is in Z80DOS or DOS+ format
|
// However, if this byte is 0, timestamp is in Z80DOS or DOS+ format
|
||||||
else if(directory[dOff + 1] == 0x00)
|
else if(directory[dOff + 1] == 0x00)
|
||||||
{
|
{
|
||||||
dirPtr = Marshal.AllocHGlobal(32);
|
|
||||||
Marshal.Copy(directory, dOff, dirPtr, 32);
|
|
||||||
TrdPartyDateEntry trdPartyDateEntry =
|
TrdPartyDateEntry trdPartyDateEntry =
|
||||||
(TrdPartyDateEntry)Marshal.PtrToStructure(dirPtr, typeof(TrdPartyDateEntry));
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<TrdPartyDateEntry>(directory, dOff,
|
||||||
Marshal.FreeHGlobal(dirPtr);
|
32);
|
||||||
|
|
||||||
FileEntryInfo fInfo;
|
FileEntryInfo fInfo;
|
||||||
|
|
||||||
|
|||||||
@@ -77,10 +77,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
switch(magic)
|
switch(magic)
|
||||||
{
|
{
|
||||||
case CRAM_MAGIC:
|
case CRAM_MAGIC:
|
||||||
IntPtr crSbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(crSb));
|
crSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<CramSuperBlock>(sector);
|
||||||
Marshal.Copy(sector, 0, crSbPtr, Marshal.SizeOf(crSb));
|
|
||||||
crSb = (CramSuperBlock)Marshal.PtrToStructure(crSbPtr, typeof(CramSuperBlock));
|
|
||||||
Marshal.FreeHGlobal(crSbPtr);
|
|
||||||
break;
|
break;
|
||||||
case CRAM_CIGAM:
|
case CRAM_CIGAM:
|
||||||
crSb = Helpers.Marshal.ByteArrayToStructureBigEndian<CramSuperBlock>(sector);
|
crSb = Helpers.Marshal.ByteArrayToStructureBigEndian<CramSuperBlock>(sector);
|
||||||
|
|||||||
@@ -60,11 +60,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
|
|
||||||
if(sector.Length != 128) return false;
|
if(sector.Length != 128) return false;
|
||||||
|
|
||||||
VolumeLabel vol = new VolumeLabel();
|
VolumeLabel vol = Helpers.Marshal.ByteArrayToStructureLittleEndian<VolumeLabel>(sector);
|
||||||
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;
|
return ecma67_magic.SequenceEqual(vol.labelIdentifier) && vol.labelNumber == 1 && vol.recordLength == 0x31;
|
||||||
}
|
}
|
||||||
@@ -77,11 +73,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
|
|
||||||
StringBuilder sbInformation = new StringBuilder();
|
StringBuilder sbInformation = new StringBuilder();
|
||||||
|
|
||||||
VolumeLabel vol = new VolumeLabel();
|
VolumeLabel vol = Helpers.Marshal.ByteArrayToStructureLittleEndian<VolumeLabel>(sector);
|
||||||
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.AppendLine("ECMA-67");
|
||||||
|
|
||||||
|
|||||||
@@ -72,10 +72,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
|
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
|
||||||
if(sector.Length < Marshal.SizeOf(f2fsSb)) return false;
|
if(sector.Length < Marshal.SizeOf(f2fsSb)) return false;
|
||||||
|
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(f2fsSb));
|
f2fsSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<F2FS_Superblock>(sector);
|
||||||
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(f2fsSb));
|
|
||||||
f2fsSb = (F2FS_Superblock)Marshal.PtrToStructure(sbPtr, typeof(F2FS_Superblock));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
return f2fsSb.magic == F2FS_MAGIC;
|
return f2fsSb.magic == F2FS_MAGIC;
|
||||||
}
|
}
|
||||||
@@ -98,10 +95,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
|
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
|
||||||
if(sector.Length < Marshal.SizeOf(f2fsSb)) return;
|
if(sector.Length < Marshal.SizeOf(f2fsSb)) return;
|
||||||
|
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(f2fsSb));
|
f2fsSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<F2FS_Superblock>(sector);
|
||||||
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(f2fsSb));
|
|
||||||
f2fsSb = (F2FS_Superblock)Marshal.PtrToStructure(sbPtr, typeof(F2FS_Superblock));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
if(f2fsSb.magic != F2FS_MAGIC) return;
|
if(f2fsSb.magic != F2FS_MAGIC) return;
|
||||||
|
|
||||||
|
|||||||
@@ -516,43 +516,17 @@ namespace DiscImageChef.Filesystems
|
|||||||
|
|
||||||
if(imagePlugin.Info.SectorSize >= 256 && !useHumanBpb)
|
if(imagePlugin.Info.SectorSize >= 256 && !useHumanBpb)
|
||||||
{
|
{
|
||||||
IntPtr bpbPtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(512);
|
atariBpb = Helpers.Marshal.ByteArrayToStructureLittleEndian<AtariParameterBlock>(bpbSector);
|
||||||
System.Runtime.InteropServices.Marshal.Copy(bpbSector, 0, bpbPtr, 512);
|
msxBpb = Helpers.Marshal.ByteArrayToStructureLittleEndian<MsxParameterBlock>(bpbSector);
|
||||||
|
dos2Bpb = Helpers.Marshal.ByteArrayToStructureLittleEndian<BiosParameterBlock2>(bpbSector);
|
||||||
atariBpb =
|
dos30Bpb = Helpers.Marshal.ByteArrayToStructureLittleEndian<BiosParameterBlock30>(bpbSector);
|
||||||
(AtariParameterBlock)
|
dos32Bpb = Helpers.Marshal.ByteArrayToStructureLittleEndian<BiosParameterBlock32>(bpbSector);
|
||||||
System.Runtime.InteropServices.Marshal.PtrToStructure(bpbPtr, typeof(AtariParameterBlock));
|
dos33Bpb = Helpers.Marshal.ByteArrayToStructureLittleEndian<BiosParameterBlock33>(bpbSector);
|
||||||
msxBpb =
|
shortEbpb = Helpers.Marshal.ByteArrayToStructureLittleEndian<BiosParameterBlockShortEbpb>(bpbSector);
|
||||||
(MsxParameterBlock)
|
ebpb = Helpers.Marshal.ByteArrayToStructureLittleEndian<BiosParameterBlockEbpb>(bpbSector);
|
||||||
System.Runtime.InteropServices.Marshal.PtrToStructure(bpbPtr, typeof(MsxParameterBlock));
|
shortFat32Bpb = Helpers.Marshal.ByteArrayToStructureLittleEndian<Fat32ParameterBlockShort>(bpbSector);
|
||||||
dos2Bpb =
|
fat32Bpb = Helpers.Marshal.ByteArrayToStructureLittleEndian<Fat32ParameterBlock>(bpbSector);
|
||||||
(BiosParameterBlock2)
|
apricotBpb = Helpers.Marshal.ByteArrayToStructureLittleEndian<ApricotLabel>(bpbSector);
|
||||||
System.Runtime.InteropServices.Marshal.PtrToStructure(bpbPtr, typeof(BiosParameterBlock2));
|
|
||||||
dos30Bpb =
|
|
||||||
(BiosParameterBlock30)
|
|
||||||
System.Runtime.InteropServices.Marshal.PtrToStructure(bpbPtr, typeof(BiosParameterBlock30));
|
|
||||||
dos32Bpb =
|
|
||||||
(BiosParameterBlock32)
|
|
||||||
System.Runtime.InteropServices.Marshal.PtrToStructure(bpbPtr, typeof(BiosParameterBlock32));
|
|
||||||
dos33Bpb =
|
|
||||||
(BiosParameterBlock33)
|
|
||||||
System.Runtime.InteropServices.Marshal.PtrToStructure(bpbPtr, typeof(BiosParameterBlock33));
|
|
||||||
shortEbpb =
|
|
||||||
(BiosParameterBlockShortEbpb)
|
|
||||||
System.Runtime.InteropServices.Marshal.PtrToStructure(bpbPtr, typeof(BiosParameterBlockShortEbpb));
|
|
||||||
ebpb =
|
|
||||||
(BiosParameterBlockEbpb)
|
|
||||||
System.Runtime.InteropServices.Marshal.PtrToStructure(bpbPtr, typeof(BiosParameterBlockEbpb));
|
|
||||||
shortFat32Bpb =
|
|
||||||
(Fat32ParameterBlockShort)
|
|
||||||
System.Runtime.InteropServices.Marshal.PtrToStructure(bpbPtr, typeof(Fat32ParameterBlockShort));
|
|
||||||
fat32Bpb =
|
|
||||||
(Fat32ParameterBlock)
|
|
||||||
System.Runtime.InteropServices.Marshal.PtrToStructure(bpbPtr, typeof(Fat32ParameterBlock));
|
|
||||||
apricotBpb =
|
|
||||||
(ApricotLabel)System.Runtime.InteropServices.Marshal.PtrToStructure(bpbPtr, typeof(ApricotLabel));
|
|
||||||
|
|
||||||
System.Runtime.InteropServices.Marshal.FreeHGlobal(bpbPtr);
|
|
||||||
|
|
||||||
int bitsInBpsAtari = CountBits.Count(atariBpb.bps);
|
int bitsInBpsAtari = CountBits.Count(atariBpb.bps);
|
||||||
int bitsInBpsMsx = CountBits.Count(msxBpb.bps);
|
int bitsInBpsMsx = CountBits.Count(msxBpb.bps);
|
||||||
@@ -1122,12 +1096,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
if(fat32Bpb.fsinfo_sector + partition.Start <= partition.End)
|
if(fat32Bpb.fsinfo_sector + partition.Start <= partition.End)
|
||||||
{
|
{
|
||||||
byte[] fsinfoSector = imagePlugin.ReadSector(fat32Bpb.fsinfo_sector + partition.Start);
|
byte[] fsinfoSector = imagePlugin.ReadSector(fat32Bpb.fsinfo_sector + partition.Start);
|
||||||
IntPtr fsinfoPtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(512);
|
FsInfoSector fsInfo = Helpers.Marshal.ByteArrayToStructureLittleEndian<FsInfoSector>(fsinfoSector);
|
||||||
System.Runtime.InteropServices.Marshal.Copy(fsinfoSector, 0, fsinfoPtr, 512);
|
|
||||||
FsInfoSector fsInfo =
|
|
||||||
(FsInfoSector)
|
|
||||||
System.Runtime.InteropServices.Marshal.PtrToStructure(fsinfoPtr, typeof(FsInfoSector));
|
|
||||||
System.Runtime.InteropServices.Marshal.FreeHGlobal(fsinfoPtr);
|
|
||||||
|
|
||||||
if(fsInfo.signature1 == FSINFO_SIGNATURE1 && fsInfo.signature2 == FSINFO_SIGNATURE2 &&
|
if(fsInfo.signature1 == FSINFO_SIGNATURE1 && fsInfo.signature2 == FSINFO_SIGNATURE2 &&
|
||||||
fsInfo.signature3 == FSINFO_SIGNATURE3)
|
fsInfo.signature3 == FSINFO_SIGNATURE3)
|
||||||
@@ -1560,12 +1529,8 @@ namespace DiscImageChef.Filesystems
|
|||||||
// Not a volume label
|
// Not a volume label
|
||||||
if(rootDirectory[i + 0x0B] != 0x08 && rootDirectory[i + 0x0B] != 0x28) continue;
|
if(rootDirectory[i + 0x0B] != 0x08 && rootDirectory[i + 0x0B] != 0x28) continue;
|
||||||
|
|
||||||
IntPtr entryPtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(32);
|
|
||||||
System.Runtime.InteropServices.Marshal.Copy(rootDirectory, i, entryPtr, 32);
|
|
||||||
DirectoryEntry entry =
|
DirectoryEntry entry =
|
||||||
(DirectoryEntry)
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<DirectoryEntry>(rootDirectory, i, 32);
|
||||||
System.Runtime.InteropServices.Marshal.PtrToStructure(entryPtr, typeof(DirectoryEntry));
|
|
||||||
System.Runtime.InteropServices.Marshal.FreeHGlobal(entryPtr);
|
|
||||||
|
|
||||||
byte[] fullname = new byte[11];
|
byte[] fullname = new byte[11];
|
||||||
Array.Copy(entry.filename, 0, fullname, 0, 8);
|
Array.Copy(entry.filename, 0, fullname, 0, 8);
|
||||||
|
|||||||
@@ -205,10 +205,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
// Fun with seeking follows on superblock reading!
|
// Fun with seeking follows on superblock reading!
|
||||||
ufs_sb_sectors = imagePlugin.ReadSectors(sb_offset, sb_size_in_sectors);
|
ufs_sb_sectors = imagePlugin.ReadSectors(sb_offset, sb_size_in_sectors);
|
||||||
|
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(ufs_sb_sectors.Length);
|
UFSSuperBlock ufs_sb = Helpers.Marshal.ByteArrayToStructureLittleEndian<UFSSuperBlock>(ufs_sb_sectors);
|
||||||
Marshal.Copy(ufs_sb_sectors, 0, sbPtr, ufs_sb_sectors.Length);
|
|
||||||
UFSSuperBlock ufs_sb = (UFSSuperBlock)Marshal.PtrToStructure(sbPtr, typeof(UFSSuperBlock));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
UFSSuperBlock bs_sfu = Helpers.Marshal.ByteArrayToStructureBigEndian<UFSSuperBlock>(ufs_sb_sectors);
|
UFSSuperBlock bs_sfu = Helpers.Marshal.ByteArrayToStructureBigEndian<UFSSuperBlock>(ufs_sb_sectors);
|
||||||
if(bs_sfu.fs_magic == UFS_MAGIC && ufs_sb.fs_magic == UFS_CIGAM ||
|
if(bs_sfu.fs_magic == UFS_MAGIC && ufs_sb.fs_magic == UFS_CIGAM ||
|
||||||
|
|||||||
@@ -93,10 +93,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
|
|
||||||
if(magic == HAMMER_FSBUF_VOLUME)
|
if(magic == HAMMER_FSBUF_VOLUME)
|
||||||
{
|
{
|
||||||
GCHandle handle = GCHandle.Alloc(sbSector, GCHandleType.Pinned);
|
hammerSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<HammerSuperBlock>(sbSector);
|
||||||
hammerSb = (HammerSuperBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(),
|
|
||||||
typeof(HammerSuperBlock));
|
|
||||||
handle.Free();
|
|
||||||
}
|
}
|
||||||
else hammerSb = Helpers.Marshal.ByteArrayToStructureBigEndian<HammerSuperBlock>(sbSector);
|
else hammerSb = Helpers.Marshal.ByteArrayToStructureBigEndian<HammerSuperBlock>(sbSector);
|
||||||
|
|
||||||
|
|||||||
@@ -76,21 +76,12 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] hpfsSpSector =
|
byte[] hpfsSpSector =
|
||||||
imagePlugin.ReadSector(17 + partition.Start); // Seek to spareblock, on logical sector 17
|
imagePlugin.ReadSector(17 + partition.Start); // Seek to spareblock, on logical sector 17
|
||||||
|
|
||||||
IntPtr bpbPtr = Marshal.AllocHGlobal(512);
|
|
||||||
Marshal.Copy(hpfsBpbSector, 0, bpbPtr, 512);
|
|
||||||
HpfsBiosParameterBlock hpfsBpb =
|
HpfsBiosParameterBlock hpfsBpb =
|
||||||
(HpfsBiosParameterBlock)Marshal.PtrToStructure(bpbPtr, typeof(HpfsBiosParameterBlock));
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<HpfsBiosParameterBlock>(hpfsBpbSector);
|
||||||
Marshal.FreeHGlobal(bpbPtr);
|
|
||||||
|
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(512);
|
HpfsSuperBlock hpfsSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<HpfsSuperBlock>(hpfsSbSector);
|
||||||
Marshal.Copy(hpfsSbSector, 0, sbPtr, 512);
|
|
||||||
HpfsSuperBlock hpfsSb = (HpfsSuperBlock)Marshal.PtrToStructure(sbPtr, typeof(HpfsSuperBlock));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
IntPtr spPtr = Marshal.AllocHGlobal(512);
|
HpfsSpareBlock hpfsSp = Helpers.Marshal.ByteArrayToStructureLittleEndian<HpfsSpareBlock>(hpfsSpSector);
|
||||||
Marshal.Copy(hpfsSpSector, 0, spPtr, 512);
|
|
||||||
HpfsSpareBlock hpfsSp = (HpfsSpareBlock)Marshal.PtrToStructure(spPtr, typeof(HpfsSpareBlock));
|
|
||||||
Marshal.FreeHGlobal(spPtr);
|
|
||||||
|
|
||||||
if(StringHandlers.CToString(hpfsBpb.fs_type) != "HPFS " || hpfsSb.magic1 != 0xF995E849 ||
|
if(StringHandlers.CToString(hpfsBpb.fs_type) != "HPFS " || hpfsSb.magic1 != 0xF995E849 ||
|
||||||
hpfsSb.magic2 != 0xFA53E9C5 || hpfsSp.magic1 != 0xF9911849 ||
|
hpfsSb.magic2 != 0xFA53E9C5 || hpfsSp.magic1 != 0xF9911849 ||
|
||||||
|
|||||||
@@ -65,10 +65,8 @@ namespace DiscImageChef.Filesystems
|
|||||||
|
|
||||||
if(hpofsBpbSector.Length < 512) return false;
|
if(hpofsBpbSector.Length < 512) return false;
|
||||||
|
|
||||||
IntPtr bpbPtr = Marshal.AllocHGlobal(512);
|
BiosParameterBlock bpb =
|
||||||
Marshal.Copy(hpofsBpbSector, 0, bpbPtr, 512);
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<BiosParameterBlock>(hpofsBpbSector);
|
||||||
BiosParameterBlock bpb = (BiosParameterBlock)Marshal.PtrToStructure(bpbPtr, typeof(BiosParameterBlock));
|
|
||||||
Marshal.FreeHGlobal(bpbPtr);
|
|
||||||
|
|
||||||
return bpb.fs_type.SequenceEqual(hpofsType);
|
return bpb.fs_type.SequenceEqual(hpofsType);
|
||||||
}
|
}
|
||||||
@@ -88,11 +86,8 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] volInfoSector =
|
byte[] volInfoSector =
|
||||||
imagePlugin.ReadSector(14 + partition.Start); // Seek to volume information block, on logical sector 14
|
imagePlugin.ReadSector(14 + partition.Start); // Seek to volume information block, on logical sector 14
|
||||||
|
|
||||||
IntPtr bpbPtr = Marshal.AllocHGlobal(512);
|
BiosParameterBlock bpb =
|
||||||
Marshal.Copy(hpofsBpbSector, 0, bpbPtr, 512);
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<BiosParameterBlock>(hpofsBpbSector);
|
||||||
BiosParameterBlock bpb = (BiosParameterBlock)Marshal.PtrToStructure(bpbPtr, typeof(BiosParameterBlock));
|
|
||||||
Marshal.FreeHGlobal(bpbPtr);
|
|
||||||
|
|
||||||
MediaInformationBlock mib =
|
MediaInformationBlock mib =
|
||||||
Helpers.Marshal.ByteArrayToStructureBigEndian<MediaInformationBlock>(medInfoSector);
|
Helpers.Marshal.ByteArrayToStructureBigEndian<MediaInformationBlock>(medInfoSector);
|
||||||
VolumeInformationBlock vib =
|
VolumeInformationBlock vib =
|
||||||
|
|||||||
@@ -148,20 +148,15 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
IntPtr ptr = Marshal.AllocHGlobal(2048);
|
bvd = Helpers.Marshal.ByteArrayToStructureLittleEndian<BootRecord>(vdSector, hsOff, 2048 - hsOff);
|
||||||
Marshal.Copy(vdSector, hsOff, ptr, 2048 - hsOff);
|
|
||||||
bvd = (BootRecord)Marshal.PtrToStructure(ptr, typeof(BootRecord));
|
|
||||||
Marshal.FreeHGlobal(ptr);
|
|
||||||
|
|
||||||
bootSpec = "Unknown";
|
bootSpec = "Unknown";
|
||||||
|
|
||||||
if(Encoding.GetString(bvd.Value.system_id).Substring(0, 23) == "EL TORITO SPECIFICATION")
|
if(Encoding.GetString(bvd.Value.system_id).Substring(0, 23) == "EL TORITO SPECIFICATION")
|
||||||
{
|
{
|
||||||
bootSpec = "El Torito";
|
bootSpec = "El Torito";
|
||||||
ptr = Marshal.AllocHGlobal(2048);
|
torito = Helpers
|
||||||
Marshal.Copy(vdSector, hsOff, ptr, 2048 - hsOff);
|
.Marshal.ByteArrayToStructureLittleEndian<ElToritoBootRecord>(vdSector, hsOff, 2048 - hsOff);
|
||||||
torito = (ElToritoBootRecord)Marshal.PtrToStructure(ptr, typeof(ElToritoBootRecord));
|
|
||||||
Marshal.FreeHGlobal(ptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -170,33 +165,24 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
{
|
{
|
||||||
if(highSierra)
|
if(highSierra)
|
||||||
{
|
{
|
||||||
IntPtr ptr = Marshal.AllocHGlobal(2048);
|
|
||||||
Marshal.Copy(vdSector, 0, ptr, 2048);
|
|
||||||
hsvd =
|
hsvd =
|
||||||
(HighSierraPrimaryVolumeDescriptor)
|
Helpers.Marshal
|
||||||
Marshal.PtrToStructure(ptr, typeof(HighSierraPrimaryVolumeDescriptor));
|
.ByteArrayToStructureLittleEndian<HighSierraPrimaryVolumeDescriptor>(vdSector);
|
||||||
Marshal.FreeHGlobal(ptr);
|
|
||||||
}
|
}
|
||||||
else if(cdi)
|
else if(cdi)
|
||||||
fsvd =
|
fsvd =
|
||||||
Helpers.Marshal.ByteArrayToStructureBigEndian<FileStructureVolumeDescriptor>(vdSector);
|
Helpers.Marshal.ByteArrayToStructureBigEndian<FileStructureVolumeDescriptor>(vdSector);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IntPtr ptr = Marshal.AllocHGlobal(2048);
|
pvd = Helpers.Marshal.ByteArrayToStructureLittleEndian<PrimaryVolumeDescriptor>(vdSector);
|
||||||
Marshal.Copy(vdSector, 0, ptr, 2048);
|
|
||||||
pvd = (PrimaryVolumeDescriptor)Marshal.PtrToStructure(ptr, typeof(PrimaryVolumeDescriptor));
|
|
||||||
Marshal.FreeHGlobal(ptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
IntPtr ptr = Marshal.AllocHGlobal(2048);
|
|
||||||
Marshal.Copy(vdSector, 0, ptr, 2048);
|
|
||||||
PrimaryVolumeDescriptor svd =
|
PrimaryVolumeDescriptor svd =
|
||||||
(PrimaryVolumeDescriptor)Marshal.PtrToStructure(ptr, typeof(PrimaryVolumeDescriptor));
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<PrimaryVolumeDescriptor>(vdSector);
|
||||||
Marshal.FreeHGlobal(ptr);
|
|
||||||
|
|
||||||
// Check if this is Joliet
|
// Check if this is Joliet
|
||||||
if(svd.escape_sequences[0] == '%' && svd.escape_sequences[1] == '/')
|
if(svd.escape_sequences[0] == '%' && svd.escape_sequences[1] == '/')
|
||||||
@@ -273,11 +259,9 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
// Walk thru root directory to see system area extensions in use
|
// Walk thru root directory to see system area extensions in use
|
||||||
while(rootOff + Marshal.SizeOf(typeof(DirectoryRecord)) < rootDir.Length && !cdi)
|
while(rootOff + Marshal.SizeOf(typeof(DirectoryRecord)) < rootDir.Length && !cdi)
|
||||||
{
|
{
|
||||||
DirectoryRecord record = new DirectoryRecord();
|
DirectoryRecord record =
|
||||||
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(record));
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<DirectoryRecord>(rootDir, rootOff,
|
||||||
Marshal.Copy(rootDir, rootOff, ptr, Marshal.SizeOf(record));
|
Marshal.SizeOf(typeof(DirectoryRecord)));
|
||||||
record = (DirectoryRecord)Marshal.PtrToStructure(ptr, typeof(DirectoryRecord));
|
|
||||||
Marshal.FreeHGlobal(ptr);
|
|
||||||
|
|
||||||
int saOff = Marshal.SizeOf(record) + record.name_len;
|
int saOff = Marshal.SizeOf(record) + record.name_len;
|
||||||
saOff += saOff % 2;
|
saOff += saOff % 2;
|
||||||
@@ -570,21 +554,18 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
|
|
||||||
if(vdSector[toritoOff] != 1) goto exit_torito;
|
if(vdSector[toritoOff] != 1) goto exit_torito;
|
||||||
|
|
||||||
IntPtr ptr = Marshal.AllocHGlobal(EL_TORITO_ENTRY_SIZE);
|
|
||||||
Marshal.Copy(vdSector, toritoOff, ptr, EL_TORITO_ENTRY_SIZE);
|
|
||||||
ElToritoValidationEntry valentry =
|
ElToritoValidationEntry valentry =
|
||||||
(ElToritoValidationEntry)Marshal.PtrToStructure(ptr, typeof(ElToritoValidationEntry));
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<ElToritoValidationEntry>(vdSector, toritoOff,
|
||||||
Marshal.FreeHGlobal(ptr);
|
EL_TORITO_ENTRY_SIZE);
|
||||||
|
|
||||||
if(valentry.signature != EL_TORITO_MAGIC) goto exit_torito;
|
if(valentry.signature != EL_TORITO_MAGIC) goto exit_torito;
|
||||||
|
|
||||||
toritoOff += EL_TORITO_ENTRY_SIZE;
|
toritoOff += EL_TORITO_ENTRY_SIZE;
|
||||||
|
|
||||||
ptr = Marshal.AllocHGlobal(EL_TORITO_ENTRY_SIZE);
|
|
||||||
Marshal.Copy(vdSector, toritoOff, ptr, EL_TORITO_ENTRY_SIZE);
|
|
||||||
ElToritoInitialEntry initialEntry =
|
ElToritoInitialEntry initialEntry =
|
||||||
(ElToritoInitialEntry)Marshal.PtrToStructure(ptr, typeof(ElToritoInitialEntry));
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<ElToritoInitialEntry>(vdSector, toritoOff,
|
||||||
Marshal.FreeHGlobal(ptr);
|
EL_TORITO_ENTRY_SIZE);
|
||||||
|
|
||||||
initialEntry.boot_type = (ElToritoEmulation)((byte)initialEntry.boot_type & 0xF);
|
initialEntry.boot_type = (ElToritoEmulation)((byte)initialEntry.boot_type & 0xF);
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("DEBUG (ISO9660 plugin)", "initialEntry.load_rba = {0}",
|
DicConsole.DebugWriteLine("DEBUG (ISO9660 plugin)", "initialEntry.load_rba = {0}",
|
||||||
@@ -649,11 +630,9 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
while(toritoOff < vdSector.Length && (vdSector[toritoOff] == (byte)ElToritoIndicator.Header ||
|
while(toritoOff < vdSector.Length && (vdSector[toritoOff] == (byte)ElToritoIndicator.Header ||
|
||||||
vdSector[toritoOff] == (byte)ElToritoIndicator.LastHeader))
|
vdSector[toritoOff] == (byte)ElToritoIndicator.LastHeader))
|
||||||
{
|
{
|
||||||
ptr = Marshal.AllocHGlobal(EL_TORITO_ENTRY_SIZE);
|
|
||||||
Marshal.Copy(vdSector, toritoOff, ptr, EL_TORITO_ENTRY_SIZE);
|
|
||||||
ElToritoSectionHeaderEntry sectionHeader =
|
ElToritoSectionHeaderEntry sectionHeader =
|
||||||
(ElToritoSectionHeaderEntry)Marshal.PtrToStructure(ptr, typeof(ElToritoSectionHeaderEntry));
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<ElToritoSectionHeaderEntry>(vdSector, toritoOff,
|
||||||
Marshal.FreeHGlobal(ptr);
|
EL_TORITO_ENTRY_SIZE);
|
||||||
toritoOff += EL_TORITO_ENTRY_SIZE;
|
toritoOff += EL_TORITO_ENTRY_SIZE;
|
||||||
|
|
||||||
isoMetadata.AppendFormat("Boot section {0}:", SECTION_COUNTER);
|
isoMetadata.AppendFormat("Boot section {0}:", SECTION_COUNTER);
|
||||||
@@ -663,11 +642,9 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
for(int entryCounter = 1; entryCounter <= sectionHeader.entries && toritoOff < vdSector.Length;
|
for(int entryCounter = 1; entryCounter <= sectionHeader.entries && toritoOff < vdSector.Length;
|
||||||
entryCounter++)
|
entryCounter++)
|
||||||
{
|
{
|
||||||
ptr = Marshal.AllocHGlobal(EL_TORITO_ENTRY_SIZE);
|
|
||||||
Marshal.Copy(vdSector, toritoOff, ptr, EL_TORITO_ENTRY_SIZE);
|
|
||||||
ElToritoSectionEntry sectionEntry =
|
ElToritoSectionEntry sectionEntry =
|
||||||
(ElToritoSectionEntry)Marshal.PtrToStructure(ptr, typeof(ElToritoSectionEntry));
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<ElToritoSectionEntry>(vdSector, toritoOff,
|
||||||
Marshal.FreeHGlobal(ptr);
|
EL_TORITO_ENTRY_SIZE);
|
||||||
toritoOff += EL_TORITO_ENTRY_SIZE;
|
toritoOff += EL_TORITO_ENTRY_SIZE;
|
||||||
|
|
||||||
isoMetadata.AppendFormat("\tEntry {0}:", entryCounter);
|
isoMetadata.AppendFormat("\tEntry {0}:", entryCounter);
|
||||||
@@ -731,12 +708,9 @@ namespace DiscImageChef.Filesystems.ISO9660
|
|||||||
|
|
||||||
while(toritoOff < vdSector.Length)
|
while(toritoOff < vdSector.Length)
|
||||||
{
|
{
|
||||||
ptr = Marshal.AllocHGlobal(EL_TORITO_ENTRY_SIZE);
|
|
||||||
Marshal.Copy(vdSector, toritoOff, ptr, EL_TORITO_ENTRY_SIZE);
|
|
||||||
ElToritoSectionEntryExtension sectionExtension =
|
ElToritoSectionEntryExtension sectionExtension =
|
||||||
(ElToritoSectionEntryExtension)
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<ElToritoSectionEntryExtension>(vdSector, toritoOff,
|
||||||
Marshal.PtrToStructure(ptr, typeof(ElToritoSectionEntryExtension));
|
EL_TORITO_ENTRY_SIZE);
|
||||||
Marshal.FreeHGlobal(ptr);
|
|
||||||
toritoOff += EL_TORITO_ENTRY_SIZE;
|
toritoOff += EL_TORITO_ENTRY_SIZE;
|
||||||
|
|
||||||
if(!sectionExtension.extension_flags.HasFlag(ElToritoFlags.Continued)) break;
|
if(!sectionExtension.extension_flags.HasFlag(ElToritoFlags.Continued)) break;
|
||||||
|
|||||||
@@ -58,11 +58,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] sector = imagePlugin.ReadSector(partition.Start + bootSectors);
|
byte[] sector = imagePlugin.ReadSector(partition.Start + bootSectors);
|
||||||
if(sector.Length < 512) return false;
|
if(sector.Length < 512) return false;
|
||||||
|
|
||||||
JfsSuperBlock jfsSb = new JfsSuperBlock();
|
JfsSuperBlock jfsSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<JfsSuperBlock>(sector);
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(jfsSb));
|
|
||||||
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(jfsSb));
|
|
||||||
jfsSb = (JfsSuperBlock)Marshal.PtrToStructure(sbPtr, typeof(JfsSuperBlock));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
return jfsSb.s_magic == JFS_MAGIC;
|
return jfsSb.s_magic == JFS_MAGIC;
|
||||||
}
|
}
|
||||||
@@ -77,11 +73,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] sector = imagePlugin.ReadSector(partition.Start + bootSectors);
|
byte[] sector = imagePlugin.ReadSector(partition.Start + bootSectors);
|
||||||
if(sector.Length < 512) return;
|
if(sector.Length < 512) return;
|
||||||
|
|
||||||
JfsSuperBlock jfsSb = new JfsSuperBlock();
|
JfsSuperBlock jfsSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<JfsSuperBlock>(sector);
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(jfsSb));
|
|
||||||
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(jfsSb));
|
|
||||||
jfsSb = (JfsSuperBlock)Marshal.PtrToStructure(sbPtr, typeof(JfsSuperBlock));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
sb.AppendLine("JFS filesystem");
|
sb.AppendLine("JFS filesystem");
|
||||||
sb.AppendFormat("Version {0}", jfsSb.s_version).AppendLine();
|
sb.AppendFormat("Version {0}", jfsSb.s_version).AppendLine();
|
||||||
|
|||||||
@@ -89,10 +89,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] sector = imagePlugin.ReadSectors(partition.Start + location, sbSize);
|
byte[] sector = imagePlugin.ReadSectors(partition.Start + location, sbSize);
|
||||||
if(sector.Length < Marshal.SizeOf(locusSb)) return false;
|
if(sector.Length < Marshal.SizeOf(locusSb)) return false;
|
||||||
|
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(locusSb));
|
locusSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<Locus_Superblock>(sector);
|
||||||
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(locusSb));
|
|
||||||
locusSb = (Locus_Superblock)Marshal.PtrToStructure(sbPtr, typeof(Locus_Superblock));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("Locus plugin", "magic at {1} = 0x{0:X8}", locusSb.s_magic, location);
|
DicConsole.DebugWriteLine("Locus plugin", "magic at {1} = 0x{0:X8}", locusSb.s_magic, location);
|
||||||
|
|
||||||
@@ -121,10 +118,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
sector = imagePlugin.ReadSectors(partition.Start + location, sbSize);
|
sector = imagePlugin.ReadSectors(partition.Start + location, sbSize);
|
||||||
if(sector.Length < Marshal.SizeOf(locusSb)) return;
|
if(sector.Length < Marshal.SizeOf(locusSb)) return;
|
||||||
|
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(locusSb));
|
locusSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<Locus_Superblock>(sector);
|
||||||
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(locusSb));
|
|
||||||
locusSb = (Locus_Superblock)Marshal.PtrToStructure(sbPtr, typeof(Locus_Superblock));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
if(locusSb.s_magic == LOCUS_MAGIC || locusSb.s_magic == LOCUS_CIGAM ||
|
if(locusSb.s_magic == LOCUS_MAGIC || locusSb.s_magic == LOCUS_CIGAM ||
|
||||||
locusSb.s_magic == LOCUS_MAGIC_OLD || locusSb.s_magic == LOCUS_CIGAM_OLD) break;
|
locusSb.s_magic == LOCUS_MAGIC_OLD || locusSb.s_magic == LOCUS_CIGAM_OLD) break;
|
||||||
|
|||||||
@@ -60,10 +60,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
|
|
||||||
byte[] bk0 = imagePlugin.ReadSector(0 + partition.Start);
|
byte[] bk0 = imagePlugin.ReadSector(0 + partition.Start);
|
||||||
|
|
||||||
GCHandle handle = GCHandle.Alloc(bk0, GCHandleType.Pinned);
|
MicroDosBlock0 block0 = Helpers.Marshal.ByteArrayToStructureLittleEndian<MicroDosBlock0>(bk0);
|
||||||
MicroDosBlock0 block0 =
|
|
||||||
(MicroDosBlock0)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(MicroDosBlock0));
|
|
||||||
handle.Free();
|
|
||||||
|
|
||||||
return block0.label == MAGIC && block0.mklabel == MAGIC2;
|
return block0.label == MAGIC && block0.mklabel == MAGIC2;
|
||||||
}
|
}
|
||||||
@@ -78,10 +75,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
|
|
||||||
byte[] bk0 = imagePlugin.ReadSector(0 + partition.Start);
|
byte[] bk0 = imagePlugin.ReadSector(0 + partition.Start);
|
||||||
|
|
||||||
GCHandle handle = GCHandle.Alloc(bk0, GCHandleType.Pinned);
|
MicroDosBlock0 block0 = Helpers.Marshal.ByteArrayToStructureLittleEndian<MicroDosBlock0>(bk0);
|
||||||
MicroDosBlock0 block0 =
|
|
||||||
(MicroDosBlock0)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(MicroDosBlock0));
|
|
||||||
handle.Free();
|
|
||||||
|
|
||||||
sb.AppendLine("MicroDOS filesystem");
|
sb.AppendLine("MicroDOS filesystem");
|
||||||
sb.AppendFormat("Volume has {0} blocks ({1} bytes)", block0.blocks, block0.blocks * 512).AppendLine();
|
sb.AppendFormat("Volume has {0} blocks ({1} bytes)", block0.blocks, block0.blocks * 512).AppendLine();
|
||||||
|
|||||||
@@ -232,10 +232,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
|
|
||||||
if(littleEndian)
|
if(littleEndian)
|
||||||
{
|
{
|
||||||
GCHandle handle = GCHandle.Alloc(minixSbSector, GCHandleType.Pinned);
|
mnxSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<Minix3SuperBlock>(minixSbSector);
|
||||||
mnxSb = (Minix3SuperBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(),
|
|
||||||
typeof(Minix3SuperBlock));
|
|
||||||
handle.Free();
|
|
||||||
}
|
}
|
||||||
else mnxSb = Helpers.Marshal.ByteArrayToStructureBigEndian<Minix3SuperBlock>(minixSbSector);
|
else mnxSb = Helpers.Marshal.ByteArrayToStructureBigEndian<Minix3SuperBlock>(minixSbSector);
|
||||||
|
|
||||||
@@ -269,11 +266,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
|
|
||||||
if(littleEndian)
|
if(littleEndian)
|
||||||
{
|
{
|
||||||
GCHandle handle = GCHandle.Alloc(minixSbSector, GCHandleType.Pinned);
|
mnxSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<MinixSuperBlock>(minixSbSector); }
|
||||||
mnxSb = (MinixSuperBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(),
|
|
||||||
typeof(MinixSuperBlock));
|
|
||||||
handle.Free();
|
|
||||||
}
|
|
||||||
else mnxSb = Helpers.Marshal.ByteArrayToStructureBigEndian<MinixSuperBlock>(minixSbSector);
|
else mnxSb = Helpers.Marshal.ByteArrayToStructureBigEndian<MinixSuperBlock>(minixSbSector);
|
||||||
|
|
||||||
sb.AppendLine(minixVersion);
|
sb.AppendLine(minixVersion);
|
||||||
|
|||||||
@@ -67,10 +67,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
|
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
|
||||||
if(sector.Length < Marshal.SizeOf(nilfsSb)) return false;
|
if(sector.Length < Marshal.SizeOf(nilfsSb)) return false;
|
||||||
|
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(nilfsSb));
|
nilfsSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<NILFS2_Superblock>(sector);
|
||||||
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(nilfsSb));
|
|
||||||
nilfsSb = (NILFS2_Superblock)Marshal.PtrToStructure(sbPtr, typeof(NILFS2_Superblock));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
return nilfsSb.magic == NILFS2_MAGIC;
|
return nilfsSb.magic == NILFS2_MAGIC;
|
||||||
}
|
}
|
||||||
@@ -93,10 +90,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
|
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
|
||||||
if(sector.Length < Marshal.SizeOf(nilfsSb)) return;
|
if(sector.Length < Marshal.SizeOf(nilfsSb)) return;
|
||||||
|
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(nilfsSb));
|
nilfsSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<NILFS2_Superblock>(sector);
|
||||||
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(nilfsSb));
|
|
||||||
nilfsSb = (NILFS2_Superblock)Marshal.PtrToStructure(sbPtr, typeof(NILFS2_Superblock));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
if(nilfsSb.magic != NILFS2_MAGIC) return;
|
if(nilfsSb.magic != NILFS2_MAGIC) return;
|
||||||
|
|
||||||
|
|||||||
@@ -82,10 +82,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
|
|
||||||
byte[] ntfsBpb = imagePlugin.ReadSector(0 + partition.Start);
|
byte[] ntfsBpb = imagePlugin.ReadSector(0 + partition.Start);
|
||||||
|
|
||||||
IntPtr bpbPtr = Marshal.AllocHGlobal(512);
|
NtfsBootBlock ntfsBb = Helpers.Marshal.ByteArrayToStructureLittleEndian<NtfsBootBlock>(ntfsBpb);
|
||||||
Marshal.Copy(ntfsBpb, 0, bpbPtr, 512);
|
|
||||||
NtfsBootBlock ntfsBb = (NtfsBootBlock)Marshal.PtrToStructure(bpbPtr, typeof(NtfsBootBlock));
|
|
||||||
Marshal.FreeHGlobal(bpbPtr);
|
|
||||||
|
|
||||||
sb.AppendFormat("{0} bytes per sector", ntfsBb.bps).AppendLine();
|
sb.AppendFormat("{0} bytes per sector", ntfsBb.bps).AppendLine();
|
||||||
sb.AppendFormat("{0} sectors per cluster ({1} bytes)", ntfsBb.spc, ntfsBb.spc * ntfsBb.bps).AppendLine();
|
sb.AppendFormat("{0} sectors per cluster ({1} bytes)", ntfsBb.spc, ntfsBb.spc * ntfsBb.bps).AppendLine();
|
||||||
|
|||||||
@@ -99,10 +99,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
|
|
||||||
byte[] hbSector = imagePlugin.ReadSector(1 + partition.Start);
|
byte[] hbSector = imagePlugin.ReadSector(1 + partition.Start);
|
||||||
|
|
||||||
GCHandle handle = GCHandle.Alloc(hbSector, GCHandleType.Pinned);
|
OdsHomeBlock homeblock = Helpers.Marshal.ByteArrayToStructureLittleEndian<OdsHomeBlock>(hbSector);
|
||||||
OdsHomeBlock homeblock =
|
|
||||||
(OdsHomeBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(OdsHomeBlock));
|
|
||||||
handle.Free();
|
|
||||||
|
|
||||||
// Optical disc
|
// Optical disc
|
||||||
if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc &&
|
if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc &&
|
||||||
@@ -115,9 +112,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
hbSector = new byte[0x200];
|
hbSector = new byte[0x200];
|
||||||
Array.Copy(tmp, 0x200, hbSector, 0, 0x200);
|
Array.Copy(tmp, 0x200, hbSector, 0, 0x200);
|
||||||
|
|
||||||
handle = GCHandle.Alloc(hbSector, GCHandleType.Pinned);
|
homeblock = Helpers.Marshal.ByteArrayToStructureLittleEndian<OdsHomeBlock>(hbSector);
|
||||||
homeblock = (OdsHomeBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(OdsHomeBlock));
|
|
||||||
handle.Free();
|
|
||||||
|
|
||||||
if(StringHandlers.CToString(homeblock.format) != "DECFILE11A " &&
|
if(StringHandlers.CToString(homeblock.format) != "DECFILE11A " &&
|
||||||
StringHandlers.CToString(homeblock.format) != "DECFILE11B ") return;
|
StringHandlers.CToString(homeblock.format) != "DECFILE11B ") return;
|
||||||
|
|||||||
@@ -70,11 +70,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
information = "";
|
information = "";
|
||||||
|
|
||||||
byte[] sector = imagePlugin.ReadSectors(partition.Start, 2);
|
byte[] sector = imagePlugin.ReadSectors(partition.Start, 2);
|
||||||
PcfxHeader header = new PcfxHeader();
|
PcfxHeader header = Helpers.Marshal.ByteArrayToStructureLittleEndian<PcfxHeader>(sector);
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(header));
|
|
||||||
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(header));
|
|
||||||
header = (PcfxHeader)Marshal.PtrToStructure(sbPtr, typeof(PcfxHeader));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
string date;
|
string date;
|
||||||
DateTime dateTime = DateTime.MinValue;
|
DateTime dateTime = DateTime.MinValue;
|
||||||
|
|||||||
@@ -60,10 +60,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] sector = imagePlugin.ReadSector(partition.Start + 1);
|
byte[] sector = imagePlugin.ReadSector(partition.Start + 1);
|
||||||
if(sector.Length < 512) return false;
|
if(sector.Length < 512) return false;
|
||||||
|
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(512);
|
QNX4_Superblock qnxSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<QNX4_Superblock>(sector);
|
||||||
Marshal.Copy(sector, 0, sbPtr, 512);
|
|
||||||
QNX4_Superblock qnxSb = (QNX4_Superblock)Marshal.PtrToStructure(sbPtr, typeof(QNX4_Superblock));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
// Check root directory name
|
// Check root directory name
|
||||||
if(!qnx4_rootDir_fname.SequenceEqual(qnxSb.rootDir.di_fname)) return false;
|
if(!qnx4_rootDir_fname.SequenceEqual(qnxSb.rootDir.di_fname)) return false;
|
||||||
@@ -94,10 +91,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] sector = imagePlugin.ReadSector(partition.Start + 1);
|
byte[] sector = imagePlugin.ReadSector(partition.Start + 1);
|
||||||
if(sector.Length < 512) return;
|
if(sector.Length < 512) return;
|
||||||
|
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(512);
|
QNX4_Superblock qnxSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<QNX4_Superblock>(sector);
|
||||||
Marshal.Copy(sector, 0, sbPtr, 512);
|
|
||||||
QNX4_Superblock qnxSb = (QNX4_Superblock)Marshal.PtrToStructure(sbPtr, typeof(QNX4_Superblock));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
// Too much useless information
|
// Too much useless information
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -62,17 +62,10 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] sector = imagePlugin.ReadSectors(partition.Start + bootSectors, sectors);
|
byte[] sector = imagePlugin.ReadSectors(partition.Start + bootSectors, sectors);
|
||||||
if(sector.Length < QNX6_SUPER_BLOCK_SIZE) return false;
|
if(sector.Length < QNX6_SUPER_BLOCK_SIZE) return false;
|
||||||
|
|
||||||
QNX6_AudiSuperBlock audiSb = new QNX6_AudiSuperBlock();
|
QNX6_AudiSuperBlock audiSb =
|
||||||
IntPtr audiPtr = Marshal.AllocHGlobal(Marshal.SizeOf(audiSb));
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<QNX6_AudiSuperBlock>(audiSector);
|
||||||
Marshal.Copy(audiSector, 0, audiPtr, Marshal.SizeOf(audiSb));
|
|
||||||
audiSb = (QNX6_AudiSuperBlock)Marshal.PtrToStructure(audiPtr, typeof(QNX6_AudiSuperBlock));
|
|
||||||
Marshal.FreeHGlobal(audiPtr);
|
|
||||||
|
|
||||||
QNX6_SuperBlock qnxSb = new QNX6_SuperBlock();
|
QNX6_SuperBlock qnxSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<QNX6_SuperBlock>(sector);
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(qnxSb));
|
|
||||||
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(qnxSb));
|
|
||||||
qnxSb = (QNX6_SuperBlock)Marshal.PtrToStructure(sbPtr, typeof(QNX6_SuperBlock));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
return qnxSb.magic == QNX6_MAGIC || audiSb.magic == QNX6_MAGIC;
|
return qnxSb.magic == QNX6_MAGIC || audiSb.magic == QNX6_MAGIC;
|
||||||
}
|
}
|
||||||
@@ -90,17 +83,10 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] sector = imagePlugin.ReadSectors(partition.Start + bootSectors, sectors);
|
byte[] sector = imagePlugin.ReadSectors(partition.Start + bootSectors, sectors);
|
||||||
if(sector.Length < QNX6_SUPER_BLOCK_SIZE) return;
|
if(sector.Length < QNX6_SUPER_BLOCK_SIZE) return;
|
||||||
|
|
||||||
QNX6_AudiSuperBlock audiSb = new QNX6_AudiSuperBlock();
|
QNX6_AudiSuperBlock audiSb =
|
||||||
IntPtr audiPtr = Marshal.AllocHGlobal(Marshal.SizeOf(audiSb));
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<QNX6_AudiSuperBlock>(audiSector);
|
||||||
Marshal.Copy(audiSector, 0, audiPtr, Marshal.SizeOf(audiSb));
|
|
||||||
audiSb = (QNX6_AudiSuperBlock)Marshal.PtrToStructure(audiPtr, typeof(QNX6_AudiSuperBlock));
|
|
||||||
Marshal.FreeHGlobal(audiPtr);
|
|
||||||
|
|
||||||
QNX6_SuperBlock qnxSb = new QNX6_SuperBlock();
|
QNX6_SuperBlock qnxSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<QNX6_SuperBlock>(sector);
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(qnxSb));
|
|
||||||
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(qnxSb));
|
|
||||||
qnxSb = (QNX6_SuperBlock)Marshal.PtrToStructure(sbPtr, typeof(QNX6_SuperBlock));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
bool audi = audiSb.magic == QNX6_MAGIC;
|
bool audi = audiSb.magic == QNX6_MAGIC;
|
||||||
|
|
||||||
|
|||||||
@@ -76,10 +76,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
|
|
||||||
byte[] hbSector = imagePlugin.ReadSector(1 + partition.Start);
|
byte[] hbSector = imagePlugin.ReadSector(1 + partition.Start);
|
||||||
|
|
||||||
GCHandle handle = GCHandle.Alloc(hbSector, GCHandleType.Pinned);
|
RT11HomeBlock homeblock = Helpers.Marshal.ByteArrayToStructureLittleEndian<RT11HomeBlock>(hbSector);
|
||||||
RT11HomeBlock homeblock =
|
|
||||||
(RT11HomeBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(RT11HomeBlock));
|
|
||||||
handle.Free();
|
|
||||||
|
|
||||||
/* TODO: Is this correct?
|
/* TODO: Is this correct?
|
||||||
* Assembler:
|
* Assembler:
|
||||||
|
|||||||
@@ -63,10 +63,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize);
|
byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize);
|
||||||
if(sector.Length < Marshal.SizeOf(refsVhdr)) return false;
|
if(sector.Length < Marshal.SizeOf(refsVhdr)) return false;
|
||||||
|
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(refsVhdr));
|
refsVhdr = Helpers.Marshal.ByteArrayToStructureLittleEndian<RefsVolumeHeader>(sector);
|
||||||
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(refsVhdr));
|
|
||||||
refsVhdr = (RefsVolumeHeader)Marshal.PtrToStructure(sbPtr, typeof(RefsVolumeHeader));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
return refsVhdr.identifier == FSRS && ArrayHelpers.ArrayIsNullOrEmpty(refsVhdr.mustBeZero) &&
|
return refsVhdr.identifier == FSRS && ArrayHelpers.ArrayIsNullOrEmpty(refsVhdr.mustBeZero) &&
|
||||||
refsVhdr.signature.SequenceEqual(refsSignature);
|
refsVhdr.signature.SequenceEqual(refsSignature);
|
||||||
@@ -87,10 +84,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize);
|
byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize);
|
||||||
if(sector.Length < Marshal.SizeOf(refsVhdr)) return;
|
if(sector.Length < Marshal.SizeOf(refsVhdr)) return;
|
||||||
|
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(refsVhdr));
|
refsVhdr = Helpers.Marshal.ByteArrayToStructureLittleEndian<RefsVolumeHeader>(sector);
|
||||||
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(refsVhdr));
|
|
||||||
refsVhdr = (RefsVolumeHeader)Marshal.PtrToStructure(sbPtr, typeof(RefsVolumeHeader));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("ReFS plugin", "VolumeHeader.jump empty? = {0}",
|
DicConsole.DebugWriteLine("ReFS plugin", "VolumeHeader.jump empty? = {0}",
|
||||||
ArrayHelpers.ArrayIsNullOrEmpty(refsVhdr.jump));
|
ArrayHelpers.ArrayIsNullOrEmpty(refsVhdr.jump));
|
||||||
|
|||||||
@@ -71,10 +71,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
|
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
|
||||||
if(sector.Length < Marshal.SizeOf(reiserSb)) return false;
|
if(sector.Length < Marshal.SizeOf(reiserSb)) return false;
|
||||||
|
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(reiserSb));
|
reiserSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<Reiser_Superblock>(sector);
|
||||||
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(reiserSb));
|
|
||||||
reiserSb = (Reiser_Superblock)Marshal.PtrToStructure(sbPtr, typeof(Reiser_Superblock));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
return reiser35_magic.SequenceEqual(reiserSb.magic) || reiser36_magic.SequenceEqual(reiserSb.magic) ||
|
return reiser35_magic.SequenceEqual(reiserSb.magic) || reiser36_magic.SequenceEqual(reiserSb.magic) ||
|
||||||
reiserJr_magic.SequenceEqual(reiserSb.magic);
|
reiserJr_magic.SequenceEqual(reiserSb.magic);
|
||||||
@@ -98,10 +95,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
|
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
|
||||||
if(sector.Length < Marshal.SizeOf(reiserSb)) return;
|
if(sector.Length < Marshal.SizeOf(reiserSb)) return;
|
||||||
|
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(reiserSb));
|
reiserSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<Reiser_Superblock>(sector);
|
||||||
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(reiserSb));
|
|
||||||
reiserSb = (Reiser_Superblock)Marshal.PtrToStructure(sbPtr, typeof(Reiser_Superblock));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
if(!reiser35_magic.SequenceEqual(reiserSb.magic) && !reiser36_magic.SequenceEqual(reiserSb.magic) &&
|
if(!reiser35_magic.SequenceEqual(reiserSb.magic) && !reiser36_magic.SequenceEqual(reiserSb.magic) &&
|
||||||
!reiserJr_magic.SequenceEqual(reiserSb.magic)) return;
|
!reiserJr_magic.SequenceEqual(reiserSb.magic)) return;
|
||||||
|
|||||||
@@ -72,10 +72,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
|
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
|
||||||
if(sector.Length < Marshal.SizeOf(reiserSb)) return false;
|
if(sector.Length < Marshal.SizeOf(reiserSb)) return false;
|
||||||
|
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(reiserSb));
|
reiserSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<Reiser4_Superblock>(sector);
|
||||||
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(reiserSb));
|
|
||||||
reiserSb = (Reiser4_Superblock)Marshal.PtrToStructure(sbPtr, typeof(Reiser4_Superblock));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
return reiser4_magic.SequenceEqual(reiserSb.magic);
|
return reiser4_magic.SequenceEqual(reiserSb.magic);
|
||||||
}
|
}
|
||||||
@@ -98,10 +95,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
|
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
|
||||||
if(sector.Length < Marshal.SizeOf(reiserSb)) return;
|
if(sector.Length < Marshal.SizeOf(reiserSb)) return;
|
||||||
|
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(reiserSb));
|
reiserSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<Reiser4_Superblock>(sector);
|
||||||
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(reiserSb));
|
|
||||||
reiserSb = (Reiser4_Superblock)Marshal.PtrToStructure(sbPtr, typeof(Reiser4_Superblock));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
if(!reiser4_magic.SequenceEqual(reiserSb.magic)) return;
|
if(!reiser4_magic.SequenceEqual(reiserSb.magic)) return;
|
||||||
|
|
||||||
|
|||||||
@@ -77,10 +77,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
switch(magic)
|
switch(magic)
|
||||||
{
|
{
|
||||||
case SQUASH_MAGIC:
|
case SQUASH_MAGIC:
|
||||||
IntPtr sqSbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(sqSb));
|
sqSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<SquashSuperBlock>(sector);
|
||||||
Marshal.Copy(sector, 0, sqSbPtr, Marshal.SizeOf(sqSb));
|
|
||||||
sqSb = (SquashSuperBlock)Marshal.PtrToStructure(sqSbPtr, typeof(SquashSuperBlock));
|
|
||||||
Marshal.FreeHGlobal(sqSbPtr);
|
|
||||||
break;
|
break;
|
||||||
case SQUASH_CIGAM:
|
case SQUASH_CIGAM:
|
||||||
sqSb = Helpers.Marshal.ByteArrayToStructureBigEndian<SquashSuperBlock>(sector);
|
sqSb = Helpers.Marshal.ByteArrayToStructureBigEndian<SquashSuperBlock>(sector);
|
||||||
|
|||||||
@@ -73,13 +73,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
foreach(ulong position in positions.Where(position => position + partition.Start < partition.End))
|
foreach(ulong position in positions.Where(position => position + partition.Start < partition.End))
|
||||||
{
|
{
|
||||||
sector = imagePlugin.ReadSector(position);
|
sector = imagePlugin.ReadSector(position);
|
||||||
anchor = new AnchorVolumeDescriptorPointer();
|
anchor = Helpers.Marshal.ByteArrayToStructureLittleEndian<AnchorVolumeDescriptorPointer>(sector);
|
||||||
IntPtr anchorPtr = Marshal.AllocHGlobal(Marshal.SizeOf(anchor));
|
|
||||||
Marshal.Copy(sector, 0, anchorPtr, Marshal.SizeOf(anchor));
|
|
||||||
anchor =
|
|
||||||
(AnchorVolumeDescriptorPointer)Marshal.PtrToStructure(anchorPtr,
|
|
||||||
typeof(AnchorVolumeDescriptorPointer));
|
|
||||||
Marshal.FreeHGlobal(anchorPtr);
|
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("UDF Plugin", "anchor.tag.tagIdentifier = {0}", anchor.tag.tagIdentifier);
|
DicConsole.DebugWriteLine("UDF Plugin", "anchor.tag.tagIdentifier = {0}", anchor.tag.tagIdentifier);
|
||||||
DicConsole.DebugWriteLine("UDF Plugin", "anchor.tag.descriptorVersion = {0}",
|
DicConsole.DebugWriteLine("UDF Plugin", "anchor.tag.descriptorVersion = {0}",
|
||||||
@@ -129,11 +123,8 @@ namespace DiscImageChef.Filesystems
|
|||||||
|
|
||||||
if(tagId == TagIdentifier.LogicalVolumeDescriptor)
|
if(tagId == TagIdentifier.LogicalVolumeDescriptor)
|
||||||
{
|
{
|
||||||
LogicalVolumeDescriptor lvd = new LogicalVolumeDescriptor();
|
LogicalVolumeDescriptor lvd =
|
||||||
IntPtr lvdPtr = Marshal.AllocHGlobal(Marshal.SizeOf(lvd));
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<LogicalVolumeDescriptor>(sector);
|
||||||
Marshal.Copy(sector, 0, lvdPtr, Marshal.SizeOf(lvd));
|
|
||||||
lvd = (LogicalVolumeDescriptor)Marshal.PtrToStructure(lvdPtr, typeof(LogicalVolumeDescriptor));
|
|
||||||
Marshal.FreeHGlobal(lvdPtr);
|
|
||||||
|
|
||||||
return UDF_Magic.SequenceEqual(lvd.domainIdentifier.identifier);
|
return UDF_Magic.SequenceEqual(lvd.domainIdentifier.identifier);
|
||||||
}
|
}
|
||||||
@@ -164,13 +155,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
foreach(ulong position in positions)
|
foreach(ulong position in positions)
|
||||||
{
|
{
|
||||||
sector = imagePlugin.ReadSector(position);
|
sector = imagePlugin.ReadSector(position);
|
||||||
anchor = new AnchorVolumeDescriptorPointer();
|
anchor = Helpers.Marshal.ByteArrayToStructureLittleEndian<AnchorVolumeDescriptorPointer>(sector);
|
||||||
IntPtr anchorPtr = Marshal.AllocHGlobal(Marshal.SizeOf(anchor));
|
|
||||||
Marshal.Copy(sector, 0, anchorPtr, Marshal.SizeOf(anchor));
|
|
||||||
anchor =
|
|
||||||
(AnchorVolumeDescriptorPointer)Marshal.PtrToStructure(anchorPtr,
|
|
||||||
typeof(AnchorVolumeDescriptorPointer));
|
|
||||||
Marshal.FreeHGlobal(anchorPtr);
|
|
||||||
|
|
||||||
if(anchor.tag.tagIdentifier ==
|
if(anchor.tag.tagIdentifier ==
|
||||||
TagIdentifier.AnchorVolumeDescriptorPointer &&
|
TagIdentifier.AnchorVolumeDescriptorPointer &&
|
||||||
@@ -201,18 +186,10 @@ namespace DiscImageChef.Filesystems
|
|||||||
switch(tagId)
|
switch(tagId)
|
||||||
{
|
{
|
||||||
case TagIdentifier.LogicalVolumeDescriptor:
|
case TagIdentifier.LogicalVolumeDescriptor:
|
||||||
IntPtr lvdPtr = Marshal.AllocHGlobal(Marshal.SizeOf(lvd));
|
lvd = Helpers.Marshal.ByteArrayToStructureLittleEndian<LogicalVolumeDescriptor>(sector);
|
||||||
Marshal.Copy(sector, 0, lvdPtr, Marshal.SizeOf(lvd));
|
|
||||||
lvd = (LogicalVolumeDescriptor)
|
|
||||||
Marshal.PtrToStructure(lvdPtr, typeof(LogicalVolumeDescriptor));
|
|
||||||
Marshal.FreeHGlobal(lvdPtr);
|
|
||||||
break;
|
break;
|
||||||
case TagIdentifier.PrimaryVolumeDescriptor:
|
case TagIdentifier.PrimaryVolumeDescriptor:
|
||||||
IntPtr pvdPtr = Marshal.AllocHGlobal(Marshal.SizeOf(pvd));
|
pvd = Helpers.Marshal.ByteArrayToStructureLittleEndian<PrimaryVolumeDescriptor>(sector);
|
||||||
Marshal.Copy(sector, 0, pvdPtr, Marshal.SizeOf(pvd));
|
|
||||||
pvd = (PrimaryVolumeDescriptor)
|
|
||||||
Marshal.PtrToStructure(pvdPtr, typeof(PrimaryVolumeDescriptor));
|
|
||||||
Marshal.FreeHGlobal(pvdPtr);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -222,24 +199,18 @@ namespace DiscImageChef.Filesystems
|
|||||||
}
|
}
|
||||||
|
|
||||||
sector = imagePlugin.ReadSector(lvd.integritySequenceExtent.location);
|
sector = imagePlugin.ReadSector(lvd.integritySequenceExtent.location);
|
||||||
IntPtr lvidPtr = Marshal.AllocHGlobal(Marshal.SizeOf(lvid));
|
lvid = Helpers.Marshal.ByteArrayToStructureLittleEndian<LogicalVolumeIntegrityDescriptor>(sector);
|
||||||
Marshal.Copy(sector, 0, lvidPtr, Marshal.SizeOf(lvid));
|
|
||||||
lvid =
|
|
||||||
(LogicalVolumeIntegrityDescriptor)
|
|
||||||
Marshal.PtrToStructure(lvidPtr, typeof(LogicalVolumeIntegrityDescriptor));
|
|
||||||
Marshal.FreeHGlobal(lvidPtr);
|
|
||||||
|
|
||||||
if(lvid.tag.tagIdentifier == TagIdentifier.LogicalVolumeIntegrityDescriptor &&
|
if(lvid.tag.tagIdentifier == TagIdentifier.LogicalVolumeIntegrityDescriptor &&
|
||||||
lvid.tag.tagLocation == lvd.integritySequenceExtent.location)
|
lvid.tag.tagLocation == lvd.integritySequenceExtent.location)
|
||||||
{
|
{
|
||||||
IntPtr lvidiuPtr = Marshal.AllocHGlobal(Marshal.SizeOf(lvidiu));
|
|
||||||
Marshal.Copy(sector, (int)(lvid.numberOfPartitions * 8 + 80), lvidiuPtr, Marshal.SizeOf(lvidiu));
|
|
||||||
lvidiu =
|
lvidiu =
|
||||||
(LogicalVolumeIntegrityDescriptorImplementationUse)Marshal.PtrToStructure(lvidiuPtr,
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<LogicalVolumeIntegrityDescriptorImplementationUse>(sector,
|
||||||
typeof(
|
(int)(lvid
|
||||||
LogicalVolumeIntegrityDescriptorImplementationUse
|
.numberOfPartitions *
|
||||||
));
|
8 + 80),
|
||||||
Marshal.FreeHGlobal(lvidiuPtr);
|
Marshal
|
||||||
|
.SizeOf(lvidiu));
|
||||||
}
|
}
|
||||||
else lvid = new LogicalVolumeIntegrityDescriptor();
|
else lvid = new LogicalVolumeIntegrityDescriptor();
|
||||||
|
|
||||||
|
|||||||
@@ -75,11 +75,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
ulong vmfsSuperOff = VMFS_BASE / imagePlugin.Info.SectorSize;
|
ulong vmfsSuperOff = VMFS_BASE / imagePlugin.Info.SectorSize;
|
||||||
byte[] sector = imagePlugin.ReadSector(partition.Start + vmfsSuperOff);
|
byte[] sector = imagePlugin.ReadSector(partition.Start + vmfsSuperOff);
|
||||||
|
|
||||||
VolumeInfo volInfo = new VolumeInfo();
|
VolumeInfo volInfo = Helpers.Marshal.ByteArrayToStructureLittleEndian<VolumeInfo>(sector);
|
||||||
IntPtr volInfoPtr = Marshal.AllocHGlobal(Marshal.SizeOf(volInfo));
|
|
||||||
Marshal.Copy(sector, 0, volInfoPtr, Marshal.SizeOf(volInfo));
|
|
||||||
volInfo = (VolumeInfo)Marshal.PtrToStructure(volInfoPtr, typeof(VolumeInfo));
|
|
||||||
Marshal.FreeHGlobal(volInfoPtr);
|
|
||||||
|
|
||||||
StringBuilder sbInformation = new StringBuilder();
|
StringBuilder sbInformation = new StringBuilder();
|
||||||
|
|
||||||
|
|||||||
@@ -73,11 +73,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
ulong vmfsSuperOff = VXFS_BASE / imagePlugin.Info.SectorSize;
|
ulong vmfsSuperOff = VXFS_BASE / imagePlugin.Info.SectorSize;
|
||||||
byte[] sector = imagePlugin.ReadSector(partition.Start + vmfsSuperOff);
|
byte[] sector = imagePlugin.ReadSector(partition.Start + vmfsSuperOff);
|
||||||
|
|
||||||
VxSuperBlock vxSb = new VxSuperBlock();
|
VxSuperBlock vxSb = Helpers.Marshal.ByteArrayToStructureLittleEndian<VxSuperBlock>(sector);
|
||||||
IntPtr vxSbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vxSb));
|
|
||||||
Marshal.Copy(sector, 0, vxSbPtr, Marshal.SizeOf(vxSb));
|
|
||||||
vxSb = (VxSuperBlock)Marshal.PtrToStructure(vxSbPtr, typeof(VxSuperBlock));
|
|
||||||
Marshal.FreeHGlobal(vxSbPtr);
|
|
||||||
|
|
||||||
StringBuilder sbInformation = new StringBuilder();
|
StringBuilder sbInformation = new StringBuilder();
|
||||||
|
|
||||||
|
|||||||
@@ -64,10 +64,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
if(sbSizeInSectors + partition.Start >= partition.End) return false;
|
if(sbSizeInSectors + partition.Start >= partition.End) return false;
|
||||||
|
|
||||||
byte[] sbSector = imagePlugin.ReadSectors(partition.Start, sbSizeInSectors);
|
byte[] sbSector = imagePlugin.ReadSectors(partition.Start, sbSizeInSectors);
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(sbSizeInBytes);
|
XiaSuperBlock supblk = Helpers.Marshal.ByteArrayToStructureLittleEndian<XiaSuperBlock>(sbSector);
|
||||||
Marshal.Copy(sbSector, 0, sbPtr, sbSizeInBytes);
|
|
||||||
XiaSuperBlock supblk = (XiaSuperBlock)Marshal.PtrToStructure(sbPtr, typeof(XiaSuperBlock));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
return supblk.s_magic == XIAFS_SUPER_MAGIC;
|
return supblk.s_magic == XIAFS_SUPER_MAGIC;
|
||||||
}
|
}
|
||||||
@@ -85,10 +82,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
if(sbSizeInBytes % imagePlugin.Info.SectorSize > 0) sbSizeInSectors++;
|
if(sbSizeInBytes % imagePlugin.Info.SectorSize > 0) sbSizeInSectors++;
|
||||||
|
|
||||||
byte[] sbSector = imagePlugin.ReadSectors(partition.Start, sbSizeInSectors);
|
byte[] sbSector = imagePlugin.ReadSectors(partition.Start, sbSizeInSectors);
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(sbSizeInBytes);
|
XiaSuperBlock supblk = Helpers.Marshal.ByteArrayToStructureLittleEndian<XiaSuperBlock>(sbSector);
|
||||||
Marshal.Copy(sbSector, 0, sbPtr, sbSizeInBytes);
|
|
||||||
XiaSuperBlock supblk = (XiaSuperBlock)Marshal.PtrToStructure(sbPtr, typeof(XiaSuperBlock));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
sb.AppendFormat("{0} bytes per zone", supblk.s_zone_size).AppendLine();
|
sb.AppendFormat("{0} bytes per zone", supblk.s_zone_size).AppendLine();
|
||||||
sb.AppendFormat("{0} zones in volume ({1} bytes)", supblk.s_nzones, supblk.s_nzones * supblk.s_zone_size)
|
sb.AppendFormat("{0} zones in volume ({1} bytes)", supblk.s_nzones, supblk.s_nzones * supblk.s_zone_size)
|
||||||
|
|||||||
@@ -121,20 +121,9 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize);
|
byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize);
|
||||||
if(sector.Length < Marshal.SizeOf(newHdr)) return false;
|
if(sector.Length < Marshal.SizeOf(newHdr)) return false;
|
||||||
|
|
||||||
IntPtr oldPtr = Marshal.AllocHGlobal(Marshal.SizeOf(oldHdr));
|
oldHdr = Helpers.Marshal.ByteArrayToStructureLittleEndian<spcl16>(sector);
|
||||||
Marshal.Copy(sector, 0, oldPtr, Marshal.SizeOf(oldHdr));
|
aixHdr = Helpers.Marshal.ByteArrayToStructureLittleEndian<spcl_aix>(sector);
|
||||||
oldHdr = (spcl16)Marshal.PtrToStructure(oldPtr, typeof(spcl16));
|
newHdr = Helpers.Marshal.ByteArrayToStructureLittleEndian<s_spcl>(sector);
|
||||||
Marshal.FreeHGlobal(oldPtr);
|
|
||||||
|
|
||||||
IntPtr aixPtr = Marshal.AllocHGlobal(Marshal.SizeOf(aixHdr));
|
|
||||||
Marshal.Copy(sector, 0, aixPtr, Marshal.SizeOf(aixHdr));
|
|
||||||
aixHdr = (spcl_aix)Marshal.PtrToStructure(aixPtr, typeof(spcl_aix));
|
|
||||||
Marshal.FreeHGlobal(aixPtr);
|
|
||||||
|
|
||||||
IntPtr newPtr = Marshal.AllocHGlobal(Marshal.SizeOf(newHdr));
|
|
||||||
Marshal.Copy(sector, 0, newPtr, Marshal.SizeOf(newHdr));
|
|
||||||
newHdr = (s_spcl)Marshal.PtrToStructure(newPtr, typeof(s_spcl));
|
|
||||||
Marshal.FreeHGlobal(newPtr);
|
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("dump(8) plugin", "old magic = 0x{0:X8}", oldHdr.c_magic);
|
DicConsole.DebugWriteLine("dump(8) plugin", "old magic = 0x{0:X8}", oldHdr.c_magic);
|
||||||
DicConsole.DebugWriteLine("dump(8) plugin", "aix magic = 0x{0:X8}", aixHdr.c_magic);
|
DicConsole.DebugWriteLine("dump(8) plugin", "aix magic = 0x{0:X8}", aixHdr.c_magic);
|
||||||
@@ -164,20 +153,9 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize);
|
byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize);
|
||||||
if(sector.Length < Marshal.SizeOf(newHdr)) return;
|
if(sector.Length < Marshal.SizeOf(newHdr)) return;
|
||||||
|
|
||||||
IntPtr oldPtr = Marshal.AllocHGlobal(Marshal.SizeOf(oldHdr));
|
oldHdr = Helpers.Marshal.ByteArrayToStructureLittleEndian<spcl16>(sector);
|
||||||
Marshal.Copy(sector, 0, oldPtr, Marshal.SizeOf(oldHdr));
|
aixHdr = Helpers.Marshal.ByteArrayToStructureLittleEndian<spcl_aix>(sector);
|
||||||
oldHdr = (spcl16)Marshal.PtrToStructure(oldPtr, typeof(spcl16));
|
newHdr = Helpers.Marshal.ByteArrayToStructureLittleEndian<s_spcl>(sector);
|
||||||
Marshal.FreeHGlobal(oldPtr);
|
|
||||||
|
|
||||||
IntPtr aixPtr = Marshal.AllocHGlobal(Marshal.SizeOf(aixHdr));
|
|
||||||
Marshal.Copy(sector, 0, aixPtr, Marshal.SizeOf(aixHdr));
|
|
||||||
aixHdr = (spcl_aix)Marshal.PtrToStructure(aixPtr, typeof(spcl_aix));
|
|
||||||
Marshal.FreeHGlobal(aixPtr);
|
|
||||||
|
|
||||||
IntPtr newPtr = Marshal.AllocHGlobal(Marshal.SizeOf(newHdr));
|
|
||||||
Marshal.Copy(sector, 0, newPtr, Marshal.SizeOf(newHdr));
|
|
||||||
newHdr = (s_spcl)Marshal.PtrToStructure(newPtr, typeof(s_spcl));
|
|
||||||
Marshal.FreeHGlobal(newPtr);
|
|
||||||
|
|
||||||
bool useOld = false;
|
bool useOld = false;
|
||||||
bool useAix = false;
|
bool useAix = false;
|
||||||
|
|||||||
@@ -60,10 +60,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] vbrSector = imagePlugin.ReadSector(0 + partition.Start);
|
byte[] vbrSector = imagePlugin.ReadSector(0 + partition.Start);
|
||||||
if(vbrSector.Length < 512) return false;
|
if(vbrSector.Length < 512) return false;
|
||||||
|
|
||||||
IntPtr vbrPtr = Marshal.AllocHGlobal(512);
|
VolumeBootRecord vbr = Helpers.Marshal.ByteArrayToStructureLittleEndian<VolumeBootRecord>(vbrSector);
|
||||||
Marshal.Copy(vbrSector, 0, vbrPtr, 512);
|
|
||||||
VolumeBootRecord vbr = (VolumeBootRecord)Marshal.PtrToStructure(vbrPtr, typeof(VolumeBootRecord));
|
|
||||||
Marshal.FreeHGlobal(vbrPtr);
|
|
||||||
|
|
||||||
return signature.SequenceEqual(vbr.signature);
|
return signature.SequenceEqual(vbr.signature);
|
||||||
}
|
}
|
||||||
@@ -78,23 +75,14 @@ namespace DiscImageChef.Filesystems
|
|||||||
XmlFsType = new FileSystemType();
|
XmlFsType = new FileSystemType();
|
||||||
|
|
||||||
byte[] vbrSector = imagePlugin.ReadSector(0 + partition.Start);
|
byte[] vbrSector = imagePlugin.ReadSector(0 + partition.Start);
|
||||||
IntPtr vbrPtr = Marshal.AllocHGlobal(512);
|
VolumeBootRecord vbr = Helpers.Marshal.ByteArrayToStructureLittleEndian<VolumeBootRecord>(vbrSector);
|
||||||
Marshal.Copy(vbrSector, 0, vbrPtr, 512);
|
|
||||||
VolumeBootRecord vbr = (VolumeBootRecord)Marshal.PtrToStructure(vbrPtr, typeof(VolumeBootRecord));
|
|
||||||
Marshal.FreeHGlobal(vbrPtr);
|
|
||||||
|
|
||||||
byte[] parametersSector = imagePlugin.ReadSector(9 + partition.Start);
|
byte[] parametersSector = imagePlugin.ReadSector(9 + partition.Start);
|
||||||
IntPtr parametersPtr = Marshal.AllocHGlobal(512);
|
|
||||||
Marshal.Copy(parametersSector, 0, parametersPtr, 512);
|
|
||||||
OemParameterTable parametersTable =
|
OemParameterTable parametersTable =
|
||||||
(OemParameterTable)Marshal.PtrToStructure(parametersPtr, typeof(OemParameterTable));
|
Helpers.Marshal.ByteArrayToStructureLittleEndian<OemParameterTable>(parametersSector);
|
||||||
Marshal.FreeHGlobal(parametersPtr);
|
|
||||||
|
|
||||||
byte[] chkSector = imagePlugin.ReadSector(11 + partition.Start);
|
byte[] chkSector = imagePlugin.ReadSector(11 + partition.Start);
|
||||||
IntPtr chkPtr = Marshal.AllocHGlobal(512);
|
ChecksumSector chksector = Helpers.Marshal.ByteArrayToStructureLittleEndian<ChecksumSector>(chkSector);
|
||||||
Marshal.Copy(chkSector, 0, chkPtr, 512);
|
|
||||||
ChecksumSector chksector = (ChecksumSector)Marshal.PtrToStructure(chkPtr, typeof(ChecksumSector));
|
|
||||||
Marshal.FreeHGlobal(chkPtr);
|
|
||||||
|
|
||||||
sb.AppendLine("Microsoft exFAT");
|
sb.AppendLine("Microsoft exFAT");
|
||||||
sb.AppendFormat("Partition offset: {0}", vbr.offset).AppendLine();
|
sb.AppendFormat("Partition offset: {0}", vbr.offset).AppendLine();
|
||||||
|
|||||||
@@ -209,10 +209,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
byte[] sbSector = imagePlugin.ReadSectors(sbSectorOff + partition.Start, sbSizeInSectors);
|
byte[] sbSector = imagePlugin.ReadSectors(sbSectorOff + partition.Start, sbSizeInSectors);
|
||||||
byte[] sblock = new byte[sbSizeInBytes];
|
byte[] sblock = new byte[sbSizeInBytes];
|
||||||
Array.Copy(sbSector, sbOff, sblock, 0, sbSizeInBytes);
|
Array.Copy(sbSector, sbOff, sblock, 0, sbSizeInBytes);
|
||||||
IntPtr sbPtr = Marshal.AllocHGlobal(sbSizeInBytes);
|
ext2FSSuperBlock supblk = Helpers.Marshal.ByteArrayToStructureLittleEndian<ext2FSSuperBlock>(sblock);
|
||||||
Marshal.Copy(sblock, 0, sbPtr, sbSizeInBytes);
|
|
||||||
ext2FSSuperBlock supblk = (ext2FSSuperBlock)Marshal.PtrToStructure(sbPtr, typeof(ext2FSSuperBlock));
|
|
||||||
Marshal.FreeHGlobal(sbPtr);
|
|
||||||
|
|
||||||
XmlFsType = new FileSystemType();
|
XmlFsType = new FileSystemType();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user