Roy Shea : mstask: Task PersistFile AddRef, QueryInterface, and Release.

Alexandre Julliard julliard at winehq.org
Fri Aug 22 04:43:58 CDT 2008


Module: wine
Branch: master
Commit: aec0eb87de7d71ab4d3160f3b2b0fb1250937243
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=aec0eb87de7d71ab4d3160f3b2b0fb1250937243

Author: Roy Shea <royshea at gmail.com>
Date:   Thu Aug 21 08:54:01 2008 -0700

mstask: Task PersistFile AddRef, QueryInterface, and Release.

---

 dlls/mstask/task.c |   32 ++++++++++++++++++++++++++------
 1 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/dlls/mstask/task.c b/dlls/mstask/task.c
index f1f5426..5cef29f 100644
--- a/dlls/mstask/task.c
+++ b/dlls/mstask/task.c
@@ -21,6 +21,11 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(mstask);
 
+static inline TaskImpl *impl_from_IPersistFile( IPersistFile *iface )
+{
+    return (TaskImpl*) ((char*)(iface) - FIELD_OFFSET(TaskImpl, persistVtbl));
+}
+
 static void TaskDestructor(TaskImpl *This)
 {
     TRACE("%p\n", This);
@@ -47,6 +52,12 @@ static HRESULT WINAPI MSTASK_ITask_QueryInterface(
         ITask_AddRef(iface);
         return S_OK;
     }
+    else if (IsEqualGUID(riid, &IID_IPersistFile))
+    {
+        *ppvObject = &This->persistVtbl;
+        ITask_AddRef(iface);
+        return S_OK;
+    }
 
     WARN("Unknown interface: %s\n", debugstr_guid(riid));
     *ppvObject = NULL;
@@ -473,22 +484,31 @@ static HRESULT WINAPI MSTASK_IPersistFile_QueryInterface(
         REFIID riid,
         void **ppvObject)
 {
-    FIXME("(%p, %s, %p): stub\n", iface, debugstr_guid(riid), ppvObject);
-    return E_NOTIMPL;
+    TaskImpl *This = impl_from_IPersistFile(iface);
+    TRACE("(%p, %s, %p)\n", iface, debugstr_guid(riid), ppvObject);
+    return ITask_QueryInterface((ITask *) This, riid, ppvObject);
 }
 
 static ULONG WINAPI MSTASK_IPersistFile_AddRef(
         IPersistFile* iface)
 {
-    FIXME("(%p): stub\n", iface);
-    return E_NOTIMPL;
+    TaskImpl *This = impl_from_IPersistFile(iface);
+    ULONG ref;
+    TRACE("\n");
+    ref = InterlockedIncrement(&This->ref);
+    return ref;
 }
 
 static ULONG WINAPI MSTASK_IPersistFile_Release(
         IPersistFile* iface)
 {
-    FIXME("(%p): stub\n", iface);
-    return E_NOTIMPL;
+    TaskImpl *This = impl_from_IPersistFile(iface);
+    ULONG ref;
+    TRACE("\n");
+    ref = InterlockedDecrement(&This->ref);
+    if (ref == 0)
+        TaskDestructor(This);
+    return ref;
 }
 
 static HRESULT WINAPI MSTASK_IPersistFile_GetClassID(




More information about the wine-cvs mailing list