[Spice-devel] [PATCH] vdagent-win: Assure you set a new HKEY_CURRENT_USER changing user.

Frediano Ziglio fziglio at redhat.com
Thu Apr 23 05:22:51 PDT 2015


HKEY_CURRENT_USER is cached as first profile is loaded. Closing the key
before setting the token allow the system to set a new HKEY_CURRENT_USER.
Some informations are readed from this key (like Desktop folder using
shell APIs).

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 vdagent/as_user.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/vdagent/as_user.cpp b/vdagent/as_user.cpp
index c8016da..96ecc24 100644
--- a/vdagent/as_user.cpp
+++ b/vdagent/as_user.cpp
@@ -46,6 +46,8 @@ bool AsUser::begin()
         }
     }
 
+    RegCloseKey(HKEY_CURRENT_USER);
+
     ret = ImpersonateLoggedOnUser(_token);
     if (!ret) {
         vd_printf("ImpersonateLoggedOnUser failed: %lu", GetLastError());
-- 
2.1.0


More information about the Spice-devel mailing list