dinput/tests: Add more debug traces to the HID driver.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
194ba06c40
commit
4c336655c9
|
@ -411,11 +411,12 @@ static NTSTATUS WINAPI driver_pnp( DEVICE_OBJECT *device, IRP *irp )
|
|||
IO_STACK_LOCATION *stack = IoGetCurrentIrpStackLocation( irp );
|
||||
HID_DEVICE_EXTENSION *ext = device->DeviceExtension;
|
||||
struct hid_device *impl = ext->MiniDeviceExtension;
|
||||
ULONG code = stack->MinorFunction;
|
||||
KIRQL irql;
|
||||
|
||||
if (winetest_debug > 1) trace( "pnp %#x\n", stack->MinorFunction );
|
||||
if (winetest_debug > 1) trace( "%s: device %p, code %#lx %s\n", __func__, device, code, debugstr_pnp(code) );
|
||||
|
||||
switch (stack->MinorFunction)
|
||||
switch (code)
|
||||
{
|
||||
case IRP_MN_START_DEVICE:
|
||||
++got_start_device;
|
||||
|
@ -502,7 +503,7 @@ static NTSTATUS WINAPI driver_internal_ioctl( DEVICE_OBJECT *device, IRP *irp )
|
|||
KIRQL irql;
|
||||
LONG index;
|
||||
|
||||
if (winetest_debug > 1) trace( "ioctl %#lx\n", code );
|
||||
if (winetest_debug > 1) trace( "%s: device %p, code %#lx %s\n", __func__, device, code, debugstr_ioctl(code) );
|
||||
|
||||
ok( got_start_device, "expected IRP_MN_START_DEVICE before any ioctls\n" );
|
||||
|
||||
|
@ -725,6 +726,8 @@ static NTSTATUS WINAPI driver_ioctl( DEVICE_OBJECT *device, IRP *irp )
|
|||
ULONG code = stack->Parameters.DeviceIoControl.IoControlCode;
|
||||
KIRQL irql;
|
||||
|
||||
if (winetest_debug > 1) trace( "%s: device %p, code %#lx %s\n", __func__, device, code, debugstr_ioctl(code) );
|
||||
|
||||
switch (code)
|
||||
{
|
||||
case IOCTL_WINETEST_HID_SET_EXPECT:
|
||||
|
@ -752,27 +755,32 @@ static NTSTATUS WINAPI driver_ioctl( DEVICE_OBJECT *device, IRP *irp )
|
|||
return hidclass_driver_ioctl( device, irp );
|
||||
}
|
||||
|
||||
static NTSTATUS WINAPI driver_add_device( DRIVER_OBJECT *driver, DEVICE_OBJECT *fdo )
|
||||
static NTSTATUS WINAPI driver_add_device( DRIVER_OBJECT *driver, DEVICE_OBJECT *device )
|
||||
{
|
||||
HID_DEVICE_EXTENSION *ext = fdo->DeviceExtension;
|
||||
HID_DEVICE_EXTENSION *ext = device->DeviceExtension;
|
||||
NTSTATUS ret;
|
||||
|
||||
if (winetest_debug > 1) trace( "%s: driver %p, device %p\n", __func__, driver, device );
|
||||
|
||||
/* We should be given the FDO, not the PDO. */
|
||||
ok( !!ext->PhysicalDeviceObject, "expected non-NULL pdo\n" );
|
||||
ok( ext->NextDeviceObject == ext->PhysicalDeviceObject, "got pdo %p, next %p\n",
|
||||
ext->PhysicalDeviceObject, ext->NextDeviceObject );
|
||||
todo_wine
|
||||
ok( ext->NextDeviceObject->AttachedDevice == fdo, "wrong attached device\n" );
|
||||
ok( ext->NextDeviceObject->AttachedDevice == device, "wrong attached device\n" );
|
||||
|
||||
ret = IoRegisterDeviceInterface( ext->PhysicalDeviceObject, &control_class, NULL, &control_symlink );
|
||||
ok( !ret, "got %#lx\n", ret );
|
||||
|
||||
fdo->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
if (winetest_debug > 1) trace( "Created HID FDO %p for Bus PDO %p\n", device, ext->PhysicalDeviceObject );
|
||||
|
||||
device->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static NTSTATUS WINAPI driver_create( DEVICE_OBJECT *device, IRP *irp )
|
||||
{
|
||||
if (winetest_debug > 1) trace( "%s: device %p\n", __func__, device );
|
||||
ok( 0, "unexpected call\n" );
|
||||
irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
IoCompleteRequest( irp, IO_NO_INCREMENT );
|
||||
|
@ -781,6 +789,7 @@ static NTSTATUS WINAPI driver_create( DEVICE_OBJECT *device, IRP *irp )
|
|||
|
||||
static NTSTATUS WINAPI driver_close( DEVICE_OBJECT *device, IRP *irp )
|
||||
{
|
||||
if (winetest_debug > 1) trace( "%s: device %p\n", __func__, device );
|
||||
ok( 0, "unexpected call\n" );
|
||||
irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
IoCompleteRequest( irp, IO_NO_INCREMENT );
|
||||
|
@ -789,6 +798,7 @@ static NTSTATUS WINAPI driver_close( DEVICE_OBJECT *device, IRP *irp )
|
|||
|
||||
static void WINAPI driver_unload( DRIVER_OBJECT *driver )
|
||||
{
|
||||
if (winetest_debug > 1) trace( "%s: driver %p\n", __func__, driver );
|
||||
input_queue_cleanup( &input_queue );
|
||||
expect_queue_cleanup( &expect_queue );
|
||||
winetest_cleanup();
|
||||
|
@ -812,6 +822,7 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *registry )
|
|||
DWORD size;
|
||||
|
||||
if ((ret = winetest_init())) return ret;
|
||||
if (winetest_debug > 1) trace( "%s: driver %p\n", __func__, driver );
|
||||
|
||||
InitializeObjectAttributes( &attr, registry, 0, NULL, NULL );
|
||||
ret = ZwOpenKey( &hkey, KEY_ALL_ACCESS, &attr );
|
||||
|
@ -833,6 +844,8 @@ NTSTATUS WINAPI DriverEntry( DRIVER_OBJECT *driver, UNICODE_STRING *registry )
|
|||
ok( !ret, "ZwQueryValueKey returned %#lx\n", ret );
|
||||
memcpy( &polled, buffer + info_size, size - info_size );
|
||||
params.DevicesArePolled = polled;
|
||||
/* polled mode calls this in a state where printing anything locks the system up */
|
||||
if (polled) winetest_debug = 0;
|
||||
|
||||
RtlInitUnicodeString( &name_str, L"Descriptor" );
|
||||
size = info_size + sizeof(report_descriptor_buf);
|
||||
|
|
|
@ -31,9 +31,11 @@
|
|||
#define WIN32_NO_STATUS
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winioctl.h"
|
||||
#include "winternl.h"
|
||||
|
||||
#include "ddk/wdm.h"
|
||||
#include "ddk/hidclass.h"
|
||||
|
||||
DEFINE_GUID(control_class,0xdeadbeef,0x29ef,0x4538,0xa5,0xfd,0xb6,0x95,0x73,0xa3,0x62,0xc0);
|
||||
|
||||
|
@ -65,6 +67,79 @@ struct winetest_shared_data
|
|||
LONG todo_failures;
|
||||
};
|
||||
|
||||
static inline const char *debugstr_pnp( ULONG code )
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
case IRP_MN_START_DEVICE: return "IRP_MN_START_DEVICE";
|
||||
case IRP_MN_QUERY_REMOVE_DEVICE: return "IRP_MN_QUERY_REMOVE_DEVICE";
|
||||
case IRP_MN_REMOVE_DEVICE: return "IRP_MN_REMOVE_DEVICE";
|
||||
case IRP_MN_CANCEL_REMOVE_DEVICE: return "IRP_MN_CANCEL_REMOVE_DEVICE";
|
||||
case IRP_MN_STOP_DEVICE: return "IRP_MN_STOP_DEVICE";
|
||||
case IRP_MN_QUERY_STOP_DEVICE: return "IRP_MN_QUERY_STOP_DEVICE";
|
||||
case IRP_MN_CANCEL_STOP_DEVICE: return "IRP_MN_CANCEL_STOP_DEVICE";
|
||||
case IRP_MN_QUERY_DEVICE_RELATIONS: return "IRP_MN_QUERY_DEVICE_RELATIONS";
|
||||
case IRP_MN_QUERY_INTERFACE: return "IRP_MN_QUERY_INTERFACE";
|
||||
case IRP_MN_QUERY_CAPABILITIES: return "IRP_MN_QUERY_CAPABILITIES";
|
||||
case IRP_MN_QUERY_RESOURCES: return "IRP_MN_QUERY_RESOURCES";
|
||||
case IRP_MN_QUERY_RESOURCE_REQUIREMENTS: return "IRP_MN_QUERY_RESOURCE_REQUIREMENTS";
|
||||
case IRP_MN_QUERY_DEVICE_TEXT: return "IRP_MN_QUERY_DEVICE_TEXT";
|
||||
case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: return "IRP_MN_FILTER_RESOURCE_REQUIREMENTS";
|
||||
case IRP_MN_READ_CONFIG: return "IRP_MN_READ_CONFIG";
|
||||
case IRP_MN_WRITE_CONFIG: return "IRP_MN_WRITE_CONFIG";
|
||||
case IRP_MN_EJECT: return "IRP_MN_EJECT";
|
||||
case IRP_MN_SET_LOCK: return "IRP_MN_SET_LOCK";
|
||||
case IRP_MN_QUERY_ID: return "IRP_MN_QUERY_ID";
|
||||
case IRP_MN_QUERY_PNP_DEVICE_STATE: return "IRP_MN_QUERY_PNP_DEVICE_STATE";
|
||||
case IRP_MN_QUERY_BUS_INFORMATION: return "IRP_MN_QUERY_BUS_INFORMATION";
|
||||
case IRP_MN_DEVICE_USAGE_NOTIFICATION: return "IRP_MN_DEVICE_USAGE_NOTIFICATION";
|
||||
case IRP_MN_SURPRISE_REMOVAL: return "IRP_MN_SURPRISE_REMOVAL";
|
||||
case IRP_MN_QUERY_LEGACY_BUS_INFORMATION: return "IRP_MN_QUERY_LEGACY_BUS_INFORMATION";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
static inline const char *debugstr_ioctl( ULONG code )
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
case HID_CTL_CODE(0): return "IOCTL_HID_GET_DEVICE_DESCRIPTOR";
|
||||
case HID_CTL_CODE(1): return "IOCTL_HID_GET_REPORT_DESCRIPTOR";
|
||||
case HID_CTL_CODE(2): return "IOCTL_HID_READ_REPORT";
|
||||
case HID_CTL_CODE(3): return "IOCTL_HID_WRITE_REPORT";
|
||||
case HID_CTL_CODE(4): return "IOCTL_HID_GET_STRING";
|
||||
case HID_CTL_CODE(7): return "IOCTL_HID_ACTIVATE_DEVICE";
|
||||
case HID_CTL_CODE(8): return "IOCTL_HID_DEACTIVATE_DEVICE";
|
||||
case HID_CTL_CODE(9): return "IOCTL_HID_GET_DEVICE_ATTRIBUTES";
|
||||
case HID_CTL_CODE(10): return "IOCTL_HID_SEND_IDLE_NOTIFICATION_REQUEST";
|
||||
case HID_OUT_CTL_CODE(102): return "IOCTL_GET_PHYSICAL_DESCRIPTOR";
|
||||
case HID_CTL_CODE(101): return "IOCTL_HID_FLUSH_QUEUE";
|
||||
case HID_CTL_CODE(100): return "IOCTL_HID_GET_COLLECTION_DESCRIPTOR";
|
||||
case HID_BUFFER_CTL_CODE(106): return "IOCTL_HID_GET_COLLECTION_INFORMATION";
|
||||
case HID_OUT_CTL_CODE(100): return "IOCTL_HID_GET_FEATURE";
|
||||
case HID_OUT_CTL_CODE(103): return "IOCTL_HID_GET_HARDWARE_ID";
|
||||
case HID_OUT_CTL_CODE(120): return "IOCTL_HID_GET_INDEXED_STRING";
|
||||
case HID_OUT_CTL_CODE(104): return "IOCTL_HID_GET_INPUT_REPORT";
|
||||
case HID_OUT_CTL_CODE(110): return "IOCTL_HID_GET_MANUFACTURER_STRING";
|
||||
case HID_BUFFER_CTL_CODE(104): return "IOCTL_GET_NUM_DEVICE_INPUT_BUFFERS";
|
||||
case HID_BUFFER_CTL_CODE(102): return "IOCTL_HID_GET_POLL_FREQUENCY_MSEC";
|
||||
case HID_OUT_CTL_CODE(111): return "IOCTL_HID_GET_PRODUCT_STRING";
|
||||
case HID_OUT_CTL_CODE(112): return "IOCTL_HID_GET_SERIALNUMBER_STRING";
|
||||
case HID_IN_CTL_CODE(100): return "IOCTL_HID_SET_FEATURE";
|
||||
case HID_BUFFER_CTL_CODE(105): return "IOCTL_SET_NUM_DEVICE_INPUT_BUFFERS";
|
||||
case HID_IN_CTL_CODE(101): return "IOCTL_HID_SET_OUTPUT_REPORT";
|
||||
case HID_BUFFER_CTL_CODE(103): return "IOCTL_HID_SET_POLL_FREQUENCY_MSEC";
|
||||
case HID_BUFFER_CTL_CODE(100): return "IOCTL_HID_GET_DRIVER_CONFIG";
|
||||
case HID_BUFFER_CTL_CODE(101): return "IOCTL_HID_SET_DRIVER_CONFIG";
|
||||
case HID_OUT_CTL_CODE(121): return "IOCTL_HID_GET_MS_GENRE_DESCRIPTOR";
|
||||
case IOCTL_WINETEST_HID_SET_EXPECT: return "IOCTL_WINETEST_HID_SET_EXPECT";
|
||||
case IOCTL_WINETEST_HID_WAIT_EXPECT: return "IOCTL_WINETEST_HID_WAIT_EXPECT";
|
||||
case IOCTL_WINETEST_HID_SEND_INPUT: return "IOCTL_WINETEST_HID_SEND_INPUT";
|
||||
case IOCTL_WINETEST_HID_SET_CONTEXT: return "IOCTL_WINETEST_HID_SET_CONTEXT";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef __WINE_WINE_TEST_H
|
||||
|
||||
#if !defined( __WINE_USE_MSVCRT ) || defined( __MINGW32__ )
|
||||
|
|
Loading…
Reference in New Issue