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.

407 lines
15 KiB

  1. //-----------------------------------------------------------------------------
  2. // File: odbcinst.h
  3. //
  4. // Copyright: Copyright (c) Microsoft Corporation
  5. //
  6. // Contents: Prototypes for ODBCCP32.DLL
  7. //
  8. // Comments:
  9. //
  10. //-----------------------------------------------------------------------------
  11. #ifndef __ODBCINST_H
  12. #define __ODBCINST_H
  13. #ifndef __SQL
  14. #include "sql.h"
  15. #endif
  16. #ifdef __cplusplus
  17. extern "C" { // Assume C declarations for C++
  18. #endif // __cplusplus
  19. #ifndef ODBCVER
  20. #define ODBCVER 0x0351 // Assume ODBC 3.51
  21. #endif
  22. #ifndef WINVER
  23. #define WINVER 0x0400 // Assume Windows 4.0
  24. #endif
  25. // Constants ---------------------------------------------------------------
  26. // SQLConfigDataSource request flags
  27. #define ODBC_ADD_DSN 1 // Add data source
  28. #define ODBC_CONFIG_DSN 2 // Configure (edit) data source
  29. #define ODBC_REMOVE_DSN 3 // Remove data source
  30. #if (ODBCVER >= 0x0250)
  31. #define ODBC_ADD_SYS_DSN 4 // add a system DSN
  32. #define ODBC_CONFIG_SYS_DSN 5 // Configure a system DSN
  33. #define ODBC_REMOVE_SYS_DSN 6 // remove a system DSN
  34. #if (ODBCVER >= 0x0300)
  35. #define ODBC_REMOVE_DEFAULT_DSN 7 // remove the default DSN
  36. #endif /* ODBCVER >= 0x0300 */
  37. // install request flags
  38. #define ODBC_INSTALL_INQUIRY 1
  39. #define ODBC_INSTALL_COMPLETE 2
  40. // config driver flags
  41. #define ODBC_INSTALL_DRIVER 1
  42. #define ODBC_REMOVE_DRIVER 2
  43. #define ODBC_CONFIG_DRIVER 3
  44. #define ODBC_CONFIG_DRIVER_MAX 100
  45. #endif
  46. // SQLGetConfigMode and SQLSetConfigMode flags
  47. #if (ODBCVER >= 0x0300)
  48. #define ODBC_BOTH_DSN 0
  49. #define ODBC_USER_DSN 1
  50. #define ODBC_SYSTEM_DSN 2
  51. #endif /* ODBCVER >= 0x0300 */
  52. // SQLInstallerError code
  53. #if (ODBCVER >= 0x0300)
  54. #define ODBC_ERROR_GENERAL_ERR 1
  55. #define ODBC_ERROR_INVALID_BUFF_LEN 2
  56. #define ODBC_ERROR_INVALID_HWND 3
  57. #define ODBC_ERROR_INVALID_STR 4
  58. #define ODBC_ERROR_INVALID_REQUEST_TYPE 5
  59. #define ODBC_ERROR_COMPONENT_NOT_FOUND 6
  60. #define ODBC_ERROR_INVALID_NAME 7
  61. #define ODBC_ERROR_INVALID_KEYWORD_VALUE 8
  62. #define ODBC_ERROR_INVALID_DSN 9
  63. #define ODBC_ERROR_INVALID_INF 10
  64. #define ODBC_ERROR_REQUEST_FAILED 11
  65. #define ODBC_ERROR_INVALID_PATH 12
  66. #define ODBC_ERROR_LOAD_LIB_FAILED 13
  67. #define ODBC_ERROR_INVALID_PARAM_SEQUENCE 14
  68. #define ODBC_ERROR_INVALID_LOG_FILE 15
  69. #define ODBC_ERROR_USER_CANCELED 16
  70. #define ODBC_ERROR_USAGE_UPDATE_FAILED 17
  71. #define ODBC_ERROR_CREATE_DSN_FAILED 18
  72. #define ODBC_ERROR_WRITING_SYSINFO_FAILED 19
  73. #define ODBC_ERROR_REMOVE_DSN_FAILED 20
  74. #define ODBC_ERROR_OUT_OF_MEM 21
  75. #define ODBC_ERROR_OUTPUT_STRING_TRUNCATED 22
  76. #endif /* ODBCVER >= 0x0300 */
  77. #ifndef EXPORT
  78. #define EXPORT
  79. #endif
  80. #ifndef RC_INVOKED
  81. // Prototypes --------------------------------------------------------------
  82. #define INSTAPI __stdcall
  83. // High level APIs
  84. BOOL INSTAPI SQLInstallODBC (HWND hwndParent,
  85. LPCSTR lpszInfFile,
  86. LPCSTR lpszSrcPath,
  87. LPCSTR lpszDrivers);
  88. BOOL INSTAPI SQLManageDataSources (HWND hwndParent);
  89. BOOL INSTAPI SQLCreateDataSource (HWND hwndParent,
  90. LPCSTR lpszDSN);
  91. BOOL INSTAPI SQLGetTranslator (HWND hwnd,
  92. LPSTR lpszName,
  93. WORD cbNameMax,
  94. WORD *pcbNameOut,
  95. LPSTR lpszPath,
  96. WORD cbPathMax,
  97. WORD *pcbPathOut,
  98. DWORD *pvOption);
  99. // Low level APIs
  100. // NOTE: The high-level APIs should always be used. These APIs
  101. // have been left for compatibility.
  102. BOOL INSTAPI SQLInstallDriver (LPCSTR lpszInfFile,
  103. LPCSTR lpszDriver,
  104. LPSTR lpszPath,
  105. WORD cbPathMax,
  106. WORD * pcbPathOut);
  107. BOOL INSTAPI SQLInstallDriverManager (LPSTR lpszPath,
  108. WORD cbPathMax,
  109. WORD * pcbPathOut);
  110. BOOL INSTAPI SQLGetInstalledDrivers (LPSTR lpszBuf,
  111. WORD cbBufMax,
  112. WORD * pcbBufOut);
  113. BOOL INSTAPI SQLGetAvailableDrivers (LPCSTR lpszInfFile,
  114. LPSTR lpszBuf,
  115. WORD cbBufMax,
  116. WORD * pcbBufOut);
  117. BOOL INSTAPI SQLConfigDataSource (HWND hwndParent,
  118. WORD fRequest,
  119. LPCSTR lpszDriver,
  120. LPCSTR lpszAttributes);
  121. BOOL INSTAPI SQLRemoveDefaultDataSource(void);
  122. BOOL INSTAPI SQLWriteDSNToIni (LPCSTR lpszDSN,
  123. LPCSTR lpszDriver);
  124. BOOL INSTAPI SQLRemoveDSNFromIni (LPCSTR lpszDSN);
  125. BOOL INSTAPI SQLValidDSN (LPCSTR lpszDSN);
  126. BOOL INSTAPI SQLWritePrivateProfileString(LPCSTR lpszSection,
  127. LPCSTR lpszEntry,
  128. LPCSTR lpszString,
  129. LPCSTR lpszFilename);
  130. int INSTAPI SQLGetPrivateProfileString( LPCSTR lpszSection,
  131. LPCSTR lpszEntry,
  132. LPCSTR lpszDefault,
  133. LPSTR lpszRetBuffer,
  134. int cbRetBuffer,
  135. LPCSTR lpszFilename);
  136. #if (ODBCVER >= 0x0250)
  137. BOOL INSTAPI SQLRemoveDriverManager(LPDWORD lpdwUsageCount);
  138. BOOL INSTAPI SQLInstallTranslator(LPCSTR lpszInfFile,
  139. LPCSTR lpszTranslator,
  140. LPCSTR lpszPathIn,
  141. LPSTR lpszPathOut,
  142. WORD cbPathOutMax,
  143. WORD *pcbPathOut,
  144. WORD fRequest,
  145. LPDWORD lpdwUsageCount);
  146. BOOL INSTAPI SQLRemoveTranslator(LPCSTR lpszTranslator,
  147. LPDWORD lpdwUsageCount);
  148. BOOL INSTAPI SQLRemoveDriver(LPCSTR lpszDriver,
  149. BOOL fRemoveDSN,
  150. LPDWORD lpdwUsageCount);
  151. BOOL INSTAPI SQLConfigDriver(HWND hwndParent,
  152. WORD fRequest,
  153. LPCSTR lpszDriver,
  154. LPCSTR lpszArgs,
  155. LPSTR lpszMsg,
  156. WORD cbMsgMax,
  157. WORD *pcbMsgOut);
  158. #endif
  159. #if (ODBCVER >= 0x0300)
  160. SQLRETURN INSTAPI SQLInstallerError(WORD iError,
  161. DWORD *pfErrorCode,
  162. LPSTR lpszErrorMsg,
  163. WORD cbErrorMsgMax,
  164. WORD *pcbErrorMsg);
  165. SQLRETURN INSTAPI SQLPostInstallerError(DWORD dwErrorCode, LPCSTR lpszErrMsg);
  166. BOOL INSTAPI SQLWriteFileDSN(LPCSTR lpszFileName,
  167. LPCSTR lpszAppName,
  168. LPCSTR lpszKeyName,
  169. LPCSTR lpszString);
  170. BOOL INSTAPI SQLReadFileDSN(LPCSTR lpszFileName,
  171. LPCSTR lpszAppName,
  172. LPCSTR lpszKeyName,
  173. LPSTR lpszString,
  174. WORD cbString,
  175. WORD *pcbString);
  176. BOOL INSTAPI SQLInstallDriverEx(LPCSTR lpszDriver,
  177. LPCSTR lpszPathIn,
  178. LPSTR lpszPathOut,
  179. WORD cbPathOutMax,
  180. WORD *pcbPathOut,
  181. WORD fRequest,
  182. LPDWORD lpdwUsageCount);
  183. BOOL INSTAPI SQLInstallTranslatorEx(LPCSTR lpszTranslator,
  184. LPCSTR lpszPathIn,
  185. LPSTR lpszPathOut,
  186. WORD cbPathOutMax,
  187. WORD *pcbPathOut,
  188. WORD fRequest,
  189. LPDWORD lpdwUsageCount);
  190. BOOL INSTAPI SQLGetConfigMode(UWORD *pwConfigMode);
  191. BOOL INSTAPI SQLSetConfigMode(UWORD wConfigMode);
  192. #endif /* ODBCVER >= 0x0300 */
  193. // Driver specific Setup APIs called by installer
  194. BOOL INSTAPI ConfigDSN (HWND hwndParent,
  195. WORD fRequest,
  196. LPCSTR lpszDriver,
  197. LPCSTR lpszAttributes);
  198. BOOL INSTAPI ConfigTranslator ( HWND hwndParent,
  199. DWORD *pvOption);
  200. #if (ODBCVER >= 0x0250)
  201. BOOL INSTAPI ConfigDriver(HWND hwndParent,
  202. WORD fRequest,
  203. LPCSTR lpszDriver,
  204. LPCSTR lpszArgs,
  205. LPSTR lpszMsg,
  206. WORD cbMsgMax,
  207. WORD *pcbMsgOut);
  208. #endif
  209. // UNICODE APIs
  210. // High level APIs
  211. BOOL INSTAPI SQLInstallODBCW (HWND hwndParent,
  212. LPCWSTR lpszInfFile,
  213. LPCWSTR lpszSrcPath,
  214. LPCWSTR lpszDrivers);
  215. BOOL INSTAPI SQLCreateDataSourceW (HWND hwndParent,
  216. LPCWSTR lpszDSN);
  217. BOOL INSTAPI SQLGetTranslatorW (HWND hwnd,
  218. LPWSTR lpszName,
  219. WORD cbNameMax,
  220. WORD *pcbNameOut,
  221. LPWSTR lpszPath,
  222. WORD cbPathMax,
  223. WORD *pcbPathOut,
  224. DWORD *pvOption);
  225. // Low level APIs
  226. // NOTE: The high-level APIs should always be used. These APIs
  227. // have been left for compatibility.
  228. BOOL INSTAPI SQLInstallDriverW (LPCWSTR lpszInfFile,
  229. LPCWSTR lpszDriver,
  230. LPWSTR lpszPath,
  231. WORD cbPathMax,
  232. WORD * pcbPathOut);
  233. BOOL INSTAPI SQLInstallDriverManagerW (LPWSTR lpszPath,
  234. WORD cbPathMax,
  235. WORD * pcbPathOut);
  236. BOOL INSTAPI SQLGetInstalledDriversW (LPWSTR lpszBuf,
  237. WORD cbBufMax,
  238. WORD * pcbBufOut);
  239. BOOL INSTAPI SQLGetAvailableDriversW (LPCWSTR lpszInfFile,
  240. LPWSTR lpszBuf,
  241. WORD cbBufMax,
  242. WORD * pcbBufOut);
  243. BOOL INSTAPI SQLConfigDataSourceW (HWND hwndParent,
  244. WORD fRequest,
  245. LPCWSTR lpszDriver,
  246. LPCWSTR lpszAttributes);
  247. BOOL INSTAPI SQLWriteDSNToIniW (LPCWSTR lpszDSN,
  248. LPCWSTR lpszDriver);
  249. BOOL INSTAPI SQLRemoveDSNFromIniW (LPCWSTR lpszDSN);
  250. BOOL INSTAPI SQLValidDSNW (LPCWSTR lpszDSN);
  251. BOOL INSTAPI SQLWritePrivateProfileStringW(LPCWSTR lpszSection,
  252. LPCWSTR lpszEntry,
  253. LPCWSTR lpszString,
  254. LPCWSTR lpszFilename);
  255. int INSTAPI SQLGetPrivateProfileStringW( LPCWSTR lpszSection,
  256. LPCWSTR lpszEntry,
  257. LPCWSTR lpszDefault,
  258. LPWSTR lpszRetBuffer,
  259. int cbRetBuffer,
  260. LPCWSTR lpszFilename);
  261. #if (ODBCVER >= 0x0250)
  262. BOOL INSTAPI SQLInstallTranslatorW(LPCWSTR lpszInfFile,
  263. LPCWSTR lpszTranslator,
  264. LPCWSTR lpszPathIn,
  265. LPWSTR lpszPathOut,
  266. WORD cbPathOutMax,
  267. WORD *pcbPathOut,
  268. WORD fRequest,
  269. LPDWORD lpdwUsageCount);
  270. BOOL INSTAPI SQLRemoveTranslatorW(LPCWSTR lpszTranslator,
  271. LPDWORD lpdwUsageCount);
  272. BOOL INSTAPI SQLRemoveDriverW(LPCWSTR lpszDriver,
  273. BOOL fRemoveDSN,
  274. LPDWORD lpdwUsageCount);
  275. BOOL INSTAPI SQLConfigDriverW(HWND hwndParent,
  276. WORD fRequest,
  277. LPCWSTR lpszDriver,
  278. LPCWSTR lpszArgs,
  279. LPWSTR lpszMsg,
  280. WORD cbMsgMax,
  281. WORD *pcbMsgOut);
  282. #endif
  283. #if (ODBCVER >= 0x0300)
  284. SQLRETURN INSTAPI SQLInstallerErrorW(WORD iError,
  285. DWORD *pfErrorCode,
  286. LPWSTR lpszErrorMsg,
  287. WORD cbErrorMsgMax,
  288. WORD *pcbErrorMsg);
  289. SQLRETURN INSTAPI SQLPostInstallerErrorW(DWORD dwErrorCode,
  290. LPCWSTR lpszErrorMsg);
  291. BOOL INSTAPI SQLWriteFileDSNW(LPCWSTR lpszFileName,
  292. LPCWSTR lpszAppName,
  293. LPCWSTR lpszKeyName,
  294. LPCWSTR lpszString);
  295. BOOL INSTAPI SQLReadFileDSNW(LPCWSTR lpszFileName,
  296. LPCWSTR lpszAppName,
  297. LPCWSTR lpszKeyName,
  298. LPWSTR lpszString,
  299. WORD cbString,
  300. WORD *pcbString);
  301. BOOL INSTAPI SQLInstallDriverExW(LPCWSTR lpszDriver,
  302. LPCWSTR lpszPathIn,
  303. LPWSTR lpszPathOut,
  304. WORD cbPathOutMax,
  305. WORD *pcbPathOut,
  306. WORD fRequest,
  307. LPDWORD lpdwUsageCount);
  308. BOOL INSTAPI SQLInstallTranslatorExW(LPCWSTR lpszTranslator,
  309. LPCWSTR lpszPathIn,
  310. LPWSTR lpszPathOut,
  311. WORD cbPathOutMax,
  312. WORD *pcbPathOut,
  313. WORD fRequest,
  314. LPDWORD lpdwUsageCount);
  315. #endif /* ODBCVER >= 0x0300 */
  316. // Driver specific Setup APIs called by installer
  317. BOOL INSTAPI ConfigDSNW (HWND hwndParent,
  318. WORD fRequest,
  319. LPCWSTR lpszDriver,
  320. LPCWSTR lpszAttributes);
  321. #if (ODBCVER >= 0x0250)
  322. BOOL INSTAPI ConfigDriverW(HWND hwndParent,
  323. WORD fRequest,
  324. LPCWSTR lpszDriver,
  325. LPCWSTR lpszArgs,
  326. LPWSTR lpszMsg,
  327. WORD cbMsgMax,
  328. WORD *pcbMsgOut);
  329. #endif
  330. #ifndef SQL_NOUNICODEMAP // define this to disable the mapping
  331. #ifdef UNICODE
  332. #define SQLInstallODBC SQLInstallODBCW
  333. #define SQLCreateDataSource SQLCreateDataSourceW
  334. #define SQLGetTranslator SQLGetTranslatorW
  335. #define SQLInstallDriver SQLInstallDriverW
  336. #define SQLInstallDriverManager SQLInstallDriverManagerW
  337. #define SQLGetInstalledDrivers SQLGetInstalledDriversW
  338. #define SQLGetAvailableDrivers SQLGetAvailableDriversW
  339. #define SQLConfigDataSource SQLConfigDataSourceW
  340. #define SQLWriteDSNToIni SQLWriteDSNToIniW
  341. #define SQLRemoveDSNFromIni SQLRemoveDSNFromIniW
  342. #define SQLValidDSN SQLValidDSNW
  343. #define SQLWritePrivateProfileString SQLWritePrivateProfileStringW
  344. #define SQLGetPrivateProfileString SQLGetPrivateProfileStringW
  345. #define SQLInstallTranslator SQLInstallTranslatorW
  346. #define SQLRemoveTranslator SQLRemoveTranslatorW
  347. #define SQLRemoveDriver SQLRemoveDriverW
  348. #define SQLConfigDriver SQLConfigDriverW
  349. #define SQLInstallerError SQLInstallerErrorW
  350. #define SQLPostInstallerError SQLPostInstallerErrorW
  351. #define SQLReadFileDSN SQLReadFileDSNW
  352. #define SQLWriteFileDSN SQLWriteFileDSNW
  353. #define SQLInstallDriverEx SQLInstallDriverExW
  354. #define SQLInstallTranslatorEx SQLInstallTranslatorExW
  355. #endif // UNICODE
  356. #endif // SQL_NOUNICODEMAP
  357. #endif // RC_INVOKED
  358. #ifdef __cplusplus
  359. } // End of extern "C" {
  360. #endif // __cplusplus
  361. #endif // __ODBCINST_H