From: Vincent Povirk Subject: setupapi: Add tests for dirid values. Message-Id: Date: Sat, 26 Sep 2015 13:13:28 -0500 This was written with the intent of eliminating a CrossOver hack for the undocumented dirid 13 (used by the IE6 installer), however winetestbot showed (https://testbot.winehq.org/JobDetails.pl?Key=16871) that not all Windows versions understand this id. Still, it doesn't hurt to increase our test coverage. From 464cf4af9e11021b87144c796da11f9c9dfa6ca3 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Sat, 26 Sep 2015 12:39:39 -0500 Subject: [PATCH] setupapi: Add tests for dirid values. Signed-off-by: Vincent Povirk --- dlls/setupapi/tests/install.c | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/dlls/setupapi/tests/install.c b/dlls/setupapi/tests/install.c index a98cbec..10161f0 100644 --- a/dlls/setupapi/tests/install.c +++ b/dlls/setupapi/tests/install.c @@ -720,6 +720,55 @@ static void test_inffilelist(void) RemoveDirectoryA(dirA); } +static const char dirid_inf[] = "[Version]\n" + "Signature=\"$Chicago$\"\n" + "[DefaultInstall]\n" + "AddReg=Add.Settings\n" + "[Add.Settings]\n" + "HKCU,Software\\Wine\\setupapitest,dirid,,%%%i%%\n"; + +static void check_dirid(int dirid, LPCSTR expected) +{ + char buffer[sizeof(dirid_inf)+11]; + char path[MAX_PATH], actual[MAX_PATH]; + LONG ret; + DWORD size; + + sprintf(buffer, dirid_inf, dirid); + + create_inf_file(inffile, buffer); + + sprintf(path, "%s\\%s", CURR_DIR, inffile); + run_cmdline("DefaultInstall", 128, path); + + size = sizeof(actual); + ret = RegGetValueA(HKEY_CURRENT_USER, "Software\\Wine\\setupapitest", "dirid", + RRF_RT_REG_SZ|RRF_ZEROONFAILURE, NULL, &actual, &size); + ok(ret == ERROR_SUCCESS, "Failed getting value for dirid %i, err=%d\n", dirid, ret); + ok(!strcmp(actual, expected), "Expected path for dirid %i was \"%s\", got \"%s\"\n", dirid, expected, actual); + + ok_registry(TRUE); + ret = DeleteFileA(inffile); + ok(ret, "Expected source inf to exist, last error was %d\n", GetLastError()); +} + +/* Test dirid values */ +static void test_dirid(void) +{ + char expected[MAX_PATH]; + + check_dirid(DIRID_NULL, ""); + + GetWindowsDirectoryA(expected, MAX_PATH); + check_dirid(DIRID_WINDOWS, expected); + + GetSystemDirectoryA(expected, MAX_PATH); + check_dirid(DIRID_SYSTEM, expected); + + strcat(expected, "\\unknown"); + check_dirid(40, expected); +} + START_TEST(install) { HMODULE hsetupapi = GetModuleHandleA("setupapi.dll"); @@ -770,6 +819,7 @@ START_TEST(install) test_registry(); test_install_svc_from(); test_driver_install(); + test_dirid(); UnhookWindowsHookEx(hhook); -- 2.1.4