There's RpcRaiseException() dunction in MS RPC runtime to indicate errors that occur during an RPC call either on the server side or in a pipe callback on the client side. The RPC_STATUS passed into RpcRaiseError() is propagated to the site of the RPC call.
The problem is how do I choose the RPC_STATUS value?
Say in a pipe pull() callback I read data from IStream* and feed that data into the pipe. Now IStream::Read() returns an HRESULT indicating an error and I need to call RpcRaiseException() to interrupt the call.
What value do I pass?