/*
 * Copyright (C) 2006 Mike McCormack
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

typedef DWORD DBKIND;

enum DBKINDENUM {
    DBKIND_GUID_NAME,
    DBKIND_GUID_PROPID,
    DBKIND_NAME,
    DBKIND_PGUID_NAME,
    DBKIND_PGUID_PROPID,
    DBKIND_PROPID,
    DBKIND_GUID,
};

typedef struct tagDBID {
    [switch_type(DBKIND), switch_is(eKind)] union
    {
    [case(DBKIND_GUID_NAME, DBKIND_GUID_PROPID, DBKIND_GUID, DBKIND_NAME, DBKIND_PROPID)]
        GUID guid;
    [case(DBKIND_PGUID_NAME, DBKIND_PGUID_PROPID)]
        GUID *pguid;
    [default]
        ;
    } uGuid;
    DBKIND eKind;
    [switch_type(DBKIND), switch_is(eKind)] union
    {
    [case(DBKIND_GUID_NAME, DBKIND_NAME, DBKIND_PGUID_NAME)]
        LPOLESTR pwszName;
    [case(DBKIND_GUID_PROPID, DBKIND_GUID, DBKIND_PGUID_PROPID, DBKIND_PROPID)]
        ULONG ulPropid;
    [default]
        ;
    } uName;
} DBID;

typedef DWORD DBPROPID;

typedef struct tagDBPROPIDSET {
    [size_is(cPropertyIDs)] DBPROPID *rgPropertyIDs;
    ULONG cPropertyIDs;
    GUID guidPropertySet;
} DBPROPIDSET;

typedef DWORD DBPROPOPTIONS;

enum DBPROPOPTIONENUM {
    DBPROPOPTIONS_REQUIRED = 0,
    DBPROPOPTIONS_SETIFCHEAP = 1,
    DBPROPOPTIONS_OPTIONAL = 1,
};

typedef DWORD DBPROPSTATUS;

typedef struct tagDBPROP {
    DBPROPID dwPropertyID;
    DBPROPOPTIONS dwOptions;
    DBPROPSTATUS dwStatus;
    DBID colid;
    VARIANT vValue;
} DBPROP;

typedef struct tagDBPROPSET {
    [size_is(cProperties)] DBPROP *rgProperties;
    ULONG cProperties;
    GUID guidPropertySet;
} DBPROPSET;

typedef DWORD DBPROPFLAGS;

typedef struct tagDBPROPINFO {
    LPOLESTR pwszDescription;
    DBPROPID dwPropertyID;
    DBPROPFLAGS dwFlags;
    VARTYPE vtType;
    VARIANT vValues;
} DBPROPINFO;

typedef DBPROPINFO *PDBPROPINFO;

typedef struct tagDBPROPINFOSET {
    [size_is(cPropertyInfos)] PDBPROPINFO rgPropertyInfos;
    ULONG cPropertyInfos;
    GUID guidPropertySet;
} DBPROPINFOSET;

typedef DWORD DBBINDURLFLAG;
typedef DWORD DBBINDURLSTATUS;

typedef struct tagDBIMPLICITSESSION
{
    IUnknown *pUnkOuter;
    IID *piid;
    IUnknown *pSession;
} DBIMPLICITSESSION;

typedef WORD DBTYPE;

enum DBTYPEENUM
{
    DBTYPE_EMPTY         = 0,
    DBTYPE_NULL          = 1,
    DBTYPE_I2            = 2,
    DBTYPE_I4            = 3,
    DBTYPE_R4            = 4,
    DBTYPE_R8            = 5,
    DBTYPE_CY            = 6,
    DBTYPE_DATE          = 7,
    DBTYPE_BSTR          = 8,
    DBTYPE_IDISPATCH     = 9,
    DBTYPE_ERROR         = 10,
    DBTYPE_BOOL          = 11,
    DBTYPE_VARIANT       = 12,
    DBTYPE_IUNKNOWN      = 13,
    DBTYPE_DECIMAL       = 14,
    DBTYPE_I1            = 16,
    DBTYPE_UI1           = 17,
    DBTYPE_UI2           = 18,
    DBTYPE_UI4           = 19,
    DBTYPE_I8            = 20,
    DBTYPE_UI8           = 21,
    DBTYPE_GUID          = 72,
    DBTYPE_BYTES         = 128,
    DBTYPE_STR           = 129,
    DBTYPE_WSTR          = 130,
    DBTYPE_NUMERIC       = 131,
    DBTYPE_UDT           = 132,
    DBTYPE_DBDATE        = 133,
    DBTYPE_DBTIME        = 134,
    DBTYPE_DBTIMESTAMP   = 135,

    DBTYPE_VECTOR        = 0x1000,
    DBTYPE_ARRAY         = 0x2000,
    DBTYPE_BYREF         = 0x4000,
    DBTYPE_RESERVED      = 0x8000
};

enum DBTYPEENUM15
{
    DBTYPE_HCHAPTER      = 136
};

enum DBTYPEENUM20
{
    DBTYPE_FILETIME      = 64,
    DBTYPE_PROPVARIANT   = 138,
    DBTYPE_VARNUMERIC    = 139
};

typedef DWORD DBSTATUS;

enum DBSTATUSENUM
{
    DBSTATUS_S_OK = 0,
    DBSTATUS_E_BADACCESSOR = 1,
    DBSTATUS_E_CANTCONVERTVALUE = 2,
    DBSTATUS_S_ISNULL = 3,
    DBSTATUS_S_TRUNCATED = 4,
    DBSTATUS_E_SIGNMISMATCH = 5,
    DBSTATUS_E_DATAOVERFLOW = 6,
    DBSTATUS_E_CANTCREATE = 7,
    DBSTATUS_E_UNAVAILABLE = 8,
    DBSTATUS_E_PERMISSIONDENIED = 9,
    DBSTATUS_E_INTEGRITYVIOLATION = 10,
    DBSTATUS_E_SCHEMAVIOLATION = 11,
    DBSTATUS_E_BADSTATUS = 12,
    DBSTATUS_S_DEFAULT = 13
};

enum DBPROPENUM
{
    DBPROP_ABORTPRESERVE                   = 0x00000002,
    DBPROP_ACTIVESESSIONS                  = 0x00000003,
    DBPROP_ASYNCTXNCOMMIT                  = 0x00000004,
    DBPROP_AUTH_CACHE_AUTHINFO             = 0x00000005,
    DBPROP_AUTH_ENCRYPT_PASSWORD           = 0x00000006,
    DBPROP_AUTH_INTEGRATED                 = 0x00000007,
    DBPROP_AUTH_MASK_PASSWORD              = 0x00000008,
    DBPROP_AUTH_PASSWORD                   = 0x00000009,
    DBPROP_AUTH_PERSIST_ENCRYPTED          = 0x0000000a,
    DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO = 0x0000000b,
    DBPROP_AUTH_USERID                     = 0x0000000c,
    DBPROP_BLOCKINGSTORAGEOBJECTS          = 0x0000000d,
    DBPROP_BOOKMARKS                       = 0x0000000e,
    DBPROP_BOOKMARKSKIPPED                 = 0x0000000f,
    DBPROP_BOOKMARKTYPE                    = 0x00000010,
    DBPROP_CACHEDEFERRED                   = 0x00000011,
    DBPROP_CANFETCHBACKWARDS               = 0x00000012,
    DBPROP_CANHOLDROWS                     = 0x00000013,
    DBPROP_CANSCROLLBACKWARDS              = 0x00000015,
    DBPROP_CATALOGLOCATION                 = 0x00000016,
    DBPROP_CATALOGTERM                     = 0x00000017,
    DBPROP_CATALOGUSAGE                    = 0x00000018,
    DBPROP_COL_AUTOINCREMENT               = 0x0000001a,
    DBPROP_COL_DEFAULT                     = 0x0000001b,
    DBPROP_COL_DESCRIPTION                 = 0x0000001c,
    DBPROP_COL_NULLABLE                    = 0x0000001d,
    DBPROP_COL_PRIMARYKEY                  = 0x0000001e,
    DBPROP_COL_UNIQUE                      = 0x0000001f,
    DBPROP_COLUMNDEFINITION                = 0x00000020,
    DBPROP_COLUMNRESTRICT                  = 0x00000021,
    DBPROP_COMMANDTIMEOUT                  = 0x00000022,
    DBPROP_COMMITPRESERVE                  = 0x00000023,
    DBPROP_CONCATNULLBEHAVIOR              = 0x00000024,
    DBPROP_CURRENTCATALOG                  = 0x00000025,
    DBPROP_DATASOURCENAME                  = 0x00000026,
    DBPROP_DATASOURCEREADONLY              = 0x00000027,
    DBPROP_DBMSNAME                        = 0x00000028,
    DBPROP_DBMSVER                         = 0x00000029,
    DBPROP_DEFERRED                        = 0x0000002a,
    DBPROP_DELAYSTORAGEOBJECTS             = 0x0000002b,
    DBPROP_GROUPBY                         = 0x0000002c,
    DBPROP_HETEROGENEOUSTABLES             = 0x0000002d,
    DBPROP_IDENTIFIERCASE                  = 0x0000002e,
    DBPROP_IMMOBILEROWS                    = 0x0000002f,
    DBPROP_INDEX_AUTOUPDATE                = 0x00000030,
    DBPROP_INDEX_CLUSTERED                 = 0x00000031,
    DBPROP_INDEX_FILLFACTOR                = 0x00000032,
    DBPROP_INDEX_INITIALSIZE               = 0x00000033,
    DBPROP_INDEX_NULLCOLLATION             = 0x00000034,
    DBPROP_INDEX_NULLS                     = 0x00000035,
    DBPROP_INDEX_PRIMARYKEY                = 0x00000036,
    DBPROP_INDEX_SORTBOOKMARKS             = 0x00000037,
    DBPROP_INDEX_TYPE                      = 0x00000038,
    DBPROP_INDEX_UNIQUE                    = 0x00000039,
    DBPROP_INIT_DATASOURCE                 = 0x0000003b,
    DBPROP_INIT_HWND                       = 0x0000003c,
    DBPROP_INIT_IMPERSONATION_LEVEL        = 0x0000003d,
    DBPROP_INIT_LOCATION                   = 0x0000003e,
    DBPROP_INIT_MODE                       = 0x0000003f,
    DBPROP_INIT_PROMPT                     = 0x00000040,
    DBPROP_INIT_PROTECTION_LEVEL           = 0x00000041,
    DBPROP_INIT_TIMEOUT                    = 0x00000042,
    DBPROP_LITERALBOOKMARKS                = 0x00000043,
    DBPROP_LITERALIDENTITY                 = 0x00000044,
    DBPROP_MAXINDEXSIZE                    = 0x00000046,
    DBPROP_MAXOPENROWS                     = 0x00000047,
    DBPROP_MAXPENDINGROWS                  = 0x00000048,
    DBPROP_MAXROWS                         = 0x00000049,
    DBPROP_MAXROWSIZE                      = 0x0000004a,
    DBPROP_MAXROWSIZEINCLUDESBLOB          = 0x0000004b,
    DBPROP_MAXTABLESINSELECT               = 0x0000004c,
    DBPROP_MAYWRITECOLUMN                  = 0x0000004d,
    DBPROP_MEMORYUSAGE                     = 0x0000004e,
    DBPROP_MULTIPLESTORAGEOBJECTS          = 0x00000050,
    DBPROP_MULTITABLEUPDATE                = 0x00000051,
    DBPROP_NOTIFICATIONPHASES              = 0x00000052,
    DBPROP_NULLCOLLATION                   = 0x00000053,
    DBPROP_OLEOBJECTS                      = 0x00000054,
    DBPROP_ORDERBYCOLUMNSINSELECT          = 0x00000055,
    DBPROP_ORDEREDBOOKMARKS                = 0x00000056,
    DBPROP_OTHERINSERT                     = 0x00000057,
    DBPROP_OTHERUPDATEDELETE               = 0x00000058,
    DBPROP_OWNINSERT                       = 0x00000059,
    DBPROP_OWNUPDATEDELETE                 = 0x0000005a,
    DBPROP_PREPAREABORTBEHAVIOR            = 0x0000005b,
    DBPROP_PREPARECOMMITBEHAVIOR           = 0x0000005c,
    DBPROP_PROCEDURETERM                   = 0x0000005d,
    DBPROP_PROVIDERNAME                    = 0x00000060,
    DBPROP_PROVIDEROLEDBVER                = 0x00000061,
    DBPROP_PROVIDERVER                     = 0x00000062,
    DBPROP_QUICKRESTART                    = 0x00000063,
    DBPROP_QUOTEDIDENTIFIERCASE            = 0x00000064,
    DBPROP_REENTRANTEVENTS                 = 0x00000065,
    DBPROP_REMOVEDELETED                   = 0x00000066,
    DBPROP_REPORTMULTIPLECHANGES           = 0x00000067,
    DBPROP_ROWRESTRICT                     = 0x00000068,
    DBPROP_ROWTHREADMODEL                  = 0x00000069,
    DBPROP_SCHEMATERM                      = 0x0000006a,
    DBPROP_SCHEMAUSAGE                     = 0x0000006b,
    DBPROP_SERVERCURSOR                    = 0x0000006c,
    DBPROP_SQLSUPPORT                      = 0x0000006d,
    DBPROP_STRUCTUREDSTORAGE               = 0x0000006f,
    DBPROP_SUBQUERIES                      = 0x00000070,
    DBPROP_SUPPORTEDTXNISOLEVELS           = 0x00000071,
    DBPROP_SUPPORTEDTXNISORETAIN           = 0x00000072,
    DBPROP_TABLETERM                       = 0x00000073,
    DBPROP_TRANSACTEDOBJECT                = 0x00000074,
    DBPROP_UPDATABILITY                    = 0x00000075,
    DBPROP_USERNAME                        = 0x00000076,
    DBPROP_STRONGIDENTITY                  = 0x00000077,
    DBPROP_BYREFACCESSORS                  = 0x00000078,
    DBPROP_IAccessor                       = 0x00000079,
    DBPROP_IColumnsInfo                    = 0x0000007a,
    DBPROP_IColumnsRowset                  = 0x0000007b,
    DBPROP_IConnectionPointContainer       = 0x0000007c,
    DBPROP_IRowset                         = 0x0000007e,
    DBPROP_IRowsetChange                   = 0x0000007f,
    DBPROP_IRowsetIdentity                 = 0x00000080,
    DBPROP_IRowsetInfo                     = 0x00000081,
    DBPROP_IRowsetLocate                   = 0x00000082,
    DBPROP_IRowsetResynch                  = 0x00000084,
    DBPROP_IRowsetScroll                   = 0x00000085,
    DBPROP_IRowsetUpdate                   = 0x00000086,
    DBPROP_ISupportErrorInfo               = 0x00000087,
    DBPROP_ILockBytes                      = 0x00000088,
    DBPROP_ISequentialStream               = 0x00000089,
    DBPROP_IStorage                        = 0x0000008a,
    DBPROP_IStream                         = 0x0000008b,
    DBPROP_TBL_TEMPTABLE                   = 0x0000008c,
    DBPROP_IRowsetIndex                    = 0x0000009f,
    DBPROP_INIT_PROVIDERSTRING             = 0x000000a0,
    DBPROP_SUPPORTEDTXNDDL                 = 0x000000a1,
    DBPROP_INDEX_TEMPINDEX                 = 0x000000a3,
    DBPROP_COL_FIXEDLENGTH                 = 0x000000a7,
    DBPROP_ASYNCTXNABORT                   = 0x000000a8,
    DBPROP_DSOTHREADMODEL                  = 0x000000a9,
    DBPROP_NOTIFYCOLUMNSET                 = 0x000000ab,
    DBPROP_NOTIFYROWDELETE                 = 0x000000ad,
    DBPROP_NOTIFYROWFIRSTCHANGE            = 0x000000ae,
    DBPROP_NOTIFYROWINSERT                 = 0x000000af,
    DBPROP_NOTIFYROWRESYNCH                = 0x000000b1,
    DBPROP_NOTIFYROWSETRELEASE             = 0x000000b2,
    DBPROP_NOTIFYROWSETFETCHPOSITIONCHANGE = 0x000000b3,
    DBPROP_NOTIFYROWUNDOCHANGE             = 0x000000b4,
    DBPROP_NOTIFYROWUNDODELETE             = 0x000000b5,
    DBPROP_NOTIFYROWUNDOINSERT             = 0x000000b6,
    DBPROP_NOTIFYROWUPDATE                 = 0x000000b7,
    DBPROP_OUTPUTPARAMETERAVAILABILITY     = 0x000000b8,
    DBPROP_PERSISTENTIDTYPE                = 0x000000b9,
    DBPROP_INIT_LCID                       = 0x000000ba,
    DBPROP_APPENDONLY                      = 0x000000bb,
    DBPROP_CHANGEINSERTEDROWS              = 0x000000bc,
    DBPROP_RETURNPENDINGINSERTS            = 0x000000bd,
    DBPROP_SESS_AUTOCOMMITISOLEVELS        = 0x000000be,
    DBPROP_MULTIPLEPARAMSETS               = 0x000000bf,
    DBPROP_ROWSETCONVERSIONSONCOMMAND      = 0x000000c0,
    DBPROP_IConvertType                    = 0x000000c2,
    DBPROP_MULTIPLERESULTS                 = 0x000000c4,
    DBPROP_NOTIFICATIONGRANULARITY         = 0x000000c6,
    DBPROP_NOTIFYROWSETCHANGED             = 0x000000d3,
};

cpp_quote("#ifdef DBINITCONSTANTS")
cpp_quote("#ifdef __cplusplus")
cpp_quote("#define DEFINE_DBGUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \\")
cpp_quote("        EXTERN_C const GUID name DECLSPEC_HIDDEN;     \\")
cpp_quote("        EXTERN_C const GUID name =                    \\")
cpp_quote("	{ l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }")
cpp_quote("#else")
cpp_quote("#define DEFINE_DBGUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \\")
cpp_quote("        const GUID name DECLSPEC_HIDDEN;      \\")
cpp_quote("        const GUID name =                             \\")
cpp_quote("	{ l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }")
cpp_quote("#endif")
cpp_quote("#else")
cpp_quote("#define DEFINE_DBGUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \\")
cpp_quote("    EXTERN_C const GUID name DECLSPEC_HIDDEN")
cpp_quote("#endif")

cpp_quote("DEFINE_DBGUID(DB_NULLGUID,       0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);")
cpp_quote("DEFINE_DBGUID(DBPROPSET_DBINIT,  0xc8b522bc, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d);")
cpp_quote("DEFINE_DBGUID(DBGUID_SESSION,    0xc8b522f5, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d);")
cpp_quote("DEFINE_DBGUID(DBGUID_ROWSET,     0xc8b522f6, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d);")
cpp_quote("DEFINE_DBGUID(DBGUID_ROW,        0xc8b522f7, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d);")
cpp_quote("DEFINE_DBGUID(DBGUID_STREAM,     0xc8b522f9, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d);")

cpp_quote("#define DBPROMPT_PROMPT              0x01")
cpp_quote("#define DBPROMPT_COMPLETE            0x02")
cpp_quote("#define DBPROMPT_COMPLETEREQUIRED    0x03")
cpp_quote("#define DBPROMPT_NOPROMPT            0x04")


typedef struct tagDBCOLUMNACCESS
{
    void *pData;
    DBID columnid;
    DBLENGTH cbDataLen;
    DBSTATUS dwStatus;
    DBLENGTH cbMaxLen;
    DB_DWRESERVE dwReserved;
    DBTYPE wType;
    BYTE bPrecision;
    BYTE bScale;
} DBCOLUMNACCESS;

typedef DWORD DBROWSTATUS;

enum DBROWSTATUSENUM
{
    DBROWSTATUS_S_OK         = 0,
    /* FIXME */
    DBROWSTATUS_E_FAIL       = 19,

};

