ReadFile() in C#
<p>I want to read byte data from external Chip. I am using <code>Readfile()</code> function. </p>

<pre><code>GENERIC_READ = 0x80000000;
uint GENERIC_WRITE = 0x40000000; 
FILE_SHARE_READ = 0x00000001;
FILE_SHARE_WRITE = 0x00000003; 
FILE_FLAG_NO_BUFFERING = 0x20000000; 
ReadHandle, ReadHandle = CreateFile(Devicepath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, FILE_FLAG_NO_BUFFERING); 
</code></pre>

<p>all these constants are defined as public constants. I am getting input report length from </p>

<pre><code>HidP_GetCaps. int myPtrToPreparsedData = -1; 
int reportLength = myHIDP_CAPS.InputReportByteLength
</code></pre>

<p>When ever execution comes to this line, system hangs up and it will go further.</p>

<pre><code>(ReadFile(ReadHandle, LBytes, IRBLength, ref BRead, 0))
</code></pre>

<p><code>ReadHandle</code> is valid, it is +ve number coming from createFile functions and <code>LBytes =[256],IRBLength=256,ref BRead =0</code>. Any suggestions why it is hanging up here at this part of code.</p>
