2 * Implementation of the ODBC driver installer
4 * Copyright 2005 Mike McCormack for CodeWeavers
5 * Copyright 2005 Hans Leidekker
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #define NONAMELESSUNION
31 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(odbc);
37 BOOL WINAPI ODBCCPlApplet( LONG i, LONG j, LONG * p1, LONG * p2)
39 FIXME( "( %ld %ld %p %p) : stub!\n", i, j, p1, p2);
43 static LPWSTR SQLInstall_strdup_multi(LPCSTR str)
52 for (p = str; *p; p += lstrlenA(p) + 1)
55 len = MultiByteToWideChar(CP_ACP, 0, str, p - str, NULL, 0 );
56 ret = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR));
57 MultiByteToWideChar(CP_ACP, 0, str, p - str, ret, len );
63 static LPWSTR SQLInstall_strdup(LPCSTR str)
71 len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0 );
72 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
73 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len );
78 BOOL WINAPI SQLConfigDataSourceW(HWND hwndParent, WORD fRequest,
79 LPCWSTR lpszDriver, LPCWSTR lpszAttributes)
83 FIXME("%p %d %s %s\n", hwndParent, fRequest, debugstr_w(lpszDriver),
84 debugstr_w(lpszAttributes));
86 for (p = lpszAttributes; *p; p += lstrlenW(p) + 1)
87 FIXME("%s\n", debugstr_w(p));
92 BOOL WINAPI SQLConfigDataSource(HWND hwndParent, WORD fRequest,
93 LPCSTR lpszDriver, LPCSTR lpszAttributes)
95 FIXME("%p %d %s %s\n", hwndParent, fRequest, debugstr_a(lpszDriver),
96 debugstr_a(lpszAttributes));
100 BOOL WINAPI SQLConfigDriverW(HWND hwndParent, WORD fRequest, LPCWSTR lpszDriver,
101 LPCWSTR lpszArgs, LPWSTR lpszMsg, WORD cbMsgMax, WORD *pcbMsgOut)
103 FIXME("(%p %d %s %s %p %d %p)\n", hwndParent, fRequest, debugstr_w(lpszDriver),
104 debugstr_w(lpszArgs), lpszMsg, cbMsgMax, pcbMsgOut);
108 BOOL WINAPI SQLConfigDriver(HWND hwndParent, WORD fRequest, LPCSTR lpszDriver,
109 LPCSTR lpszArgs, LPSTR lpszMsg, WORD cbMsgMax, WORD *pcbMsgOut)
111 FIXME("(%p %d %s %s %p %d %p)\n", hwndParent, fRequest, debugstr_a(lpszDriver),
112 debugstr_a(lpszArgs), lpszMsg, cbMsgMax, pcbMsgOut);
116 BOOL WINAPI SQLCreateDataSourceW(HWND hwnd, LPCWSTR lpszDS)
119 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
123 BOOL WINAPI SQLCreateDataSource(HWND hwnd, LPCSTR lpszDS)
126 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
130 BOOL WINAPI SQLGetAvailableDriversW(LPCWSTR lpszInfFile, LPWSTR lpszBuf,
131 WORD cbBufMax, WORD *pcbBufOut)
134 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
138 BOOL WINAPI SQLGetAvailableDrivers(LPCSTR lpszInfFile, LPSTR lpszBuf,
139 WORD cbBufMax, WORD *pcbBufOut)
142 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
146 BOOL WINAPI SQLGetConfigMode(UWORD *pwConfigMode)
149 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
153 BOOL WINAPI SQLGetInstalledDriversW(LPWSTR lpszBuf, WORD cbBufMax,
157 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
161 BOOL WINAPI SQLGetInstalledDrivers(LPSTR lpszBuf, WORD cbBufMax,
165 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
169 int WINAPI SQLGetPrivateProfileStringW(LPCWSTR lpszSection, LPCWSTR lpszEntry,
170 LPCWSTR lpszDefault, LPCWSTR RetBuffer, int cbRetBuffer,
171 LPCWSTR lpszFilename)
174 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
178 int WINAPI SQLGetPrivateProfileString(LPCSTR lpszSection, LPCSTR lpszEntry,
179 LPCSTR lpszDefault, LPCSTR RetBuffer, int cbRetBuffer,
183 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
187 BOOL WINAPI SQLGetTranslatorW(HWND hwndParent, LPWSTR lpszName, WORD cbNameMax,
188 WORD *pcbNameOut, LPWSTR lpszPath, WORD cbPathMax,
189 WORD *pcbPathOut, DWORD *pvOption)
192 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
196 BOOL WINAPI SQLGetTranslator(HWND hwndParent, LPSTR lpszName, WORD cbNameMax,
197 WORD *pcbNameOut, LPSTR lpszPath, WORD cbPathMax,
198 WORD *pcbPathOut, DWORD *pvOption)
201 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
205 BOOL WINAPI SQLInstallDriverW(LPCWSTR lpszInfFile, LPCWSTR lpszDriver,
206 LPWSTR lpszPath, WORD cbPathMax, WORD * pcbPathOut)
210 TRACE("%s %s %p %d %p\n", debugstr_w(lpszInfFile),
211 debugstr_w(lpszDriver), lpszPath, cbPathMax, pcbPathOut);
216 return SQLInstallDriverExW(lpszDriver, NULL, lpszPath, cbPathMax,
217 pcbPathOut, ODBC_INSTALL_COMPLETE, &usage);
220 BOOL WINAPI SQLInstallDriver(LPCSTR lpszInfFile, LPCSTR lpszDriver,
221 LPSTR lpszPath, WORD cbPathMax, WORD * pcbPathOut)
225 TRACE("%s %s %p %d %p\n", debugstr_a(lpszInfFile),
226 debugstr_a(lpszDriver), lpszPath, cbPathMax, pcbPathOut);
231 return SQLInstallDriverEx(lpszDriver, NULL, lpszPath, cbPathMax,
232 pcbPathOut, ODBC_INSTALL_COMPLETE, &usage);
235 BOOL WINAPI SQLInstallDriverExW(LPCWSTR lpszDriver, LPCWSTR lpszPathIn,
236 LPWSTR lpszPathOut, WORD cbPathOutMax, WORD *pcbPathOut,
237 WORD fRequest, LPDWORD lpdwUsageCount)
241 WCHAR path[MAX_PATH];
243 TRACE("%s %s %p %d %p %d %p\n", debugstr_w(lpszDriver),
244 debugstr_w(lpszPathIn), lpszPathOut, cbPathOutMax, pcbPathOut,
245 fRequest, lpdwUsageCount);
247 for (p = lpszDriver; *p; p += lstrlenW(p) + 1)
248 TRACE("%s\n", debugstr_w(p));
250 len = GetSystemDirectoryW(path, MAX_PATH);
255 len = GetSystemDirectoryW(path, MAX_PATH);
257 if (lpszPathOut && cbPathOutMax > len)
259 lstrcpyW(lpszPathOut, path);
265 BOOL WINAPI SQLInstallDriverEx(LPCSTR lpszDriver, LPCSTR lpszPathIn,
266 LPSTR lpszPathOut, WORD cbPathOutMax, WORD *pcbPathOut,
267 WORD fRequest, LPDWORD lpdwUsageCount)
270 LPWSTR driver, pathin;
271 WCHAR pathout[MAX_PATH];
275 TRACE("%s %s %p %d %p %d %p\n", debugstr_a(lpszDriver),
276 debugstr_a(lpszPathIn), lpszPathOut, cbPathOutMax, pcbPathOut,
277 fRequest, lpdwUsageCount);
279 for (p = lpszDriver; *p; p += lstrlenA(p) + 1)
280 TRACE("%s\n", debugstr_a(p));
282 driver = SQLInstall_strdup_multi(lpszDriver);
283 pathin = SQLInstall_strdup(lpszPathIn);
285 ret = SQLInstallDriverExW(driver, pathin, pathout, MAX_PATH, &cbOut,
286 fRequest, lpdwUsageCount);
289 int len = WideCharToMultiByte(CP_ACP, 0, pathout, -1, lpszPathOut,
294 *pcbPathOut = len - 1;
296 if (!lpszPathOut || cbPathOutMax < len)
301 len = WideCharToMultiByte(CP_ACP, 0, pathout, -1, lpszPathOut,
302 cbPathOutMax, NULL, NULL);
307 HeapFree(GetProcessHeap(), 0, driver);
308 HeapFree(GetProcessHeap(), 0, pathin);
312 BOOL WINAPI SQLInstallDriverManagerW(LPWSTR lpszPath, WORD cbPathMax,
316 WCHAR path[MAX_PATH];
318 TRACE("(%p %d %d)\n", lpszPath, cbPathMax, *pcbPathOut);
320 len = GetSystemDirectoryW(path, MAX_PATH);
325 if (lpszPath && cbPathMax > len)
327 lstrcpyW(lpszPath, path);
333 BOOL WINAPI SQLInstallDriverManager(LPSTR lpszPath, WORD cbPathMax,
338 WCHAR path[MAX_PATH];
340 TRACE("(%p %d %d)\n", lpszPath, cbPathMax, *pcbPathOut);
342 ret = SQLInstallDriverManagerW(path, MAX_PATH, &cbOut);
345 len = WideCharToMultiByte(CP_ACP, 0, path, -1, lpszPath, 0,
350 *pcbPathOut = len - 1;
352 if (!lpszPath || cbPathMax < len)
355 len = WideCharToMultiByte(CP_ACP, 0, path, -1, lpszPath,
356 cbPathMax, NULL, NULL);
362 BOOL WINAPI SQLInstallODBCW(HWND hwndParent, LPCWSTR lpszInfFile,
363 LPCWSTR lpszSrcPath, LPCWSTR lpszDrivers)
366 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
370 BOOL WINAPI SQLInstallODBC(HWND hwndParent, LPCSTR lpszInfFile,
371 LPCSTR lpszSrcPath, LPCSTR lpszDrivers)
374 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
378 SQLRETURN WINAPI SQLInstallerErrorW(WORD iError, DWORD *pfErrorCode,
379 LPWSTR lpszErrorMsg, WORD cbErrorMsgMax, WORD *pcbErrorMsg)
381 TRACE("%d %p %p %d %p\n", iError, pfErrorCode, lpszErrorMsg,
382 cbErrorMsgMax, pcbErrorMsg);
387 if (lpszErrorMsg && cbErrorMsgMax > 0)
388 *lpszErrorMsg = '\0';
393 SQLRETURN WINAPI SQLInstallerError(WORD iError, DWORD *pfErrorCode,
394 LPSTR lpszErrorMsg, WORD cbErrorMsgMax, WORD *pcbErrorMsg)
396 TRACE("%d %p %p %d %p\n", iError, pfErrorCode, lpszErrorMsg,
397 cbErrorMsgMax, pcbErrorMsg);
402 if (lpszErrorMsg && cbErrorMsgMax > 0)
403 *lpszErrorMsg = '\0';
408 BOOL WINAPI SQLInstallTranslatorExW(LPCWSTR lpszTranslator, LPCWSTR lpszPathIn,
409 LPWSTR lpszPathOut, WORD cbPathOutMax, WORD *pcbPathOut,
410 WORD fRequest, LPDWORD lpdwUsageCount)
414 WCHAR path[MAX_PATH];
416 TRACE("%s %s %p %d %p %d %p\n", debugstr_w(lpszTranslator),
417 debugstr_w(lpszPathIn), lpszPathOut, cbPathOutMax, pcbPathOut,
418 fRequest, lpdwUsageCount);
420 for (p = lpszTranslator; *p; p += lstrlenW(p) + 1)
421 TRACE("%s\n", debugstr_w(p));
423 len = GetSystemDirectoryW(path, MAX_PATH);
428 if (lpszPathOut && cbPathOutMax > len)
430 lstrcpyW(lpszPathOut, path);
436 BOOL WINAPI SQLInstallTranslatorEx(LPCSTR lpszTranslator, LPCSTR lpszPathIn,
437 LPSTR lpszPathOut, WORD cbPathOutMax, WORD *pcbPathOut,
438 WORD fRequest, LPDWORD lpdwUsageCount)
441 LPWSTR translator, pathin;
442 WCHAR pathout[MAX_PATH];
446 TRACE("%s %s %p %d %p %d %p\n", debugstr_a(lpszTranslator),
447 debugstr_a(lpszPathIn), lpszPathOut, cbPathOutMax, pcbPathOut,
448 fRequest, lpdwUsageCount);
450 for (p = lpszTranslator; *p; p += lstrlenA(p) + 1)
451 TRACE("%s\n", debugstr_a(p));
453 translator = SQLInstall_strdup_multi(lpszTranslator);
454 pathin = SQLInstall_strdup(lpszPathIn);
456 ret = SQLInstallTranslatorExW(translator, pathin, pathout, MAX_PATH,
457 &cbOut, fRequest, lpdwUsageCount);
460 int len = WideCharToMultiByte(CP_ACP, 0, pathout, -1, lpszPathOut,
465 *pcbPathOut = len - 1;
467 if (!lpszPathOut || cbPathOutMax < len)
472 len = WideCharToMultiByte(CP_ACP, 0, pathout, -1, lpszPathOut,
473 cbPathOutMax, NULL, NULL);
478 HeapFree(GetProcessHeap(), 0, translator);
479 HeapFree(GetProcessHeap(), 0, pathin);
483 BOOL WINAPI SQLInstallTranslator(LPCSTR lpszInfFile, LPCSTR lpszTranslator,
484 LPCSTR lpszPathIn, LPSTR lpszPathOut, WORD cbPathOutMax,
485 WORD *pcbPathOut, WORD fRequest, LPDWORD lpdwUsageCount)
487 TRACE("%s %s %s %p %d %p %d %p\n", debugstr_a(lpszInfFile),
488 debugstr_a(lpszTranslator), debugstr_a(lpszPathIn), lpszPathOut,
489 cbPathOutMax, pcbPathOut, fRequest, lpdwUsageCount);
494 return SQLInstallTranslatorEx(lpszTranslator, lpszPathIn, lpszPathOut,
495 cbPathOutMax, pcbPathOut, fRequest, lpdwUsageCount);
498 BOOL WINAPI SQLInstallTranslatorW(LPCWSTR lpszInfFile, LPCWSTR lpszTranslator,
499 LPCWSTR lpszPathIn, LPWSTR lpszPathOut, WORD cbPathOutMax,
500 WORD *pcbPathOut, WORD fRequest, LPDWORD lpdwUsageCount)
502 TRACE("%s %s %s %p %d %p %d %p\n", debugstr_w(lpszInfFile),
503 debugstr_w(lpszTranslator), debugstr_w(lpszPathIn), lpszPathOut,
504 cbPathOutMax, pcbPathOut, fRequest, lpdwUsageCount);
509 return SQLInstallTranslatorExW(lpszTranslator, lpszPathIn, lpszPathOut,
510 cbPathOutMax, pcbPathOut, fRequest, lpdwUsageCount);
513 BOOL WINAPI SQLManageDataSources(HWND hwnd)
516 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
520 SQLRETURN WINAPI SQLPostInstallerErrorW(DWORD fErrorCode, LPCWSTR szErrorMsg)
523 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
527 SQLRETURN WINAPI SQLPostInstallerError(DWORD fErrorCode, LPCSTR szErrorMsg)
530 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
534 BOOL WINAPI SQLReadFileDSNW(LPCWSTR lpszFileName, LPCWSTR lpszAppName,
535 LPCWSTR lpszKeyName, LPWSTR lpszString, WORD cbString,
539 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
543 BOOL WINAPI SQLReadFileDSN(LPCSTR lpszFileName, LPCSTR lpszAppName,
544 LPCSTR lpszKeyName, LPSTR lpszString, WORD cbString,
548 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
552 BOOL WINAPI SQLRemoveDefaultDataSource(void)
555 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
559 BOOL WINAPI SQLRemoveDriverW(LPCWSTR lpszDriver, BOOL fRemoveDSN,
560 LPDWORD lpdwUsageCount)
563 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
567 BOOL WINAPI SQLRemoveDriver(LPCSTR lpszDriver, BOOL fRemoveDSN,
568 LPDWORD lpdwUsageCount)
571 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
575 BOOL WINAPI SQLRemoveDriverManager(LPDWORD pdwUsageCount)
578 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
582 BOOL WINAPI SQLRemoveDSNFromIniW(LPCWSTR lpszDSN)
585 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
589 BOOL WINAPI SQLRemoveDSNFromIni(LPCSTR lpszDSN)
592 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
596 BOOL WINAPI SQLRemoveTranslatorW(LPCWSTR lpszTranslator, LPDWORD lpdwUsageCount)
599 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
603 BOOL WINAPI SQLRemoveTranslator(LPCSTR lpszTranslator, LPDWORD lpdwUsageCount)
606 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
610 BOOL WINAPI SQLSetConfigMode(UWORD wConfigMode)
613 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
617 BOOL WINAPI SQLValidDSNW(LPCWSTR lpszDSN)
620 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
624 BOOL WINAPI SQLValidDSN(LPCSTR lpszDSN)
627 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
631 BOOL WINAPI SQLWriteDSNToIniW(LPCWSTR lpszDSN, LPCWSTR lpszDriver)
634 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
638 BOOL WINAPI SQLWriteDSNToIni(LPCSTR lpszDSN, LPCSTR lpszDriver)
641 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
645 BOOL WINAPI SQLWriteFileDSNW(LPCWSTR lpszFileName, LPCWSTR lpszAppName,
646 LPCWSTR lpszKeyName, LPCWSTR lpszString)
649 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
653 BOOL WINAPI SQLWriteFileDSN(LPCSTR lpszFileName, LPCSTR lpszAppName,
654 LPCSTR lpszKeyName, LPCSTR lpszString)
657 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
661 BOOL WINAPI SQLWritePrivateProfileStringW(LPCWSTR lpszSection, LPCWSTR lpszEntry,
662 LPCWSTR lpszString, LPCWSTR lpszFilename)
665 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
669 BOOL WINAPI SQLWritePrivateProfileString(LPCSTR lpszSection, LPCSTR lpszEntry,
670 LPCSTR lpszString, LPCSTR lpszFilename)
673 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);