https://bugs.winehq.org/show_bug.cgi?id=41573
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Battle.net: |Battle.net: |SystemSurvey.exe crashes on |SystemSurvey.exe crashes on |starting Battle.net |startup (GUI process can't | |attach to parent process | |console, 'AttachConsole' is | |a stub) URL| |https://eu.battle.net/accou | |nt/download/ CC| |focht@gmx.net Component|-unknown |kernel32 Keywords| |download Status|CLOSED |REOPENED Ever confirmed|0 |1 Resolution|INVALID |---
--- Comment #14 from Anastasius Focht focht@gmx.net --- Hello folks,
confirming.
The user profile status might have an influence if the app is run or not.
One can reliably reproduce the problem by using the 'start' method (which provides a parent process).
This works:
--- snip --- $ pwd /home/focht/wine-games/wineprefix64-bnet/drive_c/Program Files (x86)/Battle.net/Battle.net.9799
$ WINEDEBUG=+process wine SystemSurvey.exe --version 0009:trace:process:init_current_directory starting in L"C:\Program Files (x86)\Battle.net\Battle.net.9799\" 0x8 ... 0009:trace:process:__wine_kernel_init starting process name=L"C:\Program Files (x86)\Battle.net\Battle.net.9799\SystemSurvey.exe" argv[0]=L"C:\Program Files (x86)\Battle.net\Battle.net.9799\SystemSurvey.exe" ... 0009:fixme:console:AttachConsole stub ffffffff 0009:trace:process:create_process_impl app (null) cmdline L"C:\ProgramData/Battle.net/Agent/Agent.exe" 0009:trace:process:find_exe_file looking for L"C:\ProgramData/Battle.net/Agent/Agent.exe" 0009:trace:process:find_exe_file Trying native exe L"C:\ProgramData\Battle.net\Agent\Agent.exe" 0009:trace:process:create_process_impl starting L"C:\ProgramData\Battle.net\Agent\Agent.exe" as Win32 binary (400000-4af000, arch 014c) 0030:trace:process:init_current_directory starting in L"C:\Program Files (x86)\Battle.net\Battle.net.9799\" 0x20 0030:trace:process:__wine_kernel_init starting process name=L"C:\ProgramData\Battle.net\Agent\Agent.exe" argv[0]=L"C:\ProgramData/Battle.net/Agent/Agent.exe" 0009:trace:process:create_process_impl started process pid 002f tid 0030 ... 0009:fixme:kerberos:kerberos_SpInstanceInit 65536,0x7d4e936c,(nil): stub 0009:fixme:winhttp:get_system_proxy_autoconfig_url no support on this platform 0009:fixme:winhttp:WinHttpDetectAutoProxyConfigUrl discovery via DHCP not supported System Survey Version: 2.4.0.47 Data Version: 3 Git Revision: v2.3.1.44-49-g17d512a Copyright (C) 2013 Blizzard Entertainment. All rights reserved. --- snip ---
(last lines are actual console output)
Using 'start' method to simulate battle.net process startup hierarchy it crashes:
--- snip --- $ pwd /home/focht/wine-games/wineprefix64-bnet/drive_c/Program Files (x86)/Battle.net/Battle.net.9799
$ WINEDEBUG=+process wine start SystemSurvey.exe --version 004f:trace:process:init_current_directory starting in L"C:\Program Files (x86)\Battle.net\Battle.net.9799\" 0x8 004f:trace:process:__wine_kernel_init starting process name=L"C:\windows\system32\start.exe" argv[0]=L"C:\windows\system32\start.exe" ... 004f:fixme:exec:SHELL_execute flags ignored: 0x00000100 004f:trace:process:create_process_impl app (null) cmdline L""SystemSurvey.exe" --version" 004f:trace:process:find_exe_file looking for L"SystemSurvey.exe" 004f:trace:process:find_exe_file Trying native exe L"C:\Program Files (x86)\Battle.net\Battle.net.9799\SystemSurvey.exe" 004f:trace:process:create_process_impl starting L"C:\Program Files (x86)\Battle.net\Battle.net.9799\SystemSurvey.exe" as Win32 binary (400000-629000, arch 014c) 0051:trace:process:init_current_directory starting in L"C:\Program Files (x86)\Battle.net\Battle.net.9799\" 0x14 0051:trace:process:__wine_kernel_init starting process name=L"C:\Program Files (x86)\Battle.net\Battle.net.9799\SystemSurvey.exe" argv[0]=L"SystemSurvey.exe" 004f:trace:process:create_process_impl started process pid 0050 tid 0051 ... 0051:fixme:console:AttachConsole stub ffffffff 0051:trace:process:create_process_impl app (null) cmdline L"C:\ProgramData/Battle.net/Agent/Agent.exe" 0051:trace:process:find_exe_file looking for L"C:\ProgramData/Battle.net/Agent/Agent.exe" 0051:trace:process:find_exe_file Trying native exe L"C:\ProgramData\Battle.net\Agent\Agent.exe" 0051:trace:process:create_process_impl starting L"C:\ProgramData\Battle.net\Agent\Agent.exe" as Win32 binary (400000-4af000, arch 014c) 0054:trace:process:init_current_directory starting in L"C:\Program Files (x86)\Battle.net\Battle.net.9799\" 0x14 0054:trace:process:__wine_kernel_init starting process name=L"C:\ProgramData\Battle.net\Agent\Agent.exe" argv[0]=L"C:\ProgramData/Battle.net/Agent/Agent.exe" ... 0051:trace:process:create_process_impl started process pid 0053 tid 0054 ... 0051:fixme:kerberos:kerberos_SpInstanceInit 65536,0x7d53436c,(nil): stub 0051:fixme:winhttp:get_system_proxy_autoconfig_url no support on this platform 0051:fixme:winhttp:WinHttpDetectAutoProxyConfigUrl discovery via DHCP not supported wine: Unhandled exception 0xc0000417 in thread 51 at address 0x523586 (thread 0051), starting debugger... --- snip ---
The 'SystemSurvey' process uses a 'minidump' thread to store crashes and other info here (albeit not really interesting):
--- snip --- $ pwd /home/focht/wine-games/wineprefix64-bnet/drive_c
$ tree --charset=ANSI "./users/focht/Local Settings/Application Data/Blizzard Entertainment/System Survey" ./users/focht/Local\ Settings/Application\ Data/Blizzard\ Entertainment/System\ Survey |-- Errors | `-- 2018-02-16\ 15.23.28 | |-- Crash.txt | `-- dxdiag.txt `-- log.txt
2 directories, 3 files --- snip ---
Process hierarchy:
--- snip --- Wine-dbg>info process
pid threads executable (all id:s are in hex) 0000003a 18 'Agent.exe' 0000003c 1 _ 'wineconsole.exe' 00000027 4 'explorer.exe' 0000000e 5 'services.exe' 00000020 4 _ 'winedevice.exe' 0000001a 3 _ 'plugplay.exe' 00000011 4 _ 'winedevice.exe' 00000008 63 'Battle.net.exe' 000000b1 20 _ 'Battle.net Helper.exe' 00000080 2 _ 'SystemSurvey.exe' --- snip ---
The problem is related to interaction with the console subsystem, specifically that Wine only provides a stub for 'AttachConsole'.
'SystemSurvey.exe' is marked as GUI process (PE Optional Header: Subsystem = 0x0002 = WINDOWS_GUI) but uses console to print output.
Relevant part of trace:
--- snip --- $ pwd /home/focht/wine-games/wineprefix64-bnet/drive_c
$ WINEDEBUG=+seh,+relay,+server,+process wine ./Battle.net.exe >>log.txt 2>&1 ... 0009: new_process( inherit_all=0, create_flags=00000410, socket_fd=248, exe_file=040c, process_access=001fffff, process_attr=00000000, thread_access=001fffff, thread_attr=00000000, cpu=x86, info_size=872, info={debug_flags=0,console_flags=0,console=0001,hstdin=ffffffff,hstdout=0004,hstderr=0008,x=0,y=0,xsize=0,ysize=0,xchars=0,ychars=0,attribute=00,flags=1,show=5,curdir=L"C:\Program Files (x86)\Battle.net\Battle.net.9799\",dllpath=L"C:\Program Files (x86)\Battle.net;C:\windows\system32;C:\windows\system;C:\windows;.;C:\windows\system32;C:\windows;C:\windows\system32\wbem",imagepath=L"C:\Program Files (x86)\Battle.net\Battle.net.9799\SystemSurvey.exe",cmdline=L""C:/Program Files (x86)/Battle.net/Battle.net.9799/SystemSurvey.exe"",title=L"C:\Program Files (x86)\Battle.net\Battle.net.9799\SystemSurvey.exe",desktop=L"",shellinfo=L"",runtime=L""}, env=L"WINEDEBUG=+seh,+relay,+server,+process
0009: *fd* 0224 -> 550 0009: new_process() = 0 { info=0410, pid=007e, phandle=0414, tid=007f, thandle=0418 } ... 007f: init_process_done( gui=1, module=00400000, ldt_copy=f7799520, entry=005188b6 ) ... 007f: get_console_mode( handle=0004 ) 007f: get_console_mode() = OBJECT_TYPE_MISMATCH { mode=0 } ... 007f: get_console_mode( handle=0008 ) 007f: get_console_mode() = OBJECT_TYPE_MISMATCH { mode=0 } ... 007f: get_process_winstation( ) 007f: get_process_winstation() = 0 { handle=0004 } 007f: get_thread_desktop( tid=007f ) 007f: get_thread_desktop() = 0 { handle=0008 } ... 007f:Call KERNEL32.GetStartupInfoW(0033fdc8) ret=005392f0 007f:Ret KERNEL32.GetStartupInfoW() retval=00000011 ret=005392f0 007f:Call KERNEL32.GetStdHandle(fffffff6) ret=005393e6 007f:Ret KERNEL32.GetStdHandle() retval=00000000 ret=005393e6 007f:Call KERNEL32.GetStdHandle(fffffff5) ret=005393e6 007f:Ret KERNEL32.GetStdHandle() retval=00000004 ret=005393e6 007f:Call KERNEL32.GetFileType(00000004) ret=005393f8 007f: get_handle_fd( handle=0004 ) 007f: get_handle_fd() = OBJECT_TYPE_MISMATCH { type=0, cacheable=0, access=00000000, options=00000000 } 007f:Ret KERNEL32.GetFileType() retval=00000000 ret=005393f8 007f:Call KERNEL32.GetStdHandle(fffffff4) ret=005393e6 007f:Ret KERNEL32.GetStdHandle() retval=00000008 ret=005393e6 007f:Call KERNEL32.GetFileType(00000008) ret=005393f8 007f: get_handle_fd( handle=0008 ) 007f: get_handle_fd() = OBJECT_TYPE_MISMATCH { type=0, cacheable=0, access=00000000, options=00000000 } 007f:Ret KERNEL32.GetFileType() retval=00000000 ret=005393f8 007f:Call KERNEL32.GetCommandLineA() ret=0053df6d 007f:Ret KERNEL32.GetCommandLineA() retval=0014b348 ret=0053df6d 007f:Call KERNEL32.GetCommandLineW() ret=0053df78 007f:Ret KERNEL32.GetCommandLineW() retval=0022065a ret=0053df78 ... 007f:Call KERNEL32.GetStartupInfoW(0033fe30) ret=00518a09 007f:Ret KERNEL32.GetStartupInfoW() retval=00000011 ret=00518a09 007f:Call KERNEL32.AttachConsole(ffffffff) ret=0040f35b 007f:fixme:console:AttachConsole stub ffffffff 007f:Ret KERNEL32.AttachConsole() retval=00000001 ret=0040f35b 007f:Call KERNEL32.GetLastError() ret=005386ac 007f:Ret KERNEL32.GetLastError() retval=0000013d ret=005386ac ... 007f:Call KERNEL32.CreateFileW(0015e468 L"CONIN$",80000000,00000003,0033fac0,00000003,00000080,00000000) ret=00535676 007f: open_console( from=0000, access=80000000, attributes=00000002, share=3 ) 007f: open_console() = ACCESS_DENIED { handle=0000 } 007f:Ret KERNEL32.CreateFileW() retval=ffffffff ret=00535676 007f:Call KERNEL32.GetLastError() ret=00535ab7 007f:Ret KERNEL32.GetLastError() retval=00000005 ret=00535ab7 ... 007f:Call KERNEL32.CreateFileW(0015e468 L"CONOUT$",40000000,00000003,0033fac0,00000002,00000080,00000000) ret=00535676 007f: open_console( from=0001, access=40000000, attributes=00000002, share=3 ) 007f: open_console() = ACCESS_DENIED { handle=0000 } 007f:Ret KERNEL32.CreateFileW() retval=ffffffff ret=00535676 007f:Call KERNEL32.GetLastError() ret=00535ab7 007f:Ret KERNEL32.GetLastError() retval=00000005 ret=00535ab7 ... 007f:Call KERNEL32.CreateFileW(0015e468 L"CONOUT$",40000000,00000003,0033fac0,00000002,00000080,00000000) ret=00535676 007f: open_console( from=0001, access=40000000, attributes=00000002, share=3 ) 007f: open_console() = ACCESS_DENIED { handle=0000 } 007f:Ret KERNEL32.CreateFileW() retval=ffffffff ret=00535676 007f:Call KERNEL32.GetLastError() ret=00535ab7 007f:Ret KERNEL32.GetLastError() retval=00000005 ret=00535ab7 ... 007f:Call KERNEL32.IsProcessorFeaturePresent(00000017) ret=0052356d 007f:Ret KERNEL32.IsProcessorFeaturePresent() retval=00000000 ret=0052356d 007f:Call KERNEL32.IsDebuggerPresent() ret=0052346d 007f:Ret KERNEL32.IsDebuggerPresent() retval=00000000 ret=0052346d 007f:Call KERNEL32.SetUnhandledExceptionFilter(00000000) ret=00523477 007f:Ret KERNEL32.SetUnhandledExceptionFilter() retval=00407240 ret=00523477 007f:Call KERNEL32.UnhandledExceptionFilter(0033eb30) ret=00523484 ... 007f:trace:seh:start_debugger Starting debugger "winedbg --auto 126 120" 007f:trace:process:create_process_impl app (null) cmdline L"winedbg --auto 126 120" ... --- snip ---
The last sequence, leading to the crash is just the MSCRT way of reporting 'STATUS_INVALID_CRUNTIME_PARAMETER' (0xc0000417).
The working case, simulated with direct start from console which works around that 'AttachConsole' is a stub (allowing to open 'CONIN$' and 'CONOUT$'):
--- snip --- ... 0030: init_thread( unix_pid=2751, unix_tid=2751, debug_level=1, teb=7ffd8000, entry=7ffdf000, reply_fd=5, wait_fd=7, cpu=x86 ) 0030: init_thread() = 0 { pid=002f, tid=0030, server_start=1d3a75c627d4728 (-0.4166900), info_size=10214, version=548, all_cpus=00000003, suspend=0 } 0030: get_startup_info( ) 0030: get_startup_info() = 0 { exe_file=0014, info_size=744, info={debug_flags=0,console_flags=0,console=0000,hstdin=0028,hstdout=0058,hstderr=005c,x=0,y=0,xsize=0,ysize=0,xchars=0,ychars=0,attribute=00,flags=100,show=0,curdir=L"C:\Program Files (x86)\Battle.net\Battle.net.9799\",dllpath=L"C:\windows\system32;C:\windows\system32;C:\windows\system;C:\windows;.;C:\windows\system32;C:\windows;C:\windows\system32\wbem",imagepath=L"C:\Program Files (x86)\Battle.net\Battle.net.9799\SystemSurvey.exe",cmdline=L"./SystemSurvey.exe",title=L"C:\Program Files (x86)\Battle.net\Battle.net.9799\SystemSurvey.exe",desktop=L"",shellinfo=L"",runtime=L""}, ... 0030:Call KERNEL32.GetStartupInfoW(0033fe30) ret=00518a09 0030:Ret KERNEL32.GetStartupInfoW() retval=00000011 ret=00518a09 0030:Call KERNEL32.AttachConsole(ffffffff) ret=0040f35b 0030:fixme:console:AttachConsole stub ffffffff 0030:Ret KERNEL32.AttachConsole() retval=00000001 ret=0040f35b ... 0030:Call KERNEL32.CreateFileW(0015d940 L"CONIN$",80000000,00000003,0033fac0,00000003,00000080,00000000) ret=00535676 0030: open_console( from=0000, access=80000000, attributes=00000002, share=3 ) 0030: open_console() = 0 { handle=0028 } 0030:Ret KERNEL32.CreateFileW() retval=0000002b ret=00535676 0030:Call KERNEL32.GetFileType(0000002b) ret=00535aca 0030:Ret KERNEL32.GetFileType() retval=00000002 ret=00535aca ... 0030:Call KERNEL32.CloseHandle(0000005b) ret=0053517e 0030: close_handle( handle=0058 ) 0030: close_handle() = 0 0030:Ret KERNEL32.CloseHandle() retval=00000001 ret=0053517e ... 0030:Call KERNEL32.CreateFileW(0015d940 L"CONOUT$",40000000,00000003,0033fac0,00000002,00000080,00000000) ret=00535676 0030: open_console( from=0001, access=40000000, attributes=00000002, share=3 ) 0030: open_console() = 0 { handle=0058 } 0030:Ret KERNEL32.CreateFileW() retval=0000005b ret=00535676 0030:Call KERNEL32.GetFileType(0000005b) ret=00535aca 0030:Ret KERNEL32.GetFileType() retval=00000002 ret=00535aca ... 0030:Call KERNEL32.CloseHandle(0000005f) ret=0053517e 0030: close_handle( handle=005c ) 0030: close_handle() = 0 0030:Ret KERNEL32.CloseHandle() retval=00000001 ret=0053517e ... 0030:Call KERNEL32.CreateFileW(0015d940 L"CONOUT$",40000000,00000003,0033fac0,00000002,00000080,00000000) ret=00535676 0030: open_console( from=0001, access=40000000, attributes=00000002, share=3 ) 0030: open_console() = 0 { handle=005c } 0030:Ret KERNEL32.CreateFileW() retval=0000005f ret=00535676 ... --- snip ---
Source: https://source.winehq.org/git/wine.git/blob/2936f3f9bb9dc01c595498a821d6adb6...
--- snip --- 2910 BOOL WINAPI AttachConsole(DWORD dwProcessId) 2911 { 2912 FIXME("stub %x\n",dwProcessId); 2913 return TRUE; 2914 } --- snip ---
https://stackoverflow.com/questions/493536/can-one-executable-be-both-a-cons...
http://www.csharp411.com/console-output-from-winforms-application/
$ sha1sum Battle.net-Setup.exe c85eefa0fdf5e7a68e5aa177c8267bc6d2ba08e8 Battle.net-Setup.exe
$ du -sh Battle.net-Setup.exe 3.8M Battle.net-Setup.exe
$ wine --version wine-3.2
Regards