NativeMethods
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
namespace Relativity.Transfer.Enumeration.Native
{
[ExcludeFromCodeCoverage]
internal static class NativeMethods
{
private const string _KERNEL32 = "kernel32.dll";
[DllImport("kernel32.dll", BestFitMapping = false, CharSet = CharSet.Auto, SetLastError = true)]
internal static extern SafeFindHandle FindFirstFile(string fileName, [In] [Out] NativeFindData data);
[DllImport("kernel32.dll", BestFitMapping = false, CharSet = CharSet.Auto, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool FindNextFile(SafeFindHandle hndFindFile, [In] [Out] [MarshalAs(UnmanagedType.LPStruct)] NativeFindData lpFindFileData);
[DllImport("kernel32.dll")]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool FindClose(IntPtr handle);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
internal static extern uint GetFileAttributes(string lpFileName);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern SafeFindHandle ([MarshalAs(UnmanagedType.LPWStr)] string , [MarshalAs(UnmanagedType.U4)] FileAccess , [MarshalAs(UnmanagedType.U4)] FileShare , IntPtr , [MarshalAs(UnmanagedType.U4)] FileMode , [MarshalAs(UnmanagedType.U4)] FileAttributes , IntPtr );
[DllImport("kernel32.dll")]
internal static extern int GetLastError();
}
}