http://bugs.winehq.org/show_bug.cgi?id=28605
--- Comment #8 from Anastasius Focht focht@gmx.net 2011-12-30 16:31:15 CST --- Hello Nikolay,
--- quote --- Actually I still don't understand how this supposed to work, the problem is that application does Invoke() with DISPID_VALUE and DISPATCH_PROPERTYGET flag while method with DISPID_VALUE is not declared with 'propget'. I tried same Invoke() in tests and it fails on Windows in exactly same way. So yeah, it's strange, what do you think, Anastasius? --- quote ---
It's not the application/v6 runtime that does this.
The vb6 application code be reduced to following vbscript/vb6 snippet:
--- snip --- set wshShell = Wscript.CreateObject("Wscript.Shell") strPath = wshShell.SpecialFolders("Desktop") --- snip ---
Consider following trace log:
--- snip --- ... 0024:trace:wshom:WshShell3_get_SpecialFolders (0x32f124) 0024:Call ntdll.RtlAllocateHeap(00110000,00000000,00000008) ret=6391825f 0024:Ret ntdll.RtlAllocateHeap() retval=0014dd48 ret=6391825f 0024:Call ntdll.RtlFreeHeap(00110000,00000000,0014d0a8) ret=6889b63f 0024:Ret ntdll.RtlFreeHeap() retval=00000001 ret=6889b63f 0024:trace:ole:DispCallFunc retval: 0x32f134->{VT_ERROR} ... 0024:trace:wshom:WshCollection_Invoke (0x14dd48)->(0 {00000000-0000-0000-0000-000000000000} 1033 2 0x32f7e0 0x32f870 0x32f7c0 0x32f7f0) 0024:trace:ole:ITypeLib2_fnGetTypeInfoOfGuid 0x14db38 {f935dc27-1cf0-11d0-adb9-00c04fd58a0b} 0x32efe8 0024:trace:ole:ITypeInfo_fnAddRef (0x152858)->ref is 1 0024:trace:ole:ITypeLib2_fnAddRef (0x14db38)->ref was 3 0024:trace:ole:ITypeInfo_fnInvoke (0x152858)(0x14dd48,id=0,flags=0x00000002,0x32f7e0,0x32f870,0x32f7c0,0x32f7f0) 0024:trace:ole:dump_DispParms args=1 named args=0 0024:trace:ole:dump_DispParms args: 0024:trace:ole:dump_Variant 0x32f82c->{VT_BSTR,L"Desktop"} 0024:trace:ole:ITypeInfo2_fnGetVarIndexOfMemId 0x152858 0 0x32eeac 0024:trace:ole:ITypeInfo2_fnGetTypeKind (0x152858) type 0x4 0024:trace:ole:ITypeInfo_fnGetRefTypeInfo typeinfo in imported typelib that isn't already loaded ... --- snip ---
WshCollection is created from WshShell3_get_SpecialFolders() and the "Item" method should be invoked on the newly created object -> WshCollection_Invoke() (propget).
Debugging session to pinpoint the problem:
--- snip --- Wine-dbg>bt Backtrace: =>0 0x6861dcd4 ITypeInfo_fnInvoke+0x1c8(iface=0x143830, pIUnk=0x13ebf0, memid=0, wFlags=0x2, pDispParams=0x33f7e0, pVarResult=0x33f870, pExcepInfo=0x33f7c0, pArgErr=0x33f7f0) [/home/focht/projects/wine/wine-git/dlls/oleaut32/typelib.c:6288] in oleaut32 (0x0033f01c) 1 0x5b0edfe7 WshCollection_Invoke+0x117(iface=0x13ebf0, dispIdMember=0, riid=0x686c8b3c, lcid=0x409, wFlags=0x2, pDispParams=0x33f7e0, pVarResult=0x33f870, pExcepInfo=0x33f7c0, puArgErr=0x33f7f0) [/home/focht/projects/wine/wine-git/dlls/wshom.ocx/shell.c:123] in wshom (0x0033f0ac) 2 0x6861f2b7 ITypeInfo_fnInvoke+0x17aa(iface=0x144868, pIUnk=0x5b0fcd88, memid=0x64, wFlags=0x3, pDispParams=0x33f7e0, pVarResult=0x33f870, pExcepInfo=0x33f7c0, pArgErr=0x33f7f0) [/home/focht/projects/wine/wine-git/dlls/oleaut32/typelib.c:6670] in oleaut32 (0x0033f2bc) 3 0x6861f74d ITypeInfo_fnInvoke+0x1c40(iface=0x1453d8, pIUnk=0x5b0fcd88, memid=0x64, wFlags=0x3, pDispParams=0x33f7e0, pVarResult=0x33f870, pExcepInfo=0x33f7c0, pArgErr=0x33f7f0) [/home/focht/projects/wine/wine-git/dlls/oleaut32/typelib.c:6732] in oleaut32 (0x0033f4cc) 4 0x6861f74d ITypeInfo_fnInvoke+0x1c40(iface=0x1458c0, pIUnk=0x5b0fcd88, memid=0x64, wFlags=0x3, pDispParams=0x33f7e0, pVarResult=0x33f870, pExcepInfo=0x33f7c0, pArgErr=0x33f7f0) [/home/focht/projects/wine/wine-git/dlls/oleaut32/typelib.c:6732] in oleaut32 (0x0033f6dc) 5 0x5b0ee7c0 WshShell3_Invoke+0x104(iface=0x5b0fcd88, dispIdMember=0x64, riid=0x6601ab38, lcid=0x409, wFlags=0x3, pDispParams=0x33f7e0, pVarResult=0x33f870, pExcepInfo=0x33f7c0, puArgErr=0x33f7f0) [/home/focht/projects/wine/wine-git/dlls/wshom.ocx/shell.c:262] in wshom (0x0033f73c) 6 0x660d8e24 in msvbvm60 (+0xd8e23) (0x0033f790) 7 0x66107986 in msvbvm60 (+0x107985) (0x0033f7f4) 8 0x66108cb0 in msvbvm60 (+0x108caf) (0x0033f814) 9 0x0041396e in burnplot (+0x1396d) (0x0033f89c) 10 0x00409301 in burnplot (+0x9300) (0x0033f994) 11 0x66051fb3 in msvbvm60 (+0x51fb2) (0x0033f9a0) 12 0x004047c6 in burnplot (+0x47c5) (0x0033f9b0) ...
Wine-dbg>p pFuncInfo->funcdesc {memid=0, lprgscode=0x0(nil), lprgelemdescParam=0x143a80, funckind=FUNC_PUREVIRTUAL, invkind=INVOKE_FUNC, callconv=CC_STDCALL, cParams=0x2, cParamsOpt=0, oVft=0x1c, cScodes=0, elemdescFunc={tdesc={u={lptdesc=(nil), lpadesc=(nil), hreftype=0}, vt=0x19}, u={idldesc={dwReserved=0, wIDLFlags=0}, paramdesc={pparamdescex=(nil), wParamFlags=0}}}, wFuncFlags=0}
...
Wine-dbg>n
6288 (wFlags & pFuncInfo->funcdesc.invkind) && --- snip ---
Code:
http://source.winehq.org/git/wine.git/blob/7e309601f3cb55deadaab9bd444757483...
wFlags passed in = 2 (INVOKE_PROPERTYGET) pFuncInfo->funcdesc.invkind = 1 (INVOKE_FUNC)
The func lookup skips the correct pFuncInfo (memid 0 -> "Item" dispid) which causes the method not being found.
--- snip --- 6283 /* we do this instead of using GetFuncDesc since it will return a fake 6284 * FUNCDESC for dispinterfaces and we want the real function description */ 6285 for (fdc = 0; fdc < This->TypeAttr.cFuncs; ++fdc){ 6286 pFuncInfo = &This->funcdescs[fdc]; 6287 if ((memid == pFuncInfo->funcdesc.memid) && 6288 (wFlags & pFuncInfo->funcdesc.invkind) && 6289 (pFuncInfo->funcdesc.wFuncFlags & FUNCFLAG_FRESTRICTED) == 0) 6290 break; 6291 } --- snip ---
Code snippet for propget result handling, responsible for wFlags = 2 (INVOKE_PROPERTYGET):
http://source.winehq.org/git/wine.git/blob/7e309601f3cb55deadaab9bd444757483...
--- snip --- 6659 if (SUCCEEDED(hres) && pVarResult && (func_desc->cParams == 1) && 6660 (func_desc->invkind & INVOKE_PROPERTYGET) && 6661 (func_desc->lprgelemdescParam[0].u.paramdesc.wParamFlags & PARAMFLAG_FRETVAL) && 6662 (pDispParams->cArgs != 0)) 6663 { 6664 if (V_VT(pVarResult) == VT_DISPATCH) 6665 { 6666 IDispatch *pDispatch = V_DISPATCH(pVarResult); 6667 /* Note: not VariantClear; we still need the dispatch 6668 * pointer to be valid */ 6669 VariantInit(pVarResult); 6670 hres = IDispatch_Invoke(pDispatch, DISPID_VALUE, &IID_NULL, 6671 GetSystemDefaultLCID(), INVOKE_PROPERTYGET, 6672 pDispParams, pVarResult, pExcepInfo, pArgErr); 6673 IDispatch_Release(pDispatch); 6674 } 6675 else 6676 { 6677 VariantClear(pVarResult); 6678 hres = DISP_E_NOTACOLLECTION; 6679 } 6680 } --- snip ---
After I changed IDispatch_Invoke() wFlags to include INVOKE_FUNC, the "Item" method is found and invoked:
--- snip --- Wine-dbg>bt Backtrace: =>0 0x2004800d WshCollection_Item(iface=0x13ebf0, index=0x146460, value=0x33ee84) [/home/focht/projects/wine/wine-git/dlls/wshom.ocx/shell.c:132] in wshom (0x0033ed5c) 1 0x7dc8aa1e DispCallFunc+0x498(pvInstance=0x13ebf0, oVft=0x1c, cc=CC_STDCALL, vtReturn=0xa, cActuals=0x2, prgvt="??", prgpvarg=0x146480, pvargResult=0x33ee94) [/home/focht/projects/wine/wine-git/dlls/oleaut32/typelib.c:6140] in oleaut32 (0x0033ee0c) 2 0x7dc8ba93 ITypeInfo_fnInvoke+0xf86(iface=0x143830, pIUnk=0x13ebf0, memid=0, wFlags=0x3, pDispParams=0x33f7e0, pVarResult=0x33f870, pExcepInfo=0x33f7c0, pArgErr=0x33f7f0) [/home/focht/projects/wine/wine-git/dlls/oleaut32/typelib.c:6539] in oleaut32 (0x0033f01c) 3 0x20047fe7 WshCollection_Invoke+0x117(iface=0x13ebf0, dispIdMember=0, riid=0x7dd35b3c, lcid=0x409, wFlags=0x3, pDispParams=0x33f7e0, pVarResult=0x33f870, pExcepInfo=0x33f7c0, puArgErr=0x33f7f0) [/home/focht/projects/wine/wine-git/dlls/wshom.ocx/shell.c:123] in wshom (0x0033f0ac) 4 0x7dc8c2b7 ITypeInfo_fnInvoke+0x17aa(iface=0x144868, pIUnk=0x20056d88, memid=0x64, wFlags=0x3, pDispParams=0x33f7e0, pVarResult=0x33f870, pExcepInfo=0x33f7c0, pArgErr=0x33f7f0) [/home/focht/projects/wine/wine-git/dlls/oleaut32/typelib.c:6670] in oleaut32 (0x0033f2bc) 5 0x7dc8c74d ITypeInfo_fnInvoke+0x1c40(iface=0x1453d8, pIUnk=0x20056d88, memid=0x64, wFlags=0x3, pDispParams=0x33f7e0, pVarResult=0x33f870, pExcepInfo=0x33f7c0, pArgErr=0x33f7f0) [/home/focht/projects/wine/wine-git/dlls/oleaut32/typelib.c:6732] in oleaut32 (0x0033f4cc) 6 0x7dc8c74d ITypeInfo_fnInvoke+0x1c40(iface=0x1458c0, pIUnk=0x20056d88, memid=0x64, wFlags=0x3, pDispParams=0x33f7e0, pVarResult=0x33f870, pExcepInfo=0x33f7c0, pArgErr=0x33f7f0) [/home/focht/projects/wine/wine-git/dlls/oleaut32/typelib.c:6732] in oleaut32 (0x0033f6dc) 7 0x200487c0 WshShell3_Invoke+0x104(iface=0x20056d88, dispIdMember=0x64, riid=0x6601ab38, lcid=0x409, wFlags=0x3, pDispParams=0x33f7e0, pVarResult=0x33f870, pExcepInfo=0x33f7c0, puArgErr=0x33f7f0) [/home/focht/projects/wine/wine-git/dlls/wshom.ocx/shell.c:262] in wshom (0x0033f73c) 8 0x660d8e24 in msvbvm60 (+0xd8e23) (0x0033f790) 9 0x66107986 in msvbvm60 (+0x107985) (0x0033f7f4) 10 0x66108cb0 in msvbvm60 (+0x108caf) (0x0033f814) 11 0x0041396e in burnplot (+0x1396d) (0x0033f89c) --- snip ---
This looks more like a bug in Wine ole (invoke flags or funcInfo lookup). Maybe we should really split into more bugs to track these separate issues/commits.
Regards