private ReadFile ( |
||
hFile | ||
lpBuffer | [ | |
nNumberOfBytesToRead | uint | |
lpNumberOfBytesRead | uint | |
lpOverlapped | ||
return | bool |
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); } }
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); } }