Rework WriteIniValues to use MSI_IterateRecords.

This commit is contained in:
Aric Stewart 2005-06-23 09:46:31 +00:00 committed by Alexandre Julliard
parent 916ef94945
commit aded32f37b
1 changed files with 100 additions and 117 deletions

View File

@ -3193,46 +3193,16 @@ end:
return rc;
}
static UINT ACTION_WriteIniValues(MSIPACKAGE *package)
{
UINT rc;
MSIQUERY * view;
MSIRECORD * row = 0;
static const WCHAR ExecSeqQuery[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','I','n','i','F','i','l','e','`',0};
static const WCHAR szWindowsFolder[] =
{'W','i','n','d','o','w','s','F','o','l','d','e','r',0};
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
if (rc != ERROR_SUCCESS)
{
TRACE("no IniFile table\n");
return ERROR_SUCCESS;
}
rc = MSI_ViewExecute(view, 0);
if (rc != ERROR_SUCCESS)
{
MSI_ViewClose(view);
msiobj_release(&view->hdr);
return rc;
}
while (1)
static UINT ITERATE_WriteIniValues(MSIRECORD *row, LPVOID param)
{
MSIPACKAGE *package = (MSIPACKAGE*)param;
LPCWSTR component,section,key,value,identifier,filename,dirproperty;
LPWSTR deformated_section, deformated_key, deformated_value;
LPWSTR folder, fullname = NULL;
MSIRECORD * uirow;
INT component_index,action;
rc = MSI_ViewFetch(view,&row);
if (rc != ERROR_SUCCESS)
{
rc = ERROR_SUCCESS;
break;
}
static const WCHAR szWindowsFolder[] =
{'W','i','n','d','o','w','s','F','o','l','d','e','r',0};
component = MSI_RecordGetString(row, 8);
component_index = get_loaded_component(package,component);
@ -3242,12 +3212,11 @@ static UINT ACTION_WriteIniValues(MSIPACKAGE *package)
{
TRACE("Skipping ini file due to disabled component %s\n",
debugstr_w(component));
msiobj_release(&row->hdr);
package->components[component_index].Action =
package->components[component_index].Installed;
continue;
return ERROR_SUCCESS;
}
package->components[component_index].Action = INSTALLSTATE_LOCAL;
@ -3305,9 +3274,7 @@ static UINT ACTION_WriteIniValues(MSIPACKAGE *package)
}
}
else if (action == 3)
{
FIXME("Append to existing section not yet implemented\n");
}
uirow = MSI_CreateRecord(4);
MSI_RecordSetStringW(uirow,1,identifier);
@ -3322,9 +3289,25 @@ cleanup:
HeapFree(GetProcessHeap(),0,deformated_key);
HeapFree(GetProcessHeap(),0,deformated_value);
HeapFree(GetProcessHeap(),0,deformated_section);
msiobj_release(&row->hdr);
return ERROR_SUCCESS;
}
MSI_ViewClose(view);
static UINT ACTION_WriteIniValues(MSIPACKAGE *package)
{
UINT rc;
MSIQUERY * view;
static const WCHAR ExecSeqQuery[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','I','n','i','F','i','l','e','`',0};
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
if (rc != ERROR_SUCCESS)
{
TRACE("no IniFile table\n");
return ERROR_SUCCESS;
}
rc = MSI_IterateRecords(view, NULL, ITERATE_WriteIniValues, package);
msiobj_release(&view->hdr);
return rc;
}