Kevin Puetz : oleaut32: Fix QueryPathOfRegTypeLib minor version comparison.

Alexandre Julliard julliard at winehq.org
Thu Mar 10 16:10:16 CST 2022


Module: wine
Branch: master
Commit: 288a1024b9b78b7c568e3ac1fae081b8bfd2734f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=288a1024b9b78b7c568e3ac1fae081b8bfd2734f

Author: Kevin Puetz <PuetzKevinA at JohnDeere.com>
Date:   Sat Feb 19 14:06:21 2022 -0600

oleaut32: Fix QueryPathOfRegTypeLib minor version comparison.

A search with wMin != 0xFFFF should match only if the actual version found
matches the major and is is >= the minor version requested (preferring
an exact match if one is available)

Signed-off-by: Kevin Puetz <PuetzKevinA at JohnDeere.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/oleaut32/tests/typelib.c | 4 ++--
 dlls/oleaut32/typelib.c       | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c
index 4266243c1ba..6bfc50642a4 100644
--- a/dlls/oleaut32/tests/typelib.c
+++ b/dlls/oleaut32/tests/typelib.c
@@ -1521,7 +1521,7 @@ cleanup:
 static BOOL do_typelib_reg_key(GUID *uid, WORD maj, WORD min, DWORD arch, LPCWSTR base, BOOL remove)
 {
     static const WCHAR typelibW[] = {'T','y','p','e','l','i','b','\\',0};
-    static const WCHAR formatW[] = {'\\','%','u','.','%','u','\\','0','\\','w','i','n','%','u',0};
+    static const WCHAR formatW[] = {'\\','%','x','.','%','x','\\','0','\\','w','i','n','%','u',0};
     static const WCHAR format2W[] = {'%','s','_','%','u','_','%','u','.','d','l','l',0};
     WCHAR buf[128];
     HKEY hkey;
@@ -1578,7 +1578,7 @@ static void test_QueryPathOfRegTypeLib(DWORD arch)
         { 3, 1, S_OK, {'f','a','k','e','_','3','_','1','.','d','l','l',0 } },
         { 3, 22, S_OK, {'f','a','k','e','_','3','_','3','7','.','d','l','l',0 } },
         { 3, 37, S_OK, {'f','a','k','e','_','3','_','3','7','.','d','l','l',0 } },
-        { 3, 40, S_OK, {'f','a','k','e','_','3','_','3','7','.','d','l','l',0 } },
+        { 3, 40, TYPE_E_LIBNOTREGISTERED, { 0 } },
         { 0xffff, 0xffff, S_OK, {'f','a','k','e','_','5','_','3','7','.','d','l','l',0 } },
         { 0xffff, 0, TYPE_E_LIBNOTREGISTERED, { 0 } },
         { 3, 0xffff, TYPE_E_LIBNOTREGISTERED, { 0 } },
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index cdc48e9c7fe..7f10bcc968d 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -207,7 +207,7 @@ static BOOL find_typelib_key( REFGUID guid, WORD *wMaj, WORD *wMin )
                     best_min = v_min;
                     break; /* exact match */
                 }
-                if (*wMin != 0xffff && v_min > best_min) best_min = v_min;
+                if (*wMin != 0xffff && v_min >= *wMin && v_min > best_min) best_min = v_min;
             }
         }
         len = sizeof(key_name);




More information about the wine-cvs mailing list