diff --git a/dlls/msi/action.c b/dlls/msi/action.c index eb3b431d849..86a7cc826c7 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -1184,7 +1184,6 @@ static UINT load_file(MSIRECORD *row, LPVOID param) file->Attributes = MSI_RecordGetInteger( row, 7 ); file->Sequence = MSI_RecordGetInteger( row, 8 ); - file->Temporary = FALSE; file->State = 0; TRACE("File Loaded (%s)\n",debugstr_w(file->File)); @@ -1739,9 +1738,6 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package) comp = file->Component; - if (file->Temporary == TRUE) - continue; - if (comp) { LPWSTR p; @@ -2449,8 +2445,6 @@ static void ACTION_RefCountComponent( MSIPACKAGE* package, MSICOMPONENT *comp ) LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry ) { - if (file->Temporary) - continue; if (file->Component == comp) ACTION_WriteSharedDLLsCount( file->TargetPath, count ); } diff --git a/dlls/msi/action.h b/dlls/msi/action.h index edf5b4a24b6..78b07b4a300 100644 --- a/dlls/msi/action.h +++ b/dlls/msi/action.h @@ -114,11 +114,18 @@ typedef struct tagMSIFILE /* 2 = present but replace */ /* 3 = present do not replace */ /* 4 = Installed */ + /* 5 = Skipped */ LPWSTR SourcePath; LPWSTR TargetPath; - BOOL Temporary; } MSIFILE; +typedef struct tagMSITEMPFILE +{ + struct list entry; + LPWSTR File; + LPWSTR Path; +} MSITEMPFILE; + typedef struct tagMSIAPPID { struct list entry; diff --git a/dlls/msi/files.c b/dlls/msi/files.c index 25102899a23..943a94c0ce8 100644 --- a/dlls/msi/files.c +++ b/dlls/msi/files.c @@ -670,9 +670,6 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package) { MSICOMPONENT* comp = NULL; - if (file->Temporary) - continue; - if (!ACTION_VerifyComponentForAction(package, file->Component, INSTALLSTATE_LOCAL)) { @@ -712,9 +709,6 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package) /* Pass 2 */ LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry ) { - if (file->Temporary) - continue; - if ((file->State == 1) || (file->State == 2)) { TRACE("Pass 2: %s\n",debugstr_w(file->File)); diff --git a/dlls/msi/helpers.c b/dlls/msi/helpers.c index 9fd2087fb71..e78b32827ad 100644 --- a/dlls/msi/helpers.c +++ b/dlls/msi/helpers.c @@ -205,22 +205,32 @@ MSIFILE* get_loaded_file( MSIPACKAGE* package, LPCWSTR key ) int track_tempfile( MSIPACKAGE *package, LPCWSTR name, LPCWSTR path ) { - MSIFILE *file; + MSITEMPFILE *temp; if (!package) - return -2; - - file = get_loaded_file( package, name ); - if (file) return -1; - file = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof (MSIFILE) ); + LIST_FOR_EACH_ENTRY( temp, &package->tempfiles, MSITEMPFILE, entry ) + { + if (lstrcmpW( name, temp->File )==0) + { + TRACE("tempfile %s already exists with path %s\n", + debugstr_w(temp->File), debugstr_w(temp->Path)); + return -1; + } + } - file->File = strdupW( name ); - file->TargetPath = strdupW( path ); - file->Temporary = TRUE; + temp = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof (MSITEMPFILE) ); + if (!temp) + return -1; - TRACE("Tracking tempfile (%s)\n", debugstr_w( file->File )); + list_add_head( &package->tempfiles, &temp->entry ); + + temp->File = strdupW( name ); + temp->Path = strdupW( path ); + + TRACE("adding tempfile %s with path %s\n", + debugstr_w(temp->File), debugstr_w(temp->Path)); return 0; } @@ -402,18 +412,18 @@ UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action) static void remove_tracked_tempfiles(MSIPACKAGE* package) { - MSIFILE *file; + struct list *item, *cursor; - if (!package) - return; - - LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry ) + LIST_FOR_EACH_SAFE( item, cursor, &package->tempfiles ) { - if (file->Temporary) - { - TRACE("Cleaning up %s\n", debugstr_w( file->TargetPath )); - DeleteFileW( file->TargetPath ); - } + MSITEMPFILE *temp = LIST_ENTRY( item, MSITEMPFILE, entry ); + + list_remove( &temp->entry ); + TRACE("deleting temp file %s\n", debugstr_w( temp->Path )); + DeleteFileW( temp->Path ); + HeapFree( GetProcessHeap(), 0, temp->File ); + HeapFree( GetProcessHeap(), 0, temp->Path ); + HeapFree( GetProcessHeap(), 0, temp ); } } diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index 9cf9763e470..4551e40bfe0 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -188,6 +188,7 @@ typedef struct tagMSIPACKAGE struct list components; struct list features; struct list files; + struct list tempfiles; struct list folders; LPWSTR ActionFormat; LPWSTR LastAction; diff --git a/dlls/msi/package.c b/dlls/msi/package.c index a5db56e3d01..820c664e5ba 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -380,6 +380,7 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db ) list_init( &package->components ); list_init( &package->features ); list_init( &package->files ); + list_init( &package->tempfiles ); list_init( &package->folders ); package->ActionFormat = NULL; package->LastAction = NULL;