https://bugs.winehq.org/show_bug.cgi?id=47439
Bug ID: 47439 Summary: Multiple .NET 4.x applications using System.Windows.Forms.InputLanguage.get_LayoutName() crash due to missing registry data Product: Wine Version: 4.11 Hardware: x86-64 OS: Linux Status: NEW Severity: normal Priority: P2 Component: user32 Assignee: wine-bugs@winehq.org Reporter: focht@gmx.net Distribution: ---
Hello folks,
encountered with some .NET 4.x apps that make use of 'System.Windows.Forms.InputLanguage' class.
There is old bug 28170 ("Text Service and Input Languages" needs unimplemented function USER32.dll.LoadKeyboardLayoutEx called") which contains some information and partial registry snippets but here only the registry data is required.
--- snip --- ... 002c:Call KERNEL32.FindNLSStringEx(015d124c L"",08400001,019b65b4 L"SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00000409",0000003a,015d4b70 L"\",00000001,0034eb7c,00000000,00000000,00000000) ret=00b3711a 002c:Ret KERNEL32.FindNLSStringEx() retval=00000006 ret=00b3711a 002c:Call KERNEL32.FindNLSStringEx(015d124c L"",08400001,019b65c2 L"CurrentControlSet\Control\Keyboard Layouts\00000409",00000033,015d4b70 L"\",00000001,0034eb7c,00000000,00000000,00000000) ret=00b3711a 002c:Ret KERNEL32.FindNLSStringEx() retval=00000011 ret=00b3711a 002c:Call KERNEL32.FindNLSStringEx(015d124c L"",08400001,019b65e6 L"Control\Keyboard Layouts\00000409",00000021,015d4b70 L"\",00000001,0034eb7c,00000000,00000000,00000000) ret=00b3711a 002c:Ret KERNEL32.FindNLSStringEx() retval=00000007 ret=00b3711a 002c:Call KERNEL32.FindNLSStringEx(015d124c L"",08400001,019b65f6 L"Keyboard Layouts\00000409",00000019,015d4b70 L"\",00000001,0034eb7c,00000000,00000000,00000000) ret=00b3711a 002c:Ret KERNEL32.FindNLSStringEx() retval=00000010 ret=00b3711a 002c:Call KERNEL32.FindNLSStringEx(015d124c L"",08400001,019b6618 L"00000409",00000008,015d4b70 L"\",00000001,0034eb7c,00000000,00000000,00000000) ret=00b3711a 002c:Ret KERNEL32.FindNLSStringEx() retval=ffffffff ret=00b3711a 002c:Call advapi32.RegOpenKeyExW(80000002,019b66d4 L"SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00000409",00000000,00020019,0034eca8) ret=04918a99 002c:Call ntdll.RtlInitUnicodeString(0034ebe0,019b66d4 L"SYSTEM\CurrentControlSet\Control\Keyboard Layouts\00000409") ret=7125815b 002c:Ret ntdll.RtlInitUnicodeString() retval=00000076 ret=7125815b 002c:Call ntdll.NtOpenKeyEx(0034eca8,00020019,0034ebe8,00000000) ret=7125818f 002c:Ret ntdll.NtOpenKeyEx() retval=c0000034 ret=7125818f 002c:Call ntdll.RtlNtStatusToDosError(c0000034) ret=7125819b 002c:Ret ntdll.RtlNtStatusToDosError() retval=00000002 ret=7125819b 002c:Ret advapi32.RegOpenKeyExW() retval=00000002 ret=04918a99 002c:trace:seh:raise_exception code=c0000005 flags=0 addr=0xfd36774 ip=0fd36774 tid=002c 002c:trace:seh:raise_exception info[0]=00000000 002c:trace:seh:raise_exception info[1]=00000000 002c:trace:seh:raise_exception eax=00000000 ebx=04090409 ecx=00000000 edx=019b630c esi=00000000 edi=0034ed48 002c:trace:seh:raise_exception ebp=0034ed54 esp=0034ed10 cs=0023 ds=002b es=002b fs=0063 gs=006b flags=00210246 002c:trace:seh:call_vectored_handlers calling handler at 0xcaa398 code=c0000005 flags=0 002c:Call KERNEL32.GetLastError() ret=00caa3c6 002c:Ret KERNEL32.GetLastError() retval=00000000 ret=00caa3c6 002c:trace:seh:call_vectored_handlers handler at 0xcaa398 returned 0 002c:trace:seh:call_stack_handlers calling handler at 0xc79eed code=c0000005 flags=0 002c:Call KERNEL32.GetLastError() ret=00b3af80 --- snip ---
Managed backtrace:
--- snip --- 0042:err:eventlog:ReportEventW L"Application: AWVSSAO_Launcher.exe\nFramework Version: v4.0.30319\nDescription: The process was terminated due to an unhandled exception.\nException Info: System.NullReferenceException\nStack:\n at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, S"... 0042:fixme:advapi:DeregisterEventSource (0xcafe4242) stub
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. at System.Windows.Forms.InputLanguage.get_LayoutName() at Rek.Launcher.MainWindow.OnSourceInitialized(EventArgs args) at System.Windows.Window.CreateSourceWindow(Boolean duringShow) at System.Windows.Window.CreateSourceWindowDuringShow() at System.Windows.Window.SafeCreateWindowDuringShow() at System.Windows.Window.ShowHelper(Object booleanBox) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at Rek.Launcher.App.Main() --- snip ---
.NET Framework source for reference:
https://github.com/dotnet/winforms/blob/f38a7a167d8f83924d43f8d2d8f2b0303435...
In this case it's enough to have the base key created, without any subkeys/data.
--- snip --- $ wine reg add "HKLM\System\CurrentControlSet\Control\Keyboard Layouts\00000409" --- snip ---
$ wine --version wine-4.11-192-g90a1e5d943
Regards