From bfcdf6df8eea1230fb0e1835a809e49e5971e5d2 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Mon, 13 May 2013 16:46:37 +0900 Subject: [PATCH] kernel32: Terminate threads before unloading DLLs on process exit. --- dlls/kernel32/process.c | 2 ++ dlls/kernel32/tests/loader.c | 22 ---------------------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index 683385fd43e..d07065c273a 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -2631,6 +2631,7 @@ __ASM_STDCALL_FUNC( ExitProcess, 4, /* Shrinker depend on this particular ExitPr void WINAPI process_ExitProcess( DWORD status ) { RtlAcquirePebLock(); + NtTerminateProcess(0, status); LdrShutdownProcess(); NtTerminateProcess(GetCurrentProcess(), status); exit(status); @@ -2641,6 +2642,7 @@ void WINAPI process_ExitProcess( DWORD status ) void WINAPI ExitProcess( DWORD status ) { RtlAcquirePebLock(); + NtTerminateProcess(0, status); LdrShutdownProcess(); NtTerminateProcess(GetCurrentProcess(), status); exit(status); diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index d481f0830ad..bd805089a36 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -1225,19 +1225,11 @@ static BOOL WINAPI dll_entry_point(HINSTANCE hinst, DWORD reason, LPVOID param) if (expected_code != STILL_ACTIVE) { ret = WaitForSingleObject(attached_thread[i], 1000); - /* FIXME: remove once Wine is fixed */ - if (test_dll_phase == 1) todo_wine - ok(ret == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %#x\n", ret); - else ok(ret == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %#x\n", ret); } ret = GetExitCodeThread(attached_thread[i], &code); trace("dll: GetExitCodeThread(%u) => %d,%u\n", i, ret, code); ok(ret == 1, "GetExitCodeThread returned %d, expected 1\n", ret); - /* FIXME: remove once Wine is fixed */ - if (test_dll_phase == 1) todo_wine - ok(code == expected_code, "expected thread exit code %u, got %u\n", expected_code, code); - else ok(code == expected_code, "expected thread exit code %u, got %u\n", expected_code, code); } @@ -1248,13 +1240,7 @@ static BOOL WINAPI dll_entry_point(HINSTANCE hinst, DWORD reason, LPVOID param) if (expected_code == STILL_ACTIVE) ok(ret == WAIT_TIMEOUT, "expected WAIT_TIMEOUT, got %#x\n", ret); else - { - /* FIXME: remove once Wine is fixed */ - if (test_dll_phase == 1) todo_wine ok(ret == WAIT_ABANDONED, "expected WAIT_ABANDONED, got %#x\n", ret); - else - ok(ret == WAIT_ABANDONED, "expected WAIT_ABANDONED, got %#x\n", ret); - } /* semaphore is not abandoned on thread termination */ ret = WaitForSingleObject(semaphore, 0); @@ -1270,16 +1256,8 @@ static BOOL WINAPI dll_entry_point(HINSTANCE hinst, DWORD reason, LPVOID param) else { ret = WaitForSingleObject(attached_thread[0], 0); - /* FIXME: remove once Wine is fixed */ - if (test_dll_phase == 1) todo_wine - ok(ret == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %#x\n", ret); - else ok(ret == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %#x\n", ret); ret = WaitForSingleObject(attached_thread[1], 0); - /* FIXME: remove once Wine is fixed */ - if (test_dll_phase == 1) todo_wine - ok(ret == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %#x\n", ret); - else ok(ret == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %#x\n", ret); }