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
);
25 static void TaskSchedulerDestructor(TaskSchedulerImpl
*This
)
28 HeapFree(GetProcessHeap(), 0, This
);
29 InterlockedDecrement(&dll_ref
);
32 static HRESULT WINAPI
MSTASK_ITaskScheduler_QueryInterface(
33 ITaskScheduler
* iface
,
37 TaskSchedulerImpl
* This
= (TaskSchedulerImpl
*)iface
;
39 TRACE("IID: %s\n", debugstr_guid(riid
));
41 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
42 IsEqualGUID(riid
, &IID_ITaskScheduler
))
44 *ppvObject
= &This
->lpVtbl
;
45 ITaskScheduler_AddRef(iface
);
53 static ULONG WINAPI
MSTASK_ITaskScheduler_AddRef(
54 ITaskScheduler
* iface
)
56 TaskSchedulerImpl
*This
= (TaskSchedulerImpl
*)iface
;
58 return InterlockedIncrement(&This
->ref
);
61 static ULONG WINAPI
MSTASK_ITaskScheduler_Release(
62 ITaskScheduler
* iface
)
64 TaskSchedulerImpl
* This
= (TaskSchedulerImpl
*)iface
;
67 ref
= InterlockedDecrement(&This
->ref
);
69 TaskSchedulerDestructor(This
);
73 static HRESULT WINAPI
MSTASK_ITaskScheduler_SetTargetComputer(
74 ITaskScheduler
* iface
,
77 FIXME("%p, %s: stub\n", iface
, debugstr_w(pwszComputer
));
81 static HRESULT WINAPI
MSTASK_ITaskScheduler_GetTargetComputer(
82 ITaskScheduler
* iface
,
83 LPWSTR
*ppwszComputer
)
85 FIXME("%p, %p: stub\n", iface
, ppwszComputer
);
89 static HRESULT WINAPI
MSTASK_ITaskScheduler_Enum(
90 ITaskScheduler
* iface
,
91 IEnumWorkItems
**ppEnumTasks
)
93 FIXME("%p, %p: stub\n", iface
, ppEnumTasks
);
97 static HRESULT WINAPI
MSTASK_ITaskScheduler_Activate(
98 ITaskScheduler
* iface
,
103 TRACE("%p, %s, %s, %p: stub\n", iface
, debugstr_w(pwszName
),
104 debugstr_guid(riid
), ppunk
);
105 FIXME("Partial stub always returning COR_E_FILENOTFOUND\n");
106 return COR_E_FILENOTFOUND
;
109 static HRESULT WINAPI
MSTASK_ITaskScheduler_Delete(
110 ITaskScheduler
* iface
,
113 FIXME("%p, %s: stub\n", iface
, debugstr_w(pwszName
));
117 static HRESULT WINAPI
MSTASK_ITaskScheduler_NewWorkItem(
118 ITaskScheduler
* iface
,
119 LPCWSTR pwszTaskName
,
125 TRACE("(%p, %s, %s, %s, %p)\n", iface
, debugstr_w(pwszTaskName
),
126 debugstr_guid(rclsid
) ,debugstr_guid(riid
), ppunk
);
128 if (!IsEqualGUID(rclsid
, &CLSID_CTask
))
129 return CLASS_E_CLASSNOTAVAILABLE
;
131 if (!IsEqualGUID(riid
, &IID_ITask
))
132 return E_NOINTERFACE
;
134 hr
= TaskConstructor(pwszTaskName
, (LPVOID
*)ppunk
);
138 static HRESULT WINAPI
MSTASK_ITaskScheduler_AddWorkItem(
139 ITaskScheduler
* iface
,
140 LPCWSTR pwszTaskName
,
141 IScheduledWorkItem
*pWorkItem
)
143 FIXME("%p, %s, %p: stub\n", iface
, debugstr_w(pwszTaskName
), pWorkItem
);
147 static HRESULT WINAPI
MSTASK_ITaskScheduler_IsOfType(
148 ITaskScheduler
* iface
,
152 FIXME("%p, %s, %s: stub\n", iface
, debugstr_w(pwszName
),
153 debugstr_guid(riid
));
157 static const ITaskSchedulerVtbl MSTASK_ITaskSchedulerVtbl
=
159 MSTASK_ITaskScheduler_QueryInterface
,
160 MSTASK_ITaskScheduler_AddRef
,
161 MSTASK_ITaskScheduler_Release
,
162 MSTASK_ITaskScheduler_SetTargetComputer
,
163 MSTASK_ITaskScheduler_GetTargetComputer
,
164 MSTASK_ITaskScheduler_Enum
,
165 MSTASK_ITaskScheduler_Activate
,
166 MSTASK_ITaskScheduler_Delete
,
167 MSTASK_ITaskScheduler_NewWorkItem
,
168 MSTASK_ITaskScheduler_AddWorkItem
,
169 MSTASK_ITaskScheduler_IsOfType
172 HRESULT
TaskSchedulerConstructor(LPVOID
*ppObj
)
174 TaskSchedulerImpl
*This
;
175 TRACE("(%p)\n", ppObj
);
177 This
= HeapAlloc(GetProcessHeap(), 0, sizeof(*This
));
179 return E_OUTOFMEMORY
;
181 This
->lpVtbl
= &MSTASK_ITaskSchedulerVtbl
;
184 *ppObj
= &This
->lpVtbl
;
185 InterlockedIncrement(&dll_ref
);