2.2.29.1 _wireVARIANT

The _wireVARIANT is a container for a union that in turn contains scalar and OLE Automation data types.

 typedef struct _wireVARIANT {
   DWORD clSize;
   DWORD rpcReserved;
   USHORT vt;
   USHORT wReserved1;
   USHORT wReserved2;
   USHORT wReserved3;
   [switch_type(ULONG), switch_is(vt)] 
     union {
     [case(VT_I8)] 
       LONGLONG llVal;
     [case(VT_I4)] 
       LONG lVal;
     [case(VT_UI1)] 
       BYTE bVal;
     [case(VT_I2)] 
       SHORT iVal;
     [case(VT_R4)] 
       FLOAT fltVal;
     [case(VT_R8)] 
       DOUBLE dblVal;
     [case(VT_BOOL)] 
       VARIANT_BOOL boolVal;
     [case(VT_ERROR)] 
       HRESULT scode;
     [case(VT_CY)] 
       CURRENCY cyVal;
     [case(VT_DATE)] 
       DATE date;
     [case(VT_BSTR)] 
       BSTR bstrVal;
     [case(VT_UNKNOWN)] 
       IUnknown* punkVal;
     [case(VT_DISPATCH)] 
       IDispatch* pdispVal;
     [case(VT_ARRAY)] 
       PSAFEARRAY parray;
     [case(VT_RECORD, VT_RECORD|VT_BYREF)] 
       BRECORD brecVal;
     [case(VT_UI1|VT_BYREF)] 
       BYTE* pbVal;
     [case(VT_I2|VT_BYREF)] 
       SHORT* piVal;
     [case(VT_I4|VT_BYREF)] 
       LONG* plVal;
     [case(VT_I8|VT_BYREF)] 
       LONGLONG* pllVal;
     [case(VT_R4|VT_BYREF)] 
       FLOAT* pfltVal;
     [case(VT_R8|VT_BYREF)] 
       DOUBLE* pdblVal;
     [case(VT_BOOL|VT_BYREF)] 
       VARIANT_BOOL* pboolVal;
     [case(VT_ERROR|VT_BYREF)] 
       HRESULT* pscode;
     [case(VT_CY|VT_BYREF)] 
       CURRENCY* pcyVal;
     [case(VT_DATE|VT_BYREF)] 
       DATE* pdate;
     [case(VT_BSTR|VT_BYREF)] 
       BSTR* pbstrVal;
     [case(VT_UNKNOWN|VT_BYREF)] 
       IUnknown** ppunkVal;
     [case(VT_DISPATCH|VT_BYREF)] 
       IDispatch** ppdispVal;
     [case(VT_ARRAY|VT_BYREF)] 
       PSAFEARRAY* pparray;
     [case(VT_VARIANT|VT_BYREF)] 
       VARIANT* pvarVal;
     [case(VT_I1)] 
       CHAR cVal;
     [case(VT_UI2)] 
       USHORT uiVal;
     [case(VT_UI4)] 
       ULONG ulVal;
     [case(VT_UI8)] 
       ULONGLONG ullVal;
     [case(VT_INT)] 
       INT intVal;
     [case(VT_UINT)] 
       UINT uintVal;
     [case(VT_DECIMAL)] 
       DECIMAL decVal;
     [case(VT_I1|VT_BYREF)] 
       CHAR* pcVal;
     [case(VT_UI2|VT_BYREF)] 
       USHORT* puiVal;
     [case(VT_UI4|VT_BYREF)] 
       ULONG* pulVal;
     [case(VT_UI8|VT_BYREF)] 
       ULONGLONG* pullVal;
     [case(VT_INT|VT_BYREF)] 
       INT* pintVal;
     [case(VT_UINT|VT_BYREF)] 
       UINT* puintVal;
     [case(VT_DECIMAL|VT_BYREF)] 
       DECIMAL* pdecVal;
     [case(VT_EMPTY)] 
             ;
     [case(VT_NULL)] 
             ;
   } _varUnion;
 } wireVARIANTStr;

clSize: MUST be set to the size, in quad words (64 bits), of the structure.

rpcReserved: MUST be set to 0 and MUST be ignored by the recipient.

vt: MUST be set to one of the values specified with a "V" in the Context column of the table in section 2.2.7.

wReserved1: MAY be set to 0 and MUST be ignored by the recipient.<6>

wReserved2: MAY be set to 0 and MUST be ignored by the recipient.<7>

wReserved3: MAY be set to 0 and MUST be ignored by the recipient.<8>

_varUnion: MUST contain an instance of the type, according to the value in the vt field.

Data of this type MUST be marshaled as specified in [C706] section 14, with the following additional restrictions.

  • All fields except _varUnion MUST be marshaled using a little-endian data representation, regardless of the data representation format label. For more information, see [C706] section 14.2.5.

  • If the vt field has the flag VT_ARRAY set, then _varUnion MUST be marshaled according to 2.2.30.

  • If the vt field has the flags VT_UNKNOWN or VT_DISPATCH set, then _varUnion MUST be marshaled according to [MS-DCOM] section 1.3.2.

  • If the vt field has the flag VT_RECORD set, then _varUnion field MUST be marshaled according to 2.2.28.

  • If the vt field has the flag VT_BSTR set, then _varUnion MUST be marshaled according to 2.2.23.

  • If none of the preceding flags is specified in the vt field, the _varUnion field MUST be marshaled by using a little-endian data representation, regardless of the data representation format label.