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
6a0eb7a5
Commit
6a0eb7a5
authored
May 04, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
May 04, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Set last error codes on GetRawInputDeviceInfoW failure.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
964bf968
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
2 deletions
+51
-2
rawinput.c
dlls/user32/rawinput.c
+14
-2
input.c
dlls/user32/tests/input.c
+37
-0
No files found.
dlls/user32/rawinput.c
View file @
6a0eb7a5
...
...
@@ -696,8 +696,16 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE handle, UINT command, void *data, UINT
TRACE
(
"handle %p, command %#x, data %p, data_size %p.
\n
"
,
handle
,
command
,
data
,
data_size
);
if
(
!
data_size
)
return
~
0U
;
if
(
!
(
device
=
find_device_from_handle
(
handle
)))
return
~
0U
;
if
(
!
data_size
)
{
SetLastError
(
ERROR_NOACCESS
);
return
~
0U
;
}
if
(
!
(
device
=
find_device_from_handle
(
handle
)))
{
SetLastError
(
ERROR_INVALID_HANDLE
);
return
~
0U
;
}
/* each case below must set:
* *data_size: length (meaning defined by command) of data we want to copy
...
...
@@ -769,6 +777,7 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE handle, UINT command, void *data, UINT
default:
FIXME
(
"command %#x not supported
\n
"
,
command
);
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
~
0U
;
}
...
...
@@ -776,7 +785,10 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE handle, UINT command, void *data, UINT
return
0
;
if
(
avail_bytes
<
to_copy_bytes
)
{
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
return
~
0U
;
}
memcpy
(
data
,
to_copy
,
to_copy_bytes
);
...
...
dlls/user32/tests/input.c
View file @
6a0eb7a5
...
...
@@ -1834,6 +1834,43 @@ static void test_GetRawInputDeviceList(void)
ret
=
pGetRawInputDeviceList
(
devices
,
&
devcount
,
sizeof
(
devices
[
0
]));
ok
(
ret
>
0
,
"expected non-zero
\n
"
);
if
(
devcount
)
{
RID_DEVICE_INFO
info
;
UINT
size
;
SetLastError
(
0xdeadbeef
);
ret
=
pGetRawInputDeviceInfoW
(
UlongToHandle
(
0xdeadbeef
),
RIDI_DEVICEINFO
,
NULL
,
NULL
);
ok
(
ret
==
~
0U
,
"GetRawInputDeviceInfoW returned %#x, expected ~0.
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_NOACCESS
,
"GetRawInputDeviceInfoW last error %#x, expected 0xdeadbeef.
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
size
=
0xdeadbeef
;
ret
=
pGetRawInputDeviceInfoW
(
UlongToHandle
(
0xdeadbeef
),
RIDI_DEVICEINFO
,
NULL
,
&
size
);
ok
(
ret
==
~
0U
,
"GetRawInputDeviceInfoW returned %#x, expected ~0.
\n
"
,
ret
);
ok
(
size
==
0xdeadbeef
,
"GetRawInputDeviceInfoW returned size %#x, expected 0.
\n
"
,
size
);
ok
(
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"GetRawInputDeviceInfoW last error %#x, expected 0xdeadbeef.
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
size
=
0xdeadbeef
;
ret
=
pGetRawInputDeviceInfoW
(
devices
[
0
].
hDevice
,
0xdeadbeef
,
NULL
,
&
size
);
ok
(
ret
==
~
0U
,
"GetRawInputDeviceInfoW returned %#x, expected ~0.
\n
"
,
ret
);
ok
(
size
==
0xdeadbeef
,
"GetRawInputDeviceInfoW returned size %#x, expected 0.
\n
"
,
size
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"GetRawInputDeviceInfoW last error %#x, expected 0xdeadbeef.
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ret
=
pGetRawInputDeviceInfoW
(
devices
[
0
].
hDevice
,
RIDI_DEVICEINFO
,
&
info
,
NULL
);
ok
(
ret
==
~
0U
,
"GetRawInputDeviceInfoW returned %#x, expected ~0.
\n
"
,
ret
);
ok
(
GetLastError
()
==
ERROR_NOACCESS
,
"GetRawInputDeviceInfoW last error %#x, expected 0xdeadbeef.
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
size
=
0
;
ret
=
pGetRawInputDeviceInfoW
(
devices
[
0
].
hDevice
,
RIDI_DEVICEINFO
,
&
info
,
&
size
);
ok
(
ret
==
~
0U
,
"GetRawInputDeviceInfoW returned %#x, expected ~0.
\n
"
,
ret
);
ok
(
size
==
sizeof
(
info
),
"GetRawInputDeviceInfoW returned size %#x, expected %#x.
\n
"
,
size
,
sizeof
(
info
)
);
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"GetRawInputDeviceInfoW last error %#x, expected 0xdeadbeef.
\n
"
,
GetLastError
()
);
}
for
(
i
=
0
;
i
<
devcount
;
++
i
)
{
WCHAR
name
[
128
];
...
...
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