3.2.4.1.2 Unmarshaling an Object Reference

The client MUST use NDR to unmarshal an OBJREF from a MInterfacePointer in the RPC PDU body. The unmarshaling mechanism consists of the following sequence of operations:

  • If the signature field of the OBJREF structure (section 2.2.18) is not set to 0x574f454d, the client MUST return RPC_E_INVALID_OBJREF.

  • If the flags field of the OBJREF structure (section 2.2.18) is not set to only one of OBJREF_STANDARD, OBJREF_HANDLER, OBJREF_CUSTOM or OBJREF_EXTENDED values, the client MUST return RPC_E_INVALID_OBJREF.

  • If the OBJREF_STANDARD flag is set in the flags field of the OBJREF structure (section 2.2.18), the client MUST do the following:

    • The client MUST extract the IID and the OBJREF_STANDARD from the OBJREF if the flags field specifies OBJREF_STANDARD.

    • Next, the client MUST extract the STDOBJREF and the DUALSTRINGARRAY from the OBJREF_STANDARD.

    • Next, the client MUST look up the OXID entry in the OXID table using the OXID from the STDOBJREF. If the table entry is not found:

      • The client MUST determine the RPC binding information to be used for the OXID resolution request, as specified in section 3.2.4.1.2.1.

      • Next, the client MUST issue the OXID resolution request to obtain the RPC binding information of the object exporter, as specified in section 3.2.4.1.2.2.

    • Next, the client MUST update its tables, as specified in section 3.2.4.1.2.3.

    • Finally, the client MUST compare the IID in the OBJREF with the IID specified by the application when unmarshaling the object reference (see section 4.5). If the IIDs are not equal:

      • First, the client SHOULD acquire an object reference of the IID specified by the application; see section 3.2.4.4.3. The client MAY instead report an error to the application.<83>

      • Next, the client MUST release the object reference unmarshaled from the OBJREF (see section 3.2.4.4.2).

  • Otherwise, if the OBJREF_EXTENDED flag is set in the flags field of the OBJREF structure (section 2.2.18), the client MUST do the following:

    • The client MUST read the Context structure (section 2.2.20) contained in the Data field of the DATAELEMENT structure (section 2.2.18.8) contained in the ElmArray field of the OBJREF_EXTENDED structure (section 2.2.18.7) contained in the OBJREF structure (section 2.2.18).

    • If the dwNumExtents field or the cbExtents field of the Context structure is not set to 0x00000000, the client MUST return RPC_E_INVALID_OBJREF.

    • Otherwise, the client MUST supply the context properties contained in the PROPMARSHALHEADER array (section 2.2.20.1) contained in the Context structure (section 2.2.20) to the application or the higher-layer protocol.

  • Otherwise, if the OBJREF_HANDLER or the OBJREF_CUSTOM flag is set in the flags field of the OBJREF structure (section 2.2.18), the client MUST supply the OBJREF to the application or higher-layer protocol to unmarshal the OBJREF_HANDLER (section 2.2.18.5) or the OBJREF_CUSTOM (section 2.2.18.6) OBJREF types respectively.