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
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
54 additions
and
85 deletions
+54
-85
device.c
dlls/hidclass.sys/device.c
+17
-18
pnp.c
dlls/hidclass.sys/pnp.c
+8
-15
message.c
dlls/win32u/message.c
+6
-35
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
...
@@ -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_report
*
last_report
,
*
report
;
struct
hid_queue
*
queue
;
struct
hid_queue
*
queue
;
LIST_ENTRY
completed
,
*
entry
;
LIST_ENTRY
completed
,
*
entry
;
RAWINPUT
*
rawinput
;
KIRQL
irql
;
KIRQL
irql
;
IRP
*
irp
;
IRP
*
irp
;
...
@@ -233,28 +232,28 @@ static void hid_device_queue_input( DEVICE_OBJECT *device, HID_XFER_PACKET *pack
...
@@ -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
))
if
(
IsEqualGUID
(
ext
->
class_guid
,
&
GUID_DEVINTERFACE_HID
))
{
{
size
=
offsetof
(
RAWINPUT
,
data
.
hid
.
bRawData
[
report_len
]
);
struct
hid_packet
*
hid
;
if
(
!
(
rawinput
=
malloc
(
size
)))
ERR
(
"Failed to allocate rawinput data!
\n
"
);
size
=
offsetof
(
struct
hid_packet
,
data
[
report_len
]
);
if
(
!
(
hid
=
malloc
(
size
)))
ERR
(
"Failed to allocate rawinput data!
\n
"
);
else
else
{
{
INPUT
input
;
INPUT
input
=
{.
type
=
INPUT_HARDWARE
};
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
.
hi
.
uMsg
=
WM_INPUT
;
input
.
hi
.
uMsg
=
WM_INPUT
;
input
.
hi
.
wParamH
=
0
;
input
.
hi
.
wParamH
=
HIWORD
(
RIM_INPUT
);
input
.
hi
.
wParamL
=
0
;
input
.
hi
.
wParamL
=
LOWORD
(
RIM_INPUT
);
NtUserSendHardwareInput
(
0
,
0
,
&
input
,
(
LPARAM
)
rawinput
);
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
...
@@ -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
)
static
void
send_wm_input_device_change
(
BASE_DEVICE_EXTENSION
*
ext
,
LPARAM
param
)
{
{
HIDP_COLLECTION_DESC
*
desc
=
ext
->
u
.
pdo
.
device_desc
.
CollectionDesc
;
HIDP_COLLECTION_DESC
*
desc
=
ext
->
u
.
pdo
.
device_desc
.
CollectionDesc
;
RAWINPUT
rawinput
;
INPUT
input
=
{.
type
=
INPUT_HARDWARE
}
;
INPUT
input
;
struct
hid_packet
hid
=
{
0
}
;
TRACE
(
"ext %p, lparam %p
\n
"
,
ext
,
(
void
*
)
param
);
TRACE
(
"ext %p, lparam %p
\n
"
,
ext
,
(
void
*
)
param
);
if
(
!
IsEqualGUID
(
ext
->
class_guid
,
&
GUID_DEVINTERFACE_HID
))
return
;
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
.
uMsg
=
WM_INPUT_DEVICE_CHANGE
;
input
.
hi
.
wParamH
=
0
;
input
.
hi
.
wParamH
=
HIWORD
(
param
);
input
.
hi
.
wParamL
=
0
;
input
.
hi
.
wParamL
=
LOWORD
(
param
);
NtUserSendHardwareInput
(
0
,
0
,
&
input
,
(
LPARAM
)
&
rawinput
);
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
)
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
...
@@ -3486,7 +3486,6 @@ NTSTATUS send_hardware_message( HWND hwnd, UINT flags, const INPUT *input, LPARA
{
{
struct
send_message_info
info
;
struct
send_message_info
info
;
int
prev_x
,
prev_y
,
new_x
,
new_y
;
int
prev_x
,
prev_y
,
new_x
,
new_y
;
USAGE
hid_usage_page
,
hid_usage
;
NTSTATUS
ret
;
NTSTATUS
ret
;
BOOL
wait
,
affects_key_state
=
FALSE
;
BOOL
wait
,
affects_key_state
=
FALSE
;
...
@@ -3500,25 +3499,6 @@ NTSTATUS send_hardware_message( HWND hwnd, UINT flags, const INPUT *input, LPARA
...
@@ -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
)))
if
(
input
->
type
==
INPUT_MOUSE
&&
(
input
->
mi
.
dwFlags
&
(
MOUSEEVENTF_LEFTDOWN
|
MOUSEEVENTF_RIGHTDOWN
)))
clip_fullscreen_window
(
hwnd
,
FALSE
);
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
)
SERVER_START_REQ
(
send_hardware_message
)
{
{
req
->
win
=
wine_server_user_handle
(
hwnd
);
req
->
win
=
wine_server_user_handle
(
hwnd
);
...
@@ -3548,30 +3528,21 @@ NTSTATUS send_hardware_message( HWND hwnd, UINT flags, const INPUT *input, LPARA
...
@@ -3548,30 +3528,21 @@ NTSTATUS send_hardware_message( HWND hwnd, UINT flags, const INPUT *input, LPARA
break
;
break
;
case
INPUT_HARDWARE
:
case
INPUT_HARDWARE
:
req
->
input
.
hw
.
msg
=
input
->
hi
.
uMsg
;
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
)
switch
(
input
->
hi
.
uMsg
)
{
{
case
WM_INPUT
:
case
WM_INPUT
:
case
WM_INPUT_DEVICE_CHANGE
:
case
WM_INPUT_DEVICE_CHANGE
:
{
{
const
RAWINPUT
*
rawinput
=
(
const
RAWINPUT
*
)
lparam
;
struct
hid_packet
*
hid
=
(
struct
hid_packet
*
)
lparam
;
switch
(
rawinput
->
header
.
dwType
)
req
->
input
.
hw
.
hid
=
hid
->
head
;
{
wine_server_add_data
(
req
,
hid
->
data
,
hid
->
head
.
count
*
hid
->
head
.
length
);
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
;
break
;
}
default:
default:
assert
(
0
)
;
req
->
input
.
hw
.
lparam
=
lparam
;
break
;
break
;
}
}
}
}
break
;
break
;
}
}
ret
=
wine_server_call
(
req
);
ret
=
wine_server_call
(
req
);
...
...
include/ntuser.h
View file @
bb5f0e12
...
@@ -1407,11 +1407,27 @@ static inline BOOL NtUserShowOwnedPopups( HWND hwnd, BOOL show )
...
@@ -1407,11 +1407,27 @@ static inline BOOL NtUserShowOwnedPopups( HWND hwnd, BOOL show )
return
NtUserCallHwndParam
(
hwnd
,
show
,
NtUserCallHwndParam_ShowOwnedPopups
);
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
struct
send_hardware_input_params
{
{
UINT
flags
;
UINT
flags
;
const
INPUT
*
input
;
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
)
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 @@
...
@@ -14,6 +14,7 @@
#include <windef.h>
#include <windef.h>
#include <winbase.h>
#include <winbase.h>
#include <ntuser.h>
typedef
unsigned
int
obj_handle_t
;
typedef
unsigned
int
obj_handle_t
;
typedef
unsigned
int
user_handle_t
;
typedef
unsigned
int
user_handle_t
;
...
@@ -325,13 +326,7 @@ typedef union
...
@@ -325,13 +326,7 @@ typedef union
unsigned
int
msg
;
unsigned
int
msg
;
lparam_t
wparam
;
lparam_t
wparam
;
lparam_t
lparam
;
lparam_t
lparam
;
struct
struct
hid_input
hid
;
{
unsigned
int
device
;
unsigned
int
usage
;
unsigned
int
count
;
unsigned
int
length
;
}
hid
;
}
hw
;
}
hw
;
}
hw_input_t
;
}
hw_input_t
;
...
@@ -6507,7 +6502,7 @@ union generic_reply
...
@@ -6507,7 +6502,7 @@ union generic_reply
/* ### protocol_version begin ### */
/* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 79
4
#define SERVER_PROTOCOL_VERSION 79
5
/* ### protocol_version end ### */
/* ### protocol_version end ### */
...
...
server/protocol.def
View file @
bb5f0e12
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
#include <windef.h>
#include <windef.h>
#include <winbase.h>
#include <winbase.h>
#include <ntuser.h>
typedef unsigned int obj_handle_t;
typedef unsigned int obj_handle_t;
typedef unsigned int user_handle_t;
typedef unsigned int user_handle_t;
...
@@ -341,13 +342,7 @@ typedef union
...
@@ -341,13 +342,7 @@ typedef union
unsigned int msg; /* message code */
unsigned int msg; /* message code */
lparam_t wparam; /* parameters */
lparam_t wparam; /* parameters */
lparam_t lparam; /* parameters */
lparam_t lparam; /* parameters */
struct
struct hid_input hid; /* defined in ntuser.h */
{
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;
} hw;
} hw;
} hw_input_t;
} hw_input_t;
...
...
server/queue.c
View file @
bb5f0e12
...
@@ -2250,7 +2250,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
...
@@ -2250,7 +2250,7 @@ static void queue_custom_hardware_message( struct desktop *desktop, user_handle_
msg
->
win
=
get_user_full_handle
(
win
);
msg
->
win
=
get_user_full_handle
(
win
);
msg
->
msg
=
input
->
hw
.
msg
;
msg
->
msg
=
input
->
hw
.
msg
;
msg
->
wparam
=
0
;
msg
->
wparam
=
input
->
hw
.
wparam
;
msg
->
lparam
=
input
->
hw
.
lparam
;
msg
->
lparam
=
input
->
hw
.
lparam
;
msg
->
x
=
desktop
->
cursor
.
x
;
msg
->
x
=
desktop
->
cursor
.
x
;
msg
->
y
=
desktop
->
cursor
.
y
;
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