Fix unsigned vs. signed problem

This commit is contained in:
Michael D
2017-12-20 18:41:50 +01:00
parent ff2afc4593
commit b030712b38
3 changed files with 12 additions and 12 deletions

View File

@@ -154,10 +154,10 @@ namespace DiscImageChef.Devices
descriptor.DeviceTypeModifier = descriptorB[9]; descriptor.DeviceTypeModifier = descriptorB[9];
descriptor.RemovableMedia = descriptorB[10] > 0; descriptor.RemovableMedia = descriptorB[10] > 0;
descriptor.CommandQueueing = descriptorB[11] > 0; descriptor.CommandQueueing = descriptorB[11] > 0;
descriptor.VendorIdOffset = BitConverter.ToUInt32(descriptorB, 12); descriptor.VendorIdOffset = BitConverter.ToInt32(descriptorB, 12);
descriptor.ProductIdOffset = BitConverter.ToUInt32(descriptorB, 16); descriptor.ProductIdOffset = BitConverter.ToInt32(descriptorB, 16);
descriptor.ProductRevisionOffset = BitConverter.ToUInt32(descriptorB, 20); descriptor.ProductRevisionOffset = BitConverter.ToInt32(descriptorB, 20);
descriptor.SerialNumberOffset = BitConverter.ToUInt32(descriptorB, 24); descriptor.SerialNumberOffset = BitConverter.ToInt32(descriptorB, 24);
descriptor.BusType = (Windows.StorageBusType)BitConverter.ToUInt32(descriptorB, 28); descriptor.BusType = (Windows.StorageBusType)BitConverter.ToUInt32(descriptorB, 28);
descriptor.RawPropertiesLength = BitConverter.ToUInt32(descriptorB, 32); descriptor.RawPropertiesLength = BitConverter.ToUInt32(descriptorB, 32);
descriptor.RawDeviceProperties = new byte[descriptor.RawPropertiesLength]; descriptor.RawDeviceProperties = new byte[descriptor.RawPropertiesLength];

View File

@@ -114,10 +114,10 @@ namespace DiscImageChef.Devices.Windows
descriptor.DeviceTypeModifier = descriptorB[9]; descriptor.DeviceTypeModifier = descriptorB[9];
descriptor.RemovableMedia = BitConverter.ToBoolean(descriptorB, 10); descriptor.RemovableMedia = BitConverter.ToBoolean(descriptorB, 10);
descriptor.CommandQueueing = BitConverter.ToBoolean(descriptorB, 11); descriptor.CommandQueueing = BitConverter.ToBoolean(descriptorB, 11);
descriptor.VendorIdOffset = BitConverter.ToUInt32(descriptorB, 12); descriptor.VendorIdOffset = BitConverter.ToInt32(descriptorB, 12);
descriptor.ProductIdOffset = BitConverter.ToUInt32(descriptorB, 16); descriptor.ProductIdOffset = BitConverter.ToInt32(descriptorB, 16);
descriptor.ProductRevisionOffset = BitConverter.ToUInt32(descriptorB, 20); descriptor.ProductRevisionOffset = BitConverter.ToInt32(descriptorB, 20);
descriptor.SerialNumberOffset = BitConverter.ToUInt32(descriptorB, 24); descriptor.SerialNumberOffset = BitConverter.ToInt32(descriptorB, 24);
descriptor.BusType = (StorageBusType)BitConverter.ToUInt32(descriptorB, 28); descriptor.BusType = (StorageBusType)BitConverter.ToUInt32(descriptorB, 28);
descriptor.RawPropertiesLength = BitConverter.ToUInt32(descriptorB, 32); descriptor.RawPropertiesLength = BitConverter.ToUInt32(descriptorB, 32);

View File

@@ -166,10 +166,10 @@ namespace DiscImageChef.Devices.Windows
public byte DeviceTypeModifier; public byte DeviceTypeModifier;
[MarshalAs(UnmanagedType.U1)] public bool RemovableMedia; [MarshalAs(UnmanagedType.U1)] public bool RemovableMedia;
[MarshalAs(UnmanagedType.U1)] public bool CommandQueueing; [MarshalAs(UnmanagedType.U1)] public bool CommandQueueing;
public uint VendorIdOffset; public int VendorIdOffset;
public uint ProductIdOffset; public int ProductIdOffset;
public uint ProductRevisionOffset; public int ProductRevisionOffset;
public uint SerialNumberOffset; public int SerialNumberOffset;
public StorageBusType BusType; public StorageBusType BusType;
public uint RawPropertiesLength; public uint RawPropertiesLength;
public byte[] RawDeviceProperties; public byte[] RawDeviceProperties;