| 1 | /************************************************* |
| 2 | * SQLInstallDriverManager |
| 3 | * |
| 4 | * I return the default dir for core components.. but |
| 5 | * thats it. |
| 6 | * This may differ slightly from the spec. |
| 7 | * |
| 8 | ************************************************** |
| 9 | * This code was created by Peter Harvey @ CodeByDesign. |
| 10 | * Released under LGPL 28.JAN.99 |
| 11 | * |
| 12 | * Contributions from... |
| 13 | * ----------------------------------------------- |
| 14 | * Peter Harvey - pharvey@codebydesign.com |
| 15 | **************************************************/ |
| 16 | #include <config.h> |
| 17 | #include <odbcinstext.h> |
| 18 | |
| 19 | BOOL SQLInstallDriverManager( LPSTR pszPath, |
| 20 | WORD nPathMax, |
| 21 | WORD *pnPathOut ) |
| 22 | { |
| 23 | char szIniName[ INI_MAX_OBJECT_NAME + 1 ]; |
| 24 | char b1[ ODBC_FILENAME_MAX + 1 ]; |
| 25 | |
| 26 | inst_logClear(); |
| 27 | |
| 28 | /* SANITY CHECKS */ |
| 29 | if ( pszPath == NULL || nPathMax < 2 ) |
| 30 | { |
| 31 | inst_logPushMsg( __FILE__, __FILE__, __LINE__, LOG_CRITICAL, ODBC_ERROR_GENERAL_ERR, "" ); |
| 32 | return 0; |
| 33 | } |
| 34 | |
| 35 | sprintf( szIniName, "%s" , odbcinst_system_file_path( b1 ) ); |
| 36 | |
| 37 | /* DO SOMETHING */ |
| 38 | strncpy( pszPath, szIniName, nPathMax ); |
| 39 | if ( pnPathOut != NULL ) |
| 40 | *pnPathOut = strlen( pszPath ); |
| 41 | |
| 42 | return TRUE; |
| 43 | } |
| 44 | |
| 45 | BOOL INSTAPI SQLInstallDriverManagerW (LPWSTR lpszPath, |
| 46 | WORD cbPathMax, |
| 47 | WORD * pcbPathOut) |
| 48 | { |
| 49 | char *path; |
| 50 | BOOL ret; |
| 51 | |
| 52 | inst_logClear(); |
| 53 | |
| 54 | path = calloc( cbPathMax, 1 ); |
| 55 | |
| 56 | ret = SQLInstallDriverManager( path, cbPathMax, pcbPathOut ); |
| 57 | |
| 58 | if ( ret ) |
| 59 | { |
| 60 | _single_string_copy_to_wide( lpszPath, path, cbPathMax ); |
| 61 | } |
| 62 | |
| 63 | free( path ); |
| 64 | |
| 65 | return ret; |
| 66 | } |
| 67 | |