RICHEDIT: implement EM_GETOLEINTERFACE

Mike McCormack mike at codeweavers.com
Tue Mar 8 02:52:03 CST 2005


ChangeLog:
Aric Stewart <aric at codeweavers.com>
* implement EM_GETOLEINTERFACE
-------------- next part --------------
Index: dlls/riched20/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/riched20/Makefile.in,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile.in
--- dlls/riched20/Makefile.in	7 Mar 2005 17:15:33 -0000	1.2
+++ dlls/riched20/Makefile.in	8 Mar 2005 08:50:41 -0000
@@ -4,6 +4,7 @@ SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 MODULE    = riched20.dll
 IMPORTS   = user32 gdi32 kernel32
+EXTRALIBS = -luuid
 
 C_SRCS = \
 	caret.c \
Index: dlls/riched20/editor.c
===================================================================
RCS file: /home/wine/wine/dlls/riched20/editor.c,v
retrieving revision 1.3
diff -u -p -r1.3 editor.c
--- dlls/riched20/editor.c	7 Mar 2005 17:15:33 -0000	1.3
+++ dlls/riched20/editor.c	8 Mar 2005 08:50:42 -0000
@@ -828,10 +828,11 @@ LRESULT WINAPI RichEditANSIWndProc(HWND 
     return DefWindowProcW(hWnd, msg, wParam, lParam);
   }
   case EM_GETOLEINTERFACE:
-    FIXME("EM_GETOLEINTERFACE: stub\n");
-    /* return 0x12345678; to find out if the missing interface is
-       related to app crash */ 
-    return 0;
+  {
+    LPVOID *ppvObj = (LPVOID*) lParam;
+    TRACE("EM_GETOLEINTERFACE %p\n", ppvObj);
+    return CreateIRichEditOle(ppvObj);
+  }
   default:
   do_default:
     return DefWindowProcW(hWnd, msg, wParam, lParam);
