mf/tests: Test input type for WMA decoder DMO.
[wine.git] / dlls / wintypes / main.c
blobe48a1b487a6e8f1c7bc102da787afdd578743af4
1 /*
2 * Copyright 2022 Zhiyi Zhang for CodeWeavers
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 <stdarg.h>
21 #define COBJMACROS
22 #include "initguid.h"
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winstring.h"
26 #include "wine/debug.h"
27 #include "objbase.h"
29 #include "activation.h"
30 #include "rometadataresolution.h"
32 #define WIDL_using_Windows_Foundation_Metadata
33 #include "windows.foundation.metadata.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(wintypes);
37 static const char *debugstr_hstring(HSTRING hstr)
39 const WCHAR *str;
40 UINT32 len;
41 if (hstr && !((ULONG_PTR)hstr >> 16))
42 return "(invalid)";
43 str = WindowsGetStringRawBuffer(hstr, &len);
44 return wine_dbgstr_wn(str, len);
47 struct wintypes
49 IActivationFactory IActivationFactory_iface;
50 IApiInformationStatics IApiInformationStatics_iface;
51 LONG ref;
54 static inline struct wintypes *impl_from_IActivationFactory(IActivationFactory *iface)
56 return CONTAINING_RECORD(iface, struct wintypes, IActivationFactory_iface);
59 static inline struct wintypes *impl_from_IApiInformationStatics(IApiInformationStatics *iface)
61 return CONTAINING_RECORD(iface, struct wintypes, IApiInformationStatics_iface);
64 static HRESULT STDMETHODCALLTYPE wintypes_QueryInterface(IActivationFactory *iface, REFIID iid,
65 void **out)
67 struct wintypes *impl = impl_from_IActivationFactory(iface);
69 TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out);
71 if (IsEqualGUID(iid, &IID_IUnknown)
72 || IsEqualGUID(iid, &IID_IInspectable)
73 || IsEqualGUID(iid, &IID_IAgileObject)
74 || IsEqualGUID(iid, &IID_IActivationFactory))
76 IUnknown_AddRef(iface);
77 *out = iface;
78 return S_OK;
81 if (IsEqualGUID(iid, &IID_IApiInformationStatics))
83 IUnknown_AddRef(iface);
84 *out = &impl->IApiInformationStatics_iface;
85 return S_OK;
88 FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
89 *out = NULL;
90 return E_NOINTERFACE;
93 static ULONG STDMETHODCALLTYPE wintypes_AddRef(IActivationFactory *iface)
95 struct wintypes *impl = impl_from_IActivationFactory(iface);
96 ULONG ref = InterlockedIncrement(&impl->ref);
97 TRACE("iface %p, ref %lu.\n", iface, ref);
98 return ref;
101 static ULONG STDMETHODCALLTYPE wintypes_Release(IActivationFactory *iface)
103 struct wintypes *impl = impl_from_IActivationFactory(iface);
104 ULONG ref = InterlockedDecrement(&impl->ref);
105 TRACE("iface %p, ref %lu.\n", iface, ref);
106 return ref;
109 static HRESULT STDMETHODCALLTYPE wintypes_GetIids(IActivationFactory *iface, ULONG *iid_count,
110 IID **iids)
112 FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids);
113 return E_NOTIMPL;
116 static HRESULT STDMETHODCALLTYPE wintypes_GetRuntimeClassName(IActivationFactory *iface,
117 HSTRING *class_name)
119 FIXME("iface %p, class_name %p stub!\n", iface, class_name);
120 return E_NOTIMPL;
123 static HRESULT STDMETHODCALLTYPE wintypes_GetTrustLevel(IActivationFactory *iface,
124 TrustLevel *trust_level)
126 FIXME("iface %p, trust_level %p stub!\n", iface, trust_level);
127 return E_NOTIMPL;
130 static HRESULT STDMETHODCALLTYPE wintypes_ActivateInstance(IActivationFactory *iface,
131 IInspectable **instance)
133 FIXME("iface %p, instance %p stub!\n", iface, instance);
134 return E_NOTIMPL;
137 static const struct IActivationFactoryVtbl activation_factory_vtbl =
139 wintypes_QueryInterface,
140 wintypes_AddRef,
141 wintypes_Release,
142 /* IInspectable methods */
143 wintypes_GetIids,
144 wintypes_GetRuntimeClassName,
145 wintypes_GetTrustLevel,
146 /* IActivationFactory methods */
147 wintypes_ActivateInstance,
150 static HRESULT STDMETHODCALLTYPE api_information_statics_QueryInterface(
151 IApiInformationStatics *iface, REFIID iid, void **out)
153 struct wintypes *impl = impl_from_IApiInformationStatics(iface);
154 return wintypes_QueryInterface(&impl->IActivationFactory_iface, iid, out);
157 static ULONG STDMETHODCALLTYPE api_information_statics_AddRef(
158 IApiInformationStatics *iface)
160 struct wintypes *impl = impl_from_IApiInformationStatics(iface);
161 return wintypes_AddRef(&impl->IActivationFactory_iface);
164 static ULONG STDMETHODCALLTYPE api_information_statics_Release(
165 IApiInformationStatics *iface)
167 struct wintypes *impl = impl_from_IApiInformationStatics(iface);
168 return wintypes_Release(&impl->IActivationFactory_iface);
171 static HRESULT STDMETHODCALLTYPE api_information_statics_GetIids(
172 IApiInformationStatics *iface, ULONG *iid_count, IID **iids)
174 FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids);
175 return E_NOTIMPL;
178 static HRESULT STDMETHODCALLTYPE api_information_statics_GetRuntimeClassName(
179 IApiInformationStatics *iface, HSTRING *class_name)
181 FIXME("iface %p, class_name %p stub!\n", iface, class_name);
182 return E_NOTIMPL;
185 static HRESULT STDMETHODCALLTYPE api_information_statics_GetTrustLevel(
186 IApiInformationStatics *iface, TrustLevel *trust_level)
188 FIXME("iface %p, trust_level %p stub!\n", iface, trust_level);
189 return E_NOTIMPL;
192 static HRESULT STDMETHODCALLTYPE api_information_statics_IsTypePresent(
193 IApiInformationStatics *iface, HSTRING type_name, BOOLEAN *value)
195 FIXME("iface %p, type_name %s, value %p stub!\n", iface, debugstr_hstring(type_name), value);
197 if (!type_name)
198 return E_INVALIDARG;
200 return E_NOTIMPL;
203 static HRESULT STDMETHODCALLTYPE api_information_statics_IsMethodPresent(
204 IApiInformationStatics *iface, HSTRING type_name, HSTRING method_name, BOOLEAN *value)
206 FIXME("iface %p, type_name %s, method_name %s, value %p stub!\n", iface,
207 debugstr_hstring(type_name), debugstr_hstring(method_name), value);
209 if (!type_name)
210 return E_INVALIDARG;
212 return E_NOTIMPL;
215 static HRESULT STDMETHODCALLTYPE api_information_statics_IsMethodPresentWithArity(
216 IApiInformationStatics *iface, HSTRING type_name, HSTRING method_name,
217 UINT32 input_parameter_count, BOOLEAN *value)
219 FIXME("iface %p, type_name %s, method_name %s, input_parameter_count %u, value %p stub!\n",
220 iface, debugstr_hstring(type_name), debugstr_hstring(method_name),
221 input_parameter_count, value);
223 if (!type_name)
224 return E_INVALIDARG;
226 return E_NOTIMPL;
229 static HRESULT STDMETHODCALLTYPE api_information_statics_IsEventPresent(
230 IApiInformationStatics *iface, HSTRING type_name, HSTRING event_name, BOOLEAN *value)
232 FIXME("iface %p, type_name %s, event_name %s, value %p stub!\n", iface,
233 debugstr_hstring(type_name), debugstr_hstring(event_name), value);
235 if (!type_name)
236 return E_INVALIDARG;
238 return E_NOTIMPL;
241 static HRESULT STDMETHODCALLTYPE api_information_statics_IsPropertyPresent(
242 IApiInformationStatics *iface, HSTRING type_name, HSTRING property_name, BOOLEAN *value)
244 FIXME("iface %p, type_name %s, property_name %s, value %p stub!\n", iface,
245 debugstr_hstring(type_name), debugstr_hstring(property_name), value);
247 if (!type_name)
248 return E_INVALIDARG;
250 return E_NOTIMPL;
253 static HRESULT STDMETHODCALLTYPE api_information_statics_IsReadOnlyPropertyPresent(
254 IApiInformationStatics *iface, HSTRING type_name, HSTRING property_name,
255 BOOLEAN *value)
257 FIXME("iface %p, type_name %s, property_name %s, value %p stub!\n", iface,
258 debugstr_hstring(type_name), debugstr_hstring(property_name), value);
260 if (!type_name)
261 return E_INVALIDARG;
263 return E_NOTIMPL;
266 static HRESULT STDMETHODCALLTYPE api_information_statics_IsWriteablePropertyPresent(
267 IApiInformationStatics *iface, HSTRING type_name, HSTRING property_name, BOOLEAN *value)
269 FIXME("iface %p, type_name %s, property_name %s, value %p stub!\n", iface,
270 debugstr_hstring(type_name), debugstr_hstring(property_name), value);
272 if (!type_name)
273 return E_INVALIDARG;
275 return E_NOTIMPL;
278 static HRESULT STDMETHODCALLTYPE api_information_statics_IsEnumNamedValuePresent(
279 IApiInformationStatics *iface, HSTRING enum_type_name, HSTRING value_name, BOOLEAN *value)
281 FIXME("iface %p, enum_type_name %s, value_name %s, value %p stub!\n", iface,
282 debugstr_hstring(enum_type_name), debugstr_hstring(value_name), value);
284 if (!enum_type_name)
285 return E_INVALIDARG;
287 return E_NOTIMPL;
290 static HRESULT STDMETHODCALLTYPE api_information_statics_IsApiContractPresentByMajor(
291 IApiInformationStatics *iface, HSTRING contract_name, UINT16 major_version, BOOLEAN *value)
293 FIXME("iface %p, contract_name %s, major_version %u, value %p stub!\n", iface,
294 debugstr_hstring(contract_name), major_version, value);
296 if (!contract_name)
297 return E_INVALIDARG;
299 *value = FALSE;
300 return S_OK;
303 static HRESULT STDMETHODCALLTYPE api_information_statics_IsApiContractPresentByMajorAndMinor(
304 IApiInformationStatics *iface, HSTRING contract_name, UINT16 major_version,
305 UINT16 minor_version, BOOLEAN *value)
307 FIXME("iface %p, contract_name %s, major_version %u, minor_version %u, value %p stub!\n", iface,
308 debugstr_hstring(contract_name), major_version, minor_version, value);
310 if (!contract_name)
311 return E_INVALIDARG;
313 return E_NOTIMPL;
316 static const struct IApiInformationStaticsVtbl api_information_statics_vtbl =
318 api_information_statics_QueryInterface,
319 api_information_statics_AddRef,
320 api_information_statics_Release,
321 /* IInspectable methods */
322 api_information_statics_GetIids,
323 api_information_statics_GetRuntimeClassName,
324 api_information_statics_GetTrustLevel,
325 /* IApiInformationStatics methods */
326 api_information_statics_IsTypePresent,
327 api_information_statics_IsMethodPresent,
328 api_information_statics_IsMethodPresentWithArity,
329 api_information_statics_IsEventPresent,
330 api_information_statics_IsPropertyPresent,
331 api_information_statics_IsReadOnlyPropertyPresent,
332 api_information_statics_IsWriteablePropertyPresent,
333 api_information_statics_IsEnumNamedValuePresent,
334 api_information_statics_IsApiContractPresentByMajor,
335 api_information_statics_IsApiContractPresentByMajorAndMinor
338 static struct wintypes wintypes =
340 {&activation_factory_vtbl},
341 {&api_information_statics_vtbl},
345 HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out)
347 FIXME("clsid %s, riid %s, out %p stub!\n", debugstr_guid(clsid), debugstr_guid(riid), out);
348 return CLASS_E_CLASSNOTAVAILABLE;
351 HRESULT WINAPI DllGetActivationFactory(HSTRING classid, IActivationFactory **factory)
353 TRACE("classid %s, factory %p.\n", debugstr_hstring(classid), factory);
354 *factory = &wintypes.IActivationFactory_iface;
355 IUnknown_AddRef(*factory);
356 return S_OK;
359 HRESULT WINAPI RoIsApiContractMajorVersionPresent(const WCHAR *name, UINT16 major, BOOL *result)
361 FIXME("name %s, major %u, result %p\n", debugstr_w(name), major, result);
362 *result = FALSE;
363 return S_OK;
366 HRESULT WINAPI RoResolveNamespace(HSTRING name, HSTRING windowsMetaDataDir,
367 DWORD packageGraphDirsCount, const HSTRING *packageGraphDirs,
368 DWORD *metaDataFilePathsCount, HSTRING **metaDataFilePaths,
369 DWORD *subNamespacesCount, HSTRING **subNamespaces)
371 FIXME("name %s, windowsMetaDataDir %s, metaDataFilePaths %p, subNamespaces %p stub!\n",
372 debugstr_hstring(name), debugstr_hstring(windowsMetaDataDir),
373 metaDataFilePaths, subNamespaces);
375 if (!metaDataFilePaths && !subNamespaces)
376 return E_INVALIDARG;
378 return RO_E_METADATA_NAME_NOT_FOUND;