https://bugs.winehq.org/show_bug.cgi?id=48956
Bug ID: 48956 Summary: winecfg fails to initialize kernelbase.dll Product: Wine Version: 5.6 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: critical Priority: P2 Component: winecrt0 Assignee: wine-bugs@winehq.org Reporter: jeff@macloue.com Distribution: ---
Created attachment 66932 --> https://bugs.winehq.org/attachment.cgi?id=66932 WINEDEBUG=+module,+nls,+file,+reg,+ntdll winecfg
winecfg fails to initialize on an empty prefix, with the following message:
000d:err:module:LdrInitializeThunk "kernelbase.dll" failed to initialize, aborting
Using bisect I traced the error to the following commit:
commit 036f4dca3c7f9ee8964bb4ae0c4bcd106a347c7b Author: Alexandre Julliard julliard@winehq.org Date: Wed Apr 8 15:09:00 2020 +0200
winecrt0: Rebuild the argv array instead of getting it from libwine.
Signed-off-by: Alexandre Julliard julliard@winehq.org
After studying the debug output I found that the process of kernelbase.dll initialization is strange. First time the trace output comes from 64-bit version:
000f:trace:module:MODULE_InitDLL (0x7b010000 L"kernelbase.dll",PROCESS_ATTACH,0x32fb00) - CALL 000f:trace:module:LdrGetDllHandle L"kernel32.dll" -> 0x7b420000 (load path L"C:\windows\system32;C:\windows\system32;C:\windows\system; 000f:trace:nls:GetLocaleInfoW (lcid=0x409,lctype=0x1004,000000000032E38C,2) 000f:trace:module:FindResourceExW 000000007B420000 #0006 #0101 0409 000f:trace:module:LoadResource 000000007B420000 000000007B4D83B0 000f:trace:nls:GetLocaleInfoW (lcid=0x409,lctype=0x1004,000000000032E38C,2) returning number 1252 000f:trace:nls:GetLocaleInfoW (lcid=0x409,lctype=0x1011,000000007B0DBBE0,2)
And the second time the output looks like coming from 32-bit code:
000d:trace:module:MODULE_InitDLL (0x7b010000 L"kernelbase.dll",PROCESS_ATTACH,0x32fd24) - CALL 000d:trace:module:LdrGetDllHandle L"kernel32.dll" -> 0x7b410000 (load path L"C:\windows\system32;C:\windows\system32;C:\windows\system; 000d:trace:nls:GetLocaleInfoW (lcid=0x409,lctype=0x1004,0032E748,2) 000d:trace:module:FindResourceExW 7B410000 #0006 #0101 0409 000d:trace:module:LoadResource 7B410000 7B4B6EF4 000d:trace:nls:GetLocaleInfoW (lcid=0x409,lctype=0x1004,0032E748,2) returning number 1252
(note narrower integer values)
Before the commit in question all the output from MODULE_InitDLL looks identical.
The exact reason of initialization failure is because FILE_CreateFile() returns STATUS_OBJECT_PATH_NOT_FOUND instead of STATUS_OBJECT_NAME_NOT_FOUND when looking for sortdefault.nls:
000d:trace:ntdll:FILE_CreateFile handle=0x32e45c access=80000000 name=L"\??\C:\windows\globalization\sorting\sortdefault.nls" objattr=00000000 root=(nil) sec=(nil) io=0x32e3e8 alloc_size=(nil) attr=00000000 sharing=00000001 disp=1 options=00000010 ea=(nil).0x00000000 000d:trace:file:wine_nt_to_unix_file_name L"\windows\globalization\sorting\sortdefault.nls" not found in /tmp/mock/dosdevices/c:/windows 000d:warn:ntdll:FILE_CreateFile L"\??\C:\windows\globalization\sorting\sortdefault.nls" not found (c000003a)
Because of this the code in open_nls_data_file in dlls/ntdll/locale.c does not look in the WINEDATADIR for the file and returns overall failure. Compare to the previous, successful call:
000f:trace:ntdll:FILE_CreateFile handle=0x32dfb8 access=80000000 name=L"\??\C:\windows\globalization\sorting\sortdefault.nls" objattr=00000000 root=(nil) sec=(nil) io=0x32ded0 alloc_size=(nil) attr=00000000 sharing=00000001 disp=1 options=00000010 ea=(nil).0x00000000 000f:trace:file:wine_nt_to_unix_file_name L"\windows\globalization\sorting\sortdefault.nls" not found in /tmp/mock/dosdevices/c:/windows/globalization/sorting/sortdefault.nls 000f:warn:ntdll:FILE_CreateFile L"\??\C:\windows\globalization\sorting\sortdefault.nls" not found (c0000034)
(Note a different status code returned and that wine_nt_to_unix_file_name() looks for the file in the correct place)
I was unable to find out why exactly this happens, the commit in question does not seem to touch anything that may cause the issue.
winecfg works if called with "wine64 winecfg", but unfortunately running Win32 programs is not possible either with "wine" or "wine64" - failing with the same error, so I consider the bug critical.
The bug can be worked around by manually copying nls/sortdefault.nls to $WINEPREFIX/drive_c/windows/globalization/sorting/ - or using wine on a prefix initialized by a working version. It does not reproduce on wine64-only install (which cannot run Win32 application by design), and though "wine64 winecfg" works - it doesn't add the windows/globalization/sorting/sortdefault.nls or other NLS files any more.
The full trace log of winecfg which ends with the error is attached.
https://bugs.winehq.org/show_bug.cgi?id=48956
Jeff MacLoue jeff@macloue.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Regression SHA1| |036f4dca3c7f9ee8964bb4ae0c4 | |bcd106a347c7b Distribution|--- |Slackware
https://bugs.winehq.org/show_bug.cgi?id=48956
--- Comment #1 from Alexandre Julliard julliard@winehq.org --- Probably already fixed by 3622b9ab153ce792aa3add8d3aa71b487edfda9a.
https://bugs.winehq.org/show_bug.cgi?id=48956
--- Comment #2 from Jeff MacLoue jeff@macloue.com --- (In reply to Alexandre Julliard from comment #1)
Probably already fixed by 3622b9ab153ce792aa3add8d3aa71b487edfda9a.
Re-verified with the latest master - indeed it was broken for me for another reason so missed this while bisecting.
The bug does not reproduce, it is fixed.
https://bugs.winehq.org/show_bug.cgi?id=48956
Jeff MacLoue jeff@macloue.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID
--- Comment #3 from Jeff MacLoue jeff@macloue.com --- Already fixed in master
https://bugs.winehq.org/show_bug.cgi?id=48956
Dmitry Timoshkov dmitry@baikal.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- Severity|critical |normal Fixed by SHA1| |3622b9ab153ce792aa3add8d3aa | |71b487edfda9a Resolution|INVALID |FIXED
--- Comment #4 from Dmitry Timoshkov dmitry@baikal.ru --- Reported fixed.
https://bugs.winehq.org/show_bug.cgi?id=48956
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #5 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 5.7.
https://bugs.winehq.org/show_bug.cgi?id=48956
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |michael.scott@quest-arts.co | |.uk
--- Comment #6 from Alexandre Julliard julliard@winehq.org --- *** Bug 49018 has been marked as a duplicate of this bug. ***
https://bugs.winehq.org/show_bug.cgi?id=48956
Gijs Vermeulen gijsvrm@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |regression