server: Implement job inheritance.

This commit is contained in:
Andrew Cook 2015-04-02 08:56:40 +11:00 committed by Alexandre Julliard
parent ecd41d1de7
commit 0dbe5adc21
2 changed files with 15 additions and 3 deletions

View File

@ -2485,7 +2485,6 @@ static void test_jobInheritance(HANDLE job)
out = FALSE;
ret = pIsProcessInJob(pi.hProcess, job, &out);
ok(ret, "IsProcessInJob error %u\n", GetLastError());
todo_wine
ok(out, "IsProcessInJob returned out=%u\n", out);
dwret = WaitForSingleObject(pi.hProcess, 1000);
@ -2513,9 +2512,7 @@ static void test_BreakawayOk(HANDLE job)
snprintf(buffer, MAX_PATH, "\"%s\" tests/process.c %s", selfname, "exit");
ret = CreateProcessA(NULL, buffer, NULL, NULL, FALSE, CREATE_BREAKAWAY_FROM_JOB, NULL, NULL, &si, &pi);
todo_wine
ok(!ret, "CreateProcessA expected failure\n");
todo_wine
expect_eq_d(ERROR_ACCESS_DENIED, GetLastError());
if (ret)

View File

@ -1039,6 +1039,14 @@ DECL_HANDLER(new_process)
return;
}
if (parent->job && (req->create_flags & CREATE_BREAKAWAY_FROM_JOB) &&
!(parent->job->limit_flags & (JOB_OBJECT_LIMIT_BREAKAWAY_OK | JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK)))
{
set_error( STATUS_ACCESS_DENIED );
close( socket_fd );
return;
}
if (!req->info_size) /* create an orphaned process */
{
create_process( socket_fd, NULL, 0 );
@ -1109,6 +1117,13 @@ DECL_HANDLER(new_process)
&& !(req->create_flags & DEBUG_ONLY_THIS_PROCESS);
process->startup_info = (struct startup_info *)grab_object( info );
if (parent->job
&& !(req->create_flags & CREATE_BREAKAWAY_FROM_JOB)
&& !(parent->job->limit_flags & JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK))
{
add_job_process( parent->job, process );
}
/* connect to the window station */
connect_process_winstation( process, current );