General refactor.

This commit is contained in:
2018-06-20 22:22:21 +01:00
parent dc1884f5d8
commit ec8b309670
93 changed files with 850 additions and 1015 deletions

View File

@@ -357,9 +357,7 @@ namespace DiscImageChef.Filesystems
static uint AmigaBootChecksum(byte[] data)
{
uint sum;
sum = 0;
uint sum = 0;
for(int i = 0; i < data.Length; i += 4)
{
uint psum = sum;

View File

@@ -49,8 +49,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
if(partition.Start > 0 || imagePlugin.Info.SectorSize != 256) return false;
int spt;
spt = imagePlugin.Info.Sectors == 455 ? 13 : 16;
int spt = imagePlugin.Info.Sectors == 455 ? 13 : 16;
byte[] vtocB = imagePlugin.ReadSector((ulong)(17 * spt));
vtoc = new Vtoc();

View File

@@ -111,7 +111,7 @@ namespace DiscImageChef.Filesystems
byte[] mdbSector = null;
ushort drSigWord;
bool APMFromHDDOnCD = false;
bool apmFromHddOnCd = false;
if(imagePlugin.Info.SectorSize == 2352 || imagePlugin.Info.SectorSize == 2448 ||
imagePlugin.Info.SectorSize == 2048)
@@ -127,11 +127,11 @@ namespace DiscImageChef.Filesystems
mdbSector = new byte[512];
if(offset >= 0x400) Array.Copy(tmpSector, offset - 0x400, bbSector, 0, 1024);
Array.Copy(tmpSector, offset, mdbSector, 0, 512);
APMFromHDDOnCD = true;
apmFromHddOnCd = true;
break;
}
if(!APMFromHDDOnCD) return;
if(!apmFromHddOnCd) return;
}
else
{
@@ -142,146 +142,146 @@ namespace DiscImageChef.Filesystems
else return;
}
HFS_MasterDirectoryBlock MDB =
BigEndianMarshal.ByteArrayToStructureBigEndian<HFS_MasterDirectoryBlock>(mdbSector);
HFS_BootBlock BB = BigEndianMarshal.ByteArrayToStructureBigEndian<HFS_BootBlock>(bbSector);
HfsMasterDirectoryBlock mdb =
BigEndianMarshal.ByteArrayToStructureBigEndian<HfsMasterDirectoryBlock>(mdbSector);
HfsBootBlock bb = BigEndianMarshal.ByteArrayToStructureBigEndian<HfsBootBlock>(bbSector);
sb.AppendLine("Apple Hierarchical File System");
sb.AppendLine();
if(APMFromHDDOnCD)
if(apmFromHddOnCd)
sb.AppendLine("HFS uses 512 bytes/sector while device uses 2048 bytes/sector.").AppendLine();
sb.AppendLine("Master Directory Block:");
sb.AppendFormat("Creation date: {0}", DateHandlers.MacToDateTime(MDB.drCrDate)).AppendLine();
sb.AppendFormat("Last modification date: {0}", DateHandlers.MacToDateTime(MDB.drLsMod)).AppendLine();
if(MDB.drVolBkUp > 0)
sb.AppendFormat("Creation date: {0}", DateHandlers.MacToDateTime(mdb.drCrDate)).AppendLine();
sb.AppendFormat("Last modification date: {0}", DateHandlers.MacToDateTime(mdb.drLsMod)).AppendLine();
if(mdb.drVolBkUp > 0)
{
sb.AppendFormat("Last backup date: {0}", DateHandlers.MacToDateTime(MDB.drVolBkUp)).AppendLine();
sb.AppendFormat("Backup sequence number: {0}", MDB.drVSeqNum).AppendLine();
sb.AppendFormat("Last backup date: {0}", DateHandlers.MacToDateTime(mdb.drVolBkUp)).AppendLine();
sb.AppendFormat("Backup sequence number: {0}", mdb.drVSeqNum).AppendLine();
}
else sb.AppendLine("Volume has never been backed up");
if((MDB.drAtrb & 0x80) == 0x80) sb.AppendLine("Volume is locked by hardware.");
sb.AppendLine((MDB.drAtrb & 0x100) == 0x100 ? "Volume was unmonted." : "Volume is mounted.");
if((MDB.drAtrb & 0x200) == 0x200) sb.AppendLine("Volume has spared bad blocks.");
if((MDB.drAtrb & 0x400) == 0x400) sb.AppendLine("Volume does not need cache.");
if((MDB.drAtrb & 0x800) == 0x800) sb.AppendLine("Boot volume is inconsistent.");
if((MDB.drAtrb & 0x1000) == 0x1000) sb.AppendLine("There are reused CNIDs.");
if((MDB.drAtrb & 0x2000) == 0x2000) sb.AppendLine("Volume is journaled.");
if((MDB.drAtrb & 0x4000) == 0x4000) sb.AppendLine("Volume is seriously inconsistent.");
if((MDB.drAtrb & 0x8000) == 0x8000) sb.AppendLine("Volume is locked by software.");
if((mdb.drAtrb & 0x80) == 0x80) sb.AppendLine("Volume is locked by hardware.");
sb.AppendLine((mdb.drAtrb & 0x100) == 0x100 ? "Volume was unmonted." : "Volume is mounted.");
if((mdb.drAtrb & 0x200) == 0x200) sb.AppendLine("Volume has spared bad blocks.");
if((mdb.drAtrb & 0x400) == 0x400) sb.AppendLine("Volume does not need cache.");
if((mdb.drAtrb & 0x800) == 0x800) sb.AppendLine("Boot volume is inconsistent.");
if((mdb.drAtrb & 0x1000) == 0x1000) sb.AppendLine("There are reused CNIDs.");
if((mdb.drAtrb & 0x2000) == 0x2000) sb.AppendLine("Volume is journaled.");
if((mdb.drAtrb & 0x4000) == 0x4000) sb.AppendLine("Volume is seriously inconsistent.");
if((mdb.drAtrb & 0x8000) == 0x8000) sb.AppendLine("Volume is locked by software.");
sb.AppendFormat("{0} files on root directory", MDB.drNmFls).AppendLine();
sb.AppendFormat("{0} directories on root directory", MDB.drNmRtDirs).AppendLine();
sb.AppendFormat("{0} files on volume", MDB.drFilCnt).AppendLine();
sb.AppendFormat("{0} directories on volume", MDB.drDirCnt).AppendLine();
sb.AppendFormat("Volume write count: {0}", MDB.drWrCnt).AppendLine();
sb.AppendFormat("{0} files on root directory", mdb.drNmFls).AppendLine();
sb.AppendFormat("{0} directories on root directory", mdb.drNmRtDirs).AppendLine();
sb.AppendFormat("{0} files on volume", mdb.drFilCnt).AppendLine();
sb.AppendFormat("{0} directories on volume", mdb.drDirCnt).AppendLine();
sb.AppendFormat("Volume write count: {0}", mdb.drWrCnt).AppendLine();
sb.AppendFormat("Volume bitmap starting sector (in 512-bytes): {0}", MDB.drVBMSt).AppendLine();
sb.AppendFormat("Next allocation block: {0}.", MDB.drAllocPtr).AppendLine();
sb.AppendFormat("{0} volume allocation blocks.", MDB.drNmAlBlks).AppendLine();
sb.AppendFormat("{0} bytes per allocation block.", MDB.drAlBlkSiz).AppendLine();
sb.AppendFormat("{0} bytes to allocate when extending a file.", MDB.drClpSiz).AppendLine();
sb.AppendFormat("{0} bytes to allocate when extending a Extents B-Tree.", MDB.drXTClpSiz).AppendLine();
sb.AppendFormat("{0} bytes to allocate when extending a Catalog B-Tree.", MDB.drCTClpSiz).AppendLine();
sb.AppendFormat("Sector of first allocation block: {0}", MDB.drAlBlSt).AppendLine();
sb.AppendFormat("Next unused CNID: {0}", MDB.drNxtCNID).AppendLine();
sb.AppendFormat("{0} unused allocation blocks.", MDB.drFreeBks).AppendLine();
sb.AppendFormat("Volume bitmap starting sector (in 512-bytes): {0}", mdb.drVBMSt).AppendLine();
sb.AppendFormat("Next allocation block: {0}.", mdb.drAllocPtr).AppendLine();
sb.AppendFormat("{0} volume allocation blocks.", mdb.drNmAlBlks).AppendLine();
sb.AppendFormat("{0} bytes per allocation block.", mdb.drAlBlkSiz).AppendLine();
sb.AppendFormat("{0} bytes to allocate when extending a file.", mdb.drClpSiz).AppendLine();
sb.AppendFormat("{0} bytes to allocate when extending a Extents B-Tree.", mdb.drXTClpSiz).AppendLine();
sb.AppendFormat("{0} bytes to allocate when extending a Catalog B-Tree.", mdb.drCTClpSiz).AppendLine();
sb.AppendFormat("Sector of first allocation block: {0}", mdb.drAlBlSt).AppendLine();
sb.AppendFormat("Next unused CNID: {0}", mdb.drNxtCNID).AppendLine();
sb.AppendFormat("{0} unused allocation blocks.", mdb.drFreeBks).AppendLine();
sb.AppendFormat("{0} bytes in the Extents B-Tree", MDB.drXTFlSize).AppendLine();
sb.AppendFormat("{0} bytes in the Catalog B-Tree", MDB.drCTFlSize).AppendLine();
sb.AppendFormat("{0} bytes in the Extents B-Tree", mdb.drXTFlSize).AppendLine();
sb.AppendFormat("{0} bytes in the Catalog B-Tree", mdb.drCTFlSize).AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.PascalToString(MDB.drVN, Encoding)).AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.PascalToString(mdb.drVN, Encoding)).AppendLine();
sb.AppendLine("Finder info:");
sb.AppendFormat("CNID of bootable system's directory: {0}", MDB.drFndrInfo0).AppendLine();
sb.AppendFormat("CNID of first-run application's directory: {0}", MDB.drFndrInfo1).AppendLine();
sb.AppendFormat("CNID of previously opened directory: {0}", MDB.drFndrInfo2).AppendLine();
sb.AppendFormat("CNID of bootable Mac OS 8 or 9 directory: {0}", MDB.drFndrInfo3).AppendLine();
sb.AppendFormat("CNID of bootable Mac OS X directory: {0}", MDB.drFndrInfo5).AppendLine();
if(MDB.drFndrInfo6 != 0 && MDB.drFndrInfo7 != 0)
sb.AppendFormat("Mac OS X Volume ID: {0:X8}{1:X8}", MDB.drFndrInfo6, MDB.drFndrInfo7).AppendLine();
sb.AppendFormat("CNID of bootable system's directory: {0}", mdb.drFndrInfo0).AppendLine();
sb.AppendFormat("CNID of first-run application's directory: {0}", mdb.drFndrInfo1).AppendLine();
sb.AppendFormat("CNID of previously opened directory: {0}", mdb.drFndrInfo2).AppendLine();
sb.AppendFormat("CNID of bootable Mac OS 8 or 9 directory: {0}", mdb.drFndrInfo3).AppendLine();
sb.AppendFormat("CNID of bootable Mac OS X directory: {0}", mdb.drFndrInfo5).AppendLine();
if(mdb.drFndrInfo6 != 0 && mdb.drFndrInfo7 != 0)
sb.AppendFormat("Mac OS X Volume ID: {0:X8}{1:X8}", mdb.drFndrInfo6, mdb.drFndrInfo7).AppendLine();
if(MDB.drEmbedSigWord == HFSP_MAGIC)
if(mdb.drEmbedSigWord == HFSP_MAGIC)
{
sb.AppendLine("Volume wraps a HFS+ volume.");
sb.AppendFormat("Starting block of the HFS+ volume: {0}", MDB.xdrStABNt).AppendLine();
sb.AppendFormat("Allocations blocks of the HFS+ volume: {0}", MDB.xdrNumABlks).AppendLine();
sb.AppendFormat("Starting block of the HFS+ volume: {0}", mdb.xdrStABNt).AppendLine();
sb.AppendFormat("Allocations blocks of the HFS+ volume: {0}", mdb.xdrNumABlks).AppendLine();
}
else
{
sb.AppendFormat("{0} blocks in volume cache", MDB.drVCSize).AppendLine();
sb.AppendFormat("{0} blocks in volume bitmap cache", MDB.drVBMCSize).AppendLine();
sb.AppendFormat("{0} blocks in volume common cache", MDB.drCtlCSize).AppendLine();
sb.AppendFormat("{0} blocks in volume cache", mdb.drVCSize).AppendLine();
sb.AppendFormat("{0} blocks in volume bitmap cache", mdb.drVBMCSize).AppendLine();
sb.AppendFormat("{0} blocks in volume common cache", mdb.drCtlCSize).AppendLine();
}
if(BB.signature == HFSBB_MAGIC)
if(bb.signature == HFSBB_MAGIC)
{
sb.AppendLine("Volume is bootable.");
sb.AppendLine();
sb.AppendLine("Boot Block:");
if((BB.boot_flags & 0x40) == 0x40) sb.AppendLine("Boot block should be executed.");
if((BB.boot_flags & 0x80) == 0x80) sb.AppendLine("Boot block is in new unknown format.");
if((bb.boot_flags & 0x40) == 0x40) sb.AppendLine("Boot block should be executed.");
if((bb.boot_flags & 0x80) == 0x80) sb.AppendLine("Boot block is in new unknown format.");
else
{
if(BB.boot_flags > 0) sb.AppendLine("Allocate secondary sound buffer at boot.");
else if(BB.boot_flags < 0) sb.AppendLine("Allocate secondary sound and video buffers at boot.");
if(bb.boot_flags > 0) sb.AppendLine("Allocate secondary sound buffer at boot.");
else if(bb.boot_flags < 0) sb.AppendLine("Allocate secondary sound and video buffers at boot.");
sb.AppendFormat("System filename: {0}", StringHandlers.PascalToString(BB.system_name, Encoding))
sb.AppendFormat("System filename: {0}", StringHandlers.PascalToString(bb.system_name, Encoding))
.AppendLine();
sb.AppendFormat("Finder filename: {0}", StringHandlers.PascalToString(BB.finder_name, Encoding))
sb.AppendFormat("Finder filename: {0}", StringHandlers.PascalToString(bb.finder_name, Encoding))
.AppendLine();
sb.AppendFormat("Debugger filename: {0}", StringHandlers.PascalToString(BB.debug_name, Encoding))
sb.AppendFormat("Debugger filename: {0}", StringHandlers.PascalToString(bb.debug_name, Encoding))
.AppendLine();
sb.AppendFormat("Disassembler filename: {0}",
StringHandlers.PascalToString(BB.disasm_name, Encoding)).AppendLine();
StringHandlers.PascalToString(bb.disasm_name, Encoding)).AppendLine();
sb.AppendFormat("Startup screen filename: {0}",
StringHandlers.PascalToString(BB.stupscr_name, Encoding)).AppendLine();
StringHandlers.PascalToString(bb.stupscr_name, Encoding)).AppendLine();
sb.AppendFormat("First program to execute at boot: {0}",
StringHandlers.PascalToString(BB.bootup_name, Encoding)).AppendLine();
sb.AppendFormat("Clipboard filename: {0}", StringHandlers.PascalToString(BB.clipbrd_name, Encoding))
StringHandlers.PascalToString(bb.bootup_name, Encoding)).AppendLine();
sb.AppendFormat("Clipboard filename: {0}", StringHandlers.PascalToString(bb.clipbrd_name, Encoding))
.AppendLine();
sb.AppendFormat("Maximum opened files: {0}", BB.max_files * 4).AppendLine();
sb.AppendFormat("Event queue size: {0}", BB.queue_size).AppendLine();
sb.AppendFormat("Heap size with 128KiB of RAM: {0} bytes", BB.heap_128k).AppendLine();
sb.AppendFormat("Heap size with 256KiB of RAM: {0} bytes", BB.heap_256k).AppendLine();
sb.AppendFormat("Heap size with 512KiB of RAM or more: {0} bytes", BB.heap_512k).AppendLine();
sb.AppendFormat("Maximum opened files: {0}", bb.max_files * 4).AppendLine();
sb.AppendFormat("Event queue size: {0}", bb.queue_size).AppendLine();
sb.AppendFormat("Heap size with 128KiB of RAM: {0} bytes", bb.heap_128k).AppendLine();
sb.AppendFormat("Heap size with 256KiB of RAM: {0} bytes", bb.heap_256k).AppendLine();
sb.AppendFormat("Heap size with 512KiB of RAM or more: {0} bytes", bb.heap_512k).AppendLine();
}
}
else if(MDB.drFndrInfo0 != 0 || MDB.drFndrInfo3 != 0 || MDB.drFndrInfo5 != 0)
else if(mdb.drFndrInfo0 != 0 || mdb.drFndrInfo3 != 0 || mdb.drFndrInfo5 != 0)
sb.AppendLine("Volume is bootable.");
else sb.AppendLine("Volume is not bootable.");
information = sb.ToString();
XmlFsType = new FileSystemType();
if(MDB.drVolBkUp > 0)
if(mdb.drVolBkUp > 0)
{
XmlFsType.BackupDate = DateHandlers.MacToDateTime(MDB.drVolBkUp);
XmlFsType.BackupDate = DateHandlers.MacToDateTime(mdb.drVolBkUp);
XmlFsType.BackupDateSpecified = true;
}
XmlFsType.Bootable = BB.signature == HFSBB_MAGIC || MDB.drFndrInfo0 != 0 || MDB.drFndrInfo3 != 0 ||
MDB.drFndrInfo5 != 0;
XmlFsType.Clusters = MDB.drNmAlBlks;
XmlFsType.ClusterSize = (int)MDB.drAlBlkSiz;
if(MDB.drCrDate > 0)
XmlFsType.Bootable = bb.signature == HFSBB_MAGIC || mdb.drFndrInfo0 != 0 || mdb.drFndrInfo3 != 0 ||
mdb.drFndrInfo5 != 0;
XmlFsType.Clusters = mdb.drNmAlBlks;
XmlFsType.ClusterSize = (int)mdb.drAlBlkSiz;
if(mdb.drCrDate > 0)
{
XmlFsType.CreationDate = DateHandlers.MacToDateTime(MDB.drCrDate);
XmlFsType.CreationDate = DateHandlers.MacToDateTime(mdb.drCrDate);
XmlFsType.CreationDateSpecified = true;
}
XmlFsType.Dirty = (MDB.drAtrb & 0x100) != 0x100;
XmlFsType.Files = MDB.drFilCnt;
XmlFsType.Dirty = (mdb.drAtrb & 0x100) != 0x100;
XmlFsType.Files = mdb.drFilCnt;
XmlFsType.FilesSpecified = true;
XmlFsType.FreeClusters = MDB.drFreeBks;
XmlFsType.FreeClusters = mdb.drFreeBks;
XmlFsType.FreeClustersSpecified = true;
if(MDB.drLsMod > 0)
if(mdb.drLsMod > 0)
{
XmlFsType.ModificationDate = DateHandlers.MacToDateTime(MDB.drLsMod);
XmlFsType.ModificationDate = DateHandlers.MacToDateTime(mdb.drLsMod);
XmlFsType.ModificationDateSpecified = true;
}
XmlFsType.Type = "HFS";
XmlFsType.VolumeName = StringHandlers.PascalToString(MDB.drVN, Encoding);
if(MDB.drFndrInfo6 != 0 && MDB.drFndrInfo7 != 0)
XmlFsType.VolumeSerial = $"{MDB.drFndrInfo6:X8}{MDB.drFndrInfo7:X8}";
XmlFsType.VolumeName = StringHandlers.PascalToString(mdb.drVN, Encoding);
if(mdb.drFndrInfo6 != 0 && mdb.drFndrInfo7 != 0)
XmlFsType.VolumeSerial = $"{mdb.drFndrInfo6:X8}{mdb.drFndrInfo7:X8}";
}
static byte[] Read2048SectorAs512(IMediaImage imagePlugin, ulong lba)
@@ -301,7 +301,7 @@ namespace DiscImageChef.Filesystems
/// Master Directory Block, should be sector 2 in volume
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct HFS_MasterDirectoryBlock // Should be sector 2 in volume
struct HfsMasterDirectoryBlock // Should be sector 2 in volume
{
/// <summary>0x000, Signature, 0x4244</summary>
public ushort drSigWord;
@@ -394,7 +394,7 @@ namespace DiscImageChef.Filesystems
/// Should be sectors 0 and 1 in volume, followed by boot code
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct HFS_BootBlock // Should be sectors 0 and 1 in volume
struct HfsBootBlock // Should be sectors 0 and 1 in volume
{
/// <summary>0x000, Signature, 0x4C4B if bootable</summary>
public ushort signature;

View File

@@ -64,8 +64,6 @@ namespace DiscImageChef.Filesystems
{
if(2 + partition.Start >= partition.End) return false;
ushort drSigWord;
ulong hfspOffset;
uint sectorsToRead = 0x800 / imagePlugin.Info.SectorSize;
@@ -73,7 +71,7 @@ namespace DiscImageChef.Filesystems
byte[] vhSector = imagePlugin.ReadSectors(partition.Start, sectorsToRead);
drSigWord = BigEndianBitConverter.ToUInt16(vhSector, 0x400); // Check for HFS Wrapper MDB
ushort drSigWord = BigEndianBitConverter.ToUInt16(vhSector, 0x400);
if(drSigWord == HFS_MAGIC) // "BD"
{
@@ -105,8 +103,7 @@ namespace DiscImageChef.Filesystems
Encoding = Encoding.BigEndianUnicode;
information = "";
ushort drSigWord;
HFSPlusVolumeHeader HPVH = new HFSPlusVolumeHeader();
HfsPlusVolumeHeader vh = new HfsPlusVolumeHeader();
ulong hfspOffset;
bool wrapped;
@@ -116,7 +113,7 @@ namespace DiscImageChef.Filesystems
byte[] vhSector = imagePlugin.ReadSectors(partition.Start, sectorsToRead);
drSigWord = BigEndianBitConverter.ToUInt16(vhSector, 0x400); // Check for HFS Wrapper MDB
ushort drSigWord = BigEndianBitConverter.ToUInt16(vhSector, 0x400);
if(drSigWord == HFS_MAGIC) // "BD"
{
@@ -147,120 +144,119 @@ namespace DiscImageChef.Filesystems
vhSector = imagePlugin.ReadSectors(partition.Start + hfspOffset, sectorsToRead); // Read volume header
HPVH.signature = BigEndianBitConverter.ToUInt16(vhSector, 0x400);
if(HPVH.signature == HFSP_MAGIC || HPVH.signature == HFSX_MAGIC)
vh.signature = BigEndianBitConverter.ToUInt16(vhSector, 0x400);
if(vh.signature != HFSP_MAGIC && vh.signature != HFSX_MAGIC) return;
StringBuilder sb = new StringBuilder();
if(vh.signature == 0x482B) sb.AppendLine("HFS+ filesystem.");
if(vh.signature == 0x4858) sb.AppendLine("HFSX filesystem.");
if(wrapped) sb.AppendLine("Volume is wrapped inside an HFS volume.");
byte[] tmp = new byte[0x400];
Array.Copy(vhSector, 0x400, tmp, 0, 0x400);
vhSector = tmp;
vh = BigEndianMarshal.ByteArrayToStructureBigEndian<HfsPlusVolumeHeader>(vhSector);
if(vh.version == 4 || vh.version == 5)
{
StringBuilder sb = new StringBuilder();
sb.AppendFormat("Filesystem version is {0}.", vh.version).AppendLine();
if(HPVH.signature == 0x482B) sb.AppendLine("HFS+ filesystem.");
if(HPVH.signature == 0x4858) sb.AppendLine("HFSX filesystem.");
if(wrapped) sb.AppendLine("Volume is wrapped inside an HFS volume.");
if((vh.attributes & 0x80) == 0x80) sb.AppendLine("Volume is locked on hardware.");
if((vh.attributes & 0x100) == 0x100) sb.AppendLine("Volume is unmounted.");
if((vh.attributes & 0x200) == 0x200) sb.AppendLine("There are bad blocks in the extents file.");
if((vh.attributes & 0x400) == 0x400) sb.AppendLine("Volume does not require cache.");
if((vh.attributes & 0x800) == 0x800) sb.AppendLine("Volume state is inconsistent.");
if((vh.attributes & 0x1000) == 0x1000) sb.AppendLine("CNIDs are reused.");
if((vh.attributes & 0x2000) == 0x2000) sb.AppendLine("Volume is journaled.");
if((vh.attributes & 0x8000) == 0x8000) sb.AppendLine("Volume is locked on software.");
byte[] tmp = new byte[0x400];
Array.Copy(vhSector, 0x400, tmp, 0, 0x400);
vhSector = tmp;
HPVH = BigEndianMarshal.ByteArrayToStructureBigEndian<HFSPlusVolumeHeader>(vhSector);
if(HPVH.version == 4 || HPVH.version == 5)
{
sb.AppendFormat("Filesystem version is {0}.", HPVH.version).AppendLine();
if((HPVH.attributes & 0x80) == 0x80) sb.AppendLine("Volume is locked on hardware.");
if((HPVH.attributes & 0x100) == 0x100) sb.AppendLine("Volume is unmounted.");
if((HPVH.attributes & 0x200) == 0x200) sb.AppendLine("There are bad blocks in the extents file.");
if((HPVH.attributes & 0x400) == 0x400) sb.AppendLine("Volume does not require cache.");
if((HPVH.attributes & 0x800) == 0x800) sb.AppendLine("Volume state is inconsistent.");
if((HPVH.attributes & 0x1000) == 0x1000) sb.AppendLine("CNIDs are reused.");
if((HPVH.attributes & 0x2000) == 0x2000) sb.AppendLine("Volume is journaled.");
if((HPVH.attributes & 0x8000) == 0x8000) sb.AppendLine("Volume is locked on software.");
sb.AppendFormat("Implementation that last mounted the volume: \"{0}\".",
Encoding.ASCII.GetString(HPVH.lastMountedVersion)).AppendLine();
if((HPVH.attributes & 0x2000) == 0x2000)
sb.AppendFormat("Journal starts at allocation block {0}.", HPVH.journalInfoBlock).AppendLine();
sb.AppendFormat("Creation date: {0}", DateHandlers.MacToDateTime(HPVH.createDate)).AppendLine();
sb.AppendFormat("Last modification date: {0}", DateHandlers.MacToDateTime(HPVH.modifyDate))
sb.AppendFormat("Implementation that last mounted the volume: \"{0}\".",
Encoding.ASCII.GetString(vh.lastMountedVersion)).AppendLine();
if((vh.attributes & 0x2000) == 0x2000)
sb.AppendFormat("Journal starts at allocation block {0}.", vh.journalInfoBlock).AppendLine();
sb.AppendFormat("Creation date: {0}", DateHandlers.MacToDateTime(vh.createDate)).AppendLine();
sb.AppendFormat("Last modification date: {0}", DateHandlers.MacToDateTime(vh.modifyDate))
.AppendLine();
if(vh.backupDate > 0)
sb.AppendFormat("Last backup date: {0}", DateHandlers.MacToDateTime(vh.backupDate))
.AppendLine();
else sb.AppendLine("Volume has never been backed up");
if(vh.backupDate > 0)
sb.AppendFormat("Last check date: {0}", DateHandlers.MacToDateTime(vh.checkedDate))
.AppendLine();
else sb.AppendLine("Volume has never been checked up");
sb.AppendFormat("{0} files on volume.", vh.fileCount).AppendLine();
sb.AppendFormat("{0} folders on volume.", vh.folderCount).AppendLine();
sb.AppendFormat("{0} bytes per allocation block.", vh.blockSize).AppendLine();
sb.AppendFormat("{0} allocation blocks.", vh.totalBlocks).AppendLine();
sb.AppendFormat("{0} free blocks.", vh.freeBlocks).AppendLine();
sb.AppendFormat("Next allocation block: {0}.", vh.nextAllocation).AppendLine();
sb.AppendFormat("Resource fork clump size: {0} bytes.", vh.rsrcClumpSize).AppendLine();
sb.AppendFormat("Data fork clump size: {0} bytes.", vh.dataClumpSize).AppendLine();
sb.AppendFormat("Next unused CNID: {0}.", vh.nextCatalogID).AppendLine();
sb.AppendFormat("Volume has been mounted writable {0} times.", vh.writeCount).AppendLine();
sb.AppendFormat("Allocation File is {0} bytes.", vh.allocationFile_logicalSize).AppendLine();
sb.AppendFormat("Extents File is {0} bytes.", vh.extentsFile_logicalSize).AppendLine();
sb.AppendFormat("Catalog File is {0} bytes.", vh.catalogFile_logicalSize).AppendLine();
sb.AppendFormat("Attributes File is {0} bytes.", vh.attributesFile_logicalSize).AppendLine();
sb.AppendFormat("Startup File is {0} bytes.", vh.startupFile_logicalSize).AppendLine();
sb.AppendLine("Finder info:");
sb.AppendFormat("CNID of bootable system's directory: {0}", vh.drFndrInfo0).AppendLine();
sb.AppendFormat("CNID of first-run application's directory: {0}", vh.drFndrInfo1).AppendLine();
sb.AppendFormat("CNID of previously opened directory: {0}", vh.drFndrInfo2).AppendLine();
sb.AppendFormat("CNID of bootable Mac OS 8 or 9 directory: {0}", vh.drFndrInfo3).AppendLine();
sb.AppendFormat("CNID of bootable Mac OS X directory: {0}", vh.drFndrInfo5).AppendLine();
if(vh.drFndrInfo6 != 0 && vh.drFndrInfo7 != 0)
sb.AppendFormat("Mac OS X Volume ID: {0:X8}{1:X8}", vh.drFndrInfo6, vh.drFndrInfo7)
.AppendLine();
if(HPVH.backupDate > 0)
sb.AppendFormat("Last backup date: {0}", DateHandlers.MacToDateTime(HPVH.backupDate))
.AppendLine();
else sb.AppendLine("Volume has never been backed up");
if(HPVH.backupDate > 0)
sb.AppendFormat("Last check date: {0}", DateHandlers.MacToDateTime(HPVH.checkedDate))
.AppendLine();
else sb.AppendLine("Volume has never been checked up");
sb.AppendFormat("{0} files on volume.", HPVH.fileCount).AppendLine();
sb.AppendFormat("{0} folders on volume.", HPVH.folderCount).AppendLine();
sb.AppendFormat("{0} bytes per allocation block.", HPVH.blockSize).AppendLine();
sb.AppendFormat("{0} allocation blocks.", HPVH.totalBlocks).AppendLine();
sb.AppendFormat("{0} free blocks.", HPVH.freeBlocks).AppendLine();
sb.AppendFormat("Next allocation block: {0}.", HPVH.nextAllocation).AppendLine();
sb.AppendFormat("Resource fork clump size: {0} bytes.", HPVH.rsrcClumpSize).AppendLine();
sb.AppendFormat("Data fork clump size: {0} bytes.", HPVH.dataClumpSize).AppendLine();
sb.AppendFormat("Next unused CNID: {0}.", HPVH.nextCatalogID).AppendLine();
sb.AppendFormat("Volume has been mounted writable {0} times.", HPVH.writeCount).AppendLine();
sb.AppendFormat("Allocation File is {0} bytes.", HPVH.allocationFile_logicalSize).AppendLine();
sb.AppendFormat("Extents File is {0} bytes.", HPVH.extentsFile_logicalSize).AppendLine();
sb.AppendFormat("Catalog File is {0} bytes.", HPVH.catalogFile_logicalSize).AppendLine();
sb.AppendFormat("Attributes File is {0} bytes.", HPVH.attributesFile_logicalSize).AppendLine();
sb.AppendFormat("Startup File is {0} bytes.", HPVH.startupFile_logicalSize).AppendLine();
sb.AppendLine("Finder info:");
sb.AppendFormat("CNID of bootable system's directory: {0}", HPVH.drFndrInfo0).AppendLine();
sb.AppendFormat("CNID of first-run application's directory: {0}", HPVH.drFndrInfo1).AppendLine();
sb.AppendFormat("CNID of previously opened directory: {0}", HPVH.drFndrInfo2).AppendLine();
sb.AppendFormat("CNID of bootable Mac OS 8 or 9 directory: {0}", HPVH.drFndrInfo3).AppendLine();
sb.AppendFormat("CNID of bootable Mac OS X directory: {0}", HPVH.drFndrInfo5).AppendLine();
if(HPVH.drFndrInfo6 != 0 && HPVH.drFndrInfo7 != 0)
sb.AppendFormat("Mac OS X Volume ID: {0:X8}{1:X8}", HPVH.drFndrInfo6, HPVH.drFndrInfo7)
.AppendLine();
XmlFsType = new FileSystemType();
if(HPVH.backupDate > 0)
{
XmlFsType.BackupDate = DateHandlers.MacToDateTime(HPVH.backupDate);
XmlFsType.BackupDateSpecified = true;
}
XmlFsType.Bootable |= HPVH.drFndrInfo0 != 0 || HPVH.drFndrInfo3 != 0 || HPVH.drFndrInfo5 != 0;
XmlFsType.Clusters = HPVH.totalBlocks;
XmlFsType.ClusterSize = (int)HPVH.blockSize;
if(HPVH.createDate > 0)
{
XmlFsType.CreationDate = DateHandlers.MacToDateTime(HPVH.createDate);
XmlFsType.CreationDateSpecified = true;
}
XmlFsType.Dirty = (HPVH.attributes & 0x100) != 0x100;
XmlFsType.Files = HPVH.fileCount;
XmlFsType.FilesSpecified = true;
XmlFsType.FreeClusters = HPVH.freeBlocks;
XmlFsType.FreeClustersSpecified = true;
if(HPVH.modifyDate > 0)
{
XmlFsType.ModificationDate = DateHandlers.MacToDateTime(HPVH.modifyDate);
XmlFsType.ModificationDateSpecified = true;
}
if(HPVH.signature == 0x482B) XmlFsType.Type = "HFS+";
if(HPVH.signature == 0x4858) XmlFsType.Type = "HFSX";
if(HPVH.drFndrInfo6 != 0 && HPVH.drFndrInfo7 != 0)
XmlFsType.VolumeSerial = $"{HPVH.drFndrInfo6:X8}{HPVH.drFndrInfo7:X8}";
XmlFsType.SystemIdentifier = Encoding.ASCII.GetString(HPVH.lastMountedVersion);
}
else
XmlFsType = new FileSystemType();
if(vh.backupDate > 0)
{
sb.AppendFormat("Filesystem version is {0}.", HPVH.version).AppendLine();
sb.AppendLine("This version is not supported yet.");
XmlFsType.BackupDate = DateHandlers.MacToDateTime(vh.backupDate);
XmlFsType.BackupDateSpecified = true;
}
information = sb.ToString();
XmlFsType.Bootable |= vh.drFndrInfo0 != 0 || vh.drFndrInfo3 != 0 || vh.drFndrInfo5 != 0;
XmlFsType.Clusters = vh.totalBlocks;
XmlFsType.ClusterSize = (int)vh.blockSize;
if(vh.createDate > 0)
{
XmlFsType.CreationDate = DateHandlers.MacToDateTime(vh.createDate);
XmlFsType.CreationDateSpecified = true;
}
XmlFsType.Dirty = (vh.attributes & 0x100) != 0x100;
XmlFsType.Files = vh.fileCount;
XmlFsType.FilesSpecified = true;
XmlFsType.FreeClusters = vh.freeBlocks;
XmlFsType.FreeClustersSpecified = true;
if(vh.modifyDate > 0)
{
XmlFsType.ModificationDate = DateHandlers.MacToDateTime(vh.modifyDate);
XmlFsType.ModificationDateSpecified = true;
}
if(vh.signature == 0x482B) XmlFsType.Type = "HFS+";
if(vh.signature == 0x4858) XmlFsType.Type = "HFSX";
if(vh.drFndrInfo6 != 0 && vh.drFndrInfo7 != 0)
XmlFsType.VolumeSerial = $"{vh.drFndrInfo6:X8}{vh.drFndrInfo7:X8}";
XmlFsType.SystemIdentifier = Encoding.ASCII.GetString(vh.lastMountedVersion);
}
else return;
else
{
sb.AppendFormat("Filesystem version is {0}.", vh.version).AppendLine();
sb.AppendLine("This version is not supported yet.");
}
information = sb.ToString();
}
/// <summary>
/// HFS+ Volume Header, should be at offset 0x0400 bytes in volume with a size of 532 bytes
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct HFSPlusVolumeHeader
struct HfsPlusVolumeHeader
{
/// <summary>0x000, "H+" for HFS+, "HX" for HFSX</summary>
public ushort signature;

View File

@@ -45,15 +45,13 @@ namespace DiscImageChef.Filesystems.AppleMFS
{
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
ushort drSigWord;
if(2 + partition.Start >= partition.End) return false;
byte[] mdbSector = imagePlugin.ReadSector(2 + partition.Start);
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
drSigWord = BigEndianBitConverter.ToUInt16(mdbSector, 0x000);
ushort drSigWord = BigEndianBitConverter.ToUInt16(mdbSector, 0x000);
return drSigWord == MFS_MAGIC;
}
@@ -66,8 +64,8 @@ namespace DiscImageChef.Filesystems.AppleMFS
StringBuilder sb = new StringBuilder();
MFS_MasterDirectoryBlock MDB = new MFS_MasterDirectoryBlock();
MFS_BootBlock BB = new MFS_BootBlock();
MFS_MasterDirectoryBlock mdb = new MFS_MasterDirectoryBlock();
MFS_BootBlock bb = new MFS_BootBlock();
byte[] pString = new byte[16];
@@ -76,101 +74,101 @@ namespace DiscImageChef.Filesystems.AppleMFS
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
MDB.drSigWord = BigEndianBitConverter.ToUInt16(mdbSector, 0x000);
if(MDB.drSigWord != MFS_MAGIC) return;
mdb.drSigWord = BigEndianBitConverter.ToUInt16(mdbSector, 0x000);
if(mdb.drSigWord != MFS_MAGIC) return;
MDB.drCrDate = BigEndianBitConverter.ToUInt32(mdbSector, 0x002);
MDB.drLsBkUp = BigEndianBitConverter.ToUInt32(mdbSector, 0x006);
MDB.drAtrb = BigEndianBitConverter.ToUInt16(mdbSector, 0x00A);
MDB.drNmFls = BigEndianBitConverter.ToUInt16(mdbSector, 0x00C);
MDB.drDirSt = BigEndianBitConverter.ToUInt16(mdbSector, 0x00E);
MDB.drBlLen = BigEndianBitConverter.ToUInt16(mdbSector, 0x010);
MDB.drNmAlBlks = BigEndianBitConverter.ToUInt16(mdbSector, 0x012);
MDB.drAlBlkSiz = BigEndianBitConverter.ToUInt32(mdbSector, 0x014);
MDB.drClpSiz = BigEndianBitConverter.ToUInt32(mdbSector, 0x018);
MDB.drAlBlSt = BigEndianBitConverter.ToUInt16(mdbSector, 0x01C);
MDB.drNxtFNum = BigEndianBitConverter.ToUInt32(mdbSector, 0x01E);
MDB.drFreeBks = BigEndianBitConverter.ToUInt16(mdbSector, 0x022);
MDB.drVNSiz = mdbSector[0x024];
byte[] variableSize = new byte[MDB.drVNSiz + 1];
Array.Copy(mdbSector, 0x024, variableSize, 0, MDB.drVNSiz + 1);
MDB.drVN = StringHandlers.PascalToString(variableSize, Encoding);
mdb.drCrDate = BigEndianBitConverter.ToUInt32(mdbSector, 0x002);
mdb.drLsBkUp = BigEndianBitConverter.ToUInt32(mdbSector, 0x006);
mdb.drAtrb = BigEndianBitConverter.ToUInt16(mdbSector, 0x00A);
mdb.drNmFls = BigEndianBitConverter.ToUInt16(mdbSector, 0x00C);
mdb.drDirSt = BigEndianBitConverter.ToUInt16(mdbSector, 0x00E);
mdb.drBlLen = BigEndianBitConverter.ToUInt16(mdbSector, 0x010);
mdb.drNmAlBlks = BigEndianBitConverter.ToUInt16(mdbSector, 0x012);
mdb.drAlBlkSiz = BigEndianBitConverter.ToUInt32(mdbSector, 0x014);
mdb.drClpSiz = BigEndianBitConverter.ToUInt32(mdbSector, 0x018);
mdb.drAlBlSt = BigEndianBitConverter.ToUInt16(mdbSector, 0x01C);
mdb.drNxtFNum = BigEndianBitConverter.ToUInt32(mdbSector, 0x01E);
mdb.drFreeBks = BigEndianBitConverter.ToUInt16(mdbSector, 0x022);
mdb.drVNSiz = mdbSector[0x024];
byte[] variableSize = new byte[mdb.drVNSiz + 1];
Array.Copy(mdbSector, 0x024, variableSize, 0, mdb.drVNSiz + 1);
mdb.drVN = StringHandlers.PascalToString(variableSize, Encoding);
BB.signature = BigEndianBitConverter.ToUInt16(bbSector, 0x000);
bb.signature = BigEndianBitConverter.ToUInt16(bbSector, 0x000);
if(BB.signature == MFSBB_MAGIC)
if(bb.signature == MFSBB_MAGIC)
{
BB.branch = BigEndianBitConverter.ToUInt32(bbSector, 0x002);
BB.boot_flags = bbSector[0x006];
BB.boot_version = bbSector[0x007];
bb.branch = BigEndianBitConverter.ToUInt32(bbSector, 0x002);
bb.boot_flags = bbSector[0x006];
bb.boot_version = bbSector[0x007];
BB.sec_sv_pages = BigEndianBitConverter.ToInt16(bbSector, 0x008);
bb.sec_sv_pages = BigEndianBitConverter.ToInt16(bbSector, 0x008);
Array.Copy(mdbSector, 0x00A, pString, 0, 16);
BB.system_name = StringHandlers.PascalToString(pString, Encoding);
bb.system_name = StringHandlers.PascalToString(pString, Encoding);
Array.Copy(mdbSector, 0x01A, pString, 0, 16);
BB.finder_name = StringHandlers.PascalToString(pString, Encoding);
bb.finder_name = StringHandlers.PascalToString(pString, Encoding);
Array.Copy(mdbSector, 0x02A, pString, 0, 16);
BB.debug_name = StringHandlers.PascalToString(pString, Encoding);
bb.debug_name = StringHandlers.PascalToString(pString, Encoding);
Array.Copy(mdbSector, 0x03A, pString, 0, 16);
BB.disasm_name = StringHandlers.PascalToString(pString, Encoding);
bb.disasm_name = StringHandlers.PascalToString(pString, Encoding);
Array.Copy(mdbSector, 0x04A, pString, 0, 16);
BB.stupscr_name = StringHandlers.PascalToString(pString, Encoding);
bb.stupscr_name = StringHandlers.PascalToString(pString, Encoding);
Array.Copy(mdbSector, 0x05A, pString, 0, 16);
BB.bootup_name = StringHandlers.PascalToString(pString, Encoding);
bb.bootup_name = StringHandlers.PascalToString(pString, Encoding);
Array.Copy(mdbSector, 0x06A, pString, 0, 16);
BB.clipbrd_name = StringHandlers.PascalToString(pString, Encoding);
bb.clipbrd_name = StringHandlers.PascalToString(pString, Encoding);
BB.max_files = BigEndianBitConverter.ToUInt16(bbSector, 0x07A);
BB.queue_size = BigEndianBitConverter.ToUInt16(bbSector, 0x07C);
BB.heap_128k = BigEndianBitConverter.ToUInt32(bbSector, 0x07E);
BB.heap_256k = BigEndianBitConverter.ToUInt32(bbSector, 0x082);
BB.heap_512k = BigEndianBitConverter.ToUInt32(bbSector, 0x086);
bb.max_files = BigEndianBitConverter.ToUInt16(bbSector, 0x07A);
bb.queue_size = BigEndianBitConverter.ToUInt16(bbSector, 0x07C);
bb.heap_128k = BigEndianBitConverter.ToUInt32(bbSector, 0x07E);
bb.heap_256k = BigEndianBitConverter.ToUInt32(bbSector, 0x082);
bb.heap_512k = BigEndianBitConverter.ToUInt32(bbSector, 0x086);
}
else BB.signature = 0x0000;
else bb.signature = 0x0000;
sb.AppendLine("Apple Macintosh File System");
sb.AppendLine();
sb.AppendLine("Master Directory Block:");
sb.AppendFormat("Creation date: {0}", DateHandlers.MacToDateTime(MDB.drCrDate)).AppendLine();
sb.AppendFormat("Last backup date: {0}", DateHandlers.MacToDateTime(MDB.drLsBkUp)).AppendLine();
if((MDB.drAtrb & 0x80) == 0x80) sb.AppendLine("Volume is locked by hardware.");
if((MDB.drAtrb & 0x8000) == 0x8000) sb.AppendLine("Volume is locked by software.");
sb.AppendFormat("{0} files on volume", MDB.drNmFls).AppendLine();
sb.AppendFormat("First directory sector: {0}", MDB.drDirSt).AppendLine();
sb.AppendFormat("{0} sectors in directory.", MDB.drBlLen).AppendLine();
sb.AppendFormat("{0} volume allocation blocks.", MDB.drNmAlBlks + 1).AppendLine();
sb.AppendFormat("Size of allocation blocks: {0} bytes", MDB.drAlBlkSiz).AppendLine();
sb.AppendFormat("{0} bytes to allocate.", MDB.drClpSiz).AppendLine();
sb.AppendFormat("First allocation block (#2) starts in sector {0}.", MDB.drAlBlSt).AppendLine();
sb.AppendFormat("Next unused file number: {0}", MDB.drNxtFNum).AppendLine();
sb.AppendFormat("{0} unused allocation blocks.", MDB.drFreeBks).AppendLine();
sb.AppendFormat("Volume name: {0}", MDB.drVN).AppendLine();
sb.AppendFormat("Creation date: {0}", DateHandlers.MacToDateTime(mdb.drCrDate)).AppendLine();
sb.AppendFormat("Last backup date: {0}", DateHandlers.MacToDateTime(mdb.drLsBkUp)).AppendLine();
if((mdb.drAtrb & 0x80) == 0x80) sb.AppendLine("Volume is locked by hardware.");
if((mdb.drAtrb & 0x8000) == 0x8000) sb.AppendLine("Volume is locked by software.");
sb.AppendFormat("{0} files on volume", mdb.drNmFls).AppendLine();
sb.AppendFormat("First directory sector: {0}", mdb.drDirSt).AppendLine();
sb.AppendFormat("{0} sectors in directory.", mdb.drBlLen).AppendLine();
sb.AppendFormat("{0} volume allocation blocks.", mdb.drNmAlBlks + 1).AppendLine();
sb.AppendFormat("Size of allocation blocks: {0} bytes", mdb.drAlBlkSiz).AppendLine();
sb.AppendFormat("{0} bytes to allocate.", mdb.drClpSiz).AppendLine();
sb.AppendFormat("First allocation block (#2) starts in sector {0}.", mdb.drAlBlSt).AppendLine();
sb.AppendFormat("Next unused file number: {0}", mdb.drNxtFNum).AppendLine();
sb.AppendFormat("{0} unused allocation blocks.", mdb.drFreeBks).AppendLine();
sb.AppendFormat("Volume name: {0}", mdb.drVN).AppendLine();
if(BB.signature == MFSBB_MAGIC)
if(bb.signature == MFSBB_MAGIC)
{
sb.AppendLine("Volume is bootable.");
sb.AppendLine();
sb.AppendLine("Boot Block:");
if((BB.boot_flags & 0x40) == 0x40) sb.AppendLine("Boot block should be executed.");
if((BB.boot_flags & 0x80) == 0x80) sb.AppendLine("Boot block is in new unknown format.");
if((bb.boot_flags & 0x40) == 0x40) sb.AppendLine("Boot block should be executed.");
if((bb.boot_flags & 0x80) == 0x80) sb.AppendLine("Boot block is in new unknown format.");
else
{
if(BB.sec_sv_pages > 0) sb.AppendLine("Allocate secondary sound buffer at boot.");
else if(BB.sec_sv_pages < 0) sb.AppendLine("Allocate secondary sound and video buffers at boot.");
if(bb.sec_sv_pages > 0) sb.AppendLine("Allocate secondary sound buffer at boot.");
else if(bb.sec_sv_pages < 0) sb.AppendLine("Allocate secondary sound and video buffers at boot.");
sb.AppendFormat("System filename: {0}", BB.system_name).AppendLine();
sb.AppendFormat("Finder filename: {0}", BB.finder_name).AppendLine();
sb.AppendFormat("Debugger filename: {0}", BB.debug_name).AppendLine();
sb.AppendFormat("Disassembler filename: {0}", BB.disasm_name).AppendLine();
sb.AppendFormat("Startup screen filename: {0}", BB.stupscr_name).AppendLine();
sb.AppendFormat("First program to execute at boot: {0}", BB.bootup_name).AppendLine();
sb.AppendFormat("Clipboard filename: {0}", BB.clipbrd_name).AppendLine();
sb.AppendFormat("Maximum opened files: {0}", BB.max_files * 4).AppendLine();
sb.AppendFormat("Event queue size: {0}", BB.queue_size).AppendLine();
sb.AppendFormat("Heap size with 128KiB of RAM: {0} bytes", BB.heap_128k).AppendLine();
sb.AppendFormat("Heap size with 256KiB of RAM: {0} bytes", BB.heap_256k).AppendLine();
sb.AppendFormat("Heap size with 512KiB of RAM or more: {0} bytes", BB.heap_512k).AppendLine();
sb.AppendFormat("System filename: {0}", bb.system_name).AppendLine();
sb.AppendFormat("Finder filename: {0}", bb.finder_name).AppendLine();
sb.AppendFormat("Debugger filename: {0}", bb.debug_name).AppendLine();
sb.AppendFormat("Disassembler filename: {0}", bb.disasm_name).AppendLine();
sb.AppendFormat("Startup screen filename: {0}", bb.stupscr_name).AppendLine();
sb.AppendFormat("First program to execute at boot: {0}", bb.bootup_name).AppendLine();
sb.AppendFormat("Clipboard filename: {0}", bb.clipbrd_name).AppendLine();
sb.AppendFormat("Maximum opened files: {0}", bb.max_files * 4).AppendLine();
sb.AppendFormat("Event queue size: {0}", bb.queue_size).AppendLine();
sb.AppendFormat("Heap size with 128KiB of RAM: {0} bytes", bb.heap_128k).AppendLine();
sb.AppendFormat("Heap size with 256KiB of RAM: {0} bytes", bb.heap_256k).AppendLine();
sb.AppendFormat("Heap size with 512KiB of RAM or more: {0} bytes", bb.heap_512k).AppendLine();
}
}
else sb.AppendLine("Volume is not bootable.");
@@ -178,25 +176,25 @@ namespace DiscImageChef.Filesystems.AppleMFS
information = sb.ToString();
XmlFsType = new FileSystemType();
if(MDB.drLsBkUp > 0)
if(mdb.drLsBkUp > 0)
{
XmlFsType.BackupDate = DateHandlers.MacToDateTime(MDB.drLsBkUp);
XmlFsType.BackupDate = DateHandlers.MacToDateTime(mdb.drLsBkUp);
XmlFsType.BackupDateSpecified = true;
}
XmlFsType.Bootable = BB.signature == MFSBB_MAGIC;
XmlFsType.Clusters = MDB.drNmAlBlks;
XmlFsType.ClusterSize = (int)MDB.drAlBlkSiz;
if(MDB.drCrDate > 0)
XmlFsType.Bootable = bb.signature == MFSBB_MAGIC;
XmlFsType.Clusters = mdb.drNmAlBlks;
XmlFsType.ClusterSize = (int)mdb.drAlBlkSiz;
if(mdb.drCrDate > 0)
{
XmlFsType.CreationDate = DateHandlers.MacToDateTime(MDB.drCrDate);
XmlFsType.CreationDate = DateHandlers.MacToDateTime(mdb.drCrDate);
XmlFsType.CreationDateSpecified = true;
}
XmlFsType.Files = MDB.drNmFls;
XmlFsType.Files = mdb.drNmFls;
XmlFsType.FilesSpecified = true;
XmlFsType.FreeClusters = MDB.drFreeBks;
XmlFsType.FreeClusters = mdb.drFreeBks;
XmlFsType.FreeClustersSpecified = true;
XmlFsType.Type = "MFS";
XmlFsType.VolumeName = MDB.drVN;
XmlFsType.VolumeName = mdb.drVN;
}
}
}

View File

@@ -65,13 +65,11 @@ namespace DiscImageChef.Filesystems
if(sector + partition.Start >= partition.End) return false;
uint magic;
byte[] tmp = imagePlugin.ReadSectors(sector + partition.Start, run);
byte[] sbSector = new byte[AFS_SUPERBLOCK_SIZE];
Array.Copy(tmp, offset, sbSector, 0, AFS_SUPERBLOCK_SIZE);
magic = BitConverter.ToUInt32(sbSector, 0x20);
uint magic = BitConverter.ToUInt32(sbSector, 0x20);
return magic == AFS_MAGIC1;
}

View File

@@ -63,13 +63,10 @@ namespace DiscImageChef.Filesystems
{
if(2 + partition.Start >= partition.End) return false;
uint magic;
uint magicBe;
byte[] sbSector = imagePlugin.ReadSector(0 + partition.Start);
magic = BitConverter.ToUInt32(sbSector, 0x20);
magicBe = BigEndianBitConverter.ToUInt32(sbSector, 0x20);
uint magic = BitConverter.ToUInt32(sbSector, 0x20);
uint magicBe = BigEndianBitConverter.ToUInt32(sbSector, 0x20);
if(magic == BEFS_MAGIC1 || magicBe == BEFS_MAGIC1) return true;

View File

@@ -45,7 +45,7 @@ namespace DiscImageChef.Filesystems
/// <summary>
/// BTRFS magic "_BHRfS_M"
/// </summary>
const ulong btrfsMagic = 0x4D5F53665248425F;
const ulong BTRFS_MAGIC = 0x4D5F53665248425F;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
@@ -77,7 +77,7 @@ namespace DiscImageChef.Filesystems
DicConsole.DebugWriteLine("BTRFS Plugin", "partition.PartitionStartSector = {0}", partition.Start);
DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.magic = 0x{0:X16}", btrfsSb.magic);
return btrfsSb.magic == btrfsMagic;
return btrfsSb.magic == BTRFS_MAGIC;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,

View File

@@ -74,10 +74,10 @@ namespace DiscImageChef.Filesystems
else
{
sector = imagePlugin.ReadSector(357);
CommodoreBAM cbmBam = new CommodoreBAM();
CommodoreBam cbmBam = new CommodoreBam();
IntPtr cbmBamPtr = Marshal.AllocHGlobal(Marshal.SizeOf(cbmBam));
Marshal.Copy(sector, 0, cbmBamPtr, Marshal.SizeOf(cbmBam));
cbmBam = (CommodoreBAM)Marshal.PtrToStructure(cbmBamPtr, typeof(CommodoreBAM));
cbmBam = (CommodoreBam)Marshal.PtrToStructure(cbmBamPtr, typeof(CommodoreBam));
Marshal.FreeHGlobal(cbmBamPtr);
if(cbmBam.dosVersion == 0x41 && (cbmBam.doubleSided == 0x00 || cbmBam.doubleSided == 0x80) &&
@@ -132,10 +132,10 @@ namespace DiscImageChef.Filesystems
else
{
sector = imagePlugin.ReadSector(357);
CommodoreBAM cbmBam = new CommodoreBAM();
CommodoreBam cbmBam = new CommodoreBam();
IntPtr cbmBamPtr = Marshal.AllocHGlobal(Marshal.SizeOf(cbmBam));
Marshal.Copy(sector, 0, cbmBamPtr, Marshal.SizeOf(cbmBam));
cbmBam = (CommodoreBAM)Marshal.PtrToStructure(cbmBamPtr, typeof(CommodoreBAM));
cbmBam = (CommodoreBam)Marshal.PtrToStructure(cbmBamPtr, typeof(CommodoreBam));
Marshal.FreeHGlobal(cbmBamPtr);
sbInformation.AppendFormat("Directory starts at track {0} sector {1}", cbmBam.directoryTrack,
@@ -157,7 +157,7 @@ namespace DiscImageChef.Filesystems
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct CommodoreBAM
struct CommodoreBam
{
/// <summary>
/// Track where directory starts

View File

@@ -172,19 +172,17 @@ namespace DiscImageChef.Filesystems.CPM
sector = imagePlugin.ReadSector(0 + partition.Start);
int amsSbOffset = 0;
uint sig1, sig2, sig3;
sig1 = BitConverter.ToUInt32(sector, 0x2B);
sig2 = BitConverter.ToUInt32(sector, 0x33) & 0x00FFFFFF;
sig3 = BitConverter.ToUInt32(sector, 0x7C);
uint sig1 = BitConverter.ToUInt32(sector, 0x2B);
uint sig2 = BitConverter.ToUInt32(sector, 0x33) & 0x00FFFFFF;
uint sig3 = BitConverter.ToUInt32(sector, 0x7C);
// PCW16 extended boot record
if(sig1 == 0x4D2F5043 && sig2 == 0x004B5344 && sig3 == sig1) amsSbOffset = 0x80;
// Read the superblock
AmstradSuperBlock amsSb;
IntPtr amsPtr = Marshal.AllocHGlobal(16);
Marshal.Copy(sector, amsSbOffset, amsPtr, 16);
amsSb = (AmstradSuperBlock)Marshal.PtrToStructure(amsPtr, typeof(AmstradSuperBlock));
AmstradSuperBlock amsSb = (AmstradSuperBlock)Marshal.PtrToStructure(amsPtr, typeof(AmstradSuperBlock));
Marshal.FreeHGlobal(amsPtr);
// Check that format byte and sidedness indicate the same number of sizes

View File

@@ -42,7 +42,7 @@ namespace DiscImageChef.Filesystems
{
public class ECMA67 : IFilesystem
{
readonly byte[] ECMA67_Magic = {0x56, 0x4F, 0x4C};
readonly byte[] ecma67_magic = {0x56, 0x4F, 0x4C};
public Encoding Encoding { get; private set; }
public string Name => "ECMA-67";
@@ -65,7 +65,7 @@ namespace DiscImageChef.Filesystems
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;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,

View File

@@ -307,12 +307,10 @@ namespace DiscImageChef.Filesystems
// HPFS
if(16 + partition.Start <= partition.End)
{
uint hpfsMagic1, hpfsMagic2;
byte[] hpfsSbSector =
imagePlugin.ReadSector(16 + partition.Start); // Seek to superblock, on logical sector 16
hpfsMagic1 = BitConverter.ToUInt32(hpfsSbSector, 0x000);
hpfsMagic2 = BitConverter.ToUInt32(hpfsSbSector, 0x004);
uint hpfsMagic1 = BitConverter.ToUInt32(hpfsSbSector, 0x000);
uint hpfsMagic2 = BitConverter.ToUInt32(hpfsSbSector, 0x004);
if(hpfsMagic1 == 0xF995E849 && hpfsMagic2 == 0xFA53E9C5) return false;
}

View File

@@ -52,10 +52,9 @@ namespace DiscImageChef.Filesystems
{
if(imagePlugin.Info.SectorSize < 512) return false;
FATX_Superblock fatxSb;
byte[] sector = imagePlugin.ReadSector(partition.Start);
fatxSb = BigEndianMarshal.ByteArrayToStructureBigEndian<FATX_Superblock>(sector);
FATX_Superblock fatxSb = BigEndianMarshal.ByteArrayToStructureBigEndian<FATX_Superblock>(sector);
return fatxSb.magic == FATX_MAGIC;
}
@@ -67,11 +66,9 @@ namespace DiscImageChef.Filesystems
information = "";
if(imagePlugin.Info.SectorSize < 512) return;
FATX_Superblock fatxSb;
byte[] sector = imagePlugin.ReadSector(partition.Start);
fatxSb = BigEndianMarshal.ByteArrayToStructureBigEndian<FATX_Superblock>(sector);
FATX_Superblock fatxSb = BigEndianMarshal.ByteArrayToStructureBigEndian<FATX_Superblock>(sector);
if(fatxSb.magic != FATX_MAGIC) return;

View File

@@ -56,12 +56,10 @@ namespace DiscImageChef.Filesystems
{
ulong hdrSector = HEADER_POS / imagePlugin.Info.SectorSize;
FossilHeader hdr;
if(partition.Start + hdrSector > imagePlugin.Info.Sectors) return false;
byte[] sector = imagePlugin.ReadSector(partition.Start + hdrSector);
hdr = BigEndianMarshal.ByteArrayToStructureBigEndian<FossilHeader>(sector);
FossilHeader hdr = BigEndianMarshal.ByteArrayToStructureBigEndian<FossilHeader>(sector);
DicConsole.DebugWriteLine("Fossil plugin", "magic at 0x{0:X8} (expected 0x{1:X8})", hdr.magic,
FOSSIL_HDR_MAGIC);
@@ -79,10 +77,8 @@ namespace DiscImageChef.Filesystems
ulong hdrSector = HEADER_POS / imagePlugin.Info.SectorSize;
FossilHeader hdr;
byte[] sector = imagePlugin.ReadSector(partition.Start + hdrSector);
hdr = BigEndianMarshal.ByteArrayToStructureBigEndian<FossilHeader>(sector);
FossilHeader hdr = BigEndianMarshal.ByteArrayToStructureBigEndian<FossilHeader>(sector);
DicConsole.DebugWriteLine("Fossil plugin", "magic at 0x{0:X8} (expected 0x{1:X8})", hdr.magic,
FOSSIL_HDR_MAGIC);

View File

@@ -65,11 +65,9 @@ namespace DiscImageChef.Filesystems
if(run + partition.Start >= partition.End) return false;
ulong magic;
byte[] sbSector = imagePlugin.ReadSectors(partition.Start, run);
magic = BitConverter.ToUInt64(sbSector, 0);
ulong magic = BitConverter.ToUInt64(sbSector, 0);
return magic == HAMMER_FSBUF_VOLUME || magic == HAMMER_FSBUF_VOLUME_REV;
}
@@ -88,11 +86,9 @@ namespace DiscImageChef.Filesystems
if(HAMMER_VOLHDR_SIZE % imagePlugin.Info.SectorSize > 0) run++;
ulong magic;
byte[] sbSector = imagePlugin.ReadSectors(partition.Start, run);
magic = BitConverter.ToUInt64(sbSector, 0);
ulong magic = BitConverter.ToUInt64(sbSector, 0);
if(magic == HAMMER_FSBUF_VOLUME)
{

View File

@@ -77,18 +77,18 @@ namespace DiscImageChef.Filesystems
IntPtr bpbPtr = Marshal.AllocHGlobal(512);
Marshal.Copy(hpfsBpbSector, 0, bpbPtr, 512);
HPFS_BIOSParameterBlock hpfsBpb =
(HPFS_BIOSParameterBlock)Marshal.PtrToStructure(bpbPtr, typeof(HPFS_BIOSParameterBlock));
HpfsBiosParameterBlock hpfsBpb =
(HpfsBiosParameterBlock)Marshal.PtrToStructure(bpbPtr, typeof(HpfsBiosParameterBlock));
Marshal.FreeHGlobal(bpbPtr);
IntPtr sbPtr = Marshal.AllocHGlobal(512);
Marshal.Copy(hpfsSbSector, 0, sbPtr, 512);
HPFS_SuperBlock hpfsSb = (HPFS_SuperBlock)Marshal.PtrToStructure(sbPtr, typeof(HPFS_SuperBlock));
HpfsSuperBlock hpfsSb = (HpfsSuperBlock)Marshal.PtrToStructure(sbPtr, typeof(HpfsSuperBlock));
Marshal.FreeHGlobal(sbPtr);
IntPtr spPtr = Marshal.AllocHGlobal(512);
Marshal.Copy(hpfsSpSector, 0, spPtr, 512);
HPFS_SpareBlock hpfsSp = (HPFS_SpareBlock)Marshal.PtrToStructure(spPtr, typeof(HPFS_SpareBlock));
HpfsSpareBlock hpfsSp = (HpfsSpareBlock)Marshal.PtrToStructure(spPtr, typeof(HpfsSpareBlock));
Marshal.FreeHGlobal(spPtr);
if(StringHandlers.CToString(hpfsBpb.fs_type) != "HPFS " || hpfsSb.magic1 != 0xF995E849 ||
@@ -206,7 +206,7 @@ namespace DiscImageChef.Filesystems
/// BIOS Parameter Block, at sector 0
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct HPFS_BIOSParameterBlock
struct HpfsBiosParameterBlock
{
/// <summary>0x000, Jump to boot code</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
@@ -263,7 +263,7 @@ namespace DiscImageChef.Filesystems
/// HPFS superblock at sector 16
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct HPFS_SuperBlock
struct HpfsSuperBlock
{
/// <summary>0x000, 0xF995E849</summary>
public uint magic1;
@@ -317,7 +317,7 @@ namespace DiscImageChef.Filesystems
/// HPFS spareblock at sector 17
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct HPFS_SpareBlock
struct HpfsSpareBlock
{
/// <summary>0x000, 0xF9911849</summary>
public uint magic1;

View File

@@ -57,10 +57,10 @@ namespace DiscImageChef.Filesystems
byte[] sector = imagePlugin.ReadSector(partition.Start + bootSectors);
if(sector.Length < 512) return false;
JFS_SuperBlock jfsSb = new JFS_SuperBlock();
JfsSuperBlock jfsSb = new JfsSuperBlock();
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(jfsSb));
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(jfsSb));
jfsSb = (JFS_SuperBlock)Marshal.PtrToStructure(sbPtr, typeof(JFS_SuperBlock));
jfsSb = (JfsSuperBlock)Marshal.PtrToStructure(sbPtr, typeof(JfsSuperBlock));
Marshal.FreeHGlobal(sbPtr);
return jfsSb.s_magic == JFS_MAGIC;
@@ -76,10 +76,10 @@ namespace DiscImageChef.Filesystems
byte[] sector = imagePlugin.ReadSector(partition.Start + bootSectors);
if(sector.Length < 512) return;
JFS_SuperBlock jfsSb = new JFS_SuperBlock();
JfsSuperBlock jfsSb = new JfsSuperBlock();
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(jfsSb));
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(jfsSb));
jfsSb = (JFS_SuperBlock)Marshal.PtrToStructure(sbPtr, typeof(JFS_SuperBlock));
jfsSb = (JfsSuperBlock)Marshal.PtrToStructure(sbPtr, typeof(JfsSuperBlock));
Marshal.FreeHGlobal(sbPtr);
sb.AppendLine("JFS filesystem");
@@ -87,31 +87,31 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("{0} blocks of {1} bytes", jfsSb.s_size, jfsSb.s_bsize).AppendLine();
sb.AppendFormat("{0} blocks per allocation group", jfsSb.s_agsize).AppendLine();
if(jfsSb.s_flags.HasFlag(JFS_Flags.Unicode)) sb.AppendLine("Volume uses Unicode for directory entries");
if(jfsSb.s_flags.HasFlag(JFS_Flags.RemountRO)) sb.AppendLine("Volume remounts read-only on error");
if(jfsSb.s_flags.HasFlag(JFS_Flags.Continue)) sb.AppendLine("Volume continues on error");
if(jfsSb.s_flags.HasFlag(JFS_Flags.Panic)) sb.AppendLine("Volume panics on error");
if(jfsSb.s_flags.HasFlag(JFS_Flags.UserQuota)) sb.AppendLine("Volume has user quotas enabled");
if(jfsSb.s_flags.HasFlag(JFS_Flags.GroupQuota)) sb.AppendLine("Volume has group quotas enabled");
if(jfsSb.s_flags.HasFlag(JFS_Flags.NoJournal)) sb.AppendLine("Volume is not using any journal");
if(jfsSb.s_flags.HasFlag(JFS_Flags.Discard))
if(jfsSb.s_flags.HasFlag(JfsFlags.Unicode)) sb.AppendLine("Volume uses Unicode for directory entries");
if(jfsSb.s_flags.HasFlag(JfsFlags.RemountRO)) sb.AppendLine("Volume remounts read-only on error");
if(jfsSb.s_flags.HasFlag(JfsFlags.Continue)) sb.AppendLine("Volume continues on error");
if(jfsSb.s_flags.HasFlag(JfsFlags.Panic)) sb.AppendLine("Volume panics on error");
if(jfsSb.s_flags.HasFlag(JfsFlags.UserQuota)) sb.AppendLine("Volume has user quotas enabled");
if(jfsSb.s_flags.HasFlag(JfsFlags.GroupQuota)) sb.AppendLine("Volume has group quotas enabled");
if(jfsSb.s_flags.HasFlag(JfsFlags.NoJournal)) sb.AppendLine("Volume is not using any journal");
if(jfsSb.s_flags.HasFlag(JfsFlags.Discard))
sb.AppendLine("Volume sends TRIM/UNMAP commands to underlying device");
if(jfsSb.s_flags.HasFlag(JFS_Flags.GroupCommit)) sb.AppendLine("Volume commits in groups of 1");
if(jfsSb.s_flags.HasFlag(JFS_Flags.LazyCommit)) sb.AppendLine("Volume commits lazy");
if(jfsSb.s_flags.HasFlag(JFS_Flags.Temporary)) sb.AppendLine("Volume does not commit to log");
if(jfsSb.s_flags.HasFlag(JFS_Flags.InlineLog)) sb.AppendLine("Volume has log withing itself");
if(jfsSb.s_flags.HasFlag(JFS_Flags.InlineMoving))
if(jfsSb.s_flags.HasFlag(JfsFlags.GroupCommit)) sb.AppendLine("Volume commits in groups of 1");
if(jfsSb.s_flags.HasFlag(JfsFlags.LazyCommit)) sb.AppendLine("Volume commits lazy");
if(jfsSb.s_flags.HasFlag(JfsFlags.Temporary)) sb.AppendLine("Volume does not commit to log");
if(jfsSb.s_flags.HasFlag(JfsFlags.InlineLog)) sb.AppendLine("Volume has log withing itself");
if(jfsSb.s_flags.HasFlag(JfsFlags.InlineMoving))
sb.AppendLine("Volume has log withing itself and is moving it out");
if(jfsSb.s_flags.HasFlag(JFS_Flags.BadSAIT)) sb.AppendLine("Volume has bad current secondary ait");
if(jfsSb.s_flags.HasFlag(JFS_Flags.Sparse)) sb.AppendLine("Volume supports sparse files");
if(jfsSb.s_flags.HasFlag(JFS_Flags.DASDEnabled)) sb.AppendLine("Volume has DASD limits enabled");
if(jfsSb.s_flags.HasFlag(JFS_Flags.DASDPrime)) sb.AppendLine("Volume primes DASD on boot");
if(jfsSb.s_flags.HasFlag(JFS_Flags.SwapBytes)) sb.AppendLine("Volume is in a big-endian system");
if(jfsSb.s_flags.HasFlag(JFS_Flags.DirIndex)) sb.AppendLine("Volume has presistent indexes");
if(jfsSb.s_flags.HasFlag(JFS_Flags.Linux)) sb.AppendLine("Volume supports Linux");
if(jfsSb.s_flags.HasFlag(JFS_Flags.DFS)) sb.AppendLine("Volume supports DCE DFS LFS");
if(jfsSb.s_flags.HasFlag(JFS_Flags.OS2)) sb.AppendLine("Volume supports OS/2, and is case insensitive");
if(jfsSb.s_flags.HasFlag(JFS_Flags.AIX)) sb.AppendLine("Volume supports AIX");
if(jfsSb.s_flags.HasFlag(JfsFlags.BadSAIT)) sb.AppendLine("Volume has bad current secondary ait");
if(jfsSb.s_flags.HasFlag(JfsFlags.Sparse)) sb.AppendLine("Volume supports sparse files");
if(jfsSb.s_flags.HasFlag(JfsFlags.DASDEnabled)) sb.AppendLine("Volume has DASD limits enabled");
if(jfsSb.s_flags.HasFlag(JfsFlags.DASDPrime)) sb.AppendLine("Volume primes DASD on boot");
if(jfsSb.s_flags.HasFlag(JfsFlags.SwapBytes)) sb.AppendLine("Volume is in a big-endian system");
if(jfsSb.s_flags.HasFlag(JfsFlags.DirIndex)) sb.AppendLine("Volume has presistent indexes");
if(jfsSb.s_flags.HasFlag(JfsFlags.Linux)) sb.AppendLine("Volume supports Linux");
if(jfsSb.s_flags.HasFlag(JfsFlags.DFS)) sb.AppendLine("Volume supports DCE DFS LFS");
if(jfsSb.s_flags.HasFlag(JfsFlags.OS2)) sb.AppendLine("Volume supports OS/2, and is case insensitive");
if(jfsSb.s_flags.HasFlag(JfsFlags.AIX)) sb.AppendLine("Volume supports AIX");
if(jfsSb.s_state != 0) sb.AppendLine("Volume is dirty");
sb.AppendFormat("Volume was last updated on {0}",
DateHandlers.UnixUnsignedToDateTime(jfsSb.s_time.tv_sec, jfsSb.s_time.tv_nsec))
@@ -138,7 +138,7 @@ namespace DiscImageChef.Filesystems
}
[Flags]
enum JFS_Flags : uint
enum JfsFlags : uint
{
Unicode = 0x00000001,
RemountRO = 0x00000002,
@@ -166,7 +166,7 @@ namespace DiscImageChef.Filesystems
}
[Flags]
enum JFS_State : uint
enum JfsState : uint
{
Clean = 0,
Mounted = 1,
@@ -176,7 +176,7 @@ namespace DiscImageChef.Filesystems
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct JFS_Extent
struct JfsExtent
{
/// <summary>
/// Leftmost 24 bits are extent length, rest 8 bits are most significant for <see cref="addr2" />
@@ -186,14 +186,14 @@ namespace DiscImageChef.Filesystems
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct JFS_TimeStruct
struct JfsTimeStruct
{
public uint tv_sec;
public uint tv_nsec;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct JFS_SuperBlock
struct JfsSuperBlock
{
public uint s_magic;
public uint s_version;
@@ -205,22 +205,22 @@ namespace DiscImageChef.Filesystems
public ushort s_l1pbsize;
public ushort pad;
public uint s_agsize;
public JFS_Flags s_flags;
public JFS_State s_state;
public JfsFlags s_flags;
public JfsState s_state;
public uint s_compress;
public JFS_Extent s_ait2;
public JFS_Extent s_aim2;
public JfsExtent s_ait2;
public JfsExtent s_aim2;
public uint s_logdev;
public uint s_logserial;
public JFS_Extent s_logpxd;
public JFS_Extent s_fsckpxd;
public JFS_TimeStruct s_time;
public JfsExtent s_logpxd;
public JfsExtent s_fsckpxd;
public JfsTimeStruct s_time;
public uint s_fsckloglen;
public sbyte s_fscklog;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] s_fpack;
public ulong s_xsize;
public JFS_Extent s_xfsckpxd;
public JFS_Extent s_xlogpxd;
public JfsExtent s_xfsckpxd;
public JfsExtent s_xlogpxd;
public Guid s_uuid;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] s_label;
public Guid s_loguuid;

View File

@@ -55,7 +55,7 @@ namespace DiscImageChef.Filesystems
if(imagePlugin.Info.SectorSize < 256) return false;
byte[] sector = imagePlugin.ReadSector(partition.Start);
LIF_SystemBlock lifSb = BigEndianMarshal.ByteArrayToStructureBigEndian<LIF_SystemBlock>(sector);
LifSystemBlock lifSb = BigEndianMarshal.ByteArrayToStructureBigEndian<LifSystemBlock>(sector);
DicConsole.DebugWriteLine("LIF plugin", "magic 0x{0:X8} (expected 0x{1:X8})", lifSb.magic, LIF_MAGIC);
return lifSb.magic == LIF_MAGIC;
@@ -70,7 +70,7 @@ namespace DiscImageChef.Filesystems
if(imagePlugin.Info.SectorSize < 256) return;
byte[] sector = imagePlugin.ReadSector(partition.Start);
LIF_SystemBlock lifSb = BigEndianMarshal.ByteArrayToStructureBigEndian<LIF_SystemBlock>(sector);
LifSystemBlock lifSb = BigEndianMarshal.ByteArrayToStructureBigEndian<LifSystemBlock>(sector);
if(lifSb.magic != LIF_MAGIC) return;
@@ -102,7 +102,7 @@ namespace DiscImageChef.Filesystems
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct LIF_SystemBlock
struct LifSystemBlock
{
public ushort magic;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] volumeLabel;

View File

@@ -154,7 +154,6 @@ namespace DiscImageChef.Filesystems.LisaFS
byte[] sector = imagePlugin.ReadSector((ulong)i);
MDDF infoMddf = new MDDF();
byte[] pString = new byte[33];
uint lisaTime;
infoMddf.fsversion = BigEndianBitConverter.ToUInt16(sector, 0x00);
infoMddf.volid = BigEndianBitConverter.ToUInt64(sector, 0x02);
@@ -168,7 +167,7 @@ namespace DiscImageChef.Filesystems.LisaFS
infoMddf.unknown2 = sector[0x4F];
infoMddf.machine_id = BigEndianBitConverter.ToUInt32(sector, 0x50);
infoMddf.master_copy_id = BigEndianBitConverter.ToUInt32(sector, 0x54);
lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x58);
uint lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x58);
infoMddf.dtvc = DateHandlers.LisaToDateTime(lisaTime);
lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x5C);
infoMddf.dtcc = DateHandlers.LisaToDateTime(lisaTime);

View File

@@ -95,7 +95,6 @@ namespace DiscImageChef.Filesystems.LisaFS
byte[] sector = device.ReadSector(i);
mddf = new MDDF();
byte[] pString = new byte[33];
uint lisaTime;
mddf.fsversion = BigEndianBitConverter.ToUInt16(sector, 0x00);
mddf.volid = BigEndianBitConverter.ToUInt64(sector, 0x02);
@@ -110,7 +109,7 @@ namespace DiscImageChef.Filesystems.LisaFS
mddf.unknown2 = sector[0x4F];
mddf.machine_id = BigEndianBitConverter.ToUInt32(sector, 0x50);
mddf.master_copy_id = BigEndianBitConverter.ToUInt32(sector, 0x54);
lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x58);
uint lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x58);
mddf.dtvc = DateHandlers.LisaToDateTime(lisaTime);
lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x5C);
mddf.dtcc = DateHandlers.LisaToDateTime(lisaTime);

View File

@@ -62,10 +62,10 @@ namespace DiscImageChef.Filesystems
const int OLDNICINOD = 700;
const int OLDNICFREE = 500;
const uint Locus_Magic = 0xFFEEDDCD;
const uint Locus_Cigam = 0xCDDDEEFF;
const uint Locus_OldMagic = 0xFFEEDDCC;
const uint Locus_OldCigam = 0xCCDDEEFF;
const uint LOCUS_MAGIC = 0xFFEEDDCD;
const uint LOCUS_CIGAM = 0xCDDDEEFF;
const uint LOCUS_MAGIC_OLD = 0xFFEEDDCC;
const uint LOCUS_CIGAM_OLD = 0xCCDDEEFF;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
@@ -78,25 +78,25 @@ namespace DiscImageChef.Filesystems
for(ulong location = 0; location <= 8; location++)
{
Locus_Superblock LocusSb = new Locus_Superblock();
Locus_Superblock locusSb = new Locus_Superblock();
uint sbSize = (uint)(Marshal.SizeOf(LocusSb) / imagePlugin.Info.SectorSize);
if(Marshal.SizeOf(LocusSb) % imagePlugin.Info.SectorSize != 0) sbSize++;
uint sbSize = (uint)(Marshal.SizeOf(locusSb) / imagePlugin.Info.SectorSize);
if(Marshal.SizeOf(locusSb) % imagePlugin.Info.SectorSize != 0) sbSize++;
if(partition.Start + location + sbSize >= imagePlugin.Info.Sectors) break;
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));
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(LocusSb));
LocusSb = (Locus_Superblock)Marshal.PtrToStructure(sbPtr, typeof(Locus_Superblock));
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(locusSb));
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);
if(LocusSb.s_magic == Locus_Magic || LocusSb.s_magic == Locus_Cigam ||
LocusSb.s_magic == Locus_OldMagic || LocusSb.s_magic == Locus_OldCigam) return true;
if(locusSb.s_magic == LOCUS_MAGIC || locusSb.s_magic == LOCUS_CIGAM ||
locusSb.s_magic == LOCUS_MAGIC_OLD || locusSb.s_magic == LOCUS_CIGAM_OLD) return true;
}
return false;
@@ -109,94 +109,94 @@ namespace DiscImageChef.Filesystems
information = "";
if(imagePlugin.Info.SectorSize < 512) return;
Locus_Superblock LocusSb = new Locus_Superblock();
Locus_Superblock locusSb = new Locus_Superblock();
byte[] sector = null;
for(ulong location = 0; location <= 8; location++)
{
uint sbSize = (uint)(Marshal.SizeOf(LocusSb) / imagePlugin.Info.SectorSize);
if(Marshal.SizeOf(LocusSb) % imagePlugin.Info.SectorSize != 0) sbSize++;
uint sbSize = (uint)(Marshal.SizeOf(locusSb) / imagePlugin.Info.SectorSize);
if(Marshal.SizeOf(locusSb) % imagePlugin.Info.SectorSize != 0) 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));
Marshal.Copy(sector, 0, sbPtr, Marshal.SizeOf(LocusSb));
LocusSb = (Locus_Superblock)Marshal.PtrToStructure(sbPtr, typeof(Locus_Superblock));
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(locusSb));
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 ||
LocusSb.s_magic == Locus_OldMagic || LocusSb.s_magic == Locus_OldCigam) break;
if(locusSb.s_magic == LOCUS_MAGIC || locusSb.s_magic == LOCUS_CIGAM ||
locusSb.s_magic == LOCUS_MAGIC_OLD || locusSb.s_magic == LOCUS_CIGAM_OLD) break;
}
// We don't care about old version for information
if(LocusSb.s_magic != Locus_Magic && LocusSb.s_magic != Locus_Cigam && LocusSb.s_magic != Locus_OldMagic &&
LocusSb.s_magic != Locus_OldCigam) return;
if(locusSb.s_magic != LOCUS_MAGIC && locusSb.s_magic != LOCUS_CIGAM && locusSb.s_magic != LOCUS_MAGIC_OLD &&
locusSb.s_magic != LOCUS_CIGAM_OLD) return;
// Numerical arrays are not important for information so no need to swap them
if(LocusSb.s_magic == Locus_Cigam || LocusSb.s_magic == Locus_OldCigam)
if(locusSb.s_magic == LOCUS_CIGAM || locusSb.s_magic == LOCUS_CIGAM_OLD)
{
LocusSb = BigEndianMarshal.ByteArrayToStructureBigEndian<Locus_Superblock>(sector);
LocusSb.s_flags = (LocusFlags)Swapping.Swap((ushort)LocusSb.s_flags);
locusSb = BigEndianMarshal.ByteArrayToStructureBigEndian<Locus_Superblock>(sector);
locusSb.s_flags = (LocusFlags)Swapping.Swap((ushort)locusSb.s_flags);
}
StringBuilder sb = new StringBuilder();
sb.AppendLine(LocusSb.s_magic == Locus_OldMagic ? "Locus filesystem (old)" : "Locus filesystem");
sb.AppendLine(locusSb.s_magic == LOCUS_MAGIC_OLD ? "Locus filesystem (old)" : "Locus filesystem");
int blockSize = LocusSb.s_version == LocusVersion.SB_SB4096 ? 4096 : 1024;
int blockSize = locusSb.s_version == LocusVersion.SB_SB4096 ? 4096 : 1024;
string s_fsmnt = StringHandlers.CToString(LocusSb.s_fsmnt, Encoding);
string s_fpack = StringHandlers.CToString(LocusSb.s_fpack, Encoding);
string s_fsmnt = StringHandlers.CToString(locusSb.s_fsmnt, Encoding);
string s_fpack = StringHandlers.CToString(locusSb.s_fpack, Encoding);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_magic = 0x{0:X8}", LocusSb.s_magic);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_gfs = {0}", LocusSb.s_gfs);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_fsize = {0}", LocusSb.s_fsize);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_lwm = {0}", LocusSb.s_lwm);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_hwm = {0}", LocusSb.s_hwm);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_llst = {0}", LocusSb.s_llst);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_fstore = {0}", LocusSb.s_fstore);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_time = {0}", LocusSb.s_time);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_tfree = {0}", LocusSb.s_tfree);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_isize = {0}", LocusSb.s_isize);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_nfree = {0}", LocusSb.s_nfree);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_flags = {0}", LocusSb.s_flags);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_tinode = {0}", LocusSb.s_tinode);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_lasti = {0}", LocusSb.s_lasti);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_nbehind = {0}", LocusSb.s_nbehind);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_gfspack = {0}", LocusSb.s_gfspack);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_ninode = {0}", LocusSb.s_ninode);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_flock = {0}", LocusSb.s_flock);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_ilock = {0}", LocusSb.s_ilock);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_fmod = {0}", LocusSb.s_fmod);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_version = {0}", LocusSb.s_version);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_magic = 0x{0:X8}", locusSb.s_magic);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_gfs = {0}", locusSb.s_gfs);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_fsize = {0}", locusSb.s_fsize);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_lwm = {0}", locusSb.s_lwm);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_hwm = {0}", locusSb.s_hwm);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_llst = {0}", locusSb.s_llst);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_fstore = {0}", locusSb.s_fstore);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_time = {0}", locusSb.s_time);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_tfree = {0}", locusSb.s_tfree);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_isize = {0}", locusSb.s_isize);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_nfree = {0}", locusSb.s_nfree);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_flags = {0}", locusSb.s_flags);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_tinode = {0}", locusSb.s_tinode);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_lasti = {0}", locusSb.s_lasti);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_nbehind = {0}", locusSb.s_nbehind);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_gfspack = {0}", locusSb.s_gfspack);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_ninode = {0}", locusSb.s_ninode);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_flock = {0}", locusSb.s_flock);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_ilock = {0}", locusSb.s_ilock);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_fmod = {0}", locusSb.s_fmod);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_version = {0}", locusSb.s_version);
sb.AppendFormat("Superblock last modified on {0}", DateHandlers.UnixToDateTime(LocusSb.s_time))
sb.AppendFormat("Superblock last modified on {0}", DateHandlers.UnixToDateTime(locusSb.s_time))
.AppendLine();
sb.AppendFormat("Volume has {0} blocks of {1} bytes each (total {2} bytes)", LocusSb.s_fsize, blockSize,
LocusSb.s_fsize * blockSize).AppendLine();
sb.AppendFormat("{0} blocks free ({1} bytes)", LocusSb.s_tfree, LocusSb.s_tfree * blockSize).AppendLine();
sb.AppendFormat("I-node list uses {0} blocks", LocusSb.s_isize).AppendLine();
sb.AppendFormat("{0} free inodes", LocusSb.s_tinode).AppendLine();
sb.AppendFormat("Next free inode search will start at inode {0}", LocusSb.s_lasti).AppendLine();
sb.AppendFormat("There are an estimate of {0} free inodes before next search start", LocusSb.s_nbehind)
sb.AppendFormat("Volume has {0} blocks of {1} bytes each (total {2} bytes)", locusSb.s_fsize, blockSize,
locusSb.s_fsize * blockSize).AppendLine();
sb.AppendFormat("{0} blocks free ({1} bytes)", locusSb.s_tfree, locusSb.s_tfree * blockSize).AppendLine();
sb.AppendFormat("I-node list uses {0} blocks", locusSb.s_isize).AppendLine();
sb.AppendFormat("{0} free inodes", locusSb.s_tinode).AppendLine();
sb.AppendFormat("Next free inode search will start at inode {0}", locusSb.s_lasti).AppendLine();
sb.AppendFormat("There are an estimate of {0} free inodes before next search start", locusSb.s_nbehind)
.AppendLine();
if(LocusSb.s_flags.HasFlag(LocusFlags.SB_RDONLY)) sb.AppendLine("Read-only volume");
if(LocusSb.s_flags.HasFlag(LocusFlags.SB_CLEAN)) sb.AppendLine("Clean volume");
if(LocusSb.s_flags.HasFlag(LocusFlags.SB_DIRTY)) sb.AppendLine("Dirty volume");
if(LocusSb.s_flags.HasFlag(LocusFlags.SB_RMV)) sb.AppendLine("Removable volume");
if(LocusSb.s_flags.HasFlag(LocusFlags.SB_PRIMPACK)) sb.AppendLine("This is the primary pack");
if(LocusSb.s_flags.HasFlag(LocusFlags.SB_REPLTYPE)) sb.AppendLine("Replicated volume");
if(LocusSb.s_flags.HasFlag(LocusFlags.SB_USER)) sb.AppendLine("User replicated volume");
if(LocusSb.s_flags.HasFlag(LocusFlags.SB_BACKBONE)) sb.AppendLine("Backbone volume");
if(LocusSb.s_flags.HasFlag(LocusFlags.SB_NFS)) sb.AppendLine("NFS volume");
if(LocusSb.s_flags.HasFlag(LocusFlags.SB_BYHAND)) sb.AppendLine("Volume inhibits automatic fsck");
if(LocusSb.s_flags.HasFlag(LocusFlags.SB_NOSUID)) sb.AppendLine("Set-uid/set-gid is disabled");
if(LocusSb.s_flags.HasFlag(LocusFlags.SB_SYNCW)) sb.AppendLine("Volume uses synchronous writes");
if(locusSb.s_flags.HasFlag(LocusFlags.SB_RDONLY)) sb.AppendLine("Read-only volume");
if(locusSb.s_flags.HasFlag(LocusFlags.SB_CLEAN)) sb.AppendLine("Clean volume");
if(locusSb.s_flags.HasFlag(LocusFlags.SB_DIRTY)) sb.AppendLine("Dirty volume");
if(locusSb.s_flags.HasFlag(LocusFlags.SB_RMV)) sb.AppendLine("Removable volume");
if(locusSb.s_flags.HasFlag(LocusFlags.SB_PRIMPACK)) sb.AppendLine("This is the primary pack");
if(locusSb.s_flags.HasFlag(LocusFlags.SB_REPLTYPE)) sb.AppendLine("Replicated volume");
if(locusSb.s_flags.HasFlag(LocusFlags.SB_USER)) sb.AppendLine("User replicated volume");
if(locusSb.s_flags.HasFlag(LocusFlags.SB_BACKBONE)) sb.AppendLine("Backbone volume");
if(locusSb.s_flags.HasFlag(LocusFlags.SB_NFS)) sb.AppendLine("NFS volume");
if(locusSb.s_flags.HasFlag(LocusFlags.SB_BYHAND)) sb.AppendLine("Volume inhibits automatic fsck");
if(locusSb.s_flags.HasFlag(LocusFlags.SB_NOSUID)) sb.AppendLine("Set-uid/set-gid is disabled");
if(locusSb.s_flags.HasFlag(LocusFlags.SB_SYNCW)) sb.AppendLine("Volume uses synchronous writes");
sb.AppendFormat("Volume label: {0}", s_fsmnt).AppendLine();
sb.AppendFormat("Physical volume name: {0}", s_fpack).AppendLine();
sb.AppendFormat("Global File System number: {0}", LocusSb.s_gfs).AppendLine();
sb.AppendFormat("Global File System pack number {0}", LocusSb.s_gfspack).AppendLine();
sb.AppendFormat("Global File System number: {0}", locusSb.s_gfs).AppendLine();
sb.AppendFormat("Global File System pack number {0}", locusSb.s_gfspack).AppendLine();
information = sb.ToString();
@@ -204,13 +204,13 @@ namespace DiscImageChef.Filesystems
{
Type = "Locus filesystem",
ClusterSize = blockSize,
Clusters = LocusSb.s_fsize,
Clusters = locusSb.s_fsize,
// Sometimes it uses one, or the other. Use the bigger
VolumeName = string.IsNullOrEmpty(s_fsmnt) ? s_fpack : s_fsmnt,
ModificationDate = DateHandlers.UnixToDateTime(LocusSb.s_time),
ModificationDate = DateHandlers.UnixToDateTime(locusSb.s_time),
ModificationDateSpecified = true,
Dirty = !LocusSb.s_flags.HasFlag(LocusFlags.SB_CLEAN) || LocusSb.s_flags.HasFlag(LocusFlags.SB_DIRTY),
FreeClusters = LocusSb.s_tfree,
Dirty = !locusSb.s_flags.HasFlag(LocusFlags.SB_CLEAN) || locusSb.s_flags.HasFlag(LocusFlags.SB_DIRTY),
FreeClusters = locusSb.s_tfree,
FreeClustersSpecified = true
};
}

