Commit b92c82c9 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

server: Add support for NtTerminateProcess(0).

parent c5fbb4a7
...@@ -1105,12 +1105,7 @@ static BOOL WINAPI dll_entry_point(HINSTANCE hinst, DWORD reason, LPVOID param) ...@@ -1105,12 +1105,7 @@ static BOOL WINAPI dll_entry_point(HINSTANCE hinst, DWORD reason, LPVOID param)
ret = GetExitCodeThread(attached_thread[i], &code); ret = GetExitCodeThread(attached_thread[i], &code);
trace("dll: GetExitCodeThread(%u) => %d,%u\n", i, ret, code); trace("dll: GetExitCodeThread(%u) => %d,%u\n", i, ret, code);
ok(ret == 1, "GetExitCodeThread returned %d, expected 1\n", ret); ok(ret == 1, "GetExitCodeThread returned %d, expected 1\n", ret);
/* FIXME: remove once Wine is fixed */ ok(code == expected_code, "expected thread exit code %u, got %u\n", expected_code, code);
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);
} }
if (test_dll_phase == 2) if (test_dll_phase == 2)
...@@ -1230,7 +1225,6 @@ static void child_process(const char *dll_name, DWORD target_offset) ...@@ -1230,7 +1225,6 @@ static void child_process(const char *dll_name, DWORD target_offset)
ok(!ret, "RtlDllShutdownInProgress returned %d\n", ret); ok(!ret, "RtlDllShutdownInProgress returned %d\n", ret);
status = pNtTerminateProcess(0, 195); status = pNtTerminateProcess(0, 195);
todo_wine
ok(!status, "NtTerminateProcess error %#x\n", status); ok(!status, "NtTerminateProcess error %#x\n", status);
ret = pRtlDllShutdownInProgress(); ret = pRtlDllShutdownInProgress();
...@@ -1239,7 +1233,7 @@ static void child_process(const char *dll_name, DWORD target_offset) ...@@ -1239,7 +1233,7 @@ static void child_process(const char *dll_name, DWORD target_offset)
break; break;
case 1: case 1:
case 2: /* ExitProcces will be called by PROCESS_DETACH handler */ case 2: /* ExitProcess will be called by PROCESS_DETACH handler */
ret = pRtlDllShutdownInProgress(); ret = pRtlDllShutdownInProgress();
ok(!ret, "RtlDllShutdownInProgress returned %d\n", ret); ok(!ret, "RtlDllShutdownInProgress returned %d\n", ret);
...@@ -1283,12 +1277,7 @@ static void child_process(const char *dll_name, DWORD target_offset) ...@@ -1283,12 +1277,7 @@ static void child_process(const char *dll_name, DWORD target_offset)
ret = GetExitCodeThread(attached_thread[i], &code); ret = GetExitCodeThread(attached_thread[i], &code);
trace("child: GetExitCodeThread(%u) => %d,%u\n", i, ret, code); trace("child: GetExitCodeThread(%u) => %d,%u\n", i, ret, code);
ok(ret == 1, "GetExitCodeThread returned %d, expected 1\n", ret); ok(ret == 1, "GetExitCodeThread returned %d, expected 1\n", ret);
/* FIXME: remove once Wine is fixed */ ok(code == expected_code, "expected thread exit code %u, got %u\n", expected_code, code);
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);
} }
*child_failures = winetest_get_failures(); *child_failures = winetest_get_failures();
......
...@@ -60,7 +60,7 @@ NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code ) ...@@ -60,7 +60,7 @@ NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code )
self = !ret && reply->self; self = !ret && reply->self;
} }
SERVER_END_REQ; SERVER_END_REQ;
if (self) exit( exit_code ); if (self && handle) exit( exit_code );
return ret; return ret;
} }
......
...@@ -1082,12 +1082,16 @@ DECL_HANDLER(terminate_process) ...@@ -1082,12 +1082,16 @@ DECL_HANDLER(terminate_process)
{ {
struct process *process; struct process *process;
if ((process = get_process_from_handle( req->handle, PROCESS_TERMINATE ))) if (req->handle)
{ {
reply->self = (current->process == process); process = get_process_from_handle( req->handle, PROCESS_TERMINATE );
terminate_process( process, current, req->exit_code ); if (!process) return;
release_object( process );
} }
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 */ /* fetch information about a process */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment