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 #include "mstask_private.h"
20 #include "wine/debug.h"
22 WINE_DEFAULT_DEBUG_CHANNEL(mstask
);
24 static void TaskSchedulerDestructor(TaskSchedulerImpl
*This
)
27 HeapFree(GetProcessHeap(), 0, This
);
28 InterlockedDecrement(&dll_ref
);
31 static HRESULT WINAPI
MSTASK_ITaskScheduler_QueryInterface(
32 ITaskScheduler
* iface
,
36 TaskSchedulerImpl
* This
= (TaskSchedulerImpl
*)iface
;
38 TRACE("IID: %s\n", debugstr_guid(riid
));
40 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
41 IsEqualGUID(riid
, &IID_ITaskScheduler
))
43 *ppvObject
= &This
->lpVtbl
;
44 ITaskScheduler_AddRef(iface
);
52 static ULONG WINAPI
MSTASK_ITaskScheduler_AddRef(
53 ITaskScheduler
* iface
)
55 TaskSchedulerImpl
*This
= (TaskSchedulerImpl
*)iface
;
57 return InterlockedIncrement(&This
->ref
);
60 static ULONG WINAPI
MSTASK_ITaskScheduler_Release(
61 ITaskScheduler
* iface
)
63 TaskSchedulerImpl
* This
= (TaskSchedulerImpl
*)iface
;
66 ref
= InterlockedDecrement(&This
->ref
);
68 TaskSchedulerDestructor(This
);
72 static HRESULT WINAPI
MSTASK_ITaskScheduler_SetTargetComputer(
73 ITaskScheduler
* iface
,
76 FIXME("%p, %s: stub\n", iface
, debugstr_w(pwszComputer
));
80 static HRESULT WINAPI
MSTASK_ITaskScheduler_GetTargetComputer(
81 ITaskScheduler
* iface
,
82 LPWSTR
*ppwszComputer
)
84 FIXME("%p, %p: stub\n", iface
, ppwszComputer
);
88 static HRESULT WINAPI
MSTASK_ITaskScheduler_Enum(
89 ITaskScheduler
* iface
,
90 IEnumWorkItems
**ppEnumTasks
)
92 FIXME("%p, %p: stub\n", iface
, ppEnumTasks
);
96 static HRESULT WINAPI
MSTASK_ITaskScheduler_Activate(
97 ITaskScheduler
* iface
,
102 FIXME("%p, %s, %s, %p: stub\n", iface
, debugstr_w(pwszName
),
103 debugstr_guid(riid
), ppunk
);
107 static HRESULT WINAPI
MSTASK_ITaskScheduler_Delete(
108 ITaskScheduler
* iface
,
111 FIXME("%p, %s: stub\n", iface
, debugstr_w(pwszName
));
115 static HRESULT WINAPI
MSTASK_ITaskScheduler_NewWorkItem(
116 ITaskScheduler
* iface
,
117 LPCWSTR pwszTaskName
,
123 TRACE("(%p, %s, %s, %s, %p)\n", iface
, debugstr_w(pwszTaskName
),
124 debugstr_guid(rclsid
) ,debugstr_guid(riid
), ppunk
);
126 if (!IsEqualGUID(rclsid
, &CLSID_CTask
))
127 return CLASS_E_CLASSNOTAVAILABLE
;
129 if (!IsEqualGUID(riid
, &IID_ITask
))
130 return E_NOINTERFACE
;
132 hr
= TaskConstructor(pwszTaskName
, (LPVOID
*)ppunk
);
136 static HRESULT WINAPI
MSTASK_ITaskScheduler_AddWorkItem(
137 ITaskScheduler
* iface
,
138 LPCWSTR pwszTaskName
,
139 IScheduledWorkItem
*pWorkItem
)
141 FIXME("%p, %s, %p: stub\n", iface
, debugstr_w(pwszTaskName
), pWorkItem
);
145 static HRESULT WINAPI
MSTASK_ITaskScheduler_IsOfType(
146 ITaskScheduler
* iface
,
150 FIXME("%p, %s, %s: stub\n", iface
, debugstr_w(pwszName
),
151 debugstr_guid(riid
));
155 static const ITaskSchedulerVtbl MSTASK_ITaskSchedulerVtbl
=
157 MSTASK_ITaskScheduler_QueryInterface
,
158 MSTASK_ITaskScheduler_AddRef
,
159 MSTASK_ITaskScheduler_Release
,
160 MSTASK_ITaskScheduler_SetTargetComputer
,
161 MSTASK_ITaskScheduler_GetTargetComputer
,
162 MSTASK_ITaskScheduler_Enum
,
163 MSTASK_ITaskScheduler_Activate
,
164 MSTASK_ITaskScheduler_Delete
,
165 MSTASK_ITaskScheduler_NewWorkItem
,
166 MSTASK_ITaskScheduler_AddWorkItem
,
167 MSTASK_ITaskScheduler_IsOfType
170 HRESULT
TaskSchedulerConstructor(LPVOID
*ppObj
)
172 TaskSchedulerImpl
*This
;
173 TRACE("(%p)\n", ppObj
);
175 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(*This
));
177 return E_OUTOFMEMORY
;
179 This
->lpVtbl
= &MSTASK_ITaskSchedulerVtbl
;
182 *ppObj
= &This
->lpVtbl
;
183 InterlockedIncrement(&dll_ref
);