mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
Rebase against 9bc7d41080f5e6805154b9d52a765f2be5d37279.
This commit is contained in:
parent
34afd80e2e
commit
d97f6a5faa
@ -1,15 +1,15 @@
|
||||
From 598845132c5c0b49bb088b6e70a4127bc81924fb Mon Sep 17 00:00:00 2001
|
||||
From ff99f88bc6aabaa9ab5b7e4b44092f39a6079541 Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Church <achurch@achurch.org>
|
||||
Date: Mon, 25 Feb 2019 11:23:12 +1100
|
||||
Subject: [PATCH] dinput: Allow reconnecting to disconnected joysticks
|
||||
|
||||
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=34297
|
||||
---
|
||||
dlls/dinput/joystick_linuxinput.c | 148 +++++++++++++++++++++++-------
|
||||
1 file changed, 113 insertions(+), 35 deletions(-)
|
||||
dlls/dinput/joystick_linuxinput.c | 152 ++++++++++++++++++++++--------
|
||||
1 file changed, 115 insertions(+), 37 deletions(-)
|
||||
|
||||
diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c
|
||||
index 14acbb5cd8c..ef7b160ba58 100644
|
||||
index 307b447d237..fcd60724853 100644
|
||||
--- a/dlls/dinput/joystick_linuxinput.c
|
||||
+++ b/dlls/dinput/joystick_linuxinput.c
|
||||
@@ -84,6 +84,13 @@ struct wine_input_absinfo {
|
||||
@ -25,8 +25,8 @@ index 14acbb5cd8c..ef7b160ba58 100644
|
||||
+
|
||||
/* implemented in effect_linuxinput.c */
|
||||
HRESULT linuxinput_create_effect(int* fd, REFGUID rguid, struct list *parent_list_entry, LPDIRECTINPUTEFFECT* peff);
|
||||
HRESULT linuxinput_get_info_A(int fd, REFGUID rguid, LPDIEFFECTINFOA info);
|
||||
@@ -123,6 +130,7 @@ struct JoystickImpl
|
||||
HRESULT linuxinput_get_info_W(int fd, REFGUID rguid, LPDIEFFECTINFOW info);
|
||||
@@ -122,6 +129,7 @@ struct JoystickImpl
|
||||
|
||||
/* joystick private */
|
||||
int joyfd;
|
||||
@ -34,7 +34,7 @@ index 14acbb5cd8c..ef7b160ba58 100644
|
||||
|
||||
int dev_axes_to_di[ABS_MAX];
|
||||
POINTL povs[4];
|
||||
@@ -468,6 +476,7 @@ static JoystickImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput, unsig
|
||||
@@ -467,6 +475,7 @@ static JoystickImpl *alloc_device(REFGUID rguid, IDirectInputImpl *dinput, unsig
|
||||
newDevice->generic.base.dinput = dinput;
|
||||
newDevice->generic.joy_polldev = joy_polldev;
|
||||
newDevice->joyfd = -1;
|
||||
@ -42,106 +42,98 @@ index 14acbb5cd8c..ef7b160ba58 100644
|
||||
newDevice->joydev = &joydevs[index];
|
||||
newDevice->generic.name = newDevice->joydev->name;
|
||||
list_init(&newDevice->ff_effects);
|
||||
@@ -675,38 +684,15 @@ static HRESULT joydev_create_device(IDirectInputImpl *dinput, REFGUID rguid, REF
|
||||
@@ -674,6 +683,44 @@ static HRESULT joydev_create_device(IDirectInputImpl *dinput, REFGUID rguid, REF
|
||||
return DIERR_DEVICENOTREG;
|
||||
}
|
||||
|
||||
-
|
||||
-const struct dinput_device joystick_linuxinput_device = {
|
||||
- "Wine Linux-input joystick driver",
|
||||
- joydev_enum_deviceA,
|
||||
- joydev_enum_deviceW,
|
||||
- joydev_create_device
|
||||
-};
|
||||
-
|
||||
-/******************************************************************************
|
||||
- * Acquire : gets exclusive control of the joystick
|
||||
- */
|
||||
-static HRESULT WINAPI JoystickWImpl_Acquire(LPDIRECTINPUTDEVICE8W iface)
|
||||
+static int joydev_open_evdev(JoystickImpl *This)
|
||||
{
|
||||
- JoystickImpl *This = impl_from_IDirectInputDevice8W(iface);
|
||||
- HRESULT res;
|
||||
-
|
||||
- TRACE("(this=%p)\n",This);
|
||||
+{
|
||||
+ int fd;
|
||||
|
||||
- if ((res = IDirectInputDevice2WImpl_Acquire(iface)) != DI_OK)
|
||||
+
|
||||
+ if ((fd = open(This->joydev->device, O_RDWR)) == -1)
|
||||
{
|
||||
- WARN("Failed to acquire: %x\n", res);
|
||||
- return res;
|
||||
- }
|
||||
-
|
||||
- if ((This->joyfd = open(This->joydev->device, O_RDWR)) == -1)
|
||||
- {
|
||||
- if ((This->joyfd = open(This->joydev->device, O_RDONLY)) == -1)
|
||||
+ {
|
||||
+ if ((fd = open(This->joydev->device, O_RDONLY)) == -1)
|
||||
{
|
||||
/* Couldn't open the device at all */
|
||||
- ERR("Failed to open device %s: %d %s\n", This->joydev->device, errno, strerror(errno));
|
||||
- IDirectInputDevice2WImpl_Unacquire(iface);
|
||||
- return DIERR_NOTFOUND;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -721,18 +707,53 @@ static HRESULT WINAPI JoystickWImpl_Acquire(LPDIRECTINPUTDEVICE8W iface)
|
||||
event.type = EV_FF;
|
||||
event.code = FF_GAIN;
|
||||
event.value = This->ff_gain;
|
||||
- if (write(This->joyfd, &event, sizeof(event)) == -1)
|
||||
+ {
|
||||
+ /* Couldn't open the device at all */
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ /* Couldn't open in r/w but opened in read-only. */
|
||||
+ WARN("Could not open %s in read-write mode. Force feedback will be disabled.\n", This->joydev->device);
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ struct input_event event;
|
||||
+
|
||||
+ event.type = EV_FF;
|
||||
+ event.code = FF_GAIN;
|
||||
+ event.value = This->ff_gain;
|
||||
+ if (write(fd, &event, sizeof(event)) == -1)
|
||||
ERR("Failed to set gain (%i): %d %s\n", This->ff_gain, errno, strerror(errno));
|
||||
if (!This->ff_autocenter)
|
||||
{
|
||||
/* Disable autocenter. */
|
||||
event.code = FF_AUTOCENTER;
|
||||
event.value = 0;
|
||||
- if (write(This->joyfd, &event, sizeof(event)) == -1)
|
||||
+ ERR("Failed to set gain (%i): %d %s\n", This->ff_gain, errno, strerror(errno));
|
||||
+ if (!This->ff_autocenter)
|
||||
+ {
|
||||
+ /* Disable autocenter. */
|
||||
+ event.code = FF_AUTOCENTER;
|
||||
+ event.value = 0;
|
||||
+ if (write(fd, &event, sizeof(event)) == -1)
|
||||
ERR("Failed disabling autocenter: %d %s\n", errno, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
+ ERR("Failed disabling autocenter: %d %s\n", errno, strerror(errno));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return fd;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+const struct dinput_device joystick_linuxinput_device = {
|
||||
+ "Wine Linux-input joystick driver",
|
||||
+ joydev_enum_deviceA,
|
||||
+ joydev_enum_deviceW,
|
||||
+ joydev_create_device
|
||||
+};
|
||||
+
|
||||
+/******************************************************************************
|
||||
+ * Acquire : gets exclusive control of the joystick
|
||||
+ */
|
||||
+static HRESULT WINAPI JoystickWImpl_Acquire(LPDIRECTINPUTDEVICE8W iface)
|
||||
+{
|
||||
+ JoystickImpl *This = impl_from_IDirectInputDevice8W(iface);
|
||||
+ HRESULT res;
|
||||
+
|
||||
+ TRACE("(this=%p)\n",This);
|
||||
+
|
||||
+ if ((res = IDirectInputDevice2WImpl_Acquire(iface)) != DI_OK)
|
||||
+ {
|
||||
+ WARN("Failed to acquire: %x\n", res);
|
||||
+ return res;
|
||||
+ }
|
||||
+
|
||||
|
||||
const struct dinput_device joystick_linuxinput_device = {
|
||||
"Wine Linux-input joystick driver",
|
||||
@@ -698,40 +745,14 @@ static HRESULT WINAPI JoystickWImpl_Acquire(LPDIRECTINPUTDEVICE8W iface)
|
||||
return res;
|
||||
}
|
||||
|
||||
- if ((This->joyfd = open(This->joydev->device, O_RDWR)) == -1)
|
||||
+ if ((This->joyfd = joydev_open_evdev(This)) == -1)
|
||||
+ {
|
||||
{
|
||||
- if ((This->joyfd = open(This->joydev->device, O_RDONLY)) == -1)
|
||||
- {
|
||||
- /* Couldn't open the device at all */
|
||||
- ERR("Failed to open device %s: %d %s\n", This->joydev->device, errno, strerror(errno));
|
||||
- IDirectInputDevice2WImpl_Unacquire(iface);
|
||||
- return DIERR_NOTFOUND;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- /* Couldn't open in r/w but opened in read-only. */
|
||||
- WARN("Could not open %s in read-write mode. Force feedback will be disabled.\n", This->joydev->device);
|
||||
- }
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- struct input_event event;
|
||||
-
|
||||
- event.type = EV_FF;
|
||||
- event.code = FF_GAIN;
|
||||
- event.value = This->ff_gain;
|
||||
- if (write(This->joyfd, &event, sizeof(event)) == -1)
|
||||
- ERR("Failed to set gain (%i): %d %s\n", This->ff_gain, errno, strerror(errno));
|
||||
- if (!This->ff_autocenter)
|
||||
- {
|
||||
- /* Disable autocenter. */
|
||||
- event.code = FF_AUTOCENTER;
|
||||
- event.value = 0;
|
||||
- if (write(This->joyfd, &event, sizeof(event)) == -1)
|
||||
- ERR("Failed disabling autocenter: %d %s\n", errno, strerror(errno));
|
||||
- }
|
||||
+ ERR("Failed to open device %s: %d %s\n", This->joydev->device, errno, strerror(errno));
|
||||
+ IDirectInputDevice2WImpl_Unacquire(iface);
|
||||
+ return DIERR_NOTFOUND;
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ This->joyfd_state = WINE_FD_STATE_OK;
|
||||
return DI_OK;
|
||||
}
|
||||
|
||||
@@ -764,6 +785,7 @@ static HRESULT WINAPI JoystickWImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface)
|
||||
@@ -763,6 +784,7 @@ static HRESULT WINAPI JoystickWImpl_Unacquire(LPDIRECTINPUTDEVICE8W iface)
|
||||
|
||||
close(This->joyfd);
|
||||
This->joyfd = -1;
|
||||
@ -149,7 +141,7 @@ index 14acbb5cd8c..ef7b160ba58 100644
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -802,23 +824,79 @@ static void joy_polldev( IDirectInputDevice8W *iface )
|
||||
@@ -801,23 +823,79 @@ static void joy_polldev( IDirectInputDevice8W *iface )
|
||||
struct input_event ie;
|
||||
JoystickImpl *This = impl_from_IDirectInputDevice8W( iface );
|
||||
|
||||
|
@ -51,7 +51,7 @@ usage()
|
||||
# Get the upstream commit sha
|
||||
upstream_commit()
|
||||
{
|
||||
echo "8ddff3f51faca2c0824e204a69f69e241fb93d15"
|
||||
echo "9bc7d41080f5e6805154b9d52a765f2be5d37279"
|
||||
}
|
||||
|
||||
# Show version information
|
||||
@ -283,7 +283,6 @@ patch_enable_all ()
|
||||
enable_ws2_32_APC_Performance="$1"
|
||||
enable_ws2_32_Connect_Time="$1"
|
||||
enable_ws2_32_getsockopt="$1"
|
||||
enable_wtsapi32_EnumerateProcesses="$1"
|
||||
enable_xactengine_initial="$1"
|
||||
enable_xactengine3_7_Notification="$1"
|
||||
enable_xactengine3_7_PrepareWave="$1"
|
||||
@ -896,9 +895,6 @@ patch_enable ()
|
||||
ws2_32-getsockopt)
|
||||
enable_ws2_32_getsockopt="$2"
|
||||
;;
|
||||
wtsapi32-EnumerateProcesses)
|
||||
enable_wtsapi32_EnumerateProcesses="$2"
|
||||
;;
|
||||
xactengine-initial)
|
||||
enable_xactengine_initial="$2"
|
||||
;;
|
||||
@ -3236,7 +3232,6 @@ fi
|
||||
# | dlls/shell32/shfldr_unixfs.c, dlls/shell32/shlview.c, dlls/shell32/shlview_cmenu.c
|
||||
# |
|
||||
if test "$enable_shell32_Context_Menu" -eq 1; then
|
||||
patch_apply shell32-Context_Menu/0001-shell32-Fix-copying-of-files-when-using-a-context-me.patch
|
||||
patch_apply shell32-Context_Menu/0003-shell32-Implement-insert-paste-for-item-context-menu.patch
|
||||
patch_apply shell32-Context_Menu/0005-shell32-Add-support-for-setting-getting-PREFERREDDRO.patch
|
||||
patch_apply shell32-Context_Menu/0006-shell32-Add-parameter-to-ISFHelper-DeleteItems-to-al.patch
|
||||
@ -4258,18 +4253,6 @@ if test "$enable_ws2_32_getsockopt" -eq 1; then
|
||||
patch_apply ws2_32-getsockopt/0001-ws2_32-Divide-values-returned-by-SO_RCVBUF-and-SO_SN.patch
|
||||
fi
|
||||
|
||||
# Patchset wtsapi32-EnumerateProcesses
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#29903] Support for WTSEnumerateProcessesW
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/wtsapi32/tests/wtsapi.c, dlls/wtsapi32/wtsapi32.c
|
||||
# |
|
||||
if test "$enable_wtsapi32_EnumerateProcesses" -eq 1; then
|
||||
patch_apply wtsapi32-EnumerateProcesses/0001-wtsapi32-Partial-implementation-of-WTSEnumerateProce.patch
|
||||
fi
|
||||
|
||||
# Patchset xactengine-initial
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
|
@ -1,30 +0,0 @@
|
||||
From 0442ed8d597eb250b7ebc41261073f71d9368f98 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sat, 2 Apr 2016 00:22:30 +0200
|
||||
Subject: [PATCH] shell32: Fix copying of files when using a context menu.
|
||||
|
||||
---
|
||||
dlls/shell32/shlview_cmenu.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c
|
||||
index 67f5ac80d84..634e3b07176 100644
|
||||
--- a/dlls/shell32/shlview_cmenu.c
|
||||
+++ b/dlls/shell32/shlview_cmenu.c
|
||||
@@ -1164,6 +1164,13 @@ static BOOL DoPaste(ContextMenu *This)
|
||||
|
||||
apidl = _ILCopyCidaToaPidl(&pidl, lpcida);
|
||||
|
||||
+ /*
|
||||
+ * In case source is a file we need to remove the last component
|
||||
+ * to obtain a IShellFolder of the parent.
|
||||
+ */
|
||||
+ if (_ILIsValue(pidl))
|
||||
+ ILRemoveLastID(pidl);
|
||||
+
|
||||
for (i = 0; bSuccess && i < lpcida->cidl; i++) {
|
||||
ITEMIDLIST *apidl_dir = NULL;
|
||||
ITEMIDLIST *apidl_item;
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1,15 +1,15 @@
|
||||
From bc86221443f957b105efda2276e92204a1f0308e Mon Sep 17 00:00:00 2001
|
||||
From 6743f6300dfd2903fc1739949826bd7b742348ad Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sat, 2 Apr 2016 04:22:07 +0200
|
||||
Subject: [PATCH] shell32: Remove source files when using cut in the context
|
||||
menu.
|
||||
|
||||
---
|
||||
dlls/shell32/shlview_cmenu.c | 75 ++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 71 insertions(+), 4 deletions(-)
|
||||
dlls/shell32/shlview_cmenu.c | 73 +++++++++++++++++++++++++++++++++---
|
||||
1 file changed, 67 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c
|
||||
index d15a144870d..3dce4a1fbac 100644
|
||||
index abee4c93a35..6a16aab2f25 100644
|
||||
--- a/dlls/shell32/shlview_cmenu.c
|
||||
+++ b/dlls/shell32/shlview_cmenu.c
|
||||
@@ -333,6 +333,64 @@ static void DoDelete(ContextMenu *This)
|
||||
@ -85,31 +85,49 @@ index d15a144870d..3dce4a1fbac 100644
|
||||
OleSetClipboard(dataobject);
|
||||
IDataObject_Release(dataobject);
|
||||
}
|
||||
@@ -1233,12 +1292,20 @@ static BOOL DoPaste(ContextMenu *This)
|
||||
/* do the copy/move */
|
||||
if (psfhlpdst && psfhlpsrc)
|
||||
{
|
||||
+ DWORD dropEffect;
|
||||
+ GetDropEffect(pda, &dropEffect);
|
||||
@@ -1170,7 +1229,7 @@ static void DoNewFolder(ContextMenu *This, IShellView *view)
|
||||
}
|
||||
}
|
||||
|
||||
-static HRESULT paste_pidls(ContextMenu *This, ITEMIDLIST **pidls, UINT count)
|
||||
+static HRESULT paste_pidls(ContextMenu *This, IDataObject *pda, ITEMIDLIST **pidls, UINT count)
|
||||
{
|
||||
IShellFolder *psfDesktop;
|
||||
UINT i;
|
||||
@@ -1202,10 +1261,12 @@ static HRESULT paste_pidls(ContextMenu *This, ITEMIDLIST **pidls, UINT count)
|
||||
/* do the copy/move */
|
||||
if (psfhlpdst && psfhlpsrc)
|
||||
{
|
||||
+ DWORD dropEffect;
|
||||
+ GetDropEffect(pda, &dropEffect);
|
||||
+
|
||||
HRESULT hr = ISFHelper_CopyItems(psfhlpdst, psfFrom, 1, (LPCITEMIDLIST*)&apidl_item);
|
||||
- if (FAILED(hr))
|
||||
+ if (SUCCEEDED(hr))
|
||||
+ {
|
||||
+ if (dropEffect == DROPEFFECT_MOVE)
|
||||
+ {
|
||||
+ if (FAILED(ISFHelper_DeleteItems(psfhlpsrc, lpcida->cidl, (LPCITEMIDLIST*)apidl, FALSE)))
|
||||
+ bSuccess = FALSE;
|
||||
+ }
|
||||
+ }
|
||||
+ else
|
||||
bSuccess = FALSE;
|
||||
- /* FIXME handle move
|
||||
- ISFHelper_DeleteItems(psfhlpsrc, 1, &apidl_item);
|
||||
- */
|
||||
hr = ISFHelper_CopyItems(psfhlpdst, psfFrom, 1, (LPCITEMIDLIST*)&pidl_item);
|
||||
- /* FIXME handle move
|
||||
- ISFHelper_DeleteItems(psfhlpsrc, 1, &pidl_item);
|
||||
- */
|
||||
+ if (SUCCEEDED(hr) && dropEffect == DROPEFFECT_MOVE)
|
||||
+ hr = ISFHelper_DeleteItems(psfhlpsrc, 1, (LPCITEMIDLIST*)&pidl_item, FALSE);
|
||||
}
|
||||
if(psfhlpdst) ISFHelper_Release(psfhlpdst);
|
||||
if(psfhlpsrc) ISFHelper_Release(psfhlpsrc);
|
||||
@@ -1251,7 +1312,7 @@ static HRESULT DoPaste(ContextMenu *This)
|
||||
apidl = _ILCopyCidaToaPidl(&pidl, lpcida);
|
||||
if (apidl)
|
||||
{
|
||||
- hr = paste_pidls(This, apidl, lpcida->cidl);
|
||||
+ hr = paste_pidls(This, pda, apidl, lpcida->cidl);
|
||||
_ILFreeaPidl(apidl, lpcida->cidl);
|
||||
SHFree(pidl);
|
||||
}
|
||||
@@ -1289,7 +1350,7 @@ static HRESULT DoPaste(ContextMenu *This)
|
||||
}
|
||||
}
|
||||
if(psfhlpdst) ISFHelper_Release(psfhlpdst);
|
||||
if(psfhlpsrc) ISFHelper_Release(psfhlpsrc);
|
||||
if (SUCCEEDED(hr))
|
||||
- hr = paste_pidls(This, pidls, count);
|
||||
+ hr = paste_pidls(This, pda, pidls, count);
|
||||
_ILFreeaPidl(pidls, count);
|
||||
}
|
||||
else
|
||||
--
|
||||
2.30.2
|
||||
|
||||
|
@ -1,131 +0,0 @@
|
||||
From 5befee66603e60c0fee60e06805346e0e165131d Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 22 Jun 2014 19:04:38 +0200
|
||||
Subject: [PATCH] wtsapi32: Partial implementation of WTSEnumerateProcessesW.
|
||||
|
||||
---
|
||||
dlls/wtsapi32/tests/wtsapi.c | 1 -
|
||||
dlls/wtsapi32/wtsapi32.c | 78 ++++++++++++++++++++++++++++++++++--
|
||||
2 files changed, 74 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/dlls/wtsapi32/tests/wtsapi.c b/dlls/wtsapi32/tests/wtsapi.c
|
||||
index 8ce1dc8bf9c..54bb3b70e6e 100644
|
||||
--- a/dlls/wtsapi32/tests/wtsapi.c
|
||||
+++ b/dlls/wtsapi32/tests/wtsapi.c
|
||||
@@ -86,7 +86,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));
|
||||
WTSFreeMemory(info);
|
||||
}
|
||||
diff --git a/dlls/wtsapi32/wtsapi32.c b/dlls/wtsapi32/wtsapi32.c
|
||||
index a5c9bf6519f..ac7fc765779 100644
|
||||
--- a/dlls/wtsapi32/wtsapi32.c
|
||||
+++ b/dlls/wtsapi32/wtsapi32.c
|
||||
@@ -17,8 +17,11 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
+#include "ntstatus.h"
|
||||
+#define WIN32_NO_STATUS
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
+#include "winternl.h"
|
||||
#include "winnls.h"
|
||||
#include "lmcons.h"
|
||||
#include "wtsapi32.h"
|
||||
@@ -116,8 +119,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)
|
||||
{
|
||||
@@ -125,9 +133,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;
|
||||
}
|
||||
|
||||
--
|
||||
2.30.2
|
||||
|
@ -1 +0,0 @@
|
||||
Fixes: [29903] Support for WTSEnumerateProcessesW
|
@ -1 +1 @@
|
||||
8ddff3f51faca2c0824e204a69f69e241fb93d15
|
||||
9bc7d41080f5e6805154b9d52a765f2be5d37279
|
||||
|
Loading…
Reference in New Issue
Block a user