WineHQ
Bug Tracking Database – Bug 48956

 Bugzilla

 

Last modified: 2020-06-30 15:25:18 UTC  

winecfg fails to initialize kernelbase.dll

Bug 48956 - winecfg fails to initialize kernelbase.dll
winecfg fails to initialize kernelbase.dll
Status: CLOSED FIXED
AppDB: Show Apps affected by this bug
Product: Wine
Classification: Unclassified
Component: winecrt0
5.6
x86-64 Linux
: P2 normal
: ---
Assigned To: Mr. Bugs
: regression
: 49018 (view as bug list)
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2020-04-17 13:34 UTC by Jeff MacLoue
Modified: 2020-06-30 15:25 UTC (History)
1 user (show)

See Also:
Regression SHA1: 036f4dca3c7f9ee8964bb4ae0c4bcd106a347c7b
Fixed by SHA1: 3622b9ab153ce792aa3add8d3aa71b487edfda9a
Distribution: Slackware
Staged patchset:


Attachments
WINEDEBUG=+module,+nls,+file,+reg,+ntdll winecfg (508.42 KB, text/plain)
2020-04-17 13:34 UTC, Jeff MacLoue
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff MacLoue 2020-04-17 13:34:47 UTC
Created attachment 66932 [details]
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.
Comment 1 Alexandre Julliard 2020-04-17 13:55:39 UTC
Probably already fixed by 3622b9ab153ce792aa3add8d3aa71b487edfda9a.
Comment 2 Jeff MacLoue 2020-04-17 17:41:54 UTC
(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.
Comment 3 Jeff MacLoue 2020-04-17 17:42:28 UTC
Already fixed in master
Comment 4 Dmitry Timoshkov 2020-04-17 21:15:54 UTC
Reported fixed.
Comment 5 Alexandre Julliard 2020-04-24 15:15:24 UTC
Closing bugs fixed in 5.7.
Comment 6 Alexandre Julliard 2020-04-26 05:37:28 UTC
*** Bug 49018 has been marked as a duplicate of this bug. ***


Privacy Policy
If you have a privacy inquiry regarding this site, please write to [email protected]

Hosted By CodeWeavers