- build a standard Wine list of files instead of using an array
- use file pointers instead of array indexes
This commit is contained in:
parent
625d872b67
commit
e18f8abee1
|
@ -1153,45 +1153,41 @@ static UINT load_feature(MSIRECORD * row, LPVOID param)
|
|||
static UINT load_file(MSIRECORD *row, LPVOID param)
|
||||
{
|
||||
MSIPACKAGE* package = (MSIPACKAGE*)param;
|
||||
DWORD index = package->loaded_files;
|
||||
LPCWSTR component;
|
||||
MSIFILE *file;
|
||||
|
||||
/* fill in the data */
|
||||
|
||||
package->loaded_files++;
|
||||
if (package->loaded_files== 1)
|
||||
package->files = HeapAlloc(GetProcessHeap(),0,sizeof(MSIFILE));
|
||||
else
|
||||
package->files = HeapReAlloc(GetProcessHeap(),0,
|
||||
package->files , package->loaded_files * sizeof(MSIFILE));
|
||||
|
||||
memset(&package->files[index],0,sizeof(MSIFILE));
|
||||
file = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof (MSIFILE) );
|
||||
if (!file)
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
|
||||
package->files[index].File = load_dynamic_stringW(row, 1);
|
||||
file->File = load_dynamic_stringW( row, 1 );
|
||||
|
||||
component = MSI_RecordGetString(row, 2);
|
||||
package->files[index].Component = get_loaded_component(package,
|
||||
component);
|
||||
component = MSI_RecordGetString( row, 2 );
|
||||
file->Component = get_loaded_component( package, component );
|
||||
|
||||
if (!package->files[index].Component)
|
||||
if (!file->Component)
|
||||
ERR("Unfound Component %s\n",debugstr_w(component));
|
||||
|
||||
package->files[index].FileName = load_dynamic_stringW(row,3);
|
||||
reduce_to_longfilename(package->files[index].FileName);
|
||||
file->FileName = load_dynamic_stringW( row, 3 );
|
||||
reduce_to_longfilename( file->FileName );
|
||||
|
||||
package->files[index].ShortName = load_dynamic_stringW(row,3);
|
||||
reduce_to_shortfilename(package->files[index].ShortName);
|
||||
file->ShortName = load_dynamic_stringW( row, 3 );
|
||||
reduce_to_shortfilename( file->ShortName );
|
||||
|
||||
package->files[index].FileSize = MSI_RecordGetInteger(row,4);
|
||||
package->files[index].Version = load_dynamic_stringW(row, 5);
|
||||
package->files[index].Language = load_dynamic_stringW(row, 6);
|
||||
package->files[index].Attributes= MSI_RecordGetInteger(row,7);
|
||||
package->files[index].Sequence= MSI_RecordGetInteger(row,8);
|
||||
file->FileSize = MSI_RecordGetInteger( row, 4 );
|
||||
file->Version = load_dynamic_stringW( row, 5 );
|
||||
file->Language = load_dynamic_stringW( row, 6 );
|
||||
file->Attributes = MSI_RecordGetInteger( row, 7 );
|
||||
file->Sequence = MSI_RecordGetInteger( row, 8 );
|
||||
|
||||
package->files[index].Temporary = FALSE;
|
||||
package->files[index].State = 0;
|
||||
file->Temporary = FALSE;
|
||||
file->State = 0;
|
||||
|
||||
TRACE("File Loaded (%s)\n",debugstr_w(package->files[index].File));
|
||||
TRACE("File Loaded (%s)\n",debugstr_w(file->File));
|
||||
|
||||
list_add_tail( &package->files, &file->entry );
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
@ -1722,9 +1718,9 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
|
|||
{'I','N','S','T','A','L','L','L','E','V','E','L',0};
|
||||
static const WCHAR szOne[] = { '1', 0 };
|
||||
MSICOMPONENT *comp;
|
||||
MSIFILE *file;
|
||||
UINT rc;
|
||||
MSIQUERY * view;
|
||||
DWORD i;
|
||||
LPWSTR level;
|
||||
DWORD sz = 3;
|
||||
WCHAR buffer[3];
|
||||
|
@ -1743,14 +1739,12 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
|
|||
msiobj_release(&view->hdr);
|
||||
}
|
||||
|
||||
TRACE("File calculations %i files\n",package->loaded_files);
|
||||
TRACE("File calculations\n");
|
||||
|
||||
for (i = 0; i < package->loaded_files; i++)
|
||||
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
|
||||
{
|
||||
MSICOMPONENT* comp = NULL;
|
||||
MSIFILE* file= NULL;
|
||||
|
||||
file = &package->files[i];
|
||||
comp = file->Component;
|
||||
|
||||
if (file->Temporary == TRUE)
|
||||
|
@ -2198,7 +2192,7 @@ static UINT ACTION_InstallValidate(MSIPACKAGE *package)
|
|||
MSIQUERY * view;
|
||||
MSIRECORD * row = 0;
|
||||
MSIFEATURE *feature;
|
||||
int i;
|
||||
MSIFILE *file;
|
||||
|
||||
TRACE(" InstallValidate \n");
|
||||
|
||||
|
@ -2233,8 +2227,10 @@ static UINT ACTION_InstallValidate(MSIPACKAGE *package)
|
|||
{
|
||||
total += COMPONENT_PROGRESS_VALUE;
|
||||
}
|
||||
for (i=0; i < package->loaded_files; i++)
|
||||
total += package->files[i].FileSize;
|
||||
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
|
||||
{
|
||||
total += file->FileSize;
|
||||
}
|
||||
ui_progress(package,0,total,0,0);
|
||||
|
||||
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
|
||||
|
@ -2347,14 +2343,10 @@ static LPWSTR resolve_keypath( MSIPACKAGE* package, MSICOMPONENT *cmp )
|
|||
}
|
||||
else
|
||||
{
|
||||
int j;
|
||||
j = get_loaded_file(package,cmp->KeyPath);
|
||||
MSIFILE *file = get_loaded_file( package, cmp->KeyPath );
|
||||
|
||||
if (j>=0)
|
||||
{
|
||||
LPWSTR p = strdupW(package->files[j].TargetPath);
|
||||
return p;
|
||||
}
|
||||
if (file)
|
||||
return strdupW( file->TargetPath );
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2411,7 +2403,6 @@ static void ACTION_RefCountComponent( MSIPACKAGE* package, MSICOMPONENT *comp )
|
|||
MSIFEATURE *feature;
|
||||
INT count = 0;
|
||||
BOOL write = FALSE;
|
||||
INT j;
|
||||
|
||||
/* only refcount DLLs */
|
||||
if (comp->KeyPath[0]==0 ||
|
||||
|
@ -2441,6 +2432,7 @@ static void ACTION_RefCountComponent( MSIPACKAGE* package, MSICOMPONENT *comp )
|
|||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
/* decrement counts */
|
||||
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
|
||||
{
|
||||
|
@ -2458,13 +2450,17 @@ static void ACTION_RefCountComponent( MSIPACKAGE* package, MSICOMPONENT *comp )
|
|||
|
||||
/* ref count all the files in the component */
|
||||
if (write)
|
||||
for (j = 0; j < package->loaded_files; j++)
|
||||
{
|
||||
MSIFILE *file;
|
||||
|
||||
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
|
||||
{
|
||||
if (package->files[j].Temporary)
|
||||
if (file->Temporary)
|
||||
continue;
|
||||
if (package->files[j].Component == comp)
|
||||
ACTION_WriteSharedDLLsCount(package->files[j].TargetPath,count);
|
||||
if (file->Component == comp)
|
||||
ACTION_WriteSharedDLLsCount( file->TargetPath, count );
|
||||
}
|
||||
}
|
||||
|
||||
/* add a count for permenent */
|
||||
if (comp->Attributes & msidbComponentAttributesPermanent)
|
||||
|
@ -2658,8 +2654,8 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param)
|
|||
{
|
||||
MSIPACKAGE* package = (MSIPACKAGE*)param;
|
||||
LPCWSTR component;
|
||||
INT index;
|
||||
MSICOMPONENT *comp;
|
||||
MSIFILE *file;
|
||||
typelib_struct tl_struct;
|
||||
HMODULE module;
|
||||
static const WCHAR szTYPELIB[] = {'T','Y','P','E','L','I','B',0};
|
||||
|
@ -2680,20 +2676,18 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param)
|
|||
|
||||
comp->Action = INSTALLSTATE_LOCAL;
|
||||
|
||||
index = get_loaded_file(package,comp->KeyPath);
|
||||
|
||||
if (index < 0)
|
||||
file = get_loaded_file( package, comp->KeyPath );
|
||||
if (!file)
|
||||
return ERROR_SUCCESS;
|
||||
|
||||
module = LoadLibraryExW(package->files[index].TargetPath, NULL,
|
||||
LOAD_LIBRARY_AS_DATAFILE);
|
||||
module = LoadLibraryExW( file->TargetPath, NULL, LOAD_LIBRARY_AS_DATAFILE );
|
||||
if (module != NULL)
|
||||
{
|
||||
LPWSTR guid;
|
||||
guid = load_dynamic_stringW(row,1);
|
||||
CLSIDFromString(guid, &tl_struct.clsid);
|
||||
HeapFree(GetProcessHeap(),0,guid);
|
||||
tl_struct.source = strdupW(package->files[index].TargetPath);
|
||||
tl_struct.source = strdupW( file->TargetPath );
|
||||
tl_struct.path = NULL;
|
||||
|
||||
EnumResourceNamesW(module, szTYPELIB, Typelib_EnumResNameProc,
|
||||
|
@ -2733,8 +2727,7 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param)
|
|||
HeapFree(GetProcessHeap(),0,tl_struct.source);
|
||||
}
|
||||
else
|
||||
ERR("Could not load file! %s\n",
|
||||
debugstr_w(package->files[index].TargetPath));
|
||||
ERR("Could not load file! %s\n", debugstr_w(file->TargetPath));
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
@ -3162,7 +3155,7 @@ static UINT ITERATE_WriteIniValues(MSIRECORD *row, LPVOID param)
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
fullname = build_directory_name(3, folder, filename, NULL);
|
||||
fullname = build_directory_name(2, folder, filename);
|
||||
|
||||
if (action == 0)
|
||||
{
|
||||
|
@ -3231,7 +3224,7 @@ static UINT ITERATE_SelfRegModules(MSIRECORD *row, LPVOID param)
|
|||
MSIPACKAGE *package = (MSIPACKAGE*)param;
|
||||
LPCWSTR filename;
|
||||
LPWSTR FullName;
|
||||
INT index;
|
||||
MSIFILE *file;
|
||||
DWORD len;
|
||||
static const WCHAR ExeStr[] =
|
||||
{'r','e','g','s','v','r','3','2','.','e','x','e',' ','\"',0};
|
||||
|
@ -3243,21 +3236,19 @@ static UINT ITERATE_SelfRegModules(MSIRECORD *row, LPVOID param)
|
|||
memset(&si,0,sizeof(STARTUPINFOW));
|
||||
|
||||
filename = MSI_RecordGetString(row,1);
|
||||
index = get_loaded_file(package,filename);
|
||||
file = get_loaded_file( package, filename );
|
||||
|
||||
if (index < 0)
|
||||
if (!file)
|
||||
{
|
||||
ERR("Unable to find file id %s\n",debugstr_w(filename));
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
len = strlenW(ExeStr);
|
||||
len += strlenW(package->files[index].TargetPath);
|
||||
len +=2;
|
||||
len = strlenW(ExeStr) + strlenW( file->TargetPath ) + 2;
|
||||
|
||||
FullName = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
|
||||
strcpyW(FullName,ExeStr);
|
||||
strcatW(FullName,package->files[index].TargetPath);
|
||||
strcatW( FullName, file->TargetPath );
|
||||
strcatW(FullName,close);
|
||||
|
||||
TRACE("Registering %s\n",debugstr_w(FullName));
|
||||
|
@ -3936,8 +3927,8 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param)
|
|||
{
|
||||
MSIPACKAGE *package = (MSIPACKAGE*)param;
|
||||
LPWSTR name;
|
||||
LPCWSTR file;
|
||||
INT index;
|
||||
LPCWSTR filename;
|
||||
MSIFILE *file;
|
||||
DWORD size;
|
||||
static const WCHAR regfont1[] =
|
||||
{'S','o','f','t','w','a','r','e','\\',
|
||||
|
@ -3954,9 +3945,9 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param)
|
|||
HKEY hkey1;
|
||||
HKEY hkey2;
|
||||
|
||||
file = MSI_RecordGetString(row,1);
|
||||
index = get_loaded_file(package,file);
|
||||
if (index < 0)
|
||||
filename = MSI_RecordGetString( row, 1 );
|
||||
file = get_loaded_file( package, filename );
|
||||
if (!file)
|
||||
{
|
||||
ERR("Unable to load file\n");
|
||||
return ERROR_SUCCESS;
|
||||
|
@ -3964,7 +3955,7 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param)
|
|||
|
||||
/* check to make sure that component is installed */
|
||||
if (!ACTION_VerifyComponentForAction(package,
|
||||
package->files[index].Component, INSTALLSTATE_LOCAL))
|
||||
file->Component, INSTALLSTATE_LOCAL))
|
||||
{
|
||||
TRACE("Skipping: Component not scheduled for install\n");
|
||||
return ERROR_SUCCESS;
|
||||
|
@ -3974,17 +3965,15 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param)
|
|||
RegCreateKeyW(HKEY_LOCAL_MACHINE,regfont2,&hkey2);
|
||||
|
||||
if (MSI_RecordIsNull(row,2))
|
||||
name = load_ttfname_from(package->files[index].TargetPath);
|
||||
name = load_ttfname_from( file->TargetPath );
|
||||
else
|
||||
name = load_dynamic_stringW(row,2);
|
||||
|
||||
if (name)
|
||||
{
|
||||
size = strlenW(package->files[index].FileName) * sizeof(WCHAR);
|
||||
RegSetValueExW(hkey1,name,0,REG_SZ,
|
||||
(LPBYTE)package->files[index].FileName,size);
|
||||
RegSetValueExW(hkey2,name,0,REG_SZ,
|
||||
(LPBYTE)package->files[index].FileName,size);
|
||||
size = strlenW( file->FileName ) * sizeof(WCHAR);
|
||||
RegSetValueExW( hkey1, name, 0, REG_SZ, (LPBYTE)file->FileName, size );
|
||||
RegSetValueExW( hkey2, name, 0, REG_SZ, (LPBYTE)file->FileName, size );
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(),0,name);
|
||||
|
|
|
@ -93,6 +93,7 @@ typedef struct tagMSIFOLDER
|
|||
|
||||
typedef struct tagMSIFILE
|
||||
{
|
||||
struct list entry;
|
||||
LPWSTR File;
|
||||
MSICOMPONENT *Component;
|
||||
LPWSTR FileName;
|
||||
|
@ -237,8 +238,8 @@ LPWSTR load_dynamic_property(MSIPACKAGE *package, LPCWSTR prop, UINT* rc);
|
|||
LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
|
||||
BOOL set_prop, MSIFOLDER **folder);
|
||||
MSICOMPONENT *get_loaded_component( MSIPACKAGE* package, LPCWSTR Component );
|
||||
MSIFEATURE *get_loaded_feature(MSIPACKAGE* package, LPCWSTR Feature );
|
||||
int get_loaded_file(MSIPACKAGE* package, LPCWSTR file);
|
||||
MSIFEATURE *get_loaded_feature( MSIPACKAGE* package, LPCWSTR Feature );
|
||||
MSIFILE *get_loaded_file( MSIPACKAGE* package, LPCWSTR file );
|
||||
int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path);
|
||||
UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action);
|
||||
UINT build_icon_path(MSIPACKAGE *, LPCWSTR, LPWSTR *);
|
||||
|
|
|
@ -918,7 +918,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
|
|||
for (i = 0; i < package->loaded_classes; i++)
|
||||
{
|
||||
MSICOMPONENT *comp;
|
||||
INT index;
|
||||
MSIFILE *file;
|
||||
DWORD size, sz;
|
||||
LPWSTR argument;
|
||||
MSIFEATURE *feature;
|
||||
|
@ -959,7 +959,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
|
|||
Description)+1)*sizeof(WCHAR));
|
||||
|
||||
RegCreateKeyW(hkey2,package->classes[i].Context,&hkey3);
|
||||
index = get_loaded_file( package, comp->KeyPath );
|
||||
file = get_loaded_file( package, comp->KeyPath );
|
||||
|
||||
|
||||
/* the context server is a short path name
|
||||
|
@ -968,7 +968,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
|
|||
if (strcmpiW(package->classes[i].Context,szInprocServer32)!=0)
|
||||
{
|
||||
sz = 0;
|
||||
sz = GetShortPathNameW(package->files[index].TargetPath, NULL, 0);
|
||||
sz = GetShortPathNameW( file->TargetPath, NULL, 0 );
|
||||
if (sz == 0)
|
||||
{
|
||||
ERR("Unable to find short path for CLSID COM Server\n");
|
||||
|
@ -986,8 +986,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
|
|||
}
|
||||
|
||||
argument = HeapAlloc(GetProcessHeap(), 0, size + sizeof(WCHAR));
|
||||
GetShortPathNameW(package->files[index].TargetPath, argument,
|
||||
sz);
|
||||
GetShortPathNameW( file->TargetPath, argument, sz );
|
||||
|
||||
if (package->classes[i].Argument)
|
||||
{
|
||||
|
@ -998,7 +997,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
|
|||
}
|
||||
else
|
||||
{
|
||||
size = lstrlenW(package->files[index].TargetPath) * sizeof(WCHAR);
|
||||
size = lstrlenW( file->TargetPath ) * sizeof(WCHAR);
|
||||
|
||||
if (package->classes[i].Argument)
|
||||
{
|
||||
|
@ -1007,7 +1006,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
|
|||
}
|
||||
|
||||
argument = HeapAlloc(GetProcessHeap(), 0, size + sizeof(WCHAR));
|
||||
strcpyW(argument, package->files[index].TargetPath);
|
||||
strcpyW( argument, file->TargetPath );
|
||||
|
||||
if (package->classes[i].Argument)
|
||||
{
|
||||
|
|
|
@ -586,14 +586,16 @@ static UINT HANDLE_CustomType18(MSIPACKAGE *package, LPCWSTR source,
|
|||
WCHAR *cmd;
|
||||
INT len;
|
||||
static const WCHAR spc[] = {' ',0};
|
||||
int index;
|
||||
MSIFILE *file;
|
||||
UINT prc;
|
||||
|
||||
memset(&si,0,sizeof(STARTUPINFOW));
|
||||
|
||||
index = get_loaded_file(package,source);
|
||||
file = get_loaded_file(package,source);
|
||||
if( !file )
|
||||
return ERROR_FUNCTION_FAILED;
|
||||
|
||||
len = strlenW(package->files[index].TargetPath);
|
||||
len = lstrlenW( file->TargetPath );
|
||||
|
||||
deformat_string(package,target,&deformated);
|
||||
if (deformated)
|
||||
|
@ -602,7 +604,7 @@ static UINT HANDLE_CustomType18(MSIPACKAGE *package, LPCWSTR source,
|
|||
|
||||
cmd = HeapAlloc(GetProcessHeap(),0,len * sizeof(WCHAR));
|
||||
|
||||
strcpyW(cmd, package->files[index].TargetPath);
|
||||
lstrcpyW( cmd, file->TargetPath);
|
||||
if (deformated)
|
||||
{
|
||||
strcatW(cmd, spc);
|
||||
|
|
|
@ -207,23 +207,22 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
|
|||
LPWSTR tracknametmp;
|
||||
static const WCHAR tmpprefix[] = {'C','A','B','T','M','P','_',0};
|
||||
LPWSTR given_file;
|
||||
INT index;
|
||||
|
||||
MSIRECORD * uirow;
|
||||
LPWSTR uipath;
|
||||
MSIFILE *f;
|
||||
|
||||
given_file = strdupAtoW(pfdin->psz1);
|
||||
index = get_loaded_file(data->package, given_file);
|
||||
f = get_loaded_file(data->package, given_file);
|
||||
|
||||
if (index < 0)
|
||||
if (!f)
|
||||
{
|
||||
ERR("Unknown File in Cabinent (%s)\n",debugstr_w(given_file));
|
||||
HeapFree(GetProcessHeap(),0,given_file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!((data->package->files[index].State == 1 ||
|
||||
data->package->files[index].State == 2)))
|
||||
if (!((f->State == 1 || f->State == 2)))
|
||||
{
|
||||
TRACE("Skipping extraction of %s\n",debugstr_w(given_file));
|
||||
HeapFree(GetProcessHeap(),0,given_file);
|
||||
|
@ -253,16 +252,16 @@ static INT_PTR cabinet_notify(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
|
|||
|
||||
/* the UI chunk */
|
||||
uirow=MSI_CreateRecord(9);
|
||||
MSI_RecordSetStringW(uirow,1,data->package->files[index].File);
|
||||
uipath = strdupW(data->package->files[index].TargetPath);
|
||||
MSI_RecordSetStringW( uirow, 1, f->File );
|
||||
uipath = strdupW( f->TargetPath );
|
||||
*(strrchrW(uipath,'\\')+1)=0;
|
||||
MSI_RecordSetStringW(uirow,9,uipath);
|
||||
MSI_RecordSetInteger(uirow,6,data->package->files[index].FileSize);
|
||||
MSI_RecordSetInteger( uirow, 6, f->FileSize );
|
||||
ui_actiondata(data->package,szInstallFiles,uirow);
|
||||
msiobj_release( &uirow->hdr );
|
||||
HeapFree(GetProcessHeap(),0,uipath);
|
||||
|
||||
ui_progress(data->package,2,data->package->files[index].FileSize,0,0);
|
||||
ui_progress( data->package, 2, f->FileSize, 0, 0);
|
||||
|
||||
return cabinet_open(file, _O_WRONLY | _O_CREAT, 0);
|
||||
}
|
||||
|
@ -433,7 +432,7 @@ static UINT ready_volume(MSIPACKAGE* package, LPCWSTR path, LPWSTR last_volume,
|
|||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static UINT ready_media_for_file(MSIPACKAGE *package, int fileindex,
|
||||
static UINT ready_media_for_file(MSIPACKAGE *package, MSIFILE *file,
|
||||
MSICOMPONENT* comp)
|
||||
{
|
||||
UINT rc = ERROR_SUCCESS;
|
||||
|
@ -451,7 +450,6 @@ static UINT ready_media_for_file(MSIPACKAGE *package, int fileindex,
|
|||
static UINT last_sequence = 0;
|
||||
static LPWSTR last_volume = NULL;
|
||||
static LPWSTR last_path = NULL;
|
||||
MSIFILE* file = NULL;
|
||||
UINT type;
|
||||
LPCWSTR prompt;
|
||||
static DWORD count = 0;
|
||||
|
@ -469,8 +467,6 @@ static UINT ready_media_for_file(MSIPACKAGE *package, int fileindex,
|
|||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
file = &package->files[fileindex];
|
||||
|
||||
if (file->Sequence <= last_sequence)
|
||||
{
|
||||
set_file_source(package,file,comp,last_path);
|
||||
|
@ -581,8 +577,6 @@ static UINT ready_media_for_file(MSIPACKAGE *package, int fileindex,
|
|||
}
|
||||
}
|
||||
rc = !extract_cabinet_file(package, source, last_path);
|
||||
/* reaquire file ptr */
|
||||
file = &package->files[fileindex];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -615,21 +609,21 @@ static UINT ready_media_for_file(MSIPACKAGE *package, int fileindex,
|
|||
return rc;
|
||||
}
|
||||
|
||||
inline static UINT get_file_target(MSIPACKAGE *package, LPCWSTR file_key,
|
||||
static UINT get_file_target(MSIPACKAGE *package, LPCWSTR file_key,
|
||||
LPWSTR* file_source)
|
||||
{
|
||||
DWORD index;
|
||||
MSIFILE *file;
|
||||
|
||||
if (!package)
|
||||
return ERROR_INVALID_HANDLE;
|
||||
|
||||
for (index = 0; index < package->loaded_files; index ++)
|
||||
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
|
||||
{
|
||||
if (strcmpW(file_key,package->files[index].File)==0)
|
||||
if (lstrcmpW( file_key, file->File )==0)
|
||||
{
|
||||
if (package->files[index].State >= 2)
|
||||
if (file->State >= 2)
|
||||
{
|
||||
*file_source = strdupW(package->files[index].TargetPath);
|
||||
*file_source = strdupW( file->TargetPath );
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
else
|
||||
|
@ -650,8 +644,8 @@ inline static UINT get_file_target(MSIPACKAGE *package, LPCWSTR file_key,
|
|||
UINT ACTION_InstallFiles(MSIPACKAGE *package)
|
||||
{
|
||||
UINT rc = ERROR_SUCCESS;
|
||||
DWORD index;
|
||||
LPWSTR ptr;
|
||||
MSIFILE *file;
|
||||
|
||||
if (!package)
|
||||
return ERROR_INVALID_HANDLE;
|
||||
|
@ -672,13 +666,10 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
|
|||
FIXME("Write DiskPrompt\n");
|
||||
|
||||
/* Pass 1 */
|
||||
for (index = 0; index < package->loaded_files; index++)
|
||||
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
|
||||
{
|
||||
MSIFILE *file;
|
||||
MSICOMPONENT* comp = NULL;
|
||||
|
||||
file = &package->files[index];
|
||||
|
||||
if (file->Temporary)
|
||||
continue;
|
||||
|
||||
|
@ -719,12 +710,8 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
|
|||
}
|
||||
|
||||
/* Pass 2 */
|
||||
for (index = 0; index < package->loaded_files; index++)
|
||||
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
|
||||
{
|
||||
MSIFILE *file;
|
||||
|
||||
file = &package->files[index];
|
||||
|
||||
if (file->Temporary)
|
||||
continue;
|
||||
|
||||
|
@ -732,7 +719,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
|
|||
{
|
||||
TRACE("Pass 2: %s\n",debugstr_w(file->File));
|
||||
|
||||
rc = ready_media_for_file( package, index, file->Component );
|
||||
rc = ready_media_for_file( package, file, file->Component );
|
||||
if (rc != ERROR_SUCCESS)
|
||||
{
|
||||
ERR("Unable to ready media\n");
|
||||
|
@ -740,13 +727,6 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
|
|||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* WARNING!
|
||||
* our file table could change here because a new temp file
|
||||
* may have been created. So reaquire our ptr.
|
||||
*/
|
||||
file = &package->files[index];
|
||||
|
||||
TRACE("file paths %s to %s\n",debugstr_w(file->SourcePath),
|
||||
debugstr_w(file->TargetPath));
|
||||
|
||||
|
@ -791,7 +771,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
|
|||
}
|
||||
|
||||
/* cleanup */
|
||||
ready_media_for_file(NULL, 0, NULL);
|
||||
ready_media_for_file(NULL, NULL, NULL);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
|
@ -100,38 +100,37 @@ static LPWSTR deformat_file(MSIPACKAGE* package, LPCWSTR key, DWORD* sz,
|
|||
BOOL shortname)
|
||||
{
|
||||
LPWSTR value = NULL;
|
||||
INT index;
|
||||
MSIFILE *file;
|
||||
|
||||
*sz = 0;
|
||||
|
||||
if (!package)
|
||||
return NULL;
|
||||
|
||||
index = get_loaded_file(package,key);
|
||||
if (index >=0)
|
||||
file = get_loaded_file( package, key );
|
||||
if (file)
|
||||
{
|
||||
if (!shortname)
|
||||
{
|
||||
value = strdupW(package->files[index].TargetPath);
|
||||
value = strdupW( file->TargetPath );
|
||||
*sz = (strlenW(value)) * sizeof(WCHAR);
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD size = 0;
|
||||
size = GetShortPathNameW(package->files[index].TargetPath, NULL, 0);
|
||||
size = GetShortPathNameW( file->TargetPath, NULL, 0 );
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
*sz = (size-1) * sizeof (WCHAR);
|
||||
size ++;
|
||||
value = HeapAlloc(GetProcessHeap(),0,size * sizeof(WCHAR));
|
||||
GetShortPathNameW(package->files[index].TargetPath, value,
|
||||
size);
|
||||
GetShortPathNameW( file->TargetPath, value, size );
|
||||
}
|
||||
else
|
||||
{
|
||||
ERR("Unable to get ShortPath size (%s)\n",
|
||||
debugstr_w(package->files[index].TargetPath));
|
||||
ERR("Unable to get ShortPath size (%s)\n",
|
||||
debugstr_w( file->TargetPath) );
|
||||
value = NULL;
|
||||
*sz = 0;
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ LPWSTR load_dynamic_property(MSIPACKAGE *package, LPCWSTR prop, UINT* rc)
|
|||
|
||||
MSICOMPONENT* get_loaded_component( MSIPACKAGE* package, LPCWSTR Component )
|
||||
{
|
||||
MSICOMPONENT *comp = NULL;
|
||||
MSICOMPONENT *comp;
|
||||
|
||||
LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry )
|
||||
{
|
||||
|
@ -181,7 +181,7 @@ MSICOMPONENT* get_loaded_component( MSIPACKAGE* package, LPCWSTR Component )
|
|||
|
||||
MSIFEATURE* get_loaded_feature(MSIPACKAGE* package, LPCWSTR Feature )
|
||||
{
|
||||
MSIFEATURE *feature = NULL;
|
||||
MSIFEATURE *feature;
|
||||
|
||||
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
|
||||
{
|
||||
|
@ -191,49 +191,36 @@ MSIFEATURE* get_loaded_feature(MSIPACKAGE* package, LPCWSTR Feature )
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int get_loaded_file(MSIPACKAGE* package, LPCWSTR file)
|
||||
MSIFILE* get_loaded_file( MSIPACKAGE* package, LPCWSTR key )
|
||||
{
|
||||
int rc = -1;
|
||||
DWORD i;
|
||||
MSIFILE *file;
|
||||
|
||||
for (i = 0; i < package->loaded_files; i++)
|
||||
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
|
||||
{
|
||||
if (strcmpW(file,package->files[i].File)==0)
|
||||
{
|
||||
rc = i;
|
||||
break;
|
||||
}
|
||||
if (lstrcmpW( key, file->File )==0)
|
||||
return file;
|
||||
}
|
||||
return rc;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path)
|
||||
int track_tempfile( MSIPACKAGE *package, LPCWSTR name, LPCWSTR path )
|
||||
{
|
||||
DWORD i;
|
||||
DWORD index;
|
||||
MSIFILE *file;
|
||||
|
||||
if (!package)
|
||||
return -2;
|
||||
|
||||
for (i=0; i < package->loaded_files; i++)
|
||||
if (strcmpW(package->files[i].File,name)==0)
|
||||
return -1;
|
||||
file = get_loaded_file( package, name );
|
||||
if (file)
|
||||
return -1;
|
||||
|
||||
index = package->loaded_files;
|
||||
package->loaded_files++;
|
||||
if (package->loaded_files== 1)
|
||||
package->files = HeapAlloc(GetProcessHeap(),0,sizeof(MSIFILE));
|
||||
else
|
||||
package->files = HeapReAlloc(GetProcessHeap(),0,
|
||||
package->files , package->loaded_files * sizeof(MSIFILE));
|
||||
file = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof (MSIFILE) );
|
||||
|
||||
memset(&package->files[index],0,sizeof(MSIFILE));
|
||||
file->File = strdupW( name );
|
||||
file->TargetPath = strdupW( path );
|
||||
file->Temporary = TRUE;
|
||||
|
||||
package->files[index].File = strdupW(name);
|
||||
package->files[index].TargetPath = strdupW(path);
|
||||
package->files[index].Temporary = TRUE;
|
||||
|
||||
TRACE("Tracking tempfile (%s)\n",debugstr_w(package->files[index].File));
|
||||
TRACE("Tracking tempfile (%s)\n", debugstr_w( file->File ));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -429,19 +416,18 @@ UINT schedule_action(MSIPACKAGE *package, UINT script, LPCWSTR action)
|
|||
|
||||
static void remove_tracked_tempfiles(MSIPACKAGE* package)
|
||||
{
|
||||
DWORD i;
|
||||
MSIFILE *file;
|
||||
|
||||
if (!package)
|
||||
return;
|
||||
|
||||
for (i = 0; i < package->loaded_files; i++)
|
||||
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
|
||||
{
|
||||
if (package->files[i].Temporary)
|
||||
if (file->Temporary)
|
||||
{
|
||||
TRACE("Cleaning up %s\n",debugstr_w(package->files[i].TargetPath));
|
||||
DeleteFileW(package->files[i].TargetPath);
|
||||
TRACE("Cleaning up %s\n", debugstr_w( file->TargetPath ));
|
||||
DeleteFileW( file->TargetPath );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -497,19 +483,20 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
|
|||
HeapFree( GetProcessHeap(), 0, comp );
|
||||
}
|
||||
|
||||
for (i = 0; i < package->loaded_files; i++)
|
||||
LIST_FOR_EACH_SAFE( item, cursor, &package->files )
|
||||
{
|
||||
HeapFree(GetProcessHeap(),0,package->files[i].File);
|
||||
HeapFree(GetProcessHeap(),0,package->files[i].FileName);
|
||||
HeapFree(GetProcessHeap(),0,package->files[i].ShortName);
|
||||
HeapFree(GetProcessHeap(),0,package->files[i].Version);
|
||||
HeapFree(GetProcessHeap(),0,package->files[i].Language);
|
||||
HeapFree(GetProcessHeap(),0,package->files[i].SourcePath);
|
||||
HeapFree(GetProcessHeap(),0,package->files[i].TargetPath);
|
||||
}
|
||||
MSIFILE *file = LIST_ENTRY( item, MSIFILE, entry );
|
||||
|
||||
if (package->files && package->loaded_files > 0)
|
||||
HeapFree(GetProcessHeap(),0,package->files);
|
||||
list_remove( &file->entry );
|
||||
HeapFree( GetProcessHeap(), 0, file->File );
|
||||
HeapFree( GetProcessHeap(), 0, file->FileName );
|
||||
HeapFree( GetProcessHeap(), 0, file->ShortName );
|
||||
HeapFree( GetProcessHeap(), 0, file->Version );
|
||||
HeapFree( GetProcessHeap(), 0, file->Language );
|
||||
HeapFree( GetProcessHeap(), 0, file->SourcePath );
|
||||
HeapFree( GetProcessHeap(), 0, file->TargetPath );
|
||||
HeapFree( GetProcessHeap(), 0, file );
|
||||
}
|
||||
|
||||
/* clean up extension, progid, class and verb structures */
|
||||
for (i = 0; i < package->loaded_classes; i++)
|
||||
|
|
|
@ -190,8 +190,7 @@ typedef struct tagMSIPACKAGE
|
|||
UINT loaded_folders;
|
||||
struct list components;
|
||||
struct list features;
|
||||
struct tagMSIFILE *files;
|
||||
UINT loaded_files;
|
||||
struct list files;
|
||||
LPWSTR ActionFormat;
|
||||
LPWSTR LastAction;
|
||||
|
||||
|
|
|
@ -380,9 +380,8 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db )
|
|||
list_init( &package->features );
|
||||
package->folders = NULL;
|
||||
list_init( &package->components );
|
||||
package->files = NULL;
|
||||
list_init( &package->files );
|
||||
package->loaded_folders = 0;
|
||||
package->loaded_files = 0;
|
||||
package->ActionFormat = NULL;
|
||||
package->LastAction = NULL;
|
||||
package->dialog = NULL;
|
||||
|
|
Loading…
Reference in New Issue