From: Paul Gofman pgofman@codeweavers.com
--- dlls/kernel32/tests/process.c | 6 +++--- server/process.c | 10 +++++++++- 2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c index 88c03066f2c..7984f3d6fb4 100644 --- a/dlls/kernel32/tests/process.c +++ b/dlls/kernel32/tests/process.c @@ -2936,7 +2936,7 @@ static void test_CompletionPort(void) port_info.CompletionKey = job; port_info.CompletionPort = NULL; ret = pSetInformationJobObject(job, JobObjectAssociateCompletionPortInformation, &port_info, sizeof(port_info)); - todo_wine ok(ret || broken(!ret && GetLastError() == ERROR_INVALID_PARAMETER) /* Before Win8 */, + ok(ret || broken(!ret && GetLastError() == ERROR_INVALID_PARAMETER) /* Before Win8 */, "got ret %d, error %lu\n", ret, GetLastError());
port = pCreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 1); @@ -2952,7 +2952,7 @@ static void test_CompletionPort(void) port_info.CompletionKey = NULL; port_info.CompletionPort = NULL; ret = pSetInformationJobObject(job, JobObjectAssociateCompletionPortInformation, &port_info, sizeof(port_info)); - todo_wine ok(ret || broken(!ret && GetLastError() == ERROR_INVALID_PARAMETER) /* Before Win8 */, + ok(ret || broken(!ret && GetLastError() == ERROR_INVALID_PARAMETER) /* Before Win8 */, "got ret %d, error %lu\n", ret, GetLastError());
create_process("wait", &pi2); @@ -2962,7 +2962,7 @@ static void test_CompletionPort(void) port_info.CompletionKey = job; port_info.CompletionPort = port; ret = pSetInformationJobObject(job, JobObjectAssociateCompletionPortInformation, &port_info, sizeof(port_info)); - todo_wine ok(ret || broken(!ret && GetLastError() == ERROR_INVALID_PARAMETER), + ok(ret || broken(!ret && GetLastError() == ERROR_INVALID_PARAMETER), "got ret %d, error %lu\n" /* Before Win8 */, ret, GetLastError());
create_process("wait", &pi); diff --git a/server/process.c b/server/process.c index 139cadd0065..3b9f311e337 100644 --- a/server/process.c +++ b/server/process.c @@ -1947,7 +1947,15 @@ DECL_HANDLER(set_job_completion_port)
if (!job) return;
- if (!job->completion_port) + if (!req->port) + { + if (job->completion_port) + { + release_object( job->completion_port ); + job->completion_port = NULL; + } + } + else if (!job->completion_port) { job->completion_port = get_completion_obj( current->process, req->port, IO_COMPLETION_MODIFY_STATE ); job->completion_key = req->key;