Share via


CoMarshalHresult

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

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

Syntax

STDAPI CoMarshalHresult(
  IStream* pStm,
  HRESULT hresult
);

Parameters

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

Return Value

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

  • S_OK
    The HRESULT was marshaled successfully.
  • STG_E_INVALIDPOINTER
    Bad pointer passed in for pStm.
  • STG_E_MEDIUMFULL
    The medium is full.

Remarks

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, your application must call this function. In other circumstances, the application does not 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.

Requirements

Header objbase.h
Library ole32.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

COM Functions