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
47ac0b0b
Commit
47ac0b0b
authored
Aug 05, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Aug 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xinput1_3: Statically allocate SP_DEVICE_INTERFACE_DETAIL_DATA_W.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
828b9b8c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
12 deletions
+8
-12
hid.c
dlls/xinput1_3/hid.c
+8
-12
No files found.
dlls/xinput1_3/hid.c
View file @
47ac0b0b
...
...
@@ -223,12 +223,12 @@ failed:
void
HID_find_gamepads
(
xinput_controller
*
devices
)
{
char
buffer
[
sizeof
(
SP_DEVICE_INTERFACE_DETAIL_DATA_W
)
+
MAX_PATH
*
sizeof
(
WCHAR
)];
SP_DEVICE_INTERFACE_DETAIL_DATA_W
*
detail
=
(
SP_DEVICE_INTERFACE_DETAIL_DATA_W
*
)
buffer
;
HDEVINFO
device_info_set
;
GUID
hid_guid
;
SP_DEVICE_INTERFACE_DATA
interface_data
;
SP_DEVICE_INTERFACE_DETAIL_DATA_W
*
data
;
PHIDP_PREPARSED_DATA
ppd
;
DWORD
detail_size
=
MAX_PATH
*
sizeof
(
WCHAR
);
HANDLE
device
;
HIDP_CAPS
caps
;
NTSTATUS
status
;
...
...
@@ -251,9 +251,7 @@ void HID_find_gamepads(xinput_controller *devices)
HidD_GetHidGuid
(
&
hid_guid
);
device_info_set
=
SetupDiGetClassDevsW
(
&
hid_guid
,
NULL
,
NULL
,
DIGCF_DEVICEINTERFACE
|
DIGCF_PRESENT
);
if
(
!
(
data
=
malloc
(
sizeof
(
*
data
)
+
detail_size
)))
goto
done
;
data
->
cbSize
=
sizeof
(
*
data
);
detail
->
cbSize
=
sizeof
(
*
detail
);
ZeroMemory
(
&
interface_data
,
sizeof
(
interface_data
));
interface_data
.
cbSize
=
sizeof
(
interface_data
);
...
...
@@ -262,17 +260,16 @@ void HID_find_gamepads(xinput_controller *devices)
while
(
SetupDiEnumDeviceInterfaces
(
device_info_set
,
NULL
,
&
hid_guid
,
idx
++
,
&
interface_data
))
{
if
(
!
SetupDiGetDeviceInterfaceDetailW
(
device_info_set
,
&
interface_data
,
data
,
sizeof
(
*
data
)
+
detail_size
,
NULL
,
NULL
))
if
(
!
SetupDiGetDeviceInterfaceDetailW
(
device_info_set
,
&
interface_data
,
detail
,
sizeof
(
buffer
),
NULL
,
NULL
))
continue
;
if
(
!
wcsstr
(
d
ata
->
DevicePath
,
L"IG_"
))
if
(
!
wcsstr
(
d
etail
->
DevicePath
,
L"IG_"
))
continue
;
if
(
find_opened_device
(
devices
,
d
ata
,
&
i
))
continue
;
/* already opened */
if
(
find_opened_device
(
devices
,
d
etail
,
&
i
))
continue
;
/* already opened */
if
(
i
==
XUSER_MAX_COUNT
)
break
;
/* no more slots */
device
=
CreateFileW
(
d
ata
->
DevicePath
,
GENERIC_READ
|
GENERIC_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
device
=
CreateFileW
(
d
etail
->
DevicePath
,
GENERIC_READ
|
GENERIC_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
if
(
device
==
INVALID_HANDLE_VALUE
)
continue
;
...
...
@@ -285,7 +282,7 @@ void HID_find_gamepads(xinput_controller *devices)
WARN
(
"ignoring HID device, unsupported usage page %04x
\n
"
,
caps
.
UsagePage
);
else
if
(
caps
.
Usage
!=
HID_USAGE_GENERIC_GAMEPAD
&&
caps
.
Usage
!=
HID_USAGE_GENERIC_JOYSTICK
&&
caps
.
Usage
!=
HID_USAGE_GENERIC_MULTI_AXIS_CONTROLLER
)
WARN
(
"ignoring HID device, unsupported usage %04x:%04x
\n
"
,
caps
.
UsagePage
,
caps
.
Usage
);
else
if
(
!
init_controller
(
&
devices
[
i
],
ppd
,
&
caps
,
device
,
d
ata
->
DevicePath
))
else
if
(
!
init_controller
(
&
devices
[
i
],
ppd
,
&
caps
,
device
,
d
etail
->
DevicePath
))
WARN
(
"ignoring HID device, failed to initialize
\n
"
);
else
goto
done
;
...
...
@@ -295,7 +292,6 @@ void HID_find_gamepads(xinput_controller *devices)
}
done:
free
(
data
);
SetupDiDestroyDeviceInfoList
(
device_info_set
);
LeaveCriticalSection
(
&
xinput_crit
);
}
...
...
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