mfplat: Remove duplicated GUID entry from attribute tracing.
[wine/zf.git] / dlls / sapi / resource.c
blob85d4430f8ad9dd4cac371910e46cd553985a20e7
1 /*
2 * Speech API (SAPI) resource manager implementation.
4 * Copyright 2020 Gijs Vermeulen
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"
29 #include "sapiddk.h"
31 #include "wine/debug.h"
33 #include "sapi_private.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(sapi);
37 struct resource_manager
39 ISpResourceManager ISpResourceManager_iface;
40 LONG ref;
43 static inline struct resource_manager *impl_from_ISpResourceManager(ISpResourceManager *iface)
45 return CONTAINING_RECORD(iface, struct resource_manager, ISpResourceManager_iface);
48 static HRESULT WINAPI resource_manager_QueryInterface(ISpResourceManager *iface, REFIID iid, void **obj)
50 struct resource_manager *This = impl_from_ISpResourceManager(iface);
52 TRACE("(%p, %s, %p).\n", iface, debugstr_guid(iid), obj);
54 if (IsEqualIID(iid, &IID_IUnknown) ||
55 IsEqualIID(iid, &IID_ISpResourceManager))
56 *obj = &This->ISpResourceManager_iface;
57 else
59 *obj = NULL;
60 FIXME("interface %s not implemented.\n", debugstr_guid(iid));
61 return E_NOINTERFACE;
64 IUnknown_AddRef((IUnknown *)*obj);
65 return S_OK;
68 static ULONG WINAPI resource_manager_AddRef(ISpResourceManager *iface)
70 struct resource_manager *This = impl_from_ISpResourceManager(iface);
71 ULONG ref = InterlockedIncrement(&This->ref);
73 TRACE("(%p): ref=%u.\n", iface, ref);
75 return ref;
78 static ULONG WINAPI resource_manager_Release(ISpResourceManager *iface)
80 struct resource_manager *This = impl_from_ISpResourceManager(iface);
81 ULONG ref = InterlockedDecrement(&This->ref);
83 TRACE("(%p): ref=%u.\n", iface, ref);
85 if (!ref)
87 heap_free(This);
90 return ref;
93 static HRESULT WINAPI resource_manager_QueryService(ISpResourceManager *iface, REFGUID guid, REFIID iid,
94 void **obj)
96 FIXME("(%p, %s, %s, %p): stub.\n", iface, debugstr_guid(guid), debugstr_guid(iid), obj);
98 return E_NOTIMPL;
101 static HRESULT WINAPI resource_manager_SetObject(ISpResourceManager *iface, REFGUID guid, IUnknown *obj)
103 FIXME("(%p, %s, %p): stub.\n", iface, debugstr_guid(guid), obj);
105 return E_NOTIMPL;
108 static HRESULT WINAPI resource_manager_GetObject(ISpResourceManager *iface, REFGUID guid, REFCLSID clsid, REFIID iid,
109 BOOL release, void **obj)
111 FIXME("(%p, %s, %s, %s, %d, %p): stub.\n", iface, debugstr_guid(guid), debugstr_guid(clsid), debugstr_guid(iid),
112 release, obj);
114 return E_NOTIMPL;
117 const static ISpResourceManagerVtbl resource_manager_vtbl =
119 resource_manager_QueryInterface,
120 resource_manager_AddRef,
121 resource_manager_Release,
122 resource_manager_QueryService,
123 resource_manager_SetObject,
124 resource_manager_GetObject
127 HRESULT resource_manager_create(IUnknown *outer, REFIID iid, void **obj)
129 struct resource_manager *This = heap_alloc(sizeof(*This));
130 HRESULT hr;
132 if (!This) return E_OUTOFMEMORY;
133 This->ISpResourceManager_iface.lpVtbl = &resource_manager_vtbl;
134 This->ref = 1;
136 hr = ISpResourceManager_QueryInterface(&This->ISpResourceManager_iface, iid, obj);
138 ISpResourceManager_Release(&This->ISpResourceManager_iface);
139 return hr;