CoUnmarshalInterface function (combaseapi.h)
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.
Syntax
HRESULT CoUnmarshalInterface(
[in] LPSTREAM pStm,
[in] REFIID riid,
[out] LPVOID *ppv
);
Parameters
[in] pStm
A pointer to the stream from which the interface is to be unmarshaled.
[in] riid
A reference to the identifier of the interface to be unmarshaled. For IID_NULL, the returned interface is the one defined by the stream, objref.iid.
[out] ppv
The 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 value
This function can return the standard return value E_FAIL, errors returned by CoCreateInstance, and the following values.
Return code | Description |
---|---|
|
The interface pointer was unmarshaled successfully. |
|
pStm is an invalid pointer. |
|
The CoInitialize or OleInitialize function was not called on the current thread before this function was called. |
|
The object application has been disconnected from the remoting system (for example, as a result of a call to the CoDisconnectObject function). |
|
An error occurred reading the registration database. |
|
The final QueryInterface of this function for the requested interface returned E_NOINTERFACE. |
Remarks
Security Note: Calling this method with untrusted data is a security risk. Call this method only with trusted data.
- Reads from the stream the CLSID to be used to create an instance of the proxy.
- 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.
- Using whichever IMarshal interface pointer it has acquired, the function then calls IMarshal::UnmarshalInterface and, if appropriate, IMarshal::ReleaseMarshalData.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps | UWP apps] |
Minimum supported server | Windows 2000 Server [desktop apps | UWP apps] |
Target Platform | Windows |
Header | combaseapi.h (include Objbase.h) |
Library | Ole32.lib |
DLL | Ole32.dll |