rpc_message calls ReadFile/WriteFile for pipes which
are open for
 asynchronous requests. ReadFile/WriteFile can fail for an pending
 request. If it fails, the caller must check the last status
 (GetLastError()) for ERROR_IO_PENDING.  
You are abusing the word "failed" here. ReadFile/WriteFile returning
FALSE and last error being ERROR_IO_PENDING just means the operation
is pending, not that anything failed:-D
  An other problem is the using of
 the overlapped structure. The same structure is used for read and write
 requests. Sometimes the results from a write request is interpreted as a
 result  from a read request. It is also a bug in GetOverlappedResult.
 GetOverlappedResult must always check if the event is signaled. The
 status value may contain the result from the previous request. 
I impl/fixed GetOverlappedResult by black boxing behaviour agains win
nt, and it should be 100% correct. Maybe someone is using it wrong or
something else is broken?
Gunnar