Commit 9e4590ff authored by Guillaume Charifi's avatar Guillaume Charifi Committed by Alexandre Julliard

oleaut32: Implement TLB dependencies lookup in resources.

parent 1ef30feb
...@@ -5594,7 +5594,7 @@ static void test_dep(void) { ...@@ -5594,7 +5594,7 @@ static void test_dep(void) {
ok(hr == S_OK, "got: %x\n", hr); ok(hr == S_OK, "got: %x\n", hr);
hr = ITypeInfo_GetRefTypeInfo(ptInfo, refType, &ptInfoExt); hr = ITypeInfo_GetRefTypeInfo(ptInfo, refType, &ptInfoExt);
todo_wine ok(hr == S_OK || broken(hr == TYPE_E_CANTLOADLIBRARY) /* win 2000 */, "got: %x\n", hr); ok(hr == S_OK || broken(hr == TYPE_E_CANTLOADLIBRARY) /* win 2000 */, "got: %x\n", hr);
ITypeInfo_Release(ptInfo); ITypeInfo_Release(ptInfo);
if(ptInfoExt) if(ptInfoExt)
......
...@@ -7572,6 +7572,45 @@ static HRESULT ITypeInfoImpl_GetDispatchRefTypeInfo( ITypeInfo *iface, ...@@ -7572,6 +7572,45 @@ static HRESULT ITypeInfoImpl_GetDispatchRefTypeInfo( ITypeInfo *iface,
return E_FAIL; return E_FAIL;
} }
struct search_res_tlb_params
{
const GUID *guid;
ITypeLib *pTLib;
};
static BOOL CALLBACK search_res_tlb(HMODULE hModule, LPCWSTR lpszType, LPWSTR lpszName, LONG_PTR lParam)
{
struct search_res_tlb_params *params = (LPVOID)lParam;
static const WCHAR formatW[] = {'\\','%','d',0};
WCHAR szPath[MAX_PATH+1];
ITypeLib *pTLib = NULL;
HRESULT ret;
DWORD len;
if (IS_INTRESOURCE(lpszName) == FALSE)
return TRUE;
if (!(len = GetModuleFileNameW(hModule, szPath, MAX_PATH)))
return TRUE;
if (snprintfW(szPath + len, sizeof(szPath)/sizeof(WCHAR) - len, formatW, LOWORD(lpszName)) < 0)
return TRUE;
ret = LoadTypeLibEx(szPath, REGKIND_NONE, &pTLib);
if (SUCCEEDED(ret))
{
ITypeLibImpl *impl = impl_from_ITypeLib(pTLib);
if (IsEqualGUID(params->guid, impl->guid))
{
params->pTLib = pTLib;
return FALSE; /* stop enumeration */
}
ITypeLib_Release(pTLib);
}
return TRUE;
}
/* ITypeInfo::GetRefTypeInfo /* ITypeInfo::GetRefTypeInfo
* *
* If a type description references other type descriptions, it retrieves * If a type description references other type descriptions, it retrieves
...@@ -7665,20 +7704,33 @@ static HRESULT WINAPI ITypeInfo_fnGetRefTypeInfo( ...@@ -7665,20 +7704,33 @@ static HRESULT WINAPI ITypeInfo_fnGetRefTypeInfo(
ITypeLib_AddRef(pTLib); ITypeLib_AddRef(pTLib);
result = S_OK; result = S_OK;
} else { } else {
static const WCHAR TYPELIBW[] = {'T','Y','P','E','L','I','B',0};
struct search_res_tlb_params params;
BSTR libnam; BSTR libnam;
TRACE("typeinfo in imported typelib that isn't already loaded\n"); TRACE("typeinfo in imported typelib that isn't already loaded\n");
result = query_typelib_path(TLB_get_guid_null(ref_type->pImpTLInfo->guid), /* Search in resource table */
ref_type->pImpTLInfo->wVersionMajor, params.guid = TLB_get_guid_null(ref_type->pImpTLInfo->guid);
ref_type->pImpTLInfo->wVersionMinor, params.pTLib = NULL;
This->pTypeLib->syskind, EnumResourceNamesW(NULL, TYPELIBW, search_res_tlb, (LONG_PTR)&params);
ref_type->pImpTLInfo->lcid, &libnam, TRUE); pTLib = params.pTLib;
if(FAILED(result)) result = S_OK;
libnam = SysAllocString(ref_type->pImpTLInfo->name);
result = LoadTypeLib(libnam, &pTLib); if (!pTLib)
SysFreeString(libnam); {
/* Search on disk */
result = query_typelib_path(TLB_get_guid_null(ref_type->pImpTLInfo->guid),
ref_type->pImpTLInfo->wVersionMajor,
ref_type->pImpTLInfo->wVersionMinor,
This->pTypeLib->syskind,
ref_type->pImpTLInfo->lcid, &libnam, TRUE);
if (FAILED(result))
libnam = SysAllocString(ref_type->pImpTLInfo->name);
result = LoadTypeLib(libnam, &pTLib);
SysFreeString(libnam);
}
if(SUCCEEDED(result)) { if(SUCCEEDED(result)) {
ref_type->pImpTLInfo->pImpTypeLib = impl_from_ITypeLib(pTLib); ref_type->pImpTLInfo->pImpTypeLib = impl_from_ITypeLib(pTLib);
......
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