public static unsafe PipeException GetOverlappedReadException(PipeHandle pipe, NativeOverlapped* nativeOverlapped, out int bytesRead)
 {
     if (UnsafeNativeMethods.GetOverlappedResult(pipe.DangerousGetHandle(), nativeOverlapped, out bytesRead, 0) != 0)
     {
         return null;
     }
     int error = Marshal.GetLastWin32Error();
     if (error == 0xea)
     {
         return null;
     }
     return CreateReadException(error);
 }
 public static unsafe PipeException GetOverlappedWriteException(PipeHandle pipe, NativeOverlapped* nativeOverlapped, out int bytesWritten)
 {
     if (UnsafeNativeMethods.GetOverlappedResult(pipe.DangerousGetHandle(), nativeOverlapped, out bytesWritten, 0) == 0)
     {
         return CreateWriteException(Marshal.GetLastWin32Error());
     }
     return null;
 }
Esempio n. 3
0
            public static unsafe PipeException GetOverlappedReadException(PipeHandle pipe,
                NativeOverlapped* nativeOverlapped, out int bytesRead)
            {
                if (UnsafeNativeMethods.GetOverlappedResult(pipe.DangerousGetHandle(), nativeOverlapped, out bytesRead, 0) == 0)
                {
                    int error = Marshal.GetLastWin32Error();
                    if (error == UnsafeNativeMethods.ERROR_MORE_DATA)
                    {
                        return null;
                    }

                    else
                    {
                        return Exceptions.CreateReadException(error);
                    }
                }
                else
                {
                    return null;
                }
            }