windowscodecs: Add support for VT_LPWSTR property ids to MetadataHandler_GetValue.
[wine/multimedia.git] / dlls / mstask / task_scheduler.c
blob1d2ac219cf81f3d5bbda3fee9f24f46aad8d9afb
1 /*
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 "corerror.h"
20 #include "mstask_private.h"
21 #include "wine/debug.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(mstask);
25 typedef struct
27 ITaskScheduler ITaskScheduler_iface;
28 LONG ref;
29 } TaskSchedulerImpl;
31 static inline TaskSchedulerImpl *impl_from_ITaskScheduler(ITaskScheduler *iface)
33 return CONTAINING_RECORD(iface, TaskSchedulerImpl, ITaskScheduler_iface);
36 static void TaskSchedulerDestructor(TaskSchedulerImpl *This)
38 TRACE("%p\n", This);
39 HeapFree(GetProcessHeap(), 0, This);
40 InterlockedDecrement(&dll_ref);
43 static HRESULT WINAPI MSTASK_ITaskScheduler_QueryInterface(
44 ITaskScheduler* iface,
45 REFIID riid,
46 void **ppvObject)
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);
57 return S_OK;
60 *ppvObject = NULL;
61 return E_NOINTERFACE;
64 static ULONG WINAPI MSTASK_ITaskScheduler_AddRef(
65 ITaskScheduler* iface)
67 TaskSchedulerImpl *This = impl_from_ITaskScheduler(iface);
68 TRACE("\n");
69 return InterlockedIncrement(&This->ref);
72 static ULONG WINAPI MSTASK_ITaskScheduler_Release(
73 ITaskScheduler* iface)
75 TaskSchedulerImpl * This = impl_from_ITaskScheduler(iface);
76 ULONG ref;
77 TRACE("\n");
78 ref = InterlockedDecrement(&This->ref);
79 if (ref == 0)
80 TaskSchedulerDestructor(This);
81 return ref;
84 static HRESULT WINAPI MSTASK_ITaskScheduler_SetTargetComputer(
85 ITaskScheduler* iface,
86 LPCWSTR pwszComputer)
88 FIXME("%p, %s: stub\n", iface, debugstr_w(pwszComputer));
89 return E_NOTIMPL;
92 static HRESULT WINAPI MSTASK_ITaskScheduler_GetTargetComputer(
93 ITaskScheduler* iface,
94 LPWSTR *ppwszComputer)
96 FIXME("%p, %p: stub\n", iface, ppwszComputer);
97 return E_NOTIMPL;
100 static HRESULT WINAPI MSTASK_ITaskScheduler_Enum(
101 ITaskScheduler* iface,
102 IEnumWorkItems **ppEnumTasks)
104 FIXME("%p, %p: stub\n", iface, ppEnumTasks);
105 return E_NOTIMPL;
108 static HRESULT WINAPI MSTASK_ITaskScheduler_Activate(
109 ITaskScheduler* iface,
110 LPCWSTR pwszName,
111 REFIID riid,
112 IUnknown **ppunk)
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,
122 LPCWSTR pwszName)
124 FIXME("%p, %s: stub\n", iface, debugstr_w(pwszName));
125 return E_NOTIMPL;
128 static HRESULT WINAPI MSTASK_ITaskScheduler_NewWorkItem(
129 ITaskScheduler* iface,
130 LPCWSTR pwszTaskName,
131 REFCLSID rclsid,
132 REFIID riid,
133 IUnknown **ppunk)
135 HRESULT hr;
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);
146 return hr;
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);
155 return E_NOTIMPL;
158 static HRESULT WINAPI MSTASK_ITaskScheduler_IsOfType(
159 ITaskScheduler* iface,
160 LPCWSTR pwszName,
161 REFIID riid)
163 FIXME("%p, %s, %s: stub\n", iface, debugstr_w(pwszName),
164 debugstr_guid(riid));
165 return E_NOTIMPL;
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));
189 if (!This)
190 return E_OUTOFMEMORY;
192 This->ITaskScheduler_iface.lpVtbl = &MSTASK_ITaskSchedulerVtbl;
193 This->ref = 1;
195 *ppObj = &This->ITaskScheduler_iface;
196 InterlockedIncrement(&dll_ref);
197 return S_OK;