2 * Copyright (C) 2008 Google (Roy Shea)
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "mstask_private.h"
21 struct ClassFactoryImpl
23 IClassFactory IClassFactory_iface
;
27 static inline ClassFactoryImpl
*impl_from_IClassFactory(IClassFactory
*iface
)
29 return CONTAINING_RECORD(iface
, ClassFactoryImpl
, IClassFactory_iface
);
32 static HRESULT WINAPI
MSTASK_IClassFactory_QueryInterface(
37 ClassFactoryImpl
*This
= impl_from_IClassFactory(iface
);
39 TRACE("IID: %s\n",debugstr_guid(riid
));
43 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
44 IsEqualGUID(riid
, &IID_IClassFactory
))
46 *ppvObj
= &This
->IClassFactory_iface
;
47 IClassFactory_AddRef(iface
);
51 WARN("Unknown interface: %s\n", debugstr_guid(riid
));
56 static ULONG WINAPI
MSTASK_IClassFactory_AddRef(IClassFactory
*face
)
59 InterlockedIncrement(&dll_ref
);
63 static ULONG WINAPI
MSTASK_IClassFactory_Release(IClassFactory
*iface
)
66 InterlockedDecrement(&dll_ref
);
70 static HRESULT WINAPI
MSTASK_IClassFactory_CreateInstance(
77 IUnknown
*punk
= NULL
;
80 TRACE("IID: %s\n",debugstr_guid(riid
));
83 return CLASS_E_NOAGGREGATION
;
85 res
= TaskSchedulerConstructor((LPVOID
*) &punk
);
89 res
= IUnknown_QueryInterface(punk
, riid
, ppvObj
);
90 IUnknown_Release(punk
);
94 static HRESULT WINAPI
MSTASK_IClassFactory_LockServer(
101 IClassFactory_AddRef(iface
);
103 IClassFactory_Release(iface
);
107 static const IClassFactoryVtbl IClassFactory_Vtbl
=
109 MSTASK_IClassFactory_QueryInterface
,
110 MSTASK_IClassFactory_AddRef
,
111 MSTASK_IClassFactory_Release
,
112 MSTASK_IClassFactory_CreateInstance
,
113 MSTASK_IClassFactory_LockServer
116 ClassFactoryImpl MSTASK_ClassFactory
= { { &IClassFactory_Vtbl
} };