Commit 0670ebc6 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

msi: Use MSI_IterateRecords when cloning properties.

parent 78584b6e
...@@ -60,45 +60,33 @@ static void MSI_FreePackage( MSIOBJECTHDR *arg) ...@@ -60,45 +60,33 @@ static void MSI_FreePackage( MSIOBJECTHDR *arg)
msi_free_properties( package ); msi_free_properties( package );
} }
static UINT iterate_clone_props(MSIRECORD *row, LPVOID param)
{
MSIPACKAGE *package = param;
LPCWSTR name, value;
name = MSI_RecordGetString( row, 1 );
value = MSI_RecordGetString( row, 2 );
MSI_SetPropertyW( package, name, value );
return ERROR_SUCCESS;
}
static UINT clone_properties( MSIPACKAGE *package ) static UINT clone_properties( MSIPACKAGE *package )
{ {
MSIQUERY * view = NULL;
UINT rc;
static const WCHAR Query[] = { static const WCHAR Query[] = {
'S','E','L','E','C','T',' ','*',' ', 'S','E','L','E','C','T',' ','*',' ',
'F','R','O','M',' ','`','P','r','o','p','e','r','t','y','`',0}; 'F','R','O','M',' ','`','P','r','o','p','e','r','t','y','`',0};
MSIQUERY *view = NULL;
/* clone the existing properties */ UINT r;
rc = MSI_DatabaseOpenViewW( package->db, Query, &view );
if (rc != ERROR_SUCCESS)
return rc;
rc = MSI_ViewExecute(view, 0); r = MSI_OpenQuery( package->db, &view, Query );
if (rc != ERROR_SUCCESS) if (r == ERROR_SUCCESS)
{ {
MSI_ViewClose(view); r = MSI_IterateRecords( view, NULL, iterate_clone_props, package );
msiobj_release(&view->hdr); msiobj_release(&view->hdr);
return rc;
}
while (1)
{
MSIRECORD * row;
LPCWSTR name, value;
rc = MSI_ViewFetch(view,&row);
if (rc != ERROR_SUCCESS)
break;
name = MSI_RecordGetString( row, 1 );
value = MSI_RecordGetString( row, 2 );
MSI_SetPropertyW( package, name, value );
msiobj_release( &row->hdr );
} }
MSI_ViewClose(view); return r;
msiobj_release(&view->hdr);
return rc;
} }
/* /*
......
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