Zebediah Figura : setupapi: Retrieve the default destination path in SetupInstallFile().

Alexandre Julliard julliard at winehq.org
Mon May 20 15:50:47 CDT 2019


Module: wine
Branch: master
Commit: d5f6d6419b16ef81ce882f01a318189251320fcb
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d5f6d6419b16ef81ce882f01a318189251320fcb

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Fri May 17 17:36:51 2019 -0500

setupapi: Retrieve the default destination path in SetupInstallFile().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/setupapi/queue.c         | 16 ++++++++++++++--
 dlls/setupapi/tests/install.c |  6 +++---
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/dlls/setupapi/queue.c b/dlls/setupapi/queue.c
index cacab2d..a0a9012 100644
--- a/dlls/setupapi/queue.c
+++ b/dlls/setupapi/queue.c
@@ -1216,7 +1216,7 @@ BOOL WINAPI SetupInstallFileExW( HINF hinf, PINFCONTEXT inf_context, PCWSTR sour
     static const WCHAR CopyFiles[] = {'C','o','p','y','F','i','l','e','s',0};
 
     BOOL ret, absolute = (root && *root && !(style & SP_COPY_SOURCE_ABSOLUTE));
-    WCHAR *buffer, *p, *inf_source = NULL;
+    WCHAR *buffer, *p, *inf_source = NULL, dest_path[MAX_PATH];
     unsigned int len;
 
     TRACE("%p %p %s %s %s %x %p %p %p\n", hinf, inf_context, debugstr_w(source), debugstr_w(root),
@@ -1224,8 +1224,11 @@ BOOL WINAPI SetupInstallFileExW( HINF hinf, PINFCONTEXT inf_context, PCWSTR sour
 
     if (in_use) FIXME("no file in use support\n");
 
+    dest_path[0] = 0;
+
     if (hinf)
     {
+        WCHAR *dest_dir;
         INFCONTEXT ctx;
 
         if (!inf_context)
@@ -1245,6 +1248,13 @@ BOOL WINAPI SetupInstallFileExW( HINF hinf, PINFCONTEXT inf_context, PCWSTR sour
             return FALSE;
         }
         source = inf_source;
+
+        if ((dest_dir = get_destination_dir( hinf, NULL )))
+        {
+            strcpyW( dest_path, dest_dir );
+            strcatW( dest_path, backslashW );
+            heap_free( dest_dir );
+        }
     }
     else if (!source)
     {
@@ -1271,7 +1281,9 @@ BOOL WINAPI SetupInstallFileExW( HINF hinf, PINFCONTEXT inf_context, PCWSTR sour
     while (*source == '\\') source++;
     strcpyW( p, source );
 
-    ret = do_file_copyW( buffer, dest, style, handler, context );
+    strcatW( dest_path, dest );
+
+    ret = do_file_copyW( buffer, dest_path, style, handler, context );
 
     HeapFree( GetProcessHeap(), 0, inf_source );
     HeapFree( GetProcessHeap(), 0, buffer );
diff --git a/dlls/setupapi/tests/install.c b/dlls/setupapi/tests/install.c
index 3677e0e..c27c9ca 100644
--- a/dlls/setupapi/tests/install.c
+++ b/dlls/setupapi/tests/install.c
@@ -1364,11 +1364,11 @@ static void test_install_file(void)
     ret = SetupInstallFileA(hinf, &infctx, "one.txt", "src", "one.txt", 0, NULL, NULL);
     ok(ret, "Expected success.\n");
     ok(GetLastError() == ERROR_SUCCESS, "Got unexpected error %#x.\n", GetLastError());
-    todo_wine ok(delete_file("dst/one.txt"), "Destination file should exist.\n");
+    ok(delete_file("dst/one.txt"), "Destination file should exist.\n");
 
     SetLastError(0xdeadbeef);
     ret = SetupInstallFileA(hinf, &infctx, "one.txt", "src", "one.txt", SP_COPY_REPLACEONLY, NULL, NULL);
-    todo_wine ok(!ret, "Expected failure.\n");
+    ok(!ret, "Expected failure.\n");
     todo_wine ok(GetLastError() == ERROR_SUCCESS, "Got unexpected error %#x.\n", GetLastError());
     ok(!file_exists("dst/one.txt"), "Destination file should not exist.\n");
 
@@ -1394,7 +1394,7 @@ static void test_install_file(void)
     ret = SetupInstallFileA(hinf, &infctx, "three.txt", "src/alpha", "three.txt", 0, NULL, NULL);
     ok(ret, "Expected success.\n");
     ok(GetLastError() == ERROR_SUCCESS, "Got unexpected error %#x.\n", GetLastError());
-    todo_wine ok(delete_file("dst/three.txt"), "Destination file should exist.\n");
+    ok(delete_file("dst/three.txt"), "Destination file should exist.\n");
 
     SetupCloseInfFile(hinf);
     delete_file("src/one.txt");




More information about the wine-cvs mailing list