View File

@@ -60,8 +60,8 @@ namespace DiscImageChef.Filesystems
byte[] bk0 = imagePlugin.ReadSector(0 + partition.Start);
GCHandle handle = GCHandle.Alloc(bk0, GCHandleType.Pinned);
MicroDOSBlock0 block0 =
(MicroDOSBlock0)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(MicroDOSBlock0));
MicroDosBlock0 block0 =
(MicroDosBlock0)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(MicroDosBlock0));
handle.Free();
return block0.label == MAGIC && block0.mklabel == MAGIC2;
@@ -78,8 +78,8 @@ namespace DiscImageChef.Filesystems
byte[] bk0 = imagePlugin.ReadSector(0 + partition.Start);
GCHandle handle = GCHandle.Alloc(bk0, GCHandleType.Pinned);
MicroDOSBlock0 block0 =
(MicroDOSBlock0)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(MicroDOSBlock0));
MicroDosBlock0 block0 =
(MicroDosBlock0)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(MicroDosBlock0));
handle.Free();
sb.AppendLine("MicroDOS filesystem");
@@ -105,7 +105,7 @@ namespace DiscImageChef.Filesystems
// Followed by directory entries
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct MicroDOSBlock0
struct MicroDosBlock0
{
/// <summary>BK starts booting here</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] public byte[] bootCode;

View File

@@ -82,7 +82,6 @@ namespace DiscImageChef.Filesystems
if(sector + partition.Start >= partition.End) return false;
ushort magic;
byte[] minixSbSector = imagePlugin.ReadSector(sector + partition.Start);
// Optical media
@@ -93,7 +92,7 @@ namespace DiscImageChef.Filesystems
minixSbSector = tmp;
}
magic = BitConverter.ToUInt16(minixSbSector, 0x010); // Here should reside magic number on Minix v1 & V2
ushort magic = BitConverter.ToUInt16(minixSbSector, 0x010);
if(magic == MINIX_MAGIC || magic == MINIX_MAGIC2 || magic == MINIX2_MAGIC || magic == MINIX2_MAGIC2 ||
magic == MINIX_CIGAM || magic == MINIX_CIGAM2 || magic == MINIX2_CIGAM ||
@@ -101,10 +100,8 @@ namespace DiscImageChef.Filesystems
magic = BitConverter.ToUInt16(minixSbSector, 0x018); // Here should reside magic number on Minix v3
if(magic == MINIX_MAGIC || magic == MINIX2_MAGIC || magic == MINIX3_MAGIC || magic == MINIX_CIGAM ||
magic == MINIX2_CIGAM || magic == MINIX3_CIGAM) return true;
return false;
return magic == MINIX_MAGIC || magic == MINIX2_MAGIC || magic == MINIX3_MAGIC || magic == MINIX_CIGAM ||
magic == MINIX2_CIGAM || magic == MINIX3_CIGAM;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
@@ -127,7 +124,6 @@ namespace DiscImageChef.Filesystems
bool minix3 = false;
int filenamesize;
string minixVersion;
ushort magic;
byte[] minixSbSector = imagePlugin.ReadSector(sector + partition.Start);
// Optical media
@@ -138,7 +134,7 @@ namespace DiscImageChef.Filesystems
minixSbSector = tmp;
}
magic = BitConverter.ToUInt16(minixSbSector, 0x018);
ushort magic = BitConverter.ToUInt16(minixSbSector, 0x018);
XmlFsType = new FileSystemType();

