Pointers (RPC)
A common pointer is defined as everything other than interface pointers and byte count pointers.
There are two possible layouts for the description:
pointer_type<1> pointer_attributes<1>
simple_type<1> FC_PAD
–or–
pointer_type<1> pointer_attributes<1>
offset_to_complex_description<2>
The first format is used if the pointer is a pointer to a simple type or a nonsized string pointer. The second format is used for pointers to all other types. Pointer attributes indicate which description layout it is with the FC_SIMPLE_POINTER flag.
pointer_type<1> is one of the following.
Format character | Description |
---|---|
FC_RP | A reference pointer. |
FC_UP | A unique pointer. |
FC_FP | A full pointer. |
FC_OP | A unique pointer in an object interface. |
The reason to distinguish FC_OP is semantic: in object interfaces, an [in,out] pointer should be freed before unmarshaling a new object and assigning a new pointer value.
Pointer_attributes<1> can have any of the flags shown in the following table.
Attribute | Flag | Description |
---|---|---|
01 | FC_ALLOCATE_ALL_NODES | The pointer is a part of an allocate(all_nodes) allocation scheme. |
02 | FC_DONT_FREE | An allocate(dont_free) pointer. |
04 | FC_ALLOCED_ON_STACK | A pointer whose referent is allocated on the stub's stack. |
08 | FC_SIMPLE_POINTER | A pointer to a simple type or nonsized conformant string. This flag being set indicates layout of the pointer description as the simple pointer layout described above, otherwise the descriptor format with the offset is indicated. |
10 | FC_POINTER_DEREF | A pointer that must be dereferenced before handling the pointer's referent. |
Pointers that have size_is(), max_is(), length_is(), last_is(), and/or first_is() applied to them have format string descriptions identical to a pointer to an array of the appropriate type (for example, a conformant array if size_is() is applied, a conformant varying array if size_is() and length_is are applied).
An object interface pointer format string has one of two formats, depending on whether the corresponding IID is known to the compiler.
An interface pointer with a constant IID has the following description:
FC_IP FC_CONSTANT_IID
iid<16>
The iid<16> part is the actual IID for the interface pointer. The iid is written to the format string in a format identical to the GUID data structure: long, short, short, char [8].
The description of an interface pointer with iid_is() applied to it is:
FC_IP FC_PAD
iid_description<>
The iid_description<> is a correlation descriptor and has 4 or 6 bytes depending on whether /robust is used. The value calculated by the NdrComputeConformance function is the IID pointer.
Byte count pointers relate to a special optimization attribute called [byte_count]. The following formats are used:
FC_BYTE_COUNT_POINTER
simple_type<1>
byte_count_description<>
–and –
FC_BYTE_COUNT_POINTER
FC_PAD
byte_count_description<>
pointee_description<>
The byte_count_description<> is a correlation descriptor and has 4 or 6 bytes depending on whether /robust is used.
The pointee_description<> is a description of the pointee type.