Rebase against 3ba4412be60dafee310b5d3c71aa762aa8846564.

This commit is contained in:
Zebediah Figura 2021-05-03 23:39:26 -05:00
parent c814617e2c
commit 813bfa288e
13 changed files with 71 additions and 572 deletions

View File

@ -1,93 +0,0 @@
From 3f092e1e4fd85a4a8cc0e34f5b5be848c3db9b44 Mon Sep 17 00:00:00 2001
From: Louis Lenders <xerox.xerox2000x@gmail.com>
Date: Sun, 18 Oct 2020 11:59:43 +0200
Subject: [PATCH] ntdll: Add stub for
RtlQueryProcessPlaceholderCompatibilityMode
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50026
Signed-off-by: Louis Lenders <xerox.xerox2000x@gmail.com>
---
dlls/ntdll/ntdll.spec | 1 +
dlls/ntdll/rtl.c | 10 ++++++++++
dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 1 +
include/ddk/ntifs.h | 8 ++++++++
4 files changed, 20 insertions(+)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 66c9d9127f9..b0804a15121 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -899,6 +899,7 @@
@ stdcall RtlQueryProcessDebugInformation(long long ptr)
@ stub RtlQueryProcessHeapInformation
@ stub RtlQueryProcessLockInformation
+@ stdcall RtlQueryProcessPlaceholderCompatibilityMode()
@ stub RtlQueryProperties
@ stub RtlQueryPropertyNames
@ stub RtlQueryPropertySet
diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c
index cf21c980a45..d7740a7a044 100644
--- a/dlls/ntdll/rtl.c
+++ b/dlls/ntdll/rtl.c
@@ -37,6 +37,7 @@
#include "ntdll_misc.h"
#include "in6addr.h"
#include "ddk/ntddk.h"
+#include "ddk/ntifs.h"
WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
WINE_DECLARE_DEBUG_CHANNEL(debugstr);
@@ -2165,3 +2166,12 @@ NTSTATUS WINAPI RtlQueryPackageIdentity(HANDLE token, WCHAR *fullname, SIZE_T *f
FIXME("(%p, %p, %p, %p, %p, %p): stub\n", token, fullname, fullname_size, appid, appid_size, packaged);
return STATUS_NOT_FOUND;
}
+
+/*********************************************************************
+ * RtlQueryProcessPlaceholderCompatibilityMode [NTDLL.@]
+ */
+char WINAPI RtlQueryProcessPlaceholderCompatibilityMode(void)
+{
+ FIXME("stub\n");
+ return PHCM_APPLICATION_DEFAULT;
+}
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
index 29fcffec892..bfedea81581 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
+++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
@@ -1212,6 +1212,7 @@
@ stdcall RtlQueryDynamicTimeZoneInformation(ptr)
@ stdcall RtlQueryInformationAcl(ptr ptr long long)
@ stdcall RtlQueryPackageIdentity(long ptr ptr ptr ptr ptr)
+@ stdcall RtlQueryProcessPlaceholderCompatibilityMode() ntdll.RtlQueryProcessPlaceholderCompatibilityMode
@ stdcall RtlQueryRegistryValues(long ptr ptr ptr ptr)
@ stdcall RtlQueryRegistryValuesEx(long ptr ptr ptr ptr) RtlQueryRegistryValues
@ stdcall RtlQueryTimeZoneInformation(ptr)
diff --git a/include/ddk/ntifs.h b/include/ddk/ntifs.h
index 73d602595c4..a9cc753d7e4 100644
--- a/include/ddk/ntifs.h
+++ b/include/ddk/ntifs.h
@@ -21,6 +21,13 @@
#include "ntddk.h"
+#define PHCM_ERROR_INVALID_PARAMETER (char)-1
+#define PHCM_ERROR_NO_TEB (char)-2
+#define PHCM_APPLICATION_DEFAULT (char)0
+#define PHCM_DISGUISE_PLACEHOLDERS (char)1
+#define PHCM_EXPOSE_PLACEHOLDERS (char)2
+#define PHCM_MAX (char)2
+
typedef struct _EX_PUSH_LOCK EX_PUSH_LOCK, *PEX_PUSH_LOCK;
typedef enum _FS_FILTER_SECTION_SYNC_TYPE
@@ -140,5 +147,6 @@ BOOLEAN WINAPI PsIsSystemThread(PETHREAD);
NTSTATUS WINAPI PsLookupProcessByProcessId(HANDLE,PEPROCESS*);
NTSTATUS WINAPI PsLookupThreadByThreadId(HANDLE,PETHREAD*);
void WINAPI PsRevertToSelf(void);
+char WINAPI RtlQueryProcessPlaceholderCompatibilityMode(void);
#endif
--
2.30.1

View File

