public static extern bool BindIoCompletionCallback([In] IntPtr FileHandle, LPOVERLAPPED_COMPLETION_ROUTINE Function, uint Flags);
public static extern bool ReadFileEx( [In] IntPtr hFile, IntPtr lpBuffer, uint nNumberOfBytesToRead, ref OVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine);
public static extern bool ReadDirectoryChanges( [In] IntPtr hDirectory, IntPtr lpBuffer, uint nBufferLength, [MarshalAs(UnmanagedType.Bool)] bool bWatchSubtree, uint dwNotifyFilter, [Out] out uint lpBytesReturned, ref OVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine);
public static bool WriteBufferToFileWithProgress(string filePath, byte[] buffer, LPOVERLAPPED_COMPLETION_ROUTINE callback) { using var hFile = CreateFileForWrite(filePath); if (hFile.IsInvalid) { return(false); } NativeOverlapped nativeOverlapped = new NativeOverlapped(); bool result = WriteFileEx(hFile.DangerousGetHandle(), buffer, (uint)buffer.LongLength, ref nativeOverlapped, callback); if (!result) { System.Diagnostics.Debug.WriteLine(Marshal.GetLastWin32Error()); } return(result); }
public static extern bool WriteFileEx( IntPtr hFile, byte[] lpBuffer, uint nNumberOfBytesToWrite, [In] ref NativeOverlapped lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine);
public static extern bool BindIoCompletionCallback([In] IntPtr FileHandle, LPOVERLAPPED_COMPLETION_ROUTINE Function, uint Flags);