[PATCH 4/3] setupapi/tests: Add a test for copying from INF files installed via SetupCopyOEMInf().
Zebediah Figura
z.figura12 at gmail.com
Thu Jun 11 11:16:33 CDT 2020
---
This test only successfully passes on Windows XP, and generates dialogs
elsewhere, so I'm attaching it essentially just as a proof of concept.
dlls/setupapi/tests/install.c | 70 +++++++++++++++++++++++++++++++++++
1 file changed, 70 insertions(+)
diff --git a/dlls/setupapi/tests/install.c b/dlls/setupapi/tests/install.c
index c085b724b59..03bf2411c36 100644
--- a/dlls/setupapi/tests/install.c
+++ b/dlls/setupapi/tests/install.c
@@ -2129,6 +2129,75 @@ static void test_register_dlls(void)
ok(ret, "Failed to delete test DLL, error %u.\n", GetLastError());
}
+static void test_oem_source_path(void)
+{
+ static const char inf_data[] = "[Version]\n"
+ "Signature=\"$Chicago$\"\n"
+ "[DefaultInstall]\n"
+ "CopyFiles=files_section\n"
+ "[files_section]\n"
+ "one.txt\n"
+ "[SourceDisksNames]\n"
+ "1=heis\n"
+ "[SourceDisksFiles]\n"
+ "one.txt=1\n"
+ "[DestinationDirs]\n"
+ "files_section=40000,dst\n";
+
+ void *context = SetupInitDefaultQueueCallbackEx(NULL, INVALID_HANDLE_VALUE, 0, 0, 0);
+ char path[MAX_PATH + 9], oem_path[MAX_PATH];
+ HSPFILEQ queue;
+ HINF hinf;
+ BOOL ret;
+
+ ret = CreateDirectoryA("src", NULL);
+ ok(ret, "Failed to create test directory, error %u.\n", GetLastError());
+ create_inf_file("src/test.inf", inf_data);
+ create_file("src/one.txt");
+
+ sprintf(path, "%s\\src\\test.inf", CURR_DIR);
+ ret = SetupCopyOEMInfA(path, NULL, SPOST_PATH, 0, oem_path, sizeof(oem_path), NULL, NULL);
+ if (!ret && (GetLastError() == ERROR_ACCESS_DENIED || GetLastError() == ERROR_WRONG_INF_TYPE
+ || GetLastError() == ERROR_UNSUPPORTED_TYPE /* Win7 */))
+ {
+ skip("Failed to install INF, error %u.\n", GetLastError());
+ delete_file("src/one.txt");
+ delete_file("src/test.inf");
+ delete_file("src/");
+ return;
+ }
+ ok(ret, "Failed to install INF, error %u.\n", GetLastError());
+
+ hinf = SetupOpenInfFileA(oem_path, NULL, INF_STYLE_WIN4, NULL);
+ ok(hinf != INVALID_HANDLE_VALUE, "Failed to open INF file, error %#x.\n", GetLastError());
+
+ ret = SetupSetDirectoryIdA(hinf, 40000, CURR_DIR);
+ ok(ret, "Failed to set directory ID, error %u.\n", GetLastError());
+
+ queue = SetupOpenFileQueue();
+ ok(queue != INVALID_HANDLE_VALUE, "Failed to open queue, error %#x.\n", GetLastError());
+
+ ret = SetupInstallFilesFromInfSectionA(hinf, NULL, queue, "DefaultInstall", NULL, 0);
+ ok(ret, "Failed to install files, error %#x.\n", GetLastError());
+
+ ret = SetupCommitFileQueueA(NULL, queue, SetupDefaultQueueCallbackA, context);
+ ok(ret, "Failed to commit queue, error %#x.\n", GetLastError());
+
+ ok(delete_file("dst/one.txt"), "Destination file should exist.\n");
+
+ SetupTermDefaultQueueCallback(context);
+ ret = SetupCloseFileQueue(queue);
+ ok(ret, "Failed to close queue, error %#x.\n", GetLastError());
+
+ ret = SetupUninstallOEMInfA(strrchr(oem_path, '\\') + 1, 0, NULL);
+ ok(ret, "Failed to uninstall INF, error %u.\n", GetLastError());
+ SetupCloseInfFile(hinf);
+ delete_file("dst/");
+ delete_file("src/one.txt");
+ delete_file("src/test.inf");
+ delete_file("src/");
+}
+
START_TEST(install)
{
char temp_path[MAX_PATH], prev_path[MAX_PATH];
@@ -2159,6 +2228,7 @@ START_TEST(install)
test_install_file();
test_start_copy();
test_register_dlls();
+ test_oem_source_path();
UnhookWindowsHookEx(hhook);
--
2.27.0
More information about the wine-devel
mailing list