MSHTML: Added test of IOleObject::[SG]etClientSite

Jacek Caban jack at itma.pwr.wroc.pl
Fri Jul 1 13:38:33 CDT 2005


Changelog:
    - Added test of IOleObject::[SG]etClientSite
    - Fix IOleObject_SetClientSite to pass tests
-------------- next part --------------
Index: dlls/mshtml/tests/htmldoc.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/tests/htmldoc.c,v
retrieving revision 1.1
diff -u -p -r1.1 htmldoc.c
--- dlls/mshtml/tests/htmldoc.c	27 Jun 2005 11:19:49 -0000	1.1
+++ dlls/mshtml/tests/htmldoc.c	1 Jul 2005 18:32:57 -0000
@@ -25,6 +25,304 @@
 #include "winbase.h"
 #include "ole2.h"
 #include "mshtml.h"
+#include "docobj.h"
+#include "mshtmhst.h"
+
+static HRESULT QueryInterface(REFIID riid, void **ppv);
+
+static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
+{
+    return QueryInterface(riid, ppv);
+}
+
+static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
+{
+    return 2;
+}
+
+static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
+{
+    return 1;
+}
+
+static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAsign, DWORD dwWhichMoniker,
+        IMoniker **ppmon)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static const IOleClientSiteVtbl ClientSiteVtbl = {
+    ClientSite_QueryInterface,
+    ClientSite_AddRef,
+    ClientSite_Release,
+    ClientSite_SaveObject,
+    ClientSite_GetMoniker,
+    ClientSite_GetContainer,
+    ClientSite_ShowObject,
+    ClientSite_OnShowWindow,
+    ClientSite_RequestNewObjectLayout
+};
+
+static IOleClientSite ClientSite = { &ClientSiteVtbl };
+
+static HRESULT WINAPI DocumentSite_QueryInterface(IOleDocumentSite *iface, REFIID riid, void **ppv)
+{
+    return QueryInterface(riid, ppv);
+}
+
+static ULONG WINAPI DocumentSite_AddRef(IOleDocumentSite *iface)
+{
+    return 2;
+}
+
+static ULONG WINAPI DocumentSite_Release(IOleDocumentSite *iface)
+{
+    return 1;
+}
+
+static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocumentView *pViewToActivate)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static const IOleDocumentSiteVtbl DocumentSiteVtbl = {
+    DocumentSite_QueryInterface,
+    DocumentSite_AddRef,
+    DocumentSite_Release,
+    DocumentSite_ActivateMe
+};
+
+static IOleDocumentSite DocumentSite = { &DocumentSiteVtbl };
+
+static HRESULT WINAPI DocHostUIHandler_QueryInterface(IDocHostUIHandler2 *iface, REFIID riid, void **ppv)
+{
+    return QueryInterface(riid, ppv);
+}
+
+static ULONG WINAPI DocHostUIHandler_AddRef(IDocHostUIHandler2 *iface)
+{
+    return 2;
+}
+
+static ULONG WINAPI DocHostUIHandler_Release(IDocHostUIHandler2 *iface)
+{
+    return 1;
+}
+
+static HRESULT WINAPI DocHostUIHandler_ShowContextMenu(IDocHostUIHandler2 *iface, DWORD dwID, POINT *ppt,
+        IUnknown *pcmdtReserved, IDispatch *pdicpReserved)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static BOOL expect_GetHostInfo = FALSE, called_GetHostInfo = FALSE;
+static HRESULT WINAPI DocHostUIHandler_GetHostInfo(IDocHostUIHandler2 *iface, DOCHOSTUIINFO *pInfo)
+{
+    ok(expect_GetHostInfo, "unexpected call\n");
+    ok(pInfo != NULL, "pInfo=NULL\n");
+    if(pInfo) {
+        ok(pInfo->cbSize == sizeof(DOCHOSTUIINFO), "pInfo->cbSize=%lu, expected %u\n",
+                pInfo->cbSize, sizeof(DOCHOSTUIINFO));
+        ok(!pInfo->dwFlags, "pInfo->dwFlags=%08lx, expected 0\n", pInfo->dwFlags);
+        pInfo->dwFlags = DOCHOSTUIFLAG_DISABLE_HELP_MENU | DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE
+            | DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY | DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION
+            | DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION;
+        ok(!pInfo->dwDoubleClick, "pInfo->dwDoubleClick=%08lx, expected 0\n", pInfo->dwDoubleClick);
+        ok(!pInfo->pchHostCss, "pInfo->pchHostCss=%p, expected NULL\n", pInfo->pchHostCss);
+        ok(!pInfo->pchHostNS, "pInfo->pchhostNS=%p, expected NULL\n", pInfo->pchHostNS);
+    }
+    called_GetHostInfo = TRUE;
+    expect_GetHostInfo = FALSE;
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DocHostUIHandler_ShowUI(IDocHostUIHandler2 *iface, DWORD dwID,
+        IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget,
+        IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DocHostUIHandler_HideUI(IDocHostUIHandler2 *iface)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DocHostUIHandler_UpdateUI(IDocHostUIHandler2 *iface)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DocHostUIHandler_EnableModeless(IDocHostUIHandler2 *iface, BOOL fEnable)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DocHostUIHandler_OnDocWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DocHostUIHandler_OnFrameWindowActivate(IDocHostUIHandler2 *iface, BOOL fActivate)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DocHostUIHandler_ResizeBorder(IDocHostUIHandler2 *iface, LPCRECT prcBorder,
+        IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DocHostUIHandler_TranslateAccelerator(IDocHostUIHandler2 *iface, LPMSG lpMsg,
+        const GUID *pguidCmdGroup, DWORD nCmdID)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static BOOL expect_GetOptionKeyPath = FALSE, called_GetOptionKeyPath = FALSE;
+static HRESULT WINAPI DocHostUIHandler_GetOptionKeyPath(IDocHostUIHandler2 *iface,
+        LPOLESTR *pchKey, DWORD dw)
+{
+    ok(expect_GetOptionKeyPath, "unexpected call\n");
+    ok(pchKey != NULL, "pchKey = NULL\n");
+    ok(!dw, "dw=%ld, expected 0\n", dw);
+    if(pchKey)
+        ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
+    called_GetOptionKeyPath = TRUE;
+    return S_OK;
+}
+
+static HRESULT WINAPI DocHostUIHandler_GetDropTarget(IDocHostUIHandler2 *iface,
+        IDropTarget *pDropTarget, IDropTarget **ppDropTarget)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DocHostUIHandler_GetExternal(IDocHostUIHandler2 *iface, IDispatch **ppDispatch)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DocHostUIHandler_TranslateUrl(IDocHostUIHandler2 *iface, DWORD dwTranslate,
+        OLECHAR *pchURLIn, OLECHAR **ppchURLOut)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DocHostUIHandler_FilterDataObject(IDocHostUIHandler2 *iface, IDataObject *pDO,
+        IDataObject **ppPORet)
+{
+    ok(0, "unexpected call\n");
+    return E_NOTIMPL;
+}
+
+static BOOL expect_GetOverrideKeyPath = FALSE, called_GetOverrideKeyPath = FALSE;
+static HRESULT WINAPI DocHostUIHandler_GetOverrideKeyPath(IDocHostUIHandler2 *iface,
+        LPOLESTR *pchKey, DWORD dw)
+{
+    ok(expect_GetOverrideKeyPath, "unexpected call\n");
+    ok(pchKey != NULL, "pchKey = NULL\n");
+    if(pchKey)
+        ok(!*pchKey, "*pchKey=%p, expected NULL\n", *pchKey);
+    ok(!dw, "dw=%ld, xepected 0\n", dw);
+    called_GetOverrideKeyPath = TRUE;
+    return S_OK;
+}
+
+static const IDocHostUIHandler2Vtbl DocHostUIHandlerVtbl = {
+    DocHostUIHandler_QueryInterface,
+    DocHostUIHandler_AddRef,
+    DocHostUIHandler_Release,
+    DocHostUIHandler_ShowContextMenu,
+    DocHostUIHandler_GetHostInfo,
+    DocHostUIHandler_ShowUI,
+    DocHostUIHandler_HideUI,
+    DocHostUIHandler_UpdateUI,
+    DocHostUIHandler_EnableModeless,
+    DocHostUIHandler_OnDocWindowActivate,
+    DocHostUIHandler_OnFrameWindowActivate,
+    DocHostUIHandler_ResizeBorder,
+    DocHostUIHandler_TranslateAccelerator,
+    DocHostUIHandler_GetOptionKeyPath,
+    DocHostUIHandler_GetDropTarget,
+    DocHostUIHandler_GetExternal,
+    DocHostUIHandler_TranslateUrl,
+    DocHostUIHandler_FilterDataObject,
+    DocHostUIHandler_GetOverrideKeyPath
+};
+
+static IDocHostUIHandler2 DocHostUIHandler = { &DocHostUIHandlerVtbl };
+
+static HRESULT QueryInterface(REFIID riid, void **ppv)
+{
+    *ppv = NULL;
+
+    if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IOleClientSite, riid))
+        *ppv = &ClientSite;
+    else if(IsEqualGUID(&IID_IOleDocumentSite, riid))
+        *ppv = &DocumentSite;
+    else if(IsEqualGUID(&IID_IDocHostUIHandler, riid) || IsEqualGUID(&IID_IDocHostUIHandler2, riid))
+        *ppv = &DocHostUIHandler;
+
+    /* TODO:
+     * IDispatch
+     * IServiceProvider
+     * IOleCommandTarget
+     * IOleWindow
+     * {D48A6EC6-6A4A-11CF-94A7-444553540000}
+     * {7BB0B520-B1A7-11D2-BB23-00C04F79ABCD}
+     * {000670BA-0000-0000-C000-000000000046}
+     */
+
+    if(*ppv)
+        return S_OK;
+    return E_NOINTERFACE;
+}
 
 static void test_Persist(IUnknown *punk)
 {
@@ -63,6 +361,7 @@ static void test_Persist(IUnknown *punk)
 static void test_OleObj(IUnknown *punk)
 {
     IOleObject *oleobj;
+    IOleClientSite *clientsite = (LPVOID)0xdeadbeef;
     HRESULT hres;
     GUID guid;
 
@@ -75,6 +374,26 @@ static void test_OleObj(IUnknown *punk)
         hres = IOleObject_GetUserClassID(oleobj, &guid);
         ok(hres == S_OK, "GetUserClassID failed: %08lx\n", hres);
         ok(IsEqualGUID(&guid, &CLSID_HTMLDocument), "guid != CLSID_HTMLDocument\n");
+
+        hres = IOleObject_GetClientSite(oleobj, &clientsite);
+        ok(hres == S_OK, "GetClientSite failed: %08lx\n", hres);
+        ok(clientsite == NULL, "GetClientSite() = %p, expected NULL\n", clientsite);
+
+        expect_GetHostInfo = TRUE;
+        expect_GetOptionKeyPath = TRUE;
+        expect_GetOverrideKeyPath = TRUE;
+        hres = IOleObject_SetClientSite(oleobj, &ClientSite);
+        ok(hres == S_OK, "SetClientSite failed: %08lx\n", hres);
+        ok(called_GetHostInfo, "expected GetHostInfo\n");
+        ok(called_GetOptionKeyPath, "expected GetOptionKeyPath\n");
+        ok(called_GetOverrideKeyPath, "expected GetOverrideKeyPath\n");
+        expect_GetHostInfo = called_GetHostInfo = FALSE;
+        expect_GetOptionKeyPath = called_GetOptionKeyPath = FALSE;
+        expect_GetOverrideKeyPath = called_GetOverrideKeyPath = FALSE;
+
+        hres = IOleObject_GetClientSite(oleobj, &clientsite);
+        ok(hres == S_OK, "GetClientSite failed: %08lx\n", hres);
+        ok(clientsite == &ClientSite, "GetClientSite() = %p, expected %p\n", clientsite, &ClientSite);
 
         IOleObject_Release(oleobj);
     }
Index: dlls/mshtml/oleobj.c
===================================================================
RCS file: /home/wine/wine/dlls/mshtml/oleobj.c,v
retrieving revision 1.6
diff -u -p -r1.6 oleobj.c
--- dlls/mshtml/oleobj.c	28 Jun 2005 10:53:42 -0000	1.6
+++ dlls/mshtml/oleobj.c	1 Jul 2005 18:32:57 -0000
@@ -30,6 +30,9 @@
 #include "docobj.h"
 
 #include "mshtml.h"
+#include "mshtmhst.h"
+
+#include "mshtml.h"
 
 #include "wine/debug.h"
 
@@ -41,36 +44,73 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
  * IOleObject implementation
  */
 
-#define OLEOBJ_THIS \
-    HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpOleObjectVtbl));
+#define OLEOBJ_THIS(iface)  (HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpOleObjectVtbl))
 
 static HRESULT WINAPI OleObject_QueryInterface(IOleObject *iface, REFIID riid, void **ppvObject)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
     return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
 }
 
 static ULONG WINAPI OleObject_AddRef(IOleObject *iface)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
     return IHTMLDocument2_AddRef(HTMLDOC(This));
 }
 
 static ULONG WINAPI OleObject_Release(IOleObject *iface)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
     return IHTMLDocument2_Release(HTMLDOC(This));
 }
 
 static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite *pClientSite)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
