Add patch for implementation of wtsapi32.WTSEnumerateProcessesW.

This commit is contained in:
Sebastian Lackner 2014-07-06 23:53:33 +02:00
parent 1761c9534e
commit 1fbebd0a1a
4 changed files with 149 additions and 2 deletions

3
debian/changelog vendored
View File

@ -1,8 +1,9 @@
wine-compholio (1.7.21) UNRELEASED; urgency=low
wine-compholio (1.7.22) UNRELEASED; urgency=low
* Added NT4 support to the process ACL tests.
* Removed RegSetKeySecurity patch (accepted upstream).
* Implement RegSetKeySecurity on top of NtSetSecurityObject.
* Updated RegSetKeySecurity patch to work with special root keys.
* Add patch for wtsapi32.WTSEnumerateProcessesW function.
-- Erich E. Hoover <erich.e.hoover@gmail.com> Fri, 04 Jul 2014 13:18:40 -0600
wine-compholio (1.7.21) unstable; urgency=low

View File

@ -0,0 +1,142 @@
From 828665a6803984db12958dfe7e9c735c192ae257 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 22 Jun 2014 19:04:38 +0200
Subject: wtsapi32: Partial implementation of WTSEnumerateProcessesW.
---
dlls/wtsapi32/tests/wtsapi.c | 1 -
dlls/wtsapi32/wtsapi32.c | 82 ++++++++++++++++++++++++++++++++++++++----
2 files changed, 75 insertions(+), 8 deletions(-)
diff --git a/dlls/wtsapi32/tests/wtsapi.c b/dlls/wtsapi32/tests/wtsapi.c
index e8dced7..a317e5f 100644
--- a/dlls/wtsapi32/tests/wtsapi.c
+++ b/dlls/wtsapi32/tests/wtsapi.c
@@ -85,7 +85,6 @@ static void test_WTSEnumerateProcessesW(void)
{
found = found || !lstrcmpW(pname, info[i].pProcessName);
}
- todo_wine
ok(found || broken(!ret), "process name %s not found\n", wine_dbgstr_w(pname));
if (info) WTSFreeMemory(info);
}
diff --git a/dlls/wtsapi32/wtsapi32.c b/dlls/wtsapi32/wtsapi32.c
index 79d5a7f..9457143 100644
--- a/dlls/wtsapi32/wtsapi32.c
+++ b/dlls/wtsapi32/wtsapi32.c
@@ -18,8 +18,11 @@
#include "config.h"
#include <stdarg.h>
#include <stdlib.h>
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
#include "windef.h"
#include "winbase.h"
+#include "winternl.h"
#include "wtsapi32.h"
#include "wine/debug.h"
@@ -84,8 +87,13 @@ BOOL WINAPI WTSEnumerateProcessesA(HANDLE hServer, DWORD Reserved, DWORD Version
BOOL WINAPI WTSEnumerateProcessesW(HANDLE hServer, DWORD Reserved, DWORD Version,
PWTS_PROCESS_INFOW* ppProcessInfo, DWORD* pCount)
{
- FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer, Reserved, Version,
- ppProcessInfo, pCount);
+ WTS_PROCESS_INFOW *processInfo;
+ SYSTEM_PROCESS_INFORMATION *spi;
+ ULONG size = 0x4000;
+ void *buf = NULL;
+ NTSTATUS status;
+ DWORD count;
+ WCHAR *name;
if (!ppProcessInfo || !pCount || Reserved != 0 || Version != 1)
{
@@ -93,9 +101,71 @@ BOOL WINAPI WTSEnumerateProcessesW(HANDLE hServer, DWORD Reserved, DWORD Version
return FALSE;
}
- *pCount = 0;
- *ppProcessInfo = NULL;
+ if (hServer != WTS_CURRENT_SERVER_HANDLE)
+ {
+ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+ return FALSE;
+ }
+
+ do
+ {
+ size *= 2;
+ HeapFree(GetProcessHeap(), 0, buf);
+ buf = HeapAlloc(GetProcessHeap(), 0, size);
+ if (!buf)
+ {
+ SetLastError(ERROR_OUTOFMEMORY);
+ return FALSE;
+ }
+ status = NtQuerySystemInformation(SystemProcessInformation, buf, size, NULL);
+ }
+ while (status == STATUS_INFO_LENGTH_MISMATCH);
+
+ if (status != STATUS_SUCCESS)
+ {
+ HeapFree(GetProcessHeap(), 0, buf);
+ SetLastError(RtlNtStatusToDosError(status));
+ return FALSE;
+ }
+ spi = buf;
+ count = size = 0;
+ for (;;)
+ {
+ size += sizeof(WTS_PROCESS_INFOW) + spi->ProcessName.Length + sizeof(WCHAR);
+ count++;
+ if (spi->NextEntryOffset == 0) break;
+ spi = (SYSTEM_PROCESS_INFORMATION *)(((PCHAR)spi) + spi->NextEntryOffset);
+ }
+
+ processInfo = HeapAlloc(GetProcessHeap(), 0, size);
+ if (!processInfo)
+ {
+ HeapFree(GetProcessHeap(), 0, buf);
+ SetLastError(ERROR_OUTOFMEMORY);
+ return FALSE;
+ }
+ name = (WCHAR *)&processInfo[count];
+
+ *ppProcessInfo = processInfo;
+ *pCount = count;
+
+ spi = buf;
+ while (count--)
+ {
+ processInfo->SessionId = 0;
+ processInfo->ProcessId = HandleToUlong(spi->UniqueProcessId);
+ processInfo->pProcessName = name;
+ processInfo->pUserSid = NULL;
+ memcpy( name, spi->ProcessName.Buffer, spi->ProcessName.Length );
+ name[ spi->ProcessName.Length/sizeof(WCHAR) ] = 0;
+
+ processInfo++;
+ name += (spi->ProcessName.Length + sizeof(WCHAR))/sizeof(WCHAR);
+ spi = (SYSTEM_PROCESS_INFORMATION *)(((PCHAR)spi) + spi->NextEntryOffset);
+ }
+
+ HeapFree(GetProcessHeap(), 0, buf);
return TRUE;
}
@@ -159,9 +229,7 @@ BOOL WINAPI WTSEnumerateSessionsW(HANDLE hServer, DWORD Reserved, DWORD Version,
*/
void WINAPI WTSFreeMemory(PVOID pMemory)
{
- static int once;
-
- if (!once++) FIXME("Stub %p\n", pMemory);
+ HeapFree(GetProcessHeap(), 0, pMemory);
}
/************************************************************
--
1.7.9.5

View File

@ -0,0 +1,3 @@
Revision: 1
Author: Sebastian Lackner
Title: Partial implementation of WTSEnumerateProcessesW.

View File

@ -6,7 +6,7 @@ diff --git a/libs/wine/config.c b/libs/wine/config.c
index a273502..5fa0cd5 100644
--- a/libs/wine/config.c
+++ b/libs/wine/config.c
@@ -478,6 +478,42 @@ const char *wine_get_version(void)
@@ -478,6 +478,43 @@ const char *wine_get_version(void)
return PACKAGE_VERSION;
}
@ -30,6 +30,7 @@ index a273502..5fa0cd5 100644
+ { "e7581ed7-12b3-4ed3-835b-5a62afbf9c85:4", "Sebastian Lackner", "Use lockfree implementation for get_cached_fd." },
+ { "3405aa34-f341-11e3-83ce-0090f5c75ad5:1", "Erich E. Hoover", "Add default security descriptor ownership and DACLs for processes." },
+ { "e46b26df-3c1b-419c-9579-f0d1e1c50bea:1", "Sebastian Lackner", "Workaround for broken implementation of shlwapi url functions." },
+ { "3790a2d5-f930-423e-9c03-f7fc1c1e0811:1", "Sebastian Lackner", "Partial implementation of WTSEnumerateProcessesW." },
+ { "0b21d7ac-0387-4493-aa38-fbafe3e749f5:2", "Michael Müller", "Decrease minimum SetTimer interval to 5 ms." },
+ { "2394843e-2bc4-4fa4-8368-1ef32093b89e:1", "Michael Müller", "Allow changing strict draw ordering through an exported function." },
+ { "255473fa-4e0a-4f51-952b-4deecc1a2181:1", "Michael Müller", "Indicate direct rendering through OpenGL extension." },