diff --git a/dlls/setupapi/tests/install.c b/dlls/setupapi/tests/install.c index 9aa5a911ee3..4b718fc8da6 100644 --- a/dlls/setupapi/tests/install.c +++ b/dlls/setupapi/tests/install.c @@ -478,6 +478,7 @@ static void test_inffilelist(void) "Signature=\"$Chicago$\""; WCHAR *p, *ptr; + char dirA[MAX_PATH]; WCHAR dir[MAX_PATH] = { 0 }; WCHAR buffer[MAX_PATH] = { 0 }; DWORD expected, outsize; @@ -510,9 +511,29 @@ static void test_inffilelist(void) todo_wine ok(!ret, "expected SetupGetInfFileListW to fail!\n"); + /* create a private directory, the temp directory may contain some + * inf files left over from old installations + */ + if (!GetTempFileNameA(CURR_DIR, "inftest", 1, dirA)) + { + win_skip("GetTempFileNameA failed with error %d\n", GetLastError()); + return; + } + if (!CreateDirectoryA(dirA, NULL )) + { + win_skip("CreateDirectoryA failed with error %d\n", GetLastError()); + return; + } + if (!SetCurrentDirectoryA(dirA)) + { + win_skip("SetCurrentDirectoryA failed with error %d\n", GetLastError()); + RemoveDirectoryA(dirA); + return; + } + + MultiByteToWideChar(CP_ACP, 0, dirA, -1, dir, MAX_PATH); /* check a not existing directory */ - MultiByteToWideChar(CP_ACP, 0, CURR_DIR, -1, dir, MAX_PATH); ptr = dir + lstrlenW(dir); MultiByteToWideChar(CP_ACP, 0, "\\not_existent", -1, ptr, MAX_PATH - lstrlenW(dir)); outsize = 0xffffffff; @@ -569,6 +590,8 @@ static void test_inffilelist(void) DeleteFile(inffile); DeleteFile(inffile2); DeleteFile(invalid_inf); + SetCurrentDirectoryA(CURR_DIR); + RemoveDirectoryA(dirA); } START_TEST(install)