Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygentask_scheduler.c
Go to the documentation of this file.
00001 /* 00002 * Copyright (C) 2008 Google (Roy Shea) 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00017 */ 00018 00019 #include "corerror.h" 00020 #include "mstask_private.h" 00021 #include "wine/debug.h" 00022 00023 WINE_DEFAULT_DEBUG_CHANNEL(mstask); 00024 00025 typedef struct 00026 { 00027 ITaskScheduler ITaskScheduler_iface; 00028 LONG ref; 00029 } TaskSchedulerImpl; 00030 00031 static inline TaskSchedulerImpl *impl_from_ITaskScheduler(ITaskScheduler *iface) 00032 { 00033 return CONTAINING_RECORD(iface, TaskSchedulerImpl, ITaskScheduler_iface); 00034 } 00035 00036 static void TaskSchedulerDestructor(TaskSchedulerImpl *This) 00037 { 00038 TRACE("%p\n", This); 00039 HeapFree(GetProcessHeap(), 0, This); 00040 InterlockedDecrement(&dll_ref); 00041 } 00042 00043 static HRESULT WINAPI MSTASK_ITaskScheduler_QueryInterface( 00044 ITaskScheduler* iface, 00045 REFIID riid, 00046 void **ppvObject) 00047 { 00048 TaskSchedulerImpl * This = impl_from_ITaskScheduler(iface); 00049 00050 TRACE("IID: %s\n", debugstr_guid(riid)); 00051 00052 if (IsEqualGUID(riid, &IID_IUnknown) || 00053 IsEqualGUID(riid, &IID_ITaskScheduler)) 00054 { 00055 *ppvObject = &This->ITaskScheduler_iface; 00056 ITaskScheduler_AddRef(iface); 00057 return S_OK; 00058 } 00059 00060 *ppvObject = NULL; 00061 return E_NOINTERFACE; 00062 } 00063 00064 static ULONG WINAPI MSTASK_ITaskScheduler_AddRef( 00065 ITaskScheduler* iface) 00066 { 00067 TaskSchedulerImpl *This = impl_from_ITaskScheduler(iface); 00068 TRACE("\n"); 00069 return InterlockedIncrement(&This->ref); 00070 } 00071 00072 static ULONG WINAPI MSTASK_ITaskScheduler_Release( 00073 ITaskScheduler* iface) 00074 { 00075 TaskSchedulerImpl * This = impl_from_ITaskScheduler(iface); 00076 ULONG ref; 00077 TRACE("\n"); 00078 ref = InterlockedDecrement(&This->ref); 00079 if (ref == 0) 00080 TaskSchedulerDestructor(This); 00081 return ref; 00082 } 00083 00084 static HRESULT WINAPI MSTASK_ITaskScheduler_SetTargetComputer( 00085 ITaskScheduler* iface, 00086 LPCWSTR pwszComputer) 00087 { 00088 FIXME("%p, %s: stub\n", iface, debugstr_w(pwszComputer)); 00089 return E_NOTIMPL; 00090 } 00091 00092 static HRESULT WINAPI MSTASK_ITaskScheduler_GetTargetComputer( 00093 ITaskScheduler* iface, 00094 LPWSTR *ppwszComputer) 00095 { 00096 FIXME("%p, %p: stub\n", iface, ppwszComputer); 00097 return E_NOTIMPL; 00098 } 00099 00100 static HRESULT WINAPI MSTASK_ITaskScheduler_Enum( 00101 ITaskScheduler* iface, 00102 IEnumWorkItems **ppEnumTasks) 00103 { 00104 FIXME("%p, %p: stub\n", iface, ppEnumTasks); 00105 return E_NOTIMPL; 00106 } 00107 00108 static HRESULT WINAPI MSTASK_ITaskScheduler_Activate( 00109 ITaskScheduler* iface, 00110 LPCWSTR pwszName, 00111 REFIID riid, 00112 IUnknown **ppunk) 00113 { 00114 TRACE("%p, %s, %s, %p: stub\n", iface, debugstr_w(pwszName), 00115 debugstr_guid(riid), ppunk); 00116 FIXME("Partial stub always returning COR_E_FILENOTFOUND\n"); 00117 return COR_E_FILENOTFOUND; 00118 } 00119 00120 static HRESULT WINAPI MSTASK_ITaskScheduler_Delete( 00121 ITaskScheduler* iface, 00122 LPCWSTR pwszName) 00123 { 00124 FIXME("%p, %s: stub\n", iface, debugstr_w(pwszName)); 00125 return E_NOTIMPL; 00126 } 00127 00128 static HRESULT WINAPI MSTASK_ITaskScheduler_NewWorkItem( 00129 ITaskScheduler* iface, 00130 LPCWSTR pwszTaskName, 00131 REFCLSID rclsid, 00132 REFIID riid, 00133 IUnknown **ppunk) 00134 { 00135 HRESULT hr; 00136 TRACE("(%p, %s, %s, %s, %p)\n", iface, debugstr_w(pwszTaskName), 00137 debugstr_guid(rclsid) ,debugstr_guid(riid), ppunk); 00138 00139 if (!IsEqualGUID(rclsid, &CLSID_CTask)) 00140 return CLASS_E_CLASSNOTAVAILABLE; 00141 00142 if (!IsEqualGUID(riid, &IID_ITask)) 00143 return E_NOINTERFACE; 00144 00145 hr = TaskConstructor(pwszTaskName, (LPVOID *)ppunk); 00146 return hr; 00147 } 00148 00149 static HRESULT WINAPI MSTASK_ITaskScheduler_AddWorkItem( 00150 ITaskScheduler* iface, 00151 LPCWSTR pwszTaskName, 00152 IScheduledWorkItem *pWorkItem) 00153 { 00154 FIXME("%p, %s, %p: stub\n", iface, debugstr_w(pwszTaskName), pWorkItem); 00155 return E_NOTIMPL; 00156 } 00157 00158 static HRESULT WINAPI MSTASK_ITaskScheduler_IsOfType( 00159 ITaskScheduler* iface, 00160 LPCWSTR pwszName, 00161 REFIID riid) 00162 { 00163 FIXME("%p, %s, %s: stub\n", iface, debugstr_w(pwszName), 00164 debugstr_guid(riid)); 00165 return E_NOTIMPL; 00166 } 00167 00168 static const ITaskSchedulerVtbl MSTASK_ITaskSchedulerVtbl = 00169 { 00170 MSTASK_ITaskScheduler_QueryInterface, 00171 MSTASK_ITaskScheduler_AddRef, 00172 MSTASK_ITaskScheduler_Release, 00173 MSTASK_ITaskScheduler_SetTargetComputer, 00174 MSTASK_ITaskScheduler_GetTargetComputer, 00175 MSTASK_ITaskScheduler_Enum, 00176 MSTASK_ITaskScheduler_Activate, 00177 MSTASK_ITaskScheduler_Delete, 00178 MSTASK_ITaskScheduler_NewWorkItem, 00179 MSTASK_ITaskScheduler_AddWorkItem, 00180 MSTASK_ITaskScheduler_IsOfType 00181 }; 00182 00183 HRESULT TaskSchedulerConstructor(LPVOID *ppObj) 00184 { 00185 TaskSchedulerImpl *This; 00186 TRACE("(%p)\n", ppObj); 00187 00188 This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); 00189 if (!This) 00190 return E_OUTOFMEMORY; 00191 00192 This->ITaskScheduler_iface.lpVtbl = &MSTASK_ITaskSchedulerVtbl; 00193 This->ref = 1; 00194 00195 *ppObj = &This->ITaskScheduler_iface; 00196 InterlockedIncrement(&dll_ref); 00197 return S_OK; 00198 } Generated on Sat May 26 2012 04:23:53 for ReactOS by
1.7.6.1
|