[PATCH 6/7] setupapi/tests: Test recording the INF section in SetupDiInstallDevice().

Zebediah Figura z.figura12 at gmail.com
Fri May 24 23:33:57 CDT 2019


---
 dlls/setupapi/tests/devinst.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c
index a63fb4a8bce..61b2660d96e 100644
--- a/dlls/setupapi/tests/devinst.c
+++ b/dlls/setupapi/tests/devinst.c
@@ -2985,6 +2985,7 @@ static void test_install_device(void)
     SP_DEVINFO_DATA device = {sizeof(device)};
     HKEY driver_key, class_key;
     HDEVINFO set;
+    DWORD size;
     BOOL ret;
     LONG res;
 
@@ -3050,6 +3051,19 @@ static void test_install_device(void)
     driver_key = SetupDiOpenDevRegKey(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DRV, KEY_READ);
     ok(driver_key != INVALID_HANDLE_VALUE, "Failed to open driver key, error %#x.\n", GetLastError());
     check_reg_str(driver_key, "foo", "bar");
+    check_reg_str(driver_key, "InfSection", "dev1");
+    check_reg_str(driver_key, "InfSectionExt", ".NT");
+
+    /* Windows XP/2003 copies the file to the inf directory inside of
+     * SetupDiInstallDevice(). Vista+ copies it inside of
+     * UpdateDriverForPlugAndPlayDevices(), the expected caller. */
+    size = sizeof(installed_inf_path);
+    res = RegQueryValueExA(driver_key, "InfPath", NULL, NULL, (BYTE *)&installed_inf_path, &size);
+    ok(!res, "Failed to get installed INF path.\n");
+    sprintf(path, "C:/windows/inf/%s", installed_inf_path);
+    DeleteFileA(path);
+    path[strlen(path) - 3] = 'p';
+    DeleteFileA(path);
     RegCloseKey(driver_key);
 
     /* We set DI_NOFILECOPY, so nothing should have been copied. */
@@ -3068,6 +3082,16 @@ static void test_install_device(void)
     driver_key = SetupDiOpenDevRegKey(set, &device, DICS_FLAG_GLOBAL, 0, DIREG_DRV, KEY_READ);
     ok(driver_key != INVALID_HANDLE_VALUE, "Failed to open driver key, error %#x.\n", GetLastError());
     check_reg_str(driver_key, "foo", "bar");
+    check_reg_str(driver_key, "InfSection", "dev1");
+    check_reg_str(driver_key, "InfSectionExt", ".NT");
+
+    size = sizeof(installed_inf_path);
+    res = RegQueryValueExA(driver_key, "InfPath", NULL, NULL, (BYTE *)&installed_inf_path, &size);
+    ok(!res, "Failed to get installed INF path.\n");
+    sprintf(path, "C:/windows/inf/%s", installed_inf_path);
+    DeleteFileA(path);
+    path[strlen(path) - 3] = 'p';
+    DeleteFileA(path);
     RegCloseKey(driver_key);
 
     ret = DeleteFileA("C:/windows/system32/setupapi_test_one.txt");
-- 
2.21.0




More information about the wine-devel mailing list