mountmgr: Store the contents of the device symlink in the drive object.
[wine/multimedia.git] / dlls / mstask / factory.c
blob8906d9223592d33284c37fe8354d6616e72011ab
1 /*
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"
20 #include "wine/debug.h"
22 WINE_DEFAULT_DEBUG_CHANNEL(mstask);
24 static HRESULT WINAPI MSTASK_IClassFactory_QueryInterface(
25 LPCLASSFACTORY iface,
26 REFIID riid,
27 LPVOID *ppvObj)
29 ClassFactoryImpl *This = (ClassFactoryImpl *)iface;
31 TRACE("IID: %s\n",debugstr_guid(riid));
32 if (ppvObj == NULL)
33 return E_POINTER;
35 if (IsEqualGUID(riid, &IID_IUnknown) ||
36 IsEqualGUID(riid, &IID_IClassFactory))
38 *ppvObj = &This->lpVtbl;
39 IClassFactory_AddRef(iface);
40 return S_OK;
43 WARN("Unknown interface: %s\n", debugstr_guid(riid));
44 *ppvObj = NULL;
45 return E_NOINTERFACE;
48 static ULONG WINAPI MSTASK_IClassFactory_AddRef(LPCLASSFACTORY iface)
50 TRACE("\n");
51 InterlockedIncrement(&dll_ref);
52 return 2;
55 static ULONG WINAPI MSTASK_IClassFactory_Release(LPCLASSFACTORY iface)
57 TRACE("\n");
58 InterlockedDecrement(&dll_ref);
59 return 1;
62 static HRESULT WINAPI MSTASK_IClassFactory_CreateInstance(
63 LPCLASSFACTORY iface,
64 LPUNKNOWN pUnkOuter,
65 REFIID riid,
66 LPVOID *ppvObj)
68 HRESULT res;
69 IUnknown *punk = NULL;
70 *ppvObj = NULL;
72 TRACE("IID: %s\n",debugstr_guid(riid));
74 if (pUnkOuter)
75 return CLASS_E_NOAGGREGATION;
77 res = TaskSchedulerConstructor((LPVOID*) &punk);
78 if (FAILED(res))
79 return res;
81 res = ITaskScheduler_QueryInterface(punk, riid, ppvObj);
82 ITaskScheduler_Release(punk);
83 return res;
86 static HRESULT WINAPI MSTASK_IClassFactory_LockServer(
87 LPCLASSFACTORY iface,
88 BOOL fLock)
90 TRACE("\n");
92 if (fLock != FALSE)
93 MSTASK_IClassFactory_AddRef(iface);
94 else
95 MSTASK_IClassFactory_Release(iface);
96 return S_OK;
99 static const IClassFactoryVtbl IClassFactory_Vtbl =
101 MSTASK_IClassFactory_QueryInterface,
102 MSTASK_IClassFactory_AddRef,
103 MSTASK_IClassFactory_Release,
104 MSTASK_IClassFactory_CreateInstance,
105 MSTASK_IClassFactory_LockServer
108 ClassFactoryImpl MSTASK_ClassFactory = { &IClassFactory_Vtbl };