HidLibrary.NativeMethods.ReadFile C# (CSharp) Method

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
        internal static extern bool ReadFile(IntPtr hFile, [Out] byte[] lpBuffer, uint nNumberOfBytesToRead, out uint lpNumberOfBytesRead, IntPtr lpOverlapped);

Usage Example

Example #1
0
 public ReadStatus ReadFile(byte[] inputBuffer)
 {
     if (safeReadHandle == null)
     {
         safeReadHandle = OpenHandle(_devicePath, true);
     }
     try
     {
         uint bytesRead;
         lock (this)
         {
             idleTicks = 0;
         }
         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);
     }
 }
All Usage Examples Of HidLibrary.NativeMethods::ReadFile