' ########################################################################################
' Microsoft Windows
' File: odbcinst.inc
' Contents: Installer DLL API.
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_odbcinst_PBI)
#DEFINE PBX_odbcinst_PBI
%EQUATE `ODBCINST_INC = 1
#INCLUDE ONCE "Legacy/Data/sql.inc"
#IF NOT %DEF(%ODBCVER)
%EQUATE `ODBCVER = &H0380 ' // Default to ODBC 3.80
#ENDIF
'#ifndef WINVER
'#define WINVER 0x0400 // Assume Windows 4.0
'#endif
'// Constants ---------------------------------------------------------------
'// SQLConfigDataSource request flags
%EQUATE `ODBC_ADD_DSN = 1 ' // Add data source
%EQUATE `ODBC_CONFIG_DSN = 2 ' // Configure (edit) data source
%EQUATE `ODBC_REMOVE_DSN = 3 ' // Remove data source
#IF %ODBCVER >= &H0250
%EQUATE `ODBC_ADD_SYS_DSN = 4 ' // add a system DSN
%EQUATE `ODBC_CONFIG_SYS_DSN = 5 ' // Configure a system DSN
%EQUATE `ODBC_REMOVE_SYS_DSN = 6 ' // remove a system DSN
#IF %ODBCVER >= &H0300
%EQUATE `ODBC_REMOVE_DEFAULT_DSN = 7 ' // remove the default DSN
#ENDIF ' /* ODBCVER >= &H0300 */
'// install request flags
%EQUATE `ODBC_INSTALL_INQUIRY = 1
%EQUATE `ODBC_INSTALL_COMPLETE = 2
'// config driver flags
%EQUATE `ODBC_INSTALL_DRIVER = 1
%EQUATE `ODBC_REMOVE_DRIVER = 2
%EQUATE `ODBC_CONFIG_DRIVER = 3
%EQUATE `ODBC_CONFIG_DRIVER_MAX = 100
#ENDIF ' /* ODBCVER >= &H0250 */
'// SQLGetConfigMode and SQLSetConfigMode flags
#IF %ODBCVER >= &H0300
%EQUATE `ODBC_BOTH_DSN = 0
%EQUATE `ODBC_USER_DSN = 1
%EQUATE `ODBC_SYSTEM_DSN = 2
#ENDIF ' /* ODBCVER >= &H0300 */
'// SQLInstallerError code
#IF %ODBCVER >= &H0300
%EQUATE `ODBC_ERROR_GENERAL_ERR = 1
%EQUATE `ODBC_ERROR_INVALID_BUFF_LEN = 2
%EQUATE `ODBC_ERROR_INVALID_HWND = 3
%EQUATE `ODBC_ERROR_INVALID_STR = 4
%EQUATE `ODBC_ERROR_INVALID_REQUEST_TYPE = 5
%EQUATE `ODBC_ERROR_COMPONENT_NOT_FOUND = 6
%EQUATE `ODBC_ERROR_INVALID_NAME = 7
%EQUATE `ODBC_ERROR_INVALID_KEYWORD_VALUE = 8
%EQUATE `ODBC_ERROR_INVALID_DSN = 9
%EQUATE `ODBC_ERROR_INVALID_INF = 10
%EQUATE `ODBC_ERROR_REQUEST_FAILED = 11
%EQUATE `ODBC_ERROR_INVALID_PATH = 12
%EQUATE `ODBC_ERROR_LOAD_LIB_FAILED = 13
%EQUATE `ODBC_ERROR_INVALID_PARAM_SEQUENCE = 14
%EQUATE `ODBC_ERROR_INVALID_LOG_FILE = 15
%EQUATE `ODBC_ERROR_USER_CANCELED = 16
%EQUATE `ODBC_ERROR_USAGE_UPDATE_FAILED = 17
%EQUATE `ODBC_ERROR_CREATE_DSN_FAILED = 18
%EQUATE `ODBC_ERROR_WRITING_SYSINFO_FAILED = 19
%EQUATE `ODBC_ERROR_REMOVE_DSN_FAILED = 20
%EQUATE `ODBC_ERROR_OUT_OF_MEM = 21
%EQUATE `ODBC_ERROR_OUTPUT_STRING_TRUNCATED = 22
%EQUATE `ODBC_ERROR_NOTRANINFO = 23
%EQUATE `ODBC_ERROR_MAX = %ODBC_ERROR_NOTRANINFO ' // update this when we add new error message
#ENDIF ' /* ODBCVER >= &H0300 */
'// Prototypes --------------------------------------------------------------
'// High level APIs
DECLARE FUNCTION SQLInstallODBCA LIB "odbccp32.dll" ALIAS "SQLInstallODBC" ( BYVAL hwndParent AS QUAD , BYREF lpszInfFile AS ASCIIZ , BYREF lpszSrcPath AS ASCIIZ , BYREF lpszDrivers AS ASCIIZ ) AS LONG
DECLARE FUNCTION SQLManageDataSources LIB "odbccp32.dll" ALIAS "SQLManageDataSources" ( BYVAL hwndParent AS QUAD
 ) AS LONG