typedef DWORD DBPART;

enum DBPARTENUM
{
    DBPART_INVALID  = 0,
    DBPART_VALUE    = 1,
    DBPART_LENGTH   = 2,
    DBPART_STATUS   = 4,
};

typedef DWORD DBPARAMIO;

enum DBPARAMIOENUM
{
    DBPARAMIO_NOTPARAM = 0,
    DBPARAMIO_INPUT    = 1,
    DBPARAMIO_OUTPUT   = 2,
};

typedef DWORD DBMEMOWNER;

enum DBMEMOWNERENUM
{
    DBMEMOWNER_CLIENTOWNED    = 0,
    DBMEMOWNER_PROVIDEROWNED  = 1,
};

typedef struct tagDBOBJECT
{
    DWORD dwFlags;
    IID iid;
} DBOBJECT;

typedef struct tagDBBINDEXT
{
    [size_is((ULONG)ulExtension)] BYTE *pExtension;
    DBCOUNTITEM ulExtension;
} DBBINDEXT;

typedef struct tagDBBINDING
{
    DBORDINAL iOrdinal;
    DBBYTEOFFSET obValue;
    DBBYTEOFFSET obLength;
    DBBYTEOFFSET obStatus;
    ITypeInfo *pTypeInfo;
    DBOBJECT *pObject;
    DBBINDEXT *pBindExt;
    DBPART dwPart;
    DBMEMOWNER dwMemOwner;
    DBPARAMIO eParamIO;
    DBLENGTH cbMaxLen;
    DWORD dwFlags;
    DBTYPE wType;
    BYTE bPrecision;
    BYTE bScale;
} DBBINDING;

