From dcd9b8ea0e3915e72c7f279dbdae8c4973c5f8b5 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Mon, 25 Jan 2016 16:24:51 +0100 Subject: [PATCH] oleaut32: Fix best version handling in QueryPathOfRegTypeLib when type library redirection is used. Signed-off-by: Piotr Caban Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/oleaut32/tests/typelib.c | 5 +++++ dlls/oleaut32/typelib.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index fe80b70b649..a354f00417d 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -5626,6 +5626,11 @@ static void test_LoadRegTypeLib(void) ok(hr == TYPE_E_LIBNOTREGISTERED || broken(hr == S_OK) /* winxp */, "got 0x%08x\n", hr); SysFreeString(path); + path = NULL; + hr = QueryPathOfRegTypeLib(&LIBID_TestTypelib, 0xffff, 0xffff, LOCALE_NEUTRAL, &path); + ok(hr == S_OK, "got 0x%08x\n", hr); + SysFreeString(path); + /* manifest version is 2.0, actual is 1.0 */ hr = LoadRegTypeLib(&LIBID_register_test, 1, 0, LOCALE_NEUTRAL, &tl); ok(hr == TYPE_E_LIBNOTREGISTERED || broken(hr == S_OK) /* winxp */, "got 0x%08x\n", hr); diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 0a83b79111c..6fd52b04a16 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -323,7 +323,7 @@ static HRESULT query_typelib_path( REFGUID guid, WORD wMaj, WORD wMin, WCHAR *nameW; DWORD len; - if (tlib->major_version != wMaj || tlib->minor_version < wMin) + if ((wMaj != 0xffff || wMin != 0xffff) && (tlib->major_version != wMaj || tlib->minor_version < wMin)) return TYPE_E_LIBNOTREGISTERED; nameW = (WCHAR*)((BYTE*)data.lpSectionBase + tlib->name_offset);