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
31 #include "wine/debug.h"
33 #include "sapi_private.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(sapi
);
37 struct resource_manager
39 ISpResourceManager ISpResourceManager_iface
;
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
;
60 FIXME("interface %s not implemented.\n", debugstr_guid(iid
));
64 IUnknown_AddRef((IUnknown
*)*obj
);
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=%lu.\n", iface
, 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=%lu.\n", iface
, ref
);
93 static HRESULT WINAPI
resource_manager_QueryService(ISpResourceManager
*iface
, REFGUID guid
, REFIID iid
,
96 FIXME("(%p, %s, %s, %p): stub.\n", iface
, debugstr_guid(guid
), debugstr_guid(iid
), obj
);
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
);
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
),
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
));
132 if (!This
) return E_OUTOFMEMORY
;
133 This
->ISpResourceManager_iface
.lpVtbl
= &resource_manager_vtbl
;
136 hr
= ISpResourceManager_QueryInterface(&This
->ISpResourceManager_iface
, iid
, obj
);
138 ISpResourceManager_Release(&This
->ISpResourceManager_iface
);