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.

891 lines
13 KiB

  1. #include "windows.h"
  2. #include "sql.h"
  3. #ifdef __cplusplus
  4. extern "C" { // Assume C declarations for C++
  5. #endif // __cplusplus
  6. #ifndef ODBCVER
  7. #define ODBCVER 0x0351 // Assume ODBC 3.51
  8. #endif
  9. #ifndef WINVER
  10. #define WINVER 0x0400 // Assume Windows 4.0
  11. #endif
  12. // Constants ---------------------------------------------------------------
  13. // SQLConfigDataSource request flags
  14. #define ODBC_ADD_DSN 1 // Add data source
  15. #define ODBC_CONFIG_DSN 2 // Configure (edit) data source
  16. #define ODBC_REMOVE_DSN 3 // Remove data source
  17. #if (ODBCVER >= 0x0250)
  18. #define ODBC_ADD_SYS_DSN 4 // add a system DSN
  19. #define ODBC_CONFIG_SYS_DSN 5 // Configure a system DSN
  20. #define ODBC_REMOVE_SYS_DSN 6 // remove a system DSN
  21. #if (ODBCVER >= 0x0300)
  22. #define ODBC_REMOVE_DEFAULT_DSN 7 // remove the default DSN
  23. #endif /* ODBCVER >= 0x0300 */
  24. // install request flags
  25. #define ODBC_INSTALL_INQUIRY 1
  26. #define ODBC_INSTALL_COMPLETE 2
  27. // config driver flags
  28. #define ODBC_INSTALL_DRIVER 1
  29. #define ODBC_REMOVE_DRIVER 2
  30. #define ODBC_CONFIG_DRIVER 3
  31. #define ODBC_CONFIG_DRIVER_MAX 100
  32. #endif
  33. // SQLGetConfigMode and SQLSetConfigMode flags
  34. #if (ODBCVER >= 0x0300)
  35. #define ODBC_BOTH_DSN 0
  36. #define ODBC_USER_DSN 1
  37. #define ODBC_SYSTEM_DSN 2
  38. #endif /* ODBCVER >= 0x0300 */
  39. // SQLInstallerError code
  40. #if (ODBCVER >= 0x0300)
  41. #define ODBC_ERROR_GENERAL_ERR 1
  42. #define ODBC_ERROR_INVALID_BUFF_LEN 2
  43. #define ODBC_ERROR_INVALID_HWND 3
  44. #define ODBC_ERROR_INVALID_STR 4
  45. #define ODBC_ERROR_INVALID_REQUEST_TYPE 5
  46. #define ODBC_ERROR_COMPONENT_NOT_FOUND 6
  47. #define ODBC_ERROR_INVALID_NAME 7
  48. #define ODBC_ERROR_INVALID_KEYWORD_VALUE 8
  49. #define ODBC_ERROR_INVALID_DSN 9
  50. #define ODBC_ERROR_INVALID_INF 10
  51. #define ODBC_ERROR_REQUEST_FAILED 11
  52. #define ODBC_ERROR_INVALID_PATH 12
  53. #define ODBC_ERROR_LOAD_LIB_FAILED 13
  54. #define ODBC_ERROR_INVALID_PARAM_SEQUENCE 14
  55. #define ODBC_ERROR_INVALID_LOG_FILE 15
  56. #define ODBC_ERROR_USER_CANCELED 16
  57. #define ODBC_ERROR_USAGE_UPDATE_FAILED 17
  58. #define ODBC_ERROR_CREATE_DSN_FAILED 18
  59. #define ODBC_ERROR_WRITING_SYSINFO_FAILED 19
  60. #define ODBC_ERROR_REMOVE_DSN_FAILED 20
  61. #define ODBC_ERROR_OUT_OF_MEM 21
  62. #define ODBC_ERROR_OUTPUT_STRING_TRUNCATED 22
  63. #endif /* ODBCVER >= 0x0300 */
  64. #ifndef EXPORT
  65. #define EXPORT
  66. #endif
  67. #ifndef RC_INVOKED
  68. // Prototypes --------------------------------------------------------------
  69. #define INSTAPI __stdcall
  70. // High level APIs
  71. BOOL
  72. INSTAPI
  73. SQLInstallODBC (
  74. HWND hwndParent,
  75. LPCSTR lpszInfFile,
  76. LPCSTR lpszSrcPath,
  77. LPCSTR lpszDrivers
  78. )
  79. {
  80. return FALSE;
  81. }
  82. BOOL
  83. INSTAPI
  84. SQLManageDataSources (
  85. HWND hwndParent
  86. )
  87. {
  88. return FALSE;
  89. }
  90. BOOL
  91. INSTAPI
  92. SQLCreateDataSource (
  93. HWND hwndParent,
  94. LPCSTR lpszDSN
  95. )
  96. {
  97. return FALSE;
  98. }
  99. BOOL
  100. INSTAPI
  101. SQLGetTranslator (
  102. HWND hwnd,
  103. LPSTR lpszName,
  104. WORD cbNameMax,
  105. WORD *pcbNameOut,
  106. LPSTR lpszPath,
  107. WORD cbPathMax,
  108. WORD *pcbPathOut,
  109. DWORD *pvOption
  110. )
  111. {
  112. return FALSE;
  113. }
  114. // Low level APIs
  115. BOOL
  116. INSTAPI
  117. SQLInstallDriver (
  118. LPCSTR lpszInfFile,
  119. LPCSTR lpszDriver,
  120. LPSTR lpszPath,
  121. WORD cbPathMax,
  122. WORD *pcbPathOut
  123. )
  124. {
  125. return FALSE;
  126. }
  127. BOOL
  128. INSTAPI
  129. SQLInstallDriverManager (
  130. LPSTR lpszPath,
  131. WORD cbPathMax,
  132. WORD *pcbPathOut
  133. )
  134. {
  135. return FALSE;
  136. }
  137. BOOL
  138. INSTAPI
  139. SQLGetInstalledDrivers (
  140. LPSTR lpszBuf,
  141. WORD cbBufMax,
  142. WORD *pcbBufOut
  143. )
  144. {
  145. return FALSE;
  146. }
  147. BOOL
  148. INSTAPI
  149. SQLGetAvailableDrivers (
  150. LPCSTR lpszInfFile,
  151. LPSTR lpszBuf,
  152. WORD cbBufMax,
  153. WORD *pcbBufOut
  154. )
  155. {
  156. return FALSE;
  157. }
  158. BOOL
  159. INSTAPI
  160. SQLConfigDataSource (
  161. HWND hwndParent,
  162. WORD fRequest,
  163. LPCSTR lpszDriver,
  164. LPCSTR lpszAttributes
  165. )
  166. {
  167. return FALSE;
  168. }
  169. BOOL
  170. INSTAPI
  171. SQLRemoveDefaultDataSource (
  172. void
  173. )
  174. {
  175. return FALSE;
  176. }
  177. BOOL
  178. INSTAPI
  179. SQLWriteDSNToIni (
  180. LPCSTR lpszDSN,
  181. LPCSTR lpszDriver
  182. )
  183. {
  184. return FALSE;
  185. }
  186. BOOL
  187. INSTAPI
  188. SQLRemoveDSNFromIni (
  189. LPCSTR lpszDSN
  190. )
  191. {
  192. return FALSE;
  193. }
  194. BOOL
  195. INSTAPI
  196. SQLValidDSN (
  197. LPCSTR lpszDSN
  198. )
  199. {
  200. return FALSE;
  201. }
  202. BOOL
  203. INSTAPI
  204. SQLWritePrivateProfileString (
  205. LPCSTR lpszSection,
  206. LPCSTR lpszEntry,
  207. LPCSTR lpszString,
  208. LPCSTR lpszFilename
  209. )
  210. {
  211. return FALSE;
  212. }
  213. int
  214. INSTAPI
  215. SQLGetPrivateProfileString (
  216. LPCSTR lpszSection,
  217. LPCSTR lpszEntry,
  218. LPCSTR lpszDefault,
  219. LPSTR lpszRetBuffer,
  220. int cbRetBuffer,
  221. LPCSTR lpszFilename
  222. )
  223. {
  224. return 0;
  225. }
  226. #if (ODBCVER >= 0x0250)
  227. BOOL
  228. INSTAPI
  229. SQLRemoveDriverManager (
  230. LPDWORD lpdwUsageCount
  231. )
  232. {
  233. return FALSE;
  234. }
  235. BOOL
  236. INSTAPI
  237. SQLInstallTranslator (
  238. LPCSTR lpszInfFile,
  239. LPCSTR lpszTranslator,
  240. LPCSTR lpszPathIn,
  241. LPSTR lpszPathOut,
  242. WORD cbPathOutMax,
  243. WORD *pcbPathOut,
  244. WORD fRequest,
  245. LPDWORD lpdwUsageCount
  246. )
  247. {
  248. return FALSE;
  249. }
  250. BOOL
  251. INSTAPI
  252. SQLRemoveTranslator (
  253. LPCSTR lpszTranslator,
  254. LPDWORD lpdwUsageCount
  255. )
  256. {
  257. return FALSE;
  258. }
  259. BOOL
  260. INSTAPI
  261. SQLRemoveDriver (
  262. LPCSTR lpszDriver,
  263. BOOL fRemoveDSN,
  264. LPDWORD lpdwUsageCount
  265. )
  266. {
  267. return FALSE;
  268. }
  269. BOOL
  270. INSTAPI
  271. SQLConfigDriver (
  272. HWND hwndParent,
  273. WORD fRequest,
  274. LPCSTR lpszDriver,
  275. LPCSTR lpszArgs,
  276. LPSTR lpszMsg,
  277. WORD cbMsgMax,
  278. WORD *pcbMsgOut
  279. )
  280. {
  281. return FALSE;
  282. }
  283. #endif
  284. #if (ODBCVER >= 0x0300)
  285. SQLRETURN
  286. INSTAPI
  287. SQLInstallerError (
  288. WORD iError,
  289. DWORD *pfErrorCode,
  290. LPSTR lpszErrorMsg,
  291. WORD cbErrorMsgMax,
  292. WORD *pcbErrorMsg
  293. )
  294. {
  295. return 0;
  296. }
  297. SQLRETURN
  298. INSTAPI
  299. SQLPostInstallerError (
  300. DWORD dwErrorCode,
  301. LPCSTR lpszErrMsg
  302. )
  303. {
  304. return 0;
  305. }
  306. BOOL
  307. INSTAPI
  308. SQLWriteFileDSN (
  309. LPCSTR lpszFileName,
  310. LPCSTR lpszAppName,
  311. LPCSTR lpszKeyName,
  312. LPCSTR lpszString
  313. )
  314. {
  315. return FALSE;
  316. }
  317. BOOL
  318. INSTAPI
  319. SQLReadFileDSN (
  320. LPCSTR lpszFileName,
  321. LPCSTR lpszAppName,
  322. LPCSTR lpszKeyName,
  323. LPSTR lpszString,
  324. WORD cbString,
  325. WORD *pcbString
  326. )
  327. {
  328. return FALSE;
  329. }
  330. BOOL
  331. INSTAPI
  332. SQLInstallDriverEx (
  333. LPCSTR lpszDriver,
  334. LPCSTR lpszPathIn,
  335. LPSTR lpszPathOut,
  336. WORD cbPathOutMax,
  337. WORD *pcbPathOut,
  338. WORD fRequest,
  339. LPDWORD lpdwUsageCount
  340. )
  341. {
  342. return FALSE;
  343. }
  344. BOOL
  345. INSTAPI
  346. SQLInstallTranslatorEx (
  347. LPCSTR lpszTranslator,
  348. LPCSTR lpszPathIn,
  349. LPSTR lpszPathOut,
  350. WORD cbPathOutMax,
  351. WORD *pcbPathOut,
  352. WORD fRequest,
  353. LPDWORD lpdwUsageCount
  354. )
  355. {
  356. return FALSE;
  357. }
  358. BOOL
  359. INSTAPI
  360. SQLGetConfigMode (
  361. UWORD *pwConfigMode
  362. )
  363. {
  364. return FALSE;
  365. }
  366. BOOL
  367. INSTAPI
  368. SQLSetConfigMode (
  369. UWORD wConfigMode
  370. )
  371. {
  372. return FALSE;
  373. }
  374. #endif /* ODBCVER >= 0x0300 */
  375. // Driver specific Setup APIs called by installer
  376. BOOL
  377. INSTAPI
  378. ConfigDSN (
  379. HWND hwndParent,
  380. WORD fRequest,
  381. LPCSTR lpszDriver,
  382. LPCSTR lpszAttributes
  383. )
  384. {
  385. return FALSE;
  386. }
  387. BOOL
  388. INSTAPI
  389. ConfigTranslator (
  390. HWND hwndParent,
  391. DWORD *pvOption
  392. )
  393. {
  394. return FALSE;
  395. }
  396. #if (ODBCVER >= 0x0250)
  397. BOOL
  398. INSTAPI
  399. ConfigDriver (
  400. HWND hwndParent,
  401. WORD fRequest,
  402. LPCSTR lpszDriver,
  403. LPCSTR lpszArgs,
  404. LPSTR lpszMsg,
  405. WORD cbMsgMax,
  406. WORD *pcbMsgOut
  407. )
  408. {
  409. return FALSE;
  410. }
  411. #endif
  412. // UNICODE APIs
  413. // High level APIs
  414. BOOL
  415. INSTAPI
  416. SQLInstallODBCW (
  417. HWND hwndParent,
  418. LPCWSTR lpszInfFile,
  419. LPCWSTR lpszSrcPath,
  420. LPCWSTR lpszDrivers
  421. )
  422. {
  423. return FALSE;
  424. }
  425. BOOL
  426. INSTAPI
  427. SQLCreateDataSourceW (
  428. HWND hwndParent,
  429. LPCWSTR lpszDSN
  430. )
  431. {
  432. return FALSE;
  433. }
  434. BOOL
  435. INSTAPI
  436. SQLGetTranslatorW (
  437. HWND hwnd,
  438. LPWSTR lpszName,
  439. WORD cbNameMax,
  440. WORD *pcbNameOut,
  441. LPWSTR lpszPath,
  442. WORD cbPathMax,
  443. WORD *pcbPathOut,
  444. DWORD *pvOption
  445. )
  446. {
  447. return FALSE;
  448. }
  449. // Low level APIs
  450. // NOTE: The high-level APIs should always be used. These APIs
  451. // have been left for compatibility.
  452. BOOL
  453. INSTAPI
  454. SQLInstallDriverW (
  455. LPCWSTR lpszInfFile,
  456. LPCWSTR lpszDriver,
  457. LPWSTR lpszPath,
  458. WORD cbPathMax,
  459. WORD *pcbPathOut
  460. )
  461. {
  462. return FALSE;
  463. }
  464. BOOL
  465. INSTAPI
  466. SQLInstallDriverManagerW (
  467. LPWSTR lpszPath,
  468. WORD cbPathMax,
  469. WORD *pcbPathOut
  470. )
  471. {
  472. return FALSE;
  473. }
  474. BOOL
  475. INSTAPI
  476. SQLGetInstalledDriversW (
  477. LPWSTR lpszBuf,
  478. WORD cbBufMax,
  479. WORD *pcbBufOut
  480. )
  481. {
  482. return FALSE;
  483. }
  484. BOOL
  485. INSTAPI
  486. SQLGetAvailableDriversW (
  487. LPCWSTR lpszInfFile,
  488. LPWSTR lpszBuf,
  489. WORD cbBufMax,
  490. WORD *pcbBufOut
  491. )
  492. {
  493. return FALSE;
  494. }
  495. BOOL
  496. INSTAPI
  497. SQLConfigDataSourceW (
  498. HWND hwndParent,
  499. WORD fRequest,
  500. LPCWSTR lpszDriver,
  501. LPCWSTR lpszAttributes
  502. )
  503. {
  504. return FALSE;
  505. }
  506. BOOL
  507. INSTAPI
  508. SQLWriteDSNToIniW (
  509. LPCWSTR lpszDSN,
  510. LPCWSTR lpszDriver
  511. )
  512. {
  513. return FALSE;
  514. }
  515. BOOL
  516. INSTAPI
  517. SQLRemoveDSNFromIniW (
  518. LPCWSTR lpszDSN
  519. )
  520. {
  521. return FALSE;
  522. }
  523. BOOL
  524. INSTAPI
  525. SQLValidDSNW (
  526. LPCWSTR lpszDSN
  527. )
  528. {
  529. return FALSE;
  530. }
  531. BOOL
  532. INSTAPI
  533. SQLWritePrivateProfileStringW (
  534. LPCWSTR lpszSection,
  535. LPCWSTR lpszEntry,
  536. LPCWSTR lpszString,
  537. LPCWSTR lpszFilename
  538. )
  539. {
  540. return FALSE;
  541. }
  542. int
  543. INSTAPI
  544. SQLGetPrivateProfileStringW (
  545. LPCWSTR lpszSection,
  546. LPCWSTR lpszEntry,
  547. LPCWSTR lpszDefault,
  548. LPWSTR lpszRetBuffer,
  549. int cbRetBuffer,
  550. LPCWSTR lpszFilename
  551. )
  552. {
  553. return 0;
  554. }
  555. #if (ODBCVER >= 0x0250)
  556. BOOL
  557. INSTAPI
  558. SQLInstallTranslatorW (
  559. LPCWSTR lpszInfFile,
  560. LPCWSTR lpszTranslator,
  561. LPCWSTR lpszPathIn,
  562. LPWSTR lpszPathOut,
  563. WORD cbPathOutMax,
  564. WORD *pcbPathOut,
  565. WORD fRequest,
  566. LPDWORD lpdwUsageCount
  567. )
  568. {
  569. return FALSE;
  570. }
  571. BOOL
  572. INSTAPI
  573. SQLRemoveTranslatorW (
  574. LPCWSTR lpszTranslator,
  575. LPDWORD lpdwUsageCount
  576. )
  577. {
  578. return FALSE;
  579. }
  580. BOOL
  581. INSTAPI
  582. SQLRemoveDriverW (
  583. LPCWSTR lpszDriver,
  584. BOOL fRemoveDSN,
  585. LPDWORD lpdwUsageCount
  586. )
  587. {
  588. return FALSE;
  589. }
  590. BOOL
  591. INSTAPI
  592. SQLConfigDriverW (
  593. HWND hwndParent,
  594. WORD fRequest,
  595. LPCWSTR lpszDriver,
  596. LPCWSTR lpszArgs,
  597. LPWSTR lpszMsg,
  598. WORD cbMsgMax,
  599. WORD *pcbMsgOut
  600. )
  601. {
  602. return FALSE;
  603. }
  604. #endif
  605. #if (ODBCVER >= 0x0300)
  606. SQLRETURN
  607. INSTAPI
  608. SQLInstallerErrorW (
  609. WORD iError,
  610. DWORD *pfErrorCode,
  611. LPWSTR lpszErrorMsg,
  612. WORD cbErrorMsgMax,
  613. WORD *pcbErrorMsg
  614. )
  615. {
  616. return 0;
  617. }
  618. SQLRETURN
  619. INSTAPI
  620. SQLPostInstallerErrorW (
  621. DWORD dwErrorCode,
  622. LPCWSTR lpszErrorMsg
  623. )
  624. {
  625. return 0;
  626. }
  627. BOOL
  628. INSTAPI
  629. SQLWriteFileDSNW (
  630. LPCWSTR lpszFileName,
  631. LPCWSTR lpszAppName,
  632. LPCWSTR lpszKeyName,
  633. LPCWSTR lpszString
  634. )
  635. {
  636. return FALSE;
  637. }
  638. BOOL
  639. INSTAPI
  640. SQLReadFileDSNW (
  641. LPCWSTR lpszFileName,
  642. LPCWSTR lpszAppName,
  643. LPCWSTR lpszKeyName,
  644. LPWSTR lpszString,
  645. WORD cbString,
  646. WORD *pcbString
  647. )
  648. {
  649. return FALSE;
  650. }
  651. BOOL
  652. INSTAPI
  653. SQLInstallDriverExW (
  654. LPCWSTR lpszDriver,
  655. LPCWSTR lpszPathIn,
  656. LPWSTR lpszPathOut,
  657. WORD cbPathOutMax,
  658. WORD *pcbPathOut,
  659. WORD fRequest,
  660. LPDWORD lpdwUsageCount
  661. )
  662. {
  663. return FALSE;
  664. }
  665. BOOL
  666. INSTAPI
  667. SQLInstallTranslatorExW (
  668. LPCWSTR lpszTranslator,
  669. LPCWSTR lpszPathIn,
  670. LPWSTR lpszPathOut,
  671. WORD cbPathOutMax,
  672. WORD *pcbPathOut,
  673. WORD fRequest,
  674. LPDWORD lpdwUsageCount
  675. )
  676. {
  677. return FALSE;
  678. }
  679. #endif /* ODBCVER >= 0x0300 */
  680. // Driver specific Setup APIs called by installer
  681. BOOL
  682. INSTAPI
  683. ConfigDSNW (
  684. HWND hwndParent,
  685. WORD fRequest,
  686. LPCWSTR lpszDriver,
  687. LPCWSTR lpszAttributes
  688. )
  689. {
  690. return FALSE;
  691. }
  692. #if (ODBCVER >= 0x0250)
  693. BOOL
  694. INSTAPI
  695. ConfigDriverW (
  696. HWND hwndParent,
  697. WORD fRequest,
  698. LPCWSTR lpszDriver,
  699. LPCWSTR lpszArgs,
  700. LPWSTR lpszMsg,
  701. WORD cbMsgMax,
  702. WORD *pcbMsgOut
  703. )
  704. {
  705. return FALSE;
  706. }
  707. #endif
  708. #ifndef SQL_NOUNICODEMAP // define this to disable the mapping
  709. #ifdef UNICODE
  710. #define SQLInstallODBC SQLInstallODBCW
  711. #define SQLCreateDataSource SQLCreateDataSourceW
  712. #define SQLGetTranslator SQLGetTranslatorW
  713. #define SQLInstallDriver SQLInstallDriverW
  714. #define SQLInstallDriverManager SQLInstallDriverManagerW
  715. #define SQLGetInstalledDrivers SQLGetInstalledDriversW
  716. #define SQLGetAvailableDrivers SQLGetAvailableDriversW
  717. #define SQLConfigDataSource SQLConfigDataSourceW
  718. #define SQLWriteDSNToIni SQLWriteDSNToIniW
  719. #define SQLRemoveDSNFromIni SQLRemoveDSNFromIniW
  720. #define SQLValidDSN SQLValidDSNW
  721. #define SQLWritePrivateProfileString SQLWritePrivateProfileStringW
  722. #define SQLGetPrivateProfileString SQLGetPrivateProfileStringW
  723. #define SQLInstallTranslator SQLInstallTranslatorW
  724. #define SQLRemoveTranslator SQLRemoveTranslatorW
  725. #define SQLRemoveDriver SQLRemoveDriverW
  726. #define SQLConfigDriver SQLConfigDriverW
  727. #define SQLInstallerError SQLInstallerErrorW
  728. #define SQLPostInstallerError SQLPostInstallerErrorW
  729. #define SQLReadFileDSN SQLReadFileDSNW
  730. #define SQLWriteFileDSN SQLWriteFileDSNW
  731. #define SQLInstallDriverEx SQLInstallDriverExW
  732. #define SQLInstallTranslatorEx SQLInstallTranslatorExW
  733. #endif // UNICODE
  734. #endif // SQL_NOUNICODEMAP
  735. #endif // RC_INVOKED
  736. #ifdef __cplusplus
  737. } // End of extern "C" {
  738. #endif // __cplusplus