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
5d63f809
Commit
5d63f809
authored
May 15, 2022
by
Zebediah Figura
Committed by
Alexandre Julliard
Jun 10, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Store the device path as a simple string pointer.
parent
58571710
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
15 deletions
+18
-15
rawinput.c
dlls/user32/rawinput.c
+18
-15
No files found.
dlls/user32/rawinput.c
View file @
5d63f809
...
...
@@ -46,7 +46,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(rawinput);
struct
device
{
SP_DEVICE_INTERFACE_DETAIL_DATA_W
*
detail
;
WCHAR
*
path
;
HANDLE
file
;
HANDLE
handle
;
RID_DEVICE_INFO
info
;
...
...
@@ -103,11 +103,11 @@ static struct device *add_device( HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface,
struct
device
*
device
=
NULL
;
RID_DEVICE_INFO
info
;
IO_STATUS_BLOCK
io
;
WCHAR
*
path
,
*
pos
;
NTSTATUS
status
;
UINT32
handle
;
DWORD
i
,
size
;
HANDLE
file
;
WCHAR
*
pos
;
SetupDiGetDeviceInterfaceDetailW
(
set
,
iface
,
NULL
,
0
,
&
size
,
&
device_data
);
if
(
GetLastError
()
!=
ERROR_INSUFFICIENT_BUFFER
)
...
...
@@ -123,16 +123,19 @@ static struct device *add_device( HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface,
}
detail
->
cbSize
=
sizeof
(
SP_DEVICE_INTERFACE_DETAIL_DATA_W
);
SetupDiGetDeviceInterfaceDetailW
(
set
,
iface
,
detail
,
size
,
NULL
,
NULL
);
path
=
wcsdup
(
detail
->
DevicePath
);
free
(
detail
);
if
(
!
path
)
return
NULL
;
/* upper case everything but the GUID */
for
(
pos
=
detail
->
DeviceP
ath
;
*
pos
&&
*
pos
!=
'{'
;
pos
++
)
*
pos
=
towupper
(
*
pos
);
for
(
pos
=
p
ath
;
*
pos
&&
*
pos
!=
'{'
;
pos
++
)
*
pos
=
towupper
(
*
pos
);
file
=
CreateFileW
(
detail
->
DeviceP
ath
,
GENERIC_READ
|
GENERIC_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
file
=
CreateFileW
(
p
ath
,
GENERIC_READ
|
GENERIC_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
if
(
file
==
INVALID_HANDLE_VALUE
)
{
ERR
(
"Failed to open device file %s, error %lu.
\n
"
,
debugstr_w
(
detail
->
DevicePath
),
GetLastError
()
);
free
(
detail
);
ERR
(
"Failed to open device file %s, error %lu.
\n
"
,
debugstr_w
(
path
),
GetLastError
()
);
free
(
path
);
return
NULL
;
}
...
...
@@ -199,16 +202,16 @@ static struct device *add_device( HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface,
if
(
device
)
{
TRACE
(
"Updating device %x / %s.
\n
"
,
handle
,
debugstr_w
(
detail
->
DevicePath
)
);
TRACE
(
"Updating device %#x / %s.
\n
"
,
handle
,
debugstr_w
(
path
)
);
free
(
device
->
data
);
CloseHandle
(
device
->
file
);
free
(
device
->
detail
);
free
(
device
->
path
);
}
else
if
(
array_reserve
((
void
**
)
&
rawinput_devices
,
&
rawinput_devices_max
,
rawinput_devices_count
+
1
,
sizeof
(
*
rawinput_devices
)))
{
device
=
&
rawinput_devices
[
rawinput_devices_count
++
];
TRACE
(
"Adding device %x / %s.
\n
"
,
handle
,
debugstr_w
(
detail
->
DevicePath
)
);
TRACE
(
"Adding device %#x / %s.
\n
"
,
handle
,
debugstr_w
(
path
)
);
}
else
{
...
...
@@ -216,7 +219,7 @@ static struct device *add_device( HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface,
goto
fail
;
}
device
->
detail
=
detail
;
device
->
path
=
path
;
device
->
file
=
file
;
device
->
handle
=
ULongToHandle
(
handle
);
device
->
info
=
info
;
...
...
@@ -227,7 +230,7 @@ static struct device *add_device( HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface,
fail:
free
(
preparsed
);
CloseHandle
(
file
);
free
(
detail
);
free
(
path
);
return
NULL
;
}
...
...
@@ -258,7 +261,7 @@ void rawinput_update_device_list(void)
{
free
(
rawinput_devices
[
idx
].
data
);
CloseHandle
(
rawinput_devices
[
idx
].
file
);
free
(
rawinput_devices
[
idx
].
detail
);
free
(
rawinput_devices
[
idx
].
path
);
}
rawinput_devices_count
=
0
;
...
...
@@ -762,8 +765,8 @@ UINT WINAPI GetRawInputDeviceInfoW(HANDLE handle, UINT command, void *data, UINT
switch
(
command
)
{
case
RIDI_DEVICENAME
:
if
((
len
=
wcslen
(
device
->
detail
->
DevicePath
)
+
1
)
<=
data_len
&&
data
)
memcpy
(
data
,
device
->
detail
->
DevicePath
,
len
*
sizeof
(
WCHAR
)
);
if
((
len
=
wcslen
(
device
->
path
)
+
1
)
<=
data_len
&&
data
)
memcpy
(
data
,
device
->
path
,
len
*
sizeof
(
WCHAR
)
);
*
data_size
=
len
;
break
;
...
...
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