[Bug 50116] New: ODBC applications fail to create/configure system DSNs with builtin 'odbccp32' (SQLConfigDataSource must remap ODBC_xxx_SYS_DSN values for ConfigDSN)
WineHQ Bugzilla
wine-bugs at winehq.org
Wed Nov 11 09:41:49 CST 2020
https://bugs.winehq.org/show_bug.cgi?id=50116
Bug ID: 50116
Summary: ODBC applications fail to create/configure system DSNs
with builtin 'odbccp32' (SQLConfigDataSource must
remap ODBC_xxx_SYS_DSN values for ConfigDSN)
Product: Wine
Version: 5.21
Hardware: x86-64
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: odbc
Assignee: wine-bugs at winehq.org
Reporter: focht at gmx.net
Distribution: ---
Hello folks,
encountered with S-Hoai client 13.x from bug 7955
Download:
https://web.archive.org/web/20160419173100/http://www.kbld.de/fileadmin/default/downloads/testversionen/shoai13-kompakt.exe
Prerequisite:
* 'winetricks -q jet40'
* MS Access 2000 runtime from
http://download.microsoft.com/download/office2000dev/art2kmin/1/win98/en-us/art2kmin.exe
-> 'winetricks -q art2kmin' can't be used here
(https://github.com/Winetricks/winetricks/issues/1641)
Content of 'MakeDSN.ini'
--- snip ---
[shoai_access]
; die folgenden Einträge sollten immer da sein
Driver=Microsoft Access Driver (*.mdb)
DSNType=System
DSN=shoai13
DESCRIPTION=S-HOAI 13.0 Access
DBQ=C:\KOBOLD\shoai.13\data\kobold13.mdb
FIL=MS Access;
--- snip ---
Re-running the admin tool after installation:
--- snip ---
$ pwd
/home/focht/.wine/drive_c/KOBOLD/shoai.13/admin/client-installation/tools/makedsn
$ WINEDEBUG=+seh,+relay,+loaddll,+odbc wine ./makedsn.exe >>log.txt 2>&1
...
0170:trace:loaddll:build_module Loaded L"C:\\windows\\system32\\ODBCCP32.DLL"
at 00990000: builtin
0170:Call PE DLL (proc=00996200,module=00990000
L"ODBCCP32.DLL",reason=WINE_PREATTACH,res=00000000)
0170:Ret PE DLL (proc=00996200,module=00990000
L"ODBCCP32.DLL",reason=WINE_PREATTACH,res=00000000) retval=1
...
0170:Call
KERNEL32.GetPrivateProfileStringA(00000000,00000000,00000000,00eb51bc,00004000,00eb5104
"C:\\KOBOLD\\shoai.13\\admin\\client-installation\\tools\\makedsn\\\\MakeDSN.ini")
ret=0046425d
...
0170:Ret KERNEL32.GetPrivateProfileStringA() retval=0000000d ret=0046425d
0170:Call KERNEL32.GetPrivateProfileStringA(00eb91c8
"shoai_access",00000000,00000000,00eb926c,00004000,00eb5104
"C:\\KOBOLD\\shoai.13\\admin\\client-installation\\tools\\makedsn\\\\MakeDSN.ini")
ret=00464366
...
0170:Call odbccp32.SQLConfigDataSource(00000000,00000004,00ebd464 "Microsoft
Access Driver (*.mdb)",00ebd54c "DSN=shoai13") ret=00465612
...
0170:trace:odbc:SQLConfigDataSource "DSN=shoai13"
0170:trace:odbc:SQLConfigDataSource "DESCRIPTION=S-HOAI 13.0 Access"
0170:trace:odbc:SQLConfigDataSource
"DBQ=C:\\KOBOLD\\shoai.13\\data\\kobold13.mdb"
0170:trace:odbc:SQLConfigDataSource "FIL=MS Access;"
...
0170:Call advapi32.RegOpenKeyW(80000002,009976d0
L"Software\\ODBC\\ODBCINST.INI\\",0031fdcc) ret=00991b65
...
0170:Ret advapi32.RegOpenKeyW() retval=00000000 ret=00991b65
0170:Call advapi32.RegOpenKeyW(00000090,001909b0 L"Microsoft Access Driver
(*.mdb)",0031fdd0) ret=00991b7d
...
0170:Ret advapi32.RegOpenKeyW() retval=00000000 ret=00991b7d
...
0170:Call advapi32.RegGetValueW(00000094,00000000,0099a028
L"driver",00000002,0031fdc8,001909f8,0031fdc4) ret=00991c3e
...
0170:Ret advapi32.RegGetValueW() retval=00000000 ret=00991c3e
...
0170:Call KERNEL32.LoadLibraryW(001909f8
L"C:\\windows\\system32\\ODBCJT32.DLL") ret=00991c53
...
0170:trace:loaddll:build_module Loaded L"C:\\windows\\system32\\ODBCJT32.DLL"
at 010B0000: native
...
0170:Ret KERNEL32.LoadLibraryW() retval=010b0000 ret=00991c53
...
0170:Call KERNEL32.GetProcAddress(010b0000,00997194 "ConfigDSN") ret=00991e58
0170:Ret KERNEL32.GetProcAddress() retval=012722aa ret=00991e58
...
0170:trace:odbc:SQLConfigDataSource Calling ConfigDSN
...
0170:Call msvcrt.wcslen(01280f28 L"DSN=shoai13;DESCRIPTION=S-HOAI 13.0
Access;DBQ=C:\\KOBOLD\\shoai.13\\data\\kobold13.mdb;FIL=MS
Access;;1\3a5f\7bc2\01c8;\0001;") ret=010bae8d
0170:Ret msvcrt.wcslen() retval=0000006a ret=010bae8d
...
0170:Call KERNEL32.LoadLibraryA(010b4bac "odbccp32.dll") ret=010dc812
...
0170:Ret KERNEL32.LoadLibraryA() retval=00990000 ret=010dc812
0170:Call KERNEL32.LoadLibraryA(0031dd60 "C:\\windows\\system32\\odbccp32.dll")
ret=010dc820
...
0170:Ret KERNEL32.LoadLibraryA() retval=00990000 ret=010dc820
0170:Call KERNEL32.FreeLibrary(00990000) ret=010dc987
...
0170:Ret KERNEL32.FreeLibrary() retval=00000001 ret=010dc987
...
0170:Call KERNEL32.GetProcAddress(00990000,010b4b10
"SQLGetPrivateProfileString") ret=010dc6a1
0170:Ret KERNEL32.GetProcAddress() retval=00991248 ret=010dc6a1
0170:Call odbccp32.SQLGetPrivateProfileString(01284aa8 "ODBC Data
Sources",01284ad8 "shoai13",01284af8 "",0031f2e0,0000012b,01284b10 "odbc.ini")
ret=010dc59e
0170:trace:odbc:SQLGetPrivateProfileString "ODBC Data Sources" "shoai13" ""
0031F2E0 299 "odbc.ini"
...
0170:Call advapi32.RegOpenKeyW(80000001,00997950 L"Software\\ODBC",0031e34c)
ret=00992fa0
...
0170:Ret advapi32.RegOpenKeyW() retval=00000000 ret=00992fa0
0170:Call advapi32.RegOpenKeyW(000000a0,00191f38 L"odbc.ini",0031e350)
ret=00992fb3
...
0170:Ret advapi32.RegOpenKeyW() retval=00000000 ret=00992fb3
...
0170:Call advapi32.RegOpenKeyW(000000a4,00191f08 L"ODBC Data Sources",0031e348)
ret=00992fce
...
0170:Ret advapi32.RegOpenKeyW() retval=00000002 ret=00992fce
...
0170:Ret odbccp32.SQLGetPrivateProfileString() retval=00000000 ret=010dc59e
...
0170:Ret odbccp32.SQLConfigDataSource() retval=00000000 ret=00465612
...
0170:Call user32.MessageBoxA(00030072,00eb51a4 "Folgende DSN konnte(n) nicht
angelegt werden:\rshoai_access\r\n",00465108 "Fehler",00040010) ret=00465047
--- snip ---
Wine source:
https://source.winehq.org/git/wine.git/blob/b940c5e7c91bff963336dd7d2c4defc3a82c75a1:/dlls/odbccp32/odbccp32.c#l374
--- snip ---
374 BOOL WINAPI SQLConfigDataSource(HWND hwnd, WORD request, LPCSTR driver,
LPCSTR attributes)
375 {
376 HMODULE mod;
377 BOOL ret = FALSE;
378 WCHAR *driverW;
379
380 TRACE("%p, %d, %s, %s\n", hwnd, request, debugstr_a(driver),
debugstr_a(attributes));
381
382 if (TRACE_ON(odbc))
383 {
384 const char *p;
385 for (p = attributes; *p; p += lstrlenA(p) + 1)
386 TRACE("%s\n", debugstr_a(p));
387 }
388
389 clear_errors();
390
391 driverW = heap_strdupAtoW(driver);
392 if (!driverW)
393 {
394 push_error(ODBC_ERROR_OUT_OF_MEM, odbc_error_out_of_mem);
395 return FALSE;
396 }
397
398 mod = load_config_driver(driverW);
399 if (!mod)
400 {
401 heap_free(driverW);
402 return FALSE;
403 }
404
405 pConfigDSN = (void*)GetProcAddress(mod, "ConfigDSN");
406 if (pConfigDSN)
407 {
408 TRACE("Calling ConfigDSN\n");
409 ret = pConfigDSN(hwnd, request, driver, attributes);
410 }
411 else
412 {
413 pConfigDSNW = (void*)GetProcAddress(mod, "ConfigDSNW");
414 if (pConfigDSNW)
415 {
416 WCHAR *attr = NULL;
417 TRACE("Calling ConfigDSNW\n");
418
419 attr = SQLInstall_strdup_multi(attributes);
420 if(attr)
421 ret = pConfigDSNW(hwnd, request, driverW, attr);
422 heap_free(attr);
423 }
424 }
425
426 if (!ret)
427 push_error(ODBC_ERROR_REQUEST_FAILED, odbc_error_request_failed);
428
429 heap_free(driverW);
430 FreeLibrary(mod);
431
432 return ret;
433 }
--- snip ---
Microsoft docs 'SQLConfigDataSource':
https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlconfigdatasource-function
Microsoft docs 'ConfigDSN':
https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/configdsn-function
--- quote ---
Arguments
hwndParent
[Input] Parent window handle. The function will not display any dialog boxes if
the handle is null.
fRequest
[Input] Type of request. The fRequest argument must contain one of the
following values:
ODBC_ADD_DSN: Add a new data source.
ODBC_CONFIG_DSN: Configure (modify) an existing data source.
ODBC_REMOVE_DSN: Remove an existing data source.
lpszDriver
[Input] Driver description (usually the name of the associated DBMS) presented
to users instead of the physical driver name.
lpszAttributes
[Input] A doubly null-terminated list of attributes in the form of
keyword-value pairs. For more information, see "Comments."
--- quote ---
You can't just pass 'fRequest' argument from 'SQLConfigDataSource' unmodified
to the driver's 'ConfigDSN' function. All ODBC_xxx_SYS_DSN request values must
be properly remapped to ODBC_xxx_DSN values. The fix should be applied to both,
the ansi and wide-char variant.
Maybe it's also the reason for other ODBC apps failing. 'winetricks' no longer
overrides 'odbccp32.dll' to native for MDAC verbs
(https://github.com/Winetricks/winetricks/issues/1448)
https://github.com/Winetricks/winetricks/issues/1637
NOTE: It doesn't fully fix the DSN creation due to other builtin 'odbccp32'
insufficiencies but it's a step in right direction.
$ sha1sum shoai13-kompakt.exe
ee726de4309c6667c458296c4530102254fc7a20 shoai13-kompakt.exe
$ du -sh shoai13-kompakt.exe
38M shoai13-kompakt.exe
$ sha1sum art2kmin.exe
73be2622254d1f857a204a03f068787542b985e9 art2kmin.exe
$ du -sh art2kmin.exe
33M art2kmin.exe
$ wine --version
wine-5.21-69-gb940c5e7c91
Regards
--
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.
More information about the wine-bugs
mailing list