Correct name of ATA pass thru structure in Windows.

This commit is contained in:
2019-10-27 20:46:24 +00:00
parent 625442a221
commit 059362b0fe
2 changed files with 158 additions and 158 deletions

View File

@@ -37,102 +37,100 @@ 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,
[MarshalAs(UnmanagedType.U4)] FileAccess access,
[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);
internal static extern SafeFileHandle CreateFile([MarshalAs(UnmanagedType.LPTStr)] string filename,
[MarshalAs(UnmanagedType.U4)] FileAccess access,
[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);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
internal static extern bool DeviceIoControlScsi(SafeFileHandle hDevice,
WindowsIoctl ioControlCode,
ref ScsiPassThroughDirectAndSenseBuffer inBuffer,
uint nInBufferSize,
ref ScsiPassThroughDirectAndSenseBuffer outBuffer,
uint nOutBufferSize,
ref uint pBytesReturned,
IntPtr overlapped);
internal static extern bool DeviceIoControlScsi(SafeFileHandle hDevice,
WindowsIoctl ioControlCode,
ref ScsiPassThroughDirectAndSenseBuffer inBuffer,
uint nInBufferSize,
ref ScsiPassThroughDirectAndSenseBuffer outBuffer,
uint nOutBufferSize,
ref uint pBytesReturned,
IntPtr overlapped);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
internal static extern bool DeviceIoControlAta(SafeFileHandle hDevice,
WindowsIoctl ioControlCode,
ref AtaPassThroughDirectWithBuffer inBuffer,
uint nInBufferSize,
ref AtaPassThroughDirectWithBuffer outBuffer,
uint nOutBufferSize,
ref uint pBytesReturned, IntPtr overlapped);
internal static extern bool DeviceIoControlAta(SafeFileHandle hDevice,
WindowsIoctl ioControlCode,
ref AtaPassThroughExBuffer inBuffer,
uint nInBufferSize,
ref AtaPassThroughExBuffer outBuffer,
uint nOutBufferSize,
ref uint pBytesReturned, IntPtr overlapped);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
internal static extern bool DeviceIoControlStorageQuery(SafeFileHandle hDevice,
WindowsIoctl ioControlCode,
ref StoragePropertyQuery inBuffer,
uint nInBufferSize,
IntPtr outBuffer,
uint nOutBufferSize,
ref uint pBytesReturned,
IntPtr overlapped);
internal static extern bool DeviceIoControlStorageQuery(SafeFileHandle hDevice,
WindowsIoctl ioControlCode,
ref StoragePropertyQuery inBuffer,
uint nInBufferSize,
IntPtr outBuffer,
uint nOutBufferSize,
ref uint pBytesReturned,
IntPtr overlapped);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
internal static extern bool DeviceIoControlIde(SafeFileHandle hDevice,
WindowsIoctl ioControlCode,
ref IdePassThroughDirect inBuffer,
uint nInBufferSize,
ref IdePassThroughDirect outBuffer,
uint nOutBufferSize,
ref uint pBytesReturned,
IntPtr overlapped);
internal static extern bool DeviceIoControlIde(SafeFileHandle hDevice,
WindowsIoctl ioControlCode,
ref IdePassThroughDirect inBuffer,
uint nInBufferSize,
ref IdePassThroughDirect outBuffer,
uint nOutBufferSize,
ref uint pBytesReturned,
IntPtr overlapped);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
internal static extern bool DeviceIoControlGetDeviceNumber(SafeFileHandle hDevice,
WindowsIoctl ioControlCode,
IntPtr inBuffer,
uint nInBufferSize,
ref StorageDeviceNumber outBuffer,
uint nOutBufferSize,
ref uint pBytesReturned,
IntPtr overlapped);
internal static extern bool DeviceIoControlGetDeviceNumber(SafeFileHandle hDevice,
WindowsIoctl ioControlCode,
IntPtr inBuffer,
uint nInBufferSize,
ref StorageDeviceNumber outBuffer,
uint nOutBufferSize,
ref uint pBytesReturned,
IntPtr overlapped);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
internal static extern bool DeviceIoControl(SafeFileHandle hDevice,
WindowsIoctl ioControlCode, IntPtr inBuffer,
uint nInBufferSize,
ref SffdiskQueryDeviceProtocolData outBuffer,
uint nOutBufferSize,
out uint pBytesReturned,
IntPtr overlapped);
internal static extern bool DeviceIoControl(SafeFileHandle hDevice,
WindowsIoctl ioControlCode, IntPtr inBuffer,
uint nInBufferSize,
ref SffdiskQueryDeviceProtocolData outBuffer,
uint nOutBufferSize,
out uint pBytesReturned,
IntPtr overlapped);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
internal static extern bool DeviceIoControl(SafeFileHandle hDevice, WindowsIoctl ioControlCode,
byte[] inBuffer,
uint nInBufferSize, byte[] outBuffer,
uint nOutBufferSize,
out uint pBytesReturned, IntPtr overlapped);
byte[] inBuffer,
uint nInBufferSize, byte[] outBuffer,
uint nOutBufferSize,
out uint pBytesReturned, IntPtr overlapped);
[DllImport("setupapi.dll", CharSet = CharSet.Auto)]
internal static extern SafeFileHandle SetupDiGetClassDevs(ref Guid classGuid, IntPtr enumerator,
IntPtr hwndParent, DeviceGetClassFlags flags);
internal static extern SafeFileHandle SetupDiGetClassDevs(ref Guid classGuid, IntPtr enumerator,
IntPtr hwndParent, DeviceGetClassFlags flags);
[DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool SetupDiEnumDeviceInterfaces(SafeFileHandle hDevInfo,
IntPtr devInfo,
ref Guid interfaceClassGuid,
uint memberIndex,
ref DeviceInterfaceData deviceInterfaceData);
public static extern bool SetupDiEnumDeviceInterfaces(SafeFileHandle hDevInfo,
IntPtr devInfo,
ref Guid interfaceClassGuid,
uint memberIndex,
ref DeviceInterfaceData deviceInterfaceData);
[DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool SetupDiGetDeviceInterfaceDetail(SafeFileHandle hDevInfo,
ref DeviceInterfaceData deviceInterfaceData,
IntPtr deviceInterfaceDetailData,
uint deviceInterfaceDetailDataSize,
ref uint requiredSize,
IntPtr deviceInfoData);
public static extern bool SetupDiGetDeviceInterfaceDetail(SafeFileHandle hDevInfo,
ref DeviceInterfaceData deviceInterfaceData,
IntPtr deviceInterfaceDetailData,
uint deviceInterfaceDetailDataSize,
ref uint requiredSize,
IntPtr deviceInfoData);
[DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool SetupDiDestroyDeviceInfoList(SafeFileHandle hDevInfo);