typedef ULONG_PTR HACCESSOR;

cpp_quote("#define DB_INVALID_HACCESSOR 0x00")

typedef ULONG_PTR HROW;

cpp_quote("#define DB_NULL_HROW 0x00")

typedef ULONG_PTR HWATCHREGION;

cpp_quote("#define DBWATCHREGION_NULL NULL")

typedef ULONG_PTR HCHAPTER;

cpp_quote("#define DB_NULL_HCHAPTER 0x00")

typedef struct tagDBPARAMS
{
    void *pData;
    DB_UPARAMS cParamSets;
    HACCESSOR hAccessor;
} DBPARAMS;

typedef DWORD DBASYNCHOP;

enum DBASYNCHOPENUM
{
    DBSYNCHOP_OPEN,
};

typedef DWORD DBASYNCHPHASE;

enum DBASYNCHPHASEENUM
{
    DBASYNCHPHASE_INITIALIZATION,
    DBASYNCHPHASE_POPULATION,
    DBASYNCHPHASE_COMPLETE,
    DBASYNCHPHASE_CANCELED,
};

typedef struct tagRMTPACK
{
    ISequentialStream *pISeqStream;
    ULONG cbData;
    ULONG cBSTR;
    [size_is(cBSTR)] BSTR *rgBSTR;
    ULONG cVARIANT;
    [size_is(cVARIANT)] VARIANT *rgVARIANT;
    ULONG cIDISPATCH;
    [size_is(cIDISPATCH)] IDispatch **rgIDISPATCH;
    ULONG cIUNKNOWN;
    [size_is(cIUNKNOWN)] IUnknown **rgIUNKNOWN;
    ULONG cPROPVARIANT;
    [size_is(cPROPVARIANT)] PROPVARIANT *rgPROPVARIANT;
    ULONG cArray;
    [size_is(cArray)] VARIANT *rgArray;
} RMTPACK;
