HANDLE hfile = CreateFile(..., FILE_FLAG_OVERLAPPED, ...);
BYTE bBuffer[100];
OVERLAPPED o = { 0 };
o.Offset = 345;
BOOL fReadDone = ReadFile(hfile, bBuffer, 100, NULL, &o);
DWORD dwError = GetLastError();
if (!fReadDone && (dwError == ERROR_IO_PENDING))
{ // The I/O is being performed asynchronously; wait for it to complete
WaitForSingleObject(hfile, INFINITE);
fReadDone = TRUE;
}
if (fReadDone){
// o.Internal contains the I/O error
// o.InternalHigh contains the number of bytes transferred
// bBuffer contains the read data}
else{
// An error occurred; see dwError
}