Index: dlls/riched20/editor.h
===================================================================
RCS file: /home/wine/wine/dlls/riched20/editor.h,v
retrieving revision 1.1
diff -u -p -r1.1 editor.h
--- dlls/riched20/editor.h	5 Mar 2005 11:19:14 -0000	1.1
+++ dlls/riched20/editor.h	8 Mar 2005 08:50:42 -0000
@@ -190,6 +190,9 @@ int ME_GetScrollPos(ME_TextEditor *edito
 void ME_EnsureVisible(ME_TextEditor *editor, ME_DisplayItem *pRun);
 COLORREF ME_GetBackColor(ME_TextEditor *editor);
 
+/* richole.c */
+extern LRESULT CreateIRichEditOle(LPVOID *);
+
 /* wintest.c */
 
 /* editor.c */
Index: dlls/riched20/richole.c
===================================================================
RCS file: /home/wine/wine/dlls/riched20/richole.c,v
retrieving revision 1.2
diff -u -p -r1.2 richole.c
--- dlls/riched20/richole.c	5 Mar 2005 11:55:44 -0000	1.2
+++ dlls/riched20/richole.c	8 Mar 2005 08:50:42 -0000
@@ -1,7 +1,8 @@
 /*
- * RichEdit GUIDs
+ * RichEdit GUIDs and OLE interface
  *
  * Copyright 2004 by Krzysztof Foltman
+ * Copyright 2004 Aric Stewart
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -18,19 +19,249 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include <windef.h>
+#include <stdarg.h>
+//#include <string.h>
 
-/* there is no way to be consistent across different sets of headers - mingw, Wine, Win32 SDK*/
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "ole2.h"
+#include "richole.h"
+#include "wine/debug.h"
 
-#define RICHEDIT_GUID(name, l, w1, w2) \
-  GUID name = { l, w1, w2, {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}}
+WINE_DEFAULT_DEBUG_CHANNEL(richedit);
 
-RICHEDIT_GUID(IID_IRichEditOle, 0x00020d00, 0, 0);
-RICHEDIT_GUID(IID_IRichEditOleCallback, 0x00020d03, 0, 0);
+typedef struct IRichEditOleImpl {
+    IRichEditOleVtbl *lpVtbl;
+    DWORD ref;
+} IRichEditOleImpl;
 
+/* there is no way to be consistent across different sets of headers - mingw, Wine, Win32 SDK*/
+
+/* FIXME: the next 6 lines should be in textserv.h */
 #define TEXTSERV_GUID(name, l, w1, w2, b1, b2) \
   GUID name = { l, w1, w2, {b1, b2, 0x00, 0xaa, 0x00, 0x6c, 0xad, 0xc5}}
 
 TEXTSERV_GUID(IID_ITextServices, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d);
 TEXTSERV_GUID(IID_ITextHost, 0xc5bdd8d0, 0xd26e, 0x11ce, 0xa8, 0x9e);
 TEXTSERV_GUID(IID_ITextHost2, 0xc5bdd8d0, 0xd26e, 0x11ce, 0xa8, 0x9e);
+
+static HRESULT WINAPI
+IRichEditOle_fnQueryInterface(IRichEditOle *me, REFIID riid, LPVOID *ppvObj)
+{
+    IRichEditOleImpl *This = (IRichEditOleImpl *)me;
+
+    TRACE("%p %s\n", This, debugstr_guid(riid) );
+
+    if (IsEqualGUID(riid, &IID_IUnknown) ||
+        IsEqualGUID(riid, &IID_IRichEditOle))
+    {
+        IRichEditOle_AddRef(me);
+        *ppvObj = (LPVOID) This;
+        return S_OK;
+    }
+ 
+    return E_NOINTERFACE;   
+}
+
+static ULONG WINAPI
+IRichEditOle_fnAddRef(IRichEditOle *me)
+{
+    IRichEditOleImpl *This = (IRichEditOleImpl *)me;
+    ULONG ref = InterlockedIncrement( &This->ref );
+
+    TRACE("%p ref = %lu\n", This, ref);
+
+    return ref;
+}
+
+static ULONG WINAPI
+IRichEditOle_fnRelease(IRichEditOle *me)
+{
+    IRichEditOleImpl *This = (IRichEditOleImpl *)me;
+    ULONG ref = InterlockedDecrement(&This->ref);
+
+    TRACE ("%p ref=%lu\n", This, ref);
+
+    if (!ref)
+    {
+        TRACE ("Destroying %p\n", This);
+        HeapFree(GetProcessHeap(),0,This);
+    }
+    return ref;
+}
+
+static HRESULT WINAPI
+IRichEditOle_fnActivateAs(IRichEditOle *me, REFCLSID rclsid, REFCLSID rclsidAs)
+{
+    IRichEditOleImpl *This = (IRichEditOleImpl *)me;
+    FIXME("stub %p\n",This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI
+IRichEditOle_fnContextSensitiveHelp(IRichEditOle *me, BOOL fEnterMode)
+{
+    IRichEditOleImpl *This = (IRichEditOleImpl *)me;
+    FIXME("stub %p\n",This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI
+IRichEditOle_fnConvertObject(IRichEditOle *me, LONG iob,
+               REFCLSID rclsidNew, LPCSTR lpstrUserTypeNew)
+{
+    IRichEditOleImpl *This = (IRichEditOleImpl *)me;
+    FIXME("stub %p\n",This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI
+IRichEditOle_fnGetClientSite(IRichEditOle *me,
+               LPOLECLIENTSITE *lplpolesite)
+{
+    IRichEditOleImpl *This = (IRichEditOleImpl *)me;
+    FIXME("stub %p\n",This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI
+IRichEditOle_fnGetClipboardData(IRichEditOle *me, CHARRANGE *lpchrg,
+               DWORD reco, LPDATAOBJECT *lplpdataobj)
+{
+    IRichEditOleImpl *This = (IRichEditOleImpl *)me;
+    FIXME("stub %p\n",This);
+    return E_NOTIMPL;
+}
+
+static LONG WINAPI IRichEditOle_fnGetLinkCount(IRichEditOle *me)
+{
+    IRichEditOleImpl *This = (IRichEditOleImpl *)me;
+    FIXME("stub %p\n",This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI
+IRichEditOle_fnGetObject(IRichEditOle *me, LONG iob,
+               REOBJECT *lpreobject, DWORD dwFlags)
+{
+    IRichEditOleImpl *This = (IRichEditOleImpl *)me;
+    FIXME("stub %p\n",This);
+    return E_NOTIMPL;
+}
+
+static LONG WINAPI
+IRichEditOle_fnGetObjectCount(IRichEditOle *me)
+{
+    IRichEditOleImpl *This = (IRichEditOleImpl *)me;
+    FIXME("stub %p\n",This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI
+IRichEditOle_fnHandsOffStorage(IRichEditOle *me, LONG iob)
+{
+    IRichEditOleImpl *This = (IRichEditOleImpl *)me;
+    FIXME("stub %p\n",This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI
+IRichEditOle_fnImportDataObject(IRichEditOle *me, LPDATAOBJECT lpdataobj,
+               CLIPFORMAT cf, HGLOBAL hMetaPict)
+{
+    IRichEditOleImpl *This = (IRichEditOleImpl *)me;
+    FIXME("stub %p\n",This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI
+IRichEditOle_fnInPlaceDeactivate(IRichEditOle *me)
+{
+    IRichEditOleImpl *This = (IRichEditOleImpl *)me;
+    FIXME("stub %p\n",This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI
+IRichEditOle_fnInsertObject(IRichEditOle *me, REOBJECT *lpreobject)
+{
+    IRichEditOleImpl *This = (IRichEditOleImpl *)me;
+    FIXME("stub %p\n",This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IRichEditOle_fnSaveCompleted(IRichEditOle *me, LONG iob,
+               LPSTORAGE lpstg)
+{
+    IRichEditOleImpl *This = (IRichEditOleImpl *)me;
+    FIXME("stub %p\n",This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI
+IRichEditOle_fnSetDvaspect(IRichEditOle *me, LONG iob, DWORD dvaspect)
+{
+    IRichEditOleImpl *This = (IRichEditOleImpl *)me;
+    FIXME("stub %p\n",This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI IRichEditOle_fnSetHostNames(IRichEditOle *me,
+               LPCSTR lpstrContainerApp, LPCSTR lpstrContainerObj)
+{
+    IRichEditOleImpl *This = (IRichEditOleImpl *)me;
+    FIXME("stub %p\n",This);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI
+IRichEditOle_fnSetLinkAvailable(IRichEditOle *me, LONG iob, BOOL fAvailable)
+{
+    IRichEditOleImpl *This = (IRichEditOleImpl *)me;
+    FIXME("stub %p\n",This);
+    return E_NOTIMPL;
+}
+
+static IRichEditOleVtbl revt = {
+    IRichEditOle_fnQueryInterface,
+    IRichEditOle_fnAddRef,
+    IRichEditOle_fnRelease,
+    IRichEditOle_fnGetClientSite,
+    IRichEditOle_fnGetObjectCount,
+    IRichEditOle_fnGetLinkCount,
+    IRichEditOle_fnGetObject,
+    IRichEditOle_fnInsertObject,
+    IRichEditOle_fnConvertObject,
+    IRichEditOle_fnActivateAs,
+    IRichEditOle_fnSetHostNames,
+    IRichEditOle_fnSetLinkAvailable,
+    IRichEditOle_fnSetDvaspect,
+    IRichEditOle_fnHandsOffStorage,
+    IRichEditOle_fnSaveCompleted,
+    IRichEditOle_fnInPlaceDeactivate,
+    IRichEditOle_fnContextSensitiveHelp,
+    IRichEditOle_fnGetClipboardData,
+    IRichEditOle_fnImportDataObject
+};
+
+LRESULT CreateIRichEditOle(LPVOID *ppObj)
+{
+    IRichEditOleImpl *reo;
+
+    reo = HeapAlloc(GetProcessHeap(), 0, sizeof(IRichEditOleImpl));
+    if (!reo)
+        return 0;
+
+    reo->lpVtbl = &revt;
+    reo->ref = 1;
+    TRACE("Created %p\n",reo);
+    *ppObj = (LPVOID) reo;
+
+    return 1;
+}
Index: dlls/uuid/uuid.c
===================================================================
RCS file: /home/wine/wine/dlls/uuid/uuid.c,v
retrieving revision 1.8
diff -u -p -r1.8 uuid.c
--- dlls/uuid/uuid.c	10 Jan 2005 13:31:29 -0000	1.8
+++ dlls/uuid/uuid.c	8 Mar 2005 08:50:42 -0000
@@ -56,6 +56,7 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,
 #include "dispex.h"
 #include "mlang.h"
 #include "mshtml.h"
+#include "richole.h"
 
 /* FIXME: cguids declares GUIDs but does not define their values */
 


More information about the wine-patches mailing list