DECLARE FUNCTION SQLCreateDataSourceA LIB "odbccp32.dll" ALIAS "SQLCreateDataSource" ( BYVAL hwndParent AS DWORD
 , BYREF lpszDSN AS ASCIIZ
 ) AS LONG
DECLARE FUNCTION SQLGetTranslatorA LIB "odbccp32.dll" ALIAS "SQLGetTranslator" ( BYVAL hwnd AS DWORD
 , BYREF lpszName AS ASCIIZ
 , BYVAL cbNameMax AS WORD
 , BYREF pcbNameOut AS WORD
 , BYREF lpszPath AS ASCIIZ
 , BYVAL cbPathMax AS WORD
 , BYREF pcbPathOut AS WORD
 , BYREF pvOption AS DWORD
 ) AS LONG
'// Low level APIs
'// NOTE: The high-level APIs should always be used. These APIs
'// have been left for compatibility.
DECLARE FUNCTION SQLInstallDriverA LIB "odbccp32.dll" ALIAS "SQLInstallDriver" ( BYREF lpszInfFile AS ASCIIZ , BYREF lpszDriver AS ASCIIZ , BYREF lpszPath AS ASCIIZ , BYVAL cbPathMax AS WORD , BYREF pcbPathOut AS WORD ) AS LONG
DECLARE FUNCTION SQLInstallDriverManagerA LIB "odbccp32.dll" ALIAS "SQLInstallDriverManager" ( BYREF lpszPath AS ASCIIZ
 , BYVAL cbPathMax AS WORD
 , BYREF pcbPathOut AS WORD
 ) AS LONG
DECLARE FUNCTION SQLGetInstalledDriversA LIB "odbccp32.dll" ALIAS "SQLGetInstalledDrivers" ( BYREF lpszBuf AS ASCIIZ
 , BYVAL cbBufMax AS WORD
 , BYREF pcbBufOut AS WORD
 ) AS LONG
DECLARE FUNCTION SQLGetAvailableDriversA LIB "odbccp32.dll" ALIAS "SQLGetAvailableDrivers" ( BYREF lpszInfile AS ASCIIZ
 , BYREF lpszBuf AS ASCIIZ
 , BYVAL cbBufMax AS WORD
 , BYREF pcbBufOut AS WORD
 ) AS LONG
DECLARE FUNCTION SQLConfigDataSourceA LIB "odbccp32.dll" ALIAS "SQLConfigDataSource" ( BYVAL hwndParent AS DWORD
 , BYVAL fRequest AS WORD
 , BYREF lpszDriver AS ASCIIZ
 , BYREF lpszAttributes AS ASCIIZ
 ) AS LONG
' In ODBC 3.0, the SQLRemoveDefaultDataSource function has been replaced by
' a call to SQLConfigDataSource with an fRequest argument of
' ODBC_REMOVE_DEFAULT_DSN.
DECLARE FUNCTION SQLRemoveDefaultDataSource LIB "odbccp32.dll" ALIAS "SQLRemoveDefaultDataSource" ( ) AS LONG
DECLARE FUNCTION SQLWriteDSNToIniA LIB "odbccp32.dll" ALIAS "SQLWriteDSNToIni" ( BYREF lpszDSN AS ASCIIZ , BYREF lpszDriver AS ASCIIZ
 ) AS LONG
DECLARE FUNCTION SQLRemoveDSNFromIniA LIB "odbccp32.dll" ALIAS "SQLRemoveDSNFromIni" ( BYREF lpszDSN AS ASCIIZ
 ) AS LONG
