Use new little endian marshaller on partitions.

This commit is contained in:
2019-02-28 00:32:14 +00:00
parent 691b51aa1b
commit e1b79b8e54
12 changed files with 99 additions and 148 deletions

View File

@@ -35,6 +35,7 @@ using System.Collections.Generic;
using System.Runtime.InteropServices;
using DiscImageChef.CommonTypes.Interfaces;
using DiscImageChef.Console;
using Marshal = DiscImageChef.Helpers.Marshal;
namespace DiscImageChef.Partitions
{
@@ -60,9 +61,7 @@ namespace DiscImageChef.Partitions
byte[] tblsector = imagePlugin.ReadSector(42 + sectorOffset);
GCHandle handle = GCHandle.Alloc(tblsector, GCHandleType.Pinned);
Partable xnxtbl = (Partable)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Partable));
handle.Free();
Partable xnxtbl = Marshal.ByteArrayToStructureLittleEndian<Partable>(tblsector);
DicConsole.DebugWriteLine("XENIX plugin", "xnxtbl.p_magic = 0x{0:X4} (should be 0x{1:X4})", xnxtbl.p_magic,
PAMAGIC);