Christian Costa : msi: Use next cabinet from the media table instead of failing when there is a mismatch with continuous cabinet .

Alexandre Julliard julliard at winehq.org
Wed May 1 13:27:27 CDT 2013


Module: wine
Branch: master
Commit: 7129293b9a75b72ec73a37ca321cf20e8d34f5de
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7129293b9a75b72ec73a37ca321cf20e8d34f5de

Author: Christian Costa <titan.costa at gmail.com>
Date:   Wed May  1 15:27:31 2013 +0200

msi: Use next cabinet from the media table instead of failing when there is a mismatch with continuous cabinet.

---

 dlls/msi/media.c         |   25 +++++++++++++++++++++++--
 dlls/msi/tests/install.c |    4 ++--
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/dlls/msi/media.c b/dlls/msi/media.c
index 612624d..d97f4bd 100644
--- a/dlls/msi/media.c
+++ b/dlls/msi/media.c
@@ -358,8 +358,29 @@ static INT_PTR cabinet_next_cabinet(FDINOTIFICATIONTYPE fdint,
 
     if (strcmpiW( mi->cabinet, cab ))
     {
-        ERR("Continuous cabinet does not match the next cabinet in the Media table\n");
-        goto done;
+        char *next_cab;
+        ULONG length;
+
+        WARN("Continuous cabinet %s does not match the next cabinet %s in the media table => use latter one\n", debugstr_w(cab), debugstr_w(mi->cabinet));
+
+        /* Use cabinet name from the media table */
+        next_cab = strdupWtoA(mi->cabinet);
+        /* Modify path to cabinet file with full filename (psz3 points to a 256 bytes buffer that can be modified contrary to psz1 and psz2) */
+        length = strlen(pfdin->psz3) + 1 + strlen(next_cab) + 1;
+        if (length > 256)
+        {
+            WARN("Cannot update next cabinet filename with a string size %u > 256\n", length);
+            msi_free(next_cab);
+            goto done;
+        }
+        else
+        {
+            strcat(pfdin->psz3, "\\");
+            strcat(pfdin->psz3, next_cab);
+        }
+        /* Path psz3 and cabinet psz1 are concatenated by FDI so just reset psz1 */
+        *pfdin->psz1 = 0;
+        msi_free(next_cab);
     }
 
     if (!(cabinet_file = get_cabinet_filename(mi)))
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 207fdef..e5d996e 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -3122,9 +3122,9 @@ static void test_continuouscabs(void)
     }
     else
     {
-        todo_wine ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
+        ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
         ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
-        todo_wine ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
+        ok(delete_pf("msitest\\caesar", TRUE), "File not installed\n");
         ok(delete_pf("msitest\\maximus", TRUE), "File not installed\n");
         ok(delete_pf("msitest", FALSE), "Directory not created\n");
     }




More information about the wine-cvs mailing list