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
03e68ae3
Commit
03e68ae3
authored
Sep 10, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput8/tests: Read the expected lengths from the registry.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
97a6870c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
44 deletions
+36
-44
driver_hid.c
dlls/dinput8/tests/driver_hid.c
+13
-6
hid.c
dlls/dinput8/tests/hid.c
+23
-38
No files found.
dlls/dinput8/tests/driver_hid.c
View file @
03e68ae3
...
...
@@ -42,6 +42,7 @@ static unsigned int got_start_device;
static
HID_DEVICE_ATTRIBUTES
attributes
;
static
char
report_descriptor_buf
[
4096
];
static
DWORD
report_descriptor_len
;
static
HIDP_CAPS
caps
;
static
DWORD
report_id
;
static
DWORD
polled
;
...
...
@@ -242,7 +243,7 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
case
IOCTL_HID_READ_REPORT
:
{
ULONG
expected_size
=
25
;
ULONG
expected_size
=
caps
.
InputReportByteLength
-
(
report_id
?
0
:
1
)
;
ok
(
!
in_size
,
"got input size %u
\n
"
,
in_size
);
ok
(
out_size
==
expected_size
,
"got output size %u
\n
"
,
out_size
);
...
...
@@ -266,7 +267,7 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
case
IOCTL_HID_WRITE_REPORT
:
{
HID_XFER_PACKET
*
packet
=
irp
->
UserBuffer
;
ULONG
expected_size
=
2
;
ULONG
expected_size
=
caps
.
OutputReportByteLength
-
(
report_id
?
0
:
1
)
;
ok
(
in_size
==
sizeof
(
*
packet
),
"got input size %u
\n
"
,
in_size
);
ok
(
!
out_size
,
"got output size %u
\n
"
,
out_size
);
...
...
@@ -284,7 +285,7 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
case
IOCTL_HID_GET_INPUT_REPORT
:
{
HID_XFER_PACKET
*
packet
=
irp
->
UserBuffer
;
ULONG
expected_size
=
23
;
ULONG
expected_size
=
caps
.
InputReportByteLength
-
(
report_id
?
0
:
1
)
;
ok
(
!
in_size
,
"got input size %u
\n
"
,
in_size
);
ok
(
out_size
==
sizeof
(
*
packet
),
"got output size %u
\n
"
,
out_size
);
...
...
@@ -303,7 +304,7 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
case
IOCTL_HID_SET_OUTPUT_REPORT
:
{
HID_XFER_PACKET
*
packet
=
irp
->
UserBuffer
;
ULONG
expected_size
=
2
;
ULONG
expected_size
=
caps
.
OutputReportByteLength
-
(
report_id
?
0
:
1
)
;
ok
(
in_size
==
sizeof
(
*
packet
),
"got input size %u
\n
"
,
in_size
);
ok
(
!
out_size
,
"got output size %u
\n
"
,
out_size
);
...
...
@@ -319,7 +320,7 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
case
IOCTL_HID_GET_FEATURE
:
{
HID_XFER_PACKET
*
packet
=
irp
->
UserBuffer
;
ULONG
expected_size
=
17
;
ULONG
expected_size
=
caps
.
FeatureReportByteLength
-
(
report_id
?
0
:
1
)
;
ok
(
!
in_size
,
"got input size %u
\n
"
,
in_size
);
ok
(
out_size
==
sizeof
(
*
packet
),
"got output size %u
\n
"
,
out_size
);
...
...
@@ -337,7 +338,7 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
case
IOCTL_HID_SET_FEATURE
:
{
HID_XFER_PACKET
*
packet
=
irp
->
UserBuffer
;
ULONG
expected_size
=
17
;
ULONG
expected_size
=
caps
.
FeatureReportByteLength
-
(
report_id
?
0
:
1
)
;
ok
(
in_size
==
sizeof
(
*
packet
),
"got input size %u
\n
"
,
in_size
);
ok
(
!
out_size
,
"got output size %u
\n
"
,
out_size
);
...
...
@@ -470,6 +471,12 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *registry )
ok
(
!
ret
,
"ZwQueryValueKey returned %#x
\n
"
,
ret
);
memcpy
(
&
attributes
,
buffer
+
info_size
,
size
-
info_size
);
RtlInitUnicodeString
(
&
name_str
,
L"Caps"
);
size
=
info_size
+
sizeof
(
caps
);
ret
=
ZwQueryValueKey
(
hkey
,
&
name_str
,
KeyValuePartialInformation
,
buffer
,
size
,
&
size
);
ok
(
!
ret
,
"ZwQueryValueKey returned %#x
\n
"
,
ret
);
memcpy
(
&
caps
,
buffer
+
info_size
,
size
-
info_size
);
driver
->
DriverExtension
->
AddDevice
=
driver_add_device
;
driver
->
DriverUnload
=
driver_unload
;
driver
->
MajorFunction
[
IRP_MJ_PNP
]
=
driver_pnp
;
...
...
dlls/dinput8/tests/hid.c
View file @
03e68ae3
...
...
@@ -724,41 +724,8 @@ static BOOL sync_ioctl( HANDLE file, DWORD code, void *in_buf, DWORD in_len, voi
return
ret
;
}
static
void
test_hidp
(
HANDLE
file
,
HANDLE
async_file
,
int
report_id
,
BOOL
polled
)
static
void
test_hidp
(
HANDLE
file
,
HANDLE
async_file
,
int
report_id
,
BOOL
polled
,
const
HIDP_CAPS
*
expect_caps
)
{
const
HIDP_CAPS
expect_hidp_caps
[]
=
{
/* without report id */
{
.
Usage
=
HID_USAGE_GENERIC_JOYSTICK
,
.
UsagePage
=
HID_USAGE_PAGE_GENERIC
,
.
InputReportByteLength
=
26
,
.
OutputReportByteLength
=
3
,
.
FeatureReportByteLength
=
22
,
.
NumberLinkCollectionNodes
=
10
,
.
NumberInputButtonCaps
=
17
,
.
NumberInputValueCaps
=
7
,
.
NumberInputDataIndices
=
47
,
.
NumberFeatureButtonCaps
=
1
,
.
NumberFeatureValueCaps
=
6
,
.
NumberFeatureDataIndices
=
8
,
},
/* with report id */
{
.
Usage
=
HID_USAGE_GENERIC_JOYSTICK
,
.
UsagePage
=
HID_USAGE_PAGE_GENERIC
,
.
InputReportByteLength
=
25
,
.
OutputReportByteLength
=
2
,
.
FeatureReportByteLength
=
21
,
.
NumberLinkCollectionNodes
=
10
,
.
NumberInputButtonCaps
=
17
,
.
NumberInputValueCaps
=
7
,
.
NumberInputDataIndices
=
47
,
.
NumberFeatureButtonCaps
=
1
,
.
NumberFeatureValueCaps
=
6
,
.
NumberFeatureDataIndices
=
8
,
},
};
const
HIDP_BUTTON_CAPS
expect_button_caps
[]
=
{
{
...
...
@@ -942,7 +909,7 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
ok
(
status
==
HIDP_STATUS_INVALID_PREPARSED_DATA
,
"HidP_GetCaps returned %#x
\n
"
,
status
);
status
=
HidP_GetCaps
(
preparsed_data
,
&
caps
);
ok
(
status
==
HIDP_STATUS_SUCCESS
,
"HidP_GetCaps returned %#x
\n
"
,
status
);
check_hidp_caps
(
&
caps
,
&
expect_hidp_caps
[
report_id
]
);
check_hidp_caps
(
&
caps
,
expect_caps
);
collection_count
=
0
;
status
=
HidP_GetLinkCollectionNodes
(
collections
,
&
collection_count
,
preparsed_data
);
...
...
@@ -1883,7 +1850,7 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
HidD_FreePreparsedData
(
preparsed_data
);
}
static
void
test_hid_device
(
DWORD
report_id
,
DWORD
polled
)
static
void
test_hid_device
(
DWORD
report_id
,
DWORD
polled
,
const
HIDP_CAPS
*
expect_caps
)
{
char
buffer
[
FIELD_OFFSET
(
SP_DEVICE_INTERFACE_DETAIL_DATA_W
,
DevicePath
[
MAX_PATH
]
)];
SP_DEVICE_INTERFACE_DATA
iface
=
{
sizeof
(
SP_DEVICE_INTERFACE_DATA
)};
...
...
@@ -2038,7 +2005,7 @@ static void test_hid_device( DWORD report_id, DWORD polled )
ok
(
poll_freq
==
500
,
"got poll_freq %u, expected 500
\n
"
,
poll_freq
);
}
test_hidp
(
file
,
async_file
,
report_id
,
polled
);
test_hidp
(
file
,
async_file
,
report_id
,
polled
,
expect_caps
);
CloseHandle
(
async_file
);
CloseHandle
(
file
);
...
...
@@ -2308,6 +2275,21 @@ static void test_hid_driver( DWORD report_id, DWORD polled )
.
ProductID
=
0x0001
,
.
VersionNumber
=
0x0100
,
};
const
HIDP_CAPS
caps
=
{
.
Usage
=
HID_USAGE_GENERIC_JOYSTICK
,
.
UsagePage
=
HID_USAGE_PAGE_GENERIC
,
.
InputReportByteLength
=
report_id
?
25
:
26
,
.
OutputReportByteLength
=
report_id
?
2
:
3
,
.
FeatureReportByteLength
=
report_id
?
21
:
22
,
.
NumberLinkCollectionNodes
=
10
,
.
NumberInputButtonCaps
=
17
,
.
NumberInputValueCaps
=
7
,
.
NumberInputDataIndices
=
47
,
.
NumberFeatureButtonCaps
=
1
,
.
NumberFeatureValueCaps
=
6
,
.
NumberFeatureDataIndices
=
8
,
};
WCHAR
cwd
[
MAX_PATH
],
tempdir
[
MAX_PATH
];
LSTATUS
status
;
...
...
@@ -2333,7 +2315,10 @@ static void test_hid_driver( DWORD report_id, DWORD polled )
status
=
RegSetValueExW
(
hkey
,
L"Attributes"
,
0
,
REG_BINARY
,
(
void
*
)
&
attributes
,
sizeof
(
attributes
)
);
ok
(
!
status
,
"RegSetValueExW returned %#x
\n
"
,
status
);
if
(
pnp_driver_start
(
L"driver_hid.dll"
))
test_hid_device
(
report_id
,
polled
);
status
=
RegSetValueExW
(
hkey
,
L"Caps"
,
0
,
REG_BINARY
,
(
void
*
)
&
caps
,
sizeof
(
caps
)
);
ok
(
!
status
,
"RegSetValueExW returned %#x
\n
"
,
status
);
if
(
pnp_driver_start
(
L"driver_hid.dll"
))
test_hid_device
(
report_id
,
polled
,
&
caps
);
pnp_driver_stop
();
SetCurrentDirectoryW
(
cwd
);
...
...
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