View File

@@ -108,11 +108,10 @@ namespace DiscImageChef.Filesystems
if(wii)
{
uint offset1, offset2, offset3, offset4;
offset1 = BigEndianBitConverter.ToUInt32(header, 0x40004) << 2;
offset2 = BigEndianBitConverter.ToUInt32(header, 0x4000C) << 2;
offset3 = BigEndianBitConverter.ToUInt32(header, 0x40014) << 2;
offset4 = BigEndianBitConverter.ToUInt32(header, 0x4001C) << 2;
uint offset1 = BigEndianBitConverter.ToUInt32(header, 0x40004) << 2;
uint offset2 = BigEndianBitConverter.ToUInt32(header, 0x4000C) << 2;
uint offset3 = BigEndianBitConverter.ToUInt32(header, 0x40014) << 2;
uint offset4 = BigEndianBitConverter.ToUInt32(header, 0x4001C) << 2;
fields.FirstPartitions = new NintendoPartition[BigEndianBitConverter.ToUInt32(header, 0x40000)];
fields.SecondPartitions = new NintendoPartition[BigEndianBitConverter.ToUInt32(header, 0x40008)];

View File

@@ -96,7 +96,7 @@ namespace DiscImageChef.Filesystems
// Blocks 0 and 1 are boot code
byte[] rootDirectoryKeyBlock = imagePlugin.ReadSectors(2 * multiplier + partition.Start, multiplier);
bool APMFromHDDOnCD = false;
bool apmFromHddOnCd = false;
if(imagePlugin.Info.SectorSize == 2352 || imagePlugin.Info.SectorSize == 2448 ||
imagePlugin.Info.SectorSize == 2048)
@@ -119,7 +119,7 @@ namespace DiscImageChef.Filesystems
ENTRIES_PER_BLOCK))
{
Array.Copy(tmp, offset, rootDirectoryKeyBlock, 0, 0x200);
APMFromHDDOnCD = true;
apmFromHddOnCd = true;
break;
}
}
@@ -145,7 +145,7 @@ namespace DiscImageChef.Filesystems
if(bitMapPointer > partition.End) return false;
ushort totalBlocks = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0x29);
if(APMFromHDDOnCD) totalBlocks /= 4;
if(apmFromHddOnCd) totalBlocks /= 4;
DicConsole.DebugWriteLine("ProDOS plugin", "{0} <= ({1} - {2} + 1)? {3}", totalBlocks, partition.End,
partition.Start, totalBlocks <= partition.End - partition.Start + 1);
@@ -162,7 +162,7 @@ namespace DiscImageChef.Filesystems
// Blocks 0 and 1 are boot code
byte[] rootDirectoryKeyBlockBytes = imagePlugin.ReadSectors(2 * multiplier + partition.Start, multiplier);
bool APMFromHDDOnCD = false;
bool apmFromHddOnCd = false;
if(imagePlugin.Info.SectorSize == 2352 || imagePlugin.Info.SectorSize == 2448 ||
imagePlugin.Info.SectorSize == 2048)
@@ -185,7 +185,7 @@ namespace DiscImageChef.Filesystems
ENTRIES_PER_BLOCK))
{
Array.Copy(tmp, offset, rootDirectoryKeyBlockBytes, 0, 0x200);
APMFromHDDOnCD = true;
apmFromHddOnCd = true;
break;
}
}
@@ -243,7 +243,7 @@ namespace DiscImageChef.Filesystems
rootDirectoryKeyBlock.header.bit_map_pointer = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x27);
rootDirectoryKeyBlock.header.total_blocks = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x29);
if(APMFromHDDOnCD)
if(apmFromHddOnCd)
sbInformation.AppendLine("ProDOS uses 512 bytes/sector while devices uses 2048 bytes/sector.")
.AppendLine();
@@ -299,20 +299,21 @@ namespace DiscImageChef.Filesystems
information = sbInformation.ToString();
XmlFsType = new FileSystemType();
XmlFsType.VolumeName = rootDirectoryKeyBlock.header.volume_name;
if(dateCorrect)
XmlFsType = new FileSystemType
{
XmlFsType.CreationDate = rootDirectoryKeyBlock.header.creation_time;
XmlFsType.CreationDateSpecified = true;
}
VolumeName = rootDirectoryKeyBlock.header.volume_name,
Files = rootDirectoryKeyBlock.header.file_count,
FilesSpecified = true,
Clusters = rootDirectoryKeyBlock.header.total_blocks,
Type = "ProDOS"
};
XmlFsType.Files = rootDirectoryKeyBlock.header.file_count;
XmlFsType.FilesSpecified = true;
XmlFsType.Clusters = rootDirectoryKeyBlock.header.total_blocks;
XmlFsType.ClusterSize = (int)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize /
(ulong)XmlFsType.Clusters);
XmlFsType.Type = "ProDOS";
XmlFsType.ClusterSize = (int)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize /
(ulong)XmlFsType.Clusters);
if(!dateCorrect) return;
XmlFsType.CreationDate = rootDirectoryKeyBlock.header.creation_time;
XmlFsType.CreationDateSpecified = true;
}
/// <summary>

