winemac.drv: Don't filter non active displays out.
[wine/zf.git] / dlls / taskschd / taskschd.c
blob42cd7711fa4b699e99530e4fdcf44d3e483deeed
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 static HINSTANCE schd_instance;
38 typedef struct
40 IClassFactory IClassFactory_iface;
41 HRESULT (*constructor)(void **);
42 } TaskScheduler_factory;
44 static inline TaskScheduler_factory *impl_from_IClassFactory(IClassFactory *iface)
46 return CONTAINING_RECORD(iface, TaskScheduler_factory, IClassFactory_iface);
49 static HRESULT WINAPI factory_QueryInterface(IClassFactory *iface, REFIID riid, LPVOID *obj)
51 if (!riid || !obj) return E_INVALIDARG;
53 TRACE("%p,%s,%p\n", iface, debugstr_guid(riid), obj);
55 if (IsEqualIID(riid, &IID_IUnknown) ||
56 IsEqualIID(riid, &IID_IClassFactory))
58 IClassFactory_AddRef(iface);
59 *obj = iface;
60 return S_OK;
63 *obj = NULL;
64 FIXME("interface %s is not implemented\n", debugstr_guid(riid));
65 return E_NOINTERFACE;
68 static ULONG WINAPI factory_AddRef(IClassFactory *iface)
70 return 2;
73 static ULONG WINAPI factory_Release(IClassFactory *iface)
75 return 1;
78 static HRESULT WINAPI factory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj)
80 TaskScheduler_factory *factory = impl_from_IClassFactory(iface);
81 IUnknown *unknown;
82 HRESULT hr;
84 if (!riid || !obj) return E_INVALIDARG;
86 TRACE("%p,%s,%p\n", outer, debugstr_guid(riid), obj);
88 *obj = NULL;
89 if (outer) return CLASS_E_NOAGGREGATION;
91 hr = factory->constructor((void **)&unknown);
92 if (hr != S_OK) return hr;
94 hr = IUnknown_QueryInterface(unknown, riid, obj);
95 IUnknown_Release(unknown);
97 return hr;
100 static HRESULT WINAPI factory_LockServer(IClassFactory *iface, BOOL lock)
102 FIXME("%p,%d: stub\n", iface, lock);
103 return S_OK;
106 static const struct IClassFactoryVtbl factory_vtbl =
108 factory_QueryInterface,
109 factory_AddRef,
110 factory_Release,
111 factory_CreateInstance,
112 factory_LockServer
115 static TaskScheduler_factory TaskScheduler_cf = { { &factory_vtbl }, TaskService_create };
117 /******************************************************************
118 * DllMain
120 BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved)
122 switch (reason)
124 case DLL_PROCESS_ATTACH:
125 schd_instance = hinst;
126 DisableThreadLibraryCalls(hinst);
127 break;
129 return TRUE;
132 /***********************************************************************
133 * DllGetClassObject
135 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *obj)
137 IClassFactory *factory = NULL;
139 if (!rclsid || !riid || !obj) return E_INVALIDARG;
141 TRACE("%s,%s,%p\n", debugstr_guid(rclsid), debugstr_guid(riid), obj);
143 *obj = NULL;
145 if (IsEqualGUID(rclsid, &CLSID_TaskScheduler))
147 factory = &TaskScheduler_cf.IClassFactory_iface;
150 if (factory) return IClassFactory_QueryInterface(factory, riid, obj);
152 FIXME("class %s/%s is not implemented\n", debugstr_guid(rclsid), debugstr_guid(riid));
153 return CLASS_E_CLASSNOTAVAILABLE;
156 /***********************************************************************
157 * DllCanUnloadNow
159 HRESULT WINAPI DllCanUnloadNow(void)
161 return S_FALSE;
164 /***********************************************************************
165 * DllRegisterServer
167 HRESULT WINAPI DllRegisterServer(void)
169 return __wine_register_resources(schd_instance);
172 /***********************************************************************
173 * DllUnregisterServer
175 HRESULT WINAPI DllUnregisterServer(void)
177 return __wine_unregister_resources(schd_instance);