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
c44ba873
Commit
c44ba873
authored
Mar 21, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Mar 21, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput/tests: Add more HID device and extension pointers tests.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d470e783
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
6 deletions
+44
-6
driver.c
dlls/dinput/tests/driver.c
+44
-6
No files found.
dlls/dinput/tests/driver.c
View file @
c44ba873
...
@@ -406,6 +406,33 @@ struct hid_device
...
@@ -406,6 +406,33 @@ struct hid_device
KSPIN_LOCK
lock
;
KSPIN_LOCK
lock
;
};
};
static
DRIVER_OBJECT
*
expect_driver
;
static
DEVICE_OBJECT
*
expect_bus_pdo
;
static
DEVICE_OBJECT
*
expect_hid_fdo
;
static
DEVICE_OBJECT
*
expect_hid_pdo
;
static
struct
hid_device
*
expect_hid_ext
;
static
void
check_device
(
DEVICE_OBJECT
*
device
)
{
static
int
checked_fdo
,
checked_pdo
;
HID_DEVICE_EXTENSION
*
ext
=
device
->
DeviceExtension
;
ok
(
device
==
expect_hid_pdo
||
device
==
expect_hid_fdo
,
"got device %p
\n
"
,
device
);
ok
(
device
->
DriverObject
==
expect_driver
,
"got DriverObject %p
\n
"
,
device
->
DriverObject
);
if
(
!
device
->
NextDevice
)
ok
(
device
==
expect_hid_fdo
,
"got device %p
\n
"
,
device
);
else
ok
(
device
->
NextDevice
==
expect_hid_fdo
,
"got NextDevice %p
\n
"
,
device
->
NextDevice
);
ok
(
!
device
->
AttachedDevice
,
"got AttachedDevice %p
\n
"
,
device
->
AttachedDevice
);
if
(
device
==
expect_hid_pdo
&&
checked_pdo
++
)
return
;
if
(
device
==
expect_hid_fdo
&&
checked_fdo
++
)
return
;
todo_wine_if
(
device
!=
expect_hid_fdo
)
ok
(
ext
->
MiniDeviceExtension
==
expect_hid_ext
,
"got MiniDeviceExtension %p
\n
"
,
ext
->
MiniDeviceExtension
);
if
(
ext
->
MiniDeviceExtension
!=
expect_hid_ext
)
return
;
ok
(
ext
->
PhysicalDeviceObject
==
expect_bus_pdo
,
"got PhysicalDeviceObject %p
\n
"
,
ext
->
PhysicalDeviceObject
);
ok
(
ext
->
NextDeviceObject
==
expect_bus_pdo
,
"got NextDeviceObject %p
\n
"
,
ext
->
NextDeviceObject
);
}
static
NTSTATUS
WINAPI
driver_pnp
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
static
NTSTATUS
WINAPI
driver_pnp
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
{
{
IO_STACK_LOCATION
*
stack
=
IoGetCurrentIrpStackLocation
(
irp
);
IO_STACK_LOCATION
*
stack
=
IoGetCurrentIrpStackLocation
(
irp
);
...
@@ -493,6 +520,9 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
...
@@ -493,6 +520,9 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
if
(
winetest_debug
>
1
)
trace
(
"%s: device %p, code %#lx %s
\n
"
,
__func__
,
device
,
code
,
debugstr_ioctl
(
code
)
);
if
(
winetest_debug
>
1
)
trace
(
"%s: device %p, code %#lx %s
\n
"
,
__func__
,
device
,
code
,
debugstr_ioctl
(
code
)
);
ok
(
expect_hid_fdo
==
device
,
"got device %p
\n
"
,
device
);
check_device
(
device
);
ok
(
got_start_device
,
"expected IRP_MN_START_DEVICE before any ioctls
\n
"
);
ok
(
got_start_device
,
"expected IRP_MN_START_DEVICE before any ioctls
\n
"
);
irp
->
IoStatus
.
Information
=
0
;
irp
->
IoStatus
.
Information
=
0
;
...
@@ -706,7 +736,7 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
...
@@ -706,7 +736,7 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
return
ret
;
return
ret
;
}
}
static
NTSTATUS
(
WINAPI
*
hidclass_driver_ioctl
)(
DEVICE_OBJECT
*
device
,
IRP
*
irp
);
static
NTSTATUS
(
WINAPI
*
hidclass_driver_ioctl
)(
DEVICE_OBJECT
*
device
,
IRP
*
irp
);
static
NTSTATUS
WINAPI
driver_ioctl
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
static
NTSTATUS
WINAPI
driver_ioctl
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
{
{
IO_STACK_LOCATION
*
stack
=
IoGetCurrentIrpStackLocation
(
irp
);
IO_STACK_LOCATION
*
stack
=
IoGetCurrentIrpStackLocation
(
irp
);
...
@@ -716,6 +746,10 @@ static NTSTATUS WINAPI driver_ioctl( DEVICE_OBJECT *device, IRP *irp )
...
@@ -716,6 +746,10 @@ static NTSTATUS WINAPI driver_ioctl( DEVICE_OBJECT *device, IRP *irp )
if
(
winetest_debug
>
1
)
trace
(
"%s: device %p, code %#lx %s
\n
"
,
__func__
,
device
,
code
,
debugstr_ioctl
(
code
)
);
if
(
winetest_debug
>
1
)
trace
(
"%s: device %p, code %#lx %s
\n
"
,
__func__
,
device
,
code
,
debugstr_ioctl
(
code
)
);
if
(
!
expect_hid_pdo
)
expect_hid_pdo
=
device
;
else
ok
(
expect_hid_pdo
==
device
,
"got device %p
\n
"
,
device
);
check_device
(
device
);
switch
(
code
)
switch
(
code
)
{
{
case
IOCTL_WINETEST_HID_SET_EXPECT
:
case
IOCTL_WINETEST_HID_SET_EXPECT
:
...
@@ -750,12 +784,14 @@ static NTSTATUS WINAPI driver_add_device( DRIVER_OBJECT *driver, DEVICE_OBJECT *
...
@@ -750,12 +784,14 @@ static NTSTATUS WINAPI driver_add_device( DRIVER_OBJECT *driver, DEVICE_OBJECT *
if
(
winetest_debug
>
1
)
trace
(
"%s: driver %p, device %p
\n
"
,
__func__
,
driver
,
device
);
if
(
winetest_debug
>
1
)
trace
(
"%s: driver %p, device %p
\n
"
,
__func__
,
driver
,
device
);
/* We should be given the FDO, not the PDO. */
expect_hid_fdo
=
device
;
ok
(
!!
ext
->
PhysicalDeviceObject
,
"expected non-NULL pdo
\n
"
)
;
expect_bus_pdo
=
ext
->
PhysicalDeviceObject
;
ok
(
ext
->
NextDeviceObject
==
ext
->
PhysicalDeviceObject
,
"got pdo %p, next %p
\n
"
,
expect_hid_ext
=
ext
->
MiniDeviceExtension
;
ext
->
PhysicalDeviceObject
,
ext
->
NextDeviceObject
);
todo_wine
todo_wine
ok
(
ext
->
NextDeviceObject
->
AttachedDevice
==
device
,
"wrong attached device
\n
"
);
ok
(
expect_bus_pdo
->
AttachedDevice
==
device
,
"got AttachedDevice %p
\n
"
,
expect_bus_pdo
->
AttachedDevice
);
ok
(
driver
==
expect_driver
,
"got driver %p
\n
"
,
driver
);
check_device
(
device
);
ret
=
IoRegisterDeviceInterface
(
ext
->
PhysicalDeviceObject
,
&
control_class
,
NULL
,
&
control_symlink
);
ret
=
IoRegisterDeviceInterface
(
ext
->
PhysicalDeviceObject
,
&
control_class
,
NULL
,
&
control_symlink
);
ok
(
!
ret
,
"got %#lx
\n
"
,
ret
);
ok
(
!
ret
,
"got %#lx
\n
"
,
ret
);
...
@@ -809,6 +845,8 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *registry )
...
@@ -809,6 +845,8 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *registry )
HANDLE
hkey
;
HANDLE
hkey
;
DWORD
size
;
DWORD
size
;
expect_driver
=
driver
;
if
((
ret
=
winetest_init
()))
return
ret
;
if
((
ret
=
winetest_init
()))
return
ret
;
if
(
winetest_debug
>
1
)
trace
(
"%s: driver %p
\n
"
,
__func__
,
driver
);
if
(
winetest_debug
>
1
)
trace
(
"%s: driver %p
\n
"
,
__func__
,
driver
);
...
...
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