Source code of Windows XP (NT5)
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.

1073 lines
20 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1999
  5. //
  6. // File: dbw.cpp
  7. //
  8. // Contents: Cert Server Database interface implementation
  9. //
  10. //---------------------------------------------------------------------------
  11. #include <pch.cpp>
  12. #pragma hdrstop
  13. #include "dbw.h"
  14. #if DBG
  15. BOOL g_fDebugJet = TRUE;
  16. #define DBGJET(args) if (g_fDebugJet) { DBGPRINT(args); }
  17. #define DBGJETDUMPHEX(jerr, flags, pb, cb) \
  18. if (JET_errSuccess == (jerr) && g_fDebugJet && NULL != (pb) && 0 != (cb)) \
  19. { \
  20. DBGDUMPHEX((DBG_SS_CERTJETI, (flags), (pb), (cb))); \
  21. }
  22. #define CTABLEMAX 40
  23. JET_TABLEID g_at[CTABLEMAX];
  24. DWORD g_ct = 0;
  25. DWORD
  26. TableIndex(
  27. JET_TABLEID tableid)
  28. {
  29. DWORD i;
  30. for (i = 0; i < g_ct; i++)
  31. {
  32. if (g_at[i] == tableid)
  33. {
  34. return(i);
  35. }
  36. }
  37. if (g_ct < CTABLEMAX)
  38. {
  39. g_at[g_ct++] = tableid;
  40. DBGJET((DBG_SS_CERTJETI, "TableIndex(%x) --> %x\n", tableid, i));
  41. return(i);
  42. }
  43. return((DWORD) -1);
  44. }
  45. VOID
  46. dbgcat(
  47. IN OUT WCHAR *pwszBuf,
  48. IN WCHAR const *pwszAdd)
  49. {
  50. wcscat(pwszBuf, NULL == wcschr(pwszBuf, L':')? L": " : L", ");
  51. wcscat(pwszBuf, pwszAdd);
  52. }
  53. WCHAR const *
  54. wszOpenDatabase(
  55. JET_GRBIT grbit)
  56. {
  57. static WCHAR s_awc[12];
  58. wsprintf(s_awc, L"{%x}", grbit);
  59. return(s_awc);
  60. }
  61. WCHAR const *
  62. wszAttachDatabase(
  63. JET_GRBIT grbit)
  64. {
  65. static WCHAR s_awc[12];
  66. wsprintf(s_awc, L"{%x}", grbit);
  67. return(s_awc);
  68. }
  69. WCHAR const *
  70. wszSeekgrbit(
  71. JET_GRBIT grbit)
  72. {
  73. static WCHAR s_awc[64]; // 1 + 2 + 6 * 2 + 5 * 2 + 13
  74. wsprintf(s_awc, L"{%x", grbit);
  75. if (JET_bitSeekEQ & grbit) dbgcat(s_awc, L"EQ");
  76. if (JET_bitSeekLT & grbit) dbgcat(s_awc, L"LT");
  77. if (JET_bitSeekLE & grbit) dbgcat(s_awc, L"LE");
  78. if (JET_bitSeekGE & grbit) dbgcat(s_awc, L"GE");
  79. if (JET_bitSeekGT & grbit) dbgcat(s_awc, L"GT");
  80. if (JET_bitSetIndexRange & grbit) dbgcat(s_awc, L"SetIndexRange");
  81. wcscat(s_awc, L"}");
  82. CSASSERT(wcslen(s_awc) < ARRAYSIZE(s_awc));
  83. return(s_awc);
  84. }
  85. WCHAR const *
  86. wszMovecrow(
  87. IN LONG cRow)
  88. {
  89. static WCHAR s_awc[16];
  90. switch (cRow)
  91. {
  92. case JET_MoveFirst: wcscpy(s_awc, L"First"); break;
  93. case JET_MovePrevious: wcscpy(s_awc, L"Previous"); break;
  94. case JET_MoveNext: wcscpy(s_awc, L"Next"); break;
  95. case JET_MoveLast: wcscpy(s_awc, L"Last"); break;
  96. default:
  97. wsprintf(s_awc, L"%d", cRow);
  98. break;
  99. }
  100. CSASSERT(wcslen(s_awc) < ARRAYSIZE(s_awc));
  101. return(s_awc);
  102. }
  103. WCHAR const *
  104. wszMovegrbit(
  105. JET_GRBIT grbit)
  106. {
  107. static WCHAR s_awc[16];
  108. if (JET_bitMoveKeyNE & grbit) wcscpy(s_awc, L"MoveKeyNE");
  109. if (0 == grbit) wcscpy(s_awc, L"0");
  110. CSASSERT(wcslen(s_awc) < ARRAYSIZE(s_awc));
  111. return(s_awc);
  112. }
  113. WCHAR const *
  114. wszSetIndexRangegrbit(
  115. JET_GRBIT grbit)
  116. {
  117. static WCHAR s_awc[64]; // 1 + 2 + 6 * 2 + 5 * 2 + 13
  118. wsprintf(s_awc, L"{%x", grbit);
  119. if (JET_bitRangeInclusive & grbit) dbgcat(s_awc, L"Inclusive");
  120. if (0 == ((JET_bitRangeInclusive | JET_bitRangeRemove) & grbit))
  121. dbgcat(s_awc, L"Exclusive");
  122. if (JET_bitRangeUpperLimit & grbit) dbgcat(s_awc, L"UpperLimit");
  123. if (0 == ((JET_bitRangeUpperLimit | JET_bitRangeRemove) & grbit))
  124. dbgcat(s_awc, L"LowerLimit");
  125. if (JET_bitRangeInstantDuration & grbit) dbgcat(s_awc, L"InstantDuration");
  126. if (JET_bitRangeRemove & grbit) dbgcat(s_awc, L"Remove");
  127. wcscat(s_awc, L"}");
  128. CSASSERT(wcslen(s_awc) < ARRAYSIZE(s_awc));
  129. return(s_awc);
  130. }
  131. WCHAR const *
  132. wszMakeKeygrbit(
  133. JET_GRBIT grbit)
  134. {
  135. static WCHAR s_awc[128];
  136. wsprintf(s_awc, L"{%x", grbit);
  137. if (JET_bitNewKey & grbit) dbgcat(s_awc, L"NewKey");
  138. if (JET_bitStrLimit & grbit) dbgcat(s_awc, L"StrLimit");
  139. if (JET_bitSubStrLimit & grbit) dbgcat(s_awc, L"SubStrLimit");
  140. if (JET_bitNormalizedKey & grbit) dbgcat(s_awc, L"NormalizedKey");
  141. if (JET_bitKeyDataZeroLength & grbit) dbgcat(s_awc, L"KeyDataZeroLength");
  142. wcscat(s_awc, L"}");
  143. CSASSERT(wcslen(s_awc) < ARRAYSIZE(s_awc));
  144. return(s_awc);
  145. }
  146. JET_ERR JET_API
  147. _dbgJetInit(
  148. JET_INSTANCE *pinstance)
  149. {
  150. JET_ERR jerr;
  151. jerr = JetInit(pinstance);
  152. DBGJET((DBG_SS_CERTJETI, "JetInit() --> %d\n", jerr));
  153. return(jerr);
  154. }
  155. JET_ERR JET_API
  156. _dbgJetTerm(
  157. JET_INSTANCE instance)
  158. {
  159. JET_ERR jerr;
  160. jerr = JetTerm(instance);
  161. DBGJET((DBG_SS_CERTJETI, "JetTerm() --> %d\n", jerr));
  162. return(jerr);
  163. }
  164. JET_ERR JET_API
  165. _dbgJetTerm2(
  166. JET_INSTANCE instance,
  167. JET_GRBIT grbit)
  168. {
  169. JET_ERR jerr;
  170. jerr = JetTerm2(instance, grbit);
  171. DBGJET((DBG_SS_CERTJETI, "JetTerm2() --> %d\n", jerr));
  172. return(jerr);
  173. }
  174. JET_ERR JET_API
  175. _dbgJetBackup(
  176. const char *szBackupPath,
  177. JET_GRBIT grbit,
  178. JET_PFNSTATUS pfnStatus)
  179. {
  180. JET_ERR jerr;
  181. jerr = JetBackup(szBackupPath, grbit, pfnStatus);
  182. DBGJET((
  183. DBG_SS_CERTJETI,
  184. "JetBackup(%hs, %x, %x) --> %d\n",
  185. szBackupPath,
  186. grbit,
  187. pfnStatus,
  188. jerr));
  189. return(jerr);
  190. }
  191. JET_ERR JET_API
  192. _dbgJetRestore(
  193. const char *sz,
  194. JET_PFNSTATUS pfn)
  195. {
  196. JET_ERR jerr;
  197. jerr = JetRestore(sz, pfn);
  198. DBGJET((DBG_SS_CERTJETI, "JetRestore(%hs, %x) --> %d\n", sz, pfn, jerr));
  199. return(jerr);
  200. }
  201. JET_ERR JET_API
  202. _dbgJetRestore2(
  203. const char *sz,
  204. const char *szDest,
  205. JET_PFNSTATUS pfn)
  206. {
  207. JET_ERR jerr;
  208. jerr = JetRestore2(sz, szDest, pfn);
  209. DBGJET((DBG_SS_CERTJETI, "JetRestore2(%hs, %hs, %x) --> %d\n", sz, szDest, pfn, jerr));
  210. return(jerr);
  211. }
  212. JET_ERR JET_API
  213. _dbgJetSetSystemParameter(
  214. JET_INSTANCE *pinstance,
  215. JET_SESID sesid,
  216. unsigned long paramid,
  217. unsigned long lParam,
  218. const char *sz)
  219. {
  220. JET_ERR jerr;
  221. char szlong[32];
  222. char const *sz2;
  223. sz2 = sz;
  224. if (NULL == sz2)
  225. {
  226. sprintf(szlong, "0x%x", lParam);
  227. sz2 = szlong;
  228. }
  229. jerr = JetSetSystemParameter(pinstance, sesid, paramid, lParam, sz);
  230. DBGJET((DBG_SS_CERTJETI, "JetSetSystemParameter(%x, %hs) --> %d\n", paramid, sz2, jerr));
  231. return(jerr);
  232. }
  233. JET_ERR JET_API
  234. _dbgJetBeginSession(
  235. JET_INSTANCE instance,
  236. JET_SESID *psesid,
  237. const char *szUserName,
  238. const char *szPassword)
  239. {
  240. JET_ERR jerr;
  241. jerr = JetBeginSession(instance, psesid, szUserName, szPassword);
  242. DBGJET((DBG_SS_CERTJETI, "JetBeginSession() --> %d\n", jerr));
  243. return(jerr);
  244. }
  245. JET_ERR JET_API
  246. _dbgJetEndSession(
  247. JET_SESID sesid,
  248. JET_GRBIT grbit)
  249. {
  250. JET_ERR jerr;
  251. jerr = JetEndSession(sesid, grbit);
  252. DBGJET((DBG_SS_CERTJETI, "JetEndSession() --> %d\n", jerr));
  253. return(jerr);
  254. }
  255. JET_ERR JET_API
  256. _dbgJetCreateDatabase(
  257. JET_SESID sesid,
  258. const char *szFilename,
  259. const char *szConnect,
  260. JET_DBID *pdbid,
  261. JET_GRBIT grbit)
  262. {
  263. JET_ERR jerr;
  264. jerr = JetCreateDatabase(sesid, szFilename, szConnect, pdbid, grbit);
  265. DBGJET((DBG_SS_CERTJETI, "JetCreateDatabase() --> %d\n", jerr));
  266. return(jerr);
  267. }
  268. JET_ERR JET_API
  269. _dbgJetCreateTable(
  270. JET_SESID sesid,
  271. JET_DBID dbid,
  272. const char *szTableName,
  273. unsigned long lPages,
  274. unsigned long lDensity,
  275. JET_TABLEID *ptableid)
  276. {
  277. JET_ERR jerr;
  278. jerr = JetCreateTable(
  279. sesid,
  280. dbid,
  281. szTableName,
  282. lPages,
  283. lDensity,
  284. ptableid);
  285. DBGJET((DBG_SS_CERTJETI, "JetCreateTable(%hs):%x --> %d\n", szTableName, TableIndex(*ptableid), jerr));
  286. return(jerr);
  287. }
  288. JET_ERR JET_API
  289. _dbgJetGetColumnInfo(
  290. JET_SESID sesid,
  291. JET_DBID dbid,
  292. const char *szTableName,
  293. const char *szColumnName,
  294. void *pvResult,
  295. unsigned long cbMax,
  296. unsigned long InfoLevel)
  297. {
  298. JET_ERR jerr;
  299. jerr = JetGetColumnInfo(
  300. sesid,
  301. dbid,
  302. szTableName,
  303. szColumnName,
  304. pvResult,
  305. cbMax,
  306. InfoLevel);
  307. DBGJET((DBG_SS_CERTJETI, "JetGetColumnInfo(%hs, %hs, %x) --> %d\n", szTableName, szColumnName, InfoLevel, jerr));
  308. return(jerr);
  309. }
  310. JET_ERR JET_API
  311. _dbgJetConvertDDL(
  312. JET_SESID sesid,
  313. JET_DBID ifmp,
  314. JET_OPDDLCONV convtyp,
  315. void *pvData,
  316. unsigned long cbData)
  317. {
  318. JET_ERR jerr;
  319. jerr = JetConvertDDL(sesid, ifmp, convtyp, pvData, cbData);
  320. if (opDDLConvIncreaseMaxColumnSize == convtyp)
  321. {
  322. JET_DDLMAXCOLUMNSIZE *pjdmcs = (JET_DDLMAXCOLUMNSIZE *) pvData;
  323. DBGJET((DBG_SS_CERTJETI, "JetConvertDDL(%hs, %hs, %x) --> %d\n", pjdmcs->szTable, pjdmcs->szColumn, pjdmcs->cbMax, jerr));
  324. }
  325. else
  326. {
  327. DBGJET((DBG_SS_CERTJETI, "JetConvertDDL(%x, %p, %x) --> %d\n", convtyp, pvData, cbData, jerr));
  328. }
  329. return(jerr);
  330. }
  331. JET_ERR JET_API
  332. _dbgJetAddColumn(
  333. JET_SESID sesid,
  334. JET_TABLEID tableid,
  335. const char *szColumn,
  336. const JET_COLUMNDEF *pcolumndef,
  337. const void *pvDefault,
  338. unsigned long cbDefault,
  339. JET_COLUMNID *pcolumnid)
  340. {
  341. JET_ERR jerr;
  342. jerr = JetAddColumn(
  343. sesid,
  344. tableid,
  345. szColumn,
  346. pcolumndef,
  347. pvDefault,
  348. cbDefault,
  349. pcolumnid);
  350. DBGJET((DBG_SS_CERTJETI, "JetAddColumn(%x, %hs):%x --> %d\n", TableIndex(tableid), szColumn, *pcolumnid, jerr));
  351. return(jerr);
  352. }
  353. JET_ERR JET_API
  354. _dbgJetDeleteColumn(
  355. JET_SESID sesid,
  356. JET_TABLEID tableid,
  357. const char *szColumnName)
  358. {
  359. JET_ERR jerr;
  360. jerr = JetDeleteColumn(sesid, tableid, szColumnName);
  361. DBGJET((DBG_SS_CERTJETI, "JetDeleteColumn(%x, %hs) --> %d\n", TableIndex(tableid), szColumnName, jerr));
  362. return(jerr);
  363. }
  364. JET_ERR JET_API
  365. _dbgJetCreateIndex(
  366. JET_SESID sesid,
  367. JET_TABLEID tableid,
  368. const char *szIndexName,
  369. JET_GRBIT grbit,
  370. const char *szKey,
  371. unsigned long cbKey,
  372. unsigned long lDensity)
  373. {
  374. JET_ERR jerr;
  375. jerr = JetCreateIndex(
  376. sesid,
  377. tableid,
  378. szIndexName,
  379. grbit,
  380. szKey,
  381. cbKey,
  382. lDensity);
  383. DBGJET((DBG_SS_CERTJETI, "JetCreateIndex(%x, %hs, %x) --> %d\n", TableIndex(tableid), szIndexName, grbit, jerr));
  384. return(jerr);
  385. }
  386. JET_ERR JET_API
  387. _dbgJetDeleteIndex(
  388. JET_SESID sesid,
  389. JET_TABLEID tableid,
  390. const char *szIndexName)
  391. {
  392. JET_ERR jerr;
  393. jerr = JetDeleteIndex(sesid, tableid, szIndexName);
  394. DBGJET((DBG_SS_CERTJETI, "JetDeleteIndex(%x, %hs) --> %d\n", TableIndex(tableid), szIndexName, jerr));
  395. return(jerr);
  396. }
  397. JET_ERR JET_API
  398. _dbgJetBeginTransaction(
  399. JET_SESID sesid)
  400. {
  401. JET_ERR jerr;
  402. jerr = JetBeginTransaction(sesid);
  403. DBGJET((DBG_SS_CERTJETI, "JetBeginTransaction() --> %d\n", jerr));
  404. return(jerr);
  405. }
  406. JET_ERR JET_API
  407. _dbgJetCommitTransaction(
  408. JET_SESID sesid,
  409. JET_GRBIT grbit)
  410. {
  411. JET_ERR jerr;
  412. jerr = JetCommitTransaction(sesid, grbit);
  413. DBGJET((DBG_SS_CERTJETI, "JetCommitTransaction(%x) --> %d\n", grbit, jerr));
  414. return(jerr);
  415. }
  416. JET_ERR JET_API
  417. _dbgJetRollback(
  418. JET_SESID sesid,
  419. JET_GRBIT grbit)
  420. {
  421. JET_ERR jerr;
  422. jerr = JetRollback(sesid, grbit);
  423. DBGJET((DBG_SS_CERTJETI, "JetRollback(%x) --> %d\n", grbit, jerr));
  424. return(jerr);
  425. }
  426. JET_ERR JET_API
  427. _dbgJetOpenDatabase(
  428. JET_SESID sesid,
  429. const char *szFilename,
  430. const char *szConnect,
  431. JET_DBID *pdbid,
  432. JET_GRBIT grbit)
  433. {
  434. JET_ERR jerr;
  435. jerr = JetOpenDatabase(sesid, szFilename, szConnect, pdbid, grbit);
  436. DBGJET((
  437. DBG_SS_CERTJETI,
  438. "JetOpenDatabase(%hs, %ws):%x --> %d\n",
  439. szFilename,
  440. wszOpenDatabase(grbit),
  441. *pdbid,
  442. jerr));
  443. return(jerr);
  444. }
  445. JET_ERR JET_API
  446. _dbgJetAttachDatabase(
  447. JET_SESID sesid,
  448. const char *szFilename,
  449. JET_GRBIT grbit)
  450. {
  451. JET_ERR jerr;
  452. jerr = JetAttachDatabase(sesid, szFilename, grbit);
  453. DBGJET((
  454. DBG_SS_CERTJETI,
  455. "JetAttachDatabase(%hs, %ws) --> %d\n",
  456. szFilename,
  457. wszAttachDatabase(grbit),
  458. jerr));
  459. return(jerr);
  460. }
  461. JET_ERR JET_API
  462. _dbgJetCloseDatabase(
  463. JET_SESID sesid,
  464. JET_DBID dbid,
  465. JET_GRBIT grbit)
  466. {
  467. JET_ERR jerr;
  468. jerr = JetCloseDatabase(sesid, dbid, grbit);
  469. DBGJET((DBG_SS_CERTJETI, "JetCloseDatabase() --> %d\n", jerr));
  470. return(jerr);
  471. }
  472. JET_ERR JET_API
  473. _dbgJetOpenTable(
  474. JET_SESID sesid,
  475. JET_DBID dbid,
  476. const char *szTableName,
  477. const void *pvParameters,
  478. unsigned long cbParameters,
  479. JET_GRBIT grbit,
  480. JET_TABLEID *ptableid)
  481. {
  482. JET_ERR jerr;
  483. jerr = JetOpenTable(
  484. sesid,
  485. dbid,
  486. szTableName,
  487. pvParameters,
  488. cbParameters,
  489. grbit,
  490. ptableid);
  491. DBGJET((DBG_SS_CERTJETI, "JetOpenTable(%hs):%x --> %d\n", szTableName, TableIndex(*ptableid), jerr));
  492. return(jerr);
  493. }
  494. JET_ERR JET_API
  495. _dbgJetCloseTable(
  496. JET_SESID sesid,
  497. JET_TABLEID tableid)
  498. {
  499. JET_ERR jerr;
  500. jerr = JetCloseTable(sesid, tableid);
  501. DBGJET((DBG_SS_CERTJETI, "JetCloseTable(%x) --> %d\n", TableIndex(tableid), jerr));
  502. return(jerr);
  503. }
  504. JET_ERR JET_API
  505. _dbgJetUpdate(
  506. JET_SESID sesid,
  507. JET_TABLEID tableid,
  508. void *pvBookmark,
  509. unsigned long cbBookmark,
  510. unsigned long *pcbActual)
  511. {
  512. JET_ERR jerr;
  513. jerr = JetUpdate(sesid, tableid, pvBookmark, cbBookmark, pcbActual);
  514. DBGJET((DBG_SS_CERTJETI, "JetUpdate(%x) --> %d\n", TableIndex(tableid), jerr));
  515. return(jerr);
  516. }
  517. JET_ERR JET_API
  518. _dbgJetDelete(
  519. JET_SESID sesid,
  520. JET_TABLEID tableid)
  521. {
  522. JET_ERR jerr;
  523. jerr = JetDelete(sesid, tableid);
  524. DBGJET((DBG_SS_CERTJETI, "JetDelete(%x) --> %d\n", TableIndex(tableid), jerr));
  525. return(jerr);
  526. }
  527. JET_ERR JET_API
  528. _dbgJetRetrieveColumn(
  529. JET_SESID sesid,
  530. JET_TABLEID tableid,
  531. JET_COLUMNID columnid,
  532. void *pvData,
  533. unsigned long cbData,
  534. unsigned long *pcbActual,
  535. JET_GRBIT grbit,
  536. JET_RETINFO *pretinfo)
  537. {
  538. JET_ERR jerr;
  539. jerr = JetRetrieveColumn(
  540. sesid,
  541. tableid,
  542. columnid,
  543. pvData,
  544. cbData,
  545. pcbActual,
  546. grbit,
  547. pretinfo);
  548. DBGJET((
  549. DBG_SS_CERTJETI,
  550. "JetRetrieveColumn(%x, %x, %x) cb:%x->%x--> %d\n",
  551. TableIndex(tableid),
  552. columnid,
  553. grbit,
  554. cbData,
  555. *pcbActual,
  556. jerr));
  557. if (NULL != pvData)
  558. {
  559. DBGJETDUMPHEX(jerr, 0, (BYTE const *) pvData, min(cbData, *pcbActual));
  560. }
  561. return(jerr);
  562. }
  563. JET_ERR JET_API
  564. _dbgJetSetColumn(
  565. JET_SESID sesid,
  566. JET_TABLEID tableid,
  567. JET_COLUMNID columnid,
  568. const void *pvData,
  569. unsigned long cbData,
  570. JET_GRBIT grbit,
  571. JET_SETINFO *psetinfo)
  572. {
  573. JET_ERR jerr;
  574. jerr = JetSetColumn(
  575. sesid,
  576. tableid,
  577. columnid,
  578. pvData,
  579. cbData,
  580. grbit,
  581. psetinfo);
  582. DBGJET((
  583. DBG_SS_CERTJETI,
  584. "JetSetColumn(%x, %x, %x) cb:%x --> %d\n",
  585. TableIndex(tableid),
  586. columnid,
  587. grbit,
  588. cbData,
  589. jerr));
  590. DBGJETDUMPHEX(jerr, 0, (BYTE const *) pvData, cbData);
  591. return(jerr);
  592. }
  593. JET_ERR JET_API
  594. _dbgJetPrepareUpdate(
  595. JET_SESID sesid,
  596. JET_TABLEID tableid,
  597. unsigned long prep)
  598. {
  599. JET_ERR jerr;
  600. jerr = JetPrepareUpdate(sesid, tableid, prep);
  601. DBGJET((DBG_SS_CERTJETI, "JetPrepareUpdate(%x, %x) --> %d\n", TableIndex(tableid), prep, jerr));
  602. return(jerr);
  603. }
  604. JET_ERR JET_API
  605. _dbgJetSetCurrentIndex2(
  606. JET_SESID sesid,
  607. JET_TABLEID tableid,
  608. const char *szIndexName,
  609. JET_GRBIT grbit)
  610. {
  611. JET_ERR jerr;
  612. jerr = JetSetCurrentIndex2(sesid, tableid, szIndexName, grbit);
  613. DBGJET((DBG_SS_CERTJETI, "JetSetCurrentIndex2(%x) --> %d\n", TableIndex(tableid), jerr));
  614. return(jerr);
  615. }
  616. JET_ERR JET_API
  617. _dbgJetMove(
  618. JET_SESID sesid,
  619. JET_TABLEID tableid,
  620. long cRow,
  621. JET_GRBIT grbit)
  622. {
  623. JET_ERR jerr;
  624. jerr = JetMove(sesid, tableid, cRow, grbit);
  625. DBGJET((
  626. DBG_SS_CERTJETI,
  627. "JetMove(%x, %ws, %ws) --> %d\n",
  628. TableIndex(tableid),
  629. wszMovecrow(cRow),
  630. wszMovegrbit(grbit),
  631. jerr));
  632. return(jerr);
  633. }
  634. JET_ERR JET_API
  635. _dbgJetMakeKey(
  636. JET_SESID sesid,
  637. JET_TABLEID tableid,
  638. const void *pvData,
  639. unsigned long cbData,
  640. JET_GRBIT grbit)
  641. {
  642. JET_ERR jerr;
  643. jerr = JetMakeKey(sesid, tableid, pvData, cbData, grbit);
  644. DBGJET((
  645. DBG_SS_CERTJETI,
  646. "JetMakeKey(%x, %ws) --> %d\n",
  647. TableIndex(tableid),
  648. wszMakeKeygrbit(grbit),
  649. jerr));
  650. DBGJETDUMPHEX(jerr, 0, (BYTE const *) pvData, cbData);
  651. return(jerr);
  652. }
  653. JET_ERR JET_API
  654. _dbgJetSeek(
  655. JET_SESID sesid,
  656. JET_TABLEID tableid,
  657. JET_GRBIT grbit)
  658. {
  659. JET_ERR jerr;
  660. jerr = JetSeek(sesid, tableid, grbit);
  661. DBGJET((
  662. DBG_SS_CERTJETI,
  663. "JetSeek(%x, %ws) --> %d\n",
  664. TableIndex(tableid),
  665. wszSeekgrbit(grbit),
  666. jerr));
  667. return(jerr);
  668. }
  669. JET_ERR JET_API
  670. _dbgJetBeginExternalBackup(
  671. JET_GRBIT grbit)
  672. {
  673. JET_ERR jerr;
  674. jerr = JetBeginExternalBackup(grbit);
  675. DBGJET((DBG_SS_CERTJETI, "JetBeginExternalBackup(%x) --> %d\n", grbit, jerr));
  676. return(jerr);
  677. }
  678. JET_ERR JET_API
  679. _dbgJetGetAttachInfo(
  680. void *pv,
  681. unsigned long cbMax,
  682. unsigned long *pcbActual)
  683. {
  684. JET_ERR jerr;
  685. jerr = JetGetAttachInfo(pv, cbMax, pcbActual);
  686. DBGJET((
  687. DBG_SS_CERTJETI,
  688. "JetGetAttachInfo(%x, %x, -> %x) --> %d\n",
  689. pv,
  690. cbMax,
  691. *pcbActual,
  692. jerr));
  693. if (NULL != pv)
  694. {
  695. DBGJETDUMPHEX(jerr, 0, (BYTE const *) pv, min(cbMax, *pcbActual));
  696. }
  697. return(jerr);
  698. }
  699. JET_ERR JET_API
  700. _dbgJetOpenFile(
  701. const char *szFileName,
  702. JET_HANDLE *phfFile,
  703. unsigned long *pulFileSizeLow,
  704. unsigned long *pulFileSizeHigh)
  705. {
  706. JET_ERR jerr;
  707. jerr = JetOpenFile(szFileName, phfFile, pulFileSizeLow, pulFileSizeHigh);
  708. DBGJET((
  709. DBG_SS_CERTJETI,
  710. "JetOpenFile(%hs, -> %x, %x, %x) --> %d\n",
  711. szFileName,
  712. *phfFile,
  713. *pulFileSizeLow,
  714. *pulFileSizeHigh,
  715. jerr));
  716. return(jerr);
  717. }
  718. JET_ERR JET_API
  719. _dbgJetReadFile(
  720. JET_HANDLE hfFile,
  721. void *pv,
  722. unsigned long cb,
  723. unsigned long *pcb)
  724. {
  725. JET_ERR jerr;
  726. jerr = JetReadFile(hfFile, pv, cb, pcb);
  727. DBGJET((
  728. DBG_SS_CERTJETI,
  729. "JetReadFile(%x, %x, %x, -> %x) --> %d\n",
  730. hfFile,
  731. pv,
  732. cb,
  733. *pcb,
  734. jerr));
  735. return(jerr);
  736. }
  737. #if 0
  738. JET_ERR JET_API
  739. _dbgJetAsyncReadFile(
  740. JET_HANDLE hfFile,
  741. void* pv,
  742. unsigned long cb,
  743. JET_OLP *pjolp)
  744. {
  745. JET_ERR jerr;
  746. jerr = JetAsyncReadFile(hfFile, pv, cb, pjolp);
  747. DBGJET((
  748. DBG_SS_CERTJETI,
  749. "JetAsyncReadFile(%x, %x, %x, %x) --> %d\n",
  750. hfFile,
  751. pv,
  752. cb,
  753. pjolp,
  754. jerr));
  755. return(jerr);
  756. }
  757. JET_ERR JET_API
  758. _dbgJetCheckAsyncReadFile(
  759. void *pv,
  760. int cb,
  761. unsigned long pgnoFirst)
  762. {
  763. JET_ERR jerr;
  764. jerr = JetCheckAsyncReadFile(pv, cb, pgnoFirst);
  765. DBGJET((
  766. DBG_SS_CERTJETI,
  767. "JetCheckAsyncReadFile(%x, %x, %x) --> %d\n",
  768. pv,
  769. cb,
  770. pgnoFirst,
  771. jerr));
  772. return(jerr);
  773. }
  774. #endif
  775. JET_ERR JET_API
  776. _dbgJetCloseFile(
  777. JET_HANDLE hfFile)
  778. {
  779. JET_ERR jerr;
  780. jerr = JetCloseFile(hfFile);
  781. DBGJET((DBG_SS_CERTJETI, "JetCloseFile(%x) --> %d\n", hfFile, jerr));
  782. return(jerr);
  783. }
  784. JET_ERR JET_API
  785. _dbgJetGetLogInfo(
  786. void *pv,
  787. unsigned long cbMax,
  788. unsigned long *pcbActual)
  789. {
  790. JET_ERR jerr;
  791. jerr = JetGetLogInfo(pv, cbMax, pcbActual);
  792. DBGJET((
  793. DBG_SS_CERTJETI,
  794. "JetGetLogInfo(%x, %x, %x, -> %x) --> %d\n",
  795. pv,
  796. cbMax,
  797. *pcbActual,
  798. jerr));
  799. if (NULL != pv)
  800. {
  801. DBGJETDUMPHEX(jerr, 0, (BYTE const *) pv, min(cbMax, *pcbActual));
  802. }
  803. return(jerr);
  804. }
  805. JET_ERR JET_API
  806. _dbgJetTruncateLog(void)
  807. {
  808. JET_ERR jerr;
  809. jerr = JetTruncateLog();
  810. DBGJET((DBG_SS_CERTJETI, "JetTruncateLog() --> %d\n", jerr));
  811. return(jerr);
  812. }
  813. JET_ERR JET_API
  814. _dbgJetEndExternalBackup(void)
  815. {
  816. JET_ERR jerr;
  817. jerr = JetEndExternalBackup();
  818. DBGJET((DBG_SS_CERTJETI, "JetEndExternalBackup() --> %d\n", jerr));
  819. return(jerr);
  820. }
  821. JET_ERR JET_API
  822. _dbgJetExternalRestore(
  823. char *szCheckpointFilePath,
  824. char *szLogPath,
  825. JET_RSTMAP *rgstmap,
  826. long crstfilemap,
  827. char *szBackupLogPath,
  828. long genLow,
  829. long genHigh,
  830. JET_PFNSTATUS pfn)
  831. {
  832. JET_ERR jerr;
  833. jerr = JetExternalRestore(
  834. szCheckpointFilePath,
  835. szLogPath,
  836. rgstmap,
  837. crstfilemap,
  838. szBackupLogPath,
  839. genLow,
  840. genHigh,
  841. pfn);
  842. DBGJET((
  843. DBG_SS_CERTJETI,
  844. "JetExternalRestore(%hs, %hs, %x, %x, %hs, %x, %x, %x) --> %d\n",
  845. szCheckpointFilePath,
  846. szLogPath,
  847. rgstmap,
  848. crstfilemap,
  849. szBackupLogPath,
  850. genLow,
  851. genHigh,
  852. pfn,
  853. jerr));
  854. return(jerr);
  855. }
  856. JET_ERR JET_API
  857. _dbgJetSetIndexRange(
  858. JET_SESID sesid,
  859. JET_TABLEID tableid,
  860. JET_GRBIT grbit)
  861. {
  862. JET_ERR jerr;
  863. jerr = JetSetIndexRange(sesid, tableid, grbit);
  864. DBGJET((
  865. DBG_SS_CERTJETI,
  866. "JetSetIndexRange(%x, %ws) --> %d\n",
  867. TableIndex(tableid),
  868. wszSetIndexRangegrbit(grbit),
  869. jerr));
  870. return(jerr);
  871. }
  872. JET_ERR JET_API
  873. _dbgJetRetrieveKey(
  874. JET_SESID sesid,
  875. JET_TABLEID tableid,
  876. void *pvData,
  877. unsigned long cbData,
  878. unsigned long *pcbActual,
  879. JET_GRBIT grbit)
  880. {
  881. JET_ERR jerr;
  882. jerr = JetRetrieveKey(sesid, tableid, pvData, cbData, pcbActual, grbit);
  883. DBGJET((
  884. DBG_SS_CERTJETI,
  885. "JetRetrieveKey(%x, %x, -> %x) --> %d\n",
  886. TableIndex(tableid),
  887. cbData,
  888. *pcbActual,
  889. jerr));
  890. DBGJETDUMPHEX(jerr, 0, (BYTE const *) pvData, min(*pcbActual, cbData));
  891. return(jerr);
  892. }
  893. #endif DBG