Hans Leidekker : msi: Don' t mark global assembly files as installed when they are extracted.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Apr 1 10:40:59 CDT 2015


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Wed Apr  1 12:32:44 2015 +0200

msi: Don't mark global assembly files as installed when they are extracted.

---

 dlls/msi/action.c  | 11 ++++++++---
 dlls/msi/files.c   | 17 +++++++++--------
 dlls/msi/install.c |  2 +-
 dlls/msi/msi.c     |  2 +-
 dlls/msi/msipriv.h |  1 +
 5 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index a9a157b..4eec12a 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -2169,13 +2169,18 @@ WCHAR *msi_build_directory_name( DWORD count, ... )
     return dir;
 }
 
-static void set_target_path( MSIPACKAGE *package, MSIFILE *file )
+BOOL msi_is_global_assembly( MSICOMPONENT *comp )
 {
-    MSIASSEMBLY *assembly = file->Component->assembly;
+    return comp->assembly && !comp->assembly->application;
+}
 
+static void set_target_path( MSIPACKAGE *package, MSIFILE *file )
+{
     msi_free( file->TargetPath );
-    if (assembly && !assembly->application)
+    if (msi_is_global_assembly( file->Component ))
     {
+        MSIASSEMBLY *assembly = file->Component->assembly;
+
         if (!assembly->tempdir) assembly->tempdir = get_temp_dir();
         file->TargetPath = msi_build_directory_name( 2, assembly->tempdir, file->FileName );
         msi_track_tempfile( package, file->TargetPath );
diff --git a/dlls/msi/files.c b/dlls/msi/files.c
index 96fb48a..fb56a6d 100644
--- a/dlls/msi/files.c
+++ b/dlls/msi/files.c
@@ -80,7 +80,7 @@ static msi_file_state calculate_install_state( MSIPACKAGE *package, MSIFILE *fil
         TRACE("skipping %s (not part of patch)\n", debugstr_w(file->File));
         return msifs_skipped;
     }
-    if ((comp->assembly && !comp->assembly->application && !comp->assembly->installed) ||
+    if ((msi_is_global_assembly( comp ) && !comp->assembly->installed) ||
         GetFileAttributesW( file->TargetPath ) == INVALID_FILE_ATTRIBUTES)
     {
         TRACE("installing %s (missing)\n", debugstr_w(file->File));
@@ -291,7 +291,7 @@ static BOOL installfiles_cb(MSIPACKAGE *package, LPCWSTR file, DWORD action,
         if (f->disk_id != disk_id || (f->state != msifs_missing && f->state != msifs_overwrite))
             return FALSE;
 
-        if (!f->Component->assembly || f->Component->assembly->application)
+        if (!msi_is_global_assembly( f->Component ))
         {
             msi_create_directory(package, f->Component->Directory);
         }
@@ -300,7 +300,7 @@ static BOOL installfiles_cb(MSIPACKAGE *package, LPCWSTR file, DWORD action,
     }
     else if (action == MSICABEXTRACT_FILEEXTRACTED)
     {
-        f->state = msifs_installed;
+        if (!msi_is_global_assembly( f->Component )) f->state = msifs_installed;
         f = NULL;
     }
 
@@ -393,22 +393,22 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
 
             TRACE("copying %s to %s\n", debugstr_w(source), debugstr_w(file->TargetPath));
 
-            if (!file->Component->assembly || file->Component->assembly->application)
+            if (!msi_is_global_assembly( file->Component ))
             {
                 msi_create_directory(package, file->Component->Directory);
             }
             rc = copy_install_file(package, file, source);
             if (rc != ERROR_SUCCESS)
             {
-                ERR("Failed to copy %s to %s (%d)\n", debugstr_w(source),
-                    debugstr_w(file->TargetPath), rc);
+                ERR("Failed to copy %s to %s (%u)\n", debugstr_w(source), debugstr_w(file->TargetPath), rc);
                 rc = ERROR_INSTALL_FAILURE;
                 msi_free(source);
                 goto done;
             }
             msi_free(source);
         }
-        else if (file->state != msifs_installed && !(file->Attributes & msidbFileAttributesPatchAdded))
+        else if (!msi_is_global_assembly( file->Component ) &&
+                 file->state != msifs_installed && !(file->Attributes & msidbFileAttributesPatchAdded))
         {
             ERR("compressed file wasn't installed (%s)\n", debugstr_w(file->File));
             rc = ERROR_INSTALL_FAILURE;
@@ -419,7 +419,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
     {
         MSICOMPONENT *comp = file->Component;
 
-        if (!comp->assembly || (file->state != msifs_missing && file->state != msifs_overwrite))
+        if (!msi_is_global_assembly( comp ) || (file->state != msifs_missing && file->state != msifs_overwrite))
             continue;
 
         rc = msi_install_assembly( package, comp );
@@ -429,6 +429,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
             rc = ERROR_INSTALL_FAILURE;
             break;
         }
+        file->state = msifs_installed;
     }
 
 done:
diff --git a/dlls/msi/install.c b/dlls/msi/install.c
index 5810a1e..a0f69c9 100644
--- a/dlls/msi/install.c
+++ b/dlls/msi/install.c
@@ -588,7 +588,7 @@ UINT MSI_SetTargetPathW( MSIPACKAGE *package, LPCWSTR szFolder, LPCWSTR szFolder
         const WCHAR *dir;
         MSICOMPONENT *comp = file->Component;
 
-        if (!comp->Enabled || (comp->assembly && !comp->assembly->application)) continue;
+        if (!comp->Enabled || msi_is_global_assembly( comp )) continue;
 
         dir = msi_get_target_folder( package, comp->Directory );
         msi_free( file->TargetPath );
diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c
index df71ed2..9dc30be 100644
--- a/dlls/msi/msi.c
+++ b/dlls/msi/msi.c
@@ -2048,7 +2048,7 @@ UINT WINAPI MsiEnumComponentCostsW( MSIHANDLE handle, LPCWSTR component, DWORD i
     GetWindowsDirectoryW( path, MAX_PATH );
     if (component && component[0])
     {
-        if (comp->assembly && !comp->assembly->application) *temp = comp->Cost;
+        if (msi_is_global_assembly( comp )) *temp = comp->Cost;
         if (!comp->Enabled || !comp->KeyPath)
         {
             *cost = 0;
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index fe4f6d6..9c016f3 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -1045,6 +1045,7 @@ extern UINT msi_install_assembly(MSIPACKAGE *, MSICOMPONENT *) DECLSPEC_HIDDEN;
 extern UINT msi_uninstall_assembly(MSIPACKAGE *, MSICOMPONENT *) DECLSPEC_HIDDEN;
 extern BOOL msi_init_assembly_caches(MSIPACKAGE *) DECLSPEC_HIDDEN;
 extern void msi_destroy_assembly_caches(MSIPACKAGE *) DECLSPEC_HIDDEN;
+extern BOOL msi_is_global_assembly(MSICOMPONENT *) DECLSPEC_HIDDEN;
 extern WCHAR *msi_font_version_from_file(const WCHAR *) DECLSPEC_HIDDEN;
 extern WCHAR **msi_split_string(const WCHAR *, WCHAR) DECLSPEC_HIDDEN;
 extern UINT msi_set_original_database_property(MSIDATABASE *, const WCHAR *) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list