Mike McCormack : msi: Use MSI_IterateRecords in ACTION_AppSearch.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Nov 28 06:01:23 CST 2006
Module: wine
Branch: master
Commit: 77b514fe24f3260f05530df29fada93e04a52e35
URL: http://source.winehq.org/git/wine.git/?a=commit;h=77b514fe24f3260f05530df29fada93e04a52e35
Author: Mike McCormack <mike at codeweavers.com>
Date: Tue Nov 28 17:46:25 2006 +0900
msi: Use MSI_IterateRecords in ACTION_AppSearch.
---
dlls/msi/appsearch.c | 89 +++++++++++++++++++++-----------------------------
1 files changed, 37 insertions(+), 52 deletions(-)
diff --git a/dlls/msi/appsearch.c b/dlls/msi/appsearch.c
index e5f0b04..4b65f65 100644
--- a/dlls/msi/appsearch.c
+++ b/dlls/msi/appsearch.c
@@ -844,65 +844,50 @@ static UINT ACTION_AppSearchSigName(MSIP
return rc;
}
-/* 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.
- */
-UINT ACTION_AppSearch(MSIPACKAGE *package)
+static UINT iterate_appsearch(MSIRECORD *row, LPVOID param)
{
- 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};
+ MSIPACKAGE *package = param;
+ LPWSTR propName, sigName, value = NULL;
+ MSISIGNATURE sig;
+ UINT r;
- rc = MSI_OpenQuery(package->db, &view, ExecSeqQuery);
- if (rc == ERROR_SUCCESS)
- {
- MSIRECORD *row = 0;
- LPWSTR propName, sigName;
+ /* get property and signature */
+ propName = msi_dup_record_field(row,1);
+ sigName = msi_dup_record_field(row,2);
- rc = MSI_ViewExecute(view, 0);
- if (rc != ERROR_SUCCESS)
- goto end;
+ TRACE("%s %s\n", debugstr_w(propName), debugstr_w(sigName));
- while (!rc)
- {
- MSISIGNATURE sig;
- LPWSTR value = NULL;
-
- rc = MSI_ViewFetch(view,&row);
- if (rc != ERROR_SUCCESS)
- {
- rc = ERROR_SUCCESS;
- break;
- }
+ 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);
- /* get property and signature */
- propName = msi_dup_record_field(row,1);
- sigName = msi_dup_record_field(row,2);
+ return r;
+}
- TRACE("Searching for Property %s, Signature_ %s\n",
- debugstr_w(propName), debugstr_w(sigName));
+/* 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.
+ */
+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;
- 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);
- }
+ r = MSI_OpenQuery( package->db, &view, query );
+ if (r != ERROR_SUCCESS)
+ return ERROR_SUCCESS;
-end:
- MSI_ViewClose(view);
- msiobj_release(&view->hdr);
- }
- else
- rc = ERROR_SUCCESS;
+ r = MSI_IterateRecords( view, NULL, iterate_appsearch, package );
+ msiobj_release( &view->hdr );
- return rc;
+ return r;
}
More information about the wine-cvs
mailing list