msi: Reload properties as they may have been changed by a transform

James Hawkins truiken at gmail.com
Thu Jul 12 13:36:43 CDT 2007


Hi,

Changelog:
* Reload properties as they may have been changed by a transform.

 dlls/msi/action.c        |    3 +++
 dlls/msi/msipriv.h       |    1 +
 dlls/msi/package.c       |   35 +++++++++++++++++++++--------------
 dlls/msi/tests/install.c |    7 ++-----
 4 files changed, 27 insertions(+), 19 deletions(-)

-- 
James Hawkins
-------------- next part --------------
diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index 37ad1ab..10443c6 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -674,6 +674,9 @@ UINT MSI_InstallPackage( MSIPACKAGE *pac
     msi_apply_transforms( package );
     msi_apply_patches( package );
 
+    /* properties may have been added by a transform */
+    msi_clone_properties( package );
+
     if ( (msi_get_property_int(package, szUILevel, 0) & INSTALLUILEVEL_MASK) >= INSTALLUILEVEL_REDUCED )
     {
         package->script->InWhatSequence |= SEQUENCE_UI;
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index 79bda64..3253a5d 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -688,6 +688,7 @@ extern UINT WINAPI MSI_SetFeatureStateW(
 extern LPCWSTR msi_download_file( LPCWSTR szUrl, LPWSTR filename );
 extern UINT msi_package_add_info(MSIPACKAGE *, DWORD, DWORD, LPCWSTR, LPWSTR);
 extern UINT msi_package_add_media_disk(MSIPACKAGE *, DWORD, DWORD, DWORD, LPWSTR, LPWSTR);
+extern UINT msi_clone_properties(MSIPACKAGE *);
 
 /* for deformating */
 extern UINT MSI_FormatRecordW( MSIPACKAGE *, MSIRECORD *, LPWSTR, DWORD * );
diff --git a/dlls/msi/package.c b/dlls/msi/package.c
index 31bfb7e..2fb7fbe 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -60,10 +60,11 @@ static void MSI_FreePackage( MSIOBJECTHD
     ACTION_free_package_structures(package);
 }
 
-static UINT clone_properties(MSIPACKAGE *package)
+static UINT create_temp_property_table(MSIPACKAGE *package)
 {
-    MSIQUERY * view = NULL;
+    MSIQUERY *view = NULL;
     UINT rc;
+
     static const WCHAR CreateSql[] = {
        'C','R','E','A','T','E',' ','T','A','B','L','E',' ','`','_','P','r','o',
        'p','e','r','t','y','`',' ','(',' ','`','_','P','r','o','p','e','r','t',
@@ -73,6 +74,22 @@ static UINT clone_properties(MSIPACKAGE 
        'U','L','L',' ','T','E','M','P','O','R','A','R','Y',' ','P','R','I','M',
        'A','R','Y',' ','K','E','Y',' ','`','_','P','r','o','p','e','r','t','y',
         '`',')',0};
+
+    rc = MSI_DatabaseOpenViewW(package->db, CreateSql, &view);
+    if (rc != ERROR_SUCCESS)
+        return rc;
+
+    rc = MSI_ViewExecute(view, 0);
+    MSI_ViewClose(view);
+    msiobj_release(&view->hdr);
+    return rc;
+}
+
+UINT msi_clone_properties(MSIPACKAGE *package)
+{
+    MSIQUERY *view = NULL;
+    UINT rc;
+
     static const WCHAR Query[] = {
        'S','E','L','E','C','T',' ','*',' ',
        'F','R','O','M',' ','`','P','r','o','p','e','r','t','y','`',0};
@@ -83,17 +100,6 @@ static UINT clone_properties(MSIPACKAGE 
        '`','V','a','l','u','e','`',')',' ',
        'V','A','L','U','E','S',' ','(','?',',','?',')',0};
 
-    /* create the temporary properties table */
-    rc = MSI_DatabaseOpenViewW(package->db, CreateSql, &view);
-    if (rc != ERROR_SUCCESS)
-        return rc;
-
-    rc = MSI_ViewExecute(view, 0);
-    MSI_ViewClose(view);
-    msiobj_release(&view->hdr);
-    if (rc != ERROR_SUCCESS)
-        return rc;
-
     /* clone the existing properties */
     rc = MSI_DatabaseOpenViewW(package->db, Query, &view);
     if (rc != ERROR_SUCCESS)
@@ -735,7 +741,8 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABA
         package->PackagePath = strdupW( db->path );
         package->BaseURL = strdupW( base_url );
 
-        clone_properties( package );
+        create_temp_property_table( package );
+        msi_clone_properties( package );
         set_installer_properties(package);
         sprintfW(uilevel,szpi,gUILevel);
         MSI_SetPropertyW(package, szLevel, uilevel);
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 61b5855..341f02d 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -2453,11 +2453,8 @@ static void test_transformprop(void)
 
     r = MsiInstallProductA(msifile, "TRANSFORMS=winetest.mst");
     ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
-    todo_wine
-    {
-        ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
-        ok(delete_pf("msitest", FALSE), "File not installed\n");
-    }
+    ok(delete_pf("msitest\\augustus", TRUE), "File not installed\n");
+    ok(delete_pf("msitest", FALSE), "File not installed\n");
 
     /* Delete the files in the temp (current) folder */
     DeleteFile(msifile);
-- 
1.4.1



More information about the wine-patches mailing list