2 * Copyright (C) 2008 Google (Roy Shea)
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "mstask_private.h"
21 #include "wine/debug.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(mstask
);
27 ITaskScheduler ITaskScheduler_iface
;
31 static inline TaskSchedulerImpl
*impl_from_ITaskScheduler(ITaskScheduler
*iface
)
33 return CONTAINING_RECORD(iface
, TaskSchedulerImpl
, ITaskScheduler_iface
);
36 static void TaskSchedulerDestructor(TaskSchedulerImpl
*This
)
39 HeapFree(GetProcessHeap(), 0, This
);
40 InterlockedDecrement(&dll_ref
);
43 static HRESULT WINAPI
MSTASK_ITaskScheduler_QueryInterface(
44 ITaskScheduler
* iface
,
48 TaskSchedulerImpl
* This
= impl_from_ITaskScheduler(iface
);
50 TRACE("IID: %s\n", debugstr_guid(riid
));
52 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
53 IsEqualGUID(riid
, &IID_ITaskScheduler
))
55 *ppvObject
= &This
->ITaskScheduler_iface
;
56 ITaskScheduler_AddRef(iface
);
64 static ULONG WINAPI
MSTASK_ITaskScheduler_AddRef(
65 ITaskScheduler
* iface
)
67 TaskSchedulerImpl
*This
= impl_from_ITaskScheduler(iface
);
69 return InterlockedIncrement(&This
->ref
);
72 static ULONG WINAPI
MSTASK_ITaskScheduler_Release(
73 ITaskScheduler
* iface
)
75 TaskSchedulerImpl
* This
= impl_from_ITaskScheduler(iface
);
78 ref
= InterlockedDecrement(&This
->ref
);
80 TaskSchedulerDestructor(This
);
84 static HRESULT WINAPI
MSTASK_ITaskScheduler_SetTargetComputer(
85 ITaskScheduler
* iface
,
88 FIXME("%p, %s: stub\n", iface
, debugstr_w(pwszComputer
));
92 static HRESULT WINAPI
MSTASK_ITaskScheduler_GetTargetComputer(
93 ITaskScheduler
* iface
,
94 LPWSTR
*ppwszComputer
)
96 FIXME("%p, %p: stub\n", iface
, ppwszComputer
);
100 static HRESULT WINAPI
MSTASK_ITaskScheduler_Enum(
101 ITaskScheduler
* iface
,
102 IEnumWorkItems
**ppEnumTasks
)
104 FIXME("%p, %p: stub\n", iface
, ppEnumTasks
);
108 static HRESULT WINAPI
MSTASK_ITaskScheduler_Activate(
109 ITaskScheduler
* iface
,
114 TRACE("%p, %s, %s, %p: stub\n", iface
, debugstr_w(pwszName
),
115 debugstr_guid(riid
), ppunk
);
116 FIXME("Partial stub always returning COR_E_FILENOTFOUND\n");
117 return COR_E_FILENOTFOUND
;
120 static HRESULT WINAPI
MSTASK_ITaskScheduler_Delete(
121 ITaskScheduler
* iface
,
124 FIXME("%p, %s: stub\n", iface
, debugstr_w(pwszName
));
128 static HRESULT WINAPI
MSTASK_ITaskScheduler_NewWorkItem(
129 ITaskScheduler
* iface
,
130 LPCWSTR pwszTaskName
,
136 TRACE("(%p, %s, %s, %s, %p)\n", iface
, debugstr_w(pwszTaskName
),
137 debugstr_guid(rclsid
) ,debugstr_guid(riid
), ppunk
);
139 if (!IsEqualGUID(rclsid
, &CLSID_CTask
))
140 return CLASS_E_CLASSNOTAVAILABLE
;
142 if (!IsEqualGUID(riid
, &IID_ITask
))
143 return E_NOINTERFACE
;
145 hr
= TaskConstructor(pwszTaskName
, (LPVOID
*)ppunk
);
149 static HRESULT WINAPI
MSTASK_ITaskScheduler_AddWorkItem(
150 ITaskScheduler
* iface
,
151 LPCWSTR pwszTaskName
,
152 IScheduledWorkItem
*pWorkItem
)
154 FIXME("%p, %s, %p: stub\n", iface
, debugstr_w(pwszTaskName
), pWorkItem
);
158 static HRESULT WINAPI
MSTASK_ITaskScheduler_IsOfType(
159 ITaskScheduler
* iface
,
163 FIXME("%p, %s, %s: stub\n", iface
, debugstr_w(pwszName
),
164 debugstr_guid(riid
));
168 static const ITaskSchedulerVtbl MSTASK_ITaskSchedulerVtbl
=
170 MSTASK_ITaskScheduler_QueryInterface
,
171 MSTASK_ITaskScheduler_AddRef
,
172 MSTASK_ITaskScheduler_Release
,
173 MSTASK_ITaskScheduler_SetTargetComputer
,
174 MSTASK_ITaskScheduler_GetTargetComputer
,
175 MSTASK_ITaskScheduler_Enum
,
176 MSTASK_ITaskScheduler_Activate
,
177 MSTASK_ITaskScheduler_Delete
,
178 MSTASK_ITaskScheduler_NewWorkItem
,
179 MSTASK_ITaskScheduler_AddWorkItem
,
180 MSTASK_ITaskScheduler_IsOfType
183 HRESULT
TaskSchedulerConstructor(LPVOID
*ppObj
)
185 TaskSchedulerImpl
*This
;
186 TRACE("(%p)\n", ppObj
);
188 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(*This
));
190 return E_OUTOFMEMORY
;
192 This
->ITaskScheduler_iface
.lpVtbl
= &MSTASK_ITaskSchedulerVtbl
;
195 *ppObj
= &This
->ITaskScheduler_iface
;
196 InterlockedIncrement(&dll_ref
);