<PackageReference Include="Relativity.Server.Transfer.SDK" Version="7.7.0" />

NativeMethods

static class 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 CreateFileW([MarshalAs(UnmanagedType.LPWStr)] string filename, [MarshalAs(UnmanagedType.U4)] FileAccess access, [MarshalAs(UnmanagedType.U4)] FileShare share, IntPtr securityAttributes, [MarshalAs(UnmanagedType.U4)] FileMode creationDisposition, [MarshalAs(UnmanagedType.U4)] FileAttributes flagsAndAttributes, IntPtr templateFile); [DllImport("kernel32.dll")] internal static extern int GetLastError(); } }