From: Edward O'Callaghan edward@antitrust.cc
Both the ::IsName() and ::FindName() methods should do case-insensitive searches however should fix up the szNameBuf param with any case diff upon a match.
Test-Fix-Spotted-by: Damien Zammit damien@zamaudio.com Signed-off-by: Edward O'Callaghan edward@antitrust.cc --- dlls/oleaut32/tests/typelib.c | 2 -- dlls/oleaut32/typelib.c | 24 ++++++++++++++++++++---- 2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c index 153964e17d5..f75102538fe 100644 --- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -7743,11 +7743,9 @@ static void test_FindName(void) ti = (void*)0xdeadbeef; hr = ITypeLib_FindName(tl, buffW, 0, &ti, &memid, &c); ok(hr == S_OK, "got 0x%08lx\n", hr); -todo_wine { ok(memid == MEMBERID_NIL, "got %ld\n", memid); ok(!lstrcmpW(buffW, wszGUID), "got %s\n", wine_dbgstr_w(buffW)); ok(c == 1, "got %d\n", c); -} if (c == 1) ITypeInfo_Release(ti);
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index f11cab97078..8ac2b25961b 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -1285,6 +1285,11 @@ static inline BSTR TLB_get_bstr(const TLBString *str) return str != NULL ? str->str : NULL; }
+static inline void TLB_set_bstr(LPOLESTR s, const TLBString *str) +{ + lstrcpyW(s, str->str); +} + static inline const GUID *TLB_get_guidref(const TLBGuid *guid) { return guid != NULL ? &guid->guid : NULL; @@ -5103,25 +5108,33 @@ static HRESULT WINAPI ITypeLib2_fnIsName( TLBVarDesc *pVDesc; UINT fdc;
- if(!lstrcmpiW(TLB_get_bstr(pTInfo->Name), szNameBuf)) + if(!lstrcmpiW(TLB_get_bstr(pTInfo->Name), szNameBuf)) { + TLB_set_bstr(szNameBuf, pTInfo->Name); goto ITypeLib2_fnIsName_exit; + }
for(fdc = 0; fdc < pTInfo->typeattr.cFuncs; ++fdc) { TLBFuncDesc *pFDesc = &pTInfo->funcdescs[fdc]; int pc;
- if(!lstrcmpiW(TLB_get_bstr(pFDesc->Name), szNameBuf)) + if(!lstrcmpiW(TLB_get_bstr(pFDesc->Name), szNameBuf)) { + TLB_set_bstr(szNameBuf, pFDesc->Name); goto ITypeLib2_fnIsName_exit; + }
for(pc=0; pc < pFDesc->funcdesc.cParams; pc++){ - if(!lstrcmpiW(TLB_get_bstr(pFDesc->pParamDesc[pc].Name), szNameBuf)) + if(!lstrcmpiW(TLB_get_bstr(pFDesc->pParamDesc[pc].Name), szNameBuf)) { + TLB_set_bstr(szNameBuf, pFDesc->pParamDesc[pc].Name); goto ITypeLib2_fnIsName_exit; + } } }
pVDesc = TLB_get_vardesc_by_name(pTInfo, szNameBuf); - if (pVDesc) + if (pVDesc) { + TLB_set_bstr(szNameBuf, pVDesc->Name); goto ITypeLib2_fnIsName_exit; + }
} *pfName=FALSE; @@ -5164,6 +5177,7 @@ static HRESULT WINAPI ITypeLib2_fnFindName(
if(!lstrcmpiW(TLB_get_bstr(pTInfo->Name), szNameBuf)) { memid[count] = MEMBERID_NIL; + TLB_set_bstr(szNameBuf, pTInfo->Name); goto ITypeLib2_fnFindName_exit; }
@@ -5172,6 +5186,7 @@ static HRESULT WINAPI ITypeLib2_fnFindName(
if(!lstrcmpiW(TLB_get_bstr(pFDesc->Name), szNameBuf)) { memid[count] = pFDesc->funcdesc.memid; + TLB_set_bstr(szNameBuf, pFDesc->Name); goto ITypeLib2_fnFindName_exit; } } @@ -5179,6 +5194,7 @@ static HRESULT WINAPI ITypeLib2_fnFindName( pVDesc = TLB_get_vardesc_by_name(pTInfo, szNameBuf); if (pVDesc) { memid[count] = pVDesc->vardesc.memid; + TLB_set_bstr(szNameBuf, pVDesc->Name); goto ITypeLib2_fnFindName_exit; }