mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Code restyling.
This commit is contained in:
@@ -52,7 +52,8 @@ namespace Aaru.Filesystems
|
||||
|
||||
public bool Identify(IMediaImage imagePlugin, Partition partition)
|
||||
{
|
||||
if(2 + partition.Start >= partition.End) return false;
|
||||
if(2 + partition.Start >= partition.End)
|
||||
return false;
|
||||
|
||||
byte[] eigthBytes = new byte[8];
|
||||
|
||||
@@ -61,25 +62,29 @@ namespace Aaru.Filesystems
|
||||
Array.Copy(ntfsBpb, 0x003, eigthBytes, 0, 8);
|
||||
string oemName = StringHandlers.CToString(eigthBytes);
|
||||
|
||||
if(oemName != "NTFS ") return false;
|
||||
if(oemName != "NTFS ")
|
||||
return false;
|
||||
|
||||
byte fatsNo = ntfsBpb[0x010];
|
||||
ushort spFat = BitConverter.ToUInt16(ntfsBpb, 0x016);
|
||||
ushort signature = BitConverter.ToUInt16(ntfsBpb, 0x1FE);
|
||||
|
||||
if(fatsNo != 0) return false;
|
||||
if(spFat != 0) return false;
|
||||
if(fatsNo != 0)
|
||||
return false;
|
||||
|
||||
if(spFat != 0)
|
||||
return false;
|
||||
|
||||
return signature == 0xAA55;
|
||||
}
|
||||
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
|
||||
Encoding encoding)
|
||||
Encoding encoding)
|
||||
{
|
||||
Encoding = Encoding.Unicode;
|
||||
information = "";
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
var sb = new StringBuilder();
|
||||
|
||||
byte[] ntfsBpb = imagePlugin.ReadSector(0 + partition.Start);
|
||||
|
||||
@@ -87,39 +92,51 @@ namespace Aaru.Filesystems
|
||||
|
||||
sb.AppendFormat("{0} bytes per sector", ntfsBb.bps).AppendLine();
|
||||
sb.AppendFormat("{0} sectors per cluster ({1} bytes)", ntfsBb.spc, ntfsBb.spc * ntfsBb.bps).AppendLine();
|
||||
|
||||
// sb.AppendFormat("{0} reserved sectors", ntfs_bb.rsectors).AppendLine();
|
||||
// sb.AppendFormat("{0} FATs", ntfs_bb.fats_no).AppendLine();
|
||||
// sb.AppendFormat("{0} entries in the root folder", ntfs_bb.root_ent).AppendLine();
|
||||
// sb.AppendFormat("{0} sectors on volume (small)", ntfs_bb.sml_sectors).AppendLine();
|
||||
sb.AppendFormat("Media descriptor: 0x{0:X2}", ntfsBb.media).AppendLine();
|
||||
|
||||
// sb.AppendFormat("{0} sectors per FAT", ntfs_bb.spfat).AppendLine();
|
||||
sb.AppendFormat("{0} sectors per track", ntfsBb.sptrk).AppendLine();
|
||||
sb.AppendFormat("{0} heads", ntfsBb.heads).AppendLine();
|
||||
sb.AppendFormat("{0} hidden sectors before filesystem", ntfsBb.hsectors).AppendLine();
|
||||
|
||||
// sb.AppendFormat("{0} sectors on volume (big)", ntfs_bb.big_sectors).AppendLine();
|
||||
sb.AppendFormat("BIOS drive number: 0x{0:X2}", ntfsBb.drive_no).AppendLine();
|
||||
|
||||
// sb.AppendFormat("NT flags: 0x{0:X2}", ntfs_bb.nt_flags).AppendLine();
|
||||
// sb.AppendFormat("Signature 1: 0x{0:X2}", ntfs_bb.signature1).AppendLine();
|
||||
sb.AppendFormat("{0} sectors on volume ({1} bytes)", ntfsBb.sectors, ntfsBb.sectors * ntfsBb.bps)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("{0} sectors on volume ({1} bytes)", ntfsBb.sectors, ntfsBb.sectors * ntfsBb.bps).
|
||||
AppendLine();
|
||||
|
||||
sb.AppendFormat("Cluster where $MFT starts: {0}", ntfsBb.mft_lsn).AppendLine();
|
||||
sb.AppendFormat("Cluster where $MFTMirr starts: {0}", ntfsBb.mftmirror_lsn).AppendLine();
|
||||
|
||||
if(ntfsBb.mft_rc_clusters > 0)
|
||||
sb.AppendFormat("{0} clusters per MFT record ({1} bytes)", ntfsBb.mft_rc_clusters,
|
||||
ntfsBb.mft_rc_clusters * ntfsBb.bps * ntfsBb.spc).AppendLine();
|
||||
else sb.AppendFormat("{0} bytes per MFT record", 1 << -ntfsBb.mft_rc_clusters).AppendLine();
|
||||
else
|
||||
sb.AppendFormat("{0} bytes per MFT record", 1 << -ntfsBb.mft_rc_clusters).AppendLine();
|
||||
|
||||
if(ntfsBb.index_blk_cts > 0)
|
||||
sb.AppendFormat("{0} clusters per Index block ({1} bytes)", ntfsBb.index_blk_cts,
|
||||
ntfsBb.index_blk_cts * ntfsBb.bps * ntfsBb.spc).AppendLine();
|
||||
else sb.AppendFormat("{0} bytes per Index block", 1 << -ntfsBb.index_blk_cts).AppendLine();
|
||||
else
|
||||
sb.AppendFormat("{0} bytes per Index block", 1 << -ntfsBb.index_blk_cts).AppendLine();
|
||||
|
||||
sb.AppendFormat("Volume serial number: {0:X16}", ntfsBb.serial_no).AppendLine();
|
||||
|
||||
// sb.AppendFormat("Signature 2: 0x{0:X4}", ntfs_bb.signature2).AppendLine();
|
||||
|
||||
XmlFsType = new FileSystemType();
|
||||
|
||||
if(ntfsBb.jump[0] == 0xEB && ntfsBb.jump[1] > 0x4E && ntfsBb.jump[1] < 0x80 && ntfsBb.signature2 == 0xAA55)
|
||||
if(ntfsBb.jump[0] == 0xEB &&
|
||||
ntfsBb.jump[1] > 0x4E &&
|
||||
ntfsBb.jump[1] < 0x80 &&
|
||||
ntfsBb.signature2 == 0xAA55)
|
||||
{
|
||||
XmlFsType.Bootable = true;
|
||||
string bootChk = Sha1Context.Data(ntfsBb.boot_code, out _);
|
||||
@@ -135,9 +152,7 @@ namespace Aaru.Filesystems
|
||||
information = sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NTFS $BOOT
|
||||
/// </summary>
|
||||
/// <summary>NTFS $BOOT</summary>
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct NtfsBootBlock
|
||||
{
|
||||
@@ -180,6 +195,7 @@ namespace Aaru.Filesystems
|
||||
public readonly byte signature1;
|
||||
/// <summary>0x027, Alignment</summary>
|
||||
public readonly byte dummy;
|
||||
|
||||
// End of BIOS Parameter Block
|
||||
|
||||
// Start of NTFS real superblock
|
||||
|
||||
Reference in New Issue
Block a user