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
c7691595
Commit
c7691595
authored
Jun 01, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Jun 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput/tests: Support test IOCTLs on the bus control interface.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
parent
56113351
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
30 deletions
+84
-30
dinput_test.h
dlls/dinput/tests/dinput_test.h
+16
-9
driver_bus.c
dlls/dinput/tests/driver_bus.c
+22
-8
driver_hid.h
dlls/dinput/tests/driver_hid.h
+2
-0
hid.c
dlls/dinput/tests/hid.c
+44
-13
No files found.
dlls/dinput/tests/dinput_test.h
View file @
c7691595
...
...
@@ -92,14 +92,21 @@ void fill_context_( const char *file, int line, char *buffer, SIZE_T size );
BOOL
sync_ioctl_
(
const
char
*
file
,
int
line
,
HANDLE
device
,
DWORD
code
,
void
*
in_buf
,
DWORD
in_len
,
void
*
out_buf
,
DWORD
*
ret_len
,
DWORD
timeout
);
#define set_hid_expect( a, b, c ) set_hid_expect_( __FILE__, __LINE__, a, b, c )
void
set_hid_expect_
(
const
char
*
file
,
int
line
,
HANDLE
device
,
struct
hid_expect
*
expect
,
DWORD
expect_size
);
#define wait_hid_expect( a, b ) wait_hid_expect_( __FILE__, __LINE__, a, b, FALSE, FALSE )
#define wait_hid_pending( a, b ) wait_hid_expect_( __FILE__, __LINE__, a, b, TRUE, FALSE )
void
wait_hid_expect_
(
const
char
*
file
,
int
line
,
HANDLE
device
,
DWORD
timeout
,
BOOL
wait_pending
,
BOOL
todo
);
#define send_hid_input( a, b, c ) send_hid_input_( __FILE__, __LINE__, a, b, c )
void
send_hid_input_
(
const
char
*
file
,
int
line
,
HANDLE
device
,
struct
hid_expect
*
expect
,
DWORD
expect_size
);
#define set_hid_expect( a, b, c ) set_hid_expect_( __FILE__, __LINE__, a, NULL, b, c )
#define bus_set_hid_expect( a, b, c, d ) set_hid_expect_( __FILE__, __LINE__, a, b, c, d )
void
set_hid_expect_
(
const
char
*
file
,
int
line
,
HANDLE
device
,
struct
hid_device_desc
*
desc
,
struct
hid_expect
*
expect
,
DWORD
expect_size
);
#define wait_hid_expect( a, b ) wait_hid_expect_( __FILE__, __LINE__, a, NULL, b, FALSE, FALSE )
#define wait_hid_pending( a, b ) wait_hid_expect_( __FILE__, __LINE__, a, NULL, b, TRUE, FALSE )
#define bus_wait_hid_expect( a, b, c ) wait_hid_expect_( __FILE__, __LINE__, a, b, c, FALSE, FALSE )
#define bus_wait_hid_pending( a, b, c ) wait_hid_expect_( __FILE__, __LINE__, a, b, c, TRUE, FALSE )
void
wait_hid_expect_
(
const
char
*
file
,
int
line
,
HANDLE
device
,
struct
hid_device_desc
*
desc
,
DWORD
timeout
,
BOOL
wait_pending
,
BOOL
todo
);
#define send_hid_input( a, b, c ) send_hid_input_( __FILE__, __LINE__, a, NULL, b, c )
#define bus_send_hid_input( a, b, c, d ) send_hid_input_( __FILE__, __LINE__, a, b, c, d )
void
send_hid_input_
(
const
char
*
file
,
int
line
,
HANDLE
device
,
struct
hid_device_desc
*
desc
,
struct
hid_expect
*
expect
,
DWORD
expect_size
);
#endif
/* __WINE_DINPUT_TEST_H */
dlls/dinput/tests/driver_bus.c
View file @
c7691595
...
...
@@ -58,8 +58,6 @@ static void check_buffer_( int line, HID_XFER_PACKET *packet, struct hid_expect
}
}
#define EXPECT_QUEUE_BUFFER_SIZE (64 * sizeof(struct hid_expect))
struct
expect_queue
{
KSPIN_LOCK
lock
;
...
...
@@ -1293,12 +1291,13 @@ static NTSTATUS WINAPI pdo_ioctl( DEVICE_OBJECT *device, IRP *irp )
IO_STACK_LOCATION
*
stack
=
IoGetCurrentIrpStackLocation
(
irp
);
struct
phys_device
*
impl
=
pdo_from_DEVICE_OBJECT
(
device
);
ULONG
in_size
=
stack
->
Parameters
.
DeviceIoControl
.
InputBufferLength
;
struct
hid_device_desc
*
desc
=
irp
->
AssociatedIrp
.
SystemBuffer
;
ULONG
code
=
stack
->
Parameters
.
DeviceIoControl
.
IoControlCode
;
NTSTATUS
status
;
if
(
winetest_debug
>
1
)
trace
(
"%s: device %p, code %#lx %s
\n
"
,
__func__
,
device
,
code
,
debugstr_ioctl
(
code
)
);
status
=
pdo_handle_ioctl
(
impl
,
irp
,
code
,
irp
->
AssociatedIrp
.
SystemBuffer
,
in_size
);
status
=
pdo_handle_ioctl
(
impl
,
irp
,
code
,
desc
+
1
,
in_size
-
sizeof
(
*
desc
)
);
if
(
status
!=
STATUS_PENDING
)
{
...
...
@@ -1312,8 +1311,10 @@ static NTSTATUS WINAPI fdo_ioctl( DEVICE_OBJECT *device, IRP *irp )
{
IO_STACK_LOCATION
*
stack
=
IoGetCurrentIrpStackLocation
(
irp
);
ULONG
in_size
=
stack
->
Parameters
.
DeviceIoControl
.
InputBufferLength
;
struct
hid_device_desc
*
desc
=
irp
->
AssociatedIrp
.
SystemBuffer
;
ULONG
code
=
stack
->
Parameters
.
DeviceIoControl
.
IoControlCode
;
struct
func_device
*
impl
=
fdo_from_DEVICE_OBJECT
(
device
);
struct
phys_device
*
pdo
;
NTSTATUS
status
;
if
(
winetest_debug
>
1
)
trace
(
"%s: device %p, code %#lx %s
\n
"
,
__func__
,
device
,
code
,
debugstr_ioctl
(
code
)
);
...
...
@@ -1321,18 +1322,31 @@ static NTSTATUS WINAPI fdo_ioctl( DEVICE_OBJECT *device, IRP *irp )
switch
(
code
)
{
case
IOCTL_WINETEST_CREATE_DEVICE
:
if
(
in_size
<
sizeof
(
struct
hid_device_
desc
))
status
=
STATUS_INVALID_PARAMETER
;
else
status
=
create_child_pdo
(
device
,
irp
->
AssociatedIrp
.
SystemBuffer
);
if
(
in_size
<
sizeof
(
*
desc
))
status
=
STATUS_INVALID_PARAMETER
;
else
status
=
create_child_pdo
(
device
,
desc
);
break
;
case
IOCTL_WINETEST_REMOVE_DEVICE
:
if
((
device
=
find_child_device
(
impl
,
irp
->
AssociatedIrp
.
SystemBuffer
))
&&
!
remove_child_device
(
impl
,
device
))
if
(
in_size
<
sizeof
(
*
desc
))
status
=
STATUS_INVALID_PARAMETER
;
else
if
(
!
(
device
=
find_child_device
(
impl
,
desc
))
||
remove_child_device
(
impl
,
device
))
status
=
STATUS_NO_SUCH_DEVICE
;
else
{
status
=
pdo_ioctl
(
device
,
irp
);
IoInvalidateDeviceRelations
(
impl
->
pdo
,
BusRelations
);
return
status
;
}
status
=
STATUS_NO_SUCH_DEVICE
;
break
;
case
IOCTL_WINETEST_HID_SET_EXPECT
:
case
IOCTL_WINETEST_HID_WAIT_EXPECT
:
case
IOCTL_WINETEST_HID_SEND_INPUT
:
case
IOCTL_WINETEST_HID_SET_CONTEXT
:
if
(
in_size
<
sizeof
(
*
desc
))
status
=
STATUS_INVALID_PARAMETER
;
else
if
(
!
(
device
=
find_child_device
(
impl
,
desc
))
||
!
(
pdo
=
pdo_from_DEVICE_OBJECT
(
device
)))
status
=
STATUS_NO_SUCH_DEVICE
;
else
status
=
pdo_handle_ioctl
(
pdo
,
irp
,
code
,
desc
+
1
,
in_size
-
sizeof
(
*
desc
)
);
break
;
default:
ok
(
0
,
"unexpected call
\n
"
);
...
...
dlls/dinput/tests/driver_hid.h
View file @
c7691595
...
...
@@ -61,6 +61,8 @@ struct hid_expect
BYTE
report_buf
[
128
];
};
#define EXPECT_QUEUE_BUFFER_SIZE (64 * sizeof(struct hid_expect))
struct
wait_expect_params
{
BOOL
wait_pending
;
...
...
dlls/dinput/tests/hid.c
View file @
c7691595
...
...
@@ -909,39 +909,70 @@ void fill_context_( const char *file, int line, char *buffer, SIZE_T size )
snprintf
(
buffer
,
size
,
"%s:%d"
,
source_file
,
line
);
}
void
set_hid_expect_
(
const
char
*
file
,
int
line
,
HANDLE
device
,
struct
hid_expect
*
expect
,
DWORD
expect_size
)
void
set_hid_expect_
(
const
char
*
file
,
int
line
,
HANDLE
device
,
struct
hid_device_desc
*
desc
,
struct
hid_expect
*
expect
,
DWORD
expect_size
)
{
char
context
[
64
];
char
buffer
[
sizeof
(
*
desc
)
+
EXPECT_QUEUE_BUFFER_SIZE
];
SIZE_T
size
;
BOOL
ret
;
fill_context_
(
file
,
line
,
context
,
ARRAY_SIZE
(
context
)
);
ret
=
sync_ioctl_
(
file
,
line
,
device
,
IOCTL_WINETEST_HID_SET_CONTEXT
,
context
,
ARRAY_SIZE
(
context
),
NULL
,
0
,
INFINITE
);
if
(
desc
)
memcpy
(
buffer
,
desc
,
sizeof
(
*
desc
)
);
else
memset
(
buffer
,
0
,
sizeof
(
*
desc
)
);
fill_context_
(
file
,
line
,
buffer
+
sizeof
(
*
desc
),
ARRAY_SIZE
(
buffer
)
-
sizeof
(
*
desc
)
);
size
=
sizeof
(
*
desc
)
+
strlen
(
buffer
+
sizeof
(
*
desc
)
)
+
1
;
ret
=
sync_ioctl_
(
file
,
line
,
device
,
IOCTL_WINETEST_HID_SET_CONTEXT
,
buffer
,
size
,
NULL
,
0
,
INFINITE
);
ok_
(
file
,
line
)(
ret
,
"IOCTL_WINETEST_HID_SET_CONTEXT failed, last error %lu
\n
"
,
GetLastError
()
);
ret
=
sync_ioctl_
(
file
,
line
,
device
,
IOCTL_WINETEST_HID_SET_EXPECT
,
expect
,
expect_size
,
NULL
,
0
,
INFINITE
);
if
(
expect
)
memcpy
(
buffer
+
sizeof
(
*
desc
),
expect
,
expect_size
);
else
memset
(
buffer
+
sizeof
(
*
desc
),
0
,
expect_size
);
size
=
sizeof
(
*
desc
)
+
expect_size
;
ret
=
sync_ioctl_
(
file
,
line
,
device
,
IOCTL_WINETEST_HID_SET_EXPECT
,
buffer
,
size
,
NULL
,
0
,
INFINITE
);
ok_
(
file
,
line
)(
ret
,
"IOCTL_WINETEST_HID_SET_EXPECT failed, last error %lu
\n
"
,
GetLastError
()
);
}
void
wait_hid_expect_
(
const
char
*
file
,
int
line
,
HANDLE
device
,
DWORD
timeout
,
BOOL
wait_pending
,
BOOL
todo
)
void
wait_hid_expect_
(
const
char
*
file
,
int
line
,
HANDLE
device
,
struct
hid_device_desc
*
desc
,
DWORD
timeout
,
BOOL
wait_pending
,
BOOL
todo
)
{
struct
wait_expect_params
params
=
{.
wait_pending
=
wait_pending
};
char
buffer
[
sizeof
(
*
desc
)
+
sizeof
(
params
)];
SIZE_T
size
;
if
(
desc
)
memcpy
(
buffer
,
desc
,
sizeof
(
*
desc
)
);
else
memset
(
buffer
,
0
,
sizeof
(
*
desc
)
);
memcpy
(
buffer
+
sizeof
(
*
desc
),
&
params
,
sizeof
(
params
)
);
size
=
sizeof
(
*
desc
)
+
sizeof
(
params
);
todo_wine_if
(
todo
)
{
BOOL
ret
=
sync_ioctl_
(
file
,
line
,
device
,
IOCTL_WINETEST_HID_WAIT_EXPECT
,
&
params
,
sizeof
(
params
)
,
NULL
,
0
,
timeout
);
BOOL
ret
=
sync_ioctl_
(
file
,
line
,
device
,
IOCTL_WINETEST_HID_WAIT_EXPECT
,
buffer
,
size
,
NULL
,
0
,
timeout
);
ok_
(
file
,
line
)(
ret
,
"IOCTL_WINETEST_HID_WAIT_EXPECT failed, last error %lu
\n
"
,
GetLastError
()
);
}
set_hid_expect_
(
file
,
line
,
device
,
NULL
,
0
);
set_hid_expect_
(
file
,
line
,
device
,
desc
,
NULL
,
0
);
}
void
send_hid_input_
(
const
char
*
file
,
int
line
,
HANDLE
device
,
struct
hid_expect
*
expect
,
DWORD
expect_size
)
void
send_hid_input_
(
const
char
*
file
,
int
line
,
HANDLE
device
,
struct
hid_device_desc
*
desc
,
struct
hid_expect
*
expect
,
DWORD
expect_size
)
{
char
context
[
64
];
char
buffer
[
sizeof
(
*
desc
)
+
EXPECT_QUEUE_BUFFER_SIZE
];
SIZE_T
size
;
BOOL
ret
;
fill_context_
(
file
,
line
,
context
,
ARRAY_SIZE
(
context
)
);
ret
=
sync_ioctl_
(
file
,
line
,
device
,
IOCTL_WINETEST_HID_SET_CONTEXT
,
context
,
ARRAY_SIZE
(
context
),
NULL
,
0
,
INFINITE
);
if
(
desc
)
memcpy
(
buffer
,
desc
,
sizeof
(
*
desc
)
);
else
memset
(
buffer
,
0
,
sizeof
(
*
desc
)
);
fill_context_
(
file
,
line
,
buffer
+
sizeof
(
*
desc
),
ARRAY_SIZE
(
buffer
)
-
sizeof
(
*
desc
)
);
size
=
sizeof
(
*
desc
)
+
strlen
(
buffer
+
sizeof
(
*
desc
)
)
+
1
;
ret
=
sync_ioctl_
(
file
,
line
,
device
,
IOCTL_WINETEST_HID_SET_CONTEXT
,
buffer
,
size
,
NULL
,
0
,
INFINITE
);
ok_
(
file
,
line
)(
ret
,
"IOCTL_WINETEST_HID_SET_CONTEXT failed, last error %lu
\n
"
,
GetLastError
()
);
ret
=
sync_ioctl_
(
file
,
line
,
device
,
IOCTL_WINETEST_HID_SEND_INPUT
,
expect
,
expect_size
,
NULL
,
0
,
INFINITE
);
if
(
expect
)
memcpy
(
buffer
+
sizeof
(
*
desc
),
expect
,
expect_size
);
else
memset
(
buffer
+
sizeof
(
*
desc
),
0
,
expect_size
);
size
=
sizeof
(
*
desc
)
+
expect_size
;
ret
=
sync_ioctl_
(
file
,
line
,
device
,
IOCTL_WINETEST_HID_SEND_INPUT
,
buffer
,
size
,
NULL
,
0
,
INFINITE
);
ok_
(
file
,
line
)(
ret
,
"IOCTL_WINETEST_HID_SEND_INPUT failed, last error %lu
\n
"
,
GetLastError
()
);
}
...
...
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