Compartilhar via


CoUnmarshalInterface (Windows CE 5.0)

Send Feedback

This function initializes a newly created proxy using data written into the stream by a previous call to the CoMarshalInterface function, and returns an interface pointer to that proxy.

STDAPI CoUnmarshalInterface(IStream* pStm,REFIID riid,void** ppv);

Parameters

  • pStm
    [in] Pointer to the stream from which the interface is to be unmarshaled.
  • riid
    [in] Reference to the identifier of the interface to be unmarshaled.
  • ppv
    [out] Address of pointer variable that receives the interface pointer requested in riid. Upon successful return, *ppv contains the requested interface pointer for the unmarshaled interface.

Return Values

This function supports the standard return value E_FAIL, as well as the following:

  • S_OK
    The interface pointer was unmarshaled successfully.
  • STG_E_INVALIDPOINTER
    pStm is an invalid pointer.
  • CO_E_NOTINITIALIZED
    The CoInitialize function was not called on the current thread before this function was called.
  • CO_E_OBJNOTCONNECTED
    The object application has been disconnected from the remoting system (for example, as a result of a call to the CoDisconnectObject function).
  • REGDB_E_CLASSNOTREG
    An error occurred reading the registration database.
  • E_NOINTERFACE
    The final QueryInterface of this function for the requested interface returned E_NOINTERFACE.
  • CoCreateInstance errors
    An error occurred when creating the handler.

Remarks

The CoUnmarshalInterface function performs the following tasks:

  1. Reads from the stream the CLSID to be used to create an instance of the proxy.

  2. Gets an IMarshal pointer to the proxy that is to do the unmarshaling.

    If the object uses COM's default marshaling implementation, the pointer thus obtained is to an instance of the generic proxy object.

    If the marshaling is occurring between two threads in the same process, the pointer is to an instance of the in-process free threaded marshaler.

    If the object provides its own marshaling code, CoUnmarshalInterface calls the CoCreateInstance function, passing the CLSID it read from the marshaling stream.

    CoCreateInstance creates an instance of the object's proxy and returns an IMarshal interface pointer to the proxy.

  3. Using whichever IMarshal interface pointer it has acquired, the function then calls IMarshal::UnmarshalInterface and, if appropriate, IMarshal::ReleaseMarshalData.

The primary caller of this function is COM itself, from within interface proxies or stubs that unmarshal an interface pointer.

There are, however, some situations in which the application might call CoUnmarshalInterface. For example, when implementing a stub, it will call CoUnmarshalInterface when the stub receives an interface pointer as a parameter in a method call.

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

Requirements

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

See Also

COM Functions

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.