ntoskrnl/tests: Expand tests for device and interface naming.
This commit is contained in:
parent
d05b88dd88
commit
297e4ae76b
2 changed files with 38 additions and 6 deletions
|
@ -34,6 +34,19 @@
|
|||
#include "driver.h"
|
||||
#include "utils.h"
|
||||
|
||||
/* memcmp() isn't exported from ntoskrnl on i386 */
|
||||
static int kmemcmp( const void *ptr1, const void *ptr2, size_t n )
|
||||
{
|
||||
const unsigned char *p1, *p2;
|
||||
|
||||
for (p1 = ptr1, p2 = ptr2; n; n--, p1++, p2++)
|
||||
{
|
||||
if (*p1 < *p2) return -1;
|
||||
if (*p1 > *p2) return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const GUID bus_class = {0xdeadbeef, 0x29ef, 0x4538, {0xa5, 0xfd, 0xb6, 0x95, 0x73, 0xa3, 0x62, 0xc1}};
|
||||
static const GUID child_class = {0xdeadbeef, 0x29ef, 0x4538, {0xa5, 0xfd, 0xb6, 0x95, 0x73, 0xa3, 0x62, 0xc2}};
|
||||
static UNICODE_STRING control_symlink, bus_symlink;
|
||||
|
@ -178,7 +191,7 @@ static NTSTATUS fdo_pnp(IRP *irp)
|
|||
|
||||
static NTSTATUS query_id(struct device *device, IRP *irp, BUS_QUERY_ID_TYPE type)
|
||||
{
|
||||
static const WCHAR device_id[] = L"wine\\test";
|
||||
static const WCHAR device_id[] = L"Wine\\Test";
|
||||
WCHAR *id = NULL;
|
||||
|
||||
irp->IoStatus.Information = 0;
|
||||
|
@ -256,6 +269,7 @@ static NTSTATUS pdo_pnp(DEVICE_OBJECT *device_obj, IRP *irp)
|
|||
|
||||
case IRP_MN_START_DEVICE:
|
||||
{
|
||||
static const WCHAR expect_symlink[] = L"\\??\\Wine#Test#1#{deadbeef-29ef-4538-a5fd-b69573a362c2}";
|
||||
static const LARGE_INTEGER wait_time = {.QuadPart = -500 * 10000};
|
||||
POWER_STATE state = {.DeviceState = PowerDeviceD0};
|
||||
NTSTATUS status;
|
||||
|
@ -267,6 +281,12 @@ static NTSTATUS pdo_pnp(DEVICE_OBJECT *device_obj, IRP *irp)
|
|||
|
||||
status = IoRegisterDeviceInterface(device_obj, &child_class, NULL, &device->child_symlink);
|
||||
ok(!status, "Failed to register interface, status %#lx.\n", status);
|
||||
ok(device->child_symlink.Length == sizeof(expect_symlink) - sizeof(WCHAR),
|
||||
"Got length %u.\n", device->child_symlink.Length);
|
||||
ok(device->child_symlink.MaximumLength == sizeof(expect_symlink),
|
||||
"Got maximum length %u.\n", device->child_symlink.MaximumLength);
|
||||
todo_wine ok(!kmemcmp(device->child_symlink.Buffer, expect_symlink, device->child_symlink.MaximumLength),
|
||||
"Got symlink \"%ls\".\n", device->child_symlink.Buffer);
|
||||
|
||||
IoSetDeviceInterfaceState(&device->child_symlink, TRUE);
|
||||
|
||||
|
|
|
@ -1406,7 +1406,7 @@ static LRESULT WINAPI device_notify_proc(HWND window, UINT message, WPARAM wpara
|
|||
else if (IsEqualGUID(&iface->dbcc_classguid, &child_class))
|
||||
{
|
||||
++got_child_arrival;
|
||||
todo_wine ok(!strcmp(iface->dbcc_name, "\\\\?\\wine#test#1#{deadbeef-29ef-4538-a5fd-b69573a362c2}"),
|
||||
todo_wine ok(!strcmp(iface->dbcc_name, "\\\\?\\Wine#Test#1#{deadbeef-29ef-4538-a5fd-b69573a362c2}"),
|
||||
"got name %s\n", debugstr_a(iface->dbcc_name));
|
||||
}
|
||||
break;
|
||||
|
@ -1434,7 +1434,7 @@ static LRESULT WINAPI device_notify_proc(HWND window, UINT message, WPARAM wpara
|
|||
else if (IsEqualGUID(&iface->dbcc_classguid, &child_class))
|
||||
{
|
||||
++got_child_removal;
|
||||
todo_wine ok(!strcmp(iface->dbcc_name, "\\\\?\\wine#test#1#{deadbeef-29ef-4538-a5fd-b69573a362c2}"),
|
||||
todo_wine ok(!strcmp(iface->dbcc_name, "\\\\?\\Wine#Test#1#{deadbeef-29ef-4538-a5fd-b69573a362c2}"),
|
||||
"got name %s\n", debugstr_a(iface->dbcc_name));
|
||||
}
|
||||
break;
|
||||
|
@ -1506,7 +1506,7 @@ static void test_pnp_devices(void)
|
|||
|
||||
ret = SetupDiGetDeviceInstanceIdA(set, &device, buffer, sizeof(buffer), NULL);
|
||||
ok(ret, "failed to get device ID, error %#lx\n", GetLastError());
|
||||
ok(!strcasecmp(buffer, "root\\winetest\\0"), "got ID %s\n", debugstr_a(buffer));
|
||||
ok(!strcmp(buffer, "ROOT\\WINETEST\\0"), "got ID %s\n", debugstr_a(buffer));
|
||||
|
||||
ret = SetupDiEnumDeviceInterfaces(set, NULL, &control_class, 0, &iface);
|
||||
ok(ret, "failed to get interface, error %#lx\n", GetLastError());
|
||||
|
@ -1517,7 +1517,7 @@ static void test_pnp_devices(void)
|
|||
iface_detail->cbSize = sizeof(*iface_detail);
|
||||
ret = SetupDiGetDeviceInterfaceDetailA(set, &iface, iface_detail, sizeof(buffer), NULL, NULL);
|
||||
ok(ret, "failed to get interface path, error %#lx\n", GetLastError());
|
||||
ok(!strcasecmp(iface_detail->DevicePath, "\\\\?\\root#winetest#0#{deadbeef-29ef-4538-a5fd-b69573a362c0}"),
|
||||
ok(!strcmp(iface_detail->DevicePath, "\\\\?\\root#winetest#0#{deadbeef-29ef-4538-a5fd-b69573a362c0}"),
|
||||
"wrong path %s\n", debugstr_a(iface_detail->DevicePath));
|
||||
|
||||
SetupDiDestroyDeviceInfoList(set);
|
||||
|
@ -1614,7 +1614,7 @@ static void test_pnp_devices(void)
|
|||
|
||||
ret = SetupDiGetDeviceInstanceIdA(set, &device, buffer, sizeof(buffer), NULL);
|
||||
ok(ret, "failed to get device ID, error %#lx\n", GetLastError());
|
||||
ok(!strcasecmp(buffer, "wine\\test\\1"), "got ID %s\n", debugstr_a(buffer));
|
||||
ok(!strcmp(buffer, "WINE\\TEST\\1"), "got ID %s\n", debugstr_a(buffer));
|
||||
|
||||
ret = SetupDiGetDeviceRegistryPropertyA(set, &device, SPDRP_CAPABILITIES,
|
||||
&type, (BYTE *)&dword, sizeof(dword), NULL);
|
||||
|
@ -1680,6 +1680,18 @@ static void test_pnp_devices(void)
|
|||
ok(!strcmp(buffer, "\\Device\\winetest_pnp_1"), "got PDO name %s\n", debugstr_a(buffer));
|
||||
}
|
||||
|
||||
ret = SetupDiEnumDeviceInterfaces(set, NULL, &child_class, 0, &iface);
|
||||
ok(ret, "failed to get interface, error %#lx\n", GetLastError());
|
||||
ok(IsEqualGUID(&iface.InterfaceClassGuid, &child_class),
|
||||
"wrong class %s\n", debugstr_guid(&iface.InterfaceClassGuid));
|
||||
ok(iface.Flags == SPINT_ACTIVE, "got flags %#lx\n", iface.Flags);
|
||||
|
||||
iface_detail->cbSize = sizeof(*iface_detail);
|
||||
ret = SetupDiGetDeviceInterfaceDetailA(set, &iface, iface_detail, sizeof(buffer), NULL, NULL);
|
||||
ok(ret, "failed to get interface path, error %#lx\n", GetLastError());
|
||||
ok(!strcmp(iface_detail->DevicePath, "\\\\?\\wine#test#1#{deadbeef-29ef-4538-a5fd-b69573a362c2}"),
|
||||
"wrong path %s\n", debugstr_a(iface_detail->DevicePath));
|
||||
|
||||
SetupDiDestroyDeviceInfoList(set);
|
||||
|
||||
RtlInitUnicodeString(&string, L"\\Device\\winetest_pnp_1");
|
||||
|
|
Loading…
Add table
Reference in a new issue