DECLARE FUNCTION SQLValidDSNA LIB "odbccp32.dll" ALIAS "SQLValidDSN" ( BYREF lpszDSN AS ASCIIZ
 ) AS LONG
DECLARE FUNCTION SQLWritePrivateProfileStringA LIB "odbccp32.dll" ALIAS "SQLWritePrivateProfileString" ( BYREF lpszSection AS ASCIIZ
 , BYREF lpszEntry AS ASCIIZ
 , BYREF lpszString AS ASCIIZ
 , BYREF lpszFileName AS ASCIIZ
 ) AS LONG
DECLARE FUNCTION SQLGetPrivateProfileStringA LIB "odbccp32.dll" ALIAS "SQLGetPrivateProfileString" ( BYREF lpszSection AS ASCIIZ
 , BYREF lpszEntry AS ASCIIZ
 , BYREF lpszDefault AS ASCIIZ
 , BYREF lpszRetBuffer AS ASCIIZ
 , BYVAL cbRetBuffer AS INTEGER
 , BYREF lpszFileName AS ASCIIZ
 ) AS LONG ' int
#IF %ODBCVER >= &H0250
DECLARE FUNCTION SQLRemoveDriverManager LIB "odbccp32.dll" ALIAS "SQLRemoveDriverManager" ( BYREF lpdwUsageCount AS QUAD ) AS LONG
DECLARE FUNCTION SQLInstallTranslatorA LIB "odbccp32.dll" ALIAS "SQLInstallTranslator" ( BYREF lpszInfFile AS ASCIIZ
 , BYREF lpszTranslator AS ASCIIZ
 , BYREF lpszPathIn AS ASCIIZ
 , BYREF lpszPathOut AS ASCIIZ
 , BYVAL cbPathOutMax AS WORD
 , BYREF pcbPathOut AS WORD
 , BYVAL fRqquest AS WORD
 , BYREF lpdwUsageCount AS DWORD
 ) AS LONG
DECLARE FUNCTION SQLRemoveTranslatorA LIB "odbccp32.dll" ALIAS "SQLRemoveTranslator" ( BYREF lpszTranslator AS ASCIIZ
 , BYREF lpdwUsageCount AS DWORD
 ) AS LONG
DECLARE FUNCTION SQLRemoveDriverA LIB "odbccp32.dll" ALIAS "SQLRemoveDriver" ( BYREF lpszDriver AS ASCIIZ
 , BYVAL fRemoveDSN AS LONG
 , BYREF lpdwUsageCount AS DWORD
 ) AS LONG
DECLARE FUNCTION SQLConfigDriverA LIB "odbccp32.dll" ALIAS "SQLConfigDriver" ( BYVAL hwndParent AS DWORD
 , BYVAL fRequest AS WORD
 , BYREF lpszDriver AS ASCIIZ
 , BYREF lpszArgs AS ASCIIZ
 , BYREF lpszMsg AS ASCIIZ
 , BYVAL cbMsgMax AS WORD
 , BYREF pcbMsgOut AS WORD
 ) AS LONG
