Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
10b00e66
Commit
10b00e66
authored
May 16, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
May 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Return an HRESULT from hid_joystick_device_try_open.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ac7fa167
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
13 deletions
+12
-13
joystick_hid.c
dlls/dinput/joystick_hid.c
+12
-13
No files found.
dlls/dinput/joystick_hid.c
View file @
10b00e66
...
...
@@ -1413,9 +1413,9 @@ static DWORD device_type_for_version( DWORD type, DWORD version )
}
}
static
BOOL
hid_joystick_device_try_open
(
UINT32
handle
,
const
WCHAR
*
path
,
HANDLE
*
device
,
PHIDP_PREPARSED_DATA
*
preparsed
,
HIDD_ATTRIBUTES
*
attrs
,
HIDP_CAPS
*
caps
,
DIDEVICEINSTANCEW
*
instance
,
DWORD
version
)
static
HRESULT
hid_joystick_device_try_open
(
UINT32
handle
,
const
WCHAR
*
path
,
HANDLE
*
device
,
PHIDP_PREPARSED_DATA
*
preparsed
,
HIDD_ATTRIBUTES
*
attrs
,
HIDP_CAPS
*
caps
,
DIDEVICEINSTANCEW
*
instance
,
DWORD
version
)
{
BOOL
has_accelerator
,
has_brake
,
has_clutch
,
has_z
,
has_pov
;
PHIDP_PREPARSED_DATA
preparsed_data
=
NULL
;
...
...
@@ -1430,7 +1430,7 @@ static BOOL hid_joystick_device_try_open( UINT32 handle, const WCHAR *path, HAND
device_file
=
CreateFileW
(
path
,
GENERIC_READ
|
GENERIC_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
FILE_FLAG_OVERLAPPED
|
FILE_FLAG_NO_BUFFERING
,
0
);
if
(
device_file
==
INVALID_HANDLE_VALUE
)
return
FALSE
;
if
(
device_file
==
INVALID_HANDLE_VALUE
)
return
DIERR_DEVICENOTREG
;
if
(
!
HidD_GetPreparsedData
(
device_file
,
&
preparsed_data
))
goto
failed
;
if
(
!
HidD_GetAttributes
(
device_file
,
attrs
))
goto
failed
;
...
...
@@ -1556,12 +1556,12 @@ static BOOL hid_joystick_device_try_open( UINT32 handle, const WCHAR *path, HAND
*
device
=
device_file
;
*
preparsed
=
preparsed_data
;
return
TRUE
;
return
DI_OK
;
failed:
CloseHandle
(
device_file
);
HidD_FreePreparsedData
(
preparsed_data
);
return
FALSE
;
return
DIERR_DEVICENOTREG
;
}
static
HRESULT
hid_joystick_device_open
(
int
index
,
DIDEVICEINSTANCEW
*
filter
,
WCHAR
*
device_path
,
...
...
@@ -1600,8 +1600,8 @@ static HRESULT hid_joystick_device_open( int index, DIDEVICEINSTANCEW *filter, W
(
BYTE
*
)
&
handle
,
sizeof
(
handle
),
NULL
,
0
)
||
type
!=
DEVPROP_TYPE_UINT32
)
continue
;
if
(
!
hid_joystick_device_try_open
(
handle
,
detail
->
DevicePath
,
device
,
preparsed
,
attrs
,
caps
,
&
instance
,
version
))
if
(
FAILED
(
hid_joystick_device_try_open
(
handle
,
detail
->
DevicePath
,
device
,
preparsed
,
attrs
,
caps
,
&
instance
,
version
)
))
continue
;
if
(
device_instance_is_disabled
(
&
instance
,
&
override
))
...
...
@@ -1620,8 +1620,8 @@ static HRESULT hid_joystick_device_open( int index, DIDEVICEINSTANCEW *filter, W
CloseHandle
(
*
device
);
HidD_FreePreparsedData
(
*
preparsed
);
if
(
!
hid_joystick_device_try_open
(
handle
,
detail
->
DevicePath
,
device
,
preparsed
,
attrs
,
caps
,
&
instance
,
version
))
if
(
FAILED
(
hid_joystick_device_try_open
(
handle
,
detail
->
DevicePath
,
device
,
preparsed
,
attrs
,
caps
,
&
instance
,
version
)
))
continue
;
}
...
...
@@ -2062,9 +2062,8 @@ HRESULT hid_joystick_create_device( struct dinput *dinput, const GUID *guid, IDi
else
{
wcscpy
(
impl
->
device_path
,
*
(
const
WCHAR
**
)
guid
);
if
(
!
hid_joystick_device_try_open
(
0
,
impl
->
device_path
,
&
impl
->
device
,
&
impl
->
preparsed
,
&
attrs
,
&
impl
->
caps
,
&
instance
,
dinput
->
dwVersion
))
hr
=
DIERR_DEVICENOTREG
;
hr
=
hid_joystick_device_try_open
(
0
,
impl
->
device_path
,
&
impl
->
device
,
&
impl
->
preparsed
,
&
attrs
,
&
impl
->
caps
,
&
instance
,
dinput
->
dwVersion
);
}
if
(
hr
!=
DI_OK
)
goto
failed
;
...
...
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