setupapi/tests: Add more SetupDiCreateDeviceInfo() tests.
SetupDiCreateDeviceInfo() should report last error ERROR_DEVINST_ALREADY_EXISTS when an registered instance exists when creating a device for an empty set. Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0b9b1cbf56
commit
7876234e3a
|
@ -212,6 +212,7 @@ static void test_device_info(void)
|
|||
char id[MAX_DEVICE_ID_LEN + 2];
|
||||
HDEVINFO set;
|
||||
BOOL ret;
|
||||
INT i = 0;
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = SetupDiCreateDeviceInfoA(NULL, NULL, NULL, NULL, NULL, 0, NULL);
|
||||
|
@ -344,6 +345,31 @@ static void test_device_info(void)
|
|||
ok(ret, "Failed to create device, error %#x.\n", GetLastError());
|
||||
|
||||
SetupDiDestroyDeviceInfoList(set);
|
||||
|
||||
set = SetupDiCreateDeviceInfoList(&guid, NULL);
|
||||
ok(set != INVALID_HANDLE_VALUE, "Failed to create device info list, error %#x.\n", GetLastError());
|
||||
ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
|
||||
ok(ret, "Failed to create device, error %#x.\n", GetLastError());
|
||||
ret = SetupDiRegisterDeviceInfo(set , &device, 0, NULL, NULL, NULL);
|
||||
ok(ret, "Failed to register device, error %#x.\n", GetLastError());
|
||||
check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\0000");
|
||||
check_device_info(set, 1, NULL, NULL);
|
||||
SetupDiDestroyDeviceInfoList(set);
|
||||
|
||||
set = SetupDiCreateDeviceInfoList(&guid, NULL);
|
||||
ret = SetupDiCreateDeviceInfoA(set, "Root\\LEGACY_BOGUS\\0000", &guid, NULL, NULL, 0, &device);
|
||||
todo_wine ok(!ret, "Expect failure\n");
|
||||
todo_wine ok(GetLastError() == ERROR_DEVINST_ALREADY_EXISTS, "Got error %#x\n", GetLastError());
|
||||
todo_wine check_device_info(set, 0, NULL, NULL);
|
||||
SetupDiDestroyDeviceInfoList(set);
|
||||
|
||||
set = SetupDiGetClassDevsA(&guid, NULL, NULL, 0);
|
||||
while (SetupDiEnumDeviceInfo(set, i++, &device))
|
||||
{
|
||||
ret = SetupDiRemoveDevice(set, &device);
|
||||
ok(ret, "Failed to remove device, error %#x.\n", GetLastError());
|
||||
}
|
||||
SetupDiDestroyDeviceInfoList(set);
|
||||
}
|
||||
|
||||
static void test_device_property(void)
|
||||
|
|
Loading…
Reference in New Issue