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
30 #include "taskschd_private.h"
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(taskschd
);
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
);
62 FIXME("interface %s is not implemented\n", debugstr_guid(riid
));
66 static ULONG WINAPI
factory_AddRef(IClassFactory
*iface
)
71 static ULONG WINAPI
factory_Release(IClassFactory
*iface
)
76 static HRESULT WINAPI
factory_CreateInstance(IClassFactory
*iface
, IUnknown
*outer
, REFIID riid
, void **obj
)
78 TaskScheduler_factory
*factory
= impl_from_IClassFactory(iface
);
82 if (!riid
|| !obj
) return E_INVALIDARG
;
84 TRACE("%p,%s,%p\n", outer
, debugstr_guid(riid
), obj
);
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
);
98 static HRESULT WINAPI
factory_LockServer(IClassFactory
*iface
, BOOL lock
)
100 FIXME("%p,%d: stub\n", iface
, lock
);
104 static const struct IClassFactoryVtbl factory_vtbl
=
106 factory_QueryInterface
,
109 factory_CreateInstance
,
113 static TaskScheduler_factory TaskScheduler_cf
= { { &factory_vtbl
}, TaskService_create
};
115 /***********************************************************************
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
);
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
;