https://bugs.winehq.org/show_bug.cgi?id=46236
Ken Thomases ken@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |ken@codeweavers.com
--- Comment #17 from Ken Thomases ken@codeweavers.com --- Created attachment 63691 --> https://bugs.winehq.org/attachment.cgi?id=63691 Hack to enable TEB->PEB access via %gs:0x60
(In reply to Chatty from comment #16)
I could finally spot the root cause with the help of Alex:
This little piece of code compiled with /MT (instead of default /MD) causes x64 code to crash on a Mac (x86 or Linux is not affected):
struct s { static unsigned WINAPI func(void* Param) { std::wcout << (const wchar_t*)Param; return 0; } }; _beginthreadex(nullptr, 0, &s::func, (void*)L"Test", 0, 0); Sleep(1000);
More info on the compiler parameter: https://docs.microsoft.com/cpp/build/reference/md-mt-ld-use-run-time- library?view=vs-2017
Those docs say that different libraries are linked depending on that compiler switch. Presumably, one library has an inlined access to some field of the TEB structure which our workaround doesn't support while the other library does not.
I'm attaching a gross hack that might help, depending on exactly which field of the TEB the library tries to access. If it's the Peb field, then this should help. Otherwise, not so much.