oleaut32: fix regression at MSFT typelib parsing

a_villacis at palosanto.com a_villacis at palosanto.com
Fri Nov 3 10:42:55 CST 2006

Finally, I managed to figure out the proper fix for the crash on regsvr32
msvbvm60.dll (and probably some other DLLs too). It turns out that the
field from which TLBFuncDesc->Entry is filled is supposed to indicate the
function entry point that implements the function described in the
typelib. The roper interpretation of the entry is right there as a

    BSTR Entry;            /* if its Hiword==0, it numeric; -1 is not

What this means is that if TLBFuncDesc->Entry has a high word of 0, it is
supposed to be a DLL function ordinal. Otherwise, it is an offset of the
function name (for lookup-by-name in the DLL). When this field was
directly copied from the binary block (and the block kept around, with a
memory leak), everything worked as expected. However, the patch to
allocate space for the function name in the Entry-as-funcname case broke
the Entry-as-ordinal case, since the ordinal value is not a proper
pointer, and therefore it is incorrect to use it as such (like calling
SysAllocString on it). This patch fixes the regression by copying the
ordinal value when indicated by the FKCCIC flag, and checking the HIWORD
before trying to free the allocated string in the Entry-as-funcname case.

BTW, could any of you please comment on the previous patch for removing
the use of CreateCompatibleDC in the implementation of GetDIBits() ? I
sent it a few days ago, but it seems to have been ignored (no commit, no
critique on why it is being rejected). Otherwise I will send it again in
the assumption that it slipped through the cracks somewhere.

* Fix regression on MSFT typelib parsing of function records by allocating
  a string copy only when indicated by FKCCIC flag, and preserving the
meaning of value as function ordinal otherwise.

Alex Villacís Lasso
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wine-oleaut32-typelib-MSFT-Entry.patch
Type: text/x-patch
Size: 1756 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20061103/1be06c0f/wine-oleaut32-typelib-MSFT-Entry.bin

More information about the wine-devel mailing list