Module: wine Branch: refs/heads/master Commit: 1f68feeef11f4c64cc55b4ceb3a9040fdf8ac551 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=1f68feeef11f4c64cc55b4ce...
Author: Robert Shearman rob@codeweavers.com Date: Tue Dec 6 21:24:45 2005 +0100
OLE: Implement ITypeInfo_AddressOfMember.
---
dlls/oleaut32/typelib.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 47 insertions(+), 1 deletions(-)
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index ebf1903..5ed9a82 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -5671,7 +5671,53 @@ static HRESULT WINAPI ITypeInfo_fnAddres MEMBERID memid, INVOKEKIND invKind, PVOID *ppv) { ITypeInfoImpl *This = (ITypeInfoImpl *)iface; - FIXME("(%p) stub!\n", This); + HRESULT hr; + BSTR dll, entry; + WORD ordinal; + HMODULE module; + + TRACE("(%p)->(0x%lx, 0x%x, %p)\n", This, memid, invKind, ppv); + + hr = ITypeInfo_GetDllEntry(iface, memid, invKind, &dll, &entry, &ordinal); + if (FAILED(hr)) + return hr; + + module = LoadLibraryW(dll); + if (!module) + { + ERR("couldn't load %s\n", debugstr_w(dll)); + SysFreeString(dll); + if (entry) SysFreeString(entry); + return STG_E_FILENOTFOUND; + } + /* FIXME: store library somewhere where we can free it */ + + if (entry) + { + LPSTR entryA; + INT len = WideCharToMultiByte(CP_ACP, 0, entry, -1, NULL, 0, NULL, NULL); + entryA = HeapAlloc(GetProcessHeap(), 0, len); + WideCharToMultiByte(CP_ACP, 0, entry, -1, entryA, len, NULL, NULL); + + *ppv = GetProcAddress(module, entryA); + if (!*ppv) + ERR("function not found %s\n", debugstr_a(entryA)); + + HeapFree(GetProcessHeap(), 0, entryA); + } + else + { + *ppv = GetProcAddress(module, MAKEINTRESOURCEA(ordinal)); + if (!*ppv) + ERR("function not found %d\n", ordinal); + } + + SysFreeString(dll); + if (entry) SysFreeString(entry); + + if (!*ppv) + return TYPE_E_DLLFUNCTIONNOTFOUND; + return S_OK; }