On Tue Aug 15 14:52:18 2023 +0000, Ake Rehnman wrote:
int test_ntterminatethread_proc_failed; DWORD WINAPI test_ntterminatethread_proc( void *arg ) { DWORD status = (UINT_PTR)arg; status = pNtTerminateThread(0, status); test_ntterminatethread_proc_failed = 1; return status; } /* verifies NtTerminateThread accepts NULL handle */ static void test_terminate_thread(void) { HANDLE thread; DWORD exitcode; NTSTATUS status; test_ntterminatethread_proc_failed = 0; status = pNtCreateThreadEx( &thread, THREAD_ALL_ACCESS, NULL, GetCurrentProcess(), (PRTL_THREAD_START_ROUTINE)test_ntterminatethread_proc, (void*)0x1234, 0, 0, 0, 0, NULL ); ok( status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status ); WaitForSingleObject(thread, INFINITE); GetExitCodeThread(thread, &exitcode); ok( exitcode == 0x1234, "NtTerminateThread failed exitcode = %lx\n", (long)exitcode); ok( test_ntterminatethread_proc_failed == 0, "NtTerminateThread failed\n"); }
Better?
The reason it was not in the test case is I already tested it in the snippet in the Bugzilla ticket. The test case was more for making sure it did not pop up again.