msi: Don't overwrite a file that has a greater or equal version to the source file.
This commit is contained in:
parent
1e942d6b1f
commit
89a8cfdb53
|
@ -459,6 +459,24 @@ done:
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* compares the version of a file read from the filesystem and
|
||||
* the version specified in the File table
|
||||
*/
|
||||
static int msi_compare_file_version(MSIFILE *file)
|
||||
{
|
||||
WCHAR version[MAX_PATH];
|
||||
DWORD size;
|
||||
UINT r;
|
||||
|
||||
size = MAX_PATH;
|
||||
version[0] = '\0';
|
||||
r = MsiGetFileVersionW(file->TargetPath, version, &size, NULL, NULL);
|
||||
if (r != ERROR_SUCCESS)
|
||||
return 0;
|
||||
|
||||
return lstrcmpW(version, file->Version);
|
||||
}
|
||||
|
||||
void msi_free_media_info( MSIMEDIAINFO *mi )
|
||||
{
|
||||
msi_free( mi->disk_prompt );
|
||||
|
@ -802,6 +820,13 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (MsiGetFileVersionW(file->TargetPath, NULL, NULL, NULL, NULL) == ERROR_SUCCESS &&
|
||||
msi_compare_file_version(file) >= 0)
|
||||
{
|
||||
TRACE("Destination file version greater, not overwriting\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (file->Sequence > mi->last_sequence || mi->is_continuous ||
|
||||
(file->IsCompressed && !mi->is_extracted))
|
||||
{
|
||||
|
@ -972,24 +997,6 @@ UINT ACTION_DuplicateFiles(MSIPACKAGE *package)
|
|||
return rc;
|
||||
}
|
||||
|
||||
/* compares the version of a file read from the filesystem and
|
||||
* the version specified in the File table
|
||||
*/
|
||||
static int msi_compare_file_version( MSIFILE *file )
|
||||
{
|
||||
WCHAR version[MAX_PATH];
|
||||
DWORD size;
|
||||
UINT r;
|
||||
|
||||
size = MAX_PATH;
|
||||
version[0] = '\0';
|
||||
r = MsiGetFileVersionW( file->TargetPath, version, &size, NULL, NULL );
|
||||
if ( r != ERROR_SUCCESS )
|
||||
return 0;
|
||||
|
||||
return lstrcmpW( version, file->Version );
|
||||
}
|
||||
|
||||
UINT ACTION_RemoveFiles( MSIPACKAGE *package )
|
||||
{
|
||||
MSIFILE *file;
|
||||
|
|
Loading…
Reference in New Issue