[1/3] msi: Always derive the SourceDir property from the database path.

Hans Leidekker hans at codeweavers.com
Fri Jan 3 08:00:33 CST 2014


---
 dlls/msi/action.c | 42 +++++++++++-------------------------------
 1 file changed, 11 insertions(+), 31 deletions(-)

diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index 2a0bf87..aab8c0f 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -424,41 +424,21 @@ static BOOL ui_sequence_exists( MSIPACKAGE *package )
 
 UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace)
 {
-    LPWSTR source, check;
+    WCHAR *source, *check, *p, *db;
+    DWORD len;
 
-    if (msi_get_property_int( package->db, szInstalled, 0 ))
-    {
-        HKEY hkey;
+    if (!(db = msi_dup_property( package->db, szOriginalDatabase )))
+        return ERROR_OUTOFMEMORY;
 
-        MSIREG_OpenInstallProps( package->ProductCode, package->Context, NULL, &hkey, FALSE );
-        source = msi_reg_get_val_str( hkey, INSTALLPROPERTY_INSTALLSOURCEW );
-        RegCloseKey( hkey );
-    }
-    else
+    if (!(p = strrchrW( db, '\\' )) && !(p = strrchrW( db, '/' )))
     {
-        LPWSTR p, db;
-        DWORD len;
-
-        db = msi_dup_property( package->db, szOriginalDatabase );
-        if (!db)
-            return ERROR_OUTOFMEMORY;
-
-        p = strrchrW( db, '\\' );
-        if (!p)
-        {
-            p = strrchrW( db, '/' );
-            if (!p)
-            {
-                msi_free(db);
-                return ERROR_SUCCESS;
-            }
-        }
-
-        len = p - db + 2;
-        source = msi_alloc( len * sizeof(WCHAR) );
-        lstrcpynW( source, db, len );
-        msi_free( db );
+        msi_free(db);
+        return ERROR_SUCCESS;
     }
+    len = p - db + 2;
+    source = msi_alloc( len * sizeof(WCHAR) );
+    lstrcpynW( source, db, len );
+    msi_free( db );
 
     check = msi_dup_property( package->db, szSourceDir );
     if (!check || replace)
-- 
1.8.5.2







More information about the wine-patches mailing list