Re: DBGRID32.OCX fix - RFC
Alex Villacís Lasso wrote: Robert Shearman wrote: What hRefType is passed to the function? I don't think the above is quite correct. Can you try changing the if statement to something like this: if (hRefType == -1 && (This->TypeAttr.typekind == TKIND_DISPATCH) && (This->TypeAttr.wTypeFlags & (TYPEFLAG_FDUAL|TYPEFLAG_FDISPATCHABLE))) That would not keep the app from crashing. For the case of DBGRID32.OCX, hRefType is systematically == 19, and it says so in the ERR message just before the crash. However, on a second look, maybe the problem is not that the function performs the wrong action, but that it returns the wrong value (E_FAIL, should be TYPE_E_ELEMENTNOTFOUND). I have to check this alternate theory on my home machine. Alex Villacís Lasso More information: if the flag dumping portion of the patch is applied, but the condition portion is not, and a dump of the available references is added, the following is the result when trying to load DBGRID32.OCX: fixme:ole:ITypeInfo_fnGetRefTypeInfopRefType->reference == 0x0640 fixme:ole:ITypeInfo_fnGetRefTypeInfopRefType->reference == 0x0190 fixme:ole:ITypeInfo_fnGetRefTypeInfopRefType->reference == 0x03e8 fixme:ole:ITypeInfo_fnGetRefTypeInfopRefType->reference == 0x0031 fixme:ole:ITypeInfo_fnGetRefTypeInfopRefType->reference == 0x0708 fixme:ole:ITypeInfo_fnGetRefTypeInfopRefType->reference == 0x0258 fixme:ole:ITypeInfo_fnGetRefTypeInfopRefType->reference == 0x00c8 fixme:ole:ITypeInfo_fnGetRefTypeInfopRefType->reference == 0x003d fixme:ole:ITypeInfo_fnGetRefTypeInfopRefType->reference == 0x0578 fixme:ole:ITypeInfo_fnGetRefTypeInfopRefType->reference == 0x07d0 fixme:ole:ITypeInfo_fnGetRefTypeInfopRefType->reference == 0x fixme:ole:ITypeInfo_fnGetRefTypeInfo Can't find pRefType for ref 19 fixme:ole:ITypeInfo_fnGetRefTypeInfotypekind is TKIND_DISPATCH fixme:ole:ITypeInfo_fnGetRefTypeInfowTypeFlags are: TYPEFLAG_FHIDDEN TYPEFLAG_FNONEXTENSIBLE TYPEFLAG_FDISPATCHABLE wine: Unhandled page fault on read access to 0x0010 at address 0x230f4f31 (thread 0009), starting debugger... BTW, no luck on the bad-return-value theory, the app keeps crashing. Alex Villacís Lasso
Re: DBGRID32.OCX fix - RFC
Robert Shearman wrote: What hRefType is passed to the function? I don't think the above is quite correct. Can you try changing the if statement to something like this: if (hRefType == -1 && (This->TypeAttr.typekind == TKIND_DISPATCH) && (This->TypeAttr.wTypeFlags & (TYPEFLAG_FDUAL|TYPEFLAG_FDISPATCHABLE))) That would not keep the app from crashing. For the case of DBGRID32.OCX, hRefType is systematically == 19, and it says so in the ERR message just before the crash. However, on a second look, maybe the problem is not that the function performs the wrong action, but that it returns the wrong value (E_FAIL, should be TYPE_E_ELEMENTNOTFOUND). I have to check this alternate theory on my home machine. Alex Villacís Lasso
Re: DBGRID32.OCX fix - RFC
Alex Villacís Lasso wrote: I would like to know if the attached patch (which prevents DBGRID32.OCX from crashing, as well as adding additional debugging information when a reference is not found) would step on anybody's toes (especially Robert Shearman, since he is sending several oleaut32 patches himself). As of 2005-12-01 CVS, any VisualBasic application that tries to use DBGRID32.OCX will systematically crash unless the patch is applied. However, since Robert Shearman is sending oleaut32 fixes, I think he might implement some functionality that will, as a side effect, fix the DBGRID32.OCX bug. No, I have no plans to change anything that should affect this. ITypeInfoImpl *This = (ITypeInfoImpl *)iface; HRESULT result = E_FAIL; -if (hRefType == -1 && - (((ITypeInfoImpl*) This)->TypeAttr.typekind == TKIND_DISPATCH) && - (((ITypeInfoImpl*) This)->TypeAttr.wTypeFlags & TYPEFLAG_FDUAL)) +if ( +( +hRefType == -1 && +(This->TypeAttr.typekind == TKIND_DISPATCH) && +(This->TypeAttr.wTypeFlags & TYPEFLAG_FDUAL) +) +|| +( +(This->TypeAttr.typekind == TKIND_DISPATCH) && +(This->TypeAttr.wTypeFlags & TYPEFLAG_FDISPATCHABLE) + ) + ) { What hRefType is passed to the function? I don't think the above is quite correct. Can you try changing the if statement to something like this: if (hRefType == -1 && (This->TypeAttr.typekind == TKIND_DISPATCH) && (This->TypeAttr.wTypeFlags & (TYPEFLAG_FDUAL|TYPEFLAG_FDISPATCHABLE))) -- Rob Shearman
DBGRID32.OCX fix - RFC
I would like to know if the attached patch (which prevents DBGRID32.OCX from crashing, as well as adding additional debugging information when a reference is not found) would step on anybody's toes (especially Robert Shearman, since he is sending several oleaut32 patches himself). As of 2005-12-01 CVS, any VisualBasic application that tries to use DBGRID32.OCX will systematically crash unless the patch is applied. However, since Robert Shearman is sending oleaut32 fixes, I think he might implement some functionality that will, as a side effect, fix the DBGRID32.OCX bug. Alex Villacís Lasso --- wine-0.9.2-cvs/dlls/oleaut32/typelib.c 2005-12-01 10:15:14.0 -0500 +++ wine-0.9.2-cvs-patch/dlls/oleaut32/typelib.c 2005-12-02 11:48:11.0 -0500 @@ -5520,9 +5520,18 @@ ITypeInfoImpl *This = (ITypeInfoImpl *)iface; HRESULT result = E_FAIL; -if (hRefType == -1 && - (((ITypeInfoImpl*) This)->TypeAttr.typekind == TKIND_DISPATCH) && - (((ITypeInfoImpl*) This)->TypeAttr.wTypeFlags & TYPEFLAG_FDUAL)) +if ( +( +hRefType == -1 && +(This->TypeAttr.typekind == TKIND_DISPATCH) && +(This->TypeAttr.wTypeFlags & TYPEFLAG_FDUAL) +) +|| +( +(This->TypeAttr.typekind == TKIND_DISPATCH) && +(This->TypeAttr.wTypeFlags & TYPEFLAG_FDISPATCHABLE) + ) + ) { /* when we meet a DUAL dispinterface, we must create the interface * version of it. @@ -5551,8 +5560,47 @@ if(pRefType->reference == hRefType) break; } - if(!pRefType) - FIXME("Can't find pRefType for ref %lx\n", hRefType); + if(!pRefType) { +static const char * descTKIND[TKIND_MAX] = { +"TKIND_ENUM", +"TKIND_RECORD", +"TKIND_MODULE", +"TKIND_INTERFACE", +"TKIND_DISPATCH", +"TKIND_COCLASS", +"TKIND_ALIAS", +"TKIND_UNION", +}; +static const char * descTypeFlags[15] = { +"TYPEFLAG_FAPPOBJECT", +"TYPEFLAG_FCANCREATE", +"TYPEFLAG_FLICENSED", +"TYPEFLAG_FPREDECLID", +"TYPEFLAG_FHIDDEN", +"TYPEFLAG_FCONTROL", +"TYPEFLAG_FDUAL", +"TYPEFLAG_FNONEXTENSIBLE", +"TYPEFLAG_FOLEAUTOMATION", +"TYPEFLAG_FRESTRICTED", +"TYPEFLAG_FAGGREGATABLE", +"TYPEFLAG_FREPLACEABLE", +"TYPEFLAG_FDISPATCHABLE", +"TYPEFLAG_FREVERSEBIND", +"TYPEFLAG_FPROXY", +}; +int i; + +FIXME("Can't find pRefType for ref %lx\n", hRefType); +FIXME("\ttypekind is %s\n", descTKIND[This->TypeAttr.typekind]); +FIXME("\twTypeFlags are:"); +for (i = 0; i < 15; i++) { +if (This->TypeAttr.wTypeFlags & (1 << i)) +FIXME(" %s", descTypeFlags[i]); +} +if (This->TypeAttr.wTypeFlags & 0x8000) +FIXME(" %08x", This->TypeAttr.wTypeFlags & 0x8000); +FIXME("\n"); + } if(pRefType && hRefType != -1) { ITypeLib *pTLib = NULL;