Re: [2/2] oleaut32: Implement TLB dependencies lookup in resources (resend 3 - last submit before abandon)
Guillaume Charifi <guillaume.charifi(a)sfr.fr> writes:
+ strcpyW(szTLBPath, szPath); + snprintfW(szStringName, sizeof(szStringName)/sizeof(WCHAR), resFormatStrW, PtrToInt(lpszIntName)); + strcatW(szTLBPath, szStringName); + + ret = TLB_PEFile_Open(szPath, PtrToInt(lpszIntName), &pBase, &dwTLBLength, &pFile); + if (ret == TYPE_E_CANTLOADLIBRARY) + ret = TLB_NEFile_Open(szPath, PtrToInt(lpszIntName), &pBase, &dwTLBLength, &pFile); + if (ret == TYPE_E_CANTLOADLIBRARY) + ret = TLB_Mapping_Open(szPath, &pBase, &dwTLBLength, &pFile); + if (SUCCEEDED(ret)) + { + if (dwTLBLength >= 4) + { + DWORD dwSignature = FromLEDWord(*((DWORD*) pBase)); + if (dwSignature == MSFT_SIGNATURE) + pTLib = ITypeLib2_Constructor_MSFT(pBase, dwTLBLength); + else if (dwSignature == SLTG_SIGNATURE) + pTLib = ITypeLib2_Constructor_SLTG(pBase, dwTLBLength); + else + { + FIXME("Header type magic 0x%08x not supported.\n", dwSignature); + ret = E_FAIL; + } + } + else + ret = E_FAIL; + IUnknown_Release(pFile); + }
You should avoid duplicating all that code.
+ if(pTLib) { + ITypeLibImpl *impl = impl_from_ITypeLib2(pTLib); + ret = UuidEqual((UUID *)This->guid, (UUID *)TLB_get_guid_null(impl->guid), &rpc_stat); + ITypeLib_Release((ITypeLib *)pTLib); + + ret = (ret == TRUE) ? LoadTypeLibEx(szTLBPath, REGKIND_NONE, (ITypeLib **)&pTLib) : E_FAIL; + }
That's pretty ugly. -- Alexandre Julliard julliard(a)winehq.org
participants (1)
-
Alexandre Julliard