user32: Update the Polish translation.
[wine/multimedia.git] / dlls / mstask / task_scheduler.c
blob5efa0869b2e181f2004eea4d073464b51d2b01e3
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 static void TaskSchedulerDestructor(TaskSchedulerImpl *This)
27 TRACE("%p\n", This);
28 HeapFree(GetProcessHeap(), 0, This);
29 InterlockedDecrement(&dll_ref);
32 static HRESULT WINAPI MSTASK_ITaskScheduler_QueryInterface(
33 ITaskScheduler* iface,
34 REFIID riid,
35 void **ppvObject)
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);
46 return S_OK;
49 *ppvObject = NULL;
50 return E_NOINTERFACE;
53 static ULONG WINAPI MSTASK_ITaskScheduler_AddRef(
54 ITaskScheduler* iface)
56 TaskSchedulerImpl *This = (TaskSchedulerImpl *)iface;
57 TRACE("\n");
58 return InterlockedIncrement(&This->ref);
61 static ULONG WINAPI MSTASK_ITaskScheduler_Release(
62 ITaskScheduler* iface)
64 TaskSchedulerImpl * This = (TaskSchedulerImpl *)iface;
65 ULONG ref;
66 TRACE("\n");
67 ref = InterlockedDecrement(&This->ref);
68 if (ref == 0)
69 TaskSchedulerDestructor(This);
70 return ref;
73 static HRESULT WINAPI MSTASK_ITaskScheduler_SetTargetComputer(
74 ITaskScheduler* iface,
75 LPCWSTR pwszComputer)
77 FIXME("%p, %s: stub\n", iface, debugstr_w(pwszComputer));
78 return E_NOTIMPL;
81 static HRESULT WINAPI MSTASK_ITaskScheduler_GetTargetComputer(
82 ITaskScheduler* iface,
83 LPWSTR *ppwszComputer)
85 FIXME("%p, %p: stub\n", iface, ppwszComputer);
86 return E_NOTIMPL;
89 static HRESULT WINAPI MSTASK_ITaskScheduler_Enum(
90 ITaskScheduler* iface,
91 IEnumWorkItems **ppEnumTasks)
93 FIXME("%p, %p: stub\n", iface, ppEnumTasks);
94 return E_NOTIMPL;
97 static HRESULT WINAPI MSTASK_ITaskScheduler_Activate(
98 ITaskScheduler* iface,
99 LPCWSTR pwszName,
100 REFIID riid,
101 IUnknown **ppunk)
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,
111 LPCWSTR pwszName)
113 FIXME("%p, %s: stub\n", iface, debugstr_w(pwszName));
114 return E_NOTIMPL;
117 static HRESULT WINAPI MSTASK_ITaskScheduler_NewWorkItem(
118 ITaskScheduler* iface,
119 LPCWSTR pwszTaskName,
120 REFCLSID rclsid,
121 REFIID riid,
122 IUnknown **ppunk)
124 HRESULT hr;
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);
135 return hr;
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);
144 return E_NOTIMPL;
147 static HRESULT WINAPI MSTASK_ITaskScheduler_IsOfType(
148 ITaskScheduler* iface,
149 LPCWSTR pwszName,
150 REFIID riid)
152 FIXME("%p, %s, %s: stub\n", iface, debugstr_w(pwszName),
153 debugstr_guid(riid));
154 return E_NOTIMPL;
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));
178 if (!This)
179 return E_OUTOFMEMORY;
181 This->lpVtbl = &MSTASK_ITaskSchedulerVtbl;
182 This->ref = 1;
184 *ppObj = &This->lpVtbl;
185 InterlockedIncrement(&dll_ref);
186 return S_OK;