mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Move partitions plugins to a separate library.
This commit is contained in:
304
DiscImageChef.Partitions/AppleMap.cs
Normal file
304
DiscImageChef.Partitions/AppleMap.cs
Normal file
@@ -0,0 +1,304 @@
|
||||
/***************************************************************************
|
||||
The Disc Image Chef
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Filename : AppleMap.cs
|
||||
Version : 1.0
|
||||
Author(s) : Natalia Portillo
|
||||
|
||||
Component : Partitioning scheme plugins
|
||||
|
||||
Revision : $Revision$
|
||||
Last change by : $Author$
|
||||
Date : $Date$
|
||||
|
||||
--[ Description ] ----------------------------------------------------------
|
||||
|
||||
Manages Apple Partition Map.
|
||||
|
||||
--[ License ] --------------------------------------------------------------
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2014 Claunia.com
|
||||
****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using DiscImageChef;
|
||||
|
||||
// Information about structures learnt from Inside Macintosh
|
||||
// Constants from image testing
|
||||
namespace DiscImageChef.PartPlugins
|
||||
{
|
||||
class AppleMap : PartPlugin
|
||||
{
|
||||
// "ER"
|
||||
const UInt16 APM_MAGIC = 0x4552;
|
||||
// "PM"
|
||||
const UInt16 APM_ENTRY = 0x504D;
|
||||
// "TS", old entry magic
|
||||
const UInt16 APM_OLDENT = 0x5453;
|
||||
|
||||
public AppleMap()
|
||||
{
|
||||
Name = "Apple Partition Map";
|
||||
PluginUUID = new Guid("36405F8D-4F1A-07F5-209C-223D735D6D22");
|
||||
}
|
||||
|
||||
public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<CommonTypes.Partition> partitions)
|
||||
{
|
||||
ulong apm_entries;
|
||||
uint sector_size;
|
||||
|
||||
if (imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448)
|
||||
sector_size = 2048;
|
||||
else
|
||||
sector_size = imagePlugin.GetSectorSize();
|
||||
|
||||
partitions = new List<CommonTypes.Partition>();
|
||||
|
||||
AppleMapBootEntry APMB = new AppleMapBootEntry();
|
||||
AppleMapPartitionEntry APMEntry;
|
||||
|
||||
byte[] APMB_sector = imagePlugin.ReadSector(0);
|
||||
|
||||
APMB.signature = BigEndianBitConverter.ToUInt16(APMB_sector, 0x00);
|
||||
APMB.sector_size = BigEndianBitConverter.ToUInt16(APMB_sector, 0x02);
|
||||
APMB.sectors = BigEndianBitConverter.ToUInt32(APMB_sector, 0x04);
|
||||
APMB.reserved1 = BigEndianBitConverter.ToUInt16(APMB_sector, 0x08);
|
||||
APMB.reserved2 = BigEndianBitConverter.ToUInt16(APMB_sector, 0x0A);
|
||||
APMB.reserved3 = BigEndianBitConverter.ToUInt32(APMB_sector, 0x0C);
|
||||
APMB.driver_entries = BigEndianBitConverter.ToUInt16(APMB_sector, 0x10);
|
||||
APMB.first_driver_blk = BigEndianBitConverter.ToUInt32(APMB_sector, 0x12);
|
||||
APMB.driver_size = BigEndianBitConverter.ToUInt16(APMB_sector, 0x16);
|
||||
APMB.operating_system = BigEndianBitConverter.ToUInt16(APMB_sector, 0x18);
|
||||
|
||||
ulong first_sector = 0;
|
||||
|
||||
if (APMB.signature == APM_MAGIC) // APM boot block found, APM starts in next sector
|
||||
first_sector = 1;
|
||||
|
||||
// Read first entry
|
||||
byte[] APMEntry_sector;
|
||||
bool APMFromHDDOnCD = false;
|
||||
|
||||
if (sector_size == 2048)
|
||||
{
|
||||
APMEntry_sector = Read2048SectorAs512(imagePlugin, first_sector);
|
||||
APMEntry = DecodeAPMEntry(APMEntry_sector);
|
||||
|
||||
if (APMEntry.signature == APM_ENTRY || APMEntry.signature == APM_OLDENT)
|
||||
{
|
||||
sector_size = 512;
|
||||
APMFromHDDOnCD = true;
|
||||
//if (MainClass.isDebug)
|
||||
Console.WriteLine("DEBUG (Apple Partition Map Plugin): PM sector size is 512 bytes, but device's 2048");
|
||||
}
|
||||
else
|
||||
{
|
||||
APMEntry_sector = imagePlugin.ReadSector(first_sector);
|
||||
APMEntry = DecodeAPMEntry(APMEntry_sector);
|
||||
|
||||
if (APMEntry.signature != APM_ENTRY && APMEntry.signature != APM_OLDENT)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
APMEntry_sector = imagePlugin.ReadSector(first_sector);
|
||||
APMEntry = DecodeAPMEntry(APMEntry_sector);
|
||||
|
||||
if (APMEntry.signature != APM_ENTRY && APMEntry.signature != APM_OLDENT)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (APMEntry.entries <= 1)
|
||||
return false;
|
||||
|
||||
apm_entries = APMEntry.entries;
|
||||
|
||||
for (ulong i = 0; i < apm_entries; i++) // For each partition
|
||||
{
|
||||
if(APMFromHDDOnCD)
|
||||
APMEntry_sector = Read2048SectorAs512(imagePlugin, first_sector + i);
|
||||
else
|
||||
APMEntry_sector = imagePlugin.ReadSector(first_sector + i);
|
||||
|
||||
APMEntry = DecodeAPMEntry(APMEntry_sector);
|
||||
|
||||
if (APMEntry.signature == APM_ENTRY || APMEntry.signature == APM_OLDENT) // It should have partition entry signature
|
||||
{
|
||||
CommonTypes.Partition _partition = new CommonTypes.Partition();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
_partition.PartitionSequence = i;
|
||||
_partition.PartitionType = APMEntry.type;
|
||||
_partition.PartitionName = APMEntry.name;
|
||||
_partition.PartitionStart = APMEntry.start * sector_size;
|
||||
_partition.PartitionLength = APMEntry.sectors * sector_size;
|
||||
_partition.PartitionStartSector = APMEntry.start;
|
||||
_partition.PartitionSectors = APMEntry.sectors;
|
||||
|
||||
sb.AppendLine("Partition flags:");
|
||||
if ((APMEntry.status & 0x01) == 0x01)
|
||||
sb.AppendLine("Partition is valid.");
|
||||
if ((APMEntry.status & 0x02) == 0x02)
|
||||
sb.AppendLine("Partition entry is not available.");
|
||||
if ((APMEntry.status & 0x04) == 0x04)
|
||||
sb.AppendLine("Partition is mounted.");
|
||||
if ((APMEntry.status & 0x08) == 0x08)
|
||||
sb.AppendLine("Partition is bootable.");
|
||||
if ((APMEntry.status & 0x10) == 0x10)
|
||||
sb.AppendLine("Partition is readable.");
|
||||
if ((APMEntry.status & 0x20) == 0x20)
|
||||
sb.AppendLine("Partition is writable.");
|
||||
if ((APMEntry.status & 0x40) == 0x40)
|
||||
sb.AppendLine("Partition's boot code is position independent.");
|
||||
|
||||
if ((APMEntry.status & 0x08) == 0x08)
|
||||
{
|
||||
sb.AppendFormat("First boot sector: {0}", APMEntry.first_boot_block).AppendLine();
|
||||
sb.AppendFormat("Boot is {0} bytes.", APMEntry.boot_size).AppendLine();
|
||||
sb.AppendFormat("Boot load address: 0x{0:X8}", APMEntry.load_address).AppendLine();
|
||||
sb.AppendFormat("Boot entry point: 0x{0:X8}", APMEntry.entry_point).AppendLine();
|
||||
sb.AppendFormat("Boot code checksum: 0x{0:X8}", APMEntry.checksum).AppendLine();
|
||||
sb.AppendFormat("Processor: {0}", APMEntry.processor).AppendLine();
|
||||
}
|
||||
|
||||
_partition.PartitionDescription = sb.ToString();
|
||||
|
||||
if ((APMEntry.status & 0x01) == 0x01)
|
||||
if (APMEntry.type != "Apple_partition_map")
|
||||
partitions.Add(_partition);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static byte[] Read2048SectorAs512(ImagePlugins.ImagePlugin imagePlugin, UInt64 LBA)
|
||||
{
|
||||
UInt64 LBA2k = LBA / 4;
|
||||
int Remainder = (int)(LBA % 4);
|
||||
|
||||
byte[] buffer = imagePlugin.ReadSector(LBA2k);
|
||||
byte[] sector = new byte[512];
|
||||
|
||||
Array.Copy(buffer, Remainder * 512, sector, 0, 512);
|
||||
|
||||
return sector;
|
||||
}
|
||||
|
||||
static AppleMapPartitionEntry DecodeAPMEntry(byte[] APMEntry_sector)
|
||||
{
|
||||
AppleMapPartitionEntry APMEntry = new AppleMapPartitionEntry();
|
||||
byte[] cString;
|
||||
|
||||
APMEntry.signature = BigEndianBitConverter.ToUInt16(APMEntry_sector, 0x00);
|
||||
APMEntry.reserved1 = BigEndianBitConverter.ToUInt16(APMEntry_sector, 0x02);
|
||||
APMEntry.entries = BigEndianBitConverter.ToUInt32(APMEntry_sector, 0x04);
|
||||
APMEntry.start = BigEndianBitConverter.ToUInt32(APMEntry_sector, 0x08);
|
||||
APMEntry.sectors = BigEndianBitConverter.ToUInt32(APMEntry_sector, 0x0C);
|
||||
cString = new byte[32];
|
||||
Array.Copy(APMEntry_sector, 0x10, cString, 0, 32);
|
||||
APMEntry.name = StringHandlers.CToString(cString);
|
||||
cString = new byte[32];
|
||||
Array.Copy(APMEntry_sector, 0x30, cString, 0, 32);
|
||||
APMEntry.type = StringHandlers.CToString(cString);
|
||||
APMEntry.first_data_block = BigEndianBitConverter.ToUInt32(APMEntry_sector, 0x50);
|
||||
APMEntry.data_sectors = BigEndianBitConverter.ToUInt32(APMEntry_sector, 0x54);
|
||||
APMEntry.status = BigEndianBitConverter.ToUInt32(APMEntry_sector, 0x58);
|
||||
APMEntry.first_boot_block = BigEndianBitConverter.ToUInt32(APMEntry_sector, 0x5C);
|
||||
APMEntry.boot_size = BigEndianBitConverter.ToUInt32(APMEntry_sector, 0x60);
|
||||
APMEntry.load_address = BigEndianBitConverter.ToUInt32(APMEntry_sector, 0x64);
|
||||
APMEntry.reserved2 = BigEndianBitConverter.ToUInt32(APMEntry_sector, 0x68);
|
||||
APMEntry.entry_point = BigEndianBitConverter.ToUInt32(APMEntry_sector, 0x6C);
|
||||
APMEntry.reserved3 = BigEndianBitConverter.ToUInt32(APMEntry_sector, 0x70);
|
||||
APMEntry.checksum = BigEndianBitConverter.ToUInt32(APMEntry_sector, 0x74);
|
||||
cString = new byte[16];
|
||||
Array.Copy(APMEntry_sector, 0x78, cString, 0, 16);
|
||||
APMEntry.processor = StringHandlers.CToString(cString);
|
||||
|
||||
return APMEntry;
|
||||
}
|
||||
|
||||
public struct AppleMapBootEntry
|
||||
{
|
||||
// Signature ("ER")
|
||||
public UInt16 signature;
|
||||
// Byter per sector
|
||||
public UInt16 sector_size;
|
||||
// Sectors of the disk
|
||||
public UInt32 sectors;
|
||||
// Reserved
|
||||
public UInt16 reserved1;
|
||||
// Reserved
|
||||
public UInt16 reserved2;
|
||||
// Reserved
|
||||
public UInt32 reserved3;
|
||||
// Number of entries of the driver descriptor
|
||||
public UInt16 driver_entries;
|
||||
// First sector of the driver
|
||||
public UInt32 first_driver_blk;
|
||||
// Size in 512bytes sectors of the driver
|
||||
public UInt16 driver_size;
|
||||
// Operating system (MacOS = 1)
|
||||
public UInt16 operating_system;
|
||||
}
|
||||
|
||||
public struct AppleMapPartitionEntry
|
||||
{
|
||||
// Signature ("PM" or "TS")
|
||||
public UInt16 signature;
|
||||
// Reserved
|
||||
public UInt16 reserved1;
|
||||
// Number of entries on the partition map, each one sector
|
||||
public UInt32 entries;
|
||||
// First sector of the partition
|
||||
public UInt32 start;
|
||||
// Number of sectos of the partition
|
||||
public UInt32 sectors;
|
||||
// Partition name, 32 bytes, null-padded
|
||||
public string name;
|
||||
// Partition type. 32 bytes, null-padded
|
||||
public string type;
|
||||
// First sector of the data area
|
||||
public UInt32 first_data_block;
|
||||
// Number of sectors of the data area
|
||||
public UInt32 data_sectors;
|
||||
// Partition status
|
||||
public UInt32 status;
|
||||
// First sector of the boot code
|
||||
public UInt32 first_boot_block;
|
||||
// Size in bytes of the boot code
|
||||
public UInt32 boot_size;
|
||||
// Load address of the boot code
|
||||
public UInt32 load_address;
|
||||
// Reserved
|
||||
public UInt32 reserved2;
|
||||
// Entry point of the boot code
|
||||
public UInt32 entry_point;
|
||||
// Reserved
|
||||
public UInt32 reserved3;
|
||||
// Boot code checksum
|
||||
public UInt32 checksum;
|
||||
// Processor type, 16 bytes, null-padded
|
||||
public string processor;
|
||||
}
|
||||
}
|
||||
}
|
||||
418
DiscImageChef.Partitions/Atari.cs
Normal file
418
DiscImageChef.Partitions/Atari.cs
Normal file
@@ -0,0 +1,418 @@
|
||||
/***************************************************************************
|
||||
The Disc Image Chef
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Filename : NeXT.cs
|
||||
Version : 1.0
|
||||
Author(s) : Natalia Portillo
|
||||
|
||||
Component : Partitioning scheme plugins
|
||||
|
||||
Revision : $Revision$
|
||||
Last change by : $Author$
|
||||
Date : $Date$
|
||||
|
||||
--[ Description ] ----------------------------------------------------------
|
||||
|
||||
Manages NeXTStep and OpenStep partitions.
|
||||
|
||||
--[ License ] --------------------------------------------------------------
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2014 Claunia.com
|
||||
****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using DiscImageChef;
|
||||
|
||||
// Information learnt from XNU source and testing against real disks
|
||||
namespace DiscImageChef.PartPlugins
|
||||
{
|
||||
class AtariPartitions : PartPlugin
|
||||
{
|
||||
const UInt32 TypeGEMDOS = 0x0047454D;
|
||||
const UInt32 TypeBigGEMDOS = 0x0042474D;
|
||||
const UInt32 TypeExtended = 0x0058474D;
|
||||
const UInt32 TypeLinux = 0x004C4E58;
|
||||
const UInt32 TypeSwap = 0x00535750;
|
||||
const UInt32 TypeRAW = 0x00524157;
|
||||
const UInt32 TypeNetBSD = 0x004E4244;
|
||||
const UInt32 TypeNetBSDSwap = 0x004E4253;
|
||||
|
||||
public AtariPartitions()
|
||||
{
|
||||
Name = "Atari partitions";
|
||||
PluginUUID = new Guid("d1dd0f24-ec39-4c4d-9072-be31919a3b5e");
|
||||
}
|
||||
|
||||
public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<CommonTypes.Partition> partitions)
|
||||
{
|
||||
partitions = new List<CommonTypes.Partition>();
|
||||
|
||||
if (imagePlugin.GetSectorSize() < 512)
|
||||
return false;
|
||||
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
|
||||
byte[] sector = imagePlugin.ReadSector(0);
|
||||
|
||||
AtariTable table = new AtariTable();
|
||||
table.boot = new byte[342];
|
||||
table.icdEntries = new AtariEntry[8];
|
||||
table.unused = new byte[12];
|
||||
table.entries = new AtariEntry[4];
|
||||
|
||||
Array.Copy(sector, 0, table.boot, 0, 342);
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
table.icdEntries[i].type = BigEndianBitConverter.ToUInt32(sector, 342 + i * 12 + 0);
|
||||
table.icdEntries[i].start = BigEndianBitConverter.ToUInt32(sector, 342 + i * 12 + 4);
|
||||
table.icdEntries[i].length = BigEndianBitConverter.ToUInt32(sector, 342 + i * 12 + 8);
|
||||
}
|
||||
|
||||
Array.Copy(sector, 438, table.unused, 0, 12);
|
||||
|
||||
table.size = BigEndianBitConverter.ToUInt32(sector, 450);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
table.entries[i].type = BigEndianBitConverter.ToUInt32(sector, 454 + i * 12 + 0);
|
||||
table.entries[i].start = BigEndianBitConverter.ToUInt32(sector, 454 + i * 12 + 4);
|
||||
table.entries[i].length = BigEndianBitConverter.ToUInt32(sector, 454 + i * 12 + 8);
|
||||
}
|
||||
|
||||
table.badStart = BigEndianBitConverter.ToUInt32(sector, 502);
|
||||
table.badLength = BigEndianBitConverter.ToUInt32(sector, 506);
|
||||
table.checksum = BigEndianBitConverter.ToUInt16(sector, 510);
|
||||
|
||||
//if (MainClass.isDebug)
|
||||
{
|
||||
Checksums.SHA1Context sha1Ctx = new Checksums.SHA1Context();
|
||||
sha1Ctx.Init();
|
||||
sha1Ctx.Update(table.boot);
|
||||
Console.WriteLine("DEBUG (Atari plugin): Boot code SHA1: {0}", sha1Ctx.End());
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
Console.WriteLine("DEBUG (Atari plugin): table.icdEntries[{0}].flag = 0x{1:X2}", i, (table.icdEntries[i].type & 0xFF000000) >> 24);
|
||||
Console.WriteLine("DEBUG (Atari plugin): table.icdEntries[{0}].type = 0x{1:X6}", i, (table.icdEntries[i].type & 0x00FFFFFF));
|
||||
Console.WriteLine("DEBUG (Atari plugin): table.icdEntries[{0}].start = {1}", i, table.icdEntries[i].start);
|
||||
Console.WriteLine("DEBUG (Atari plugin): table.icdEntries[{0}].length = {1}", i, table.icdEntries[i].length);
|
||||
}
|
||||
|
||||
Console.WriteLine("DEBUG (Atari plugin): table.size = {0}", table.size);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Console.WriteLine("DEBUG (Atari plugin): table.entries[{0}].flag = 0x{1:X2}", i, (table.entries[i].type & 0xFF000000) >> 24);
|
||||
Console.WriteLine("DEBUG (Atari plugin): table.entries[{0}].type = 0x{1:X6}", i, (table.entries[i].type & 0x00FFFFFF));
|
||||
Console.WriteLine("DEBUG (Atari plugin): table.entries[{0}].start = {1}", i, table.entries[i].start);
|
||||
Console.WriteLine("DEBUG (Atari plugin): table.entries[{0}].length = {1}", i, table.entries[i].length);
|
||||
}
|
||||
|
||||
Console.WriteLine("DEBUG (Atari plugin): table.badStart = {0}", table.badStart);
|
||||
Console.WriteLine("DEBUG (Atari plugin): table.badLength = {0}", table.badLength);
|
||||
Console.WriteLine("DEBUG (Atari plugin): table.checksum = 0x{0:X4}", table.checksum);
|
||||
}
|
||||
|
||||
bool validTable = false;
|
||||
ulong partitionSequence = 0;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
UInt32 type = table.entries[i].type & 0x00FFFFFF;
|
||||
|
||||
if (type == TypeGEMDOS || type == TypeBigGEMDOS || type == TypeLinux ||
|
||||
type == TypeSwap || type == TypeRAW || type == TypeNetBSD || type == TypeNetBSDSwap)
|
||||
{
|
||||
validTable = true;
|
||||
|
||||
if (table.entries[i].start <= imagePlugin.GetSectors())
|
||||
{
|
||||
//if (MainClass.isDebug)
|
||||
{
|
||||
if ((table.entries[i].start + table.entries[i].length) > imagePlugin.GetSectors())
|
||||
Console.WriteLine("DEBUG (Atari plugin): WARNING: End of partition goes beyond device size");
|
||||
}
|
||||
|
||||
ulong sectorSize = imagePlugin.GetSectorSize();
|
||||
if (sectorSize == 2448 || sectorSize == 2352)
|
||||
sectorSize = 2048;
|
||||
|
||||
CommonTypes.Partition part = new CommonTypes.Partition();
|
||||
part.PartitionLength = table.entries[i].length * sectorSize;
|
||||
part.PartitionSectors = table.entries[i].length;
|
||||
part.PartitionSequence = partitionSequence;
|
||||
part.PartitionName = "";
|
||||
part.PartitionStart = table.entries[i].start * sectorSize;
|
||||
part.PartitionStartSector = table.entries[i].start;
|
||||
|
||||
byte[] partType = new byte[3];
|
||||
partType[0] = (byte)((type & 0xFF0000) >> 16);
|
||||
partType[1] = (byte)((type & 0x00FF00) >> 8);
|
||||
partType[2] = (byte)(type & 0x0000FF);
|
||||
part.PartitionType = Encoding.ASCII.GetString(partType);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case TypeGEMDOS:
|
||||
part.PartitionDescription = "Atari GEMDOS partition";
|
||||
break;
|
||||
case TypeBigGEMDOS:
|
||||
part.PartitionDescription = "Atari GEMDOS partition bigger than 32 MiB";
|
||||
break;
|
||||
case TypeLinux:
|
||||
part.PartitionDescription = "Linux partition";
|
||||
break;
|
||||
case TypeSwap:
|
||||
part.PartitionDescription = "Swap partition";
|
||||
break;
|
||||
case TypeRAW:
|
||||
part.PartitionDescription = "RAW partition";
|
||||
break;
|
||||
case TypeNetBSD:
|
||||
part.PartitionDescription = "NetBSD partition";
|
||||
break;
|
||||
case TypeNetBSDSwap:
|
||||
part.PartitionDescription = "NetBSD swap partition";
|
||||
break;
|
||||
default:
|
||||
part.PartitionDescription = "Unknown partition type";
|
||||
break;
|
||||
}
|
||||
|
||||
partitions.Add(part);
|
||||
partitionSequence++;
|
||||
}
|
||||
}
|
||||
|
||||
if (type == TypeExtended)
|
||||
{
|
||||
byte[] extendedSector = imagePlugin.ReadSector(table.entries[i].start);
|
||||
AtariTable extendedTable = new AtariTable();
|
||||
extendedTable.entries = new AtariEntry[4];
|
||||
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
extendedTable.entries[j].type = BigEndianBitConverter.ToUInt32(extendedSector, 454 + j * 12 + 0);
|
||||
extendedTable.entries[j].start = BigEndianBitConverter.ToUInt32(extendedSector, 454 + j * 12 + 4);
|
||||
extendedTable.entries[j].length = BigEndianBitConverter.ToUInt32(extendedSector, 454 + j * 12 + 8);
|
||||
}
|
||||
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
UInt32 extendedType = extendedTable.entries[j].type & 0x00FFFFFF;
|
||||
|
||||
if (extendedType == TypeGEMDOS || extendedType == TypeBigGEMDOS || extendedType == TypeLinux ||
|
||||
extendedType == TypeSwap || extendedType == TypeRAW || extendedType == TypeNetBSD || extendedType == TypeNetBSDSwap)
|
||||
{
|
||||
validTable = true;
|
||||
if (extendedTable.entries[j].start <= imagePlugin.GetSectors())
|
||||
{
|
||||
//if (MainClass.isDebug)
|
||||
{
|
||||
if ((extendedTable.entries[j].start + extendedTable.entries[j].length) > imagePlugin.GetSectors())
|
||||
Console.WriteLine("DEBUG (Atari plugin): WARNING: End of partition goes beyond device size");
|
||||
}
|
||||
|
||||
ulong sectorSize = imagePlugin.GetSectorSize();
|
||||
if (sectorSize == 2448 || sectorSize == 2352)
|
||||
sectorSize = 2048;
|
||||
|
||||
CommonTypes.Partition part = new CommonTypes.Partition();
|
||||
part.PartitionLength = extendedTable.entries[j].length * sectorSize;
|
||||
part.PartitionSectors = extendedTable.entries[j].length;
|
||||
part.PartitionSequence = partitionSequence;
|
||||
part.PartitionName = "";
|
||||
part.PartitionStart = extendedTable.entries[j].start * sectorSize;
|
||||
part.PartitionStartSector = extendedTable.entries[j].start;
|
||||
|
||||
byte[] partType = new byte[3];
|
||||
partType[0] = (byte)((extendedType & 0xFF0000) >> 16);
|
||||
partType[1] = (byte)((extendedType & 0x00FF00) >> 8);
|
||||
partType[2] = (byte)(extendedType & 0x0000FF);
|
||||
part.PartitionType = Encoding.ASCII.GetString(partType);
|
||||
|
||||
switch (extendedType)
|
||||
{
|
||||
case TypeGEMDOS:
|
||||
part.PartitionDescription = "Atari GEMDOS partition";
|
||||
break;
|
||||
case TypeBigGEMDOS:
|
||||
part.PartitionDescription = "Atari GEMDOS partition bigger than 32 MiB";
|
||||
break;
|
||||
case TypeLinux:
|
||||
part.PartitionDescription = "Linux partition";
|
||||
break;
|
||||
case TypeSwap:
|
||||
part.PartitionDescription = "Swap partition";
|
||||
break;
|
||||
case TypeRAW:
|
||||
part.PartitionDescription = "RAW partition";
|
||||
break;
|
||||
case TypeNetBSD:
|
||||
part.PartitionDescription = "NetBSD partition";
|
||||
break;
|
||||
case TypeNetBSDSwap:
|
||||
part.PartitionDescription = "NetBSD swap partition";
|
||||
break;
|
||||
default:
|
||||
part.PartitionDescription = "Unknown partition type";
|
||||
break;
|
||||
}
|
||||
|
||||
partitions.Add(part);
|
||||
partitionSequence++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (validTable)
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
UInt32 type = table.icdEntries[i].type & 0x00FFFFFF;
|
||||
|
||||
if (type == TypeGEMDOS || type == TypeBigGEMDOS || type == TypeLinux ||
|
||||
type == TypeSwap || type == TypeRAW || type == TypeNetBSD || type == TypeNetBSDSwap)
|
||||
{
|
||||
if (table.icdEntries[i].start <= imagePlugin.GetSectors())
|
||||
{
|
||||
//if (MainClass.isDebug)
|
||||
{
|
||||
if ((table.icdEntries[i].start + table.icdEntries[i].length) > imagePlugin.GetSectors())
|
||||
Console.WriteLine("DEBUG (Atari plugin): WARNING: End of partition goes beyond device size");
|
||||
}
|
||||
|
||||
ulong sectorSize = imagePlugin.GetSectorSize();
|
||||
if (sectorSize == 2448 || sectorSize == 2352)
|
||||
sectorSize = 2048;
|
||||
|
||||
CommonTypes.Partition part = new CommonTypes.Partition();
|
||||
part.PartitionLength = table.icdEntries[i].length * sectorSize;
|
||||
part.PartitionSectors = table.icdEntries[i].length;
|
||||
part.PartitionSequence = partitionSequence;
|
||||
part.PartitionName = "";
|
||||
part.PartitionStart = table.icdEntries[i].start * sectorSize;
|
||||
part.PartitionStartSector = table.icdEntries[i].start;
|
||||
|
||||
byte[] partType = new byte[3];
|
||||
partType[0] = (byte)((type & 0xFF0000) >> 16);
|
||||
partType[1] = (byte)((type & 0x00FF00) >> 8);
|
||||
partType[2] = (byte)(type & 0x0000FF);
|
||||
part.PartitionType = Encoding.ASCII.GetString(partType);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case TypeGEMDOS:
|
||||
part.PartitionDescription = "Atari GEMDOS partition";
|
||||
break;
|
||||
case TypeBigGEMDOS:
|
||||
part.PartitionDescription = "Atari GEMDOS partition bigger than 32 MiB";
|
||||
break;
|
||||
case TypeLinux:
|
||||
part.PartitionDescription = "Linux partition";
|
||||
break;
|
||||
case TypeSwap:
|
||||
part.PartitionDescription = "Swap partition";
|
||||
break;
|
||||
case TypeRAW:
|
||||
part.PartitionDescription = "RAW partition";
|
||||
break;
|
||||
case TypeNetBSD:
|
||||
part.PartitionDescription = "NetBSD partition";
|
||||
break;
|
||||
case TypeNetBSDSwap:
|
||||
part.PartitionDescription = "NetBSD swap partition";
|
||||
break;
|
||||
default:
|
||||
part.PartitionDescription = "Unknown partition type";
|
||||
break;
|
||||
}
|
||||
|
||||
partitions.Add(part);
|
||||
partitionSequence++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return partitions.Count > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Atari partition entry
|
||||
/// </summary>
|
||||
struct AtariEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// First byte flag, three bytes type in ASCII.
|
||||
/// Flag bit 0 = active
|
||||
/// Flag bit 7 = bootable
|
||||
/// </summary>
|
||||
public UInt32 type;
|
||||
/// <summary>
|
||||
/// Starting sector
|
||||
/// </summary>
|
||||
public UInt32 start;
|
||||
/// <summary>
|
||||
/// Length in sectors
|
||||
/// </summary>
|
||||
public UInt32 length;
|
||||
}
|
||||
|
||||
struct AtariTable
|
||||
{
|
||||
/// <summary>
|
||||
/// Boot code for 342 bytes
|
||||
/// </summary>
|
||||
public byte[] boot;
|
||||
/// <summary>
|
||||
/// 8 extra entries for ICDPro driver
|
||||
/// </summary>
|
||||
public AtariEntry[] icdEntries;
|
||||
/// <summary>
|
||||
/// Unused, 12 bytes
|
||||
/// </summary>
|
||||
public byte[] unused;
|
||||
/// <summary>
|
||||
/// Disk size in sectors
|
||||
/// </summary>
|
||||
public UInt32 size;
|
||||
/// <summary>
|
||||
/// 4 partition entries
|
||||
/// </summary>
|
||||
public AtariEntry[] entries;
|
||||
/// <summary>
|
||||
/// Starting sector of bad block list
|
||||
/// </summary>
|
||||
public UInt32 badStart;
|
||||
/// <summary>
|
||||
/// Length in sectors of bad block list
|
||||
/// </summary>
|
||||
public UInt32 badLength;
|
||||
/// <summary>
|
||||
/// Checksum for bootable disks
|
||||
/// </summary>
|
||||
public UInt16 checksum;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
DiscImageChef.Partitions/ChangeLog
Normal file
12
DiscImageChef.Partitions/ChangeLog
Normal file
@@ -0,0 +1,12 @@
|
||||
2015-10-05 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* MBR.cs:
|
||||
* RDB.cs:
|
||||
* NeXT.cs:
|
||||
* Atari.cs:
|
||||
* AppleMap.cs:
|
||||
* PartPlugin.cs:
|
||||
* Properties/AssemblyInfo.cs:
|
||||
* DiscImageChef.Partitions.csproj:
|
||||
Move partitions plugins to a separate library.
|
||||
|
||||
64
DiscImageChef.Partitions/DiscImageChef.Partitions.csproj
Normal file
64
DiscImageChef.Partitions/DiscImageChef.Partitions.csproj
Normal file
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{DA7AB65D-B5BA-4003-8893-A51BB071BA2F}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>DiscImageChef.Partitions</RootNamespace>
|
||||
<AssemblyName>DiscImageChef.Partitions</AssemblyName>
|
||||
<ReleaseVersion>2.2</ReleaseVersion>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="AppleMap.cs" />
|
||||
<Compile Include="Atari.cs" />
|
||||
<Compile Include="MBR.cs" />
|
||||
<Compile Include="NeXT.cs" />
|
||||
<Compile Include="PartPlugin.cs" />
|
||||
<Compile Include="RDB.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DiscImageChef.CommonTypes\DiscImageChef.CommonTypes.csproj">
|
||||
<Project>{F2B84194-26EB-4227-B1C5-6602517E85AE}</Project>
|
||||
<Name>DiscImageChef.CommonTypes</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\DiscImageChef.Helpers\DiscImageChef.Helpers.csproj">
|
||||
<Project>{F8BDF57B-1571-4CD0-84B3-B422088D359A}</Project>
|
||||
<Name>DiscImageChef.Helpers</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\DiscImageChef.DiscImages\DiscImageChef.DiscImages.csproj">
|
||||
<Project>{74032CBC-339B-42F3-AF6F-E96C261F3E6A}</Project>
|
||||
<Name>DiscImageChef.DiscImages</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\DiscImageChef.Checksums\DiscImageChef.Checksums.csproj">
|
||||
<Project>{CC48B324-A532-4A45-87A6-6F91F7141E8D}</Project>
|
||||
<Name>DiscImageChef.Checksums</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
1240
DiscImageChef.Partitions/MBR.cs
Normal file
1240
DiscImageChef.Partitions/MBR.cs
Normal file
File diff suppressed because it is too large
Load Diff
202
DiscImageChef.Partitions/NeXT.cs
Normal file
202
DiscImageChef.Partitions/NeXT.cs
Normal file
@@ -0,0 +1,202 @@
|
||||
/***************************************************************************
|
||||
The Disc Image Chef
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Filename : NeXT.cs
|
||||
Version : 1.0
|
||||
Author(s) : Natalia Portillo
|
||||
|
||||
Component : Partitioning scheme plugins
|
||||
|
||||
Revision : $Revision$
|
||||
Last change by : $Author$
|
||||
Date : $Date$
|
||||
|
||||
--[ Description ] ----------------------------------------------------------
|
||||
|
||||
Manages NeXTStep and OpenStep partitions.
|
||||
|
||||
--[ License ] --------------------------------------------------------------
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2014 Claunia.com
|
||||
****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using DiscImageChef;
|
||||
|
||||
// Information learnt from XNU source and testing against real disks
|
||||
namespace DiscImageChef.PartPlugins
|
||||
{
|
||||
class NeXTDisklabel : PartPlugin
|
||||
{
|
||||
const UInt32 NEXT_MAGIC1 = 0x4E655854;
|
||||
// "NeXT"
|
||||
const UInt32 NEXT_MAGIC2 = 0x646C5632;
|
||||
// "dlV2"
|
||||
const UInt32 NEXT_MAGIC3 = 0x646C5633;
|
||||
// "dlV3"
|
||||
const UInt16 disktabStart = 0xB4;
|
||||
// 180
|
||||
const UInt16 disktabEntrySize = 0x2C;
|
||||
// 44
|
||||
public NeXTDisklabel()
|
||||
{
|
||||
Name = "NeXT Disklabel";
|
||||
PluginUUID = new Guid("246A6D93-4F1A-1F8A-344D-50187A5513A9");
|
||||
}
|
||||
|
||||
public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<CommonTypes.Partition> partitions)
|
||||
{
|
||||
byte[] cString;
|
||||
bool magic_found;
|
||||
byte[] entry_sector;
|
||||
|
||||
UInt32 magic;
|
||||
UInt32 sector_size;
|
||||
UInt16 front_porch;
|
||||
|
||||
if (imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448)
|
||||
sector_size = 2048;
|
||||
else
|
||||
sector_size = imagePlugin.GetSectorSize();
|
||||
|
||||
partitions = new List<CommonTypes.Partition>();
|
||||
|
||||
entry_sector = imagePlugin.ReadSector(0); // Starts on sector 0 on NeXT machines, CDs and floppies
|
||||
magic = BigEndianBitConverter.ToUInt32(entry_sector, 0x00);
|
||||
|
||||
if (magic == NEXT_MAGIC1 || magic == NEXT_MAGIC2 || magic == NEXT_MAGIC3)
|
||||
magic_found = true;
|
||||
else
|
||||
{
|
||||
entry_sector = imagePlugin.ReadSector(15); // Starts on sector 15 on MBR machines
|
||||
magic = BigEndianBitConverter.ToUInt32(entry_sector, 0x00);
|
||||
|
||||
if (magic == NEXT_MAGIC1 || magic == NEXT_MAGIC2 || magic == NEXT_MAGIC3)
|
||||
magic_found = true;
|
||||
else
|
||||
{
|
||||
if (sector_size == 2048)
|
||||
entry_sector = imagePlugin.ReadSector(4); // Starts on sector 4 on RISC CDs
|
||||
else
|
||||
entry_sector = imagePlugin.ReadSector(16); // Starts on sector 16 on RISC disks
|
||||
magic = BigEndianBitConverter.ToUInt32(entry_sector, 0x00);
|
||||
|
||||
if (magic == NEXT_MAGIC1 || magic == NEXT_MAGIC2 || magic == NEXT_MAGIC3)
|
||||
magic_found = true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
front_porch = BigEndianBitConverter.ToUInt16(entry_sector, 0x6A);
|
||||
|
||||
if (magic_found)
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
NeXTEntry entry = new NeXTEntry();
|
||||
|
||||
entry.start = BigEndianBitConverter.ToUInt32(entry_sector, disktabStart + disktabEntrySize * i + 0x00);
|
||||
entry.sectors = BigEndianBitConverter.ToUInt32(entry_sector, disktabStart + disktabEntrySize * i + 0x04);
|
||||
entry.block_size = BigEndianBitConverter.ToUInt16(entry_sector, disktabStart + disktabEntrySize * i + 0x08);
|
||||
entry.frag_size = BigEndianBitConverter.ToUInt16(entry_sector, disktabStart + disktabEntrySize * i + 0x0A);
|
||||
entry.optimization = entry_sector[disktabStart + disktabEntrySize * i + 0x0C];
|
||||
entry.cpg = BigEndianBitConverter.ToUInt16(entry_sector, disktabStart + disktabEntrySize * i + 0x0D);
|
||||
entry.bpi = BigEndianBitConverter.ToUInt16(entry_sector, disktabStart + disktabEntrySize * i + 0x0F);
|
||||
entry.freemin = entry_sector[disktabStart + disktabEntrySize * i + 0x11];
|
||||
entry.newfs = entry_sector[disktabStart + disktabEntrySize * i + 0x12];
|
||||
cString = new byte[16];
|
||||
Array.Copy(entry_sector, disktabStart + disktabEntrySize * i + 0x13, cString, 0, 16);
|
||||
entry.mount_point = StringHandlers.CToString(cString);
|
||||
entry.automount = entry_sector[disktabStart + disktabEntrySize * i + 0x23];
|
||||
cString = new byte[8];
|
||||
Array.Copy(entry_sector, disktabStart + disktabEntrySize * i + 0x24, cString, 0, 8);
|
||||
entry.type = StringHandlers.CToString(cString);
|
||||
|
||||
if (entry.sectors > 0 && entry.sectors < 0xFFFFFFFF && entry.start < 0xFFFFFFFF)
|
||||
{
|
||||
CommonTypes.Partition part = new CommonTypes.Partition();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
part.PartitionLength = (ulong)entry.sectors * sector_size;
|
||||
part.PartitionStart = ((ulong)entry.start + front_porch) * sector_size;
|
||||
part.PartitionType = entry.type;
|
||||
part.PartitionSequence = (ulong)i;
|
||||
part.PartitionName = entry.mount_point;
|
||||
part.PartitionSectors = (ulong)entry.sectors;
|
||||
part.PartitionStartSector = ((ulong)entry.start + front_porch);
|
||||
|
||||
sb.AppendFormat("{0} bytes per block", entry.block_size).AppendLine();
|
||||
sb.AppendFormat("{0} bytes per fragment", entry.frag_size).AppendLine();
|
||||
if (entry.optimization == 's')
|
||||
sb.AppendLine("Space optimized");
|
||||
else if (entry.optimization == 't')
|
||||
sb.AppendLine("Time optimized");
|
||||
else
|
||||
sb.AppendFormat("Unknown optimization {0:X2}", entry.optimization).AppendLine();
|
||||
sb.AppendFormat("{0} cylinders per group", entry.cpg).AppendLine();
|
||||
sb.AppendFormat("{0} bytes per inode", entry.bpi).AppendLine();
|
||||
sb.AppendFormat("{0}% of space must be free at minimum", entry.freemin).AppendLine();
|
||||
if (entry.newfs != 1) // Seems to indicate newfs has been already run
|
||||
sb.AppendLine("Filesystem should be formatted at start");
|
||||
if (entry.automount == 1)
|
||||
sb.AppendLine("Filesystem should be automatically mounted");
|
||||
|
||||
part.PartitionDescription = sb.ToString();
|
||||
|
||||
partitions.Add(part);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
struct NeXTEntry
|
||||
{
|
||||
public UInt32 start;
|
||||
// Sector of start, counting from front porch
|
||||
public UInt32 sectors;
|
||||
// Length in sectors
|
||||
public UInt16 block_size;
|
||||
// Filesystem's block size
|
||||
public UInt16 frag_size;
|
||||
// Filesystem's fragment size
|
||||
public byte optimization;
|
||||
// 's'pace or 't'ime
|
||||
public UInt16 cpg;
|
||||
// Cylinders per group
|
||||
public UInt16 bpi;
|
||||
// Bytes per inode
|
||||
public byte freemin;
|
||||
// % of minimum free space
|
||||
public byte newfs;
|
||||
// Should newfs be run on first start?
|
||||
public string mount_point;
|
||||
// Mount point or empty if mount where you want
|
||||
public byte automount;
|
||||
// Should automount
|
||||
public string type;
|
||||
// Filesystem type, always "4.3BSD"?
|
||||
}
|
||||
}
|
||||
}
|
||||
66
DiscImageChef.Partitions/PartPlugin.cs
Normal file
66
DiscImageChef.Partitions/PartPlugin.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
/***************************************************************************
|
||||
The Disc Image Chef
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Filename : PartPlugin.cs
|
||||
Version : 1.0
|
||||
Author(s) : Natalia Portillo
|
||||
|
||||
Component : Partitioning scheme plugins
|
||||
|
||||
Revision : $Revision$
|
||||
Last change by : $Author$
|
||||
Date : $Date$
|
||||
|
||||
--[ Description ] ----------------------------------------------------------
|
||||
|
||||
Defines functions to be used by partitioning scheme plugins and several constants.
|
||||
|
||||
--[ License ] --------------------------------------------------------------
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2014 Claunia.com
|
||||
****************************************************************************/
|
||||
//$Id$
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DiscImageChef.PartPlugins
|
||||
{
|
||||
/// <summary>
|
||||
/// Abstract class to implement partitioning schemes interpreting plugins.
|
||||
/// </summary>
|
||||
public abstract class PartPlugin
|
||||
{
|
||||
/// <summary>Plugin name.</summary>
|
||||
public string Name;
|
||||
/// <summary>Plugin UUID.</summary>
|
||||
public Guid PluginUUID;
|
||||
|
||||
protected PartPlugin()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Interprets a partitioning scheme.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c>, if partitioning scheme is recognized, <c>false</c> otherwise.</returns>
|
||||
/// <param name="imagePlugin">Disk image.</param>
|
||||
/// <param name="partitions">Returns list of partitions.</param>
|
||||
public abstract bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<CommonTypes.Partition> partitions);
|
||||
}
|
||||
}
|
||||
27
DiscImageChef.Partitions/Properties/AssemblyInfo.cs
Normal file
27
DiscImageChef.Partitions/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle("DiscImageChef.Partitions")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Claunia.com")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("© Claunia.com")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
|
||||
1529
DiscImageChef.Partitions/RDB.cs
Normal file
1529
DiscImageChef.Partitions/RDB.cs
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user