Struct de-class

This commit is contained in:
2015-10-06 18:29:15 +01:00
parent 4aef27f3d3
commit c083f45ece
3 changed files with 31 additions and 28 deletions

View File

@@ -1,3 +1,9 @@
2015-10-06 Natalia Portillo <claunia@claunia.com>
* Windows/Extern.cs:
* Windows/Structs.cs:
Struct de-class
2015-10-06 Natalia Portillo <claunia@claunia.com> 2015-10-06 Natalia Portillo <claunia@claunia.com>
* Windows/Extern.cs: * Windows/Extern.cs:

View File

@@ -20,9 +20,9 @@ namespace DiscImageChef.Devices.Windows
public static extern bool DeviceIoControl( public static extern bool DeviceIoControl(
SafeFileHandle hDevice, SafeFileHandle hDevice,
uint IoControlCode, uint IoControlCode,
ref Structs.SCSI_PASS_THROUGH_DIRECT_AND_SENSE_BUFFER InBuffer, ref ScsiPassThroughDirectAndSenseBuffer InBuffer,
uint nInBufferSize, uint nInBufferSize,
ref Structs.SCSI_PASS_THROUGH_DIRECT_AND_SENSE_BUFFER OutBuffer, ref ScsiPassThroughDirectAndSenseBuffer OutBuffer,
uint nOutBufferSize, uint nOutBufferSize,
ref uint pBytesReturned, ref uint pBytesReturned,
IntPtr Overlapped IntPtr Overlapped

View File

@@ -3,34 +3,31 @@ using System.Runtime.InteropServices;
namespace DiscImageChef.Devices.Windows namespace DiscImageChef.Devices.Windows
{ {
static class Structs [StructLayout(LayoutKind.Sequential)]
struct ScsiPassThroughDirect
{ {
[StructLayout(LayoutKind.Sequential)] public ushort Length;
internal struct SCSI_PASS_THROUGH_DIRECT public byte ScsiStatus;
{ public byte PathId;
public ushort Length; public byte TargetId;
public byte ScsiStatus; public byte Lun;
public byte PathId; public byte CdbLength;
public byte TargetId; public byte SenseInfoLength;
public byte Lun; [MarshalAs(UnmanagedType.U1)]
public byte CdbLength; public ScsiIoctlDirection DataIn;
public byte SenseInfoLength; public uint DataTransferLength;
[MarshalAs(UnmanagedType.U1)] public uint TimeOutValue;
public ScsiIoctlDirection DataIn; public IntPtr DataBuffer;
public uint DataTransferLength; public uint SenseInfoOffset;
public uint TimeOutValue; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public IntPtr DataBuffer; public byte[] Cdb;
public uint SenseInfoOffset; };
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] Cdb;
};
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
internal struct SCSI_PASS_THROUGH_DIRECT_AND_SENSE_BUFFER { struct ScsiPassThroughDirectAndSenseBuffer {
public SCSI_PASS_THROUGH_DIRECT sptd; public ScsiPassThroughDirect sptd;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] SenseBuf; public byte[] SenseBuf;
}
} }
} }