From: Billy Laws blaws05@gmail.com
I confirmed that ARM64EC BT thread creation callbacks aren't called through some logging in FEX. --- dlls/ntdll/loader.c | 2 ++ dlls/ntdll/tests/thread.c | 4 ++-- dlls/ntdll/unix/thread.c | 10 ++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 5859d1e5a74..8df76c6cc26 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -4401,6 +4401,8 @@ void loader_init( CONTEXT *context, void **entry )
if (process_detaching) NtTerminateThread( GetCurrentThread(), 0 );
+ if (NtCurrentTeb()->SkipLoaderInit) return; + RtlEnterCriticalSection( &loader_section );
if (!imports_fixup_done) diff --git a/dlls/ntdll/tests/thread.c b/dlls/ntdll/tests/thread.c index 6192104b9dc..b892ca04f6c 100644 --- a/dlls/ntdll/tests/thread.c +++ b/dlls/ntdll/tests/thread.c @@ -505,11 +505,11 @@ static void test_arm64_skip_loader_init(void) status = pNtCreateThreadEx( &thread, THREAD_ALL_ACCESS, NULL, GetCurrentProcess(), (PRTL_THREAD_START_ROUTINE)code_mem, &args, THREAD_CREATE_FLAGS_SKIP_THREAD_ATTACH | THREAD_CREATE_FLAGS_SKIP_LOADER_INIT, 0, 0, 0, NULL );
- todo_wine ok( status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status ); + ok( status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status );
WaitForSingleObject( thread, INFINITE );
- todo_wine ok( (args.teb_same_teb_flags & 0x4008) == 0x4008, "wrong value %x\n", args.teb_same_teb_flags ); + ok( (args.teb_same_teb_flags & 0x4008) == 0x4008, "wrong value %x\n", args.teb_same_teb_flags );
CloseHandle( thread ); } diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index 65e7fbcb6bf..8f3fb701a38 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -1316,7 +1316,8 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle, ACCESS_MASK access, OBJECT_ATT SIZE_T stack_reserve, PS_ATTRIBUTE_LIST *attr_list ) { static const ULONG supported_flags = THREAD_CREATE_FLAGS_CREATE_SUSPENDED | THREAD_CREATE_FLAGS_SKIP_THREAD_ATTACH | - THREAD_CREATE_FLAGS_HIDE_FROM_DEBUGGER | THREAD_CREATE_FLAGS_BYPASS_PROCESS_FREEZE; + THREAD_CREATE_FLAGS_HIDE_FROM_DEBUGGER | THREAD_CREATE_FLAGS_SKIP_LOADER_INIT | + THREAD_CREATE_FLAGS_BYPASS_PROCESS_FREEZE; sigset_t sigset; pthread_t pthread_id; pthread_attr_t pthread_attr; @@ -1413,8 +1414,13 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle, ACCESS_MASK access, OBJECT_ATT set_thread_id( teb, GetCurrentProcessId(), tid );
teb->SkipThreadAttach = !!(flags & THREAD_CREATE_FLAGS_SKIP_THREAD_ATTACH); + teb->SkipLoaderInit = !!(flags & THREAD_CREATE_FLAGS_SKIP_LOADER_INIT); wow_teb = get_wow_teb( teb ); - if (wow_teb) wow_teb->SkipThreadAttach = teb->SkipThreadAttach; + if (wow_teb) + { + wow_teb->SkipThreadAttach = teb->SkipThreadAttach; + wow_teb->SkipLoaderInit = teb->SkipLoaderInit; + }
thread_data = (struct ntdll_thread_data *)&teb->GdiTebBatch; thread_data->request_fd = request_pipe[1];