Commit 709e31ff authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dinput/tests: Create a child PDO from the Bus driver.

parent 657e07ae
...@@ -772,6 +772,13 @@ static NTSTATUS WINAPI driver_ioctl( DEVICE_OBJECT *device, IRP *irp ) ...@@ -772,6 +772,13 @@ static NTSTATUS WINAPI driver_ioctl( DEVICE_OBJECT *device, IRP *irp )
irp->IoStatus.Status = STATUS_SUCCESS; irp->IoStatus.Status = STATUS_SUCCESS;
IoCompleteRequest( irp, IO_NO_INCREMENT ); IoCompleteRequest( irp, IO_NO_INCREMENT );
return STATUS_SUCCESS; return STATUS_SUCCESS;
case IOCTL_WINETEST_REMOVE_DEVICE:
case IOCTL_WINETEST_CREATE_DEVICE:
ok( 0, "unexpected call\n" );
irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
IoCompleteRequest( irp, IO_NO_INCREMENT );
return STATUS_NOT_SUPPORTED;
} }
return hidclass_driver_ioctl( device, irp ); return hidclass_driver_ioctl( device, irp );
......
...@@ -43,6 +43,8 @@ DEFINE_GUID(control_class,0xdeadbeef,0x29ef,0x4538,0xa5,0xfd,0xb6,0x95,0x73,0xa3 ...@@ -43,6 +43,8 @@ DEFINE_GUID(control_class,0xdeadbeef,0x29ef,0x4538,0xa5,0xfd,0xb6,0x95,0x73,0xa3
#define IOCTL_WINETEST_HID_WAIT_EXPECT CTL_CODE(FILE_DEVICE_KEYBOARD, 0x801, METHOD_NEITHER, FILE_ANY_ACCESS) #define IOCTL_WINETEST_HID_WAIT_EXPECT CTL_CODE(FILE_DEVICE_KEYBOARD, 0x801, METHOD_NEITHER, FILE_ANY_ACCESS)
#define IOCTL_WINETEST_HID_SEND_INPUT CTL_CODE(FILE_DEVICE_KEYBOARD, 0x802, METHOD_IN_DIRECT, FILE_ANY_ACCESS) #define IOCTL_WINETEST_HID_SEND_INPUT CTL_CODE(FILE_DEVICE_KEYBOARD, 0x802, METHOD_IN_DIRECT, FILE_ANY_ACCESS)
#define IOCTL_WINETEST_HID_SET_CONTEXT CTL_CODE(FILE_DEVICE_KEYBOARD, 0x803, METHOD_IN_DIRECT, FILE_ANY_ACCESS) #define IOCTL_WINETEST_HID_SET_CONTEXT CTL_CODE(FILE_DEVICE_KEYBOARD, 0x803, METHOD_IN_DIRECT, FILE_ANY_ACCESS)
#define IOCTL_WINETEST_CREATE_DEVICE CTL_CODE(FILE_DEVICE_KEYBOARD, 0x804, METHOD_IN_DIRECT, FILE_ANY_ACCESS)
#define IOCTL_WINETEST_REMOVE_DEVICE CTL_CODE(FILE_DEVICE_KEYBOARD, 0x805, METHOD_IN_DIRECT, FILE_ANY_ACCESS)
struct hid_expect struct hid_expect
{ {
...@@ -57,6 +59,13 @@ struct hid_expect ...@@ -57,6 +59,13 @@ struct hid_expect
BYTE report_buf[128]; BYTE report_buf[128];
}; };
/* create/remove device */
struct bus_device_desc
{
WORD vid;
WORD pid;
};
/* kernel/user shared data */ /* kernel/user shared data */
struct winetest_shared_data struct winetest_shared_data
{ {
...@@ -136,6 +145,8 @@ static inline const char *debugstr_ioctl( ULONG code ) ...@@ -136,6 +145,8 @@ static inline const char *debugstr_ioctl( ULONG code )
case IOCTL_WINETEST_HID_WAIT_EXPECT: return "IOCTL_WINETEST_HID_WAIT_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_SEND_INPUT: return "IOCTL_WINETEST_HID_SEND_INPUT";
case IOCTL_WINETEST_HID_SET_CONTEXT: return "IOCTL_WINETEST_HID_SET_CONTEXT"; case IOCTL_WINETEST_HID_SET_CONTEXT: return "IOCTL_WINETEST_HID_SET_CONTEXT";
case IOCTL_WINETEST_CREATE_DEVICE: return "IOCTL_WINETEST_CREATE_DEVICE";
case IOCTL_WINETEST_REMOVE_DEVICE: return "IOCTL_WINETEST_REMOVE_DEVICE";
default: return "unknown"; default: return "unknown";
} }
} }
......
...@@ -427,7 +427,8 @@ static void unload_driver( SC_HANDLE service ) ...@@ -427,7 +427,8 @@ static void unload_driver( SC_HANDLE service )
ret = QueryServiceStatus( service, &status ); ret = QueryServiceStatus( service, &status );
ok( ret, "QueryServiceStatus failed: %lu\n", GetLastError() ); ok( ret, "QueryServiceStatus failed: %lu\n", GetLastError() );
} }
ok( status.dwCurrentState == SERVICE_STOPPED, "expected SERVICE_STOPPED, got %lu\n", status.dwCurrentState ); ok( status.dwCurrentState == SERVICE_STOPPED || !status.dwCurrentState,
"expected SERVICE_STOPPED, got %lu\n", status.dwCurrentState );
DeleteService( service ); DeleteService( service );
CloseServiceHandle( service ); CloseServiceHandle( service );
...@@ -493,8 +494,8 @@ static void pnp_driver_stop( BOOL bus ) ...@@ -493,8 +494,8 @@ static void pnp_driver_stop( BOOL bus )
GetFullPathNameW( L"winetest.inf", ARRAY_SIZE(path), path, NULL ); GetFullPathNameW( L"winetest.inf", ARRAY_SIZE(path), path, NULL );
ret = SetupCopyOEMInfW( path, NULL, 0, 0, dest, ARRAY_SIZE(dest), NULL, &filepart ); ret = SetupCopyOEMInfW( path, NULL, 0, 0, dest, ARRAY_SIZE(dest), NULL, &filepart );
ok( ret, "Failed to copy INF, error %lu\n", GetLastError() ); ok( ret, "Failed to copy INF, error %lu\n", GetLastError() );
ret = SetupUninstallOEMInfW( filepart, 0, NULL ); ret = SetupUninstallOEMInfW( filepart, SUOI_FORCEDELETE, NULL );
ok( ret, "Failed to uninstall INF, error %lu\n", GetLastError() ); ok( ret, "Failed to uninstall INF, error %lx\n", GetLastError() );
ret = DeleteFileW( L"winetest.cat" ); ret = DeleteFileW( L"winetest.cat" );
ok( ret, "Failed to delete file, error %lu\n", GetLastError() ); ok( ret, "Failed to delete file, error %lu\n", GetLastError() );
...@@ -3611,7 +3612,12 @@ DWORD WINAPI dinput_test_device_thread( void *stop_event ) ...@@ -3611,7 +3612,12 @@ DWORD WINAPI dinput_test_device_thread( void *stop_event )
static void test_bus_driver(void) static void test_bus_driver(void)
{ {
struct bus_device_desc desc =
{
.vid = LOWORD(EXPECT_VIDPID), .pid = HIWORD(EXPECT_VIDPID),
};
HANDLE control; HANDLE control;
BOOL ret;
if (!bus_device_start()) goto done; if (!bus_device_start()) goto done;
...@@ -3631,6 +3637,11 @@ static void test_bus_driver(void) ...@@ -3631,6 +3637,11 @@ static void test_bus_driver(void)
control = CreateFileW( L"\\\\?\\root#winetest#0#{deadbeef-29ef-4538-a5fd-b69573a362c0}", 0, 0, control = CreateFileW( L"\\\\?\\root#winetest#0#{deadbeef-29ef-4538-a5fd-b69573a362c0}", 0, 0,
NULL, OPEN_EXISTING, 0, NULL ); NULL, OPEN_EXISTING, 0, NULL );
ok( control != INVALID_HANDLE_VALUE, "CreateFile failed, error %lu\n", GetLastError() ); ok( control != INVALID_HANDLE_VALUE, "CreateFile failed, error %lu\n", GetLastError() );
ret = sync_ioctl( control, IOCTL_WINETEST_CREATE_DEVICE, &desc, sizeof(desc), NULL, 0, INFINITE );
ok( ret, "IOCTL_WINETEST_CREATE_DEVICE failed, last error %lu\n", GetLastError() );
ret = sync_ioctl( control, IOCTL_WINETEST_REMOVE_DEVICE, &desc, sizeof(desc), NULL, 0, INFINITE );
ok( ret, "IOCTL_WINETEST_REMOVE_DEVICE failed, last error %lu\n", GetLastError() );
CloseHandle( control ); CloseHandle( control );
done: done:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment