https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f554481baf886de6d457230ed8a4233b8f00099d

commit f554481baf886de6d457230ed8a4233b8f00099d
Author:     Amine Khaldi <amine.kha...@reactos.org>
AuthorDate: Mon Jun 4 03:59:11 2018 +0100
Commit:     Amine Khaldi <amine.kha...@reactos.org>
CommitDate: Mon Jun 4 03:59:11 2018 +0100

    [WTSAPI32] Sync with Wine Staging 3.9. CORE-14656
---
 dll/win32/wtsapi32/CMakeLists.txt |  2 +-
 dll/win32/wtsapi32/wtsapi32.c     | 16 +++++++++++++++-
 media/doc/README.WINE             |  2 +-
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/dll/win32/wtsapi32/CMakeLists.txt 
b/dll/win32/wtsapi32/CMakeLists.txt
index b7c19e5cc3..6c58733791 100644
--- a/dll/win32/wtsapi32/CMakeLists.txt
+++ b/dll/win32/wtsapi32/CMakeLists.txt
@@ -11,5 +11,5 @@ list(APPEND SOURCE
 add_library(wtsapi32 SHARED ${SOURCE})
 set_module_type(wtsapi32 win32dll)
 target_link_libraries(wtsapi32 wine)
-add_importlibs(wtsapi32 msvcrt kernel32 ntdll)
+add_importlibs(wtsapi32 advapi32 msvcrt kernel32 ntdll)
 add_cd_file(TARGET wtsapi32 DESTINATION reactos/system32 FOR all)
diff --git a/dll/win32/wtsapi32/wtsapi32.c b/dll/win32/wtsapi32/wtsapi32.c
index fad7aa8d7d..f684dd9058 100644
--- a/dll/win32/wtsapi32/wtsapi32.c
+++ b/dll/win32/wtsapi32/wtsapi32.c
@@ -25,6 +25,7 @@
 #include "wine/winternl.h"
 #include "wtsapi32.h"
 #include "wine/debug.h"
+#include "wine/heap.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(wtsapi);
 
@@ -241,7 +242,7 @@ BOOL WINAPI WTSEnumerateSessionsW(HANDLE hServer, DWORD 
Reserved, DWORD Version,
  */
 void WINAPI WTSFreeMemory(PVOID pMemory)
 {
-    HeapFree(GetProcessHeap(), 0, pMemory);
+    heap_free(pMemory);
 }
 
 /************************************************************
@@ -305,6 +306,19 @@ BOOL WINAPI WTSQuerySessionInformationW(
     FIXME("Stub %p 0x%08x %d %p %p\n", hServer, SessionId, WTSInfoClass,
         Buffer, BytesReturned);
 
+    if (WTSInfoClass == WTSUserName)
+    {
+        WCHAR *username;
+        DWORD count = 0;
+
+        GetUserNameW(NULL, &count);
+        if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) return FALSE;
+        if (!(username = heap_alloc(count * sizeof(WCHAR)))) return FALSE;
+        GetUserNameW(username, &count);
+        *Buffer = username;
+        *BytesReturned = count * sizeof(WCHAR);
+        return TRUE;
+    }
     return FALSE;
 }
 
diff --git a/media/doc/README.WINE b/media/doc/README.WINE
index 9d019760d2..c71caf4196 100644
--- a/media/doc/README.WINE
+++ b/media/doc/README.WINE
@@ -212,7 +212,7 @@ reactos/dll/win32/wmi                 # Synced to 
WineStaging-2.9
 reactos/dll/win32/wmiutils            # Synced to WineStaging-3.3
 reactos/dll/win32/wmvcore             # Synced to WineStaging-3.9
 reactos/dll/win32/wshom.ocx           # Synced to WineStaging-3.3
-reactos/dll/win32/wtsapi32            # Synced to WineStaging-3.3
+reactos/dll/win32/wtsapi32            # Synced to WineStaging-3.9
 reactos/dll/win32/wuapi               # Synced to WineStaging-3.3
 reactos/dll/win32/xinput1_1           # Synced to WineStaging-2.9
 reactos/dll/win32/xinput1_2           # Synced to WineStaging-2.9

Reply via email to