Use new little endian marshaller on filesystems.

This commit is contained in:
2019-03-01 00:28:55 +00:00
parent f95633046e
commit 0ec558da55
45 changed files with 154 additions and 531 deletions

View File

@@ -99,10 +99,7 @@ namespace DiscImageChef.Filesystems
byte[] hbSector = imagePlugin.ReadSector(1 + partition.Start);
GCHandle handle = GCHandle.Alloc(hbSector, GCHandleType.Pinned);
OdsHomeBlock homeblock =
(OdsHomeBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(OdsHomeBlock));
handle.Free();
OdsHomeBlock homeblock = Helpers.Marshal.ByteArrayToStructureLittleEndian<OdsHomeBlock>(hbSector);
// Optical disc
if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc &&
@@ -115,9 +112,7 @@ namespace DiscImageChef.Filesystems
hbSector = new byte[0x200];
Array.Copy(tmp, 0x200, hbSector, 0, 0x200);
handle = GCHandle.Alloc(hbSector, GCHandleType.Pinned);
homeblock = (OdsHomeBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(OdsHomeBlock));
handle.Free();
homeblock = Helpers.Marshal.ByteArrayToStructureLittleEndian<OdsHomeBlock>(hbSector);
if(StringHandlers.CToString(homeblock.format) != "DECFILE11A " &&
StringHandlers.CToString(homeblock.format) != "DECFILE11B ") return;