Module: wine Branch: master Commit: 9c131bb05691cf4fbbe76c4657099b13670478e1 URL: http://source.winehq.org/git/wine.git/?a=commit;h=9c131bb05691cf4fbbe76c4657...
Author: Roy Shea royshea@gmail.com Date: Wed Aug 20 18:28:30 2008 -0700
mstask: TaskTrigger stub with AddRef, QueryInterface, and Release.
---
dlls/mstask/Makefile.in | 5 +- dlls/mstask/mstask_private.h | 7 +++ dlls/mstask/task_trigger.c | 122 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+), 2 deletions(-)
diff --git a/dlls/mstask/Makefile.in b/dlls/mstask/Makefile.in index 6c1f824..9fb78ee 100644 --- a/dlls/mstask/Makefile.in +++ b/dlls/mstask/Makefile.in @@ -6,10 +6,11 @@ MODULE = mstask.dll IMPORTS = uuid kernel32
C_SRCS = \ - task.c \ factory.c \ mstask_main.c \ - task_scheduler.c + task.c \ + task_scheduler.c \ + task_trigger.c
RC_SRCS = rsrc.rc
diff --git a/dlls/mstask/mstask_private.h b/dlls/mstask/mstask_private.h index a532bdd..e5de0dc 100644 --- a/dlls/mstask/mstask_private.h +++ b/dlls/mstask/mstask_private.h @@ -40,6 +40,13 @@ extern ClassFactoryImpl MSTASK_ClassFactory;
typedef struct { + const ITaskTriggerVtbl *lpVtbl; + LONG ref; +} TaskTriggerImpl; +extern HRESULT TaskTriggerConstructor(LPVOID *ppObj); + +typedef struct +{ const ITaskSchedulerVtbl *lpVtbl; LONG ref; } TaskSchedulerImpl; diff --git a/dlls/mstask/task_trigger.c b/dlls/mstask/task_trigger.c new file mode 100644 index 0000000..25ea3ec --- /dev/null +++ b/dlls/mstask/task_trigger.c @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2008 Google (Roy Shea) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "mstask_private.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mstask); + +static HRESULT WINAPI MSTASK_ITaskTrigger_QueryInterface( + ITaskTrigger* iface, + REFIID riid, + void **ppvObject) +{ + TaskTriggerImpl *This = (TaskTriggerImpl *)iface; + + TRACE("IID: %s\n", debugstr_guid(riid)); + if (ppvObject == NULL) + return E_POINTER; + + if (IsEqualGUID(riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_ITaskTrigger)) + { + *ppvObject = &This->lpVtbl; + ITaskTrigger_AddRef(iface); + return S_OK; + } + + WARN("Unknown interface: %s\n", debugstr_guid(riid)); + *ppvObject = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI MSTASK_ITaskTrigger_AddRef( + ITaskTrigger* iface) +{ + TaskTriggerImpl *This = (TaskTriggerImpl *)iface; + ULONG ref; + TRACE("\n"); + ref = InterlockedIncrement(&This->ref); + return ref; +} + +static ULONG WINAPI MSTASK_ITaskTrigger_Release( + ITaskTrigger* iface) +{ + TaskTriggerImpl *This = (TaskTriggerImpl *)iface; + ULONG ref; + TRACE("\n"); + ref = InterlockedDecrement(&This->ref); + if (ref == 0) + { + HeapFree(GetProcessHeap(), 0, This); + InterlockedDecrement(&dll_ref); + } + return ref; +} + +static HRESULT WINAPI MSTASK_ITaskTrigger_SetTrigger( + ITaskTrigger* iface, + const PTASK_TRIGGER pTrigger) +{ + FIXME("Not implemented\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITaskTrigger_GetTrigger( + ITaskTrigger* iface, + PTASK_TRIGGER pTrigger) +{ + FIXME("Not implemented\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MSTASK_ITaskTrigger_GetTriggerString( + ITaskTrigger* iface, + LPWSTR *ppwszTrigger) +{ + FIXME("Not implemented\n"); + return E_NOTIMPL; +} + +static const ITaskTriggerVtbl MSTASK_ITaskTriggerVtbl = +{ + MSTASK_ITaskTrigger_QueryInterface, + MSTASK_ITaskTrigger_AddRef, + MSTASK_ITaskTrigger_Release, + MSTASK_ITaskTrigger_SetTrigger, + MSTASK_ITaskTrigger_GetTrigger, + MSTASK_ITaskTrigger_GetTriggerString +}; + +HRESULT TaskTriggerConstructor(LPVOID *ppObj) +{ + TaskTriggerImpl *This; + TRACE("(%p)\n", ppObj); + + This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); + if (!This) + return E_OUTOFMEMORY; + + This->lpVtbl = &MSTASK_ITaskTriggerVtbl; + This->ref = 1; + + *ppObj = &This->lpVtbl; + InterlockedIncrement(&dll_ref); + return S_OK; +}