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
4c584fe7
Commit
4c584fe7
authored
Jul 26, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Jul 27, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32u: Read rawinput device preparsed data using virtual memory.
parent
689826a0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
9 deletions
+24
-9
joystick8.c
dlls/dinput/tests/joystick8.c
+6
-6
rawinput.c
dlls/win32u/rawinput.c
+18
-3
No files found.
dlls/dinput/tests/joystick8.c
View file @
4c584fe7
...
...
@@ -4308,7 +4308,12 @@ static void test_rawinput(void)
count
=
ARRAY_SIZE
(
raw_device_list
);
res
=
GetRawInputDeviceList
(
raw_device_list
,
&
count
,
sizeof
(
RAWINPUTDEVICELIST
)
);
todo_wine
if
(
!
strcmp
(
winetest_platform
,
"wine"
)
&&
res
==
device_count
)
{
/* Wine refreshes its device list every 2s, but GetRawInputDeviceInfoW with an unknown handle will force it */
GetRawInputDeviceInfoW
(
(
HANDLE
)
0xdeadbeef
,
RIDI_DEVICEINFO
,
NULL
,
&
count
);
res
=
GetRawInputDeviceList
(
raw_device_list
,
&
count
,
sizeof
(
RAWINPUTDEVICELIST
)
);
}
ok
(
res
==
device_count
+
1
,
"GetRawInputDeviceList returned %lu
\n
"
,
res
);
ok
(
count
==
ARRAY_SIZE
(
raw_device_list
),
"got count %u
\n
"
,
count
);
device_count
=
res
;
...
...
@@ -4326,9 +4331,7 @@ static void test_rawinput(void)
if
(
wcsstr
(
path
,
expect_vidpid_str
))
break
;
}
todo_wine
ok
(
!!
wcsstr
(
path
,
expect_vidpid_str
),
"got path %s
\n
"
,
debugstr_w
(
path
)
);
if
(
!
wcsstr
(
path
,
expect_vidpid_str
))
goto
done
;
file
=
CreateFileW
(
path
,
FILE_READ_ACCESS
|
FILE_WRITE_ACCESS
,
...
...
@@ -4346,12 +4349,9 @@ static void test_rawinput(void)
while
(
PeekMessageW
(
&
msg
,
hwnd
,
0
,
0
,
PM_REMOVE
))
DispatchMessageW
(
&
msg
);
ok
(
!
wm_input_device_change_count
,
"got %u WM_INPUT_DEVICE_CHANGE
\n
"
,
wm_input_device_change_count
);
todo_wine
ok
(
wm_input_count
==
1
,
"got %u WM_INPUT
\n
"
,
wm_input_count
);
todo_wine
ok
(
wm_input_len
==
offsetof
(
RAWINPUT
,
data
.
hid
.
bRawData
[
desc
.
caps
.
InputReportByteLength
]),
"got wm_input_len %u
\n
"
,
wm_input_len
);
todo_wine
ok
(
!
memcmp
(
rawinput
->
data
.
hid
.
bRawData
,
injected_input
[
i
].
report_buf
,
desc
.
caps
.
InputReportByteLength
),
"got unexpected report data
\n
"
);
wm_input_count
=
0
;
...
...
dlls/win32u/rawinput.c
View file @
4c584fe7
...
...
@@ -253,6 +253,8 @@ static struct device *add_device( HKEY key, DWORD type )
NTSTATUS
status
;
unsigned
int
i
;
UINT32
handle
;
void
*
buffer
;
SIZE_T
size
;
HANDLE
file
;
if
(
!
query_reg_value
(
key
,
symbolic_linkW
,
value
,
sizeof
(
value_buffer
)
))
...
...
@@ -327,9 +329,22 @@ static struct device *add_device( HKEY key, DWORD type )
goto
fail
;
}
status
=
NtDeviceIoControlFile
(
file
,
NULL
,
NULL
,
NULL
,
&
io
,
IOCTL_HID_GET_COLLECTION_DESCRIPTOR
,
NULL
,
0
,
preparsed
,
hid_info
.
DescriptorSize
);
/* NtDeviceIoControlFile checks that the output buffer is writable using ntdll virtual
* memory protection information, we need an NtAllocateVirtualMemory allocated buffer.
*/
buffer
=
NULL
;
size
=
hid_info
.
DescriptorSize
;
if
(
!
(
status
=
NtAllocateVirtualMemory
(
GetCurrentProcess
(),
&
buffer
,
0
,
&
size
,
MEM_RESERVE
|
MEM_COMMIT
,
PAGE_READWRITE
)))
{
size
=
0
;
status
=
NtDeviceIoControlFile
(
file
,
NULL
,
NULL
,
NULL
,
&
io
,
IOCTL_HID_GET_COLLECTION_DESCRIPTOR
,
NULL
,
0
,
buffer
,
hid_info
.
DescriptorSize
);
if
(
!
status
)
memcpy
(
preparsed
,
buffer
,
hid_info
.
DescriptorSize
);
NtFreeVirtualMemory
(
GetCurrentProcess
(),
&
buffer
,
&
size
,
MEM_RELEASE
);
}
if
(
status
)
{
ERR
(
"Failed to get collection descriptor, status %#x.
\n
"
,
status
);
...
...
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