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
b4dfa8ff
Commit
b4dfa8ff
authored
Sep 21, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Check sizes in HID joystick IDirectInputDevice8_GetProperty.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0daf8417
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
joystick_hid.c
dlls/dinput/joystick_hid.c
+9
-0
hid.c
dlls/dinput8/tests/hid.c
+0
-2
No files found.
dlls/dinput/joystick_hid.c
View file @
b4dfa8ff
...
...
@@ -500,28 +500,33 @@ static HRESULT WINAPI hid_joystick_GetProperty( IDirectInputDevice8W *iface, con
TRACE
(
"iface %p, guid %s, header %p
\n
"
,
iface
,
debugstr_guid
(
guid
),
header
);
if
(
!
header
)
return
DIERR_INVALIDPARAM
;
if
(
header
->
dwHeaderSize
!=
sizeof
(
DIPROPHEADER
))
return
DIERR_INVALIDPARAM
;
if
(
!
IS_DIPROP
(
guid
))
return
DI_OK
;
switch
(
LOWORD
(
guid
))
{
case
(
DWORD_PTR
)
DIPROP_RANGE
:
if
(
header
->
dwSize
!=
sizeof
(
DIPROPRANGE
))
return
DIERR_INVALIDPARAM
;
enum_value_objects
(
impl
,
header
,
DIDFT_AXIS
,
get_property_prop_range
,
header
);
return
DI_OK
;
case
(
DWORD_PTR
)
DIPROP_PRODUCTNAME
:
{
DIPROPSTRING
*
value
=
(
DIPROPSTRING
*
)
header
;
if
(
header
->
dwSize
!=
sizeof
(
DIPROPSTRING
))
return
DIERR_INVALIDPARAM
;
lstrcpynW
(
value
->
wsz
,
impl
->
instance
.
tszProductName
,
MAX_PATH
);
return
DI_OK
;
}
case
(
DWORD_PTR
)
DIPROP_INSTANCENAME
:
{
DIPROPSTRING
*
value
=
(
DIPROPSTRING
*
)
header
;
if
(
header
->
dwSize
!=
sizeof
(
DIPROPSTRING
))
return
DIERR_INVALIDPARAM
;
lstrcpynW
(
value
->
wsz
,
impl
->
instance
.
tszInstanceName
,
MAX_PATH
);
return
DI_OK
;
}
case
(
DWORD_PTR
)
DIPROP_VIDPID
:
{
DIPROPDWORD
*
value
=
(
DIPROPDWORD
*
)
header
;
if
(
header
->
dwSize
!=
sizeof
(
DIPROPDWORD
))
return
DIERR_INVALIDPARAM
;
if
(
!
impl
->
attrs
.
VendorID
||
!
impl
->
attrs
.
ProductID
)
return
DIERR_UNSUPPORTED
;
value
->
dwData
=
MAKELONG
(
impl
->
attrs
.
VendorID
,
impl
->
attrs
.
ProductID
);
return
DI_OK
;
...
...
@@ -529,12 +534,14 @@ static HRESULT WINAPI hid_joystick_GetProperty( IDirectInputDevice8W *iface, con
case
(
DWORD_PTR
)
DIPROP_JOYSTICKID
:
{
DIPROPDWORD
*
value
=
(
DIPROPDWORD
*
)
header
;
if
(
header
->
dwSize
!=
sizeof
(
DIPROPDWORD
))
return
DIERR_INVALIDPARAM
;
value
->
dwData
=
impl
->
instance
.
guidInstance
.
Data3
;
return
DI_OK
;
}
case
(
DWORD_PTR
)
DIPROP_GUIDANDPATH
:
{
DIPROPGUIDANDPATH
*
value
=
(
DIPROPGUIDANDPATH
*
)
header
;
if
(
header
->
dwSize
!=
sizeof
(
DIPROPGUIDANDPATH
))
return
DIERR_INVALIDPARAM
;
lstrcpynW
(
value
->
wszPath
,
impl
->
device_path
,
MAX_PATH
);
return
DI_OK
;
}
...
...
@@ -566,11 +573,13 @@ static HRESULT WINAPI hid_joystick_SetProperty( IDirectInputDevice8W *iface, con
TRACE
(
"iface %p, guid %s, header %p
\n
"
,
iface
,
debugstr_guid
(
guid
),
header
);
if
(
!
header
)
return
DIERR_INVALIDPARAM
;
if
(
header
->
dwHeaderSize
!=
sizeof
(
DIPROPHEADER
))
return
DIERR_INVALIDPARAM
;
if
(
!
IS_DIPROP
(
guid
))
return
DI_OK
;
switch
(
LOWORD
(
guid
))
{
case
(
DWORD_PTR
)
DIPROP_RANGE
:
if
(
header
->
dwSize
!=
sizeof
(
DIPROPRANGE
))
return
DIERR_INVALIDPARAM
;
enum_value_objects
(
impl
,
header
,
DIDFT_AXIS
,
set_property_prop_range
,
(
void
*
)
header
);
return
DI_OK
;
default:
...
...
dlls/dinput8/tests/hid.c
View file @
b4dfa8ff
...
...
@@ -3785,11 +3785,9 @@ static void test_simple_joystick(void)
hr
=
IDirectInputDevice8_GetProperty
(
device
,
DIPROP_VIDPID
,
NULL
);
ok
(
hr
==
DIERR_INVALIDPARAM
,
"IDirectInputDevice8_GetProperty returned %#x
\n
"
,
hr
);
hr
=
IDirectInputDevice8_GetProperty
(
device
,
DIPROP_VIDPID
,
&
prop_string
.
diph
);
todo_wine
ok
(
hr
==
DIERR_INVALIDPARAM
,
"IDirectInputDevice8_GetProperty returned %#x
\n
"
,
hr
);
prop_dword
.
diph
.
dwHeaderSize
=
sizeof
(
DIPROPHEADER
)
-
1
;
hr
=
IDirectInputDevice8_GetProperty
(
device
,
DIPROP_VIDPID
,
&
prop_dword
.
diph
);
todo_wine
ok
(
hr
==
DIERR_INVALIDPARAM
,
"IDirectInputDevice8_GetProperty returned %#x
\n
"
,
hr
);
prop_dword
.
diph
.
dwHeaderSize
=
sizeof
(
DIPROPHEADER
);
...
...
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