https://bugs.winehq.org/show_bug.cgi?id=42939
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |focht@gmx.net Component|-unknown |kernel32 Summary|NOX App Player - Not |NOX App Player v3.8.x |installing properly |(Android Emulator) fails in | |post-installation step | |(VirtualBox COM Server | |raises assert: failed to | |set self TLS. lasterr=87 | |thread 'CGMgr') Fixed by SHA1| |e99811aee2dff88c41d6e287540 | |1810a85325839 Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED URL| |https://web.archive.org/web | |/20170519011527/https://res | |05.bignox.com/g5/M00/00/E4/ | |CqtxtVkNc5mAOV1_EXe7iLa6_6E | |123.exe?filename=nox_setup_ | |v3.8.2.0_full_intl.exe Keywords| |download, Installer
--- Comment #5 from Anastasius Focht focht@gmx.net --- Hello folks,
confirming with old version of the app (newer version v6.x suffers from different bugs).
This was fixed some time ago (Wine 2.16) by commit https://source.winehq.org/git/wine.git/commitdiff/e99811aee2dff88c41d6e28754... ("kernel32: Implement SetDefaultDllDirectories.")
Thanks Alexandre
--- snip --- $ WINEDEBUG=+seh,+relay,+service,+msi wine ./nox_setup_v3.8.2.0_full_intl.exe
log.txt 2>&1
... 0043:Call KERNEL32.CreateProcessW(00000000,021ed110 L""C:\Program Files (x86)\Bignox\BigNoxVM\RT\BigNoxVMMgr.exe" list vms",00000000,00000000,00000001,00000000,00000000,00000000,021ed0b8,021ed510) ret=0040ffc1 ... 0124:Call KERNEL32.__wine_kernel_init() ret=7bcd8235 ... 0043:Ret KERNEL32.CreateProcessW() retval=00000001 ret=0040ffc1 ... 0124:Call KERNEL32.CreateProcessW(00000000,0023efc0 L""C:\Program Files (x86)\Bignox\BigNoxVM\RT\NoxVMSVC.exe" -Embedding",00000000,00000000,00000000,00000008,00000000,00000000,0023ef50,0023ef30) ret=7fb6bb517a01 ... 012e:Call KERNEL32.__wine_kernel_init() ret=7bcd8235 0124:Ret KERNEL32.CreateProcessW() retval=00000001 ret=7fb6bb517a01 ... 0124:Call PE DLL (proc=0x2e632c,module=0x240000 L"VBoxRT.dll",reason=PROCESS_ATTACH,res=0x1) ... 013c:Call msvcr100._beginthreadex(00000000,00000000,002e3490,00772fb0,00000000,011abf00) ret=002e35a4 013c:Call KERNEL32.CreateThread(00000000,00000000,002e3490,00772fb0,00000000,011abf00) ret=7fd10ce8279c 013c:Ret KERNEL32.CreateThread() retval=00000130 ret=7fd10ce8279c 013c:Ret msvcr100._beginthreadex() retval=00000130 ret=002e35a4 ... 0141:Starting thread proc 0x2e3490 (arg=0x772fb0) 0141:Call KERNEL32.TlsSetValue(ffffffff,00772fb0) ret=002e34b9 0141:Ret KERNEL32.TlsSetValue() retval=00000000 ret=002e34b9 0141:Call msvcr100.memcpy(00580920,00441600,00000022) ret=0028a95b 0141:Ret msvcr100.memcpy() retval=00580920 ret=0028a95b 0141:Call msvcr100.memcpy(00580942,00447394,00000006) ret=0028a95b 0141:Ret msvcr100.memcpy() retval=00580942 ret=0028a95b 0141:Call msvcr100.memcpy(00580948,00441624,0000000d) ret=0028a95b 0141:Ret msvcr100.memcpy() retval=00580948 ret=0028a95b 0141:Call msvcr100.memcpy(00580955,0045ca08,00000034) ret=0028a95b 0141:Ret msvcr100.memcpy() retval=00580955 ret=0028a95b 0141:Call msvcr100.memcpy(00580989,00441633,00000001) ret=0028a95b 0141:Ret msvcr100.memcpy() retval=00580989 ret=0028a95b ... 0141:Call KERNEL32.GetLastError() ret=002d9d75 0141:Ret KERNEL32.GetLastError() retval=00000057 ret=002d9d75 ... 0141:Call ws2_32.WSASetLastError(00000057) ret=002d9dcd 0141:Ret ws2_32.WSASetLastError() retval=00000057 ret=002d9dcd 0141:Call KERNEL32.GetLastError() ret=002d9d75 0141:Ret KERNEL32.GetLastError() retval=00000057 ret=002d9d75 0141:Call ws2_32.WSAGetLastError() ret=002d9d7e 0141:Ret ws2_32.WSAGetLastError() retval=00000057 ret=002d9d7e 0141:Call msvcr100._errno() ret=002d9d87 0141:Ret msvcr100._errno() retval=000af490 ret=002d9d87 0141:Call msvcr100.getenv(00458f68 "VBOX_ASSERT") ret=002cc79d 0141:Ret msvcr100.getenv() retval=00000000 ret=002cc79d 0141:Call msvcr100._errno() ret=002d9db7 0141:Ret msvcr100._errno() retval=000af490 ret=002d9db7 0141:Call ws2_32.WSASetLastError(00000057) ret=002d9dcd 0141:Ret ws2_32.WSASetLastError() retval=00000057 ret=002d9dcd trace:seh:raise_exception code=80000003 flags=0 addr=0x2e34f8 ip=2e34f8 tid=0141 trace:seh:raise_exception info[0]=0000000000000000 trace:seh:raise_exception rax=0000000000000001 rbx=0000000000000000 rcx=0000000000000057 rdx=00000000014aeac0 trace:seh:raise_exception rsi=0000000000000141 rdi=0000000000772fb0 rbp=00000000014ae650 rsp=00000000014ae4e0 trace:seh:raise_exception r8=0000000000000000 r9=00000000014ae002 r10=0000000000000000 r11=0000000000000000 trace:seh:raise_exception r12=00000000011ab77e r13=00000000011ab77f r14=00000000011ab910 r15=00000000011ab910 trace:seh:RtlVirtualUnwind type 1 rip 2e34f7 rsp 14ae4e0 ... wine: Unhandled exception 0x80000003 in thread 141 at address 0x2e34f8 (thread 0141), starting debugger... --- snip ---
For easier reproduce, start the BigNoxVMMgr app with some command which starts the COM server:
--- snip --- $ pwd /home/focht/.wine/drive_c/Program Files (x86)/Bignox/BigNoxVM/RT
$ wine BigNoxVMMgr.exe list vms ... --- snip ---
The app creates a few log files.
'.wine/drive_c/users/focht/.BigNox/NoxVMSVC.log':
--- snip --- VirtualBox COM Server 4.3.12_OSE r2807 win.amd64 (Jan 20 2017 20:57:39) release log 00:00:00.000000 Log opened 2019-03-15T11:34:16.289886000Z 00:00:00.000000 Build Type: release 00:00:00.000000 OS Product: Windows 7 00:00:00.000000 OS Release: 6.1.7601 00:00:00.000000 OS Service Pack: 1 00:00:00.000000 Host RAM: 15920MB total, 12411MB available 00:00:00.000000 Executable: unknown 00:00:00.000000 Process ID: 301 00:00:00.000000 Package type: WINDOWS_64BITS_GENERIC (OSE) 00:00:00.000000 00:00:00.000000 !!Assertion Failed!! 00:00:00.000000 Expression: <NULL> 00:00:00.000000 Location : C:\vm\vboxOld\src\VBox\Runtime\r3\win\thread-win.cpp(209) unsigned int __cdecl rtThreadNativeMain(void *) 00:00:00.000000 failed to set self TLS. lasterr=87 thread 'CGMgr' 00:00:00.000000 main USBLibInit: USB Service not found 00:00:00.000000 main failed to get the sun_VBoxNetFlt component, error (0x80004001) 00:00:00.000000 main netIfListHostAdapters: EnumComponents error (0x80004001)HostDnsMonitorProxy: Host's DNS information updated: 00:00:00.000000 main Support driver version mismatch: DriverVersion=too-old ClientVersion=0x1a0007 00:00:00.000000 main VDInit finished --- snip ---
'.wine/drive_c/users/focht/2019-03-15-11-34-17.010-VBox-301.log':
--- snip --- Log created: 2019-03-15T11:34:17.109176000Z Executable: VBox Commandline: "C:\Program Files (x86)\Bignox\BigNoxVM\RT\NoxVMSVC.exe" -Embedding failed to set self TLS. lasterr=87 thread 'CGMgr' --- snip ---
Since they forked off from VirtualBox Open-Source project, the corresponding source can be traced back.
https://github.com/mirror/vbox/blob/master/src/VBox/Runtime/r3/win/thread-wi...
--- snip ---
/******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ /** The TLS index allocated for storing the RTTHREADINT pointer. */ static DWORD g_dwSelfTLS = TLS_OUT_OF_INDEXES;
...
DECLHIDDEN(int) rtThreadNativeInit(void) { g_dwSelfTLS = TlsAlloc(); if (g_dwSelfTLS == TLS_OUT_OF_INDEXES) return VERR_NO_TLS_FOR_SELF; return VINF_SUCCESS; }
...
/** * Wrapper which unpacks the param stuff and calls thread function. */ static unsigned __stdcall rtThreadNativeMain(void *pvArgs) { DWORD dwThreadId = GetCurrentThreadId(); PRTTHREADINT pThread = (PRTTHREADINT)pvArgs;
if (!TlsSetValue(g_dwSelfTLS, pThread)) AssertReleaseMsgFailed(("failed to set self TLS. lasterr=%d thread '%s'\n", GetLastError(), pThread->szName)); if (IsDebuggerPresent()) rtThreadWinTellDebuggerThreadName(dwThreadId, &pThread->szName[0]);
int rc = rtThreadMain(pThread, dwThreadId, &pThread->szName[0]);
TlsSetValue(g_dwSelfTLS, NULL); rtThreadNativeUninitComAndOle(); _endthreadex(rc); return rc; } --- snip ---
https://github.com/mirror/vbox/blob/b9657cd5351cf17432b664009cc25bb480dc64c1...
--- snip --- /** * Initializes the thread database. * * @returns iprt status code. */ DECLHIDDEN(int) rtThreadInit(void) { #ifdef IN_RING3 int rc = VINF_ALREADY_INITIALIZED; if (g_ThreadRWSem == NIL_RTSEMRW) { /* * We assume the caller is the 1st thread, which we'll call 'main'. * But first, we'll create the semaphore. */ rc = RTSemRWCreateEx(&g_ThreadRWSem, RTSEMRW_FLAGS_NO_LOCK_VAL, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, NULL); if (RT_SUCCESS(rc)) { rc = rtThreadNativeInit(); if (RT_SUCCESS(rc)) rc = rtThreadAdopt(RTTHREADTYPE_DEFAULT, 0, RTTHREADINT_FLAGS_MAIN, "main"); if (RT_SUCCESS(rc)) rc = rtSchedNativeCalcDefaultPriority(RTTHREADTYPE_DEFAULT); if (RT_SUCCESS(rc)) { g_frtThreadInitialized = true; return VINF_SUCCESS; }
/* failed, clear out */ RTSemRWDestroy(g_ThreadRWSem); g_ThreadRWSem = NIL_RTSEMRW; } } ... --- snip ---
https://github.com/mirror/vbox/blob/b9657cd5351cf17432b664009cc25bb480dc64c1...
--- snip --- static int rtR3InitNativeObtrusiveWorker(void) { /* * Disable error popups. */ UINT fOldErrMode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX | fOldErrMode);
/* * Restrict DLL searching for the process on windows versions which allow * us to do so. * - The first trick works on XP SP1+ and disables the searching of the * current directory. * - The second trick is W7 w/ KB2533623 and W8+, it restrict the DLL * searching to the application directory and the System32 directory. */ int rc = VINF_SUCCESS;
typedef BOOL (WINAPI *PFNSETDLLDIRECTORY)(LPCWSTR); PFNSETDLLDIRECTORY pfnSetDllDir = (PFNSETDLLDIRECTORY)GetProcAddress(g_hModKernel32, "SetDllDirectoryW"); if (pfnSetDllDir) { if (pfnSetDllDir(L"")) g_enmWinLdrProt = RTR3WINLDRPROT_NO_CWD; else rc = VERR_INTERNAL_ERROR_3; }
/** @bugref 6861: Observed GUI issues on Vista (32-bit and 64-bit). */ if (g_enmWinVer > kRTWinOSType_VISTA) { typedef BOOL(WINAPI *PFNSETDEFAULTDLLDIRECTORIES)(DWORD); PFNSETDEFAULTDLLDIRECTORIES pfnSetDefDllDirs; pfnSetDefDllDirs = (PFNSETDEFAULTDLLDIRECTORIES)GetProcAddress(g_hModKernel32, "SetDefaultDllDirectories"); if (pfnSetDefDllDirs) { if (pfnSetDefDllDirs(LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32)) g_enmWinLdrProt = RTR3WINLDRPROT_SAFE; else if (RT_SUCCESS(rc)) rc = VERR_INTERNAL_ERROR_4; } }
return rc; }
...
DECLHIDDEN(int) rtR3InitNativeFirst(uint32_t fFlags) { /* * Make sure we've got the handles of the two main Windows NT dlls. */ g_hModKernel32 = GetModuleHandleW(L"kernel32.dll"); if (g_hModKernel32 == NULL) return VERR_INTERNAL_ERROR_2; g_hModNtDll = GetModuleHandleW(L"ntdll.dll"); if (g_hModNtDll == NULL) return VERR_INTERNAL_ERROR_2;
rtR3InitWindowsVersion();
int rc = VINF_SUCCESS; if (!(fFlags & RTR3INIT_FLAGS_UNOBTRUSIVE)) rc = rtR3InitNativeObtrusiveWorker();
return rc; }
--- snip ---
https://github.com/mirror/vbox/blob/b9657cd5351cf17432b664009cc25bb480dc64c1...
--- snip --- ** * rtR3Init worker. */ static int rtR3InitBody(uint32_t fFlags, int cArgs, char ***papszArgs, const char *pszProgramPath) { /* * Early native initialization. */ int rc = rtR3InitNativeFirst(fFlags); AssertMsgRCReturn(rc, ("rtR3InitNativeFirst failed with %Rrc\n", rc), rc);
/* * Disable error popups. */ #if defined(RT_OS_OS2) /** @todo move to private code. */ DosError(FERR_DISABLEHARDERR); #endif
/* * Init C runtime locale before we do anything that may end up converting * paths or we'll end up using the "C" locale for path conversion. */ setlocale(LC_CTYPE, "");
/* * The Process ID. */ #ifdef _MSC_VER g_ProcessSelf = _getpid(); /* crappy ansi compiler */ #else g_ProcessSelf = getpid(); #endif
/* * Save the init flags. */ g_fInitFlags |= fFlags;
#if !defined(IN_GUEST) && !defined(RT_NO_GIP) # ifdef VBOX /* * This MUST be done as the very first thing, before any file is opened. * The log is opened on demand, but the first log entries may be caused * by rtThreadInit() below. */ const char *pszDisableHostCache = getenv("VBOX_DISABLE_HOST_DISK_CACHE"); if ( pszDisableHostCache != NULL && *pszDisableHostCache && strcmp(pszDisableHostCache, "0") != 0) { RTFileSetForceFlags(RTFILE_O_WRITE, RTFILE_O_WRITE_THROUGH, 0); RTFileSetForceFlags(RTFILE_O_READWRITE, RTFILE_O_WRITE_THROUGH, 0); } # endif /* VBOX */ #endif /* !IN_GUEST && !RT_NO_GIP */
/* * Thread Thread database and adopt the caller thread as 'main'. * This must be done before everything else or else we'll call into threading * without having initialized TLS entries and suchlike. */ rc = rtThreadInit(); AssertMsgRCReturn(rc, ("Failed to initialize threads, rc=%Rrc!\n", rc), rc); ... --- snip ---
The failing 'SetDefaultDllDirectories' call in 'rtR3InitNativeObtrusiveWorker' causes an internal assert in main thread. The logging functionality which is used by the assert() implementation gathers/dumps various system info which uses helper threads. The helper threads rely on the app's thread "database" initialization. Since the assert() was raised very early in main thread, 'rtThreadInit' had not been called yet. This results in a failure to set TLS data upon thread entry, causing another debug assert (int 3).
$ sha1sum nox_setup_v3.8.2.0_full_intl.exe duc79f8639c3ae13352dea3362766d54334152351a nox_setup_v3.8.2.0_full_intl.exe
$ du -sh nox_setup_v3.8.2.0_full_intl.exe 280M nox_setup_v3.8.2.0_full_intl.exe
$ wine --version wine-4.3-338-gf34f13825f
Regards