+    IDocHostUIHandler *pDocHostUIHandler;
+    HRESULT hres;
+
     TRACE("(%p)->(%p)\n", This, pClientSite);
 
     if(This->client)
         IOleClientSite_Release(This->client);
-    if(pClientSite)
-        IOleClientSite_AddRef(pClientSite);
+
+    if(!pClientSite) {
+        This->client = NULL;
+        return S_OK;
+    }
+
+    hres = IOleObject_QueryInterface(pClientSite, &IID_IDocHostUIHandler, (void**)&pDocHostUIHandler);
+    if(SUCCEEDED(hres)) {
+        DOCHOSTUIINFO hostinfo;
+        LPOLESTR key_path, override_key_path = NULL;
+        IDocHostUIHandler2 *pDocHostUIHandler2;
+
+        memset(&hostinfo, 0, sizeof(DOCHOSTUIINFO));
+        hostinfo.cbSize = sizeof(DOCHOSTUIINFO);
+        hres = IDocHostUIHandler_GetHostInfo(pDocHostUIHandler, &hostinfo);
+        if(SUCCEEDED(hres))
+            /* FIXME: use hostinfo */
+            TRACE("hostinfo = {%lu %08lx %08lx %s %s}\n",
+                    hostinfo.cbSize, hostinfo.dwFlags, hostinfo.dwDoubleClick,
+                    debugstr_w(hostinfo.pchHostCss), debugstr_w(hostinfo.pchHostNS));
+
+        hres = IDocHostUIHandler_GetOptionKeyPath(pDocHostUIHandler, &key_path, 0);
+        if(hres == S_OK && key_path && key_path[0])
+            /* FIXME: use key_path */
+            TRACE("key_path = %s\n", debugstr_w(key_path));
+
+        hres = IDocHostUIHandler_QueryInterface(pDocHostUIHandler, &IID_IDocHostUIHandler2,
+                (void**)&pDocHostUIHandler2);
+        if(SUCCEEDED(hres)) {
+            /*FIXME: use override_key_path */
+            hres = IDocHostUIHandler2_GetOverrideKeyPath(pDocHostUIHandler2, &override_key_path, 0);
+            if(hres == S_OK && override_key_path && override_key_path[0])
+                FIXME("override_key_path = %s\n", debugstr_w(override_key_path));
+        }
+    }
+
+    IOleClientSite_AddRef(pClientSite);
     This->client = pClientSite;
 
     return S_OK;
