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
25 #include "winstring.h"
26 #include "wine/debug.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
)
41 if (hstr
&& !((ULONG_PTR
)hstr
>> 16))
43 str
= WindowsGetStringRawBuffer(hstr
, &len
);
44 return wine_dbgstr_wn(str
, len
);
49 IActivationFactory IActivationFactory_iface
;
50 IApiInformationStatics IApiInformationStatics_iface
;
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
,
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
);
81 if (IsEqualGUID(iid
, &IID_IApiInformationStatics
))
83 IUnknown_AddRef(iface
);
84 *out
= &impl
->IApiInformationStatics_iface
;
88 FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid
));
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
);
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
);
109 static HRESULT STDMETHODCALLTYPE
wintypes_GetIids(IActivationFactory
*iface
, ULONG
*iid_count
,
112 FIXME("iface %p, iid_count %p, iids %p stub!\n", iface
, iid_count
, iids
);
116 static HRESULT STDMETHODCALLTYPE
wintypes_GetRuntimeClassName(IActivationFactory
*iface
,
119 FIXME("iface %p, class_name %p stub!\n", iface
, class_name
);
123 static HRESULT STDMETHODCALLTYPE
wintypes_GetTrustLevel(IActivationFactory
*iface
,
124 TrustLevel
*trust_level
)
126 FIXME("iface %p, trust_level %p stub!\n", iface
, trust_level
);
130 static HRESULT STDMETHODCALLTYPE
wintypes_ActivateInstance(IActivationFactory
*iface
,
131 IInspectable
**instance
)
133 FIXME("iface %p, instance %p stub!\n", iface
, instance
);
137 static const struct IActivationFactoryVtbl activation_factory_vtbl
=
139 wintypes_QueryInterface
,
142 /* IInspectable methods */
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
253 static HRESULT STDMETHODCALLTYPE
api_information_statics_IsReadOnlyPropertyPresent(
254 IApiInformationStatics
*iface
, HSTRING type_name
, HSTRING property_name
,
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
)
378 return RO_E_METADATA_NAME_NOT_FOUND
;