Files
Aaru/DiscImageChef.Devices/Windows/Extern.cs
Natalia Portillo 115bf5030f * DiscImageChef.Devices/Command.cs:
Add skeleton for send SCSI command method.

	* DiscImageChef.Devices/Linux/Command.cs:
	* DiscImageChef.Devices/Windows/Command.cs:
	  Added per-platform send SCSI command method.

	* DiscImageChef.sln:
	* DiscImageChef.Interop/DetectOS.cs:
	* DiscImageChef.Interop/PlatformID.cs:
	* DiscImageChef.Interop/Properties/AssemblyInfo.cs:
	* DiscImageChef.Interop/DiscImageChef.Interop.csproj:
	  Added code to detect OS.

	* DiscImageChef.Devices/DiscImageChef.Devices.csproj:
	  Added per-platform send SCSI command method.
	Add skeleton for send SCSI command method.

	* DiscImageChef.Devices/Linux/Extern.cs:
	* DiscImageChef.Devices/Windows/Extern.cs:
	  Enhanced externs.

	* DiscImageChef.Devices/Linux/Structs.cs:
	  Typo.
2015-10-12 06:25:49 +01:00

48 lines
1.9 KiB
C#

using System;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;
namespace DiscImageChef.Devices.Windows
{
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);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint="ioctl", 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
);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint="ioctl", CharSet = CharSet.Auto)]
internal static extern bool DeviceIoControlAta(
SafeFileHandle hDevice,
WindowsIoctl IoControlCode,
ref AtaPassThroughDirect InBuffer,
uint nInBufferSize,
ref AtaPassThroughDirect OutBuffer,
uint nOutBufferSize,
ref uint pBytesReturned,
IntPtr Overlapped
);
[DllImport("Kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
internal static extern bool CloseHandle(SafeFileHandle hDevice);
}
}