@@ -78,7 +118,8 @@ static HRESULT WINAPI OleObject_SetClien
 
 static HRESULT WINAPI OleObject_GetClientSite(IOleObject *iface, IOleClientSite **ppClientSite)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
+
     TRACE("(%p)->(%p)\n", This, ppClientSite);
 
     if(!ppClientSite)
@@ -93,28 +134,28 @@ static HRESULT WINAPI OleObject_GetClien
 
 static HRESULT WINAPI OleObject_SetHostNames(IOleObject *iface, LPCOLESTR szContainerApp, LPCOLESTR szContainerObj)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
     FIXME("(%p)->(%s %s)\n", This, debugstr_w(szContainerApp), debugstr_w(szContainerObj));
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
     FIXME("(%p)->(%08lx)\n", This, dwSaveOption);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD dwWhichMoniker, IMoniker *pmk)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
     FIXME("(%p %ld %p)->()\n", This, dwWhichMoniker, pmk);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI OleObject_GetMoniker(IOleObject *iface, DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
     FIXME("(%p)->(%ld %ld %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
     return E_NOTIMPL;
 }
@@ -122,14 +163,14 @@ static HRESULT WINAPI OleObject_GetMonik
 static HRESULT WINAPI OleObject_InitFromData(IOleObject *iface, IDataObject *pDataObject, BOOL fCreation,
                                         DWORD dwReserved)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
     FIXME("(%p)->(%p %x %ld)\n", This, pDataObject, fCreation, dwReserved);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI OleObject_GetClipboardData(IOleObject *iface, DWORD dwReserved, IDataObject **ppDataObject)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
     FIXME("(%p)->(%ld %p)\n", This, dwReserved, ppDataObject);
     return E_NOTIMPL;
 }
