server: Add support for NtTerminateProcess(0).

This commit is contained in:
Dmitry Timoshkov 2013-04-15 18:21:21 +09:00 committed by Alexandre Julliard
parent c5fbb4a780
commit b92c82c942
3 changed files with 12 additions and 19 deletions

View File

@ -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();

View File

@ -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;
}

View File

@ -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 */