mstask: Task PersistFile AddRef, QueryInterface, and Release.

This commit is contained in:
Roy Shea 2008-08-21 08:54:01 -07:00 committed by Alexandre Julliard
parent 2841755c16
commit aec0eb87de
1 changed files with 26 additions and 6 deletions

View File

@ -21,6 +21,11 @@
WINE_DEFAULT_DEBUG_CHANNEL(mstask); 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) static void TaskDestructor(TaskImpl *This)
{ {
TRACE("%p\n", This); TRACE("%p\n", This);
@ -47,6 +52,12 @@ static HRESULT WINAPI MSTASK_ITask_QueryInterface(
ITask_AddRef(iface); ITask_AddRef(iface);
return S_OK; 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)); WARN("Unknown interface: %s\n", debugstr_guid(riid));
*ppvObject = NULL; *ppvObject = NULL;
@ -473,22 +484,31 @@ static HRESULT WINAPI MSTASK_IPersistFile_QueryInterface(
REFIID riid, REFIID riid,
void **ppvObject) void **ppvObject)
{ {
FIXME("(%p, %s, %p): stub\n", iface, debugstr_guid(riid), ppvObject); TaskImpl *This = impl_from_IPersistFile(iface);
return E_NOTIMPL; TRACE("(%p, %s, %p)\n", iface, debugstr_guid(riid), ppvObject);
return ITask_QueryInterface((ITask *) This, riid, ppvObject);
} }
static ULONG WINAPI MSTASK_IPersistFile_AddRef( static ULONG WINAPI MSTASK_IPersistFile_AddRef(
IPersistFile* iface) IPersistFile* iface)
{ {
FIXME("(%p): stub\n", iface); TaskImpl *This = impl_from_IPersistFile(iface);
return E_NOTIMPL; ULONG ref;
TRACE("\n");
ref = InterlockedIncrement(&This->ref);
return ref;
} }
static ULONG WINAPI MSTASK_IPersistFile_Release( static ULONG WINAPI MSTASK_IPersistFile_Release(
IPersistFile* iface) IPersistFile* iface)
{ {
FIXME("(%p): stub\n", iface); TaskImpl *This = impl_from_IPersistFile(iface);
return E_NOTIMPL; ULONG ref;
TRACE("\n");
ref = InterlockedDecrement(&This->ref);
if (ref == 0)
TaskDestructor(This);
return ref;
} }
static HRESULT WINAPI MSTASK_IPersistFile_GetClassID( static HRESULT WINAPI MSTASK_IPersistFile_GetClassID(