From ed5c597acaf69d26f736c90502946292eeef6e40 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 11 Feb 2016 19:07:36 +0100
Subject: wtsapi32: Improve WTSQueryUserToken stub. (v2)

---
 dlls/wtsapi32/wtsapi32.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/dlls/wtsapi32/wtsapi32.c b/dlls/wtsapi32/wtsapi32.c
index c668604..6f8223c 100644
--- a/dlls/wtsapi32/wtsapi32.c
+++ b/dlls/wtsapi32/wtsapi32.c
@@ -243,7 +243,16 @@ BOOL WINAPI WTSQuerySessionInformationW(
 BOOL WINAPI WTSQueryUserToken(ULONG session_id, PHANDLE token)
 {
     FIXME("%u %p\n", session_id, token);
-    return FALSE;
+
+    if (!token)
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return FALSE;
+    }
+
+    return DuplicateHandle(GetCurrentProcess(), GetCurrentProcessToken(),
+                           GetCurrentProcess(), token,
+                           0, FALSE, DUPLICATE_SAME_ACCESS);
 }
 
 /************************************************************
-- 
2.7.1

