msi: Use MSI_IterateRecords in ACTION_AppSearch.

This commit is contained in:
Mike McCormack 2006-11-28 17:46:25 +09:00 committed by Alexandre Julliard
parent 63afb3f840
commit 77b514fe24
1 changed files with 38 additions and 53 deletions

View File

@ -844,65 +844,50 @@ static UINT ACTION_AppSearchSigName(MSIPACKAGE *package, LPCWSTR sigName,
return rc; return rc;
} }
static UINT iterate_appsearch(MSIRECORD *row, LPVOID param)
{
MSIPACKAGE *package = param;
LPWSTR propName, sigName, value = NULL;
MSISIGNATURE sig;
UINT r;
/* get property and signature */
propName = msi_dup_record_field(row,1);
sigName = msi_dup_record_field(row,2);
TRACE("%s %s\n", debugstr_w(propName), debugstr_w(sigName));
r = ACTION_AppSearchSigName(package, sigName, &sig, &value);
if (value)
{
MSI_SetPropertyW(package, propName, value);
msi_free(value);
}
ACTION_FreeSignature(&sig);
msi_free(propName);
msi_free(sigName);
return r;
}
/* http://msdn.microsoft.com/library/en-us/msi/setup/appsearch_table.asp /* http://msdn.microsoft.com/library/en-us/msi/setup/appsearch_table.asp
* is the best reference for the AppSearch table and how it's used. * is the best reference for the AppSearch table and how it's used.
*/ */
UINT ACTION_AppSearch(MSIPACKAGE *package) UINT ACTION_AppSearch(MSIPACKAGE *package)
{ {
MSIQUERY *view; static const WCHAR query[] = {
UINT rc; 's','e','l','e','c','t',' ','*',' ',
static const WCHAR ExecSeqQuery[] = { 'f','r','o','m',' ',
's','e','l','e','c','t',' ','*',' ', 'A','p','p','S','e','a','r','c','h',0};
'f','r','o','m',' ', MSIQUERY *view = NULL;
'A','p','p','S','e','a','r','c','h',0}; UINT r;
rc = MSI_OpenQuery(package->db, &view, ExecSeqQuery); r = MSI_OpenQuery( package->db, &view, query );
if (rc == ERROR_SUCCESS) if (r != ERROR_SUCCESS)
{ return ERROR_SUCCESS;
MSIRECORD *row = 0;
LPWSTR propName, sigName;
rc = MSI_ViewExecute(view, 0); r = MSI_IterateRecords( view, NULL, iterate_appsearch, package );
if (rc != ERROR_SUCCESS) msiobj_release( &view->hdr );
goto end;
while (!rc) return r;
{
MSISIGNATURE sig;
LPWSTR value = NULL;
rc = MSI_ViewFetch(view,&row);
if (rc != ERROR_SUCCESS)
{
rc = ERROR_SUCCESS;
break;
}
/* get property and signature */
propName = msi_dup_record_field(row,1);
sigName = msi_dup_record_field(row,2);
TRACE("Searching for Property %s, Signature_ %s\n",
debugstr_w(propName), debugstr_w(sigName));
rc = ACTION_AppSearchSigName(package, sigName, &sig, &value);
if (value)
{
MSI_SetPropertyW(package, propName, value);
msi_free(value);
}
ACTION_FreeSignature(&sig);
msi_free(propName);
msi_free(sigName);
msiobj_release(&row->hdr);
}
end:
MSI_ViewClose(view);
msiobj_release(&view->hdr);
}
else
rc = ERROR_SUCCESS;
return rc;
} }