Module: wine Branch: master Commit: b92c82c9426c3315ef156027429c8c0a15e3a521 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b92c82c9426c3315ef15602742...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Mon Apr 15 18:21:21 2013 +0900
server: Add support for NtTerminateProcess(0).
---
dlls/kernel32/tests/loader.c | 17 +++-------------- dlls/ntdll/process.c | 2 +- server/process.c | 12 ++++++++---- 3 files changed, 12 insertions(+), 19 deletions(-)
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index c88a995..ddf6fb3 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -1105,12 +1105,7 @@ static BOOL WINAPI dll_entry_point(HINSTANCE hinst, DWORD reason, LPVOID param) 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 (expected_code == STILL_ACTIVE || expected_code == 196) - ok(code == expected_code, "expected thread exit code %u, got %u\n", expected_code, code); - else - todo_wine - ok(code == expected_code, "expected thread exit code %u, got %u\n", expected_code, code); + ok(code == expected_code, "expected thread exit code %u, got %u\n", expected_code, code); }
if (test_dll_phase == 2) @@ -1230,7 +1225,6 @@ static void child_process(const char *dll_name, DWORD target_offset) ok(!ret, "RtlDllShutdownInProgress returned %d\n", ret);
status = pNtTerminateProcess(0, 195); - todo_wine ok(!status, "NtTerminateProcess error %#x\n", status);
ret = pRtlDllShutdownInProgress(); @@ -1239,7 +1233,7 @@ static void child_process(const char *dll_name, DWORD target_offset) break;
case 1: - case 2: /* ExitProcces will be called by PROCESS_DETACH handler */ + case 2: /* ExitProcess will be called by PROCESS_DETACH handler */ ret = pRtlDllShutdownInProgress(); ok(!ret, "RtlDllShutdownInProgress returned %d\n", ret);
@@ -1283,12 +1277,7 @@ static void child_process(const char *dll_name, DWORD target_offset) ret = GetExitCodeThread(attached_thread[i], &code); trace("child: 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 (expected_code == STILL_ACTIVE || expected_code == 196) - ok(code == expected_code, "expected thread exit code %u, got %u\n", expected_code, code); - else - todo_wine - ok(code == expected_code, "expected thread exit code %u, got %u\n", expected_code, code); + ok(code == expected_code, "expected thread exit code %u, got %u\n", expected_code, code); }
*child_failures = winetest_get_failures(); diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c index a39f5d0..88a9e41 100644 --- a/dlls/ntdll/process.c +++ b/dlls/ntdll/process.c @@ -60,7 +60,7 @@ NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code ) self = !ret && reply->self; } SERVER_END_REQ; - if (self) exit( exit_code ); + if (self && handle) exit( exit_code ); return ret; }
diff --git a/server/process.c b/server/process.c index 4f04a23..74a289a 100644 --- a/server/process.c +++ b/server/process.c @@ -1082,12 +1082,16 @@ DECL_HANDLER(terminate_process) { struct process *process;
- if ((process = get_process_from_handle( req->handle, PROCESS_TERMINATE ))) + if (req->handle) { - reply->self = (current->process == process); - terminate_process( process, current, req->exit_code ); - release_object( process ); + process = get_process_from_handle( req->handle, PROCESS_TERMINATE ); + if (!process) return; } + else process = (struct process *)grab_object( current->process ); + + reply->self = (current->process == process); + terminate_process( process, current, req->exit_code ); + release_object( process ); }
/* fetch information about a process */