[Spice-devel] [PATCH] vdservice: set process handle for vdagent launched on session>0

Arnon Gilboa agilboa at redhat.com
Sun Nov 25 07:14:19 PST 2012


The problem on XP was failing to terminate agent running on session>0,
since during agent process creation, a handle was not set, so it was NULL.
Therefore, the new agent created (at the session we switched to) was unable
to open vitio-serial which was still used by the other running agent instance.

rhbz#868254
---
 vdservice/vdservice.cpp |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/vdservice/vdservice.cpp b/vdservice/vdservice.cpp
index b2448e7..a2cf67d 100644
--- a/vdservice/vdservice.cpp
+++ b/vdservice/vdservice.cpp
@@ -640,6 +640,13 @@ BOOL create_session_process_as_user(IN DWORD session_id, IN BOOL use_default_tok
         ret = proc_ret.ret_value;
         if (ret) {
             *process_information = proc_ret.process_information;
+            if (process_information->hProcess == 0) {
+                process_information->hProcess = OpenProcess(SYNCHRONIZE | PROCESS_TERMINATE, FALSE,
+                                                            process_information->dwProcessId);
+                if (!process_information->hProcess) {
+                    vd_printf("OpenProcess() failed %lu", GetLastError());
+                }
+            }
         } else {
             SetLastError(proc_ret.last_error);
         }
-- 
1.7.4.1



More information about the Spice-devel mailing list