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
ab8c00af
Commit
ab8c00af
authored
Apr 26, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Apr 26, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hidclass.sys: Move handle_minidriver_string inline.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ae212726
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
34 deletions
+26
-34
device.c
dlls/hidclass.sys/device.c
+26
-34
No files found.
dlls/hidclass.sys/device.c
View file @
ab8c00af
...
...
@@ -403,11 +403,13 @@ static const struct device_strings device_strings[] =
{
.
id
=
L"VID_054C&PID_0CE6"
,
.
product
=
L"Wireless Controller"
},
};
static
const
WCHAR
*
find_
product_string
(
const
WCHAR
*
device_id
)
static
const
WCHAR
*
find_
device_string
(
const
WCHAR
*
device_id
,
ULONG
index
)
{
const
WCHAR
*
match_id
=
wcsrchr
(
device_id
,
'\\'
)
+
1
;
DWORD
i
;
if
(
index
!=
HID_STRING_ID_IPRODUCT
)
return
NULL
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
device_strings
);
++
i
)
if
(
!
wcsnicmp
(
device_strings
[
i
].
id
,
match_id
,
17
))
return
device_strings
[
i
].
product
;
...
...
@@ -415,30 +417,6 @@ static const WCHAR *find_product_string( const WCHAR *device_id )
return
NULL
;
}
static
void
handle_minidriver_string
(
BASE_DEVICE_EXTENSION
*
ext
,
IRP
*
irp
,
ULONG
index
)
{
IO_STACK_LOCATION
*
stack
=
IoGetCurrentIrpStackLocation
(
irp
);
WCHAR
*
output_buf
=
MmGetSystemAddressForMdlSafe
(
irp
->
MdlAddress
,
NormalPagePriority
);
ULONG
output_len
=
stack
->
Parameters
.
DeviceIoControl
.
OutputBufferLength
;
const
WCHAR
*
str
=
NULL
;
if
(
index
==
HID_STRING_ID_IPRODUCT
)
str
=
find_product_string
(
ext
->
device_id
);
if
(
!
str
)
call_minidriver
(
IOCTL_HID_GET_STRING
,
ext
->
u
.
pdo
.
parent_fdo
,
ULongToPtr
(
index
),
sizeof
(
index
),
output_buf
,
output_len
,
&
irp
->
IoStatus
);
else
{
irp
->
IoStatus
.
Information
=
(
wcslen
(
str
)
+
1
)
*
sizeof
(
WCHAR
);
if
(
irp
->
IoStatus
.
Information
>
output_len
)
irp
->
IoStatus
.
Status
=
STATUS_BUFFER_TOO_SMALL
;
else
{
memcpy
(
output_buf
,
str
,
irp
->
IoStatus
.
Information
);
irp
->
IoStatus
.
Status
=
STATUS_SUCCESS
;
}
}
}
static
void
hid_device_xfer_report
(
BASE_DEVICE_EXTENSION
*
ext
,
ULONG
code
,
IRP
*
irp
)
{
IO_STACK_LOCATION
*
stack
=
IoGetCurrentIrpStackLocation
(
irp
);
...
...
@@ -520,9 +498,10 @@ NTSTATUS WINAPI pdo_ioctl(DEVICE_OBJECT *device, IRP *irp)
struct
hid_queue
*
queue
=
irp
->
Tail
.
Overlay
.
OriginalFileObject
->
FsContext
;
IO_STACK_LOCATION
*
irpsp
=
IoGetCurrentIrpStackLocation
(
irp
);
BASE_DEVICE_EXTENSION
*
ext
=
device
->
DeviceExtension
;
ULONG
code
,
index
;
const
WCHAR
*
str
;
NTSTATUS
status
;
BOOL
removed
;
ULONG
code
;
KIRQL
irql
;
irp
->
IoStatus
.
Information
=
0
;
...
...
@@ -569,18 +548,31 @@ NTSTATUS WINAPI pdo_ioctl(DEVICE_OBJECT *device, IRP *irp)
break
;
}
case
IOCTL_HID_GET_PRODUCT_STRING
:
{
handle_minidriver_string
(
ext
,
irp
,
HID_STRING_ID_IPRODUCT
);
break
;
}
case
IOCTL_HID_GET_SERIALNUMBER_STRING
:
case
IOCTL_HID_GET_MANUFACTURER_STRING
:
{
WCHAR
*
output_buf
=
MmGetSystemAddressForMdlSafe
(
irp
->
MdlAddress
,
NormalPagePriority
);
ULONG
output_len
=
irpsp
->
Parameters
.
DeviceIoControl
.
OutputBufferLength
;
if
(
code
==
IOCTL_HID_GET_PRODUCT_STRING
)
index
=
HID_STRING_ID_IPRODUCT
;
if
(
code
==
IOCTL_HID_GET_SERIALNUMBER_STRING
)
index
=
HID_STRING_ID_ISERIALNUMBER
;
if
(
code
==
IOCTL_HID_GET_MANUFACTURER_STRING
)
index
=
HID_STRING_ID_IMANUFACTURER
;
if
((
str
=
find_device_string
(
ext
->
device_id
,
index
)))
{
irp
->
IoStatus
.
Information
=
(
wcslen
(
str
)
+
1
)
*
sizeof
(
WCHAR
);
if
(
irp
->
IoStatus
.
Information
>
output_len
)
irp
->
IoStatus
.
Status
=
STATUS_BUFFER_TOO_SMALL
;
else
{
handle_minidriver_string
(
ext
,
irp
,
HID_STRING_ID_ISERIALNUMBER
);
memcpy
(
output_buf
,
str
,
irp
->
IoStatus
.
Information
);
irp
->
IoStatus
.
Status
=
STATUS_SUCCESS
;
}
break
;
}
case
IOCTL_HID_GET_MANUFACTURER_STRING
:
{
handle_minidriver_string
(
ext
,
irp
,
HID_STRING_ID_IMANUFACTURER
);
call_minidriver
(
IOCTL_HID_GET_STRING
,
ext
->
u
.
pdo
.
parent_fdo
,
ULongToPtr
(
index
),
sizeof
(
index
),
output_buf
,
output_len
,
&
irp
->
IoStatus
);
break
;
}
case
IOCTL_HID_GET_COLLECTION_INFORMATION
:
...
...
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