Ejemplo n.º 1
0
 public static extern bool BindIoCompletionCallback([In] IntPtr FileHandle, LPOVERLAPPED_COMPLETION_ROUTINE Function, uint Flags);
Ejemplo n.º 2
0
 public static extern bool ReadFileEx(
     [In] IntPtr hFile, IntPtr lpBuffer, uint nNumberOfBytesToRead, ref OVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine);
Ejemplo n.º 3
0
 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);
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 public static extern bool WriteFileEx(
     IntPtr hFile,
     byte[] lpBuffer,
     uint nNumberOfBytesToWrite,
     [In] ref NativeOverlapped lpOverlapped,
     LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine);
Ejemplo n.º 6
0
 public static extern bool BindIoCompletionCallback([In] IntPtr FileHandle, LPOVERLAPPED_COMPLETION_ROUTINE Function, uint Flags);