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
5e41525c
Commit
5e41525c
authored
Sep 13, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winexinput.sys: Return native product strings on some devices.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fb31e6f3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
+60
-0
main.c
dlls/winexinput.sys/main.c
+60
-0
No files found.
dlls/winexinput.sys/main.c
View file @
5e41525c
...
...
@@ -32,6 +32,7 @@
#include "ddk/wdm.h"
#include "ddk/hidport.h"
#include "ddk/hidpddi.h"
#include "ddk/hidtypes.h"
#include "wine/asm.h"
#include "wine/debug.h"
...
...
@@ -314,17 +315,76 @@ static NTSTATUS try_complete_pending_read(DEVICE_OBJECT *device, IRP *irp)
return
IoCallDriver
(
fdo
->
bus_device
,
xinput_irp
);
}
struct
device_strings
{
const
WCHAR
*
id
;
const
WCHAR
*
product
;
};
static
const
struct
device_strings
device_strings
[]
=
{
{
.
id
=
L"VID_045E&PID_028E&IG_00"
,
.
product
=
L"Controller (XBOX 360 For Windows)"
},
{
.
id
=
L"VID_045E&PID_028F&IG_00"
,
.
product
=
L"Controller (XBOX 360 For Windows)"
},
{
.
id
=
L"VID_045E&PID_02D1&IG_00"
,
.
product
=
L"Controller (XBOX One For Windows)"
},
{
.
id
=
L"VID_045E&PID_02DD&IG_00"
,
.
product
=
L"Controller (XBOX One For Windows)"
},
{
.
id
=
L"VID_045E&PID_02E3&IG_00"
,
.
product
=
L"Controller (XBOX One For Windows)"
},
{
.
id
=
L"VID_045E&PID_02EA&IG_00"
,
.
product
=
L"Controller (XBOX One For Windows)"
},
{
.
id
=
L"VID_045E&PID_02FD&IG_00"
,
.
product
=
L"Controller (XBOX One For Windows)"
},
{
.
id
=
L"VID_045E&PID_0719&IG_00"
,
.
product
=
L"Controller (XBOX 360 For Windows)"
},
};
static
const
WCHAR
*
find_product_string
(
const
WCHAR
*
device_id
)
{
const
WCHAR
*
match_id
=
wcsrchr
(
device_id
,
'\\'
)
+
1
;
DWORD
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
device_strings
);
++
i
)
if
(
!
wcsicmp
(
device_strings
[
i
].
id
,
match_id
))
return
device_strings
[
i
].
product
;
return
NULL
;
}
static
NTSTATUS
WINAPI
gamepad_internal_ioctl
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
{
IO_STACK_LOCATION
*
stack
=
IoGetCurrentIrpStackLocation
(
irp
);
ULONG
output_len
=
stack
->
Parameters
.
DeviceIoControl
.
OutputBufferLength
;
ULONG
code
=
stack
->
Parameters
.
DeviceIoControl
.
IoControlCode
;
struct
func_device
*
fdo
=
fdo_from_DEVICE_OBJECT
(
device
);
struct
device
*
impl
=
impl_from_DEVICE_OBJECT
(
device
);
const
WCHAR
*
str
=
NULL
;
TRACE
(
"device %p, irp %p, code %#x, bus_device %p.
\n
"
,
device
,
irp
,
code
,
fdo
->
bus_device
);
switch
(
code
)
{
case
IOCTL_HID_GET_STRING
:
switch
((
ULONG_PTR
)
stack
->
Parameters
.
DeviceIoControl
.
Type3InputBuffer
)
{
case
HID_STRING_ID_IPRODUCT
:
str
=
find_product_string
(
impl
->
device_id
);
break
;
}
if
(
!
str
)
{
IoSkipCurrentIrpStackLocation
(
irp
);
return
IoCallDriver
(
fdo
->
bus_device
,
irp
);
}
irp
->
IoStatus
.
Information
=
(
wcslen
(
str
)
+
1
)
*
sizeof
(
WCHAR
);
if
(
output_len
<
irp
->
IoStatus
.
Information
)
{
irp
->
IoStatus
.
Status
=
STATUS_BUFFER_TOO_SMALL
;
IoCompleteRequest
(
irp
,
IO_NO_INCREMENT
);
return
STATUS_BUFFER_TOO_SMALL
;
}
wcscpy
(
irp
->
UserBuffer
,
str
);
irp
->
IoStatus
.
Status
=
STATUS_SUCCESS
;
IoCompleteRequest
(
irp
,
IO_NO_INCREMENT
);
return
STATUS_SUCCESS
;
case
IOCTL_HID_GET_DEVICE_DESCRIPTOR
:
{
HID_DESCRIPTOR
*
descriptor
=
(
HID_DESCRIPTOR
*
)
irp
->
UserBuffer
;
...
...
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