Vincent Povirk : mscoree: Use upgrade code to find installed Wine Mono version.

Alexandre Julliard julliard at winehq.org
Thu Sep 13 03:49:17 CDT 2018


Module: wine
Branch: stable
Commit: 1e871af6b317405a78ba0de0606012187e64b105
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=1e871af6b317405a78ba0de0606012187e64b105

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Mon Jul 16 13:57:29 2018 -0500

mscoree: Use upgrade code to find installed Wine Mono version.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45317
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit cb6e92d3287e9768b2e535c0b3fa159b19ec26cf)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/mscoree/mscoree_main.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/dlls/mscoree/mscoree_main.c b/dlls/mscoree/mscoree_main.c
index 42f8169..c4876fe 100644
--- a/dlls/mscoree/mscoree_main.c
+++ b/dlls/mscoree/mscoree_main.c
@@ -669,8 +669,10 @@ static BOOL install_wine_mono(void)
 {
     BOOL is_wow64 = FALSE;
     HMODULE hmsi;
+    UINT (WINAPI *pMsiEnumRelatedProductsA)(LPCSTR,DWORD,DWORD,LPSTR);
     UINT (WINAPI *pMsiGetProductInfoA)(LPCSTR,LPCSTR,LPSTR,DWORD*);
     char versionstringbuf[15];
+    char productcodebuf[39];
     UINT res;
     DWORD buffer_size;
     PROCESS_INFORMATION pi;
@@ -681,7 +683,7 @@ static BOOL install_wine_mono(void)
     BOOL ret;
 
     static const char* mono_version = "4.7.1";
-    static const char* mono_product_code = "{E45D8920-A758-4088-B6C6-31DBB276992E}";
+    static const char* mono_upgrade_code = "{DE624609-C6B5-486A-9274-EF0B854F6BC5}";
 
     static const WCHAR controlW[] = {'\\','c','o','n','t','r','o','l','.','e','x','e',0};
     static const WCHAR argsW[] =
@@ -703,11 +705,22 @@ static BOOL install_wine_mono(void)
         return FALSE;
     }
 
-    pMsiGetProductInfoA = (void*)GetProcAddress(hmsi, "MsiGetProductInfoA");
+    pMsiEnumRelatedProductsA = (void*)GetProcAddress(hmsi, "MsiEnumRelatedProductsA");
 
-    buffer_size = sizeof(versionstringbuf);
+    res = pMsiEnumRelatedProductsA(mono_upgrade_code, 0, 0, productcodebuf);
 
-    res = pMsiGetProductInfoA(mono_product_code, "VersionString", versionstringbuf, &buffer_size);
+    if (res == ERROR_SUCCESS)
+    {
+        pMsiGetProductInfoA = (void*)GetProcAddress(hmsi, "MsiGetProductInfoA");
+
+        buffer_size = sizeof(versionstringbuf);
+
+        res = pMsiGetProductInfoA(productcodebuf, "VersionString", versionstringbuf, &buffer_size);
+    }
+    else if (res != ERROR_NO_MORE_ITEMS)
+    {
+        ERR("MsiEnumRelatedProducts failed, err=%u\n", res);
+    }
 
     FreeLibrary(hmsi);
 




More information about the wine-cvs mailing list