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
19 #define WIN32_NO_STATUS
21 #define COM_NO_WINDOWS_H
24 #include "mstask_private.h"
25 #include <wine/debug.h>
27 WINE_DEFAULT_DEBUG_CHANNEL(mstask
);
31 ITaskScheduler ITaskScheduler_iface
;
35 static inline TaskSchedulerImpl
*impl_from_ITaskScheduler(ITaskScheduler
*iface
)
37 return CONTAINING_RECORD(iface
, TaskSchedulerImpl
, ITaskScheduler_iface
);
40 static void TaskSchedulerDestructor(TaskSchedulerImpl
*This
)
43 HeapFree(GetProcessHeap(), 0, This
);
44 InterlockedDecrement(&dll_ref
);
47 static HRESULT WINAPI
MSTASK_ITaskScheduler_QueryInterface(
48 ITaskScheduler
* iface
,
52 TaskSchedulerImpl
* This
= impl_from_ITaskScheduler(iface
);
54 TRACE("IID: %s\n", debugstr_guid(riid
));
56 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
57 IsEqualGUID(riid
, &IID_ITaskScheduler
))
59 *ppvObject
= &This
->ITaskScheduler_iface
;
60 ITaskScheduler_AddRef(iface
);
68 static ULONG WINAPI
MSTASK_ITaskScheduler_AddRef(
69 ITaskScheduler
* iface
)
71 TaskSchedulerImpl
*This
= impl_from_ITaskScheduler(iface
);
73 return InterlockedIncrement(&This
->ref
);
76 static ULONG WINAPI
MSTASK_ITaskScheduler_Release(
77 ITaskScheduler
* iface
)
79 TaskSchedulerImpl
* This
= impl_from_ITaskScheduler(iface
);
82 ref
= InterlockedDecrement(&This
->ref
);
84 TaskSchedulerDestructor(This
);
88 static HRESULT WINAPI
MSTASK_ITaskScheduler_SetTargetComputer(
89 ITaskScheduler
* iface
,
92 FIXME("%p, %s: stub\n", iface
, debugstr_w(pwszComputer
));
96 static HRESULT WINAPI
MSTASK_ITaskScheduler_GetTargetComputer(
97 ITaskScheduler
* iface
,
98 LPWSTR
*ppwszComputer
)
100 FIXME("%p, %p: stub\n", iface
, ppwszComputer
);
104 static HRESULT WINAPI
MSTASK_ITaskScheduler_Enum(
105 ITaskScheduler
* iface
,
106 IEnumWorkItems
**ppEnumTasks
)
108 FIXME("%p, %p: stub\n", iface
, ppEnumTasks
);
112 static HRESULT WINAPI
MSTASK_ITaskScheduler_Activate(
113 ITaskScheduler
* iface
,
118 TRACE("%p, %s, %s, %p: stub\n", iface
, debugstr_w(pwszName
),
119 debugstr_guid(riid
), ppunk
);
120 FIXME("Partial stub always returning COR_E_FILENOTFOUND\n");
121 return COR_E_FILENOTFOUND
;
124 static HRESULT WINAPI
MSTASK_ITaskScheduler_Delete(
125 ITaskScheduler
* iface
,
128 FIXME("%p, %s: stub\n", iface
, debugstr_w(pwszName
));
132 static HRESULT WINAPI
MSTASK_ITaskScheduler_NewWorkItem(
133 ITaskScheduler
* iface
,
134 LPCWSTR pwszTaskName
,
140 TRACE("(%p, %s, %s, %s, %p)\n", iface
, debugstr_w(pwszTaskName
),
141 debugstr_guid(rclsid
) ,debugstr_guid(riid
), ppunk
);
143 if (!IsEqualGUID(rclsid
, &CLSID_CTask
))
144 return CLASS_E_CLASSNOTAVAILABLE
;
146 if (!IsEqualGUID(riid
, &IID_ITask
))
147 return E_NOINTERFACE
;
149 hr
= TaskConstructor(pwszTaskName
, (LPVOID
*)ppunk
);
153 static HRESULT WINAPI
MSTASK_ITaskScheduler_AddWorkItem(
154 ITaskScheduler
* iface
,
155 LPCWSTR pwszTaskName
,
156 IScheduledWorkItem
*pWorkItem
)
158 FIXME("%p, %s, %p: stub\n", iface
, debugstr_w(pwszTaskName
), pWorkItem
);
162 static HRESULT WINAPI
MSTASK_ITaskScheduler_IsOfType(
163 ITaskScheduler
* iface
,
167 FIXME("%p, %s, %s: stub\n", iface
, debugstr_w(pwszName
),
168 debugstr_guid(riid
));
172 static const ITaskSchedulerVtbl MSTASK_ITaskSchedulerVtbl
=
174 MSTASK_ITaskScheduler_QueryInterface
,
175 MSTASK_ITaskScheduler_AddRef
,
176 MSTASK_ITaskScheduler_Release
,
177 MSTASK_ITaskScheduler_SetTargetComputer
,
178 MSTASK_ITaskScheduler_GetTargetComputer
,
179 MSTASK_ITaskScheduler_Enum
,
180 MSTASK_ITaskScheduler_Activate
,
181 MSTASK_ITaskScheduler_Delete
,
182 MSTASK_ITaskScheduler_NewWorkItem
,
183 MSTASK_ITaskScheduler_AddWorkItem
,
184 MSTASK_ITaskScheduler_IsOfType
187 HRESULT
TaskSchedulerConstructor(LPVOID
*ppObj
)
189 TaskSchedulerImpl
*This
;
190 TRACE("(%p)\n", ppObj
);
192 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(*This
));
194 return E_OUTOFMEMORY
;
196 This
->ITaskScheduler_iface
.lpVtbl
= &MSTASK_ITaskSchedulerVtbl
;
199 *ppObj
= &This
->ITaskScheduler_iface
;
200 InterlockedIncrement(&dll_ref
);