@@ -137,7 +178,7 @@ static HRESULT WINAPI OleObject_GetClipb
 static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite,
                                         LONG lindex, HWND hwndParent, LPCRECT lprcPosRect)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
     IOleDocumentSite *pDocSite;
     HRESULT hres;
 
@@ -179,28 +220,29 @@ static HRESULT WINAPI OleObject_DoVerb(I
 
 static HRESULT WINAPI OleObject_EnumVerbs(IOleObject *iface, IEnumOLEVERB **ppEnumOleVerb)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
     FIXME("(%p)->(%p)\n", This, ppEnumOleVerb);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI OleObject_Update(IOleObject *iface)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
     FIXME("(%p)\n", This);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI OleObject_IsUpToDate(IOleObject *iface)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
     FIXME("(%p)\n", This);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI OleObject_GetUserClassID(IOleObject *iface, CLSID *pClsid)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
+
     TRACE("(%p)->(%p)\n", This, pClsid);
 
     if(!pClsid)
@@ -212,60 +254,62 @@ static HRESULT WINAPI OleObject_GetUserC
 
 static HRESULT WINAPI OleObject_GetUserType(IOleObject *iface, DWORD dwFormOfType, LPOLESTR *pszUserType)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
     FIXME("(%p)->(%ld %p)\n", This, dwFormOfType, pszUserType);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI OleObject_SetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
     FIXME("(%p)->(%ld %p)\n", This, dwDrawAspect, psizel);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
     FIXME("(%p)->(%ld %p)\n", This, dwDrawAspect, psizel);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *pAdvSink, DWORD *pdwConnection)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
     FIXME("(%p)->(%p %p)\n", This, pAdvSink, pdwConnection);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI OleObject_Unadvise(IOleObject *iface, DWORD dwConnection)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
     FIXME("(%p)->(%ld)\n", This, dwConnection);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI OleObject_EnumAdvise(IOleObject *iface, IEnumSTATDATA **ppenumAdvise)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
     FIXME("(%p)->(%p)\n", This, ppenumAdvise);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI OleObject_GetMiscStatus(IOleObject *iface, DWORD dwAspect, DWORD *pdwStatus)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
     FIXME("(%p)->(%ld %p)\n", This, dwAspect, pdwStatus);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI OleObject_SetColorScheme(IOleObject *iface, LOGPALETTE *pLogpal)
 {
-    OLEOBJ_THIS
+    HTMLDocument *This = OLEOBJ_THIS(iface);
     FIXME("(%p)->(%p)\n", This, pLogpal);
     return E_NOTIMPL;
 }
 
