Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/msi/package.c | 100 ++++++++++++++++++++++++-----------------------
dlls/msi/tests/package.c | 5 +++
2 files changed, 56 insertions(+), 49 deletions(-)
diff --git a/dlls/msi/package.c b/dlls/msi/package.c
index 477fa0ff50..5aa3dd0e12 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -528,71 +528,73 @@ done:
static LPWSTR get_fusion_filename(MSIPACKAGE *package)
{
- HKEY netsetup;
+ static const WCHAR fusion[] =
+ {'f','u','s','i','o','n','.','d','l','l',0};
+ static const WCHAR subkey[] =
+ {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
+ 'N','E','T',' ','F','r','a','m','e','w','o','r','k',' ','S','e','t','u','p','\\','N','D','P',0};
+ static const WCHAR subdir[] =
+ {'M','i','c','r','o','s','o','f','t','.','N','E','T','\\','F','r','a','m','e','w','o','r','k','\\',0};
+ static const WCHAR v2050727[] =
+ {'v','2','.','0','.','5','0','7','2','7',0};
+ static const WCHAR v4client[] =
+ {'v','4','\\','C','l','i','e','n','t',0};
+ static const WCHAR installpath[] =
+ {'I','n','s','t','a','l','l','P','a','t','h',0};
+ HKEY netsetup, hkey;
LONG res;
- LPWSTR file = NULL;
- DWORD index = 0, size;
- WCHAR ver[MAX_PATH];
- WCHAR name[MAX_PATH];
- WCHAR windir[MAX_PATH];
-
- static const WCHAR fusion[] = {'f','u','s','i','o','n','.','d','l','l',0};
- static const WCHAR sub[] = {
- 'S','o','f','t','w','a','r','e','\\',
- 'M','i','c','r','o','s','o','f','t','\\',
- 'N','E','T',' ','F','r','a','m','e','w','o','r','k',' ','S','e','t','u','p','\\',
- 'N','D','P',0
- };
- static const WCHAR subdir[] = {
- 'M','i','c','r','o','s','o','f','t','.','N','E','T','\\',
- 'F','r','a','m','e','w','o','r','k','\\',0
- };
+ DWORD size, len, type;
+ WCHAR windir[MAX_PATH], path[MAX_PATH], *filename = NULL;
- res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, sub, 0, KEY_ENUMERATE_SUB_KEYS, &netsetup);
+ res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, subkey, 0, KEY_CREATE_SUB_KEY, &netsetup);
if (res != ERROR_SUCCESS)
return NULL;
- GetWindowsDirectoryW(windir, MAX_PATH);
-
- ver[0] = '\0';
- size = MAX_PATH;
- while (RegEnumKeyExW(netsetup, index, name, &size, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
+ if (!RegCreateKeyExW(netsetup, v4client, 0, NULL, 0, KEY_QUERY_VALUE, NULL, &hkey, NULL))
{
- index++;
-
- /* verify existence of fusion.dll .Net 3.0 does not install a new one */
- if (strcmpW( ver, name ) < 0)
+ size = sizeof(path)/sizeof(path[0]);
+ if (!RegQueryValueExW(hkey, installpath, NULL, &type, (BYTE *)path, &size))
{
- LPWSTR check;
- size = lstrlenW(windir) + lstrlenW(subdir) + lstrlenW(name) +lstrlenW(fusion) + 3;
- check = msi_alloc(size * sizeof(WCHAR));
+ len = strlenW(path) + strlenW(fusion) + 2;
+ if (!(filename = msi_alloc(len * sizeof(WCHAR)))) return NULL;
- if (!check)
+ strcpyW(filename, path);
+ strcatW(filename, szBackSlash);
+ strcatW(filename, fusion);
+ if (GetFileAttributesW(filename) != INVALID_FILE_ATTRIBUTES)
{
- msi_free(file);
- return NULL;
+ TRACE( "found %s\n", debugstr_w(filename) );
+ RegCloseKey(hkey);
+ RegCloseKey(netsetup);
+ return filename;
}
+ }
+ RegCloseKey(hkey);
+ }
- lstrcpyW(check, windir);
- lstrcatW(check, szBackSlash);
- lstrcatW(check, subdir);
- lstrcatW(check, name);
- lstrcatW(check, szBackSlash);
- lstrcatW(check, fusion);
+ if (!RegCreateKeyExW(netsetup, v2050727, 0, NULL, 0, KEY_QUERY_VALUE, NULL, &hkey, NULL))
+ {
+ RegCloseKey(hkey);
+ GetWindowsDirectoryW(windir, MAX_PATH);
+ len = strlenW(windir) + strlenW(subdir) + strlenW(v2050727) + strlenW(fusion) + 3;
+ if (!(filename = msi_alloc(len * sizeof(WCHAR)))) return NULL;
- if(GetFileAttributesW(check) != INVALID_FILE_ATTRIBUTES)
- {
- msi_free(file);
- file = check;
- lstrcpyW(ver, name);
- }
- else
- msi_free(check);
+ strcpyW(filename, windir);
+ strcatW(filename, szBackSlash);
+ strcatW(filename, subdir);
+ strcatW(filename, v2050727);
+ strcatW(filename, szBackSlash);
+ strcatW(filename, fusion);
+ if (GetFileAttributesW(filename) != INVALID_FILE_ATTRIBUTES)
+ {
+ TRACE( "found %s\n", debugstr_w(filename) );
+ RegCloseKey(netsetup);
+ return filename;
}
}
RegCloseKey(netsetup);
- return file;
+ return filename;
}
typedef struct tagLANGANDCODEPAGE
diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c
index e4cee59663..2022953f9b 100644
--- a/dlls/msi/tests/package.c
+++ b/dlls/msi/tests/package.c
@@ -5652,6 +5652,11 @@ static void test_installprops(void)
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", r);
ok(atol(buf) == res, "Expected %d, got %ld\n", res, atol(buf));
+ buf[0] = 0;
+ size = MAX_PATH;
+ r = MsiGetPropertyA(hpkg, "MsiNetAssemblySupport", buf, &size);
+ if (r == ERROR_SUCCESS) trace( "MsiNetAssemblySupport \"%s\"\n", buf );
+
if (pGetSystemInfo && pSHGetFolderPathA)
{
pGetSystemInfo(&si);
--
2.11.0