[4/4] taskschd: Add Task Scheduler class factory.
Dmitry Timoshkov
dmitry at baikal.ru
Mon Dec 23 01:38:17 CST 2013
---
dlls/taskschd/taskschd.c | 113 ++++++++++++++++++++++++++++++++++++++++++++
dlls/taskschd/taskschd.spec | 4 +-
2 files changed, 115 insertions(+), 2 deletions(-)
diff --git a/dlls/taskschd/taskschd.c b/dlls/taskschd/taskschd.c
index 33d6993..d77184d 100644
--- a/dlls/taskschd/taskschd.c
+++ b/dlls/taskschd/taskschd.c
@@ -27,6 +27,8 @@
#include "winbase.h"
#include "objbase.h"
#include "rpcproxy.h"
+#include "taskschd.h"
+#include "taskschd_private.h"
#include "wine/debug.h"
@@ -34,6 +36,85 @@ WINE_DEFAULT_DEBUG_CHANNEL(taskschd);
static HINSTANCE schd_instance;
+typedef struct
+{
+ IClassFactory IClassFactory_iface;
+ HRESULT (*constructor)(void **);
+} TaskScheduler_factory;
+
+static inline TaskScheduler_factory *impl_from_IClassFactory(IClassFactory *iface)
+{
+ return CONTAINING_RECORD(iface, TaskScheduler_factory, IClassFactory_iface);
+}
+
+static HRESULT WINAPI factory_QueryInterface(IClassFactory *iface, REFIID riid, LPVOID *obj)
+{
+ if (!riid || !obj) return E_INVALIDARG;
+
+ TRACE("%p,%s,%p\n", iface, debugstr_guid(riid), obj);
+
+ if (IsEqualIID(riid, &IID_IUnknown) ||
+ IsEqualIID(riid, &IID_IClassFactory))
+ {
+ IClassFactory_AddRef(iface);
+ *obj = iface;
+ return S_OK;
+ }
+
+ *obj = NULL;
+ FIXME("interface %s is not implemented\n", debugstr_guid(riid));
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI factory_AddRef(IClassFactory *iface)
+{
+ return 2;
+}
+
+static ULONG WINAPI factory_Release(IClassFactory *iface)
+{
+ return 1;
+}
+
+static HRESULT WINAPI factory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj)
+{
+ TaskScheduler_factory *factory = impl_from_IClassFactory(iface);
+ IUnknown *unknown;
+ HRESULT hr;
+
+ if (!riid || !obj) return E_INVALIDARG;
+
+ TRACE("%p,%s,%p\n", outer, debugstr_guid(riid), obj);
+
+ *obj = NULL;
+ if (outer) return CLASS_E_NOAGGREGATION;
+
+ hr = factory->constructor((void **)&unknown);
+ if (hr != S_OK) return hr;
+
+ hr = IUnknown_QueryInterface(unknown, riid, obj);
+ IUnknown_Release(unknown);
+
+ return hr;
+}
+
+static HRESULT WINAPI factory_LockServer(IClassFactory *iface, BOOL lock)
+{
+ FIXME("%p,%d: stub\n", iface, lock);
+ return S_OK;
+}
+
+static const struct IClassFactoryVtbl factory_vtbl =
+{
+ factory_QueryInterface,
+ factory_AddRef,
+ factory_Release,
+ factory_CreateInstance,
+ factory_LockServer
+};
+
+static TaskScheduler_factory TaskScheduler_cf = { { &factory_vtbl }, TaskService_create };
+
/******************************************************************
* DllMain
*/
@@ -68,6 +149,38 @@ HRESULT WINAPI DllUnregisterServer(void)
return __wine_unregister_resources(schd_instance);
}
+/***********************************************************************
+ * DllGetClassObject
+ */
+HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *obj)
+{
+ IClassFactory *factory = NULL;
+
+ if (!rclsid || !riid || !obj) return E_INVALIDARG;
+
+ TRACE("%s,%s,%p\n", debugstr_guid(rclsid), debugstr_guid(riid), obj);
+
+ *obj = NULL;
+
+ if (IsEqualGUID(rclsid, &CLSID_TaskScheduler))
+ {
+ factory = &TaskScheduler_cf.IClassFactory_iface;
+ }
+
+ if (factory) return IClassFactory_QueryInterface(factory, riid, obj);
+
+ FIXME("class %s/%s is not implemented\n", debugstr_guid(rclsid), debugstr_guid(riid));
+ return CLASS_E_CLASSNOTAVAILABLE;
+}
+
+/***********************************************************************
+ * DllCanUnloadNow
+ */
+HRESULT WINAPI DllCanUnloadNow(void)
+{
+ return S_FALSE;
+}
+
const char *debugstr_variant(const VARIANT *v)
{
if (!v) return "(null)";
diff --git a/dlls/taskschd/taskschd.spec b/dlls/taskschd/taskschd.spec
index d20e3d1..af75eea 100644
--- a/dlls/taskschd/taskschd.spec
+++ b/dlls/taskschd/taskschd.spec
@@ -1,5 +1,5 @@
-@ stub DllCanUnloadNow
-@ stub DllGetClassObject
+@ stdcall -private DllCanUnloadNow()
+@ stdcall -private DllGetClassObject(ptr ptr ptr)
@ stub DllGetVersion
@ stdcall -private DllRegisterServer()
@ stdcall -private DllUnregisterServer()
--
1.8.5.2
More information about the wine-patches
mailing list