| Previous | Next |
| RPC_X_SS_CANNOT_GET_CALL_HANDLE | RPC_X_ENUM_VALUE_OUT_OF_RANGE |
RPC_X_NULL_REF_POINTER
Reference pointers are not nullable
RPC_X_NULL_REF_POINTER is about the MIDL pointer contract, not merely a C or C++ null-pointer check. A [ref] pointer must always identify valid storage and cannot be null. Top-level pointer parameters default to [ref] when no pointer attribute is specified, so an IDL declaration can require a non-null argument even when a native function signature looks like an ordinary pointer.
Use [unique] or [ptr] only when the interface deliberately permits absence and the corresponding ownership and aliasing rules are appropriate. Changing an existing public interface from [ref] to a nullable pointer changes its wire contract and should not be used as an ad-hoc recovery for this error.
Likely causes
- A caller passed a null buffer or output location to an
[in],[out], or[in, out]reference parameter. - A language binding, FFI layer, or generated wrapper mapped optional application data onto a required
[ref]parameter. - Memory was released or a pointer was cleared before a synchronous RPC call completed.
- IDL and generated proxy/stub artifacts are out of sync with the code that invokes them.
Useful checks
- Inspect the authoritative IDL, not only the C header, for
[ref],[unique],[ptr], and direction attributes. - Validate pointer ownership and buffer lifetime at the caller boundary before the RPC is made.
- For an optional payload, use the interface's documented nullable representation rather than passing null to a required reference pointer.
References
Microsoft: ref attribute · The Open Group: DCE NDR pointer representation · Microsoft: RPC return values
Looking for a different code? Search another status or error code.