@ -1 +0,0 @@
Fixes: [50026]: ntdll: Add stub for RtlQueryProcessPlaceholderCompatibilityMode

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "2deb8c2825afcb88a9f106b73aa1f4da9253fb87"
echo "3ba4412be60dafee310b5d3c71aa762aa8846564"
}
# Show version information
@ -168,7 +168,6 @@ patch_enable_all ()
enable_ntdll_ProcessQuotaLimits="$1"
enable_ntdll_RtlFirstFreeAce="$1"
enable_ntdll_RtlQueryPackageIdentity="$1"
enable_ntdll_RtlQueryProcessPlaceholderCompatibilityMode="$1"
enable_ntdll_Serial_Port_Detection="$1"
enable_ntdll_Syscall_Emulation="$1"
enable_ntdll_WRITECOPY="$1"
@ -557,9 +556,6 @@ patch_enable ()
ntdll-RtlQueryPackageIdentity)
enable_ntdll_RtlQueryPackageIdentity="$2"
;;
ntdll-RtlQueryProcessPlaceholderCompatibilityMode)
enable_ntdll_RtlQueryProcessPlaceholderCompatibilityMode="$2"
;;
ntdll-Serial_Port_Detection)
enable_ntdll_Serial_Port_Detection="$2"
;;
@ -2990,18 +2986,6 @@ if test "$enable_ntdll_RtlQueryPackageIdentity" -eq 1; then
patch_apply ntdll-RtlQueryPackageIdentity/0003-ntdll-tests-Add-basic-tests-for-RtlQueryPackageIdent.patch
fi
# Patchset ntdll-RtlQueryProcessPlaceholderCompatibilityMode
# |
# | This patchset fixes the following Wine bugs:
# | * [#50026] : ntdll: Add stub for RtlQueryProcessPlaceholderCompatibilityMode
# |
# | Modified files:
# | * dlls/ntdll/ntdll.spec, dlls/ntdll/rtl.c, dlls/ntoskrnl.exe/ntoskrnl.exe.spec, include/ddk/ntifs.h
# |
if test "$enable_ntdll_RtlQueryProcessPlaceholderCompatibilityMode" -eq 1; then
patch_apply ntdll-RtlQueryProcessPlaceholderCompatibilityMode/0001-ntdll-Add-stub-for-RtlQueryProcessPlaceholderCompati.patch
fi
# Patchset ntdll-Serial_Port_Detection
# |
# | This patchset fixes the following Wine bugs:
@ -3375,7 +3359,6 @@ fi
# |
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/0002-shell32-Set-return-value-correctly-in-DoPaste.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
@ -3793,9 +3776,8 @@ fi
# | * [#50506] WM_INPUT messages are not received for HID devices registered with RegisterRawInputDevices
# |
# | Modified files:
# | * dlls/hidclass.sys/Makefile.in, dlls/hidclass.sys/device.c, dlls/hidclass.sys/pnp.c, dlls/ntoskrnl.exe/ntoskrnl.exe.spec,
# | dlls/ntoskrnl.exe/pnp.c, dlls/user32/message.c, dlls/user32/rawinput.c, include/ddk/wdm.h, server/protocol.def,
# | server/queue.c, server/trace.c
# | * dlls/hidclass.sys/Makefile.in, dlls/hidclass.sys/device.c, dlls/hidclass.sys/pnp.c, dlls/user32/message.c,
# | dlls/user32/rawinput.c, server/protocol.def, server/queue.c, server/trace.c
# |
if test "$enable_user32_rawinput_hid" -eq 1; then
patch_apply user32-rawinput-hid/0005-hidclass.sys-Use-__wine_send_input-to-send-device-no.patch
@ -3809,10 +3791,7 @@ if test "$enable_user32_rawinput_hid" -eq 1; then
patch_apply user32-rawinput-hid/0013-hidclass.sys-Send-rawinput-messages-with-HID-report.patch
patch_apply user32-rawinput-hid/0014-server-Add-extra-data-to-hardware_msg_data.patch
patch_apply user32-rawinput-hid/0015-server-Implement-WM_INPUT-RIM_TYPEHID-message-dispat.patch
patch_apply user32-rawinput-hid/0016-ntoskrnl-Implement-IoSetDevicePropertyData.patch
patch_apply user32-rawinput-hid/0017-hidclass.sys-Assign-rawinput-handles-through-device-.patch
patch_apply user32-rawinput-hid/0018-user32-Enumerate-mouse-rawinput-device-before-HID-de.patch
patch_apply user32-rawinput-hid/0019-user32-Use-device-handles-assigned-by-hidclass.sys.patch
fi
# Patchset user32-rawinput-mouse

View File

