From 842525f423b0c105eded22e0e7b613f7e5ffcd02 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Wed, 1 Aug 2012 11:55:22 +0200 Subject: [PATCH] msi: Try the registered install location first when resolving the target directory. --- dlls/msi/action.c | 18 +++++++++++++++--- dlls/msi/msipriv.h | 1 + 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/dlls/msi/action.c b/dlls/msi/action.c index e1d2f2afc74..f8745285cf7 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -2281,6 +2281,19 @@ WCHAR *msi_normalize_path( const WCHAR *in ) return ret; } +static WCHAR *get_install_location( MSIPACKAGE *package ) +{ + HKEY hkey; + WCHAR *path; + + if (!package->ProductCode) return NULL; + if (MSIREG_OpenInstallProps( package->ProductCode, package->Context, NULL, &hkey, FALSE )) + return NULL; + path = msi_reg_get_val_str( hkey, szInstallLocation ); + RegCloseKey( hkey ); + return path; +} + void msi_resolve_target_folder( MSIPACKAGE *package, const WCHAR *name, BOOL load_prop ) { FolderList *fl; @@ -2293,7 +2306,8 @@ void msi_resolve_target_folder( MSIPACKAGE *package, const WCHAR *name, BOOL loa if (!strcmpW( folder->Directory, szTargetDir )) /* special resolving for target root dir */ { - if (!load_prop || !(path = msi_dup_property( package->db, szTargetDir ))) + if (!(path = get_install_location( package )) && + (!load_prop || !(path = msi_dup_property( package->db, szTargetDir )))) { path = msi_dup_property( package->db, szRootDrive ); } @@ -4837,8 +4851,6 @@ static UINT msi_publish_install_properties(MSIPACKAGE *package, HKEY hkey) {'H','e','l','p','T','e','l','e','p','h','o','n','e',0}; static const WCHAR szARPINSTALLLOCATION[] = {'A','R','P','I','N','S','T','A','L','L','L','O','C','A','T','I','O','N',0}; - static const WCHAR szInstallLocation[] = - {'I','n','s','t','a','l','l','L','o','c','a','t','i','o','n',0}; static const WCHAR szManufacturer[] = {'M','a','n','u','f','a','c','t','u','r','e','r',0}; static const WCHAR szPublisher[] = diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index a0657f4ce90..43ac194f98e 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -1177,6 +1177,7 @@ static const WCHAR szRollbackDisabled[] = {'R','o','l','l','b','a','c','k','D',' static const WCHAR szName[] = {'N','a','m','e',0}; static const WCHAR szData[] = {'D','a','t','a',0}; static const WCHAR szLangResource[] = {'\\','V','a','r','F','i','l','e','I','n','f','o','\\','T','r','a','n','s','l','a','t','i','o','n',0}; +static const WCHAR szInstallLocation[] = {'I','n','s','t','a','l','l','L','o','c','a','t','i','o','n',0}; /* memory allocation macro functions */ static void *msi_alloc( size_t len ) __WINE_ALLOC_SIZE(1);