mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Correct name of ATA pass thru structure in Windows.
This commit is contained in:
@@ -37,7 +37,7 @@ using Microsoft.Win32.SafeHandles;
|
||||
|
||||
namespace DiscImageChef.Devices.Windows
|
||||
{
|
||||
static class Extern
|
||||
internal static class Extern
|
||||
{
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
|
||||
internal static extern SafeFileHandle CreateFile([MarshalAs(UnmanagedType.LPTStr)] string filename,
|
||||
@@ -45,10 +45,8 @@ namespace DiscImageChef.Devices.Windows
|
||||
[MarshalAs(UnmanagedType.U4)] FileShare share,
|
||||
IntPtr
|
||||
securityAttributes, // optional SECURITY_ATTRIBUTES struct or IntPtr.Zero
|
||||
[MarshalAs(UnmanagedType.U4)]
|
||||
FileMode creationDisposition,
|
||||
[MarshalAs(UnmanagedType.U4)]
|
||||
FileAttributes flagsAndAttributes, IntPtr templateFile);
|
||||
[MarshalAs(UnmanagedType.U4)] FileMode creationDisposition,
|
||||
[MarshalAs(UnmanagedType.U4)] FileAttributes flagsAndAttributes, IntPtr templateFile);
|
||||
|
||||
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
|
||||
internal static extern bool DeviceIoControlScsi(SafeFileHandle hDevice,
|
||||
@@ -63,9 +61,9 @@ namespace DiscImageChef.Devices.Windows
|
||||
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
|
||||
internal static extern bool DeviceIoControlAta(SafeFileHandle hDevice,
|
||||
WindowsIoctl ioControlCode,
|
||||
ref AtaPassThroughDirectWithBuffer inBuffer,
|
||||
ref AtaPassThroughExBuffer inBuffer,
|
||||
uint nInBufferSize,
|
||||
ref AtaPassThroughDirectWithBuffer outBuffer,
|
||||
ref AtaPassThroughExBuffer outBuffer,
|
||||
uint nOutBufferSize,
|
||||
ref uint pBytesReturned, IntPtr overlapped);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace DiscImageChef.Devices.Windows
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
struct ScsiPassThroughDirect
|
||||
internal struct ScsiPassThroughDirect
|
||||
{
|
||||
public ushort Length;
|
||||
public byte ScsiStatus;
|
||||
@@ -48,73 +48,84 @@ namespace DiscImageChef.Devices.Windows
|
||||
public byte Lun;
|
||||
public byte CdbLength;
|
||||
public byte SenseInfoLength;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public ScsiIoctlDirection DataIn;
|
||||
[MarshalAs(UnmanagedType.U1)] public ScsiIoctlDirection DataIn;
|
||||
public uint DataTransferLength;
|
||||
public uint TimeOutValue;
|
||||
public IntPtr DataBuffer;
|
||||
public uint SenseInfoOffset;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public byte[] Cdb;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct ScsiPassThroughDirectAndSenseBuffer
|
||||
internal struct ScsiPassThroughDirectAndSenseBuffer
|
||||
{
|
||||
public ScsiPassThroughDirect sptd;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
||||
public byte[] SenseBuf;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
struct AtaPassThroughDirect
|
||||
internal struct AtaPassThroughEx
|
||||
{
|
||||
/// <summary>
|
||||
/// Length in bytes of this structure
|
||||
/// </summary>
|
||||
public ushort Length;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates transfer direction and kind of operation
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.U2)]
|
||||
public AtaFlags AtaFlags;
|
||||
[MarshalAs(UnmanagedType.U2)] public AtaFlags AtaFlags;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates IDE port or bus, set by driver
|
||||
/// </summary>
|
||||
public byte PathId;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates target device on bus, set by driver
|
||||
/// </summary>
|
||||
public byte TargetId;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates logical unit number of device, set by driver
|
||||
/// </summary>
|
||||
public byte Lun;
|
||||
|
||||
/// <summary>
|
||||
/// Reserved
|
||||
/// </summary>
|
||||
public byte ReservedAsUchar;
|
||||
|
||||
/// <summary>
|
||||
/// Data transfer length in bytes
|
||||
/// </summary>
|
||||
public uint DataTransferLength;
|
||||
|
||||
/// <summary>
|
||||
/// Timeout value in seconds
|
||||
/// </summary>
|
||||
public uint TimeOutValue;
|
||||
|
||||
/// <summary>
|
||||
/// Reserved
|
||||
/// </summary>
|
||||
public uint ReservedAsUlong;
|
||||
|
||||
/// <summary>
|
||||
/// Pointer to data buffer relative to start of this structure
|
||||
/// </summary>
|
||||
public IntPtr DataBuffer;
|
||||
public IntPtr DataBufferOffset;
|
||||
|
||||
/// <summary>
|
||||
/// Previous ATA registers, for LBA48
|
||||
/// </summary>
|
||||
public AtaTaskFile PreviousTaskFile;
|
||||
|
||||
/// <summary>
|
||||
/// ATA registers
|
||||
/// </summary>
|
||||
@@ -123,75 +134,63 @@ namespace DiscImageChef.Devices.Windows
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
struct AtaPassThroughDirectWithBuffer
|
||||
internal struct AtaPassThroughExBuffer
|
||||
{
|
||||
public AtaPassThroughDirect aptd;
|
||||
public AtaPassThroughEx aptd;
|
||||
public uint filler;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64 * 512)]
|
||||
public byte[] dataBuffer;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
struct AtaTaskFile
|
||||
internal struct AtaTaskFile
|
||||
{
|
||||
// Fields for commands sent
|
||||
[FieldOffset(0)]
|
||||
public byte Features;
|
||||
[FieldOffset(6)]
|
||||
public byte Command;
|
||||
[FieldOffset(0)] public byte Features;
|
||||
[FieldOffset(6)] public byte Command;
|
||||
|
||||
// Fields on command return
|
||||
[FieldOffset(0)]
|
||||
public byte Error;
|
||||
[FieldOffset(6)]
|
||||
public byte Status;
|
||||
[FieldOffset(0)] public byte Error;
|
||||
[FieldOffset(6)] public byte Status;
|
||||
|
||||
// Common fields
|
||||
[FieldOffset(1)]
|
||||
public byte SectorCount;
|
||||
[FieldOffset(2)]
|
||||
public byte SectorNumber;
|
||||
[FieldOffset(3)]
|
||||
public byte CylinderLow;
|
||||
[FieldOffset(4)]
|
||||
public byte CylinderHigh;
|
||||
[FieldOffset(5)]
|
||||
public byte DeviceHead;
|
||||
[FieldOffset(7)]
|
||||
public byte Reserved;
|
||||
[FieldOffset(1)] public byte SectorCount;
|
||||
[FieldOffset(2)] public byte SectorNumber;
|
||||
[FieldOffset(3)] public byte CylinderLow;
|
||||
[FieldOffset(4)] public byte CylinderHigh;
|
||||
[FieldOffset(5)] public byte DeviceHead;
|
||||
[FieldOffset(7)] public byte Reserved;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct StoragePropertyQuery
|
||||
internal struct StoragePropertyQuery
|
||||
{
|
||||
[MarshalAs(UnmanagedType.U4)]
|
||||
public StoragePropertyId PropertyId;
|
||||
[MarshalAs(UnmanagedType.U4)]
|
||||
public StorageQueryType QueryType;
|
||||
[MarshalAs(UnmanagedType.U4)] public StoragePropertyId PropertyId;
|
||||
[MarshalAs(UnmanagedType.U4)] public StorageQueryType QueryType;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
|
||||
public byte[] AdditionalParameters;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
struct StorageDescriptorHeader
|
||||
internal struct StorageDescriptorHeader
|
||||
{
|
||||
public uint Version;
|
||||
public uint Size;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct StorageDeviceDescriptor
|
||||
internal struct StorageDeviceDescriptor
|
||||
{
|
||||
public uint Version;
|
||||
public uint Size;
|
||||
public byte DeviceType;
|
||||
public byte DeviceTypeModifier;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public bool RemovableMedia;
|
||||
[MarshalAs(UnmanagedType.U1)]
|
||||
public bool CommandQueueing;
|
||||
[MarshalAs(UnmanagedType.U1)] public bool RemovableMedia;
|
||||
[MarshalAs(UnmanagedType.U1)] public bool CommandQueueing;
|
||||
public int VendorIdOffset;
|
||||
public int ProductIdOffset;
|
||||
public int ProductRevisionOffset;
|
||||
@@ -202,16 +201,18 @@ namespace DiscImageChef.Devices.Windows
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct IdePassThroughDirect
|
||||
internal struct IdePassThroughDirect
|
||||
{
|
||||
/// <summary>
|
||||
/// ATA registers
|
||||
/// </summary>
|
||||
public AtaTaskFile CurrentTaskFile;
|
||||
|
||||
/// <summary>
|
||||
/// Size of data buffer
|
||||
/// </summary>
|
||||
public uint DataBufferSize;
|
||||
|
||||
/// <summary>
|
||||
/// Data buffer
|
||||
/// </summary>
|
||||
@@ -221,7 +222,7 @@ namespace DiscImageChef.Devices.Windows
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
struct StorageDeviceNumber
|
||||
internal struct StorageDeviceNumber
|
||||
{
|
||||
public int deviceType;
|
||||
public int deviceNumber;
|
||||
@@ -230,7 +231,7 @@ namespace DiscImageChef.Devices.Windows
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
struct DeviceInfoData
|
||||
internal struct DeviceInfoData
|
||||
{
|
||||
public int cbSize;
|
||||
public Guid classGuid;
|
||||
@@ -240,17 +241,17 @@ namespace DiscImageChef.Devices.Windows
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
struct DeviceInterfaceData
|
||||
internal struct DeviceInterfaceData
|
||||
{
|
||||
public int cbSize;
|
||||
public Guid interfaceClassGuid;
|
||||
public uint flags;
|
||||
IntPtr reserved;
|
||||
private readonly IntPtr reserved;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
struct UsbSetupPacket
|
||||
internal struct UsbSetupPacket
|
||||
{
|
||||
public byte bmRequest;
|
||||
public byte bRequest;
|
||||
@@ -261,16 +262,17 @@ namespace DiscImageChef.Devices.Windows
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
struct UsbDescriptorRequest
|
||||
internal struct UsbDescriptorRequest
|
||||
{
|
||||
public int ConnectionIndex;
|
||||
|
||||
public UsbSetupPacket SetupPacket;
|
||||
//public byte[] Data;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
struct SffdiskQueryDeviceProtocolData
|
||||
internal struct SffdiskQueryDeviceProtocolData
|
||||
{
|
||||
public ushort size;
|
||||
public ushort reserved;
|
||||
@@ -279,7 +281,7 @@ namespace DiscImageChef.Devices.Windows
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")]
|
||||
struct SffdiskDeviceCommandData
|
||||
internal struct SffdiskDeviceCommandData
|
||||
{
|
||||
public ushort size;
|
||||
public ushort reserved;
|
||||
@@ -290,7 +292,7 @@ namespace DiscImageChef.Devices.Windows
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct SdCmdDescriptor
|
||||
internal struct SdCmdDescriptor
|
||||
{
|
||||
public byte commandCode;
|
||||
public SdCommandClass cmdClass;
|
||||
|
||||
Reference in New Issue
Block a user