Commit c50ef541 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Keep temporary files in a seperate list.

parent 42744ff4
......@@ -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 );
}
......
......@@ -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;
......
......@@ -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));
......
......@@ -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;
return -1;
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 = get_loaded_file( package, name );
if (file)
temp = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof (MSITEMPFILE) );
if (!temp)
return -1;
file = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof (MSIFILE) );
list_add_head( &package->tempfiles, &temp->entry );
file->File = strdupW( name );
file->TargetPath = strdupW( path );
file->Temporary = TRUE;
temp->File = strdupW( name );
temp->Path = strdupW( path );
TRACE("Tracking tempfile (%s)\n", debugstr_w( file->File ));
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;
if (!package)
return;
struct list *item, *cursor;
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 );
}
}
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment