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
...@@ -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