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