Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

947 lines
42 KiB

  1. //--------------------------------------------------------------------------
  2. // DirectDB.idl
  3. //--------------------------------------------------------------------------
  4. import "ocidl.idl";
  5. import "objidl.idl";
  6. //--------------------------------------------------------------------------
  7. // Dependencies
  8. //--------------------------------------------------------------------------
  9. cpp_quote("#include <stddef.h> // for offsetof")
  10. //--------------------------------------------------------------------------
  11. // Interfaces
  12. //--------------------------------------------------------------------------
  13. interface IDatabaseSession;
  14. interface IDatabase;
  15. interface IDatabaseProgress;
  16. interface IDatabaseNotify;
  17. interface IDatabaseExtension;
  18. interface IDatabaseStream;
  19. interface IDatabaseQuery;
  20. //--------------------------------------------------------------------------
  21. // Class Ids and Interface Ids
  22. //--------------------------------------------------------------------------
  23. cpp_quote("// {4A16043F-676D-11d2-994E-00C04FA309D4}")
  24. cpp_quote("DEFINE_GUID(CLSID_DatabaseSession, 0x4a16043f, 0x676d, 0x11d2, 0x99, 0x4e, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
  25. cpp_quote("")
  26. cpp_quote("// {4A160440-676D-11d2-994E-00C04FA309D4}")
  27. cpp_quote("DEFINE_GUID(IID_IDatabaseSession, 0x4a160440, 0x676d, 0x11d2, 0x99, 0x4e, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
  28. cpp_quote("")
  29. cpp_quote("// {7157F0AE-967B-11d1-9A08-00C04FA309D4}")
  30. cpp_quote("DEFINE_GUID(IID_IDatabase, 0x7157f0ae, 0x967b, 0x11d1, 0x9a, 0x8, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
  31. cpp_quote("")
  32. cpp_quote("// {8CA77091-7B1C-11d2-995F-00C04FA309D4}")
  33. cpp_quote("DEFINE_GUID(IID_CDatabase, 0x8ca77091, 0x7b1c, 0x11d2, 0x99, 0x5f, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
  34. cpp_quote("")
  35. cpp_quote("// {82EAD219-A6EC-11d1-9A11-00C04FA309D4}")
  36. cpp_quote("DEFINE_GUID(IID_IDatabaseStream, 0x82ead219, 0xa6ec, 0x11d1, 0x9a, 0x11, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
  37. cpp_quote("")
  38. cpp_quote("// {80C42C87-63C1-11d2-9949-00C04FA309D4}")
  39. cpp_quote("DEFINE_GUID(IID_CDatabaseStream, 0x80c42c87, 0x63c1, 0x11d2, 0x99, 0x49, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
  40. cpp_quote("")
  41. cpp_quote("// {5E8A5021-AC7C-11d1-9A16-00C04FA309D4}")
  42. cpp_quote("DEFINE_GUID(IID_IDatabaseProgress, 0x5e8a5021, 0xac7c, 0x11d1, 0x9a, 0x16, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
  43. cpp_quote("")
  44. cpp_quote("// {5E8A5022-AC7C-11d1-9A16-00C04FA309D4}")
  45. cpp_quote("DEFINE_GUID(IID_IDatabaseNotify, 0x5e8a5022, 0xac7c, 0x11d1, 0x9a, 0x16, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
  46. cpp_quote("")
  47. cpp_quote("// {B58A0F80-0702-11d2-9A63-00C04FA309D4}")
  48. cpp_quote("DEFINE_GUID(IID_IDatabaseExtension, 0xb58a0f80, 0x702, 0x11d2, 0x9a, 0x63, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
  49. cpp_quote("")
  50. cpp_quote("// {E6CEC131-7F4B-11d2-9962-00C04FA309D4}")
  51. cpp_quote("DEFINE_GUID(IID_IDatabaseQuery, 0xe6cec131, 0x7f4b, 0x11d2, 0x99, 0x62, 0x0, 0xc0, 0x4f, 0xa3, 0x9, 0xd4);")
  52. //--------------------------------------------------------------------------
  53. // HRESULT Macros
  54. //--------------------------------------------------------------------------
  55. cpp_quote("#ifndef FACILITY_INTERNET")
  56. cpp_quote("#define FACILITY_INTERNET 12")
  57. cpp_quote("#endif")
  58. cpp_quote("#ifndef HR_E")
  59. cpp_quote("#define HR_E(n) MAKE_SCODE(SEVERITY_ERROR, FACILITY_INTERNET, n)")
  60. cpp_quote("#endif")
  61. cpp_quote("#ifndef HR_S")
  62. cpp_quote("#define HR_S(n) MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_INTERNET, n)")
  63. cpp_quote("#endif")
  64. cpp_quote("#ifndef HR_CODE")
  65. cpp_quote("#define HR_CODE(hr) (INT)(hr & 0xffff)")
  66. cpp_quote("#endif")
  67. cpp_quote("")
  68. //--------------------------------------------------------------------------
  69. // DirectDB Error HRESULTS
  70. //--------------------------------------------------------------------------
  71. cpp_quote("#define DB_E_ALREADYOPEN HR_E(300)")
  72. cpp_quote("#define DB_E_CREATEMUTEX HR_E(301)")
  73. cpp_quote("#define DB_E_CREATEFILE HR_E(302)")
  74. cpp_quote("#define DB_E_GETFILESIZE HR_E(303)")
  75. cpp_quote("#define DB_E_CREATEFILEMAPPING HR_E(304)")
  76. cpp_quote("#define DB_E_MAPVIEWOFFILE HR_E(305)")
  77. cpp_quote("#define DB_E_SETENDOFFILE HR_E(306)")
  78. cpp_quote("#define DB_E_SETFILEPOINTER HR_E(307)")
  79. cpp_quote("#define DB_E_BADMAJORVERSION HR_E(308)")
  80. cpp_quote("#define DB_E_INVALIDFILESIGNATURE HR_E(309)")
  81. cpp_quote("#define DB_E_WRITEFILE HR_E(310)")
  82. cpp_quote("#define DB_E_TIMEOUT HR_E(311)")
  83. cpp_quote("#define DB_E_FLUSHVIEWOFFILE HR_E(312)")
  84. cpp_quote("#define DB_E_FLUSHFILEBUFFERS HR_E(313)")
  85. cpp_quote("#define DB_E_DUPLICATE HR_E(314)")
  86. cpp_quote("#define DB_E_CORRUPT HR_E(315)")
  87. cpp_quote("#define DB_E_DISKFULL HR_E(316)")
  88. cpp_quote("#define DB_E_GETTEMPFILENAME HR_E(317)")
  89. cpp_quote("#define DB_E_NOTFOUND HR_E(318)")
  90. cpp_quote("#define DB_E_STREAMTABLEFULL HR_E(319)")
  91. cpp_quote("#define DB_E_NORECORDS HR_E(320)")
  92. cpp_quote("#define DB_E_COMPACT_PREEMPTED HR_E(321)")
  93. cpp_quote("#define DB_E_DATABASE_CHANGED HR_E(322)")
  94. cpp_quote("#define DB_E_COMPACTING HR_E(323)")
  95. cpp_quote("#define DB_E_RECORDVERSIONCHANGED HR_E(324)")
  96. cpp_quote("#define DB_E_CORRUPTRECORD HR_E(325)")
  97. cpp_quote("#define DB_E_BADMINORVERSION HR_E(326)")
  98. cpp_quote("#define DB_E_BADEXTENSIONCLSID HR_E(327)")
  99. cpp_quote("#define DB_E_TOOMANYOPENROWSETS HR_E(328)")
  100. cpp_quote("#define DB_E_LOCKEDFORREAD HR_E(329)")
  101. cpp_quote("#define DB_E_LOCKEDFORWRITE HR_E(330)")
  102. cpp_quote("#define DB_E_FILENOTFOUND HR_E(331)")
  103. cpp_quote("#define DB_E_UNMATCHINGQUOTES HR_E(332)")
  104. cpp_quote("#define DB_E_UNMATCHINGPARENS HR_E(333)")
  105. cpp_quote("#define DB_E_NUMBERTOOBIG HR_E(334)")
  106. cpp_quote("#define DB_E_BADNUMBER HR_E(335)")
  107. cpp_quote("#define DB_E_NOSYMBOLS HR_E(336)")
  108. cpp_quote("#define DB_E_INVALIDSYMBOL HR_E(337)")
  109. cpp_quote("#define DB_E_INVALIDCOLUMN HR_E(338)")
  110. cpp_quote("#define DB_E_BADEXPRESSION HR_E(339)")
  111. cpp_quote("#define DB_E_MOVEFILE HR_E(340)")
  112. cpp_quote("#define DB_E_ACCESSDENIED HR_E(341)")
  113. cpp_quote("#define DB_E_WRONGTHREAD HR_E(342)")
  114. cpp_quote("#define DB_E_ALREADYREGISTERED HR_E(343)")
  115. //--------------------------------------------------------------------------
  116. // DirectDB Error HRESULTS
  117. //--------------------------------------------------------------------------
  118. cpp_quote("#define DB_S_FOUND HR_S(800)")
  119. cpp_quote("#define DB_S_NOTFOUND HR_S(801)")
  120. //--------------------------------------------------------------------------
  121. // sizeofMember
  122. //--------------------------------------------------------------------------
  123. cpp_quote("#define sizeofMember(s,m) sizeof(((s *)0)->m)")
  124. //--------------------------------------------------------------------------
  125. // DECLARE_HANDLE Macro
  126. //--------------------------------------------------------------------------
  127. #ifndef DECLARE_HANDLE
  128. #define DECLARE_HANDLE(name) \
  129. struct name##__ { DWORD unused; }; \
  130. typedef struct name##__ _far* name
  131. #endif
  132. // OE team hasn't fixed their idl to avoid the Win64 midl warnings - turn it off
  133. midl_pragma warning(disable:2395)
  134. //--------------------------------------------------------------------------
  135. // DirectDB Type Library
  136. //--------------------------------------------------------------------------
  137. [
  138. uuid(E462D143-5162-11d1-8A95-00C04FB951F3),
  139. helpstring("Microsoft DirectDB Type Library 1.0"),
  140. version(1.0)
  141. ]
  142. library DirectDB
  143. {
  144. //----------------------------------------------------------------------
  145. // Standard Type Library Stuff
  146. //----------------------------------------------------------------------
  147. importlib("stdole2.tlb");
  148. //----------------------------------------------------------------------
  149. // IDatabase
  150. //----------------------------------------------------------------------
  151. cpp_quote("#ifndef __LPDATABASE_DEFINED")
  152. cpp_quote("#define __LPDATABASE_DEFINED")
  153. [
  154. object,
  155. uuid(7157F0AE-967B-11d1-9A08-00C04FA309D4),
  156. pointer_default(unique)
  157. ]
  158. interface IDatabase : IUnknown
  159. {
  160. //------------------------------------------------------------------
  161. // Pointer to an interface of this type
  162. //------------------------------------------------------------------
  163. typedef IDatabase *LPDATABASE;
  164. //------------------------------------------------------------------
  165. // Constants
  166. //------------------------------------------------------------------
  167. const DWORD CMAX_INDEXES = 8;
  168. const DWORD CMAX_KEYS = 8;
  169. const DWORD COLUMNS_ALL = 0xFFFFFFFF;
  170. //------------------------------------------------------------------
  171. // Reserved Unique Ids
  172. //------------------------------------------------------------------
  173. const DWORD RESERVED_ID_MIN = 0xFFFFFBFF;
  174. const DWORD RESERVED_ID_MAX = 0xFFFFFFFF;
  175. //------------------------------------------------------------------
  176. // HROWSET
  177. //------------------------------------------------------------------
  178. DECLARE_HANDLE(HROWSET);
  179. typedef HROWSET *LPHROWSET;
  180. const HROWSET HROWSET_INVALID = (HROWSET) 0x00000000;
  181. //------------------------------------------------------------------
  182. // HLOCK
  183. //------------------------------------------------------------------
  184. DECLARE_HANDLE(HLOCK);
  185. typedef HLOCK *LPHLOCK;
  186. //------------------------------------------------------------------
  187. // METHODID
  188. //------------------------------------------------------------------
  189. typedef DWORD METHODID;
  190. //------------------------------------------------------------------
  191. // SEEKROWSETTYPE
  192. //------------------------------------------------------------------
  193. typedef enum tagSEEKROWSETTYPE {
  194. SEEK_ROWSET_BEGIN,
  195. SEEK_ROWSET_CURRENT,
  196. SEEK_ROWSET_END
  197. } SEEKROWSETTYPE;
  198. //------------------------------------------------------------------
  199. // TRANSACTIONTYPE
  200. //------------------------------------------------------------------
  201. typedef enum tagTRANSACTIONTYPE {
  202. TRANSACTION_INSERT,
  203. TRANSACTION_UPDATE,
  204. TRANSACTION_DELETE,
  205. TRANSACTION_INDEX_CHANGED,
  206. TRANSACTION_INDEX_DELETED,
  207. TRANSACTION_COMPACTED
  208. } TRANSACTIONTYPE, *LPTRANSACTIONTYPE;
  209. //------------------------------------------------------------------
  210. // HTRANSACTION
  211. //------------------------------------------------------------------
  212. DECLARE_HANDLE(HTRANSACTION);
  213. typedef HTRANSACTION *LPHTRANSACTION;
  214. //------------------------------------------------------------------
  215. // FILEADDRESS
  216. //------------------------------------------------------------------
  217. typedef DWORD FILEADDRESS;
  218. typedef LPDWORD LPFILEADDRESS;
  219. //------------------------------------------------------------------
  220. // INDEXORDINAL
  221. //------------------------------------------------------------------
  222. typedef DWORD INDEXORDINAL;
  223. typedef LPDWORD LPINDEXORDINAL;
  224. cpp_quote("#define INVALID_INDEX_ORDINAL 0xFFFFFFFF")
  225. //------------------------------------------------------------------
  226. // COLUMNORDINAL
  227. //------------------------------------------------------------------
  228. typedef BYTE COLUMNORDINAL;
  229. typedef BYTE *LPCOLUMNORDINAL;
  230. //------------------------------------------------------------------
  231. // COMPACTFLAGS
  232. //------------------------------------------------------------------
  233. typedef DWORD COMPACTFLAGS;
  234. cpp_quote("#define COMPACT_PREEMPTABLE 0x00000001")
  235. cpp_quote("#define COMPACT_YIELD 0x00000002")
  236. //------------------------------------------------------------------
  237. // LOCKNOTIFYFLAGS
  238. //------------------------------------------------------------------
  239. typedef DWORD LOCKNOTIFYFLAGS;
  240. //------------------------------------------------------------------
  241. // REGISTERNOTIFYFLAGS
  242. //------------------------------------------------------------------
  243. typedef DWORD REGISTERNOTIFYFLAGS;
  244. cpp_quote("#define REGISTER_NOTIFY_NOADDREF 0x00000001")
  245. cpp_quote("#define REGISTER_NOTIFY_ORDINALSONLY 0x00000002")
  246. //------------------------------------------------------------------
  247. // COMPAREFLAGS
  248. //------------------------------------------------------------------
  249. typedef BYTE COMPAREFLAGS;
  250. cpp_quote("#define COMPARE_IGNORECASE 0x00000001")
  251. cpp_quote("#define COMPARE_DESCENDING 0x00000002")
  252. cpp_quote("#define COMPARE_ASANSI 0x00000004")
  253. //------------------------------------------------------------------
  254. // TABLESCHEMAFLAGS
  255. //------------------------------------------------------------------
  256. typedef DWORD TABLESCHEMAFLAGS;
  257. cpp_quote("#define TSF_RESETIFBADVERSION 0x00000001")
  258. cpp_quote("#define TSF_HASSTREAMS 0x00000002")
  259. cpp_quote("#define TSF_HASEXTENSION 0x00000004")
  260. //------------------------------------------------------------------
  261. // CREATEROWSETFLAGS
  262. //------------------------------------------------------------------
  263. typedef DWORD CREATEROWSETFLAGS;
  264. //------------------------------------------------------------------
  265. // INDEXFLAGS
  266. //------------------------------------------------------------------
  267. typedef BYTE INDEXFLAGS;
  268. cpp_quote("#define INDEX_DESCENDING 0x00000001")
  269. //------------------------------------------------------------------
  270. // INDEXORDINAL
  271. //------------------------------------------------------------------
  272. cpp_quote("#define IINDEX_PRIMARY 0")
  273. //------------------------------------------------------------------
  274. // ROWORDINAL
  275. //------------------------------------------------------------------
  276. typedef DWORD ROWORDINAL;
  277. typedef LPDWORD LPROWORDINAL;
  278. const ROWORDINAL INVALID_ROWORDINAL = 0xffffffff;
  279. //------------------------------------------------------------------
  280. // ACCESSTYPE
  281. //------------------------------------------------------------------
  282. typedef enum tagACCESSTYPE {
  283. ACCESS_READ=100,
  284. ACCESS_WRITE=200
  285. } ACCESSTYPE;
  286. //------------------------------------------------------------------
  287. // COLUMNDATATYPE
  288. //------------------------------------------------------------------
  289. typedef enum tagCOLUMNDATATYPE {
  290. CDT_FILETIME,
  291. CDT_FIXSTRA,
  292. CDT_VARSTRA,
  293. CDT_BYTE,
  294. CDT_DWORD,
  295. CDT_WORD,
  296. CDT_STREAM,
  297. CDT_VARBLOB,
  298. CDT_FIXBLOB,
  299. CDT_FLAGS,
  300. CDT_UNIQUE,
  301. CDT_FIXSTRW,
  302. CDT_VARSTRW,
  303. CDT_LASTTYPE
  304. } COLUMNDATATYPE;
  305. //------------------------------------------------------------------
  306. // SYMBOLTYPE
  307. //------------------------------------------------------------------
  308. typedef enum tagSYMBOLTYPE {
  309. SYMBOL_INVALID,
  310. SYMBOL_COLUMN,
  311. SYMBOL_DWORD,
  312. SYMBOL_METHOD
  313. } SYMBOLTYPE;
  314. //------------------------------------------------------------------
  315. // SYMBOLINFO
  316. //------------------------------------------------------------------
  317. typedef struct tagSYMBOLINFO {
  318. SYMBOLTYPE tySymbol;
  319. LPCSTR pszName;
  320. DWORD dwValue;
  321. } SYMBOLINFO, *LPSYMBOLINFO;
  322. //------------------------------------------------------------------
  323. // SYMBOLTABLE
  324. //------------------------------------------------------------------
  325. typedef struct tagSYMBOLTABLE {
  326. DWORD cSymbols;
  327. SYMBOLINFO rgSymbol[32];
  328. } SYMBOLTABLE, *LPSYMBOLTABLE;
  329. typedef SYMBOLTABLE const *LPCSYMBOLTABLE;
  330. //------------------------------------------------------------------
  331. // ORDINALLIST
  332. //------------------------------------------------------------------
  333. typedef struct tagORDINALLIST {
  334. ROWORDINAL rgiRecord1[CMAX_INDEXES];
  335. ROWORDINAL rgiRecord2[CMAX_INDEXES];
  336. } ORDINALLIST, *LPORDINALLIST;
  337. //------------------------------------------------------------------
  338. // INDEXKEY - 6 Bytes
  339. //------------------------------------------------------------------
  340. #pragma pack(1)
  341. typedef struct tagINDEXKEY {
  342. COLUMNORDINAL iColumn; // 1
  343. COMPAREFLAGS bCompare; // 2
  344. DWORD dwBits; // 6
  345. } INDEXKEY, *LPINDEXKEY;
  346. #pragma pack()
  347. typedef INDEXKEY const *LPCINDEXKEY;
  348. //------------------------------------------------------------------
  349. // TABLEINDEX - 2 + (8 * 6) = 50 Bytes
  350. //------------------------------------------------------------------
  351. #pragma pack(1)
  352. typedef struct tagTABLEINDEX {
  353. BYTE cKeys; // 2
  354. INDEXFLAGS bFlags; // 4
  355. INDEXKEY rgKey[CMAX_KEYS];
  356. } TABLEINDEX, *LPTABLEINDEX;
  357. #pragma pack()
  358. typedef TABLEINDEX const *LPCTABLEINDEX;
  359. //------------------------------------------------------------------
  360. // TABLECOLUMN
  361. //------------------------------------------------------------------
  362. typedef struct tagTABLECOLUMN {
  363. COLUMNORDINAL iOrdinal;
  364. COLUMNDATATYPE type;
  365. DWORD ofBinding;
  366. DWORD cbSize;
  367. } TABLECOLUMN, *LPTABLECOLUMN;
  368. typedef TABLECOLUMN const *LPCTABLECOLUMN;
  369. //------------------------------------------------------------------
  370. // TABLESCHEMA
  371. //------------------------------------------------------------------
  372. typedef struct tagTABLESCHEMA {
  373. const CLSID *pclsidExtension;
  374. DWORD cbBinding;
  375. DWORD ofMemory;
  376. DWORD ofVersion;
  377. DWORD dwMinorVersion;
  378. TABLESCHEMAFLAGS dwFlags;
  379. DWORD cbUserData;
  380. DWORD ofUniqueId;
  381. BYTE cColumns;
  382. LPCTABLECOLUMN prgColumn;
  383. LPCTABLEINDEX pPrimaryIndex;
  384. LPCSYMBOLTABLE pSymbols;
  385. } TABLESCHEMA, *LPTABLESCHEMA;
  386. typedef TABLESCHEMA const *LPCTABLESCHEMA;
  387. //------------------------------------------------------------------
  388. // BEGIN_TABLE_INDEX
  389. //------------------------------------------------------------------
  390. cpp_quote("#ifdef DEFINE_DIRECTDB")
  391. cpp_quote("#define BEGIN_TABLE_INDEX(_index, _cKeys) \\")
  392. cpp_quote(" extern const TABLEINDEX _index = { _cKeys, 0, {")
  393. cpp_quote("#else")
  394. cpp_quote("#define BEGIN_TABLE_INDEX(_index, _cKeys)")
  395. cpp_quote("#endif")
  396. //------------------------------------------------------------------
  397. // DEFINE_KEY
  398. //------------------------------------------------------------------
  399. cpp_quote("#ifdef DEFINE_DIRECTDB")
  400. cpp_quote("#define DEFINE_KEY(_iColumn, _wCompare, _dwBits) { _iColumn, _wCompare, _dwBits },")
  401. cpp_quote("#else")
  402. cpp_quote("#define DEFINE_KEY(_iColumn, _wCompare, _dwBits)")
  403. cpp_quote("#endif")
  404. //------------------------------------------------------------------
  405. // END_TABLE_INDEX
  406. //------------------------------------------------------------------
  407. cpp_quote("#ifdef DEFINE_DIRECTDB")
  408. cpp_quote("#define END_TABLE_INDEX } };")
  409. cpp_quote("#else")
  410. cpp_quote("#define END_TABLE_INDEX")
  411. cpp_quote("#endif")
  412. //------------------------------------------------------------------
  413. // BEGIN_COLUMN_ARRAY
  414. //------------------------------------------------------------------
  415. cpp_quote("#ifdef DEFINE_DIRECTDB")
  416. cpp_quote("#define BEGIN_COLUMN_ARRAY(_name, _cColumns) const TABLECOLUMN _name[_cColumns] = {")
  417. cpp_quote("#else")
  418. cpp_quote("#define BEGIN_COLUMN_ARRAY(_name, _cColumns)")
  419. cpp_quote("#endif")
  420. //------------------------------------------------------------------
  421. // DEFINE_COLUMN
  422. //------------------------------------------------------------------
  423. cpp_quote("#ifdef DEFINE_DIRECTDB")
  424. cpp_quote("#define DEFINE_COLUMN(_iColumn, _type, _structure, _member)\\")
  425. cpp_quote(" { _iColumn, _type, offsetof(_structure, _member), sizeofMember(_structure, _member) },")
  426. cpp_quote("#else")
  427. cpp_quote("#define DEFINE_COLUMN(_iColumn, _type, _structure, _member)")
  428. cpp_quote("#endif")
  429. //------------------------------------------------------------------
  430. // END_COLUMN_ARRAY
  431. //------------------------------------------------------------------
  432. cpp_quote("#ifdef DEFINE_DIRECTDB")
  433. cpp_quote("#define END_COLUMN_ARRAY };")
  434. cpp_quote("#else")
  435. cpp_quote("#define END_COLUMN_ARRAY")
  436. cpp_quote("#endif")
  437. //------------------------------------------------------------------
  438. // BEGIN_SYMBOL_TABLE
  439. //------------------------------------------------------------------
  440. cpp_quote("#ifdef DEFINE_DIRECTDB")
  441. cpp_quote("#define BEGIN_SYMBOL_TABLE(_name, _cSymbols) \\")
  442. cpp_quote(" extern const SYMBOLTABLE _name = { _cSymbols, {")
  443. cpp_quote("#else")
  444. cpp_quote("#define BEGIN_SYMBOL_TABLE(_name, _cSymbols)")
  445. cpp_quote("#endif")
  446. //------------------------------------------------------------------
  447. // DEFINE_SYMBOL
  448. //------------------------------------------------------------------
  449. cpp_quote("#ifdef DEFINE_DIRECTDB")
  450. cpp_quote("#define DEFINE_SYMBOL(_tySymbol, _pszName, _dwValue) \\")
  451. cpp_quote(" { _tySymbol, (LPCSTR)_pszName, _dwValue },")
  452. cpp_quote("#else")
  453. cpp_quote("#define DEFINE_SYMBOL(_tySymbol, _pszName, _dwValue)")
  454. cpp_quote("#endif")
  455. //------------------------------------------------------------------
  456. // END_SYMBOL_TABLE
  457. //------------------------------------------------------------------
  458. cpp_quote("#ifdef DEFINE_DIRECTDB")
  459. cpp_quote("#define END_SYMBOL_TABLE } };")
  460. cpp_quote("#else")
  461. cpp_quote("#define END_SYMBOL_TABLE")
  462. cpp_quote("#endif")
  463. //------------------------------------------------------------------
  464. // BEGIN_TABLE_SCHEMA
  465. //------------------------------------------------------------------
  466. cpp_quote("#ifdef DEFINE_DIRECTDB")
  467. cpp_quote("#define BEGIN_TABLE_SCHEMA(_schema, _clsid, _binding) \\")
  468. cpp_quote(" extern const TABLESCHEMA _schema = { \\")
  469. cpp_quote(" &_clsid,\\")
  470. cpp_quote(" sizeof(_binding),\\")
  471. cpp_quote(" offsetof(_binding, pAllocated),\\")
  472. cpp_quote(" offsetof(_binding, bVersion),")
  473. cpp_quote("#else")
  474. cpp_quote("#define BEGIN_TABLE_SCHEMA(_schema, _clsid, _binding)")
  475. cpp_quote("#endif")
  476. //------------------------------------------------------------------
  477. // SCHEMA_PROPERTY
  478. //------------------------------------------------------------------
  479. cpp_quote("#ifdef DEFINE_DIRECTDB")
  480. cpp_quote("#define SCHEMA_PROPERTY(_value) \\")
  481. cpp_quote(" _value,")
  482. cpp_quote("#else")
  483. cpp_quote("#define SCHEMA_PROPERTY(_value)")
  484. cpp_quote("#endif")
  485. //------------------------------------------------------------------
  486. // END_TABLE_SCHEMA
  487. //------------------------------------------------------------------
  488. cpp_quote("#ifdef DEFINE_DIRECTDB")
  489. cpp_quote("#define END_TABLE_SCHEMA };")
  490. cpp_quote("#else")
  491. cpp_quote("#define END_TABLE_SCHEMA")
  492. cpp_quote("#endif")
  493. //------------------------------------------------------------------
  494. // Locking Methods
  495. //------------------------------------------------------------------
  496. HRESULT Lock(
  497. [out] LPHLOCK phLock);
  498. HRESULT Unlock(
  499. [out] LPHLOCK phLock);
  500. //------------------------------------------------------------------
  501. // Data Manipulation Methods
  502. //------------------------------------------------------------------
  503. HRESULT InsertRecord(
  504. [in] LPVOID pRecord);
  505. HRESULT UpdateRecord(
  506. [in] LPVOID pRecord);
  507. HRESULT DeleteRecord(
  508. [in] LPVOID pRecord);
  509. HRESULT FindRecord(
  510. [in] INDEXORDINAL iIndex,
  511. [in] DWORD cColumns, // Use COLUMNS_ALL to compare all columns of the index
  512. [in,out] LPVOID pRecord,
  513. [out] LPROWORDINAL piRow);
  514. HRESULT GetRowOrdinal(
  515. [in] INDEXORDINAL iIndex,
  516. [in] LPVOID pRecord,
  517. [out] LPROWORDINAL piRow);
  518. HRESULT FreeRecord(
  519. [in,out] LPVOID pRecord);
  520. HRESULT GetUserData(
  521. [in,out] LPVOID pvUserData,
  522. [in] ULONG cbUserData);
  523. HRESULT SetUserData(
  524. [in] LPVOID pvUserData,
  525. [in] ULONG cbUserData);
  526. HRESULT GetRecordCount(
  527. [in] INDEXORDINAL iIndex,
  528. [out] LPDWORD pcRecords);
  529. //------------------------------------------------------------------
  530. // Schema Methods
  531. //------------------------------------------------------------------
  532. HRESULT GetIndexInfo(
  533. [in] INDEXORDINAL iIndex,
  534. [out] LPSTR *ppszFilter,
  535. [out] LPTABLEINDEX pIndex);
  536. HRESULT ModifyIndex(
  537. [in] INDEXORDINAL iIndex,
  538. [in] LPCSTR pszFilter,
  539. [in] LPCTABLEINDEX pIndex);
  540. HRESULT DeleteIndex(
  541. [in] INDEXORDINAL iIndex);
  542. //------------------------------------------------------------------
  543. // Rowset Methods
  544. //------------------------------------------------------------------
  545. HRESULT CreateRowset(
  546. [in] INDEXORDINAL iIndex,
  547. [in] CREATEROWSETFLAGS dwFlags,
  548. [out] LPHROWSET phRowset);
  549. HRESULT SeekRowset(
  550. [in] HROWSET hRowset,
  551. [in] SEEKROWSETTYPE tySeek,
  552. [in] LONG cRows,
  553. [out] LPROWORDINAL piRowNew);
  554. HRESULT QueryRowset(
  555. [in] HROWSET hRowset,
  556. [in] LONG cWanted,
  557. [in,out] LPVOID *prgpRecord,
  558. [out] LPDWORD pcObtained);
  559. HRESULT CloseRowset(
  560. [in,out] LPHROWSET phRowset);
  561. //------------------------------------------------------------------
  562. // Steaming Methods
  563. //------------------------------------------------------------------
  564. HRESULT CreateStream(
  565. [out] LPFILEADDRESS pfaStart);
  566. HRESULT DeleteStream(
  567. [in] FILEADDRESS faStart);
  568. HRESULT CopyStream(
  569. [in] IDatabase *pDest,
  570. [in] FILEADDRESS faStream,
  571. [out] LPFILEADDRESS pfaNew);
  572. HRESULT OpenStream(
  573. [in] ACCESSTYPE tyAccess,
  574. [in] FILEADDRESS faStream,
  575. [out] IStream **ppStream);
  576. HRESULT ChangeStreamLock(
  577. [in] IStream *pStream,
  578. [in] ACCESSTYPE tyAccessNew);
  579. //------------------------------------------------------------------
  580. // Notification Methods
  581. //------------------------------------------------------------------
  582. HRESULT RegisterNotify(
  583. [in] INDEXORDINAL iIndex,
  584. [in] REGISTERNOTIFYFLAGS dwFlags,
  585. [in] DWORD_PTR dwCookie,
  586. [in] IDatabaseNotify *pNotify);
  587. HRESULT DispatchNotify(
  588. [in] IDatabaseNotify *pNotify);
  589. HRESULT SuspendNotify(
  590. [in] IDatabaseNotify *pNotify);
  591. HRESULT ResumeNotify(
  592. [in] IDatabaseNotify *pNotify);
  593. HRESULT UnregisterNotify(
  594. [in] IDatabaseNotify *pNotify);
  595. HRESULT LockNotify(
  596. [in] LOCKNOTIFYFLAGS dwFlags,
  597. [out] LPHLOCK phLock);
  598. HRESULT UnlockNotify(
  599. [in,out] LPHLOCK phLock);
  600. HRESULT GetTransaction(
  601. [in,out] LPHTRANSACTION phTransaction,
  602. [out] LPTRANSACTIONTYPE ptyTransaction,
  603. [in] LPVOID pRecord1,
  604. [in] LPVOID pRecord2,
  605. [in,out] LPINDEXORDINAL piIndex,
  606. [in] LPORDINALLIST pOrdinals);
  607. //------------------------------------------------------------------
  608. // Maintenence Methods
  609. //------------------------------------------------------------------
  610. HRESULT MoveFile(
  611. [in] LPCWSTR pwszFilePath);
  612. HRESULT SetSize(
  613. [in] DWORD cbSize);
  614. HRESULT Repair(void);
  615. HRESULT Compact(
  616. [in] IDatabaseProgress *pProgress,
  617. [in] COMPACTFLAGS dwFlags);
  618. //------------------------------------------------------------------
  619. // Fast-Heap Methods
  620. //------------------------------------------------------------------
  621. HRESULT HeapAllocate(
  622. [in] DWORD dwFlags, // HEAP_xxx Flags normally passed to HeapAlloc
  623. [in] DWORD cbSize,
  624. [out] LPVOID *ppBuffer);
  625. HRESULT HeapFree(
  626. [in] LPVOID pBuffer);
  627. //------------------------------------------------------------------
  628. // General Utility Methods
  629. //------------------------------------------------------------------
  630. HRESULT GenerateId(
  631. [out] LPDWORD pdwId);
  632. HRESULT GetClientCount(
  633. [out] LPDWORD pcClients);
  634. HRESULT GetFile(
  635. [out] LPWSTR *ppwszFile);
  636. HRESULT GetSize(
  637. [out] LPDWORD pcbFile,
  638. [out] LPDWORD pcbAllocated,
  639. [out] LPDWORD pcbFreed,
  640. [out] LPDWORD pcbStreams);
  641. }
  642. cpp_quote("#endif // __LPDATABASE_DEFINED")
  643. //----------------------------------------------------------------------
  644. // IDatabaseSession
  645. //----------------------------------------------------------------------
  646. cpp_quote("#ifndef __LPDATABASESESSION_DEFINED")
  647. cpp_quote("#define __LPDATABASESESSION_DEFINED")
  648. [
  649. object,
  650. uuid(4A160440-676D-11d2-994E-00C04FA309D4),
  651. pointer_default(unique)
  652. ]
  653. interface IDatabaseSession : IUnknown
  654. {
  655. //------------------------------------------------------------------
  656. // Pointer to an interface of this type
  657. //------------------------------------------------------------------
  658. typedef IDatabaseSession *LPDATABASESESSION;
  659. //------------------------------------------------------------------
  660. // OPENDATABASEFLAGS
  661. //------------------------------------------------------------------
  662. typedef DWORD OPENDATABASEFLAGS;
  663. cpp_quote("#define OPEN_DATABASE_NORESET 0x00000001")
  664. cpp_quote("#define OPEN_DATABASE_NOADDREFEXT 0x00000002")
  665. cpp_quote("#define OPEN_DATABASE_NOEXTENSION 0x00000004")
  666. //cpp_quote("#define OPEN_DATABASE_NOREPAIRUI 0x00000008")
  667. cpp_quote("#define OPEN_DATABASE_NOMONITOR 0x00000010")
  668. cpp_quote("#define OPEN_DATABASE_EXCLUSEIVE 0x00000020")
  669. cpp_quote("#define OPEN_DATABASE_NOCREATE 0x00000040")
  670. //------------------------------------------------------------------
  671. // Members
  672. //------------------------------------------------------------------
  673. HRESULT OpenDatabase(
  674. [in] LPCSTR pszFile,
  675. [in] OPENDATABASEFLAGS dwFlags,
  676. [in] LPCTABLESCHEMA pSchema,
  677. [in] IDatabaseExtension *pExtension,
  678. [out] IDatabase **ppDB);
  679. HRESULT OpenDatabaseW(
  680. [in] LPCWSTR pwszFile,
  681. [in] OPENDATABASEFLAGS dwFlags,
  682. [in] LPCTABLESCHEMA pSchema,
  683. [in] IDatabaseExtension *pExtension,
  684. [out] IDatabase **ppDB);
  685. HRESULT OpenQuery(
  686. [in] IDatabase *pDatabase,
  687. [in] LPCSTR pszQuery,
  688. [out] IDatabaseQuery **ppQuery);
  689. }
  690. cpp_quote("#endif // __LPDATABASESESSION_DEFINED")
  691. //----------------------------------------------------------------------
  692. // IDatabaseExtension
  693. //----------------------------------------------------------------------
  694. cpp_quote("#ifndef __LPDATABASEEXTENSION_DEFINED")
  695. cpp_quote("#define __LPDATABASEEXTENSION_DEFINED")
  696. [
  697. object,
  698. uuid(B58A0F80-0702-11d2-9A63-00C04FA309D4),
  699. pointer_default(unique)
  700. ]
  701. interface IDatabaseExtension : IUnknown
  702. {
  703. //------------------------------------------------------------------
  704. // OPERATIONSTATE
  705. //------------------------------------------------------------------
  706. typedef enum tagOPERATIONSTATE {
  707. OPERATION_BEFORE,
  708. OPERATION_AFTER
  709. } OPERATIONSTATE;
  710. //------------------------------------------------------------------
  711. // Pointer to an interface of this type
  712. //------------------------------------------------------------------
  713. typedef IDatabaseExtension *LPDATABASEEXTENSION;
  714. //------------------------------------------------------------------
  715. // Methods
  716. //------------------------------------------------------------------
  717. HRESULT Initialize(
  718. [in] IDatabase *pDB);
  719. HRESULT OnLock(void);
  720. HRESULT OnUnlock(void);
  721. HRESULT OnRecordInsert(
  722. [in] OPERATIONSTATE tyState,
  723. [in] LPORDINALLIST pOrdinals, // Only valid when tyState = OPERATION_AFTER
  724. [in] LPVOID pRecord);
  725. HRESULT OnRecordUpdate(
  726. [in] OPERATIONSTATE tyState,
  727. [in] LPORDINALLIST pOrdinals, // Only valid when tyState = OPERATION_AFTER
  728. [in] LPVOID pRecordOld,
  729. [in] LPVOID pRecordNew);
  730. HRESULT OnRecordDelete(
  731. [in] OPERATIONSTATE tyState,
  732. [in] LPORDINALLIST pOrdinals, // Only valid when tyState = OPERATION_AFTER
  733. [in] LPVOID pRecord);
  734. HRESULT OnExecuteMethod(
  735. [in] METHODID idMethod,
  736. [in] LPVOID pBinding,
  737. [in] LPDWORD pdwResult);
  738. }
  739. cpp_quote("#endif // __LPDATABASEEXTENSION_DEFINED")
  740. //----------------------------------------------------------------------
  741. // IDatabaseNotify
  742. //----------------------------------------------------------------------
  743. cpp_quote("#ifndef __LPDATABASENOTIFY_DEFINED")
  744. cpp_quote("#define __LPDATABASENOTIFY_DEFINED")
  745. [
  746. object,
  747. uuid(7CADFB4C-AC65-11d1-9A16-00C04FA309D4),
  748. pointer_default(unique)
  749. ]
  750. interface IDatabaseNotify : IUnknown
  751. {
  752. //------------------------------------------------------------------
  753. // Pointer to an interface of this type
  754. //------------------------------------------------------------------
  755. typedef IDatabaseNotify *LPDATABASENOTIFY;
  756. //------------------------------------------------------------------
  757. // Methods
  758. //------------------------------------------------------------------
  759. HRESULT OnTransaction(
  760. [in] HTRANSACTION hTransaction,
  761. [in] DWORD_PTR dwCookie,
  762. [in] IDatabase *pDB);
  763. }
  764. cpp_quote("#endif // __LPDATABASENOTIFY_DEFINED")
  765. //----------------------------------------------------------------------
  766. // IDatabaseStream
  767. //----------------------------------------------------------------------
  768. cpp_quote("#ifndef __LPDATABASESTREAM_DEFINED")
  769. cpp_quote("#define __LPDATABASESTREAM_DEFINED")
  770. [
  771. object,
  772. uuid(82EAD219-A6EC-11d1-9A11-00C04FA309D4),
  773. pointer_default(unique)
  774. ]
  775. interface IDatabaseStream : IStream
  776. {
  777. //------------------------------------------------------------------
  778. // Pointer to an interface of this type
  779. //------------------------------------------------------------------
  780. typedef IDatabaseStream *LPDATABASESTREAM;
  781. //------------------------------------------------------------------
  782. // Methods
  783. //------------------------------------------------------------------
  784. HRESULT GetFileAddress(
  785. [out] LPFILEADDRESS pfaStream);
  786. HRESULT CompareDatabase(
  787. [in] IDatabase *pDatabase);
  788. }
  789. cpp_quote("#endif // __LPDATABASESTREAM_DEFINED")
  790. //----------------------------------------------------------------------
  791. // IDatabaseProgress
  792. //----------------------------------------------------------------------
  793. cpp_quote("#ifndef __LPDATABASEPROGRESS_DEFINED")
  794. cpp_quote("#define __LPDATABASEPROGRESS_DEFINED")
  795. [
  796. object,
  797. uuid(7CADFB4B-AC65-11d1-9A16-00C04FA309D4),
  798. pointer_default(unique)
  799. ]
  800. interface IDatabaseProgress : IUnknown
  801. {
  802. HRESULT Update(
  803. [in] DWORD cCount);
  804. }
  805. cpp_quote("#endif // __LPDATABASEPROGRESS_DEFINED")
  806. //----------------------------------------------------------------------
  807. // IDatabaseQuery
  808. //----------------------------------------------------------------------
  809. cpp_quote("#ifndef __LPDATABASEQUERY_DEFINED")
  810. cpp_quote("#define __LPDATABASEQUERY_DEFINED")
  811. [
  812. object,
  813. uuid(E6CEC131-7F4B-11d2-9962-00C04FA309D4),
  814. pointer_default(unique)
  815. ]
  816. interface IDatabaseQuery : IUnknown
  817. {
  818. HRESULT Evaluate(
  819. [in] LPVOID pBinding);
  820. }
  821. cpp_quote("#endif // __LPDATABASEQUERY_DEFINED")
  822. } // DirectDB Library Object Definition