Commit 38d67a45 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

- build a standard Wine list of components instead of using an array

- use component pointers instead of array indexes
parent 94feee32
...@@ -965,52 +965,44 @@ static UINT ACTION_CreateFolders(MSIPACKAGE *package) ...@@ -965,52 +965,44 @@ static UINT ACTION_CreateFolders(MSIPACKAGE *package)
return rc; return rc;
} }
static int load_component(MSIPACKAGE* package, MSIRECORD * row) static MSICOMPONENT* load_component( MSIRECORD * row )
{ {
int index = package->loaded_components; MSICOMPONENT *comp;
DWORD sz; DWORD sz;
/* fill in the data */ comp = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MSICOMPONENT) );
if (!comp)
package->loaded_components++; return comp;
if (package->loaded_components == 1)
package->components = HeapAlloc(GetProcessHeap(),0,
sizeof(MSICOMPONENT));
else
package->components = HeapReAlloc(GetProcessHeap(),0,
package->components, package->loaded_components *
sizeof(MSICOMPONENT));
memset(&package->components[index],0,sizeof(MSICOMPONENT));
/* fill in the data */
sz = IDENTIFIER_SIZE; sz = IDENTIFIER_SIZE;
MSI_RecordGetStringW(row,1,package->components[index].Component,&sz); MSI_RecordGetStringW(row,1,comp->Component,&sz);
TRACE("Loading Component %s\n", TRACE("Loading Component %s\n",
debugstr_w(package->components[index].Component)); debugstr_w(comp->Component));
sz = 0x100; sz = 0x100;
if (!MSI_RecordIsNull(row,2)) if (!MSI_RecordIsNull(row,2))
MSI_RecordGetStringW(row,2,package->components[index].ComponentId,&sz); MSI_RecordGetStringW(row,2,comp->ComponentId,&sz);
sz = IDENTIFIER_SIZE; sz = IDENTIFIER_SIZE;
MSI_RecordGetStringW(row,3,package->components[index].Directory,&sz); MSI_RecordGetStringW(row,3,comp->Directory,&sz);
package->components[index].Attributes = MSI_RecordGetInteger(row,4); comp->Attributes = MSI_RecordGetInteger(row,4);
sz = 0x100; sz = 0x100;
MSI_RecordGetStringW(row,5,package->components[index].Condition,&sz); MSI_RecordGetStringW(row,5,comp->Condition,&sz);
sz = IDENTIFIER_SIZE; sz = IDENTIFIER_SIZE;
MSI_RecordGetStringW(row,6,package->components[index].KeyPath,&sz); MSI_RecordGetStringW(row,6,comp->KeyPath,&sz);
package->components[index].Installed = INSTALLSTATE_ABSENT; comp->Installed = INSTALLSTATE_ABSENT;
package->components[index].Action = INSTALLSTATE_UNKNOWN; comp->Action = INSTALLSTATE_UNKNOWN;
package->components[index].ActionRequest = INSTALLSTATE_UNKNOWN; comp->ActionRequest = INSTALLSTATE_UNKNOWN;
package->components[index].Enabled = TRUE; comp->Enabled = TRUE;
return index; return comp;
} }
typedef struct { typedef struct {
...@@ -1018,28 +1010,33 @@ typedef struct { ...@@ -1018,28 +1010,33 @@ typedef struct {
INT index; INT index;
} _ilfs; } _ilfs;
static UINT add_feature_component( MSIFEATURE *feature, int index ) static UINT add_feature_component( MSIFEATURE *feature, MSICOMPONENT *comp )
{ {
ComponentList *cl; ComponentList *cl;
cl = HeapAlloc( GetProcessHeap(), 0, sizeof (*cl) ); cl = HeapAlloc( GetProcessHeap(), 0, sizeof (*cl) );
if ( !cl ) if ( !cl )
return ERROR_NOT_ENOUGH_MEMORY; return ERROR_NOT_ENOUGH_MEMORY;
cl->component = index; cl->component = comp;
list_add_tail( feature->Components, &cl->entry ); list_add_tail( feature->Components, &cl->entry );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static UINT iterate_component_check(MSIRECORD *row, LPVOID param) static UINT iterate_component_check( MSIRECORD *row, LPVOID param )
{ {
_ilfs* ilfs= (_ilfs*)param; _ilfs* ilfs= (_ilfs*)param;
INT c_indx; MSIPACKAGE *package = ilfs->package;
MSICOMPONENT *comp;
comp = load_component( row );
if (!comp)
return ERROR_FUNCTION_FAILED;
c_indx = load_component(ilfs->package,row); list_add_tail( &package->components, &comp->entry );
add_feature_component( &ilfs->package->features[ilfs->index], c_indx ); add_feature_component( &package->features[ilfs->index], comp );
TRACE("Loaded new component to index %i\n",c_indx); TRACE("Loaded new component %p\n", comp);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -1049,7 +1046,7 @@ static UINT iterate_load_featurecomponents(MSIRECORD *row, LPVOID param) ...@@ -1049,7 +1046,7 @@ static UINT iterate_load_featurecomponents(MSIRECORD *row, LPVOID param)
_ilfs* ilfs= (_ilfs*)param; _ilfs* ilfs= (_ilfs*)param;
LPCWSTR component; LPCWSTR component;
DWORD rc; DWORD rc;
INT c_indx; MSICOMPONENT *comp;
MSIQUERY * view; MSIQUERY * view;
static const WCHAR Query[] = static const WCHAR Query[] =
{'S','E','L','E','C','T',' ','*',' ','F','R', 'O','M',' ', {'S','E','L','E','C','T',' ','*',' ','F','R', 'O','M',' ',
...@@ -1061,12 +1058,11 @@ static UINT iterate_load_featurecomponents(MSIRECORD *row, LPVOID param) ...@@ -1061,12 +1058,11 @@ static UINT iterate_load_featurecomponents(MSIRECORD *row, LPVOID param)
component = MSI_RecordGetString(row,1); component = MSI_RecordGetString(row,1);
/* check to see if the component is already loaded */ /* check to see if the component is already loaded */
c_indx = get_loaded_component(ilfs->package,component); comp = get_loaded_component( ilfs->package, component );
if (c_indx != -1) if (comp)
{ {
TRACE("Component %s already loaded at %i\n", debugstr_w(component), TRACE("Component %s already loaded\n", debugstr_w(component) );
c_indx); add_feature_component( &ilfs->package->features[ilfs->index], comp );
add_feature_component( &ilfs->package->features[ilfs->index], c_indx );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -1183,10 +1179,10 @@ static UINT load_file(MSIRECORD *row, LPVOID param) ...@@ -1183,10 +1179,10 @@ static UINT load_file(MSIRECORD *row, LPVOID param)
package->files[index].File = load_dynamic_stringW(row, 1); package->files[index].File = load_dynamic_stringW(row, 1);
component = MSI_RecordGetString(row, 2); component = MSI_RecordGetString(row, 2);
package->files[index].ComponentIndex = get_loaded_component(package, package->files[index].Component = get_loaded_component(package,
component); component);
if (package->files[index].ComponentIndex == -1) if (!package->files[index].Component)
ERR("Unfound Component %s\n",debugstr_w(component)); ERR("Unfound Component %s\n",debugstr_w(component));
package->files[index].FileName = load_dynamic_stringW(row,3); package->files[index].FileName = load_dynamic_stringW(row,3);
...@@ -1423,16 +1419,17 @@ static INT load_folder(MSIPACKAGE *package, const WCHAR* dir) ...@@ -1423,16 +1419,17 @@ static INT load_folder(MSIPACKAGE *package, const WCHAR* dir)
/* scan for and update current install states */ /* scan for and update current install states */
static void ACTION_UpdateInstallStates(MSIPACKAGE *package) static void ACTION_UpdateInstallStates(MSIPACKAGE *package)
{ {
MSICOMPONENT *comp;
int i; int i;
for (i = 0; i < package->loaded_components; i++) LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry )
{ {
INSTALLSTATE res; INSTALLSTATE res;
res = MsiGetComponentPathW(package->ProductCode, res = MsiGetComponentPathW( package->ProductCode,
package->components[i].ComponentId , NULL, NULL); comp->ComponentId, NULL, NULL);
if (res < 0) if (res < 0)
res = INSTALLSTATE_ABSENT; res = INSTALLSTATE_ABSENT;
package->components[i].Installed = res; comp->Installed = res;
} }
for (i = 0; i < package->loaded_features; i++) for (i = 0; i < package->loaded_features; i++)
...@@ -1443,16 +1440,16 @@ static void ACTION_UpdateInstallStates(MSIPACKAGE *package) ...@@ -1443,16 +1440,16 @@ static void ACTION_UpdateInstallStates(MSIPACKAGE *package)
LIST_FOR_EACH_ENTRY( cl, package->features[i].Components, LIST_FOR_EACH_ENTRY( cl, package->features[i].Components,
ComponentList, entry ) ComponentList, entry )
{ {
MSICOMPONENT* component = &package->components[cl->component]; comp= cl->component;
if (res == -10) if (res == -10)
res = component->Installed; res = comp->Installed;
else else
{ {
if (res == component->Installed) if (res == comp->Installed)
continue; continue;
if (res != component->Installed) if (res != comp->Installed)
res = INSTALLSTATE_INCOMPLETE; res = INSTALLSTATE_INCOMPLETE;
} }
} }
...@@ -1522,6 +1519,7 @@ static UINT SetFeatureStates(MSIPACKAGE *package) ...@@ -1522,6 +1519,7 @@ static UINT SetFeatureStates(MSIPACKAGE *package)
static const WCHAR szRemove[] = static const WCHAR szRemove[] =
{'R','E','M','O','V','E',0}; {'R','E','M','O','V','E',0};
BOOL override = FALSE; BOOL override = FALSE;
MSICOMPONENT* component;
/* I do not know if this is where it should happen.. but */ /* I do not know if this is where it should happen.. but */
...@@ -1615,7 +1613,7 @@ static UINT SetFeatureStates(MSIPACKAGE *package) ...@@ -1615,7 +1613,7 @@ static UINT SetFeatureStates(MSIPACKAGE *package)
LIST_FOR_EACH_ENTRY( cl, feature->Components, ComponentList, entry ) LIST_FOR_EACH_ENTRY( cl, feature->Components, ComponentList, entry )
{ {
MSICOMPONENT* component = &package->components[cl->component]; component = cl->component;
if (!component->Enabled) if (!component->Enabled)
{ {
...@@ -1662,10 +1660,8 @@ static UINT SetFeatureStates(MSIPACKAGE *package) ...@@ -1662,10 +1660,8 @@ static UINT SetFeatureStates(MSIPACKAGE *package)
} }
} }
for(i = 0; i < package->loaded_components; i++) LIST_FOR_EACH_ENTRY( component, &package->components, MSICOMPONENT, entry )
{ {
MSICOMPONENT* component= &package->components[i];
TRACE("Result: Component %s (Installed %i, Action %i, Request %i)\n", TRACE("Result: Component %s (Installed %i, Action %i, Request %i)\n",
debugstr_w(component->Component), component->Installed, debugstr_w(component->Component), component->Installed,
component->Action, component->ActionRequest); component->Action, component->ActionRequest);
...@@ -1740,6 +1736,7 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package) ...@@ -1740,6 +1736,7 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
static const WCHAR szlevel[] = static const WCHAR szlevel[] =
{'I','N','S','T','A','L','L','L','E','V','E','L',0}; {'I','N','S','T','A','L','L','L','E','V','E','L',0};
static const WCHAR szOne[] = { '1', 0 }; static const WCHAR szOne[] = { '1', 0 };
MSICOMPONENT *comp;
UINT rc; UINT rc;
MSIQUERY * view; MSIQUERY * view;
DWORD i; DWORD i;
...@@ -1769,8 +1766,7 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package) ...@@ -1769,8 +1766,7 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
MSIFILE* file= NULL; MSIFILE* file= NULL;
file = &package->files[i]; file = &package->files[i];
if (file->ComponentIndex >= 0) comp = file->Component;
comp = &package->components[file->ComponentIndex];
if (file->Temporary == TRUE) if (file->Temporary == TRUE)
continue; continue;
...@@ -1856,16 +1852,15 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package) ...@@ -1856,16 +1852,15 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
} }
TRACE("Enabling or Disabling Components\n"); TRACE("Enabling or Disabling Components\n");
for (i = 0; i < package->loaded_components; i++) LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry )
{ {
if (package->components[i].Condition[0]) if (comp->Condition[0])
{ {
if (MSI_EvaluateConditionW(package, if (MSI_EvaluateConditionW(package,
package->components[i].Condition) == MSICONDITION_FALSE) comp->Condition) == MSICONDITION_FALSE)
{ {
TRACE("Disabling component %s\n", TRACE("Disabling component %s\n", debugstr_w(comp->Component));
debugstr_w(package->components[i].Component)); comp->Enabled = FALSE;
package->components[i].Enabled = FALSE;
} }
} }
} }
...@@ -2013,7 +2008,7 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param) ...@@ -2013,7 +2008,7 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param)
DWORD type,size; DWORD type,size;
LPWSTR deformated; LPWSTR deformated;
LPCWSTR szRoot, component, name, key, value; LPCWSTR szRoot, component, name, key, value;
INT component_index; MSICOMPONENT *comp;
MSIRECORD * uirow; MSIRECORD * uirow;
LPWSTR uikey; LPWSTR uikey;
INT root; INT root;
...@@ -2028,21 +2023,19 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param) ...@@ -2028,21 +2023,19 @@ static UINT ITERATE_WriteRegistryValues(MSIRECORD *row, LPVOID param)
name = NULL; name = NULL;
component = MSI_RecordGetString(row, 6); component = MSI_RecordGetString(row, 6);
component_index = get_loaded_component(package,component); comp = get_loaded_component(package,component);
if (!ACTION_VerifyComponentForAction(package, component_index, if (!ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_LOCAL))
INSTALLSTATE_LOCAL))
{ {
TRACE("Skipping write due to disabled component %s\n", TRACE("Skipping write due to disabled component %s\n",
debugstr_w(component)); debugstr_w(component));
package->components[component_index].Action = comp->Action = comp->Installed;
package->components[component_index].Installed;
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
package->components[component_index].Action = INSTALLSTATE_LOCAL; comp->Action = INSTALLSTATE_LOCAL;
name = MSI_RecordGetString(row, 4); name = MSI_RecordGetString(row, 4);
if( MSI_RecordIsNull(row,5) && name ) if( MSI_RecordIsNull(row,5) && name )
...@@ -2210,6 +2203,7 @@ static UINT ACTION_InstallInitialize(MSIPACKAGE *package) ...@@ -2210,6 +2203,7 @@ static UINT ACTION_InstallInitialize(MSIPACKAGE *package)
static UINT ACTION_InstallValidate(MSIPACKAGE *package) static UINT ACTION_InstallValidate(MSIPACKAGE *package)
{ {
MSICOMPONENT *comp;
DWORD progress = 0; DWORD progress = 0;
DWORD total = 0; DWORD total = 0;
static const WCHAR q1[]= static const WCHAR q1[]=
...@@ -2249,7 +2243,10 @@ static UINT ACTION_InstallValidate(MSIPACKAGE *package) ...@@ -2249,7 +2243,10 @@ static UINT ACTION_InstallValidate(MSIPACKAGE *package)
msiobj_release(&view->hdr); msiobj_release(&view->hdr);
total = total + progress * REG_PROGRESS_VALUE; total = total + progress * REG_PROGRESS_VALUE;
total = total + package->loaded_components * COMPONENT_PROGRESS_VALUE; LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry )
{
total += COMPONENT_PROGRESS_VALUE;
}
for (i=0; i < package->loaded_files; i++) for (i=0; i < package->loaded_files; i++)
total += package->files[i].FileSize; total += package->files[i].FileSize;
ui_progress(package,0,total,0,0); ui_progress(package,0,total,0,0);
...@@ -2308,10 +2305,8 @@ static UINT ACTION_LaunchConditions(MSIPACKAGE *package) ...@@ -2308,10 +2305,8 @@ static UINT ACTION_LaunchConditions(MSIPACKAGE *package)
return rc; return rc;
} }
static LPWSTR resolve_keypath( MSIPACKAGE* package, INT static LPWSTR resolve_keypath( MSIPACKAGE* package, MSICOMPONENT *cmp )
component_index)
{ {
MSICOMPONENT* cmp = &package->components[component_index];
if (cmp->KeyPath[0]==0) if (cmp->KeyPath[0]==0)
{ {
...@@ -2426,27 +2421,23 @@ static UINT ACTION_WriteSharedDLLsCount(LPCWSTR path, UINT count) ...@@ -2426,27 +2421,23 @@ static UINT ACTION_WriteSharedDLLsCount(LPCWSTR path, UINT count)
/* /*
* Return TRUE if the count should be written out and FALSE if not * Return TRUE if the count should be written out and FALSE if not
*/ */
static void ACTION_RefCountComponent( MSIPACKAGE* package, UINT index) static void ACTION_RefCountComponent( MSIPACKAGE* package, MSICOMPONENT *comp )
{ {
INT count = 0; INT count = 0;
BOOL write = FALSE; BOOL write = FALSE;
INT j; INT j;
/* only refcount DLLs */ /* only refcount DLLs */
if (package->components[index].KeyPath[0]==0 || if (comp->KeyPath[0]==0 ||
package->components[index].Attributes & comp->Attributes & msidbComponentAttributesRegistryKeyPath ||
msidbComponentAttributesRegistryKeyPath || comp->Attributes & msidbComponentAttributesODBCDataSource)
package->components[index].Attributes &
msidbComponentAttributesODBCDataSource)
write = FALSE; write = FALSE;
else else
{ {
count = ACTION_GetSharedDLLsCount(package->components[index]. count = ACTION_GetSharedDLLsCount( comp->FullKeypath);
FullKeypath);
write = (count > 0); write = (count > 0);
if (package->components[index].Attributes & if (comp->Attributes & msidbComponentAttributesSharedDllRefCount)
msidbComponentAttributesSharedDllRefCount)
write = TRUE; write = TRUE;
} }
...@@ -2461,7 +2452,7 @@ static void ACTION_RefCountComponent( MSIPACKAGE* package, UINT index) ...@@ -2461,7 +2452,7 @@ static void ACTION_RefCountComponent( MSIPACKAGE* package, UINT index)
LIST_FOR_EACH_ENTRY( cl, package->features[j].Components, LIST_FOR_EACH_ENTRY( cl, package->features[j].Components,
ComponentList, entry ) ComponentList, entry )
{ {
if ( cl->component == index ) if ( cl->component == comp )
count++; count++;
} }
} }
...@@ -2476,7 +2467,7 @@ static void ACTION_RefCountComponent( MSIPACKAGE* package, UINT index) ...@@ -2476,7 +2467,7 @@ static void ACTION_RefCountComponent( MSIPACKAGE* package, UINT index)
LIST_FOR_EACH_ENTRY( cl, package->features[j].Components, LIST_FOR_EACH_ENTRY( cl, package->features[j].Components,
ComponentList, entry ) ComponentList, entry )
{ {
if ( cl->component == index ) if ( cl->component == comp )
count--; count--;
} }
} }
...@@ -2487,20 +2478,18 @@ static void ACTION_RefCountComponent( MSIPACKAGE* package, UINT index) ...@@ -2487,20 +2478,18 @@ static void ACTION_RefCountComponent( MSIPACKAGE* package, UINT index)
{ {
if (package->files[j].Temporary) if (package->files[j].Temporary)
continue; continue;
if (package->files[j].ComponentIndex == index) if (package->files[j].Component == comp)
ACTION_WriteSharedDLLsCount(package->files[j].TargetPath,count); ACTION_WriteSharedDLLsCount(package->files[j].TargetPath,count);
} }
/* add a count for permenent */ /* add a count for permenent */
if (package->components[index].Attributes & if (comp->Attributes & msidbComponentAttributesPermanent)
msidbComponentAttributesPermanent)
count ++; count ++;
package->components[index].RefCount = count; comp->RefCount = count;
if (write) if (write)
ACTION_WriteSharedDLLsCount(package->components[index].FullKeypath, ACTION_WriteSharedDLLsCount( comp->FullKeypath, comp->RefCount );
package->components[index].RefCount);
} }
/* /*
...@@ -2515,7 +2504,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package) ...@@ -2515,7 +2504,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
WCHAR squished_pc[GUID_SIZE]; WCHAR squished_pc[GUID_SIZE];
WCHAR squished_cc[GUID_SIZE]; WCHAR squished_cc[GUID_SIZE];
UINT rc; UINT rc;
DWORD i; MSICOMPONENT *comp;
HKEY hkey=0,hkey2=0; HKEY hkey=0,hkey2=0;
if (!package) if (!package)
...@@ -2529,32 +2518,33 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package) ...@@ -2529,32 +2518,33 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
squash_guid(package->ProductCode,squished_pc); squash_guid(package->ProductCode,squished_pc);
ui_progress(package,1,COMPONENT_PROGRESS_VALUE,1,0); ui_progress(package,1,COMPONENT_PROGRESS_VALUE,1,0);
for (i = 0; i < package->loaded_components; i++)
LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry )
{ {
ui_progress(package,2,0,0,0); ui_progress(package,2,0,0,0);
if (package->components[i].ComponentId[0]!=0) if (comp->ComponentId[0]!=0)
{ {
WCHAR *keypath = NULL; WCHAR *keypath = NULL;
MSIRECORD * uirow; MSIRECORD * uirow;
squash_guid(package->components[i].ComponentId,squished_cc); squash_guid(comp->ComponentId,squished_cc);
keypath = resolve_keypath(package,i); keypath = resolve_keypath( package, comp );
package->components[i].FullKeypath = keypath; comp->FullKeypath = keypath;
/* do the refcounting */ /* do the refcounting */
ACTION_RefCountComponent( package, i); ACTION_RefCountComponent( package, comp );
TRACE("Component %s (%s), Keypath=%s, RefCount=%i\n", TRACE("Component %s (%s), Keypath=%s, RefCount=%i\n",
debugstr_w(package->components[i].Component), debugstr_w(comp->Component),
debugstr_w(squished_cc), debugstr_w(squished_cc),
debugstr_w(package->components[i].FullKeypath), debugstr_w(comp->FullKeypath),
package->components[i].RefCount); comp->RefCount);
/* /*
* Write the keypath out if the component is to be registered * Write the keypath out if the component is to be registered
* and delete the key if the component is to be deregistered * and delete the key if the component is to be deregistered
*/ */
if (ACTION_VerifyComponentForAction(package, i, if (ACTION_VerifyComponentForAction(package, comp,
INSTALLSTATE_LOCAL)) INSTALLSTATE_LOCAL))
{ {
rc = RegCreateKeyW(hkey,squished_cc,&hkey2); rc = RegCreateKeyW(hkey,squished_cc,&hkey2);
...@@ -2566,8 +2556,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package) ...@@ -2566,8 +2556,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
RegSetValueExW(hkey2,squished_pc,0,REG_SZ,(LPBYTE)keypath, RegSetValueExW(hkey2,squished_pc,0,REG_SZ,(LPBYTE)keypath,
(strlenW(keypath)+1)*sizeof(WCHAR)); (strlenW(keypath)+1)*sizeof(WCHAR));
if (package->components[i].Attributes & if (comp->Attributes & msidbComponentAttributesPermanent)
msidbComponentAttributesPermanent)
{ {
static const WCHAR szPermKey[] = static const WCHAR szPermKey[] =
{ '0','0','0','0','0','0','0','0','0','0','0','0', { '0','0','0','0','0','0','0','0','0','0','0','0',
...@@ -2584,14 +2573,13 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package) ...@@ -2584,14 +2573,13 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
/* UI stuff */ /* UI stuff */
uirow = MSI_CreateRecord(3); uirow = MSI_CreateRecord(3);
MSI_RecordSetStringW(uirow,1,package->ProductCode); MSI_RecordSetStringW(uirow,1,package->ProductCode);
MSI_RecordSetStringW(uirow,2,package->components[i]. MSI_RecordSetStringW(uirow,2,comp->ComponentId);
ComponentId);
MSI_RecordSetStringW(uirow,3,keypath); MSI_RecordSetStringW(uirow,3,keypath);
ui_actiondata(package,szProcessComponents,uirow); ui_actiondata(package,szProcessComponents,uirow);
msiobj_release( &uirow->hdr ); msiobj_release( &uirow->hdr );
} }
} }
else if (ACTION_VerifyComponentForAction(package, i, else if (ACTION_VerifyComponentForAction(package, comp,
INSTALLSTATE_ABSENT)) INSTALLSTATE_ABSENT))
{ {
DWORD res; DWORD res;
...@@ -2611,8 +2599,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package) ...@@ -2611,8 +2599,7 @@ static UINT ACTION_ProcessComponents(MSIPACKAGE *package)
/* UI stuff */ /* UI stuff */
uirow = MSI_CreateRecord(2); uirow = MSI_CreateRecord(2);
MSI_RecordSetStringW(uirow,1,package->ProductCode); MSI_RecordSetStringW(uirow,1,package->ProductCode);
MSI_RecordSetStringW(uirow,2,package->components[i]. MSI_RecordSetStringW(uirow,2,comp->ComponentId);
ComponentId);
ui_actiondata(package,szProcessComponents,uirow); ui_actiondata(package,szProcessComponents,uirow);
msiobj_release( &uirow->hdr ); msiobj_release( &uirow->hdr );
} }
...@@ -2688,28 +2675,28 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param) ...@@ -2688,28 +2675,28 @@ static UINT ITERATE_RegisterTypeLibraries(MSIRECORD *row, LPVOID param)
MSIPACKAGE* package = (MSIPACKAGE*)param; MSIPACKAGE* package = (MSIPACKAGE*)param;
LPCWSTR component; LPCWSTR component;
INT index; INT index;
MSICOMPONENT *comp;
typelib_struct tl_struct; typelib_struct tl_struct;
HMODULE module; HMODULE module;
static const WCHAR szTYPELIB[] = {'T','Y','P','E','L','I','B',0}; static const WCHAR szTYPELIB[] = {'T','Y','P','E','L','I','B',0};
component = MSI_RecordGetString(row,3); component = MSI_RecordGetString(row,3);
index = get_loaded_component(package,component); comp = get_loaded_component(package,component);
if (index < 0) if (!comp)
return ERROR_SUCCESS; return ERROR_SUCCESS;
if (!ACTION_VerifyComponentForAction(package, index, INSTALLSTATE_LOCAL)) if (!ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_LOCAL))
{ {
TRACE("Skipping typelib reg due to disabled component\n"); TRACE("Skipping typelib reg due to disabled component\n");
package->components[index].Action = comp->Action = comp->Installed;
package->components[index].Installed;
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
package->components[index].Action = INSTALLSTATE_LOCAL; comp->Action = INSTALLSTATE_LOCAL;
index = get_loaded_file(package,package->components[index].KeyPath); index = get_loaded_file(package,comp->KeyPath);
if (index < 0) if (index < 0)
return ERROR_SUCCESS; return ERROR_SUCCESS;
...@@ -2801,29 +2788,27 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param) ...@@ -2801,29 +2788,27 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param)
LPCWSTR buffer; LPCWSTR buffer;
WCHAR filename[0x100]; WCHAR filename[0x100];
DWORD sz; DWORD sz;
DWORD index; MSICOMPONENT *comp;
static const WCHAR szlnk[]={'.','l','n','k',0}; static const WCHAR szlnk[]={'.','l','n','k',0};
IShellLinkW *sl; IShellLinkW *sl;
IPersistFile *pf; IPersistFile *pf;
HRESULT res; HRESULT res;
buffer = MSI_RecordGetString(row,4); buffer = MSI_RecordGetString(row,4);
index = get_loaded_component(package,buffer); comp = get_loaded_component(package,buffer);
if (!comp)
if (index < 0)
return ERROR_SUCCESS; return ERROR_SUCCESS;
if (!ACTION_VerifyComponentForAction(package, index, INSTALLSTATE_LOCAL)) if (!ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_LOCAL))
{ {
TRACE("Skipping shortcut creation due to disabled component\n"); TRACE("Skipping shortcut creation due to disabled component\n");
package->components[index].Action = comp->Action = comp->Installed;
package->components[index].Installed;
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
package->components[index].Action = INSTALLSTATE_LOCAL; comp->Action = INSTALLSTATE_LOCAL;
ui_actiondata(package,szCreateShortcuts,row); ui_actiondata(package,szCreateShortcuts,row);
...@@ -2869,7 +2854,7 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param) ...@@ -2869,7 +2854,7 @@ static UINT ITERATE_CreateShortcuts(MSIRECORD *row, LPVOID param)
{ {
LPWSTR keypath; LPWSTR keypath;
FIXME("poorly handled shortcut format, advertised shortcut\n"); FIXME("poorly handled shortcut format, advertised shortcut\n");
keypath = strdupW(package->components[index].FullKeypath); keypath = strdupW( comp->FullKeypath );
IShellLinkW_SetPath(sl,keypath); IShellLinkW_SetPath(sl,keypath);
HeapFree(GetProcessHeap(),0,keypath); HeapFree(GetProcessHeap(),0,keypath);
} }
...@@ -3146,26 +3131,25 @@ static UINT ITERATE_WriteIniValues(MSIRECORD *row, LPVOID param) ...@@ -3146,26 +3131,25 @@ static UINT ITERATE_WriteIniValues(MSIRECORD *row, LPVOID param)
LPWSTR deformated_section, deformated_key, deformated_value; LPWSTR deformated_section, deformated_key, deformated_value;
LPWSTR folder, fullname = NULL; LPWSTR folder, fullname = NULL;
MSIRECORD * uirow; MSIRECORD * uirow;
INT component_index,action; INT action;
MSICOMPONENT *comp;
static const WCHAR szWindowsFolder[] = static const WCHAR szWindowsFolder[] =
{'W','i','n','d','o','w','s','F','o','l','d','e','r',0}; {'W','i','n','d','o','w','s','F','o','l','d','e','r',0};
component = MSI_RecordGetString(row, 8); component = MSI_RecordGetString(row, 8);
component_index = get_loaded_component(package,component); comp = get_loaded_component(package,component);
if (!ACTION_VerifyComponentForAction(package, component_index, if (!ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_LOCAL))
INSTALLSTATE_LOCAL))
{ {
TRACE("Skipping ini file due to disabled component %s\n", TRACE("Skipping ini file due to disabled component %s\n",
debugstr_w(component)); debugstr_w(component));
package->components[component_index].Action = comp->Action = comp->Installed;
package->components[component_index].Installed;
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
package->components[component_index].Action = INSTALLSTATE_LOCAL; comp->Action = INSTALLSTATE_LOCAL;
identifier = MSI_RecordGetString(row,1); identifier = MSI_RecordGetString(row,1);
filename = MSI_RecordGetString(row,2); filename = MSI_RecordGetString(row,2);
...@@ -3371,7 +3355,7 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package) ...@@ -3371,7 +3355,7 @@ static UINT ACTION_PublishFeatures(MSIPACKAGE *package)
LIST_FOR_EACH_ENTRY( cl, package->features[i].Components, LIST_FOR_EACH_ENTRY( cl, package->features[i].Components,
ComponentList, entry ) ComponentList, entry )
{ {
MSICOMPONENT* component = &package->components[cl->component]; MSICOMPONENT* component = cl->component;
WCHAR buf[21]; WCHAR buf[21];
memset(buf,0,sizeof(buf)); memset(buf,0,sizeof(buf));
...@@ -4000,7 +3984,7 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param) ...@@ -4000,7 +3984,7 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param)
/* check to make sure that component is installed */ /* check to make sure that component is installed */
if (!ACTION_VerifyComponentForAction(package, if (!ACTION_VerifyComponentForAction(package,
package->files[index].ComponentIndex, INSTALLSTATE_LOCAL)) package->files[index].Component, INSTALLSTATE_LOCAL))
{ {
TRACE("Skipping: Component not scheduled for install\n"); TRACE("Skipping: Component not scheduled for install\n");
return ERROR_SUCCESS; return ERROR_SUCCESS;
...@@ -4062,18 +4046,15 @@ static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param) ...@@ -4062,18 +4046,15 @@ static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param)
LPWSTR output = NULL; LPWSTR output = NULL;
HKEY hkey; HKEY hkey;
UINT rc = ERROR_SUCCESS; UINT rc = ERROR_SUCCESS;
UINT index; MSICOMPONENT *comp;
DWORD sz = 0; DWORD sz = 0;
component = MSI_RecordGetString(rec,3); component = MSI_RecordGetString(rec,3);
index = get_loaded_component(package,component); comp = get_loaded_component(package,component);
if (!ACTION_VerifyComponentForAction(package, index, if (!ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_LOCAL) &&
INSTALLSTATE_LOCAL) && !ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_SOURCE) &&
!ACTION_VerifyComponentForAction(package, index, !ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_ADVERTISED))
INSTALLSTATE_SOURCE) &&
!ACTION_VerifyComponentForAction(package, index,
INSTALLSTATE_ADVERTISED))
{ {
TRACE("Skipping: Component %s not scheduled for install\n", TRACE("Skipping: Component %s not scheduled for install\n",
debugstr_w(component)); debugstr_w(component));
...@@ -4091,8 +4072,7 @@ static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param) ...@@ -4091,8 +4072,7 @@ static UINT ITERATE_PublishComponent(MSIRECORD *rec, LPVOID param)
qualifier = MSI_RecordGetString(rec,2); qualifier = MSI_RecordGetString(rec,2);
feature = MSI_RecordGetString(rec,5); feature = MSI_RecordGetString(rec,5);
advertise = create_component_advertise_string(package, advertise = create_component_advertise_string(package, comp, feature);
&package->components[index], feature);
sz = strlenW(advertise); sz = strlenW(advertise);
......
...@@ -44,6 +44,8 @@ typedef struct tagMSIFEATURE ...@@ -44,6 +44,8 @@ typedef struct tagMSIFEATURE
typedef struct tagMSICOMPONENT typedef struct tagMSICOMPONENT
{ {
struct list entry;
DWORD magic;
WCHAR Component[IDENTIFIER_SIZE]; WCHAR Component[IDENTIFIER_SIZE];
WCHAR ComponentId[IDENTIFIER_SIZE]; WCHAR ComponentId[IDENTIFIER_SIZE];
WCHAR Directory[IDENTIFIER_SIZE]; WCHAR Directory[IDENTIFIER_SIZE];
...@@ -66,7 +68,7 @@ typedef struct tagMSICOMPONENT ...@@ -66,7 +68,7 @@ typedef struct tagMSICOMPONENT
typedef struct tagComponentList typedef struct tagComponentList
{ {
struct list entry; struct list entry;
int component; MSICOMPONENT *component;
} ComponentList; } ComponentList;
typedef struct tagMSIFOLDER typedef struct tagMSIFOLDER
...@@ -91,7 +93,7 @@ typedef struct tagMSIFOLDER ...@@ -91,7 +93,7 @@ typedef struct tagMSIFOLDER
typedef struct tagMSIFILE typedef struct tagMSIFILE
{ {
LPWSTR File; LPWSTR File;
INT ComponentIndex; MSICOMPONENT *Component;
LPWSTR FileName; LPWSTR FileName;
LPWSTR ShortName; LPWSTR ShortName;
INT FileSize; INT FileSize;
...@@ -115,7 +117,7 @@ typedef struct tagMSICLASS ...@@ -115,7 +117,7 @@ typedef struct tagMSICLASS
{ {
WCHAR CLSID[IDENTIFIER_SIZE]; /* Primary Key */ WCHAR CLSID[IDENTIFIER_SIZE]; /* Primary Key */
WCHAR Context[IDENTIFIER_SIZE]; /* Primary Key */ WCHAR Context[IDENTIFIER_SIZE]; /* Primary Key */
INT ComponentIndex; /* Primary Key */ MSICOMPONENT *Component;
INT ProgIDIndex; INT ProgIDIndex;
LPWSTR ProgIDText; LPWSTR ProgIDText;
LPWSTR Description; LPWSTR Description;
...@@ -134,7 +136,7 @@ typedef struct tagMSICLASS ...@@ -134,7 +136,7 @@ typedef struct tagMSICLASS
typedef struct tagMSIEXTENSION typedef struct tagMSIEXTENSION
{ {
WCHAR Extension[256]; /* Primary Key */ WCHAR Extension[256]; /* Primary Key */
INT ComponentIndex; /* Primary Key */ MSICOMPONENT *Component;
INT ProgIDIndex; INT ProgIDIndex;
LPWSTR ProgIDText; LPWSTR ProgIDText;
INT MIMEIndex; INT MIMEIndex;
...@@ -233,7 +235,7 @@ WCHAR *load_dynamic_stringW(MSIRECORD *row, INT index); ...@@ -233,7 +235,7 @@ WCHAR *load_dynamic_stringW(MSIRECORD *row, INT index);
LPWSTR load_dynamic_property(MSIPACKAGE *package, LPCWSTR prop, UINT* rc); LPWSTR load_dynamic_property(MSIPACKAGE *package, LPCWSTR prop, UINT* rc);
LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source, LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
BOOL set_prop, MSIFOLDER **folder); BOOL set_prop, MSIFOLDER **folder);
int get_loaded_component(MSIPACKAGE* package, LPCWSTR Component ); MSICOMPONENT *get_loaded_component( MSIPACKAGE* package, LPCWSTR Component );
int get_loaded_feature(MSIPACKAGE* package, LPCWSTR Feature ); int get_loaded_feature(MSIPACKAGE* package, LPCWSTR Feature );
int get_loaded_file(MSIPACKAGE* package, LPCWSTR file); int get_loaded_file(MSIPACKAGE* package, LPCWSTR file);
int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path); int track_tempfile(MSIPACKAGE *package, LPCWSTR name, LPCWSTR path);
...@@ -242,7 +244,7 @@ UINT build_icon_path(MSIPACKAGE *, LPCWSTR, LPWSTR *); ...@@ -242,7 +244,7 @@ UINT build_icon_path(MSIPACKAGE *, LPCWSTR, LPWSTR *);
DWORD build_version_dword(LPCWSTR); DWORD build_version_dword(LPCWSTR);
LPWSTR build_directory_name(DWORD , ...); LPWSTR build_directory_name(DWORD , ...);
BOOL create_full_pathW(const WCHAR *path); BOOL create_full_pathW(const WCHAR *path);
BOOL ACTION_VerifyComponentForAction(MSIPACKAGE*, INT, INSTALLSTATE); BOOL ACTION_VerifyComponentForAction(MSIPACKAGE*, MSICOMPONENT*, INSTALLSTATE);
BOOL ACTION_VerifyFeatureForAction(MSIPACKAGE*, INT, INSTALLSTATE); BOOL ACTION_VerifyFeatureForAction(MSIPACKAGE*, INT, INSTALLSTATE);
void reduce_to_longfilename(WCHAR*); void reduce_to_longfilename(WCHAR*);
void reduce_to_shortfilename(WCHAR*); void reduce_to_shortfilename(WCHAR*);
......
...@@ -253,8 +253,7 @@ static INT load_class(MSIPACKAGE* package, MSIRECORD *row) ...@@ -253,8 +253,7 @@ static INT load_class(MSIPACKAGE* package, MSIRECORD *row)
sz = IDENTIFIER_SIZE; sz = IDENTIFIER_SIZE;
MSI_RecordGetStringW(row, 2, package->classes[index].Context, &sz); MSI_RecordGetStringW(row, 2, package->classes[index].Context, &sz);
buffer = MSI_RecordGetString(row,3); buffer = MSI_RecordGetString(row,3);
package->classes[index].ComponentIndex = get_loaded_component(package, package->classes[index].Component = get_loaded_component(package, buffer);
buffer);
package->classes[index].ProgIDText = load_dynamic_stringW(row,4); package->classes[index].ProgIDText = load_dynamic_stringW(row,4);
package->classes[index].ProgIDIndex = package->classes[index].ProgIDIndex =
...@@ -466,8 +465,7 @@ static INT load_extension(MSIPACKAGE* package, MSIRECORD *row) ...@@ -466,8 +465,7 @@ static INT load_extension(MSIPACKAGE* package, MSIRECORD *row)
debugstr_w(package->extensions[index].Extension)); debugstr_w(package->extensions[index].Extension));
buffer = MSI_RecordGetString(row,2); buffer = MSI_RecordGetString(row,2);
package->extensions[index].ComponentIndex = package->extensions[index].Component = get_loaded_component(package,buffer);
get_loaded_component(package,buffer);
package->extensions[index].ProgIDText = load_dynamic_stringW(row,3); package->extensions[index].ProgIDText = load_dynamic_stringW(row,3);
package->extensions[index].ProgIDIndex = load_given_progid(package, package->extensions[index].ProgIDIndex = load_given_progid(package,
...@@ -574,10 +572,10 @@ static UINT iterate_load_verb(MSIRECORD *row, LPVOID param) ...@@ -574,10 +572,10 @@ static UINT iterate_load_verb(MSIRECORD *row, LPVOID param)
static UINT iterate_all_classes(MSIRECORD *rec, LPVOID param) static UINT iterate_all_classes(MSIRECORD *rec, LPVOID param)
{ {
MSICOMPONENT *comp;
LPCWSTR clsid; LPCWSTR clsid;
LPCWSTR context; LPCWSTR context;
LPCWSTR buffer; LPCWSTR buffer;
INT component_index;
MSIPACKAGE* package =(MSIPACKAGE*)param; MSIPACKAGE* package =(MSIPACKAGE*)param;
INT i; INT i;
BOOL match = FALSE; BOOL match = FALSE;
...@@ -585,7 +583,7 @@ static UINT iterate_all_classes(MSIRECORD *rec, LPVOID param) ...@@ -585,7 +583,7 @@ static UINT iterate_all_classes(MSIRECORD *rec, LPVOID param)
clsid = MSI_RecordGetString(rec,1); clsid = MSI_RecordGetString(rec,1);
context = MSI_RecordGetString(rec,2); context = MSI_RecordGetString(rec,2);
buffer = MSI_RecordGetString(rec,3); buffer = MSI_RecordGetString(rec,3);
component_index = get_loaded_component(package,buffer); comp = get_loaded_component(package,buffer);
for (i = 0; i < package->loaded_classes; i++) for (i = 0; i < package->loaded_classes; i++)
{ {
...@@ -593,7 +591,7 @@ static UINT iterate_all_classes(MSIRECORD *rec, LPVOID param) ...@@ -593,7 +591,7 @@ static UINT iterate_all_classes(MSIRECORD *rec, LPVOID param)
continue; continue;
if (strcmpW(context,package->classes[i].Context)) if (strcmpW(context,package->classes[i].Context))
continue; continue;
if (component_index == package->classes[i].ComponentIndex) if (comp == package->classes[i].Component)
{ {
match = TRUE; match = TRUE;
break; break;
...@@ -625,22 +623,22 @@ static VOID load_all_classes(MSIPACKAGE *package) ...@@ -625,22 +623,22 @@ static VOID load_all_classes(MSIPACKAGE *package)
static UINT iterate_all_extensions(MSIRECORD *rec, LPVOID param) static UINT iterate_all_extensions(MSIRECORD *rec, LPVOID param)
{ {
MSICOMPONENT *comp;
LPCWSTR buffer; LPCWSTR buffer;
LPCWSTR extension; LPCWSTR extension;
INT component_index;
MSIPACKAGE* package =(MSIPACKAGE*)param; MSIPACKAGE* package =(MSIPACKAGE*)param;
BOOL match = FALSE; BOOL match = FALSE;
INT i; INT i;
extension = MSI_RecordGetString(rec,1); extension = MSI_RecordGetString(rec,1);
buffer = MSI_RecordGetString(rec,2); buffer = MSI_RecordGetString(rec,2);
component_index = get_loaded_component(package,buffer); comp = get_loaded_component(package,buffer);
for (i = 0; i < package->loaded_extensions; i++) for (i = 0; i < package->loaded_extensions; i++)
{ {
if (strcmpiW(extension,package->extensions[i].Extension)) if (strcmpiW(extension,package->extensions[i].Extension))
continue; continue;
if (component_index == package->extensions[i].ComponentIndex) if (comp == package->extensions[i].Component)
{ {
match = TRUE; match = TRUE;
break; break;
...@@ -920,16 +918,15 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) ...@@ -920,16 +918,15 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
for (i = 0; i < package->loaded_classes; i++) for (i = 0; i < package->loaded_classes; i++)
{ {
INT index,f_index; MSICOMPONENT *comp;
INT index, f_index;
DWORD size, sz; DWORD size, sz;
LPWSTR argument; LPWSTR argument;
if (package->classes[i].ComponentIndex < 0) comp = package->classes[i].Component;
{ if ( !comp )
continue; continue;
}
index = package->classes[i].ComponentIndex;
f_index = package->classes[i].FeatureIndex; f_index = package->classes[i].FeatureIndex;
/* /*
...@@ -963,7 +960,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package) ...@@ -963,7 +960,7 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
Description)+1)*sizeof(WCHAR)); Description)+1)*sizeof(WCHAR));
RegCreateKeyW(hkey2,package->classes[i].Context,&hkey3); RegCreateKeyW(hkey2,package->classes[i].Context,&hkey3);
index = get_loaded_file(package,package->components[index].KeyPath); index = get_loaded_file( package, comp->KeyPath );
/* the context server is a short path name /* the context server is a short path name
...@@ -1425,14 +1422,13 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) ...@@ -1425,14 +1422,13 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package)
for (i = 0; i < package->loaded_extensions; i++) for (i = 0; i < package->loaded_extensions; i++)
{ {
WCHAR extension[257]; WCHAR extension[257];
INT index,f_index; INT f_index;
index = package->extensions[i].ComponentIndex; if (!package->extensions[i].Component)
f_index = package->extensions[i].FeatureIndex;
if (index < 0)
continue; continue;
f_index = package->extensions[i].FeatureIndex;
/* /*
* yes. MSDN says that these are based on _Feature_ not on * yes. MSDN says that these are based on _Feature_ not on
* Component. So verify the feature is to be installed * Component. So verify the feature is to be installed
...@@ -1512,7 +1508,7 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) ...@@ -1512,7 +1508,7 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package)
/* do all the verbs */ /* do all the verbs */
for (v = 0; v < package->extensions[i].VerbCount; v++) for (v = 0; v < package->extensions[i].VerbCount; v++)
register_verb(package, progid, register_verb(package, progid,
&package->components[index], package->extensions[i].Component,
&package->extensions[i], &package->extensions[i],
&package->verbs[package->extensions[i].Verbs[v]], &package->verbs[package->extensions[i].Verbs[v]],
&Sequence); &Sequence);
......
...@@ -56,14 +56,13 @@ extern const WCHAR szRemoveFiles[]; ...@@ -56,14 +56,13 @@ extern const WCHAR szRemoveFiles[];
static const WCHAR cszTempFolder[]= {'T','e','m','p','F','o','l','d','e','r',0}; static const WCHAR cszTempFolder[]= {'T','e','m','p','F','o','l','d','e','r',0};
inline static UINT create_component_directory ( MSIPACKAGE* package, INT component) static UINT create_component_directory( MSIPACKAGE* package, MSICOMPONENT *comp )
{ {
UINT rc = ERROR_SUCCESS; UINT rc = ERROR_SUCCESS;
MSIFOLDER *folder; MSIFOLDER *folder;
LPWSTR install_path; LPWSTR install_path;
install_path = resolve_folder(package, package->components[component].Directory, install_path = resolve_folder(package, comp->Directory, FALSE, FALSE, &folder);
FALSE, FALSE, &folder);
if (!install_path) if (!install_path)
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
...@@ -683,7 +682,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package) ...@@ -683,7 +682,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
if (file->Temporary) if (file->Temporary)
continue; continue;
if (!ACTION_VerifyComponentForAction(package, file->ComponentIndex, if (!ACTION_VerifyComponentForAction(package, file->Component,
INSTALLSTATE_LOCAL)) INSTALLSTATE_LOCAL))
{ {
ui_progress(package,2,file->FileSize,0,0); ui_progress(package,2,file->FileSize,0,0);
...@@ -700,13 +699,12 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package) ...@@ -700,13 +699,12 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
TRACE("Pass 1: %s\n",debugstr_w(file->File)); TRACE("Pass 1: %s\n",debugstr_w(file->File));
create_component_directory( package, file->ComponentIndex); create_component_directory( package, file->Component );
/* recalculate file paths because things may have changed */ /* recalculate file paths because things may have changed */
if (file->ComponentIndex >= 0) comp = file->Component;
comp = &package->components[file->ComponentIndex]; if (!comp)
else
{ {
ERR("No Component for file\n"); ERR("No Component for file\n");
continue; continue;
...@@ -724,7 +722,6 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package) ...@@ -724,7 +722,6 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
for (index = 0; index < package->loaded_files; index++) for (index = 0; index < package->loaded_files; index++)
{ {
MSIFILE *file; MSIFILE *file;
MSICOMPONENT* comp = NULL;
file = &package->files[index]; file = &package->files[index];
...@@ -735,10 +732,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package) ...@@ -735,10 +732,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
{ {
TRACE("Pass 2: %s\n",debugstr_w(file->File)); TRACE("Pass 2: %s\n",debugstr_w(file->File));
if (file->ComponentIndex >= 0) rc = ready_media_for_file( package, index, file->Component );
comp = &package->components[file->ComponentIndex];
rc = ready_media_for_file(package, index, comp);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
{ {
ERR("Unable to ready media\n"); ERR("Unable to ready media\n");
...@@ -808,27 +802,25 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param) ...@@ -808,27 +802,25 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param)
WCHAR dest_name[0x100]; WCHAR dest_name[0x100];
LPWSTR dest_path, dest; LPWSTR dest_path, dest;
LPCWSTR file_key, component; LPCWSTR file_key, component;
INT component_index;
DWORD sz; DWORD sz;
DWORD rc; DWORD rc;
MSICOMPONENT *comp;
component = MSI_RecordGetString(row,2); component = MSI_RecordGetString(row,2);
component_index = get_loaded_component(package,component); comp = get_loaded_component(package,component);
if (!ACTION_VerifyComponentForAction(package, component_index, if (!ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_LOCAL))
INSTALLSTATE_LOCAL))
{ {
TRACE("Skipping copy due to disabled component %s\n", TRACE("Skipping copy due to disabled component %s\n",
debugstr_w(component)); debugstr_w(component));
/* the action taken was the same as the current install state */ /* the action taken was the same as the current install state */
package->components[component_index].Action = comp->Action = comp->Installed;
package->components[component_index].Installed;
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
package->components[component_index].Action = INSTALLSTATE_LOCAL; comp->Action = INSTALLSTATE_LOCAL;
file_key = MSI_RecordGetString(row,3); file_key = MSI_RecordGetString(row,3);
if (!file_key) if (!file_key)
......
...@@ -79,18 +79,17 @@ static const WCHAR* scanW(LPCWSTR buf, WCHAR token, DWORD len) ...@@ -79,18 +79,17 @@ static const WCHAR* scanW(LPCWSTR buf, WCHAR token, DWORD len)
static LPWSTR deformat_component(MSIPACKAGE* package, LPCWSTR key, DWORD* sz) static LPWSTR deformat_component(MSIPACKAGE* package, LPCWSTR key, DWORD* sz)
{ {
LPWSTR value = NULL; LPWSTR value = NULL;
INT index; MSICOMPONENT *comp;
*sz = 0; *sz = 0;
if (!package) if (!package)
return NULL; return NULL;
ERR("POORLY HANDLED DEFORMAT.. [$componentkey] \n"); ERR("POORLY HANDLED DEFORMAT.. [$componentkey] \n");
index = get_loaded_component(package,key); comp = get_loaded_component(package,key);
if (index >= 0) if (comp)
{ {
value = resolve_folder(package, package->components[index].Directory, value = resolve_folder(package, comp->Directory, FALSE, FALSE, NULL);
FALSE, FALSE, NULL);
*sz = (strlenW(value)) * sizeof(WCHAR); *sz = (strlenW(value)) * sizeof(WCHAR);
} }
......
...@@ -167,20 +167,16 @@ LPWSTR load_dynamic_property(MSIPACKAGE *package, LPCWSTR prop, UINT* rc) ...@@ -167,20 +167,16 @@ LPWSTR load_dynamic_property(MSIPACKAGE *package, LPCWSTR prop, UINT* rc)
return str; return str;
} }
int get_loaded_component(MSIPACKAGE* package, LPCWSTR Component ) MSICOMPONENT* get_loaded_component( MSIPACKAGE* package, LPCWSTR Component )
{ {
int rc = -1; MSICOMPONENT *comp = NULL;
DWORD i;
for (i = 0; i < package->loaded_components; i++) LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry )
{ {
if (strcmpW(Component,package->components[i].Component)==0) if (lstrcmpW(Component,comp->Component)==0)
{ return comp;
rc = i;
break;
}
} }
return rc; return NULL;
} }
int get_loaded_feature(MSIPACKAGE* package, LPCWSTR Feature ) int get_loaded_feature(MSIPACKAGE* package, LPCWSTR Feature )
...@@ -487,11 +483,14 @@ void ACTION_free_package_structures( MSIPACKAGE* package) ...@@ -487,11 +483,14 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
if (package->folders && package->loaded_folders > 0) if (package->folders && package->loaded_folders > 0)
HeapFree(GetProcessHeap(),0,package->folders); HeapFree(GetProcessHeap(),0,package->folders);
for (i = 0; i < package->loaded_components; i++) LIST_FOR_EACH_SAFE( item, cursor, &package->components )
HeapFree(GetProcessHeap(),0,package->components[i].FullKeypath); {
MSICOMPONENT *comp = LIST_ENTRY( item, MSICOMPONENT, entry );
if (package->components && package->loaded_components > 0)
HeapFree(GetProcessHeap(),0,package->components); list_remove( &comp->entry );
HeapFree( GetProcessHeap(), 0, comp->FullKeypath );
HeapFree( GetProcessHeap(), 0, comp );
}
for (i = 0; i < package->loaded_files; i++) for (i = 0; i < package->loaded_files; i++)
{ {
...@@ -762,13 +761,13 @@ void ui_actiondata(MSIPACKAGE *package, LPCWSTR action, MSIRECORD * record) ...@@ -762,13 +761,13 @@ void ui_actiondata(MSIPACKAGE *package, LPCWSTR action, MSIRECORD * record)
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
} }
BOOL ACTION_VerifyComponentForAction(MSIPACKAGE* package, INT index, BOOL ACTION_VerifyComponentForAction(MSIPACKAGE* package, MSICOMPONENT* comp,
INSTALLSTATE check ) INSTALLSTATE check )
{ {
if (package->components[index].Installed == check) if (comp->Installed == check)
return FALSE; return FALSE;
if (package->components[index].ActionRequest == check) if (comp->ActionRequest == check)
return TRUE; return TRUE;
else else
return FALSE; return FALSE;
...@@ -867,8 +866,8 @@ void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature) ...@@ -867,8 +866,8 @@ void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature)
LIST_FOR_EACH_ENTRY( cl, feature->Components, ComponentList, entry ) LIST_FOR_EACH_ENTRY( cl, feature->Components, ComponentList, entry )
{ {
MSICOMPONENT* component = &package->components[cl->component]; MSICOMPONENT* component = cl->component;
TRACE("MODIFYING(%i): Component %s (Installed %i, Action %i, Request %i)\n", TRACE("MODIFYING(%i): Component %s (Installed %i, Action %i, Request %i)\n",
newstate, debugstr_w(component->Component), component->Installed, newstate, debugstr_w(component->Component), component->Installed,
component->Action, component->ActionRequest); component->Action, component->ActionRequest);
......
...@@ -545,20 +545,20 @@ UINT WINAPI MsiGetComponentStateA(MSIHANDLE hInstall, LPSTR szComponent, ...@@ -545,20 +545,20 @@ UINT WINAPI MsiGetComponentStateA(MSIHANDLE hInstall, LPSTR szComponent,
UINT MSI_GetComponentStateW(MSIPACKAGE *package, LPWSTR szComponent, UINT MSI_GetComponentStateW(MSIPACKAGE *package, LPWSTR szComponent,
INSTALLSTATE *piInstalled, INSTALLSTATE *piAction) INSTALLSTATE *piInstalled, INSTALLSTATE *piAction)
{ {
INT index; MSICOMPONENT *comp;
TRACE("%p %s %p %p\n", package, debugstr_w(szComponent), piInstalled, TRACE("%p %s %p %p\n", package, debugstr_w(szComponent), piInstalled,
piAction); piAction);
index = get_loaded_component(package,szComponent); comp = get_loaded_component(package,szComponent);
if (index < 0) if (!comp)
return ERROR_UNKNOWN_COMPONENT; return ERROR_UNKNOWN_COMPONENT;
if (piInstalled) if (piInstalled)
*piInstalled = package->components[index].Installed; *piInstalled = comp->Installed;
if (piAction) if (piAction)
*piAction = package->components[index].Action; *piAction = comp->Action;
TRACE("states (%i, %i)\n", TRACE("states (%i, %i)\n",
(piInstalled)?*piInstalled:-1,(piAction)?*piAction:-1); (piInstalled)?*piInstalled:-1,(piAction)?*piAction:-1);
......
...@@ -190,8 +190,7 @@ typedef struct tagMSIPACKAGE ...@@ -190,8 +190,7 @@ typedef struct tagMSIPACKAGE
UINT loaded_features; UINT loaded_features;
struct tagMSIFOLDER *folders; struct tagMSIFOLDER *folders;
UINT loaded_folders; UINT loaded_folders;
struct tagMSICOMPONENT *components; struct list components;
UINT loaded_components;
struct tagMSIFILE *files; struct tagMSIFILE *files;
UINT loaded_files; UINT loaded_files;
LPWSTR ActionFormat; LPWSTR ActionFormat;
......
...@@ -379,11 +379,10 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db ) ...@@ -379,11 +379,10 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db )
package->db = db; package->db = db;
package->features = NULL; package->features = NULL;
package->folders = NULL; package->folders = NULL;
package->components = NULL; list_init( &package->components );
package->files = NULL; package->files = NULL;
package->loaded_features = 0; package->loaded_features = 0;
package->loaded_folders = 0; package->loaded_folders = 0;
package->loaded_components= 0;
package->loaded_files = 0; package->loaded_files = 0;
package->ActionFormat = NULL; package->ActionFormat = NULL;
package->LastAction = 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