CoUnmarshalInterface

Initializes a proxy object using data written into the stream by a previous call to the CoMarshalInterface function, and returns an interface pointer to that proxy object.

STDAPI CoUnmarshalInterface(

IStream * pStm,
//Stream used for unmarshalling
REFIID riid,
//IID of interface pointer desired
void ** ppv
//Receives the interface pointer
);

Parameters

pStm

Points to the stream from which the interface pointer is to be unmarshalled.

riid

Specifies the IID of the interface pointer desired.

ppv

Receives the interface pointer.

Return Values

S_OK

Indicates the interface was unmarshalled successfully.

STG_E_INVALIDPOINTER

Indicates pStm is an invalid pointer.

CO_E_NOTINITIALIZED

Indicates the CoInitialize or OleInitialize function was not called on the current thread before this function was called.

CO_E_OBJNOTCONNECTED

Indicates 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

Indicates an error occurred reading the registration database.

E_OUTOFMEMORY

Out of memory.

E_INVALIDARG

Indicates one or more arguments are invalid.

E_UNEXPECTED

Indicates an unexpected error occurred.

E_NOINTERFACE

Indicates the final QueryInterface of this function for the requested interface returned E_NOINTERFACE.

E_FAIL

Indicates an unspecified error.

CoCreateInstance errors

Indicates an error occurred when creating the handler (standard or custom marshaling).

Comments

The main steps that CoUnmarshalInterface performs are the following:

  1. The function reads a CLSID from the stream.

  2. If standard marshalling is being used, the function gets an IMarshal pointer to an instance of the standard unmarshaller. If custom marshalling is being used, the function creates a proxy by calling the CoCreateInstance function, passing the CLSID it read from the stream, and requests an IMarshal interface pointer to the newly created proxy.

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

You typically do not need to call this function. The primary caller of this function is OLE, from within interface proxies or stubs that unmarshal an interface pointer.

The only place where you might need to call this function is from your implementation of IMarshal::UnmarshalInterface, if you are performing custom marshaling. If your implementation of IMarshal::MarshalInterface called the CoMarshalInterface function to marshal an interface pointer to the stream, you must call CoUnmarshalInterface to retrieve that interface pointer. The retrieved interface pointer is typically a pointer to a private object in the originating process.

See Also

CoMarshalInterface, IMarshal::UnmarshalInterface

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database