NdrStubForwardingFunction function

The NdrStubForwardingFunction function is the entry point for server-side object methods that are defined in a base interface.


RPCRTAPI void __RPC_STUB NdrStubForwardingFunction(
  _In_    IRpcStubBuffer    *pThis,
  _In_    IRpcChannelBuffer *pChannel,
  _Inout_ PRPC_MESSAGE      pMsg,
  _Out_   DWORD             *pdwStubPhase


pThis [in]

Pointer to an instance of the CStdStubBuffer object, implementing IRpcStubBuffer, for the DCOM interface.

pChannel [in]

Pointer to IRpcChannelBuffer for the DCOM interface, often provided by OLE.

pMsg [in, out]

Pointer to an RPC_MESSAGE structure that contains information about the RPC request.

pdwStubPhase [out]

Pointer to a flag that tracks the current interpreter call's activity.

Return value

This function has no return value. Throws an exception upon error.


The pdwStubPhase parameter is used by the object interface to determine exception handling behavior. The following table describes possible values for the pdwStubPhase parameter.

STUB_UNMARSHALThe stub is in marshalling phase.
STUB_CALL_SERVERThe stub is calling a server manager routine.
STUB_MARSHALThe stub is in unmarshalling phase.
STUB_CALL_SERVER_NO_HRESULTObsolete. For deprecated stubs only.


For methods that are defined in a base interface, RPC needs to forward the code to the base interface implementation. For example:

Interface IFunctionSample: IUnknown


HRESULT FunctionSample();


Interface IOperation: IFunctionSample


HRESULT Operation();


In this example, where IFunctionSample and IOperation are defined in different .idl files. IFunctionSample is the base interface and IOperation is the derived interface. IOperation can aggregate IOperation without implementing IOperation::FunctionSample. When the client calls IOperation::FunctionSample, in the server side, RPC forwards the call to IFunctionSample:FunctionSample.


Minimum supported client

Windows 2000 Professional [desktop apps | UWP apps]

Minimum supported server

Windows 2000 Server [desktop apps | UWP apps]