ReadFile() private method

private ReadFile ( IntPtr hFile, [ lpBuffer, uint nNumberOfBytesToRead, uint &lpNumberOfBytesRead, IntPtr lpOverlapped ) : bool
hFile System.IntPtr
lpBuffer [
nNumberOfBytesToRead uint
lpNumberOfBytesRead uint
lpOverlapped System.IntPtr
return bool
コード例 #1
0
 public ReadStatus ReadFile(byte[] inputBuffer)
 {
     EnsureReadHandleActive();
     try
     {
         if (NativeMethods.ReadFile(SafeReadHandle.DangerousGetHandle(), inputBuffer, (uint)inputBuffer.Length, out uint bytesRead, IntPtr.Zero))
         {
             return(ReadStatus.Success);
         }
         else
         {
             return(ReadStatus.NoDataRead);
         }
     }
コード例 #2
0
ファイル: HidDevice.cs プロジェクト: chris-ayala/DS4Windows
 public ReadStatus ReadFile(byte[] inputBuffer)
 {
     if (safeReadHandle == null)
     {
         safeReadHandle = OpenHandle(_devicePath, true);
     }
     try
     {
         uint bytesRead;
         if (NativeMethods.ReadFile(safeReadHandle.DangerousGetHandle(), inputBuffer, (uint)inputBuffer.Length, out bytesRead, IntPtr.Zero))
         {
             return(ReadStatus.Success);
         }
         else
         {
             return(ReadStatus.NoDataRead);
         }
     }
     catch (Exception)
     {
         return(ReadStatus.ReadError);
     }
 }