Mike McCormack | 6621503 | 2006-07-20 15:26:18 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2006 Mike McCormack |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Lesser General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2.1 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Lesser General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Lesser General Public |
| 15 | * License along with this library; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA |
| 17 | */ |
| 18 | |
| 19 | typedef DWORD DBKIND; |
| 20 | |
| 21 | enum DBKINDENUM { |
| 22 | DBKIND_GUID_NAME, |
| 23 | DBKIND_GUID_PROPID, |
| 24 | DBKIND_NAME, |
| 25 | DBKIND_PGUID_NAME, |
| 26 | DBKIND_PGUID_PROPID, |
| 27 | DBKIND_PROPID, |
| 28 | DBKIND_GUID, |
| 29 | }; |
| 30 | |
| 31 | typedef struct tagDBID { |
| 32 | [switch_type(DBKIND), switch_is(eKind)] union |
| 33 | { |
| 34 | [case(DBKIND_GUID_NAME, DBKIND_GUID_PROPID, DBKIND_GUID, DBKIND_NAME, DBKIND_PROPID)] |
| 35 | GUID guid; |
| 36 | [case(DBKIND_PGUID_NAME, DBKIND_PGUID_PROPID)] |
| 37 | GUID *pguid; |
| 38 | [default] |
| 39 | ; |
| 40 | } uGuid; |
| 41 | DBKIND eKind; |
| 42 | [switch_type(DBKIND), switch_is(eKind)] union |
| 43 | { |
| 44 | [case(DBKIND_GUID_NAME, DBKIND_NAME, DBKIND_PGUID_NAME)] |
| 45 | LPOLESTR pwszName; |
| 46 | [case(DBKIND_GUID_PROPID, DBKIND_GUID, DBKIND_PGUID_PROPID, DBKIND_PROPID)] |
| 47 | ULONG ulPropid; |
| 48 | [default] |
| 49 | ; |
| 50 | } uName; |
| 51 | } DBID; |
| 52 | |
| 53 | typedef DWORD DBPROPID; |
| 54 | |
| 55 | typedef struct tagDBPROPIDSET { |
| 56 | [size_is(cPropertyIDs)] DBPROPID *rgPropertyIDs; |
| 57 | ULONG cPropertyIDs; |
| 58 | GUID guidPropertySet; |
| 59 | } DBPROPIDSET; |
| 60 | |
| 61 | typedef DWORD DBPROPOPTIONS; |
| 62 | |
| 63 | enum DBPROPOPTIONENUM { |
| 64 | DBPROPOPTIONS_REQUIRED = 0, |
| 65 | DBPROPOPTIONS_SETIFCHEAP = 1, |
| 66 | DBPROPOPTIONS_OPTIONAL = 1, |
| 67 | }; |
| 68 | |
| 69 | typedef DWORD DBPROPSTATUS; |
| 70 | |
| 71 | typedef struct tagDBPROP { |
| 72 | DBPROPID dwPropertyID; |
| 73 | DBPROPOPTIONS dwOptions; |
| 74 | DBPROPSTATUS dwStatus; |
| 75 | DBID colid; |
| 76 | VARIANT vValue; |
| 77 | } DBPROP; |
| 78 | |
| 79 | typedef struct tagDBPROPSET { |
| 80 | [size_is(cProperties)] DBPROP *rgProperties; |
| 81 | ULONG cProperties; |
| 82 | GUID guidPropertySet; |
| 83 | } DBPROPSET; |
| 84 | |
| 85 | typedef DWORD DBPROPFLAGS; |
| 86 | |
| 87 | typedef struct tagDBPROPINFO { |
| 88 | LPOLESTR pwszDescription; |
| 89 | DBPROPID dwPropertyID; |
| 90 | DBPROPFLAGS dwFlags; |
| 91 | VARTYPE vtType; |
| 92 | VARIANT vValues; |
| 93 | } DBPROPINFO; |
| 94 | |
| 95 | typedef DBPROPINFO *PDBPROPINFO; |
| 96 | |
| 97 | typedef struct tagDBPROPINFOSET { |
| 98 | [size_is(cPropertyInfos)] PDBPROPINFO rgPropertyInfos; |
| 99 | ULONG cPropertyInfos; |
| 100 | GUID guidPropertySet; |
| 101 | } DBPROPINFOSET; |
Huw Davies | d328e9a | 2009-07-22 17:18:50 +0100 | [diff] [blame] | 102 | |
| 103 | typedef DWORD DBBINDURLFLAG; |
| 104 | typedef DWORD DBBINDURLSTATUS; |
| 105 | |
| 106 | typedef struct tagDBIMPLICITSESSION |
| 107 | { |
| 108 | IUnknown *pUnkOuter; |
| 109 | IID *piid; |
| 110 | IUnknown *pSession; |
| 111 | } DBIMPLICITSESSION; |
Huw Davies | 0223f71 | 2009-08-27 12:34:59 +0100 | [diff] [blame] | 112 | |
| 113 | typedef WORD DBTYPE; |
| 114 | |
Huw Davies | 15a5e46 | 2009-09-09 19:14:38 +0100 | [diff] [blame] | 115 | enum DBTYPEENUM |
| 116 | { |
| 117 | DBTYPE_EMPTY = 0, |
| 118 | DBTYPE_NULL = 1, |
| 119 | DBTYPE_I2 = 2, |
| 120 | DBTYPE_I4 = 3, |
| 121 | DBTYPE_R4 = 4, |
| 122 | DBTYPE_R8 = 5, |
| 123 | DBTYPE_CY = 6, |
| 124 | DBTYPE_DATE = 7, |
| 125 | DBTYPE_BSTR = 8, |
| 126 | DBTYPE_IDISPATCH = 9, |
| 127 | DBTYPE_ERROR = 10, |
| 128 | DBTYPE_BOOL = 11, |
| 129 | DBTYPE_VARIANT = 12, |
| 130 | DBTYPE_IUNKNOWN = 13, |
| 131 | DBTYPE_DECIMAL = 14, |
| 132 | DBTYPE_I1 = 16, |
| 133 | DBTYPE_UI1 = 17, |
| 134 | DBTYPE_UI2 = 18, |
| 135 | DBTYPE_UI4 = 19, |
| 136 | DBTYPE_I8 = 20, |
| 137 | DBTYPE_UI8 = 21, |
| 138 | DBTYPE_GUID = 72, |
| 139 | DBTYPE_BYTES = 128, |
| 140 | DBTYPE_STR = 129, |
| 141 | DBTYPE_WSTR = 130, |
| 142 | DBTYPE_NUMERIC = 131, |
| 143 | DBTYPE_UDT = 132, |
| 144 | DBTYPE_DBDATE = 133, |
| 145 | DBTYPE_DBTIME = 134, |
| 146 | DBTYPE_DBTIMESTAMP = 135, |
| 147 | |
| 148 | DBTYPE_VECTOR = 0x1000, |
| 149 | DBTYPE_ARRAY = 0x2000, |
| 150 | DBTYPE_BYREF = 0x4000, |
| 151 | DBTYPE_RESERVED = 0x8000 |
| 152 | }; |
| 153 | |
Huw Davies | 44967f0 | 2009-10-26 13:29:41 +0000 | [diff] [blame] | 154 | enum DBTYPEENUM15 |
| 155 | { |
| 156 | DBTYPE_HCHAPTER = 136 |
| 157 | }; |
| 158 | |
| 159 | enum DBTYPEENUM20 |
| 160 | { |
| 161 | DBTYPE_FILETIME = 64, |
| 162 | DBTYPE_PROPVARIANT = 138, |
| 163 | DBTYPE_VARNUMERIC = 139 |
| 164 | }; |
| 165 | |
Huw Davies | 0223f71 | 2009-08-27 12:34:59 +0100 | [diff] [blame] | 166 | typedef DWORD DBSTATUS; |
Huw Davies | 6b6d8cc | 2009-09-16 11:44:00 +0100 | [diff] [blame] | 167 | |
| 168 | enum DBSTATUSENUM |
| 169 | { |
| 170 | DBSTATUS_S_OK = 0, |
| 171 | DBSTATUS_E_BADACCESSOR = 1, |
| 172 | DBSTATUS_E_CANTCONVERTVALUE = 2, |
| 173 | DBSTATUS_S_ISNULL = 3, |
| 174 | DBSTATUS_S_TRUNCATED = 4, |
| 175 | DBSTATUS_E_SIGNMISMATCH = 5, |
| 176 | DBSTATUS_E_DATAOVERFLOW = 6, |
| 177 | DBSTATUS_E_CANTCREATE = 7, |
| 178 | DBSTATUS_E_UNAVAILABLE = 8, |
| 179 | DBSTATUS_E_PERMISSIONDENIED = 9, |
| 180 | DBSTATUS_E_INTEGRITYVIOLATION = 10, |
| 181 | DBSTATUS_E_SCHEMAVIOLATION = 11, |
| 182 | DBSTATUS_E_BADSTATUS = 12, |
| 183 | DBSTATUS_S_DEFAULT = 13 |
| 184 | }; |
Huw Davies | 44967f0 | 2009-10-26 13:29:41 +0000 | [diff] [blame] | 185 | |
Huw Davies | 10f6d5c | 2010-01-15 16:28:37 +0000 | [diff] [blame] | 186 | cpp_quote("#ifdef DBINITCONSTANTS") |
| 187 | cpp_quote("#ifdef __cplusplus") |
| 188 | cpp_quote("#define DEFINE_DBGUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \\") |
| 189 | cpp_quote(" EXTERN_C const GUID name DECLSPEC_HIDDEN; \\") |
| 190 | cpp_quote(" EXTERN_C const GUID name = \\") |
| 191 | cpp_quote(" { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }") |
| 192 | cpp_quote("#else") |
| 193 | cpp_quote("#define DEFINE_DBGUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \\") |
| 194 | cpp_quote(" const GUID name DECLSPEC_HIDDEN; \\") |
| 195 | cpp_quote(" const GUID name = \\") |
| 196 | cpp_quote(" { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }") |
| 197 | cpp_quote("#endif") |
| 198 | cpp_quote("#else") |
| 199 | cpp_quote("#define DEFINE_DBGUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \\") |
| 200 | cpp_quote(" EXTERN_C const GUID name DECLSPEC_HIDDEN") |
| 201 | cpp_quote("#endif") |
| 202 | |
| 203 | cpp_quote("DEFINE_DBGUID(DBGUID_SESSION, 0xc8b522f5, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d);") |
| 204 | cpp_quote("DEFINE_DBGUID(DBGUID_ROWSET, 0xc8b522f6, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d);") |
| 205 | cpp_quote("DEFINE_DBGUID(DBGUID_ROW, 0xc8b522f7, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d);") |
| 206 | cpp_quote("DEFINE_DBGUID(DBGUID_STREAM, 0xc8b522f9, 0x5cf3, 0x11ce, 0xad, 0xe5, 0x00, 0xaa, 0x00, 0x44, 0x77, 0x3d);") |
Huw Davies | 41af26b | 2009-12-09 13:52:11 +0000 | [diff] [blame] | 207 | |
Huw Davies | 44967f0 | 2009-10-26 13:29:41 +0000 | [diff] [blame] | 208 | typedef struct tagDBCOLUMNACCESS |
| 209 | { |
| 210 | void *pData; |
| 211 | DBID columnid; |
| 212 | DBLENGTH cbDataLen; |
| 213 | DBSTATUS dwStatus; |
| 214 | DBLENGTH cbMaxLen; |
| 215 | DB_DWRESERVE dwReserved; |
| 216 | DBTYPE wType; |
| 217 | BYTE bPrecision; |
| 218 | BYTE bScale; |
| 219 | } DBCOLUMNACCESS; |
| 220 | |
| 221 | typedef DWORD DBROWSTATUS; |
| 222 | |
| 223 | enum DBROWSTATUSENUM |
| 224 | { |
| 225 | DBROWSTATUS_S_OK = 0, |
| 226 | /* FIXME */ |
| 227 | DBROWSTATUS_E_FAIL = 19, |
| 228 | |
| 229 | }; |
| 230 | |
| 231 | typedef DWORD DBPART; |
| 232 | |
| 233 | enum DBPARTENUM |
| 234 | { |
| 235 | DBPART_INVALID = 0, |
| 236 | DBPART_VALUE = 1, |
| 237 | DBPART_LENGTH = 2, |
| 238 | DBPART_STATUS = 4, |
| 239 | }; |
| 240 | |
| 241 | typedef DWORD DBPARAMIO; |
| 242 | |
| 243 | enum DBPARAMIOENUM |
| 244 | { |
| 245 | DBPARAMIO_NOTPARAM = 0, |
| 246 | DBPARAMIO_INPUT = 1, |
| 247 | DBPARAMIO_OUTPUT = 2, |
| 248 | }; |
| 249 | |
| 250 | typedef DWORD DBMEMOWNER; |
| 251 | |
| 252 | enum DBMEMOWNERENUM |
| 253 | { |
| 254 | DBMEMOWNER_CLIENTOWNED = 0, |
| 255 | DBMEMOWNER_PROVIDEROWNED = 1, |
| 256 | }; |
| 257 | |
| 258 | typedef struct tagDBOBJECT |
| 259 | { |
| 260 | DWORD dwFlags; |
| 261 | IID iid; |
| 262 | } DBOBJECT; |
| 263 | |
| 264 | typedef struct tagDBBINDEXT |
| 265 | { |
| 266 | [size_is((ULONG)ulExtension)] BYTE *pExtension; |
| 267 | DBCOUNTITEM ulExtension; |
| 268 | } DBBINDEXT; |
| 269 | |
| 270 | typedef struct tagDBBINDING |
| 271 | { |
| 272 | DBORDINAL iOrdinal; |
| 273 | DBBYTEOFFSET obValue; |
| 274 | DBBYTEOFFSET obLength; |
| 275 | DBBYTEOFFSET obStatus; |
| 276 | ITypeInfo *pTypeInfo; |
| 277 | DBOBJECT *pObject; |
| 278 | DBBINDEXT *pBindExt; |
| 279 | DBPART dwPart; |
| 280 | DBMEMOWNER dwMemOwner; |
| 281 | DBPARAMIO eParamIO; |
| 282 | DBLENGTH cbMaxLen; |
| 283 | DWORD dwFlags; |
| 284 | DBTYPE wType; |
| 285 | BYTE bPrecision; |
| 286 | BYTE bScale; |
| 287 | } DBBINDING; |
| 288 | |
| 289 | typedef ULONG_PTR HACCESSOR; |
| 290 | |
| 291 | cpp_quote("#define DB_INVALID_HACCESSOR 0x00") |
| 292 | |
| 293 | typedef ULONG_PTR HROW; |
| 294 | |
| 295 | cpp_quote("#define DB_NULL_HROW 0x00") |
| 296 | |
| 297 | typedef ULONG_PTR HWATCHREGION; |
| 298 | |
| 299 | cpp_quote("#define DBWATCHREGION_NULL NULL") |
| 300 | |
| 301 | typedef ULONG_PTR HCHAPTER; |
| 302 | |
| 303 | cpp_quote("#define DB_NULL_HCHAPTER 0x00") |
| 304 | |
| 305 | typedef struct tagDBPARAMS |
| 306 | { |
| 307 | void *pData; |
| 308 | DB_UPARAMS cParamSets; |
| 309 | HACCESSOR hAccessor; |
| 310 | } DBPARAMS; |
| 311 | |
Huw Davies | cf8c3ec | 2009-11-11 10:48:44 +0000 | [diff] [blame] | 312 | typedef DWORD DBASYNCHOP; |
| 313 | |
| 314 | enum DBASYNCHOPENUM |
| 315 | { |
| 316 | DBSYNCHOP_OPEN, |
| 317 | }; |
| 318 | |
| 319 | typedef DWORD DBASYNCHPHASE; |
| 320 | |
| 321 | enum DBASYNCHPHASEENUM |
| 322 | { |
| 323 | DBASYNCHPHASE_INITIALIZATION, |
| 324 | DBASYNCHPHASE_POPULATION, |
| 325 | DBASYNCHPHASE_COMPLETE, |
| 326 | DBASYNCHPHASE_CANCELED, |
| 327 | }; |
| 328 | |
Huw Davies | 44967f0 | 2009-10-26 13:29:41 +0000 | [diff] [blame] | 329 | typedef struct tagRMTPACK |
| 330 | { |
| 331 | ISequentialStream *pISeqStream; |
| 332 | ULONG cbData; |
| 333 | ULONG cBSTR; |
| 334 | [size_is(cBSTR)] BSTR *rgBSTR; |
| 335 | ULONG cVARIANT; |
| 336 | [size_is(cVARIANT)] VARIANT *rgVARIANT; |
| 337 | ULONG cIDISPATCH; |
| 338 | [size_is(cIDISPATCH)] IDispatch **rgIDISPATCH; |
| 339 | ULONG cIUNKNOWN; |
| 340 | [size_is(cIUNKNOWN)] IUnknown **rgIUNKNOWN; |
| 341 | ULONG cPROPVARIANT; |
| 342 | [size_is(cPROPVARIANT)] PROPVARIANT *rgPROPVARIANT; |
| 343 | ULONG cArray; |
| 344 | [size_is(cArray)] VARIANT *rgArray; |
| 345 | } RMTPACK; |