SetupDiCreateDeviceInfoList returns INVALID_HANDLE_VALUE(~0) on error instead of NULL.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/setupapi/tests/devinst.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c index bfffcb9c32..b4c5ce67ed 100644 --- a/dlls/setupapi/tests/devinst.c +++ b/dlls/setupapi/tests/devinst.c @@ -286,7 +286,7 @@ static void test_device_info(void) ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
set = SetupDiCreateDeviceInfoList(&guid, NULL); - ok(set != NULL, "Failed to create device info, error %#x.\n", GetLastError()); + ok(set && set != INVALID_HANDLE_VALUE, "Failed to create device info, error %#x.\n", GetLastError());
SetLastError(0xdeadbeef); ret = SetupDiCreateDeviceInfoA(set, "Root\LEGACY_BOGUS\0000", NULL, NULL, NULL, 0, NULL); @@ -366,7 +366,7 @@ static void test_device_info(void) SetupDiDestroyDeviceInfoList(set);
set = SetupDiCreateDeviceInfoList(NULL, NULL); - ok(set != NULL, "Failed to create device info, error %#x.\n", GetLastError()); + ok(set && set != INVALID_HANDLE_VALUE, "Failed to create device info, error %#x.\n", GetLastError());
SetLastError(0xdeadbeef); ret = SetupDiCreateDeviceInfoA(set, "Root\LEGACY_BOGUS\0000", NULL, NULL, NULL, 0, NULL); @@ -427,7 +427,7 @@ static void test_get_device_instance_id(void) ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
set = SetupDiCreateDeviceInfoList(&guid, NULL); - ok(set != NULL, "Failed to create device list, error %#x.\n", GetLastError()); + ok(set && set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
SetLastError(0xdeadbeef); ret = SetupDiGetDeviceInstanceIdA(set, NULL, NULL, 0, NULL); @@ -485,7 +485,7 @@ static void test_register_device_info(void) ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
set = SetupDiCreateDeviceInfoList(&guid, NULL); - ok(set != NULL, "Failed to create device list, error %#x.\n", GetLastError()); + ok(set && set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
SetLastError(0xdeadbeef); ret = SetupDiRegisterDeviceInfo(set, NULL, 0, NULL, NULL, NULL); @@ -528,7 +528,7 @@ static void test_register_device_info(void) SetupDiDestroyDeviceInfoList(set);
set = SetupDiGetClassDevsA(&guid, NULL, NULL, 0); - ok(set != NULL, "Failed to create device list, error %#x.\n", GetLastError()); + ok(set && set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
check_device_info(set, 0, &guid, "Root\LEGACY_BOGUS\0000"); check_device_info(set, 1, &guid, "Root\LEGACY_BOGUS\0002"); @@ -596,7 +596,7 @@ static void test_device_iface(void) ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
set = SetupDiCreateDeviceInfoList(&guid, NULL); - ok(set != NULL, "Failed to create device list, error %#x.\n", GetLastError()); + ok(set && set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
SetLastError(0xdeadbeef); ret = SetupDiCreateDeviceInterfaceA(set, NULL, NULL, NULL, 0, NULL); @@ -697,7 +697,7 @@ static void test_device_iface_detail(void) ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
set = SetupDiCreateDeviceInfoList(&guid, NULL); - ok(set != NULL, "Failed to create device list, error %#x.\n", GetLastError()); + ok(set && set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
SetLastError(0xdeadbeef); ret = SetupDiGetDeviceInterfaceDetailA(set, NULL, NULL, 0, NULL, NULL); @@ -787,7 +787,7 @@ static void test_device_key(void) ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
set = SetupDiCreateDeviceInfoList(&guid, NULL); - ok(set != NULL, "Failed to create device list, error %#x.\n", GetLastError()); + ok(set && set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
res = RegOpenKeyW(HKEY_LOCAL_MACHINE, bogus, &key); ok(res != ERROR_SUCCESS, "Key should not exist.\n");
On 12/17/2018 09:52 AM, Zhiyi Zhang wrote:
SetupDiCreateDeviceInfoList returns INVALID_HANDLE_VALUE(~0) on error instead of NULL.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com
dlls/setupapi/tests/devinst.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c index bfffcb9c32..b4c5ce67ed 100644 --- a/dlls/setupapi/tests/devinst.c +++ b/dlls/setupapi/tests/devinst.c @@ -286,7 +286,7 @@ static void test_device_info(void) ok(GetLastError() == ERROR_INVALID_HANDLE, "Got unexpected error %#x.\n", GetLastError());
set = SetupDiCreateDeviceInfoList(&guid, NULL);
- ok(set != NULL, "Failed to create device info, error %#x.\n", GetLastError());
- ok(set && set != INVALID_HANDLE_VALUE, "Failed to create device info, error %#x.\n", GetLastError());
Is there a reason that we're still checking if it's null, then?