@ -1,17 +1,17 @@
From 9175a389d86cc231e7e8158360402feb7c5b269e Mon Sep 17 00:00:00 2001
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: shell32: Fix copying of files when using a context menu.
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 099f5bc..552b809 100644
index 67f5ac80d84..634e3b07176 100644
--- a/dlls/shell32/shlview_cmenu.c
+++ b/dlls/shell32/shlview_cmenu.c
@@ -739,6 +739,13 @@ static BOOL DoPaste(ContextMenu *This)
@@ -1164,6 +1164,13 @@ static BOOL DoPaste(ContextMenu *This)
apidl = _ILCopyCidaToaPidl(&pidl, lpcida);
@ -22,9 +22,9 @@ index 099f5bc..552b809 100644
+ if (_ILIsValue(pidl))
+ ILRemoveLastID(pidl);
+
/* bind to the source shellfolder */
SHGetDesktopFolder(&psfDesktop);
if(psfDesktop)
for (i = 0; bSuccess && i < lpcida->cidl; i++) {
ITEMIDLIST *apidl_dir = NULL;
ITEMIDLIST *apidl_item;
--
2.7.1
2.30.2

View File

@ -1,26 +0,0 @@
From 7f13fd37d55efe4cc20c4c3eb1c79d3c8ef0040d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 2 Apr 2016 01:21:34 +0200
Subject: shell32: Set return value correctly in DoPaste.
---
dlls/shell32/shlview_cmenu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c
index 552b809..7ce6cd9 100644
--- a/dlls/shell32/shlview_cmenu.c
+++ b/dlls/shell32/shlview_cmenu.c
@@ -764,7 +764,8 @@ static BOOL DoPaste(ContextMenu *This)
/* do the copy/move */
if (psfhlpdst && psfhlpsrc)
{
- ISFHelper_CopyItems(psfhlpdst, psfFrom, lpcida->cidl, (LPCITEMIDLIST*)apidl);
+ if (SUCCEEDED(ISFHelper_CopyItems(psfhlpdst, psfFrom, lpcida->cidl, (LPCITEMIDLIST*)apidl)))
+ bSuccess = TRUE;
/* FIXME handle move
ISFHelper_DeleteItems(psfhlpsrc, lpcida->cidl, apidl);
*/
--
2.7.1

View File

@ -1,12 +1,12 @@
From 9272578ec7000b28be8e1454f4e2dd2ee7017146 Mon Sep 17 00:00:00 2001
From c95a146e0925be225cd71f23062de266b82b28d4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 2 Apr 2016 01:39:40 +0200
Subject: [PATCH] shell32: Implement insert/paste for item context menus.
---
dlls/shell32/shell32.rc | 1 +
dlls/shell32/shlview_cmenu.c | 64 ++++++++++++++++++++++++++++++++----
2 files changed, 58 insertions(+), 7 deletions(-)
dlls/shell32/shlview_cmenu.c | 46 ++++++++++++++++++++++++++++++++----
2 files changed, 42 insertions(+), 5 deletions(-)
diff --git a/dlls/shell32/shell32.rc b/dlls/shell32/shell32.rc
index ff859381593..e7324c9af5e 100644
@ -21,7 +21,7 @@ index ff859381593..e7324c9af5e 100644
MENUITEM "Create &Link", FCIDM_SHVIEW_CREATELINK
MENUITEM "&Delete", FCIDM_SHVIEW_DELETE
diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c
index f8b6a8572de..0e72e13c80f 100644
index 634e3b07176..fe943179cb1 100644
--- a/dlls/shell32/shlview_cmenu.c
+++ b/dlls/shell32/shlview_cmenu.c
@@ -66,6 +66,8 @@ typedef struct
@ -113,7 +113,7 @@ index f8b6a8572de..0e72e13c80f 100644
case FCIDM_SHVIEW_PROPERTIES:
TRACE("Verb FCIDM_SHVIEW_PROPERTIES\n");
DoOpenProperties(This, lpcmi->hwnd);
@@ -845,6 +877,7 @@ static HRESULT WINAPI ItemMenu_GetCommandString(IContextMenu3 *iface, UINT_PTR c
@@ -849,6 +881,7 @@ static HRESULT WINAPI ItemMenu_GetCommandString(IContextMenu3 *iface, UINT_PTR c
static const WCHAR exploreW[] = {'e','x','p','l','o','r','e',0};
static const WCHAR cutW[] = {'c','u','t',0};
static const WCHAR copyW[] = {'c','o','p','y',0};
@ -121,7 +121,7 @@ index f8b6a8572de..0e72e13c80f 100644
static const WCHAR linkW[] = {'l','i','n','k',0};
static const WCHAR deleteW[] = {'d','e','l','e','t','e',0};
static const WCHAR propertiesW[] = {'p','r','o','p','e','r','t','i','e','s',0};
@@ -878,6 +911,9 @@ static HRESULT WINAPI ItemMenu_GetCommandString(IContextMenu3 *iface, UINT_PTR c
@@ -882,6 +915,9 @@ static HRESULT WINAPI ItemMenu_GetCommandString(IContextMenu3 *iface, UINT_PTR c
case FCIDM_SHVIEW_COPY:
cmdW = copyW;
break;
@ -131,31 +131,6 @@ index f8b6a8572de..0e72e13c80f 100644
case FCIDM_SHVIEW_CREATELINK:
cmdW = linkW;
break;
@@ -1177,8 +1213,22 @@ static BOOL DoPaste(ContextMenu *This)
if (psfFrom)
{
/* get source and destination shellfolder */
- ISFHelper *psfhlpdst, *psfhlpsrc;
- IShellFolder_QueryInterface(This->parent, &IID_ISFHelper, (void**)&psfhlpdst);
+ ISFHelper *psfhlpdst = NULL, *psfhlpsrc = NULL;
+
+ /* when using an item context menu we first need to bind to the selected folder */
+ if (This->apidl)
+ {
+ IShellFolder *folder;
+
+ if (SUCCEEDED(IShellFolder_BindToObject(This->parent, This->apidl[0], NULL, &IID_IShellFolder, (LPVOID*)&folder)))
+ {
+ IShellFolder_QueryInterface(folder, &IID_ISFHelper, (void**)&psfhlpdst);
+ IShellFolder_Release(folder);
+ }
+ }
+ else
+ IShellFolder_QueryInterface(This->parent, &IID_ISFHelper, (void**)&psfhlpdst);
+
IShellFolder_QueryInterface(psfFrom, &IID_ISFHelper, (void**)&psfhlpsrc);
/* do the copy/move */
--
2.30.2

View File

@ -1,20 +1,22 @@
From c6df9e2fd8f92597a728935e67a6ac6c3bc1223c Mon Sep 17 00:00:00 2001
From bc86221443f957b105efda2276e92204a1f0308e 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: shell32: Remove source files when using cut in the context menu.
Subject: [PATCH] shell32: Remove source files when using cut in the context
menu.
---
dlls/shell32/shlview_cmenu.c | 75 +++++++++++++++++++++++++++++++++++++++++---
dlls/shell32/shlview_cmenu.c | 75 ++++++++++++++++++++++++++++++++++--
1 file changed, 71 insertions(+), 4 deletions(-)
diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c
index 494d95b..c32a4e8 100644
index d15a144870d..3dce4a1fbac 100644
--- a/dlls/shell32/shlview_cmenu.c
+++ b/dlls/shell32/shlview_cmenu.c
@@ -281,6 +281,64 @@ static void DoDelete(ContextMenu *This)
@@ -333,6 +333,64 @@ static void DoDelete(ContextMenu *This)
}
}
/**************************************************************************
+/**************************************************************************
+ * SetDropEffect
+ *
+ * Set the drop effect in a IDataObject object
@ -72,11 +74,10 @@ index 494d95b..c32a4e8 100644
+ }
+}
+
+/**************************************************************************
/**************************************************************************
* DoCopyOrCut
*
* copies the currently selected items into the clipboard
@@ -293,6 +351,7 @@ static void DoCopyOrCut(ContextMenu *This, HWND hwnd, BOOL cut)
@@ -346,6 +404,7 @@ static void DoCopyOrCut(ContextMenu *This, HWND hwnd, BOOL cut)
if (SUCCEEDED(IShellFolder_GetUIObjectOf(This->parent, hwnd, This->cidl, (LPCITEMIDLIST*)This->apidl, &IID_IDataObject, 0, (void**)&dataobject)))
{
@ -84,30 +85,31 @@ index 494d95b..c32a4e8 100644
OleSetClipboard(dataobject);
IDataObject_Release(dataobject);
}
@@ -818,11 +877,19 @@ static BOOL DoPaste(ContextMenu *This)
/* do the copy/move */
if (psfhlpdst && psfhlpsrc)
{
+ DWORD dropEffect;
+ GetDropEffect(pda, &dropEffect);
@@ -1233,12 +1292,20 @@ static BOOL DoPaste(ContextMenu *This)
/* do the copy/move */
if (psfhlpdst && psfhlpsrc)
{
+ DWORD dropEffect;
+ GetDropEffect(pda, &dropEffect);
+
if (SUCCEEDED(ISFHelper_CopyItems(psfhlpdst, psfFrom, lpcida->cidl, (LPCITEMIDLIST*)apidl)))
- bSuccess = TRUE;
- /* FIXME handle move
- ISFHelper_DeleteItems(psfhlpsrc, lpcida->cidl, apidl);
- */
+ {
+ if (dropEffect == DROPEFFECT_MOVE)
+ {
+ if (SUCCEEDED(ISFHelper_DeleteItems(psfhlpsrc, lpcida->cidl, (LPCITEMIDLIST*)apidl, FALSE)))
+ bSuccess = TRUE;
+ }
+ else
+ bSuccess = TRUE;
+ }
}
if(psfhlpdst) ISFHelper_Release(psfhlpdst);
if(psfhlpsrc) ISFHelper_Release(psfhlpsrc);
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);
- */
}
if(psfhlpdst) ISFHelper_Release(psfhlpdst);
if(psfhlpsrc) ISFHelper_Release(psfhlpsrc);
--
2.7.1
2.30.2

View File

@ -1,19 +1,19 @@
From 47c24300c6530de5dfe32f352ef839e62ebbd520 Mon Sep 17 00:00:00 2001
From 295de3efbdb815a703e77c391ee1f3038987495b 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:41:56 +0200
Subject: shell32: Recognize cut/copy/paste string verbs in item menu context
menu.
Subject: [PATCH] shell32: Recognize cut/copy/paste string verbs in item menu
context menu.
---
dlls/shell32/shlview_cmenu.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c
index c32a4e8..cfe88d5 100644
index 3dce4a1fbac..8265993385f 100644
--- a/dlls/shell32/shlview_cmenu.c
+++ b/dlls/shell32/shlview_cmenu.c
@@ -554,6 +554,12 @@ static HRESULT WINAPI ItemMenu_InvokeCommand(
DoDelete(This);
@@ -925,6 +925,12 @@ static HRESULT WINAPI ItemMenu_InvokeCommand(
DoCopyOrCut(This, lpcmi->hwnd, TRUE);
else if (strcmp(lpcmi->lpVerb,"properties")==0)
DoOpenProperties(This, lpcmi->hwnd);
+ else if (strcmp(lpcmi->lpVerb,"cut")==0)
@ -26,5 +26,5 @@ index c32a4e8..cfe88d5 100644
FIXME("Unhandled string verb %s\n",debugstr_a(lpcmi->lpVerb));
return E_FAIL;
--
2.7.1
2.30.2

View File

@ -1,4 +1,4 @@
From d394cc092108c710ad2cccbcec1919a084037910 Mon Sep 17 00:00:00 2001
From 9c6c0fb4a36ccf59313dbf0eff887c41c1749eb5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 23 Mar 2021 10:42:07 +0100
Subject: [PATCH] server: Implement WM_INPUT / RIM_TYPEHID message dispatch.
@ -9,11 +9,11 @@ data after each RAWINPUT struct.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50506
---
dlls/user32/message.c | 1 +
dlls/user32/rawinput.c | 23 +++++++++++++++++++++--
dlls/user32/rawinput.c | 22 ++++++++++++++++++++--
server/protocol.def | 2 +-
server/queue.c | 25 ++++++++++++++++++-------
server/trace.c | 1 +
5 files changed, 42 insertions(+), 10 deletions(-)
5 files changed, 41 insertions(+), 10 deletions(-)
diff --git a/dlls/user32/message.c b/dlls/user32/message.c
index 54fcdc4588c..f986b71953a 100644
@ -28,10 +28,10 @@ index 54fcdc4588c..f986b71953a 100644
req->input.hw.data.rawinput.type = rawinput->header.dwType;
switch (rawinput->header.dwType)
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
index 99481ffae3d..c69393d9ed2 100644
index a43021ceac9..c40b685be50 100644
--- a/dlls/user32/rawinput.c
+++ b/dlls/user32/rawinput.c
@@ -326,6 +326,22 @@ BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_ms
@@ -373,6 +373,22 @@ BOOL rawinput_from_hardware_message(RAWINPUT *rawinput, const struct hardware_ms
rawinput->data.keyboard.Message = msg_data->rawinput.kbd.message;
rawinput->data.keyboard.ExtraInformation = msg_data->info;
}
@ -54,7 +54,7 @@ index 99481ffae3d..c69393d9ed2 100644
else
{
FIXME("Unhandled rawinput type %#x.\n", msg_data->rawinput.type);
@@ -524,7 +540,7 @@ UINT WINAPI DECLSPEC_HOTPATCH GetRawInputBuffer(RAWINPUT *data, UINT *data_size,
@@ -566,7 +582,7 @@ UINT WINAPI DECLSPEC_HOTPATCH GetRawInputBuffer(RAWINPUT *data, UINT *data_size,
struct hardware_msg_data *msg_data;
struct rawinput_thread_data *thread_data;
RAWINPUT *rawinput;
@ -63,7 +63,7 @@ index 99481ffae3d..c69393d9ed2 100644
BOOL is_wow64;
int i;
@@ -584,7 +600,9 @@ UINT WINAPI DECLSPEC_HOTPATCH GetRawInputBuffer(RAWINPUT *data, UINT *data_size,
@@ -626,7 +642,9 @@ UINT WINAPI DECLSPEC_HOTPATCH GetRawInputBuffer(RAWINPUT *data, UINT *data_size,
data->header.dwSize - sizeof(RAWINPUTHEADER));
data->header.dwSize += overhead;
data = NEXTRAWINPUTBLOCK(data);
@ -74,19 +74,11 @@ index 99481ffae3d..c69393d9ed2 100644
}
if (count == 0 && next_size == 0) *data_size = 0;
@@ -657,6 +675,7 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE handle, UINT command, void *data, UINT
handle, command, data, data_size);
if (!data_size) return ~0U;
+ if (!device) return ~0U;
/* each case below must set:
* *data_size: length (meaning defined by command) of data we want to copy
diff --git a/server/protocol.def b/server/protocol.def
index f97b966719c..829216b58c1 100644
index c9a0b53dfea..ce137caaea8 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -369,7 +369,7 @@ typedef union
@@ -358,7 +358,7 @@ typedef union
lparam_t lparam; /* message param */
union
{
@ -169,10 +161,10 @@ index 248157ca7da..a411d0af8d2 100644
free_message( msg );
diff --git a/server/trace.c b/server/trace.c
index 3d24cec0133..f50a0367683 100644
index c6bdbb1139c..30aa979a20e 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -471,6 +471,7 @@ static void dump_hw_input( const char *prefix, const hw_input_t *input )
@@ -456,6 +456,7 @@ static void dump_hw_input( const char *prefix, const hw_input_t *input )
dump_uint64( ",lparam=", &input->hw.lparam );
switch (input->hw.msg)
{

View File

@ -1,124 +0,0 @@
From 2e8dd5065ba659d6f5f5c5bedadbec4e06a98a6a Mon Sep 17 00:00:00 2001
From: Arkadiusz Hiler <ahiler@codeweavers.com>
Date: Tue, 23 Feb 2021 14:41:58 +0200
Subject: [PATCH] ntoskrnl: Implement IoSetDevicePropertyData().
---
dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 1 +
dlls/ntoskrnl.exe/pnp.c | 51 +++++++++++++++++++++++++++++
include/ddk/wdm.h | 4 +++
3 files changed, 56 insertions(+)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
index 2e5e2e6e11b..4eb08faec2e 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
+++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
@@ -465,6 +465,7 @@
@ stdcall IoReuseIrp(ptr long)
@ stub IoSetCompletionRoutineEx
@ stdcall IoSetDeviceInterfaceState(ptr long)
+@ stdcall IoSetDevicePropertyData(ptr ptr long long long long ptr)
@ stub IoSetDeviceToVerify
@ stub IoSetFileOrigin
@ stub IoSetHardErrorOrVerifyDevice
diff --git a/dlls/ntoskrnl.exe/pnp.c b/dlls/ntoskrnl.exe/pnp.c
index 7994a8b85b9..0d5d0d721d4 100644
--- a/dlls/ntoskrnl.exe/pnp.c
+++ b/dlls/ntoskrnl.exe/pnp.c
@@ -38,6 +38,12 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
WINE_DEFAULT_DEBUG_CHANNEL(plugplay);
+static inline const char *debugstr_propkey( const DEVPROPKEY *id )
+{
+ if (!id) return "(null)";
+ return wine_dbg_sprintf( "{%s,%04x}", wine_dbgstr_guid( &id->fmtid ), id->pid );
+}
+
#define MAX_SERVICE_NAME 260
struct device_interface
@@ -770,6 +776,51 @@ NTSTATUS WINAPI IoSetDeviceInterfaceState( UNICODE_STRING *name, BOOLEAN enable
return ret;
}
+/***********************************************************************
+ * IoSetDevicePropertyData (NTOSKRNL.EXE.@)
+ */
+NTSTATUS WINAPI IoSetDevicePropertyData( DEVICE_OBJECT *device, const DEVPROPKEY *property_key, LCID lcid,
+ ULONG flags, DEVPROPTYPE type, ULONG size, void *data )
+{
+ SP_DEVINFO_DATA sp_device = {sizeof(sp_device)};
+ WCHAR device_instance_id[MAX_DEVICE_ID_LEN];
+ NTSTATUS status;
+ HDEVINFO set;
+
+ TRACE( "device %p, property_key %s, lcid %#x, flags %#x, type %#x, size %u, data %p.\n",
+ device, debugstr_propkey(property_key), lcid, flags, type, size, data );
+
+ /* flags is always treated as PLUGPLAY_PROPERTY_PERSISTENT starting with Win 8 / 2012 */
+
+ if (lcid != LOCALE_NEUTRAL) FIXME( "only LOCALE_NEUTRAL is supported\n" );
+
+ if ((status = get_device_instance_id( device, device_instance_id ))) return status;
+
+ if ((set = SetupDiCreateDeviceInfoList( &GUID_NULL, NULL )) == INVALID_HANDLE_VALUE)
+ {
+ ERR( "Failed to create device list, error %#x.\n", GetLastError() );
+ return GetLastError();
+ }
+
+ if (!SetupDiOpenDeviceInfoW( set, device_instance_id, NULL, 0, &sp_device ))
+ {
+ ERR( "Failed to open device, error %#x.\n", GetLastError() );
+ SetupDiDestroyDeviceInfoList( set );
+ return GetLastError();
+ }
+
+ if (!SetupDiSetDevicePropertyW( set, &sp_device, property_key, type, data, size, 0 ))
+ {
+ ERR( "Failed to set property, error %#x.\n", GetLastError() );
+ SetupDiDestroyDeviceInfoList( set );
+ return GetLastError();
+ }
+
+ SetupDiDestroyDeviceInfoList( set );
+
+ return STATUS_SUCCESS;
+}
+
/***********************************************************************
* IoRegisterDeviceInterface (NTOSKRNL.EXE.@)
*/
diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h
index 3b9af7d52b2..3d0f810c2f0 100644
--- a/include/ddk/wdm.h
+++ b/include/ddk/wdm.h
@@ -21,6 +21,7 @@
#define _NTDDK_
#include <ntstatus.h>
+#include <devpropdef.h>
#ifdef _WIN64
#define POINTER_ALIGNMENT DECLSPEC_ALIGN(8)
@@ -1677,6 +1678,8 @@ void WINAPI ExReleaseResourceForThreadLite(ERESOURCE*,ERESOURCE_THREAD);
ULONG WINAPI ExSetTimerResolution(ULONG,BOOLEAN);
void WINAPI ExUnregisterCallback(void*);
+#define PLUGPLAY_PROPERTY_PERSISTENT 0x0001
+
void WINAPI IoAcquireCancelSpinLock(KIRQL*);
NTSTATUS WINAPI IoAcquireRemoveLockEx(IO_REMOVE_LOCK*,void*,const char*,ULONG, ULONG);
NTSTATUS WINAPI IoAllocateDriverObjectExtension(PDRIVER_OBJECT,PVOID,ULONG,PVOID*);
@@ -1724,6 +1727,7 @@ void WINAPI IoReleaseRemoveLockAndWaitEx(IO_REMOVE_LOCK*,void*,ULONG);
void WINAPI IoReleaseRemoveLockEx(IO_REMOVE_LOCK*,void*,ULONG);
void WINAPI IoReuseIrp(IRP*,NTSTATUS);
NTSTATUS WINAPI IoSetDeviceInterfaceState(UNICODE_STRING*,BOOLEAN);
+NTSTATUS WINAPI IoSetDevicePropertyData(DEVICE_OBJECT*,const DEVPROPKEY*,LCID,ULONG,DEVPROPTYPE,ULONG,void*);
NTSTATUS WINAPI IoWMIRegistrationControl(PDEVICE_OBJECT,ULONG);
void FASTCALL KeAcquireInStackQueuedSpinLockAtDpcLevel(KSPIN_LOCK*,KLOCK_QUEUE_HANDLE*);
--
2.30.2

View File

@ -1,51 +0,0 @@
From cce25a3d567e6afcff3ccf97c46f08b9d2dda42f Mon Sep 17 00:00:00 2001
From: Arkadiusz Hiler <ahiler@codeweavers.com>
Date: Wed, 10 Feb 2021 13:23:33 +0100
Subject: [PATCH] hidclass.sys: Assign rawinput handles through device
properties.
---
dlls/hidclass.sys/pnp.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c
index 5e50ee90c60..15f4c12cba5 100644
--- a/dlls/hidclass.sys/pnp.c
+++ b/dlls/hidclass.sys/pnp.c
@@ -26,6 +26,8 @@
#include "ntddkbd.h"
#include "ddk/hidtypes.h"
#include "ddk/wdm.h"
+#include "initguid.h"
+#include "devpkey.h"
#include "regstr.h"
#include "winuser.h"
#include "wine/debug.h"
@@ -88,6 +90,8 @@ static NTSTATUS get_device_id(DEVICE_OBJECT *device, BUS_QUERY_ID_TYPE type, WCH
return irp_status.u.Status;
}
+DEFINE_DEVPROPKEY(DEVPROPKEY_HID_HANDLE, 0xbc62e415, 0xf4fe, 0x405c, 0x8e, 0xda, 0x63, 0x6f, 0xb5, 0x9f, 0x08, 0x98, 2);
+
/* user32 reserves 1 & 2 for winemouse and winekeyboard,
* keep this in sync with user_private.h */
#define WINE_MOUSE_HANDLE 1
@@ -248,6 +252,15 @@ static void create_child(minidriver *minidriver, DEVICE_OBJECT *fdo)
else
pdo_ext->u.pdo.rawinput_handle = alloc_rawinput_handle();
+ status = IoSetDevicePropertyData(child_pdo, &DEVPROPKEY_HID_HANDLE, LOCALE_NEUTRAL,
+ PLUGPLAY_PROPERTY_PERSISTENT, DEVPROP_TYPE_UINT32,
+ sizeof(pdo_ext->u.pdo.rawinput_handle), &pdo_ext->u.pdo.rawinput_handle);
+ if (status != STATUS_SUCCESS)
+ {
+ FIXME("failed to set device property %x\n", status);
+ return;
+ }
+
pdo_ext->u.pdo.poll_interval = DEFAULT_POLL_INTERVAL;
pdo_ext->u.pdo.ring_buffer = RingBuffer_Create(
--
2.30.2

View File

@ -1,154 +0,0 @@
From 29aca5031e4237e55b1c3cfe591cd7f4af31fa9c Mon Sep 17 00:00:00 2001
From: Arkadiusz Hiler <ahiler@codeweavers.com>
Date: Mon, 22 Feb 2021 15:41:46 +0200
Subject: [PATCH] user32: Use device handles assigned by hidclass.sys.
This allows us to avoid racy handle mapping for messages from the WM_INPUT
family.
---
dlls/user32/rawinput.c | 61 +++++++++++++++++++++++++++++++++++-------
1 file changed, 51 insertions(+), 10 deletions(-)
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c
index 566a5844ad5..d42c2017e78 100644
--- a/dlls/user32/rawinput.c
+++ b/dlls/user32/rawinput.c
@@ -38,15 +38,19 @@
#include "user_private.h"
#include "initguid.h"
+#include "devpkey.h"
#include "ntddmou.h"
#include "ntddkbd.h"
WINE_DEFAULT_DEBUG_CHANNEL(rawinput);
+DEFINE_DEVPROPKEY(DEVPROPKEY_HID_HANDLE, 0xbc62e415, 0xf4fe, 0x405c, 0x8e, 0xda, 0x63, 0x6f, 0xb5, 0x9f, 0x08, 0x98, 2);
+
struct device
{
SP_DEVICE_INTERFACE_DETAIL_DATA_W *detail;
HANDLE file;
+ HANDLE handle;
RID_DEVICE_INFO info;
PHIDP_PREPARSED_DATA data;
};
@@ -92,10 +96,12 @@ static BOOL array_reserve(void **elements, unsigned int *capacity, unsigned int
static struct device *add_device(HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface)
{
+ SP_DEVINFO_DATA device_data = {sizeof(device_data)};
SP_DEVICE_INTERFACE_DETAIL_DATA_W *detail;
+ UINT32 handle;
struct device *device;
HANDLE file;
- DWORD size;
+ DWORD idx, size, type;
SetupDiGetDeviceInterfaceDetailW(set, iface, NULL, 0, &size, NULL);
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
@@ -109,7 +115,27 @@ static struct device *add_device(HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface)
return FALSE;
}
detail->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W);
- SetupDiGetDeviceInterfaceDetailW(set, iface, detail, size, NULL, NULL);
+ SetupDiGetDeviceInterfaceDetailW(set, iface, detail, size, NULL, &device_data);
+
+ if (!SetupDiGetDevicePropertyW(set, &device_data, &DEVPROPKEY_HID_HANDLE, &type, (BYTE *)&handle, sizeof(handle), NULL, 0))
+ {
+ ERR("Failed to get handle for %s, skipping HID device.\n", debugstr_w(detail->DevicePath));
+ heap_free(detail);
+ return NULL;
+ }
+
+ if (type != DEVPROP_TYPE_UINT32)
+ ERR("Wrong prop type for HANDLE.\n");
+
+ for (idx = 0; idx < rawinput_devices_count; ++idx)
+ {
+ if (rawinput_devices[idx].handle == ULongToHandle(handle))
+ {
+ TRACE("Discarding %s as it's a duplicate of %s.\n", debugstr_w(detail->DevicePath), debugstr_w(rawinput_devices[idx].detail->DevicePath));
+ heap_free(detail);
+ return NULL;
+ }
+ }
TRACE("Found HID device %s.\n", debugstr_w(detail->DevicePath));
@@ -135,6 +161,7 @@ static struct device *add_device(HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface)
device->detail = detail;
device->file = file;
device->info.cbSize = sizeof(RID_DEVICE_INFO);
+ device->handle = ULongToHandle(handle);
device->data = NULL;
return device;
@@ -142,8 +169,6 @@ static struct device *add_device(HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface)
static void find_devices(void)
{
- static ULONGLONG last_check;
-
SP_DEVICE_INTERFACE_DATA iface = { sizeof(iface) };
struct device *device;
HIDD_ATTRIBUTES attr;
@@ -152,10 +177,6 @@ static void find_devices(void)
HDEVINFO set;
DWORD idx;
- if (GetTickCount64() - last_check < 2000)
- return;
- last_check = GetTickCount64();
-
HidD_GetHidGuid(&hid_guid);
EnterCriticalSection(&rawinput_devices_cs);
@@ -247,6 +268,26 @@ static void find_devices(void)
}
+static struct device *rawinput_device_from_handle(HANDLE handle)
+{
+ unsigned int i;
+
+ if (!handle) return NULL;
+
+ for (i = 0; i < rawinput_devices_count; ++i)
+ if (rawinput_devices[i].handle == handle)
+ return &rawinput_devices[i];
+
+ find_devices();
+
+ for (i = 0; i < rawinput_devices_count; ++i)
+ if (rawinput_devices[i].handle == handle)
+ return &rawinput_devices[i];
+
+ return NULL;
+}
+
+
struct rawinput_thread_data *rawinput_thread_data(void)
{
struct user_thread_info *thread_info = get_user_thread_info();
@@ -420,7 +461,7 @@ UINT WINAPI GetRawInputDeviceList(RAWINPUTDEVICELIST *devices, UINT *device_coun
for (i = 0; i < rawinput_devices_count; ++i)
{
- devices[2 + i].hDevice = &rawinput_devices[i];
+ devices[2 + i].hDevice = rawinput_devices[i].handle;
devices[2 + i].dwType = rawinput_devices[i].info.dwType;
}
@@ -692,7 +733,7 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE handle, UINT command, void *data, UINT
static const RID_DEVICE_INFO_MOUSE mouse_info = {1, 5, 0, FALSE};
RID_DEVICE_INFO info;
- struct device *device = handle;
+ struct device *device = rawinput_device_from_handle(handle);
const void *to_copy;
UINT to_copy_bytes, avail_bytes;
--
2.30.2

View File

@ -1 +1 @@
2deb8c2825afcb88a9f106b73aa1f4da9253fb87
3ba4412be60dafee310b5d3c71aa762aa8846564