Commit 69ec6b4c authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

oleaut32: Add some additional tests for QueryPathOfRegTypeLib, make them pass under Wine.

parent f2e2e3e4
......@@ -638,6 +638,10 @@ static void test_QueryPathOfRegTypeLib(void)
{ 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 } },
{ 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 } },
{ 5, 0xffff, TYPE_E_LIBNOTREGISTERED, { 0 } },
{ 4, 0, TYPE_E_LIBNOTREGISTERED, { 0 } }
};
static const WCHAR base[] = {'f','a','k','e',0};
......@@ -657,6 +661,7 @@ static void test_QueryPathOfRegTypeLib(void)
if (!do_typelib_reg_key(&uid, 3, 0, base, 0)) return;
if (!do_typelib_reg_key(&uid, 3, 1, base, 0)) return;
if (!do_typelib_reg_key(&uid, 3, 37, base, 0)) return;
if (!do_typelib_reg_key(&uid, 5, 37, base, 0)) return;
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
{
......
......@@ -168,13 +168,13 @@ static void FromLEDWords(void *p_Val, int p_iSize)
/*
* Find a typelib key which matches a requested maj.min version.
*/
static BOOL find_typelib_key( REFGUID guid, WORD wMaj, WORD *wMin )
static BOOL find_typelib_key( REFGUID guid, WORD *wMaj, WORD *wMin )
{
static const WCHAR typelibW[] = {'T','y','p','e','l','i','b','\\',0};
WCHAR buffer[60];
char key_name[16];
DWORD len, i;
INT best_min = -1;
INT best_maj = -1, best_min = -1;
HKEY hkey;
memcpy( buffer, typelibW, sizeof(typelibW) );
......@@ -193,20 +193,40 @@ static BOOL find_typelib_key( REFGUID guid, WORD wMaj, WORD *wMin )
{
TRACE("found %s: %x.%x\n", debugstr_w(buffer), v_maj, v_min);
if (wMaj == v_maj)
if (*wMaj == 0xffff && *wMin == 0xffff)
{
if (v_maj > best_maj) best_maj = v_maj;
if (v_min > best_min) best_min = v_min;
}
else if (*wMaj == v_maj)
{
best_maj = v_maj;
if (*wMin == v_min)
{
best_min = v_min;
break; /* exact match */
}
if (v_min > best_min) best_min = v_min;
if (*wMin != 0xffff && v_min > best_min) best_min = v_min;
}
}
len = sizeof(key_name);
}
RegCloseKey( hkey );
if (best_min >= 0)
TRACE("found best_maj %d, best_min %d\n", best_maj, best_min);
if (*wMaj == 0xffff && *wMin == 0xffff)
{
if (best_maj >= 0 && best_min >= 0)
{
*wMaj = best_maj;
*wMin = best_min;
return TRUE;
}
}
if (*wMaj == best_maj && best_min >= 0)
{
*wMin = best_min;
return TRUE;
......@@ -295,7 +315,7 @@ HRESULT WINAPI QueryPathOfRegTypeLib(
TRACE_(typelib)("(%s, %x.%x, 0x%x, %p)\n", debugstr_guid(guid), wMaj, wMin, lcid, path);
if (!find_typelib_key( guid, wMaj, &wMin )) return TYPE_E_LIBNOTREGISTERED;
if (!find_typelib_key( guid, &wMaj, &wMin )) return TYPE_E_LIBNOTREGISTERED;
get_typelib_key( guid, wMaj, wMin, buffer );
res = RegOpenKeyExW( HKEY_CLASSES_ROOT, buffer, 0, KEY_READ, &hkey );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment