Hans Leidekker : msi: Only perform the media check if the label of the disk entry differs from the last.

Alexandre Julliard julliard at winehq.org
Sun Mar 3 13:21:32 CST 2019


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Mon Jan  7 08:55:15 2019 +0100

msi: Only perform the media check if the label of the disk entry differs from the last.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=40433
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 85fea53af80d324a4cf7f80a45f43fed8d8d65e1)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/msi/media.c   | 26 +++++++++++++++++---------
 dlls/msi/msipriv.h |  1 +
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/dlls/msi/media.c b/dlls/msi/media.c
index 5f8c26a..09aac09 100644
--- a/dlls/msi/media.c
+++ b/dlls/msi/media.c
@@ -664,6 +664,7 @@ void msi_free_media_info(MSIMEDIAINFO *mi)
     msi_free(mi->disk_prompt);
     msi_free(mi->cabinet);
     msi_free(mi->volume_label);
+    msi_free(mi->last_volume);
     msi_free(mi);
 }
 
@@ -898,20 +899,27 @@ UINT ready_media( MSIPACKAGE *package, BOOL compressed, MSIMEDIAINFO *mi )
         }
     }
     /* check volume matches, change media if not */
-    if (mi->volume_label && mi->disk_id > 1)
+    if (mi->volume_label)
     {
-        WCHAR *source = msi_dup_property( package->db, szSourceDir );
-        BOOL match = source_matches_volume( mi, source );
-        msi_free( source );
-
-        if (!match && (mi->type == DRIVE_CDROM || mi->type == DRIVE_REMOVABLE))
+        /* assume first volume is in the drive */
+        if (mi->last_volume && strcmpiW( mi->last_volume, mi->volume_label ))
         {
-            if ((rc = msi_change_media( package, mi )) != ERROR_SUCCESS)
+            WCHAR *source = msi_dup_property( package->db, szSourceDir );
+            BOOL match = source_matches_volume( mi, source );
+            msi_free( source );
+
+            if (!match && (mi->type == DRIVE_CDROM || mi->type == DRIVE_REMOVABLE))
             {
-                msi_free( cabinet_file );
-                return rc;
+                if ((rc = msi_change_media( package, mi )) != ERROR_SUCCESS)
+                {
+                    msi_free( cabinet_file );
+                    return rc;
+                }
             }
         }
+
+        msi_free(mi->last_volume);
+        mi->last_volume = strdupW(mi->volume_label);
     }
     if (mi->cabinet)
     {
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index 27d654b..fdafeec 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -170,6 +170,7 @@ typedef struct tagMSIMEDIAINFO
     LPWSTR disk_prompt;
     LPWSTR cabinet;
     LPWSTR volume_label;
+    LPWSTR last_volume;
     BOOL is_continuous;
     BOOL is_extracted;
     WCHAR sourcedir[MAX_PATH];




More information about the wine-cvs mailing list