Windows CE .NET

This function marshals an HRESULT to the specified stream, from which it can be unmarshaled using the CoUnmarshalHresult function.

STDAPI CoMarshalHresult(
  IStream* pStm,
  HRESULT hresult 


[in] Pointer to the marshaling stream.
[in] HRESULT in the originating process.

Return Values

This function supports the standard return values E_OUTOFMEMORY and E_UNEXPECTED, as well as the following:

The HRESULT was marshaled successfully.
Bad pointer passed in for pStm.
The medium is full.


An HRESULT is process-specific, so an HRESULT that is valid in one process might not be valid in another. If you are writing your own implementation of IMarshal and need to marshal an HRESULT from one process to another, either as a parameter or a return code, you must call this function. In other circumstances, you will have no need to call this function.

This function performs the following tasks:

  1. Writes an HRESULT to a stream.
  2. Returns an IStream pointer to that stream.

To determine whether the platform supports this function, see Determining Supported COM APIs.


OS Versions: Windows CE 3.0 and later.
Header: Objbase.h.
Link Library: Ole32.lib.

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.