1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
|
/*
* 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 "corerror.h"
#include "mstask_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(mstask);
typedef struct
{
ITaskScheduler ITaskScheduler_iface;
LONG ref;
} TaskSchedulerImpl;
static inline TaskSchedulerImpl *impl_from_ITaskScheduler(ITaskScheduler *iface)
{
return CONTAINING_RECORD(iface, TaskSchedulerImpl, ITaskScheduler_iface);
}
static void TaskSchedulerDestructor(TaskSchedulerImpl *This)
{
TRACE("%p\n", This);
HeapFree(GetProcessHeap(), 0, This);
InterlockedDecrement(&dll_ref);
}
static HRESULT WINAPI MSTASK_ITaskScheduler_QueryInterface(
ITaskScheduler* iface,
REFIID riid,
void **ppvObject)
{
TaskSchedulerImpl * This = impl_from_ITaskScheduler(iface);
TRACE("IID: %s\n", debugstr_guid(riid));
if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_ITaskScheduler))
{
*ppvObject = &This->ITaskScheduler_iface;
ITaskScheduler_AddRef(iface);
return S_OK;
}
*ppvObject = NULL;
return E_NOINTERFACE;
}
static ULONG WINAPI MSTASK_ITaskScheduler_AddRef(
ITaskScheduler* iface)
{
TaskSchedulerImpl *This = impl_from_ITaskScheduler(iface);
TRACE("\n");
return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI MSTASK_ITaskScheduler_Release(
ITaskScheduler* iface)
{
TaskSchedulerImpl * This = impl_from_ITaskScheduler(iface);
ULONG ref;
TRACE("\n");
ref = InterlockedDecrement(&This->ref);
if (ref == 0)
TaskSchedulerDestructor(This);
return ref;
}
static HRESULT WINAPI MSTASK_ITaskScheduler_SetTargetComputer(
ITaskScheduler* iface,
LPCWSTR pwszComputer)
{
FIXME("%p, %s: stub\n", iface, debugstr_w(pwszComputer));
return E_NOTIMPL;
}
static HRESULT WINAPI MSTASK_ITaskScheduler_GetTargetComputer(
ITaskScheduler* iface,
LPWSTR *ppwszComputer)
{
FIXME("%p, %p: stub\n", iface, ppwszComputer);
return E_NOTIMPL;
}
static HRESULT WINAPI MSTASK_ITaskScheduler_Enum(
ITaskScheduler* iface,
IEnumWorkItems **ppEnumTasks)
{
FIXME("%p, %p: stub\n", iface, ppEnumTasks);
return E_NOTIMPL;
}
static HRESULT WINAPI MSTASK_ITaskScheduler_Activate(
ITaskScheduler* iface,
LPCWSTR pwszName,
REFIID riid,
IUnknown **ppunk)
{
TRACE("%p, %s, %s, %p: stub\n", iface, debugstr_w(pwszName),
debugstr_guid(riid), ppunk);
FIXME("Partial stub always returning COR_E_FILENOTFOUND\n");
return COR_E_FILENOTFOUND;
}
static HRESULT WINAPI MSTASK_ITaskScheduler_Delete(
ITaskScheduler* iface,
LPCWSTR pwszName)
{
FIXME("%p, %s: stub\n", iface, debugstr_w(pwszName));
return E_NOTIMPL;
}
static HRESULT WINAPI MSTASK_ITaskScheduler_NewWorkItem(
ITaskScheduler* iface,
LPCWSTR pwszTaskName,
REFCLSID rclsid,
REFIID riid,
IUnknown **ppunk)
{
HRESULT hr;
TRACE("(%p, %s, %s, %s, %p)\n", iface, debugstr_w(pwszTaskName),
debugstr_guid(rclsid) ,debugstr_guid(riid), ppunk);
if (!IsEqualGUID(rclsid, &CLSID_CTask))
return CLASS_E_CLASSNOTAVAILABLE;
if (!IsEqualGUID(riid, &IID_ITask))
return E_NOINTERFACE;
hr = TaskConstructor(pwszTaskName, (LPVOID *)ppunk);
return hr;
}
static HRESULT WINAPI MSTASK_ITaskScheduler_AddWorkItem(
ITaskScheduler* iface,
LPCWSTR pwszTaskName,
IScheduledWorkItem *pWorkItem)
{
FIXME("%p, %s, %p: stub\n", iface, debugstr_w(pwszTaskName), pWorkItem);
return E_NOTIMPL;
}
static HRESULT WINAPI MSTASK_ITaskScheduler_IsOfType(
ITaskScheduler* iface,
LPCWSTR pwszName,
REFIID riid)
{
FIXME("%p, %s, %s: stub\n", iface, debugstr_w(pwszName),
debugstr_guid(riid));
return E_NOTIMPL;
}
static const ITaskSchedulerVtbl MSTASK_ITaskSchedulerVtbl =
{
MSTASK_ITaskScheduler_QueryInterface,
MSTASK_ITaskScheduler_AddRef,
MSTASK_ITaskScheduler_Release,
MSTASK_ITaskScheduler_SetTargetComputer,
MSTASK_ITaskScheduler_GetTargetComputer,
MSTASK_ITaskScheduler_Enum,
MSTASK_ITaskScheduler_Activate,
MSTASK_ITaskScheduler_Delete,
MSTASK_ITaskScheduler_NewWorkItem,
MSTASK_ITaskScheduler_AddWorkItem,
MSTASK_ITaskScheduler_IsOfType
};
HRESULT TaskSchedulerConstructor(LPVOID *ppObj)
{
TaskSchedulerImpl *This;
TRACE("(%p)\n", ppObj);
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
if (!This)
return E_OUTOFMEMORY;
This->ITaskScheduler_iface.lpVtbl = &MSTASK_ITaskSchedulerVtbl;
This->ref = 1;
*ppObj = &This->ITaskScheduler_iface;
InterlockedIncrement(&dll_ref);
return S_OK;
}
|