Walt Ogburn wrote:
I'm not sure how to proceed here. My small patch makes the GetIDsOfNames in olefont work, so that programs that want to use GetIDsOfNames to get a DISPID code and then use Invoke to set font size, bold, etc. will work. With your bigger patch, IFontDisp uses the GetIDsOfNames from typelib.c, which also works, but it also uses the Invoke from typelib.c, which doesn't know how to set the font size, etc.
It does know how to do that - it uses the typelib to calculate an offset in the vtable of the this pointer passed into CreateStdDispatch and calls the matching method.
Therefore, programs that try to get the DISPID code with GetIDsOfNames and then set some property with Invoke are broken at a different point after your patch.
Have you tested this? How exactly do they break? Do they crash or does Invoke return an error?
The thing is, I don't see how the Invoke in typelib.c can be made to get and set the font size, font weight, etc. correctly. It shouldn't know about the internal structure of OLEFontImpl, right? So how can it know that DISPID_FONT_WEIGHT and DISPID_FONT_BOLD mean doing doing different things to the same field in the OLEFontImpl, or where to find it?
Again, it should look up the offset in the vtable to call the appropriate put_... or get_... function depending on whether propget or propput is specified.
If you know how to make Invoke work again after your patch, that would be great.
It is possible that I overlooked something that we need to do for the invoking through a typelib to work. I'll need more info to find this out.