As bug 17042 [1] reported, the IUnknown object returned by CreateTextServices() does not support ITextDocument. I believe that's the root cause of some apps crash.
richole.c has a very limited implementation of ITextDocument for IRichEditOle, which is totally unreusable. I'm trying to implement ITextDocument for both ITextServices and IRichEditOle. ME_Editor type provides most of the editor functionalities, and both of ITextServices and IRichEditOle use it. So I'm going to use it to implement ITextDocument. The proposal is: struct tagReTxtDoc { IUnknown *parentObj; ME_Editor *editor; } ReTxtDoc; ReTxtDoc *CreateReTxtDoc(IUnknown *parentObj, ME_Editor *editor); void DestroyReTxtDoc(ReTxtDoc); ReTxtDoc_addRef/QueryInterface/Release -> delegate to parentObj Other ITextDocument methods: use ME_Editor to implement. This is my first time to develop WINE. Any comments/suggestions? [1] http://bugs.winehq.org/show_bug.cgi?id=17042