ntdll/tests: Adjust test_virtual_unwind() for Win11 results.
[wine.git] / dlls / taskschd / taskschd.c
blob6d47a4ee1e963081da99f8a494ec190323e6b6bf
1 /*
2 * Task Scheduler
4 * Copyright 2013 Dmitry Timoshkov
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
23 #define COBJMACROS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "objbase.h"
28 #include "rpcproxy.h"
29 #include "taskschd.h"
30 #include "taskschd_private.h"
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(taskschd);
36 typedef struct
38 IClassFactory IClassFactory_iface;
39 HRESULT (*constructor)(void **);
40 } TaskScheduler_factory;
42 static inline TaskScheduler_factory *impl_from_IClassFactory(IClassFactory *iface)
44 return CONTAINING_RECORD(iface, TaskScheduler_factory, IClassFactory_iface);
47 static HRESULT WINAPI factory_QueryInterface(IClassFactory *iface, REFIID riid, LPVOID *obj)
49 if (!riid || !obj) return E_INVALIDARG;
51 TRACE("%p,%s,%p\n", iface, debugstr_guid(riid), obj);
53 if (IsEqualIID(riid, &IID_IUnknown) ||
54 IsEqualIID(riid, &IID_IClassFactory))
56 IClassFactory_AddRef(iface);
57 *obj = iface;
58 return S_OK;
61 *obj = NULL;
62 FIXME("interface %s is not implemented\n", debugstr_guid(riid));
63 return E_NOINTERFACE;
66 static ULONG WINAPI factory_AddRef(IClassFactory *iface)
68 return 2;
71 static ULONG WINAPI factory_Release(IClassFactory *iface)
73 return 1;
76 static HRESULT WINAPI factory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj)
78 TaskScheduler_factory *factory = impl_from_IClassFactory(iface);
79 IUnknown *unknown;
80 HRESULT hr;
82 if (!riid || !obj) return E_INVALIDARG;
84 TRACE("%p,%s,%p\n", outer, debugstr_guid(riid), obj);
86 *obj = NULL;
87 if (outer) return CLASS_E_NOAGGREGATION;
89 hr = factory->constructor((void **)&unknown);
90 if (hr != S_OK) return hr;
92 hr = IUnknown_QueryInterface(unknown, riid, obj);
93 IUnknown_Release(unknown);
95 return hr;
98 static HRESULT WINAPI factory_LockServer(IClassFactory *iface, BOOL lock)
100 FIXME("%p,%d: stub\n", iface, lock);
101 return S_OK;
104 static const struct IClassFactoryVtbl factory_vtbl =
106 factory_QueryInterface,
107 factory_AddRef,
108 factory_Release,
109 factory_CreateInstance,
110 factory_LockServer
113 static TaskScheduler_factory TaskScheduler_cf = { { &factory_vtbl }, TaskService_create };
115 /***********************************************************************
116 * DllGetClassObject
118 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *obj)
120 IClassFactory *factory = NULL;
122 if (!rclsid || !riid || !obj) return E_INVALIDARG;
124 TRACE("%s,%s,%p\n", debugstr_guid(rclsid), debugstr_guid(riid), obj);
126 *obj = NULL;
128 if (IsEqualGUID(rclsid, &CLSID_TaskScheduler))
130 factory = &TaskScheduler_cf.IClassFactory_iface;
133 if (factory) return IClassFactory_QueryInterface(factory, riid, obj);
135 FIXME("class %s/%s is not implemented\n", debugstr_guid(rclsid), debugstr_guid(riid));
136 return CLASS_E_CLASSNOTAVAILABLE;