IMarshal::GetUnmarshalClass

HRESULT IMarshal::GetUnmarshalClass(iid, pvInterface, dwDestContext, pvDestContext, mshlflags, pclsid)

Answer the class that should be used in the unmarshaling process to create an uninitialized object proxy.

dwDestContext is described in the API function CoMarshalInterface. The implementation of GetUnmarshalClass may wish for some destination contexts for which it takes no special action to delegate to the standard marshaling implementation, which is available through CoGetStandardMarshal. In addition, this delegation should always be done if the dwDestContext parameter contains any flags that the GetUnmarshalClass does not fully understand; it is by this means that we can extend the richness of destination contexts in the future. For example, in the future, one of these bits will likely be defined to indicate that the destination of the marshaling is across the network.

If the caller already has in hand the iid interface identified as being marshaled, he should pass the interface pointer through pvInterface. If he does not have this interface already, then he should pass NULL. This pointer can sometimes, though rarely, be used in order to determine the appropriate unmarshal class. If the IMarshal implementation really needs it, in can always QueryInterface on itself to retrieve the interface pointer; we optionally pass it here only to improve efficiency.

Argument

Type

Description

iid

REFIID

The interface on this object that we are going to marshal.

pvInterface

void *

The actual pointer that will be marshaled. May be NULL.

dwDestContext

DWORD

The destination context relative to the current context in which the unmarshaling will be done.

pvDestContext

void*

Non-NULL for some dwDestContext values.

mshlflags

DWORD

As in CoMarshalInterface().

pclsid

CLSID *

The class to be used in the unmarshaling process.

return value

HRESULT

S_OK, E_FAIL, E_NOINTERFACE, E_UNEXPECTED