Implement the RemoveFiles action.
This commit is contained in:
parent
198557261b
commit
fd4a2003db
@ -4285,7 +4285,7 @@ static struct _actions StandardActions[] = {
|
||||
{ szRemoveDuplicateFiles, NULL},
|
||||
{ szRemoveEnvironmentStrings, ACTION_RemoveEnvironmentStrings },
|
||||
{ szRemoveExistingProducts, NULL},
|
||||
{ szRemoveFiles, NULL},
|
||||
{ szRemoveFiles, ACTION_RemoveFiles},
|
||||
{ szRemoveFolders, NULL},
|
||||
{ szRemoveIniValues, ACTION_RemoveIniValues },
|
||||
{ szRemoveODBC, NULL},
|
||||
|
@ -243,6 +243,7 @@ extern UINT ACTION_CustomAction(MSIPACKAGE *package,const WCHAR *action, BOOL ex
|
||||
extern UINT ACTION_AppSearch(MSIPACKAGE *package);
|
||||
extern UINT ACTION_FindRelatedProducts(MSIPACKAGE *package);
|
||||
extern UINT ACTION_InstallFiles(MSIPACKAGE *package);
|
||||
extern UINT ACTION_RemoveFiles(MSIPACKAGE *package);
|
||||
extern UINT ACTION_DuplicateFiles(MSIPACKAGE *package);
|
||||
extern UINT ACTION_RegisterClassInfo(MSIPACKAGE *package);
|
||||
extern UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package);
|
||||
|
@ -868,3 +868,29 @@ UINT ACTION_DuplicateFiles(MSIPACKAGE *package)
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
UINT ACTION_RemoveFiles( MSIPACKAGE *package )
|
||||
{
|
||||
MSIFILE *file;
|
||||
|
||||
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
|
||||
{
|
||||
if ( !file->Component )
|
||||
continue;
|
||||
if ( file->Component->Installed == INSTALLSTATE_LOCAL )
|
||||
continue;
|
||||
|
||||
if ( file->state == msifs_installed )
|
||||
ERR("removing installed file %s\n", debugstr_w(file->TargetPath));
|
||||
|
||||
if ( file->state != msifs_present )
|
||||
continue;
|
||||
|
||||
TRACE("removing %s\n", debugstr_w(file->File) );
|
||||
if ( !DeleteFileW( file->TargetPath ) )
|
||||
ERR("failed to delete %s\n", debugstr_w(file->TargetPath) );
|
||||
file->state = msifs_missing;
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user