View File

@@ -42,7 +42,7 @@ namespace DiscImageChef.Filesystems
{
public class QNX4 : IFilesystem
{
readonly byte[] QNX4_RootDir_Fname =
readonly byte[] qnx4_rootDir_fname =
{0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
public FileSystemType XmlFsType { get; private set; }
@@ -63,7 +63,7 @@ namespace DiscImageChef.Filesystems
Marshal.FreeHGlobal(sbPtr);
// 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;
// Check sizes are multiple of blocks
if(qnxSb.rootDir.di_size % 512 != 0 || qnxSb.inode.di_size % 512 != 0 || qnxSb.boot.di_size % 512 != 0 ||

View File

@@ -58,8 +58,9 @@ namespace DiscImageChef.Filesystems
// Documentation says ID should be sector 0
// I've found that OS-9/X68000 has it on sector 4
// I've read OS-9/Apple2 has it on sector 15
foreach(ulong location in new[] {0, 4, 15})
foreach(int i in new[] {0, 4, 15})
{
ulong location = (ulong)i;
RBF_IdSector rbfSb = new RBF_IdSector();
uint sbSize = (uint)(Marshal.SizeOf(rbfSb) / imagePlugin.Info.SectorSize);
@@ -94,8 +95,9 @@ namespace DiscImageChef.Filesystems
RBF_IdSector rbfSb = new RBF_IdSector();
RBF_NewIdSector rbf9000Sb = new RBF_NewIdSector();
foreach(ulong location in new[] {0, 4, 15})
foreach(int i in new[] {0, 4, 15})
{
ulong location = (ulong)i;
uint sbSize = (uint)(Marshal.SizeOf(rbfSb) / imagePlugin.Info.SectorSize);
if(Marshal.SizeOf(rbfSb) % imagePlugin.Info.SectorSize != 0) sbSize++;

View File

@@ -44,9 +44,9 @@ namespace DiscImageChef.Filesystems
{
const uint REISER_SUPER_OFFSET = 0x10000;
readonly byte[] Reiser35_Magic = {0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x46, 0x73, 0x00, 0x00};
readonly byte[] Reiser36_Magic = {0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x32, 0x46, 0x73, 0x00};
readonly byte[] ReiserJr_Magic = {0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x33, 0x46, 0x73, 0x00};
readonly byte[] reiser35_magic = {0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x46, 0x73, 0x00, 0x00};
readonly byte[] reiser36_magic = {0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x32, 0x46, 0x73, 0x00};
readonly byte[] reiserJr_magic = {0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x33, 0x46, 0x73, 0x00};
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
@@ -75,8 +75,8 @@ namespace DiscImageChef.Filesystems
reiserSb = (Reiser_Superblock)Marshal.PtrToStructure(sbPtr, typeof(Reiser_Superblock));
Marshal.FreeHGlobal(sbPtr);
return Reiser35_Magic.SequenceEqual(reiserSb.magic) || Reiser36_Magic.SequenceEqual(reiserSb.magic) ||
ReiserJr_Magic.SequenceEqual(reiserSb.magic);
return reiser35_magic.SequenceEqual(reiserSb.magic) || reiser36_magic.SequenceEqual(reiserSb.magic) ||
reiserJr_magic.SequenceEqual(reiserSb.magic);
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
@@ -102,14 +102,14 @@ namespace DiscImageChef.Filesystems
reiserSb = (Reiser_Superblock)Marshal.PtrToStructure(sbPtr, typeof(Reiser_Superblock));
Marshal.FreeHGlobal(sbPtr);
if(!Reiser35_Magic.SequenceEqual(reiserSb.magic) && !Reiser36_Magic.SequenceEqual(reiserSb.magic) &&
!ReiserJr_Magic.SequenceEqual(reiserSb.magic)) return;
if(!reiser35_magic.SequenceEqual(reiserSb.magic) && !reiser36_magic.SequenceEqual(reiserSb.magic) &&
!reiserJr_magic.SequenceEqual(reiserSb.magic)) return;
StringBuilder sb = new StringBuilder();
if(Reiser35_Magic.SequenceEqual(reiserSb.magic)) sb.AppendLine("Reiser 3.5 filesystem");
else if(Reiser36_Magic.SequenceEqual(reiserSb.magic)) sb.AppendLine("Reiser 3.6 filesystem");
else if(ReiserJr_Magic.SequenceEqual(reiserSb.magic)) sb.AppendLine("Reiser Jr. filesystem");
if(reiser35_magic.SequenceEqual(reiserSb.magic)) sb.AppendLine("Reiser 3.5 filesystem");
else if(reiser36_magic.SequenceEqual(reiserSb.magic)) sb.AppendLine("Reiser 3.6 filesystem");
else if(reiserJr_magic.SequenceEqual(reiserSb.magic)) sb.AppendLine("Reiser Jr. filesystem");
sb.AppendFormat("Volume has {0} blocks with {1} blocks free", reiserSb.block_count, reiserSb.free_blocks)
.AppendLine();
sb.AppendFormat("{0} bytes per block", reiserSb.blocksize).AppendLine();
@@ -126,9 +126,9 @@ namespace DiscImageChef.Filesystems
information = sb.ToString();
XmlFsType = new FileSystemType();
if(Reiser35_Magic.SequenceEqual(reiserSb.magic)) XmlFsType.Type = "Reiser 3.5 filesystem";
else if(Reiser36_Magic.SequenceEqual(reiserSb.magic)) XmlFsType.Type = "Reiser 3.6 filesystem";
else if(ReiserJr_Magic.SequenceEqual(reiserSb.magic)) XmlFsType.Type = "Reiser Jr. filesystem";
if(reiser35_magic.SequenceEqual(reiserSb.magic)) XmlFsType.Type = "Reiser 3.5 filesystem";
else if(reiser36_magic.SequenceEqual(reiserSb.magic)) XmlFsType.Type = "Reiser 3.6 filesystem";
else if(reiserJr_magic.SequenceEqual(reiserSb.magic)) XmlFsType.Type = "Reiser Jr. filesystem";
XmlFsType.ClusterSize = reiserSb.blocksize;
XmlFsType.Clusters = reiserSb.block_count;
XmlFsType.FreeClusters = reiserSb.free_blocks;

View File

@@ -44,7 +44,7 @@ namespace DiscImageChef.Filesystems
{
const uint REISER4_SUPER_OFFSET = 0x10000;
readonly byte[] Reiser4_Magic =
readonly byte[] reiser4_magic =
{0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
public FileSystemType XmlFsType { get; private set; }
@@ -74,7 +74,7 @@ namespace DiscImageChef.Filesystems
reiserSb = (Reiser4_Superblock)Marshal.PtrToStructure(sbPtr, typeof(Reiser4_Superblock));
Marshal.FreeHGlobal(sbPtr);
return Reiser4_Magic.SequenceEqual(reiserSb.magic);
return reiser4_magic.SequenceEqual(reiserSb.magic);
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
@@ -100,7 +100,7 @@ namespace DiscImageChef.Filesystems
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;
StringBuilder sb = new StringBuilder();

View File

@@ -51,13 +51,11 @@ namespace DiscImageChef.Filesystems
{
if(2 + partition.Start >= partition.End) return false;
byte signature; // 0x29
byte[] bpb = imagePlugin.ReadSector(0 + partition.Start);
byte[] fsTypeB = new byte[8];
signature = bpb[0x25];
byte signature = bpb[0x25];
Array.Copy(bpb, 0x35, fsTypeB, 0, 8);
string fsType = StringHandlers.CToString(fsTypeB);

View File

@@ -50,11 +50,11 @@ namespace DiscImageChef.Filesystems
{
public class UNICOS : IFilesystem
{
const int NC1MAXPART = 64;
const int NC1MAXIREG = 4;
const int NC1_MAXPART = 64;
const int NC1_MAXIREG = 4;
const ulong UNICOS_Magic = 0x6e6331667331636e;
const ulong UNICOS_Secure = 0xcd076d1771d670cd;
const ulong UNICOS_MAGIC = 0x6e6331667331636e;
const ulong UNICOS_SECURE = 0xcd076d1771d670cd;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
@@ -76,9 +76,9 @@ namespace DiscImageChef.Filesystems
unicosSb = BigEndianMarshal.ByteArrayToStructureBigEndian<UNICOS_Superblock>(sector);
DicConsole.DebugWriteLine("UNICOS plugin", "magic = 0x{0:X16} (expected 0x{1:X16})", unicosSb.s_magic,
UNICOS_Magic);
UNICOS_MAGIC);
return unicosSb.s_magic == UNICOS_Magic;
return unicosSb.s_magic == UNICOS_MAGIC;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
@@ -98,12 +98,12 @@ namespace DiscImageChef.Filesystems
unicosSb = BigEndianMarshal.ByteArrayToStructureBigEndian<UNICOS_Superblock>(sector);
if(unicosSb.s_magic != UNICOS_Magic) return;
if(unicosSb.s_magic != UNICOS_MAGIC) return;
StringBuilder sb = new StringBuilder();
sb.AppendLine("UNICOS filesystem");
if(unicosSb.s_secure == UNICOS_Secure) sb.AppendLine("Volume is secure");
if(unicosSb.s_secure == UNICOS_SECURE) sb.AppendLine("Volume is secure");
sb.AppendFormat("Volume contains {0} partitions", unicosSb.s_npart).AppendLine();
sb.AppendFormat("{0} bytes per sector", unicosSb.s_iounit).AppendLine();
sb.AppendLine("4096 bytes per block");
@@ -145,7 +145,7 @@ namespace DiscImageChef.Filesystems
public long fd_name; /* Physical device name */
public uint fd_sblk; /* Start block number */
public uint fd_nblk; /* Number of blocks */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NC1MAXIREG)]
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NC1_MAXIREG)]
public nc1ireg_sb[] fd_ireg; /* Inode regions */
}
@@ -178,7 +178,7 @@ namespace DiscImageChef.Filesystems
public long s_ifract; /* Ratio of inodes to blocks */
public extent_t s_sfs; /* SFS only blocks */
public long s_flag; /* Flag word */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NC1MAXPART)]
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NC1_MAXPART)]
public nc1fdev_sb[] s_part; /* Partition descriptors */
public long s_iounit; /* Physical block size */
public long s_numiresblks; /* number of inode reservation blocks */

View File

@@ -53,9 +53,7 @@ namespace DiscImageChef.Filesystems
{
if(2 + partition.Start >= partition.End) return false;
uint magic;
magic = BitConverter.ToUInt32(imagePlugin.ReadSector(0 + partition.Start), 0);
uint magic = BitConverter.ToUInt32(imagePlugin.ReadSector(0 + partition.Start), 0);
return magic == BFS_MAGIC;
}

View File

@@ -79,8 +79,9 @@ namespace DiscImageChef.Filesystems
}
}
else
foreach(ulong location in new[] {0, 1, 2})
foreach(int i in new[] {0, 1, 2})
{
ulong location = (ulong)i;
XFS_Superblock xfsSb = new XFS_Superblock();
uint sbSize = (uint)(Marshal.SizeOf(xfsSb) / imagePlugin.Info.SectorSize);
@@ -133,8 +134,9 @@ namespace DiscImageChef.Filesystems
}
}
else
foreach(ulong location in new[] {0, 1, 2})
foreach(int i in new[] {0, 1, 2})
{
ulong location = (ulong)i;
uint sbSize = (uint)(Marshal.SizeOf(xfsSb) / imagePlugin.Info.SectorSize);
if(Marshal.SizeOf(xfsSb) % imagePlugin.Info.SectorSize != 0) sbSize++;

View File

@@ -166,15 +166,13 @@ namespace DiscImageChef.Filesystems
if(nvlist == null || nvlist.Length < 16) return false;
int offset;
if(!xdr) return false;
BigEndianBitConverter.IsLittleEndian = littleEndian;
offset = 8;
int offset = 8;
while(offset < nvlist.Length)
{
uint nameLength;
NVS_Item item = new NVS_Item();
int currOff = offset;
@@ -186,7 +184,7 @@ namespace DiscImageChef.Filesystems
offset += 4;
item.decodedSize = BigEndianBitConverter.ToUInt32(nvlist, offset);
offset += 4;
nameLength = BigEndianBitConverter.ToUInt32(nvlist, offset);
uint nameLength = BigEndianBitConverter.ToUInt32(nvlist, offset);
offset += 4;
if(nameLength % 4 > 0) nameLength += 4 - nameLength % 4;
byte[] nameBytes = new byte[nameLength];

View File

@@ -45,7 +45,7 @@ namespace DiscImageChef.Filesystems
{
readonly Guid OEM_FLASH_PARAMETER_GUID = new Guid("0A0C7E46-3399-4021-90C8-FA6D389C4BA2");
readonly byte[] Signature = {0x45, 0x58, 0x46, 0x41, 0x54, 0x20, 0x20, 0x20};
readonly byte[] signature = {0x45, 0x58, 0x46, 0x41, 0x54, 0x20, 0x20, 0x20};
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
@@ -64,7 +64,7 @@ namespace DiscImageChef.Filesystems
VolumeBootRecord vbr = (VolumeBootRecord)Marshal.PtrToStructure(vbrPtr, typeof(VolumeBootRecord));
Marshal.FreeHGlobal(vbrPtr);
return Signature.SequenceEqual(vbr.signature);
return signature.SequenceEqual(vbr.signature);
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
@@ -111,7 +111,7 @@ namespace DiscImageChef.Filesystems
.AppendLine();
sb.AppendFormat("Volume serial number: {0:X8}", vbr.volumeSerial).AppendLine();
sb.AppendFormat("BIOS drive is {0:X2}h", vbr.drive).AppendLine();
if(vbr.flags.HasFlag(VolumeFlags.SecondFATActive)) sb.AppendLine("2nd FAT is in use");
if(vbr.flags.HasFlag(VolumeFlags.SecondFatActive)) sb.AppendLine("2nd FAT is in use");
if(vbr.flags.HasFlag(VolumeFlags.VolumeDirty)) sb.AppendLine("Volume is dirty");
if(vbr.flags.HasFlag(VolumeFlags.MediaFailure)) sb.AppendLine("Underlying media presented errors");
@@ -148,7 +148,7 @@ namespace DiscImageChef.Filesystems
[Flags]
enum VolumeFlags : ushort
{
SecondFATActive = 1,
SecondFatActive = 1,
VolumeDirty = 2,
MediaFailure = 4,
ClearToZero = 8