#ENDIF ' /* ODBCVER >= 0x0250 */
#IF %ODBCVER >= &H0300
DECLARE FUNCTION SQLInstallerErrorA LIB "odbccp32.dll" ALIAS "SQLInstallerError" ( BYVAL iError AS WORD ' WORD iError , BYREF pfErrorCode AS QUAD ' DWORD *pfErrorCode , BYREF lpszErrorMsg AS ASCIIZ ' LPCSTR lpszErrorMsg , BYVAL cbErrorMsgMax AS WORD ' WORD cbErrorMsgMax , BYREF pcbErrorMsg AS WORD ' WORD pcbErrorMsg ) AS INTEGER ' SQLRETURN
DECLARE FUNCTION SQLPostInstallerErrorA LIB "odbccp32.dll" ALIAS "SQLPostInstallerError" ( BYVAL dwErrorCode AS QUAD ' DWORD dwErrorCode , BYREF lpszErrMsg AS ASCIIZ ' LPCSTR lpszErrMsg ) AS INTEGER ' SQLRETURN
DECLARE FUNCTION SQLWriteFileDSNA LIB "odbccp32.dll" ALIAS "SQLWriteFileDSN" ( BYREF lpszFileName AS ASCIIZ ) AS LONG ' LPCSTR lpszFileName , BYREF lpszAppName AS ASCIIZ ' LPCSTR lpszAppName , BYREF lpszKeyName AS ASCIIZ ' LPCSTR lpszKeyName , BYREF lpszString AS ASCIIZ ' LPCSTR lpszString
DECLARE FUNCTION SQLReadFileDSNA LIB "odbccp32.dll" ALIAS "SQLReadFileDSN" ( BYREF lpszFileName AS ASCIIZ ' LPCSTR lpszFileName
 , BYREF lpszAppName AS ASCIIZ ' LPCSTR lpszAppName
 , BYREF lpszKeyName AS ASCIIZ ' LPCSTR lpszKeyName
 , BYREF lpszString AS ASCIIZ ' LPSTR lpszString
 , BYVAL cbString AS WORD ' WORD cbString
 , BYREF pcbString AS WORD ' WORD *pcbString
 ) AS LONG
' // Note: lpszDriver has been declared as BYVAL DWORD instead of BYREF ASCIIZ because
' // we have to pass a doubly null-terminated list of null separated keyword-value pairs
' // describing the driver.
DECLARE FUNCTION SQLInstallDriverExA LIB "odbccp32.dll" ALIAS "SQLInstallDriverEx" ( BYVAL lpszDriver AS QUAD ) AS LONG ' LPCSTR lpszDriver , BYREF lpszPathIn AS ASCIIZ ' LPCSTR lpszPathIn , BYREF lpszPathOut AS ASCIIZ ' LPSTR lpszPathOut , BYVAL cbPathOutMax AS WORD ' WORD cbPathOutMax , BYREF pcbPathOut AS WORD ' WORD *pcbPathOut , BYVAL fRequest AS WORD ' WORD fRequest , BYREF lpdwUsageCount AS QUAD ' LPDWORD lpdwUsageCount
DECLARE FUNCTION SQLInstallTranslatorExA LIB "odbccp32.dll" ALIAS "SQLInstallTranslatorEx" ( BYREF lpszTranslator AS ASCIIZ ' LPCSTR lpszTranslator
 , BYREF lpszPathIn AS ASCIIZ ' LPCSTR lpszPathIn
 , BYREF lpszPathOut AS ASCIIZ ' LPSTR lpszPathOut
 , BYVAL cbPathOutMax AS WORD ' WORD cbPathOutMax
 , BYREF pcbPathOut AS WORD ' WORD pcbPathOut
 , BYVAL fRqquest AS WORD ' WORD fRqquest
 , BYREF lpdwUsageCount AS DWORD ' LPDWORD lpdwUsageCount
 ) AS LONG
DECLARE FUNCTION SQLGetConfigMode LIB "odbccp32.dll" ALIAS "SQLGetConfigMode" ( BYREF pwConfigMode AS WORD ) AS LONG 'UWORD *pwConfigMode
DECLARE FUNCTION SQLSetConfigMode LIB "odbccp32.dll" ALIAS "SQLSetConfigMode" ( BYVAL wConfigMode AS WORD ) AS LONG 'UWORD wConfigMode
#ENDIF ' /* ODBCVER >= 0x0300 */
'// Driver specific Setup APIs called by installer
'BOOL INSTAPI ConfigDSN (
' HWND hwndParent,
' WORD fRequest,
' LPCSTR lpszDriver,
' LPCSTR lpszAttributes);
'BOOL INSTAPI ConfigTranslator (
' HWND hwndParent,
' DWORD *pvOption);
'#IF %ODBCVER >= &H0250
'BOOL INSTAPI ConfigDriver (
' HWND hwndParent,
' WORD fRequest,
' LPCSTR lpszDriver,
' LPCSTR lpszArgs,
' LPSTR lpszMsg,
' WORD cbMsgMax,
' WORD *pcbMsgOut);
'#ENDIF
'// UNICODE APIs
'// High level APIs
DECLARE FUNCTION SQLInstallODBCW LIB "odbccp32.dll" ALIAS "SQLInstallODBCW" ( BYREF hwndParent AS QUAD ) AS LONG ' HWND hwndParent , BYREF lpszInfFile AS WSTRINGZ ' LPCWSTR lpszInfFile , BYREF lpszSrcPath AS WSTRINGZ ' LPCWSTR lpszSrcPath , BYREF lpszDrivers AS WSTRINGZ ' LPCWSTR lpszDrivers
#IF %DEF(%UNICODE)
 MACRO SQLInstallODBC = SQLInstallODBCW
#ELSE
 MACRO SQLInstallODBC = SQLInstallODBCA
#ENDIF
DECLARE FUNCTION SQLCreateDataSourceW LIB "odbccp32.dll" ALIAS "SQLCreateDataSourceW" ( BYVAL hwndParent AS QUAD ) AS LONG ' HWND hwndParent , BYREF lpszDSN AS WSTRINGZ ' LPCWSTR lpszDSN
#IF %DEF(%UNICODE)
 MACRO SQLCreateDataSource = SQLCreateDataSourceW
#ELSE
 MACRO SQLCreateDataSource = SQLCreateDataSourceA
#ENDIF
DECLARE FUNCTION SQLGetTranslatorW LIB "odbccp32.dll" ALIAS "SQLGetTranslatorW" ( BYVAL hwnd AS QUAD ) AS LONG ' HWND hwnd , BYREF lpszName AS WSTRINGZ ' LPWSTR lpszName , BYVAL cbNameMax AS WORD ' WORD cbNameMax , BYREF pcbNameOut AS WORD ' WORD *pcbNameOut , BYREF lpszPath AS WSTRINGZ ' LPWSTR lpszPath , BYVAL cbPathMax AS WORD ' WORD cbPathMax , BYREF pcbPathOut AS WORD ' WORD *pcbPathOut , BYREF pvOption AS QUAD ' DWORD *pvOption
#IF %DEF(%UNICODE)
 MACRO SQLGetTranslator = SQLGetTranslatorW
#ELSE
 MACRO SQLGetTranslator = SQLGetTranslatorA
#ENDIF
'// Low level APIs
'// NOTE: The high-level APIs should always be used. These APIs
'// have been left for compatibility.
DECLARE FUNCTION SQLInstallDriverW LIB "odbccp32.dll" ALIAS "SQLInstallDriverW" ( BYREF lpszInfFile AS WSTRINGZ ) AS LONG ' LPCWSTR lpszInfFile , BYREF lpszDriver AS WSTRINGZ ' LPCWSTR lpszDriver , BYREF lpszPath AS WSTRINGZ ' LPWSTR lpszPath , BYVAL cbPathMax AS WORD ' WORD cbPathMax , BYREF pcbPathOut AS WORD ' WORD *pcbPathOut
#IF %DEF(%UNICODE)
 MACRO SQLInstallDriver = SQLInstallDriverW
#ELSE
 MACRO SQLInstallDriver = SQLInstallDriverA
#ENDIF
DECLARE FUNCTION SQLInstallDriverManagerW LIB "odbccp32.dll" ALIAS "SQLInstallDriverManagerW" ( BYREF lpszPath AS WSTRINGZ ) AS LONG ' LPWSTR lpszPath , BYVAL cbPathMax AS WORD ' WORD cbPathMax , BYREF pcbPathOut AS WORD ' WORD *pcbPathOut
#IF %DEF(%UNICODE)
 MACRO SQLInstallDriverManager = SQLInstallDriverManagerW
#ELSE
 MACRO SQLInstallDriverManager = SQLInstallDriverManagerA
#ENDIF
DECLARE FUNCTION SQLGetInstalledDriversW LIB "odbccp32.dll" ALIAS "SQLGetInstalledDriversW" ( BYREF lpszBuf AS WSTRINGZ ) AS LONG ' LPWSTR lpszBuf , BYVAL cbBufMax AS WORD ' WORD cbBufMax , BYREF pcbBufOut AS WORD ' WORD *pcbBufOut
#IF %DEF(%UNICODE)
 MACRO SQLGetInstalledDrivers = SQLGetInstalledDriversW
#ELSE
 MACRO SQLGetInstalledDrivers = SQLGetInstalledDriversA
#ENDIF
DECLARE FUNCTION SQLGetAvailableDriversW LIB "odbccp32.dll" ALIAS "SQLGetAvailableDriversW" ( BYREF lpszInfile AS WSTRINGZ ) AS LONG ' LPCWSTR lpszInfile , BYREF lpszBuf AS WSTRINGZ ' LPWSTR lpszBuf , BYVAL cbBufMax AS WORD ' WORD cbBufMax , BYREF pcbBufOut AS WORD ' WORD *pcbBufOut
#IF %DEF(%UNICODE)
 MACRO SQLGetAvailableDrivers = SQLGetAvailableDriversW
#ELSE
 MACRO SQLGetAvailableDrivers = SQLGetAvailableDriversA
#ENDIF
DECLARE FUNCTION SQLConfigDataSourceW LIB "odbccp32.dll" ALIAS "SQLConfigDataSourceW" ( BYVAL hwndParent AS QUAD ) AS LONG ' HWND hwndParent , BYVAL fRequest AS WORD ' WORD fRequest , BYREF lpszDriver AS WSTRINGZ ' LPCWSTR lpszDriver , BYREF lpszAttributes AS WSTRINGZ ' LPCWSTR lpszAttributes
#IF %DEF(%UNICODE)
 MACRO SQLConfigDataSource = SQLConfigDataSourceW
#ELSE
 MACRO SQLConfigDataSource = SQLConfigDataSourceA
#ENDIF
DECLARE FUNCTION SQLWriteDSNToIniW LIB "odbccp32.dll" ALIAS "SQLWriteDSNToIniW" ( BYREF lpszDSN AS WSTRINGZ ) AS LONG ' LPCWSTR lpszDSN , BYREF lpszDriver AS WSTRINGZ ' LPCWSTR lpszDriver
#IF %DEF(%UNICODE)
 MACRO SQLWriteDSNToIni = SQLWriteDSNToIniW
#ELSE
 MACRO SQLWriteDSNToIni = SQLWriteDSNToIniA
#ENDIF
DECLARE FUNCTION SQLRemoveDSNFromIniW LIB "odbccp32.dll" ALIAS "SQLRemoveDSNFromIniW" ( BYREF lpszDSN AS WSTRINGZ ) AS LONG ' LPCWSTR lpszDSN
#IF %DEF(%UNICODE)
 MACRO SQLRemoveDSNFromIni = SQLRemoveDSNFromIniW
#ELSE
 MACRO SQLRemoveDSNFromIni = SQLRemoveDSNFromIniA
#ENDIF
DECLARE FUNCTION SQLValidDSNW LIB "odbccp32.dll" ALIAS "SQLValidDSNW" ( BYREF lpszDSN AS WSTRINGZ ) AS LONG ' LPCWSTR lpszDSN
#IF %DEF(%UNICODE)
 MACRO SQLValidDSN = SQLValidDSNW
#ELSE
 MACRO SQLValidDSN = SQLValidDSNA
#ENDIF
DECLARE FUNCTION SQLWritePrivateProfileStringW LIB "odbccp32.dll" ALIAS "SQLWritePrivateProfileStringW" ( BYREF lpszSection AS WSTRINGZ ) AS LONG ' LPCWSTR lpszSection , BYREF lpszEntry AS WSTRINGZ ' LPCWSTR lpszEntry , BYREF lpszString AS WSTRINGZ ' LPCWSTR lpszString , BYREF lpszFileName AS WSTRINGZ ' LPCWSTR lpszFileName
#IF %DEF(%UNICODE)
 MACRO SQLWritePrivateProfileString = SQLWritePrivateProfileStringW
#ELSE
 MACRO SQLWritePrivateProfileString = SQLWritePrivateProfileStringA
#ENDIF
DECLARE FUNCTION SQLGetPrivateProfileStringW LIB "odbccp32.dll" ALIAS "SQLGetPrivateProfileStringW" ( BYREF lpszSection AS WSTRINGZ ' LPCWSTR lpszSection , BYREF lpszEntry AS WSTRINGZ ' LPCWSTR lpszEntry , BYREF lpszDefault AS WSTRINGZ ' LPCWSTR lpszDefault , BYREF lpszRetBuffer AS WSTRINGZ ' LPWSTR lpszRetBuffer , BYVAL cbRetBuffer AS INTEGER ' int cbRetBuffer , BYREF lpszFileName AS WSTRINGZ ' LPCWSTR lpszFileName ) AS LONG ' int
#IF %DEF(%UNICODE)
 MACRO SQLGetPrivateProfileString = SQLGetPrivateProfileStringW
#ELSE
 MACRO SQLGetPrivateProfileString = SQLGetPrivateProfileStringA
#ENDIF
#IF %ODBCVER >= &H0250
DECLARE FUNCTION SQLInstallTranslatorW LIB "odbccp32.dll" ALIAS "SQLInstallTranslatorW" ( BYREF lpszInfFile AS WSTRINGZ ) AS LONG ' LPCWSTR lpszInfFile , BYREF lpszTranslator AS WSTRINGZ ' LPCWSTR lpszTranslator , BYREF lpszPathIn AS WSTRINGZ ' LPCWSTR lpszPathIn , BYREF lpszPathOut AS WSTRINGZ ' LPWSTR lpszPathOut , BYVAL cbPathOutMax AS WORD ' WORD cbPathOutMax , BYREF pcbPathOut AS WORD ' WORD *pcbPathOut , BYVAL fRqquest AS WORD ' WORD fRqquest , BYREF lpdwUsageCount AS QUAD ' LPDWORD lpdwUsageCount
#IF %DEF(%UNICODE)
 MACRO SQLInstallTranslator = SQLInstallTranslatorW
#ELSE
 MACRO SQLInstallTranslator = SQLInstallTranslatorA
#ENDIF
DECLARE FUNCTION SQLRemoveTranslatorW LIB "odbccp32.dll" ALIAS "SQLRemoveTranslatorW" ( BYREF lpszTranslator AS WSTRINGZ ) AS LONG ' LPCWSTR lpszTranslator , BYREF lpdwUsageCount AS QUAD ' LPDWORD lpdwUsageCount
#IF %DEF(%UNICODE)
 MACRO SQLRemoveTranslator = SQLRemoveTranslatorW
#ELSE
 MACRO SQLRemoveTranslator = SQLRemoveTranslatorA
#ENDIF
DECLARE FUNCTION SQLRemoveDriverW LIB "odbccp32.dll" ALIAS "SQLRemoveDriverW" ( BYREF lpszDriver AS WSTRINGZ ) AS LONG ' LPCWSTR lpszDriver , BYVAL fRemoveDSN AS LONG ' BOOL fRemoveDSN , BYREF lpdwUsageCount AS QUAD ' LPDWORD lpdwUsageCount
#IF %DEF(%UNICODE)
 MACRO SQLRemoveDriver = SQLRemoveDriverW
#ELSE
 MACRO SQLRemoveDriver = SQLRemoveDriverA
#ENDIF
DECLARE FUNCTION SQLConfigDriverW LIB "odbccp32.dll" ALIAS "SQLConfigDriverW" ( BYVAL hwndParent AS QUAD ) AS LONG ' HWND hwndParent , BYVAL fRequest AS WORD ' WORD fRequest , BYREF lpszDriver AS WSTRINGZ ' LPCWSTR lpszDriver , BYREF lpszArgs AS WSTRINGZ ' LPCWSTR lpszArgs , BYREF lpszMsg AS WSTRINGZ ' LPWSTR lpszMsg , BYVAL cbMsgMax AS WORD ' WORD cbMsgMax , BYREF pcbMsgOut AS WORD ' WORD pcbMsgOut
#IF %DEF(%UNICODE)
 MACRO SQLConfigDriver = SQLConfigDriverW
#ELSE
 MACRO SQLConfigDriver = SQLConfigDriverA
#ENDIF
#ENDIF
#IF %ODBCVER >= &H0300
DECLARE FUNCTION SQLInstallerErrorW LIB "odbccp32.dll" ALIAS "SQLInstallerErrorW" ( BYVAL iError AS WORD ' WORD iError , BYREF pfErrorCode AS QUAD ' DWORD *pfErrorCode , BYREF lpszErrorMsg AS WSTRINGZ ' LPCWSTR lpszErrorMsg , BYVAL cbErrorMsgMax AS WORD ' WORD cbErrorMsgMax , BYREF pcbErrorMsg AS WORD ' WORD pcbErrorMsg ) AS INTEGER ' SQLRETURN
#IF %DEF(%UNICODE)
 MACRO SQLInstallerError = SQLInstallerErrorW
#ELSE
 MACRO SQLInstallerError = SQLInstallerErrorA
#ENDIF
DECLARE FUNCTION SQLPostInstallerErrorW LIB "odbccp32.dll" ALIAS "SQLPostInstallerErrorW" ( BYVAL dwErrorCode AS QUAD ' DWORD dwErrorCode , BYREF lpszErrMsg AS WSTRINGZ ' LPCWSTR lpszErrMsg ) AS INTEGER ' SQLRETURN
#IF %DEF(%UNICODE)
 MACRO SQLPostInstallerError = SQLPostInstallerErrorW
#ELSE
 MACRO SQLPostInstallerError = SQLPostInstallerErrorA
#ENDIF
DECLARE FUNCTION SQLWriteFileDSNW LIB "odbccp32.dll" ALIAS "SQLWriteFileDSNW" ( BYREF lpszFileName AS WSTRINGZ ) AS LONG ' LPCWSTR lpszFileName , BYREF lpszAppName AS WSTRINGZ ' LPCWSTR lpszAppName , BYREF lpszKeyName AS WSTRINGZ ' LPCWSTR lpszKeyName , BYREF lpszString AS WSTRINGZ ' LPCWSTR lpszString
#IF %DEF(%UNICODE)
 MACRO SQLWriteFileDSN = SQLWriteFileDSNW
#ELSE
 MACRO SQLWriteFileDSN = SQLWriteFileDSNA
#ENDIF
DECLARE FUNCTION SQLReadFileDSNW LIB "odbccp32.dll" ALIAS "SQLReadFileDSNW" ( BYREF lpszFileName AS WSTRINGZ ) AS LONG ' LPCWSTR lpszFileName , BYREF lpszAppName AS WSTRINGZ ' LPCWSTR lpszAppName , BYREF lpszKeyName AS WSTRINGZ ' LPCWSTR lpszKeyName , BYREF lpszString AS WSTRINGZ ' LPWSTR lpszString , BYVAL cbString AS WORD ' WORD cbString , BYREF pcbString AS WORD ' WORD *pcbString
#IF %DEF(%UNICODE)
 MACRO SQLReadFileDSN = SQLReadFileDSNW
#ELSE
 MACRO SQLReadFileDSN = SQLReadFileDSNA
#ENDIF
' // Note: lpszDriver has been declared as BYVAL DWORD instead of BYREF ASCIIZ because
' // we have to pass a doubly null-terminated list of null separated keyword-value pairs
' // describing the driver.
DECLARE FUNCTION SQLInstallDriverExW LIB "odbccp32.dll" ALIAS "SQLInstallDriverExW" ( BYVAL lpszDriver AS QUAD ) AS LONG ' LPCWSTR lpszDriver , BYREF lpszPathIn AS WSTRINGZ ' LPCWSTR lpszPathIn , BYREF lpszPathOut AS WSTRINGZ ' LPWSTR lpszPathOut , BYVAL cbPathOutMax AS WORD ' WORD cbPathOutMax , BYREF pcbPathOut AS WORD ' WORD *pcbPathOut , BYVAL fRequest AS WORD ' WORD fRequest , BYREF lpdwUsageCount AS QUAD ' LPDWORD lpdwUsageCount
#IF %DEF(%UNICODE)
 MACRO SQLInstallDriverEx = SQLInstallDriverExW
#ELSE
 MACRO SQLInstallDriverEx = SQLInstallDriverExA
#ENDIF
DECLARE FUNCTION SQLInstallTranslatorExW LIB "odbccp32.dll" ALIAS "SQLInstallTranslatorExW" ( BYREF lpszTranslator AS WSTRINGZ ) AS LONG ' LPCWSTR lpszTranslator , BYREF lpszPathIn AS WSTRINGZ ' LPCWSTR lpszPathIn , BYREF lpszPathOut AS WSTRINGZ ' LPWSTR lpszPathOut , BYVAL cbPathOutMax AS WORD ' WORD cbPathOutMax , BYREF pcbPathOut AS WORD ' WORD pcbPathOut , BYVAL fRqquest AS WORD ' WORD fRqquest , BYREF lpdwUsageCount AS QUAD ' LPDWORD lpdwUsageCount
#IF %DEF(%UNICODE)
 MACRO SQLInstallTranslatorEx = SQLInstallTranslatorExW
#ELSE
 MACRO SQLInstallTranslatorEx = SQLInstallTranslatorExA
#ENDIF
#ENDIF ' /* ODBCVER >= 0x0300 */
'// Driver specific Setup APIs called by installer
'BOOL INSTAPI ConfigDSNW (
' HWND hwndParent,
' WORD fRequest,
' LPCWSTR lpszDriver,
' LPCWSTR lpszAttributes);
'#if (ODBCVER >= 0x0250)
'BOOL INSTAPI ConfigDriverW (
' HWND hwndParent,
' WORD fRequest,
' LPCWSTR lpszDriver,
' LPCWSTR lpszArgs,
' LPWSTR lpszMsg,
' WORD cbMsgMax,
' WORD *pcbMsgOut);
'#endif
#ENDIF
