Files
Aaru/DiscImageChef.Devices/Windows/Extern.cs

48 lines
1.8 KiB
C#
Raw Normal View History

2015-10-05 21:20:25 +01:00
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,
2015-10-06 18:27:38 +01:00
[MarshalAs(UnmanagedType.U4)] FileAccess access,
[MarshalAs(UnmanagedType.U4)] FileShare share,
2015-10-05 21:20:25 +01:00
IntPtr securityAttributes, // optional SECURITY_ATTRIBUTES struct or IntPtr.Zero
2015-10-06 18:28:06 +01:00
[MarshalAs(UnmanagedType.U4)] FileMode creationDisposition,
2015-10-06 18:27:38 +01:00
[MarshalAs(UnmanagedType.U4)] FileAttributes flagsAndAttributes,
2015-10-05 21:20:25 +01:00
IntPtr templateFile);
2015-10-07 02:15:31 +01:00
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint="ioctl", CharSet = CharSet.Auto)]
public static extern bool DeviceIoControlScsi(
2015-10-05 21:20:25 +01:00
SafeFileHandle hDevice,
uint IoControlCode,
2015-10-06 18:29:15 +01:00
ref ScsiPassThroughDirectAndSenseBuffer InBuffer,
2015-10-05 21:20:25 +01:00
uint nInBufferSize,
2015-10-06 18:29:15 +01:00
ref ScsiPassThroughDirectAndSenseBuffer OutBuffer,
2015-10-05 21:20:25 +01:00
uint nOutBufferSize,
ref uint pBytesReturned,
IntPtr Overlapped
);
2015-10-07 02:15:31 +01:00
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint="ioctl", CharSet = CharSet.Auto)]
public static extern bool DeviceIoControlAta(
SafeFileHandle hDevice,
uint IoControlCode,
ref AtaPassThroughDirect InBuffer,
uint nInBufferSize,
ref AtaPassThroughDirect OutBuffer,
uint nOutBufferSize,
ref uint pBytesReturned,
IntPtr Overlapped
);
2015-10-05 21:20:25 +01:00
[DllImport("Kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern bool CloseHandle(SafeFileHandle hDevice);
}
}