From d263c91ce28b39102770c03d65ecab0d71a97e3c Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Fri, 10 Apr 2015 12:58:26 +0200 Subject: [PATCH] msi: Assume that file patches from registered MSI patches have already been applied. --- dlls/msi/files.c | 14 +++++++++++++- dlls/msi/msipriv.h | 1 + dlls/msi/patch.c | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/dlls/msi/files.c b/dlls/msi/files.c index 31167540b57..ca758dd9605 100644 --- a/dlls/msi/files.c +++ b/dlls/msi/files.c @@ -448,6 +448,17 @@ static MSIFILEPATCH *find_filepatch( MSIPACKAGE *package, UINT disk_id, const WC return NULL; } +static BOOL is_registered_patch_media( MSIPACKAGE *package, UINT disk_id ) +{ + MSIPATCHINFO *patch; + + LIST_FOR_EACH_ENTRY( patch, &package->patches, MSIPATCHINFO, entry ) + { + if (patch->disk_id == disk_id && patch->registered) return TRUE; + } + return FALSE; +} + static BOOL patchfiles_cb(MSIPACKAGE *package, LPCWSTR file, DWORD action, LPWSTR *path, DWORD *attrs, PVOID user) { @@ -457,7 +468,8 @@ static BOOL patchfiles_cb(MSIPACKAGE *package, LPCWSTR file, DWORD action, { MSICOMPONENT *comp; - if (!(patch = find_filepatch( package, patch->disk_id, file ))) return FALSE; + if (is_registered_patch_media( package, patch->disk_id ) || + !(patch = find_filepatch( package, patch->disk_id, file ))) return FALSE; comp = patch->File->Component; comp->Action = msi_get_component_action( package, comp ); diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index 5a8c24f2f3c..9bec75f6239 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -193,6 +193,7 @@ typedef struct tagMSIPATCHINFO LPWSTR localfile; MSIPATCHSTATE state; BOOL delete_on_close; + BOOL registered; UINT disk_id; } MSIPATCHINFO; diff --git a/dlls/msi/patch.c b/dlls/msi/patch.c index b7bf2ef3ca5..545635987e0 100644 --- a/dlls/msi/patch.c +++ b/dlls/msi/patch.c @@ -918,6 +918,7 @@ static UINT msi_apply_patch_package( MSIPACKAGE *package, const WCHAR *file ) goto done; r = ERROR_OUTOFMEMORY; + patch->registered = FALSE; if (!(patch->filename = strdupW( file ))) goto done; if (!(patch->localfile = strdupW( localfile ))) goto done; @@ -1034,6 +1035,7 @@ UINT msi_apply_registered_patch( MSIPACKAGE *package, LPCWSTR patch_code ) msiobj_release( &patch_db->hdr ); return r; } + patch_info->registered = TRUE; patch_info->localfile = strdupW( patch_file ); if (!patch_info->localfile) {