[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: howto fix bug 13462
From:       "Louis. Lenders" <xerox_xerox2000 () yahoo ! co ! uk>
Date:       2008-09-29 21:07:18
Message-ID: 727272.30964.qm () web23203 ! mail ! ird ! yahoo ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]







Rob Shearman <robertshearman <at> gmail.com> writes:

Hi Rob, i think i got the test ready now, i'll send it when the defenitions are
in place in ctxtcall.idl. Now still strugling how to fix the bug.

 I fixed up the patch below, also by looking how things are done in similar
places in wine-code. With patch applied I can see that
ContextCallback_ContextCallback and ContextCallback_Release are called from the
application (tested with NASA WorldWind), and the simple stubs are enough to let
the app continue fine. But i'm not sure if everything is 100% ok. Is this what
you more or less meant in your first comment?

diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index 37907ec..a1f41fd 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -55,6 +55,7 @@
 #include "objbase.h"
 #include "ole2.h"
 #include "ole2ver.h"
+#include "ctxtcall.h"
 
 #include "compobj_private.h"
 
@@ -3615,25 +3616,39 @@ HRESULT WINAPI CoRegisterChannelHook(REFGUID guidExtension, \
IChannelHook *pChann  typedef struct Context
 {
     const IComThreadingInfoVtbl *lpVtbl;
+    const IContextCallback *lpVtblIContextCallback;
     LONG refs;
     APTTYPE apttype;
 } Context;
 
+static inline Context *impl_from_Context(IComThreadingInfo *iface)
+{
+    return (Context *)((char*)iface - FIELD_OFFSET(Context, lpVtbl));
+}
+
 static HRESULT WINAPI Context_QueryInterface(IComThreadingInfo *iface, REFIID riid, \
LPVOID *ppv)  {
+    Context* This=impl_from_Context((IComThreadingInfo*) iface);
     *ppv = NULL;
 
     if (IsEqualIID(riid, &IID_IComThreadingInfo) ||
         IsEqualIID(riid, &IID_IUnknown))
     {
         *ppv = iface;
-        IUnknown_AddRef(iface);
-        return S_OK;
     }
+    else if(IsEqualIID(riid, &IID_IContextCallback))
+        {
+        *ppv = &This->lpVtblIContextCallback;
+        }
+    else
+        {
+        FIXME("interface not implemented %s\n", debugstr_guid(riid));
+        return E_NOINTERFACE;
+        }
 
-    FIXME("interface not implemented %s\n", debugstr_guid(riid));
-    return E_NOINTERFACE;
-}
+    IUnknown_AddRef(iface);
+    return S_OK;
+}    
 
 static ULONG WINAPI Context_AddRef(IComThreadingInfo *iface)
 {
@@ -3691,6 +3706,31 @@ static HRESULT WINAPI \
Context_SetCurrentLogicalThreadId(IComThreadingInfo *iface  return E_NOTIMPL;
 }
 
+
+static HRESULT WINAPI  ContextCallback_QueryInterface(IContextCallback *iface, \
REFIID riid, LPVOID *ppv) +{
+    FIXME("\n");
+    return E_NOTIMPL;
+}
+
+static ULONG WINAPI  ContextCallback_AddRef(IContextCallback *iface)
+{
+    FIXME("\n");
+    return E_NOTIMPL;
+}
+
+static ULONG WINAPI ContextCallback_Release(IContextCallback *iface)
+{
+    FIXME("\n");
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ContextCallback_ContextCallback(IContextCallback *iface, \
PFNCONTEXTCALL pfnCallback, ComCallData* pParam, REFIID riid, int iMethod, IUnknown* \
pUnk) +{
+    FIXME("not implemented yet\n");
+    return E_NOTIMPL;
+}
+
 static const IComThreadingInfoVtbl Context_Threading_Vtbl =
 {
     Context_QueryInterface,
@@ -3702,6 +3742,14 @@ static const IComThreadingInfoVtbl Context_Threading_Vtbl =
     Context_SetCurrentLogicalThreadId
 };
 
+static const IContextCallbackVtbl Context_Callback_Vtbl =
+{
+    ContextCallback_QueryInterface,
+    ContextCallback_AddRef,
+    ContextCallback_Release,
+    ContextCallback_ContextCallback
+};
+
 /***********************************************************************
  *           CoGetObjectContext [OLE32.@]
  *
@@ -3735,6 +3783,7 @@ HRESULT WINAPI CoGetObjectContext(REFIID riid, void **ppv)
         return E_OUTOFMEMORY;
 
     context->lpVtbl = &Context_Threading_Vtbl;
+    context->lpVtblIContextCallback=(IContextCallback*)&Context_Callback_Vtbl;
     context->refs = 1;
     if (apt->multi_threaded)
         context->apttype = APTTYPE_MTA;



      


[Attachment #5 (text/html)]

<html><head><style type="text/css"><!-- DIV {margin:0px;} \
--></style></head><body><div style="font-family:times new roman, new york, times, \
serif;font-size:12pt"><br><div style="font-family: times new roman,new \
york,times,serif; font-size: 12pt;"><div style="font-family: times new roman,new \
york,times,serif; font-size: 12pt;"><br><br><div style="font-family: times new \
roman,new york,times,serif; font-size: 12pt;"><div>Rob Shearman &lt;robertshearman \
&lt;at&gt; gmail.com&gt; writes:<br><br>Hi Rob, i think i got the test ready now, \
i'll send it when the defenitions are<br>in place in ctxtcall.idl. Now still \
strugling how to fix the bug.<br><br>&nbsp;I fixed up the patch below, also by \
looking how things are done in similar<br>places in wine-code. With patch applied I \
can see that<br>ContextCallback_ContextCallback and ContextCallback_Release are \
called from the<br>application (tested with NASA WorldWind), and the simple stubs are \
enough to let<br>the app  continue fine. But i'm not sure if everything is 100% ok. \
Is this what<br>you more or less meant in your first comment?<br><br>diff --git \
a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c<br>index 37907ec..a1f41fd 100644<br>--- \
a/dlls/ole32/compobj.c<br>+++ b/dlls/ole32/compobj.c<br>@@ -55,6 +55,7 \
@@<br>&nbsp;#include "objbase.h"<br>&nbsp;#include "ole2.h"<br>&nbsp;#include \
"ole2ver.h"<br>+#include "ctxtcall.h"<br>&nbsp;<br>&nbsp;#include \
"compobj_private.h"<br>&nbsp;<br>@@ -3615,25 +3616,39 @@ HRESULT WINAPI \
CoRegisterChannelHook(REFGUID guidExtension, IChannelHook *pChann<br>&nbsp;typedef \
struct Context<br>&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp; const IComThreadingInfoVtbl \
*lpVtbl;<br>+&nbsp;&nbsp;&nbsp; const IContextCallback \
*lpVtblIContextCallback;<br>&nbsp;&nbsp;&nbsp;&nbsp; LONG \
refs;<br>&nbsp;&nbsp;&nbsp;&nbsp; APTTYPE apttype;<br>&nbsp;} \
                Context;<br>&nbsp;<br>+static inline Context \
                *impl_from_Context(IComThreadingInfo
 *iface)<br>+{<br>+&nbsp;&nbsp;&nbsp; return (Context *)((char*)iface - \
FIELD_OFFSET(Context, lpVtbl));<br>+}<br>+<br>&nbsp;static HRESULT WINAPI \
Context_QueryInterface(IComThreadingInfo *iface, REFIID riid, LPVOID \
*ppv)<br>&nbsp;{<br>+&nbsp;&nbsp;&nbsp; Context* \
This=impl_from_Context((IComThreadingInfo*) iface);<br>&nbsp;&nbsp;&nbsp;&nbsp; *ppv \
= NULL;<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp; if (IsEqualIID(riid, \
&amp;IID_IComThreadingInfo) ||<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
IsEqualIID(riid, &amp;IID_IUnknown))<br>&nbsp;&nbsp;&nbsp;&nbsp; \
{<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *ppv = \
iface;<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
IUnknown_AddRef(iface);<br>-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return \
S_OK;<br>&nbsp;&nbsp;&nbsp;&nbsp; }<br>+&nbsp;&nbsp;&nbsp; else if(IsEqualIID(riid, \
&amp;IID_IContextCallback))<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
                {<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 *ppv = &amp;This-&gt;lpVtblIContextCallback;<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
}<br>+&nbsp;&nbsp;&nbsp; else<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
{<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FIXME("interface not implemented \
%s\n", debugstr_guid(riid));<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return \
E_NOINTERFACE;<br>+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
}<br>&nbsp;<br>-&nbsp;&nbsp;&nbsp; FIXME("interface not implemented %s\n", \
debugstr_guid(riid));<br>-&nbsp;&nbsp;&nbsp; return \
E_NOINTERFACE;<br>-}<br>+&nbsp;&nbsp;&nbsp; \
IUnknown_AddRef(iface);<br>+&nbsp;&nbsp;&nbsp; return S_OK;<br>+}&nbsp;&nbsp; \
&nbsp;<br>&nbsp;<br>&nbsp;static ULONG WINAPI Context_AddRef(IComThreadingInfo \
*iface)<br>&nbsp;{<br>@@ -3691,6 +3706,31 @@ static HRESULT WINAPI \
Context_SetCurrentLogicalThreadId(IComThreadingInfo \
*iface<br>&nbsp;&nbsp;&nbsp;&nbsp; return \
E_NOTIMPL;<br>&nbsp;}<br>&nbsp;<br>+<br>+static HRESULT WINAPI&nbsp;  \
ContextCallback_QueryInterface(IContextCallback *iface, REFIID riid, LPVOID \
*ppv)<br>+{<br>+&nbsp;&nbsp;&nbsp; FIXME("\n");<br>+&nbsp;&nbsp;&nbsp; return \
E_NOTIMPL;<br>+}<br>+<br>+static ULONG WINAPI&nbsp; \
ContextCallback_AddRef(IContextCallback *iface)<br>+{<br>+&nbsp;&nbsp;&nbsp; \
FIXME("\n");<br>+&nbsp;&nbsp;&nbsp; return E_NOTIMPL;<br>+}<br>+<br>+static ULONG \
WINAPI ContextCallback_Release(IContextCallback *iface)<br>+{<br>+&nbsp;&nbsp;&nbsp; \
FIXME("\n");<br>+&nbsp;&nbsp;&nbsp; return E_NOTIMPL;<br>+}<br>+<br>+static HRESULT \
WINAPI ContextCallback_ContextCallback(IContextCallback *iface, PFNCONTEXTCALL \
pfnCallback, ComCallData* pParam, REFIID riid, int iMethod, IUnknown* \
pUnk)<br>+{<br>+&nbsp;&nbsp;&nbsp; FIXME("not implemented \
yet\n");<br>+&nbsp;&nbsp;&nbsp; return E_NOTIMPL;<br>+}<br>+<br>&nbsp;static const \
IComThreadingInfoVtbl Context_Threading_Vtbl =<br>&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp; \
Context_QueryInterface,<br>@@ -3702,6 +3742,14 @@ static  const IComThreadingInfoVtbl \
Context_Threading_Vtbl =<br>&nbsp;&nbsp;&nbsp;&nbsp; \
Context_SetCurrentLogicalThreadId<br>&nbsp;};<br>&nbsp;<br>+static const \
IContextCallbackVtbl Context_Callback_Vtbl =<br>+{<br>+&nbsp;&nbsp;&nbsp; \
ContextCallback_QueryInterface,<br>+&nbsp;&nbsp;&nbsp; \
ContextCallback_AddRef,<br>+&nbsp;&nbsp;&nbsp; \
ContextCallback_Release,<br>+&nbsp;&nbsp;&nbsp; \
ContextCallback_ContextCallback<br>+};<br>+<br>&nbsp;/***********************************************************************<br>&nbsp; \
*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CoGetObjectContext \
[OLE32.@]<br>&nbsp; *<br>@@ -3735,6 +3783,7 @@ HRESULT WINAPI \
CoGetObjectContext(REFIID riid, void \
**ppv)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return \
E_OUTOFMEMORY;<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp; context-&gt;lpVtbl = \
&amp;Context_Threading_Vtbl;<br>+&nbsp;&nbsp;&nbsp;  \
context-&gt;lpVtblIContextCallback=(IContextCallback*)&amp;Context_Callback_Vtbl;<br>&nbsp;&nbsp;&nbsp;&nbsp; \
context-&gt;refs = 1;<br>&nbsp;&nbsp;&nbsp;&nbsp; if \
(apt-&gt;multi_threaded)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
context-&gt;apttype = APTTYPE_MTA;</div></div><br>




      </div></div></div><br>



      </body></html>





[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic