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
8962ec5a
Commit
8962ec5a
authored
May 25, 2022
by
Zebediah Figura
Committed by
Alexandre Julliard
Jun 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Populate the RID_DEVICE_INFO structure in add_device().
Signed-off-by:
Zebediah Figura
<
zfigura@codeweavers.com
>
parent
a64ec46e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
37 deletions
+47
-37
rawinput.c
dlls/user32/rawinput.c
+47
-37
No files found.
dlls/user32/rawinput.c
View file @
8962ec5a
...
...
@@ -94,15 +94,21 @@ static BOOL array_reserve(void **elements, unsigned int *capacity, unsigned int
return
TRUE
;
}
static
struct
device
*
add_device
(
HDEVINFO
set
,
SP_DEVICE_INTERFACE_DATA
*
iface
)
static
struct
device
*
add_device
(
HDEVINFO
set
,
SP_DEVICE_INTERFACE_DATA
*
iface
,
DWORD
type
)
{
static
const
RID_DEVICE_INFO_KEYBOARD
keyboard_info
=
{
0
,
0
,
1
,
12
,
3
,
101
};
static
const
RID_DEVICE_INFO_MOUSE
mouse_info
=
{
1
,
5
,
0
,
FALSE
};
SP_DEVINFO_DATA
device_data
=
{
sizeof
(
device_data
)};
PHIDP_PREPARSED_DATA
preparsed_data
=
NULL
;
SP_DEVICE_INTERFACE_DETAIL_DATA_W
*
detail
;
struct
device
*
device
=
NULL
;
RID_DEVICE_INFO
info
;
HIDD_ATTRIBUTES
attr
;
HIDP_CAPS
caps
;
UINT32
handle
;
DWORD
i
,
size
;
HANDLE
file
;
WCHAR
*
pos
;
DWORD
i
,
size
,
type
;
SetupDiGetDeviceInterfaceDetailW
(
set
,
iface
,
NULL
,
0
,
&
size
,
&
device_data
);
if
(
GetLastError
()
!=
ERROR_INSUFFICIENT_BUFFER
)
...
...
@@ -138,6 +144,40 @@ static struct device *add_device(HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface)
return
NULL
;
}
memset
(
&
info
,
0
,
sizeof
(
info
)
);
info
.
cbSize
=
sizeof
(
info
);
info
.
dwType
=
type
;
switch
(
type
)
{
case
RIM_TYPEHID
:
attr
.
Size
=
sizeof
(
HIDD_ATTRIBUTES
);
if
(
!
HidD_GetAttributes
(
device
->
file
,
&
attr
))
WARN
(
"Failed to get attributes.
\n
"
);
info
.
hid
.
dwVendorId
=
attr
.
VendorID
;
info
.
hid
.
dwProductId
=
attr
.
ProductID
;
info
.
hid
.
dwVersionNumber
=
attr
.
VersionNumber
;
if
(
!
HidD_GetPreparsedData
(
file
,
&
preparsed_data
))
WARN
(
"Failed to get preparsed data.
\n
"
);
if
(
!
HidP_GetCaps
(
preparsed_data
,
&
caps
))
WARN
(
"Failed to get caps.
\n
"
);
info
.
hid
.
usUsagePage
=
caps
.
UsagePage
;
info
.
hid
.
usUsage
=
caps
.
Usage
;
break
;
case
RIM_TYPEMOUSE
:
info
.
mouse
=
mouse_info
;
break
;
case
RIM_TYPEKEYBOARD
:
info
.
keyboard
=
keyboard_info
;
break
;
}
for
(
i
=
0
;
i
<
rawinput_devices_count
&&
!
device
;
++
i
)
if
(
rawinput_devices
[
i
].
handle
==
UlongToHandle
(
handle
))
device
=
rawinput_devices
+
i
;
...
...
@@ -166,8 +206,8 @@ static struct device *add_device(HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface)
device
->
detail
=
detail
;
device
->
file
=
file
;
device
->
handle
=
ULongToHandle
(
handle
);
device
->
info
.
cbSize
=
sizeof
(
RID_DEVICE_INFO
)
;
device
->
data
=
NULL
;
device
->
info
=
info
;
device
->
data
=
preparsed_data
;
return
device
;
}
...
...
@@ -176,8 +216,6 @@ void rawinput_update_device_list(void)
{
SP_DEVICE_INTERFACE_DATA
iface
=
{
sizeof
(
iface
)
};
struct
device
*
device
;
HIDD_ATTRIBUTES
attr
;
HIDP_CAPS
caps
;
GUID
hid_guid
;
HDEVINFO
set
;
DWORD
idx
;
...
...
@@ -201,26 +239,8 @@ void rawinput_update_device_list(void)
for
(
idx
=
0
;
SetupDiEnumDeviceInterfaces
(
set
,
NULL
,
&
hid_guid
,
idx
,
&
iface
);
++
idx
)
{
if
(
!
(
device
=
add_device
(
set
,
&
iface
)))
if
(
!
(
device
=
add_device
(
set
,
&
iface
,
RIM_TYPEHID
)))
continue
;
attr
.
Size
=
sizeof
(
HIDD_ATTRIBUTES
);
if
(
!
HidD_GetAttributes
(
device
->
file
,
&
attr
))
WARN
(
"Failed to get attributes.
\n
"
);
device
->
info
.
dwType
=
RIM_TYPEHID
;
device
->
info
.
hid
.
dwVendorId
=
attr
.
VendorID
;
device
->
info
.
hid
.
dwProductId
=
attr
.
ProductID
;
device
->
info
.
hid
.
dwVersionNumber
=
attr
.
VersionNumber
;
if
(
!
HidD_GetPreparsedData
(
device
->
file
,
&
device
->
data
))
WARN
(
"Failed to get preparsed data.
\n
"
);
if
(
!
HidP_GetCaps
(
device
->
data
,
&
caps
))
WARN
(
"Failed to get caps.
\n
"
);
device
->
info
.
hid
.
usUsagePage
=
caps
.
UsagePage
;
device
->
info
.
hid
.
usUsage
=
caps
.
Usage
;
}
SetupDiDestroyDeviceInfoList
(
set
);
...
...
@@ -229,13 +249,8 @@ void rawinput_update_device_list(void)
for
(
idx
=
0
;
SetupDiEnumDeviceInterfaces
(
set
,
NULL
,
&
GUID_DEVINTERFACE_MOUSE
,
idx
,
&
iface
);
++
idx
)
{
static
const
RID_DEVICE_INFO_MOUSE
mouse_info
=
{
1
,
5
,
0
,
FALSE
};
if
(
!
(
device
=
add_device
(
set
,
&
iface
)))
if
(
!
(
device
=
add_device
(
set
,
&
iface
,
RIM_TYPEMOUSE
)))
continue
;
device
->
info
.
dwType
=
RIM_TYPEMOUSE
;
device
->
info
.
mouse
=
mouse_info
;
}
SetupDiDestroyDeviceInfoList
(
set
);
...
...
@@ -244,13 +259,8 @@ void rawinput_update_device_list(void)
for
(
idx
=
0
;
SetupDiEnumDeviceInterfaces
(
set
,
NULL
,
&
GUID_DEVINTERFACE_KEYBOARD
,
idx
,
&
iface
);
++
idx
)
{
static
const
RID_DEVICE_INFO_KEYBOARD
keyboard_info
=
{
0
,
0
,
1
,
12
,
3
,
101
};
if
(
!
(
device
=
add_device
(
set
,
&
iface
)))
if
(
!
(
device
=
add_device
(
set
,
&
iface
,
RIM_TYPEHID
)))
continue
;
device
->
info
.
dwType
=
RIM_TYPEKEYBOARD
;
device
->
info
.
keyboard
=
keyboard_info
;
}
SetupDiDestroyDeviceInfoList
(
set
);
...
...
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