+#undef OLEPBJ_THIS
+
 static const IOleObjectVtbl OleObjectVtbl = {
     OleObject_QueryInterface,
     OleObject_AddRef,
@@ -297,31 +341,30 @@ static const IOleObjectVtbl OleObjectVtb
  * IOleDocument implementation
  */
 
-#define OLEDOC_THIS \
-    HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpOleDocumentVtbl));
+#define OLEDOC_THIS(iface)  (HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpOleDocumentVtbl));
 
 static HRESULT WINAPI OleDocument_QueryInterface(IOleDocument *iface, REFIID riid, void **ppvObject)
 {
-    OLEDOC_THIS
+    HTMLDocument *This = OLEDOC_THIS(iface);
     return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
 }
 
 static ULONG WINAPI OleDocument_AddRef(IOleDocument *iface)
 {
-    OLEDOC_THIS
+    HTMLDocument *This = OLEDOC_THIS(iface);
     return IHTMLDocument2_AddRef(HTMLDOC(This));
 }
 
 static ULONG WINAPI OleDocument_Release(IOleDocument *iface)
 {
-    OLEDOC_THIS
+    HTMLDocument *This = OLEDOC_THIS(iface);
     return IHTMLDocument2_Release(HTMLDOC(This));
 }
 
 static HRESULT WINAPI OleDocument_CreateView(IOleDocument *iface, IOleInPlaceSite *pIPSite, IStream *pstm,
                                    DWORD dwReserved, IOleDocumentView **ppView)
 {
-    OLEDOC_THIS
+    HTMLDocument *This = OLEDOC_THIS(iface);
     HRESULT hres;
 
     TRACE("(%p)->(%p %p %ld %p)\n", This, pIPSite, pstm, dwReserved, ppView);
@@ -352,7 +395,7 @@ static HRESULT WINAPI OleDocument_Create
 
 static HRESULT WINAPI OleDocument_GetDocMiscStatus(IOleDocument *iface, DWORD *pdwStatus)
 {
-    OLEDOC_THIS
+    HTMLDocument *This = OLEDOC_THIS(iface);
     FIXME("(%p)->(%p)\n", This, pdwStatus);
     return E_NOTIMPL;
 }
@@ -360,10 +403,12 @@ static HRESULT WINAPI OleDocument_GetDoc
 static HRESULT WINAPI OleDocument_EnumViews(IOleDocument *iface, IEnumOleDocumentViews **ppEnum,
                                    IOleDocumentView **ppView)
 {
-    OLEDOC_THIS
+    HTMLDocument *This = OLEDOC_THIS(iface);
     FIXME("(%p)->(%p %p)\n", This, ppEnum, ppView);
     return E_NOTIMPL;
 }
+
+#undef OLEDOC_THIS
 
 static const IOleDocumentVtbl OleDocumentVtbl = {
     OleDocument_QueryInterface,


More information about the wine-patches mailing list