From: Jeff Smith Subject: [PATCH 2/3] setupapi/tests: Add error tests for SetupDiDestroyDeviceInfoList. Message-Id: <20200608015436.983250-2-whydoubt@gmail.com> Date: Sun, 7 Jun 2020 20:54:35 -0500 In-Reply-To: <20200608015436.983250-1-whydoubt@gmail.com> References: <20200607043444.969330-1-whydoubt@gmail.com> <20200608015436.983250-1-whydoubt@gmail.com> Signed-off-by: Jeff Smith --- dlls/setupapi/tests/devinst.c | 40 ++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c index 80abc44029..06308ed4e9 100644 --- a/dlls/setupapi/tests/devinst.c +++ b/dlls/setupapi/tests/devinst.c @@ -2708,7 +2708,10 @@ static void test_class_installer(void) ok(*coinst_last_message == DIF_REMOVE, "Got unexpected message %#x.\n", *coinst_last_message); *coinst_callback_count = 0; - SetupDiDestroyDeviceInfoList(set); + SetLastError(0xdeadbeef); + ret = SetupDiDestroyDeviceInfoList(set); + ok(ret, "Failed to destroy device list.\n"); + todo_wine ok(!GetLastError(), "Got unexpected error %#x.\n", GetLastError()); ok(*coinst_callback_count == 1, "Got %d callbacks.\n", *coinst_callback_count); ok(*coinst_last_message == DIF_DESTROYPRIVATEDATA, "Got unexpected message %#x.\n", *coinst_last_message); @@ -2740,7 +2743,10 @@ static void test_class_installer(void) ok(GetLastError() == E_FAIL, "Got unexpected error %#x.\n", GetLastError()); ok(!device_is_registered(set, &device), "Expected device not to be registered.\n"); - SetupDiDestroyDeviceInfoList(set); + SetLastError(0xdeadbeef); + ret = SetupDiDestroyDeviceInfoList(set); + ok(ret, "Failed to destroy device list.\n"); + todo_wine ok(!GetLastError(), "Got unexpected error %#x.\n", GetLastError()); /* Test returning ERROR_DI_DO_DEFAULT. */ @@ -2766,7 +2772,10 @@ static void test_class_installer(void) ok(ret, "Failed to call class installer, error %#x.\n", GetLastError()); ok(!device_is_registered(set, &device), "Expected device not to be registered.\n"); - SetupDiDestroyDeviceInfoList(set); + SetLastError(0xdeadbeef); + ret = SetupDiDestroyDeviceInfoList(set); + ok(ret, "Failed to destroy device list.\n"); + todo_wine ok(!GetLastError(), "Got unexpected error %#x.\n", GetLastError()); /* The default entry point is ClassInstall(). */ @@ -2786,7 +2795,10 @@ static void test_class_installer(void) ok(*coinst_last_message == DIF_ALLOW_INSTALL, "Got unexpected message %#x.\n", *coinst_last_message); *coinst_callback_count = 0; - SetupDiDestroyDeviceInfoList(set); + SetLastError(0xdeadbeef); + ret = SetupDiDestroyDeviceInfoList(set); + ok(ret, "Failed to destroy device list.\n"); + todo_wine ok(!GetLastError(), "Got unexpected error %#x.\n", GetLastError()); ok(*coinst_callback_count == 1, "Got %d callbacks.\n", *coinst_callback_count); ok(*coinst_last_message == DIF_DESTROYPRIVATEDATA, "Got unexpected message %#x.\n", *coinst_last_message); @@ -2854,7 +2866,10 @@ static void test_class_coinstaller(void) ok(*coinst_last_message == DIF_REMOVE, "Got unexpected message %#x.\n", *coinst_last_message); *coinst_callback_count = 0; - SetupDiDestroyDeviceInfoList(set); + SetLastError(0xdeadbeef); + ret = SetupDiDestroyDeviceInfoList(set); + ok(ret, "Failed to destroy device list.\n"); + todo_wine ok(!GetLastError(), "Got unexpected error %#x.\n", GetLastError()); todo_wine ok(*coinst_callback_count == 1, "Got %d callbacks.\n", *coinst_callback_count); todo_wine ok(*coinst_last_message == DIF_DESTROYPRIVATEDATA, "Got unexpected message %#x.\n", *coinst_last_message); @@ -2883,7 +2898,10 @@ static void test_class_coinstaller(void) ok(GetLastError() == E_FAIL, "Got unexpected error %#x.\n", GetLastError()); ok(!device_is_registered(set, &device), "Expected device not to be registered.\n"); - SetupDiDestroyDeviceInfoList(set); + SetLastError(0xdeadbeef); + ret = SetupDiDestroyDeviceInfoList(set); + ok(ret, "Failed to destroy device list.\n"); + todo_wine ok(!GetLastError(), "Got unexpected error %#x.\n", GetLastError()); /* The default entry point is CoDeviceInstall(). */ @@ -2906,7 +2924,10 @@ static void test_class_coinstaller(void) ok(*coinst_last_message == DIF_ALLOW_INSTALL, "Got unexpected message %#x.\n", *coinst_last_message); *coinst_callback_count = 0; - SetupDiDestroyDeviceInfoList(set); + SetLastError(0xdeadbeef); + ret = SetupDiDestroyDeviceInfoList(set); + ok(ret, "Failed to destroy device list.\n"); + todo_wine ok(!GetLastError(), "Got unexpected error %#x.\n", GetLastError()); ok(*coinst_callback_count == 1, "Got %d callbacks.\n", *coinst_callback_count); ok(*coinst_last_message == DIF_DESTROYPRIVATEDATA, "Got unexpected message %#x.\n", *coinst_last_message); @@ -2954,7 +2975,10 @@ static void test_call_class_installer(void) ok(ret, "Failed to call class installer, error %#x.\n", GetLastError()); ok(!device_is_registered(set, &device), "Expected device not to be registered.\n"); - SetupDiDestroyDeviceInfoList(set); + SetLastError(0xdeadbeef); + ret = SetupDiDestroyDeviceInfoList(set); + ok(ret, "Failed to destroy device list.\n"); + todo_wine ok(!GetLastError(), "Got unexpected error %#x.\n", GetLastError()); load_resource("coinst.dll", "C:\\windows\\system32\\winetest_coinst.dll"); -- 2.23.0