Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
bb5f0e12
Commit
bb5f0e12
authored
Jan 28, 2024
by
Rémi Bernon
Committed by
Alexandre Julliard
Mar 05, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32u: Use a custom struct hid_input for NtUserSendHardwareInput.
parent
66baee8b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
57 additions
and
88 deletions
+57
-88
device.c
dlls/hidclass.sys/device.c
+18
-19
pnp.c
dlls/hidclass.sys/pnp.c
+8
-15
message.c
dlls/win32u/message.c
+8
-37
ntuser.h
include/ntuser.h
+17
-1
server_protocol.h
include/wine/server_protocol.h
+3
-8
protocol.def
server/protocol.def
+2
-7
queue.c
server/queue.c
+1
-1
No files found.
dlls/hidclass.sys/device.c
View file @
bb5f0e12
...
...
@@ -225,7 +225,6 @@ static void hid_device_queue_input( DEVICE_OBJECT *device, HID_XFER_PACKET *pack
struct
hid_report
*
last_report
,
*
report
;
struct
hid_queue
*
queue
;
LIST_ENTRY
completed
,
*
entry
;
RAWINPUT
*
rawinput
;
KIRQL
irql
;
IRP
*
irp
;
...
...
@@ -233,28 +232,28 @@ static void hid_device_queue_input( DEVICE_OBJECT *device, HID_XFER_PACKET *pack
if
(
IsEqualGUID
(
ext
->
class_guid
,
&
GUID_DEVINTERFACE_HID
))
{
size
=
offsetof
(
RAWINPUT
,
data
.
hid
.
bRawData
[
report_len
]
);
if
(
!
(
rawinput
=
malloc
(
size
)))
ERR
(
"Failed to allocate rawinput data!
\n
"
);
struct
hid_packet
*
hid
;
size
=
offsetof
(
struct
hid_packet
,
data
[
report_len
]
);
if
(
!
(
hid
=
malloc
(
size
)))
ERR
(
"Failed to allocate rawinput data!
\n
"
);
else
{
INPUT
input
;
rawinput
->
header
.
dwType
=
RIM_TYPEHID
;
rawinput
->
header
.
dwSize
=
size
;
rawinput
->
header
.
hDevice
=
ULongToHandle
(
ext
->
u
.
pdo
.
rawinput_handle
);
rawinput
->
header
.
wParam
=
RIM_INPUT
;
rawinput
->
data
.
hid
.
dwCount
=
1
;
rawinput
->
data
.
hid
.
dwSizeHid
=
report_len
;
memcpy
(
rawinput
->
data
.
hid
.
bRawData
,
packet
->
reportBuffer
,
packet
->
reportBufferLen
);
memset
(
rawinput
->
data
.
hid
.
bRawData
+
packet
->
reportBufferLen
,
0
,
report_len
-
packet
->
reportBufferLen
);
input
.
type
=
INPUT_HARDWARE
;
INPUT
input
=
{.
type
=
INPUT_HARDWARE
};
input
.
hi
.
uMsg
=
WM_INPUT
;
input
.
hi
.
wParamH
=
0
;
input
.
hi
.
wParamL
=
0
;
NtUserSendHardwareInput
(
0
,
0
,
&
input
,
(
LPARAM
)
rawinput
);
input
.
hi
.
wParamH
=
HIWORD
(
RIM_INPUT
);
input
.
hi
.
wParamL
=
LOWORD
(
RIM_INPUT
);
hid
->
head
.
device
=
ext
->
u
.
pdo
.
rawinput_handle
;
hid
->
head
.
usage
=
MAKELONG
(
desc
->
Usage
,
desc
->
UsagePage
);
hid
->
head
.
count
=
1
;
hid
->
head
.
length
=
report_len
;
memcpy
(
hid
->
data
,
packet
->
reportBuffer
,
packet
->
reportBufferLen
);
memset
(
hid
->
data
+
packet
->
reportBufferLen
,
0
,
report_len
-
packet
->
reportBufferLen
);
NtUserSendHardwareInput
(
0
,
0
,
&
input
,
(
LPARAM
)
hid
);
free
(
rawinput
);
free
(
hid
);
}
}
...
...
dlls/hidclass.sys/pnp.c
View file @
bb5f0e12
...
...
@@ -114,27 +114,20 @@ C_ASSERT(offsetof(RAWINPUT, data.hid.bRawData[2 * sizeof(USAGE)]) < sizeof(RAWIN
static
void
send_wm_input_device_change
(
BASE_DEVICE_EXTENSION
*
ext
,
LPARAM
param
)
{
HIDP_COLLECTION_DESC
*
desc
=
ext
->
u
.
pdo
.
device_desc
.
CollectionDesc
;
RAWINPUT
rawinput
;
INPUT
input
;
INPUT
input
=
{.
type
=
INPUT_HARDWARE
}
;
struct
hid_packet
hid
=
{
0
}
;
TRACE
(
"ext %p, lparam %p
\n
"
,
ext
,
(
void
*
)
param
);
if
(
!
IsEqualGUID
(
ext
->
class_guid
,
&
GUID_DEVINTERFACE_HID
))
return
;
rawinput
.
header
.
dwType
=
RIM_TYPEHID
;
rawinput
.
header
.
dwSize
=
offsetof
(
RAWINPUT
,
data
.
hid
.
bRawData
[
2
*
sizeof
(
USAGE
)]);
rawinput
.
header
.
hDevice
=
ULongToHandle
(
ext
->
u
.
pdo
.
rawinput_handle
);
rawinput
.
header
.
wParam
=
param
;
rawinput
.
data
.
hid
.
dwCount
=
0
;
rawinput
.
data
.
hid
.
dwSizeHid
=
0
;
((
USAGE
*
)
rawinput
.
data
.
hid
.
bRawData
)[
0
]
=
desc
->
UsagePage
;
((
USAGE
*
)
rawinput
.
data
.
hid
.
bRawData
)[
1
]
=
desc
->
Usage
;
input
.
type
=
INPUT_HARDWARE
;
input
.
hi
.
uMsg
=
WM_INPUT_DEVICE_CHANGE
;
input
.
hi
.
wParamH
=
0
;
input
.
hi
.
wParamL
=
0
;
NtUserSendHardwareInput
(
0
,
0
,
&
input
,
(
LPARAM
)
&
rawinput
);
input
.
hi
.
wParamH
=
HIWORD
(
param
);
input
.
hi
.
wParamL
=
LOWORD
(
param
);
hid
.
head
.
device
=
ext
->
u
.
pdo
.
rawinput_handle
;
hid
.
head
.
usage
=
MAKELONG
(
desc
->
Usage
,
desc
->
UsagePage
);
NtUserSendHardwareInput
(
0
,
0
,
&
input
,
(
LPARAM
)
&
hid
);
}
static
NTSTATUS
WINAPI
driver_add_device
(
DRIVER_OBJECT
*
driver
,
DEVICE_OBJECT
*
bus_pdo
)
...
...
dlls/win32u/message.c
View file @
bb5f0e12
...
...
@@ -3486,7 +3486,6 @@ NTSTATUS send_hardware_message( HWND hwnd, UINT flags, const INPUT *input, LPARA
{
struct
send_message_info
info
;
int
prev_x
,
prev_y
,
new_x
,
new_y
;
USAGE
hid_usage_page
,
hid_usage
;
NTSTATUS
ret
;
BOOL
wait
,
affects_key_state
=
FALSE
;
...
...
@@ -3500,25 +3499,6 @@ NTSTATUS send_hardware_message( HWND hwnd, UINT flags, const INPUT *input, LPARA
if
(
input
->
type
==
INPUT_MOUSE
&&
(
input
->
mi
.
dwFlags
&
(
MOUSEEVENTF_LEFTDOWN
|
MOUSEEVENTF_RIGHTDOWN
)))
clip_fullscreen_window
(
hwnd
,
FALSE
);
if
(
input
->
type
==
INPUT_HARDWARE
)
{
if
(
input
->
hi
.
uMsg
==
WM_INPUT_DEVICE_CHANGE
)
{
const
RAWINPUT
*
rawinput
=
(
const
RAWINPUT
*
)
lparam
;
hid_usage_page
=
((
USAGE
*
)
rawinput
->
data
.
hid
.
bRawData
)[
0
];
hid_usage
=
((
USAGE
*
)
rawinput
->
data
.
hid
.
bRawData
)[
1
];
}
if
(
input
->
hi
.
uMsg
==
WM_INPUT
)
{
const
RAWINPUT
*
rawinput
=
(
const
RAWINPUT
*
)
lparam
;
if
(
!
rawinput_device_get_usages
(
rawinput
->
header
.
hDevice
,
&
hid_usage_page
,
&
hid_usage
))
{
WARN
(
"unable to get HID usages for device %p
\n
"
,
rawinput
->
header
.
hDevice
);
return
STATUS_INVALID_HANDLE
;
}
}
}
SERVER_START_REQ
(
send_hardware_message
)
{
req
->
win
=
wine_server_user_handle
(
hwnd
);
...
...
@@ -3548,29 +3528,20 @@ NTSTATUS send_hardware_message( HWND hwnd, UINT flags, const INPUT *input, LPARA
break
;
case
INPUT_HARDWARE
:
req
->
input
.
hw
.
msg
=
input
->
hi
.
uMsg
;
req
->
input
.
hw
.
l
param
=
MAKELONG
(
input
->
hi
.
wParamL
,
input
->
hi
.
wParamH
);
req
->
input
.
hw
.
w
param
=
MAKELONG
(
input
->
hi
.
wParamL
,
input
->
hi
.
wParamH
);
switch
(
input
->
hi
.
uMsg
)
{
case
WM_INPUT
:
case
WM_INPUT_DEVICE_CHANGE
:
{
const
RAWINPUT
*
rawinput
=
(
const
RAWINPUT
*
)
lparam
;
switch
(
rawinput
->
header
.
dwType
)
{
case
RIM_TYPEHID
:
req
->
input
.
hw
.
wparam
=
rawinput
->
header
.
wParam
;
req
->
input
.
hw
.
hid
.
device
=
HandleToUlong
(
rawinput
->
header
.
hDevice
);
req
->
input
.
hw
.
hid
.
usage
=
MAKELONG
(
hid_usage
,
hid_usage_page
);
req
->
input
.
hw
.
hid
.
count
=
rawinput
->
data
.
hid
.
dwCount
;
req
->
input
.
hw
.
hid
.
length
=
rawinput
->
data
.
hid
.
dwSizeHid
;
wine_server_add_data
(
req
,
rawinput
->
data
.
hid
.
bRawData
,
rawinput
->
data
.
hid
.
dwCount
*
rawinput
->
data
.
hid
.
dwSizeHid
);
break
;
default:
assert
(
0
);
break
;
}
struct
hid_packet
*
hid
=
(
struct
hid_packet
*
)
lparam
;
req
->
input
.
hw
.
hid
=
hid
->
head
;
wine_server_add_data
(
req
,
hid
->
data
,
hid
->
head
.
count
*
hid
->
head
.
length
);
break
;
}
default:
req
->
input
.
hw
.
lparam
=
lparam
;
break
;
}
break
;
}
...
...
include/ntuser.h
View file @
bb5f0e12
...
...
@@ -1407,11 +1407,27 @@ static inline BOOL NtUserShowOwnedPopups( HWND hwnd, BOOL show )
return
NtUserCallHwndParam
(
hwnd
,
show
,
NtUserCallHwndParam_ShowOwnedPopups
);
}
struct
hid_input
{
UINT
device
;
UINT
usage
;
UINT
count
;
UINT
length
;
};
struct
hid_packet
{
struct
hid_input
head
;
BYTE
data
[];
};
C_ASSERT
(
sizeof
(
struct
hid_packet
)
==
offsetof
(
struct
hid_packet
,
data
[
0
]));
struct
send_hardware_input_params
{
UINT
flags
;
const
INPUT
*
input
;
LPARAM
lparam
;
/*
RAWINPUT
pointer for WM_INPUT* messages */
LPARAM
lparam
;
/*
struct hid_packet
pointer for WM_INPUT* messages */
};
static
inline
BOOL
NtUserSendHardwareInput
(
HWND
hwnd
,
UINT
flags
,
const
INPUT
*
input
,
LPARAM
lparam
)
...
...
include/wine/server_protocol.h
View file @
bb5f0e12
...
...
@@ -14,6 +14,7 @@
#include <windef.h>
#include <winbase.h>
#include <ntuser.h>
typedef
unsigned
int
obj_handle_t
;
typedef
unsigned
int
user_handle_t
;
...
...
@@ -325,13 +326,7 @@ typedef union
unsigned
int
msg
;
lparam_t
wparam
;
lparam_t
lparam
;
struct
{
unsigned
int
device
;
unsigned
int
usage
;
unsigned
int
count
;
unsigned
int
length
;
}
hid
;
struct
hid_input
hid
;
}
hw
;
}
hw_input_t
;
...
...
@@ -6507,7 +6502,7 @@ union generic_reply
/* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 79
4
#define SERVER_PROTOCOL_VERSION 79
5
/* ### protocol_version end ### */
...
...
server/protocol.def
View file @
bb5f0e12
...
...
@@ -30,6 +30,7 @@
#include <windef.h>
#include <winbase.h>
#include <ntuser.h>
typedef unsigned int obj_handle_t;
typedef unsigned int user_handle_t;
...
...
@@ -341,13 +342,7 @@ typedef union
unsigned int msg; /* message code */
lparam_t wparam; /* parameters */
lparam_t lparam; /* parameters */
struct
{
unsigned int device; /* rawinput device index */
unsigned int usage; /* HID device usage */
unsigned int count; /* HID report count */
unsigned int length; /* HID report length */
} hid;
struct hid_input hid; /* defined in ntuser.h */
} hw;
} hw_input_t;
...
...
server/queue.c
View file @
bb5f0e12
...
...
@@ -2250,7 +2250,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
msg
->
win
=
get_user_full_handle
(
win
);
msg
->
msg
=
input
->
hw
.
msg
;
msg
->
wparam
=
0
;
msg
->
wparam
=
input
->
hw
.
wparam
;
msg
->
lparam
=
input
->
hw
.
lparam
;
msg
->
x
=
desktop
->
cursor
.
x
;
msg
->
y
=
desktop
->
cursor
.
y
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment