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
);
39 IActivationFactory IActivationFactory_iface
;
40 IApiInformationStatics IApiInformationStatics_iface
;
44 static inline struct wintypes
*impl_from_IActivationFactory(IActivationFactory
*iface
)
46 return CONTAINING_RECORD(iface
, struct wintypes
, IActivationFactory_iface
);
49 static inline struct wintypes
*impl_from_IApiInformationStatics(IApiInformationStatics
*iface
)
51 return CONTAINING_RECORD(iface
, struct wintypes
, IApiInformationStatics_iface
);
54 static HRESULT STDMETHODCALLTYPE
wintypes_QueryInterface(IActivationFactory
*iface
, REFIID iid
,
57 struct wintypes
*impl
= impl_from_IActivationFactory(iface
);
59 TRACE("iface %p, iid %s, out %p stub!\n", iface
, debugstr_guid(iid
), out
);
61 if (IsEqualGUID(iid
, &IID_IUnknown
)
62 || IsEqualGUID(iid
, &IID_IInspectable
)
63 || IsEqualGUID(iid
, &IID_IAgileObject
)
64 || IsEqualGUID(iid
, &IID_IActivationFactory
))
66 IUnknown_AddRef(iface
);
71 if (IsEqualGUID(iid
, &IID_IApiInformationStatics
))
73 IUnknown_AddRef(iface
);
74 *out
= &impl
->IApiInformationStatics_iface
;
78 FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid
));
83 static ULONG STDMETHODCALLTYPE
wintypes_AddRef(IActivationFactory
*iface
)
85 struct wintypes
*impl
= impl_from_IActivationFactory(iface
);
86 ULONG ref
= InterlockedIncrement(&impl
->ref
);
87 TRACE("iface %p, ref %lu.\n", iface
, ref
);
91 static ULONG STDMETHODCALLTYPE
wintypes_Release(IActivationFactory
*iface
)
93 struct wintypes
*impl
= impl_from_IActivationFactory(iface
);
94 ULONG ref
= InterlockedDecrement(&impl
->ref
);
95 TRACE("iface %p, ref %lu.\n", iface
, ref
);
99 static HRESULT STDMETHODCALLTYPE
wintypes_GetIids(IActivationFactory
*iface
, ULONG
*iid_count
,
102 FIXME("iface %p, iid_count %p, iids %p stub!\n", iface
, iid_count
, iids
);
106 static HRESULT STDMETHODCALLTYPE
wintypes_GetRuntimeClassName(IActivationFactory
*iface
,
109 FIXME("iface %p, class_name %p stub!\n", iface
, class_name
);
113 static HRESULT STDMETHODCALLTYPE
wintypes_GetTrustLevel(IActivationFactory
*iface
,
114 TrustLevel
*trust_level
)
116 FIXME("iface %p, trust_level %p stub!\n", iface
, trust_level
);
120 static HRESULT STDMETHODCALLTYPE
wintypes_ActivateInstance(IActivationFactory
*iface
,
121 IInspectable
**instance
)
123 FIXME("iface %p, instance %p stub!\n", iface
, instance
);
127 static const struct IActivationFactoryVtbl activation_factory_vtbl
=
129 wintypes_QueryInterface
,
132 /* IInspectable methods */
134 wintypes_GetRuntimeClassName
,
135 wintypes_GetTrustLevel
,
136 /* IActivationFactory methods */
137 wintypes_ActivateInstance
,
140 static HRESULT STDMETHODCALLTYPE
api_information_statics_QueryInterface(
141 IApiInformationStatics
*iface
, REFIID iid
, void **out
)
143 struct wintypes
*impl
= impl_from_IApiInformationStatics(iface
);
144 return wintypes_QueryInterface(&impl
->IActivationFactory_iface
, iid
, out
);
147 static ULONG STDMETHODCALLTYPE
api_information_statics_AddRef(
148 IApiInformationStatics
*iface
)
150 struct wintypes
*impl
= impl_from_IApiInformationStatics(iface
);
151 return wintypes_AddRef(&impl
->IActivationFactory_iface
);
154 static ULONG STDMETHODCALLTYPE
api_information_statics_Release(
155 IApiInformationStatics
*iface
)
157 struct wintypes
*impl
= impl_from_IApiInformationStatics(iface
);
158 return wintypes_Release(&impl
->IActivationFactory_iface
);
161 static HRESULT STDMETHODCALLTYPE
api_information_statics_GetIids(
162 IApiInformationStatics
*iface
, ULONG
*iid_count
, IID
**iids
)
164 FIXME("iface %p, iid_count %p, iids %p stub!\n", iface
, iid_count
, iids
);
168 static HRESULT STDMETHODCALLTYPE
api_information_statics_GetRuntimeClassName(
169 IApiInformationStatics
*iface
, HSTRING
*class_name
)
171 FIXME("iface %p, class_name %p stub!\n", iface
, class_name
);
175 static HRESULT STDMETHODCALLTYPE
api_information_statics_GetTrustLevel(
176 IApiInformationStatics
*iface
, TrustLevel
*trust_level
)
178 FIXME("iface %p, trust_level %p stub!\n", iface
, trust_level
);
182 static HRESULT STDMETHODCALLTYPE
api_information_statics_IsTypePresent(
183 IApiInformationStatics
*iface
, HSTRING type_name
, BOOLEAN
*value
)
185 FIXME("iface %p, type_name %s, value %p stub!\n", iface
, debugstr_hstring(type_name
), value
);
193 static HRESULT STDMETHODCALLTYPE
api_information_statics_IsMethodPresent(
194 IApiInformationStatics
*iface
, HSTRING type_name
, HSTRING method_name
, BOOLEAN
*value
)
196 FIXME("iface %p, type_name %s, method_name %s, value %p stub!\n", iface
,
197 debugstr_hstring(type_name
), debugstr_hstring(method_name
), value
);
205 static HRESULT STDMETHODCALLTYPE
api_information_statics_IsMethodPresentWithArity(
206 IApiInformationStatics
*iface
, HSTRING type_name
, HSTRING method_name
,
207 UINT32 input_parameter_count
, BOOLEAN
*value
)
209 FIXME("iface %p, type_name %s, method_name %s, input_parameter_count %u, value %p stub!\n",
210 iface
, debugstr_hstring(type_name
), debugstr_hstring(method_name
),
211 input_parameter_count
, value
);
219 static HRESULT STDMETHODCALLTYPE
api_information_statics_IsEventPresent(
220 IApiInformationStatics
*iface
, HSTRING type_name
, HSTRING event_name
, BOOLEAN
*value
)
222 FIXME("iface %p, type_name %s, event_name %s, value %p stub!\n", iface
,
223 debugstr_hstring(type_name
), debugstr_hstring(event_name
), value
);
231 static HRESULT STDMETHODCALLTYPE
api_information_statics_IsPropertyPresent(
232 IApiInformationStatics
*iface
, HSTRING type_name
, HSTRING property_name
, BOOLEAN
*value
)
234 FIXME("iface %p, type_name %s, property_name %s, value %p stub!\n", iface
,
235 debugstr_hstring(type_name
), debugstr_hstring(property_name
), value
);
243 static HRESULT STDMETHODCALLTYPE
api_information_statics_IsReadOnlyPropertyPresent(
244 IApiInformationStatics
*iface
, HSTRING type_name
, HSTRING property_name
,
247 FIXME("iface %p, type_name %s, property_name %s, value %p stub!\n", iface
,
248 debugstr_hstring(type_name
), debugstr_hstring(property_name
), value
);
256 static HRESULT STDMETHODCALLTYPE
api_information_statics_IsWriteablePropertyPresent(
257 IApiInformationStatics
*iface
, HSTRING type_name
, HSTRING property_name
, BOOLEAN
*value
)
259 FIXME("iface %p, type_name %s, property_name %s, value %p stub!\n", iface
,
260 debugstr_hstring(type_name
), debugstr_hstring(property_name
), value
);
268 static HRESULT STDMETHODCALLTYPE
api_information_statics_IsEnumNamedValuePresent(
269 IApiInformationStatics
*iface
, HSTRING enum_type_name
, HSTRING value_name
, BOOLEAN
*value
)
271 FIXME("iface %p, enum_type_name %s, value_name %s, value %p stub!\n", iface
,
272 debugstr_hstring(enum_type_name
), debugstr_hstring(value_name
), value
);
280 static HRESULT STDMETHODCALLTYPE
api_information_statics_IsApiContractPresentByMajor(
281 IApiInformationStatics
*iface
, HSTRING contract_name
, UINT16 major_version
, BOOLEAN
*value
)
283 FIXME("iface %p, contract_name %s, major_version %u, value %p stub!\n", iface
,
284 debugstr_hstring(contract_name
), major_version
, value
);
293 static HRESULT STDMETHODCALLTYPE
api_information_statics_IsApiContractPresentByMajorAndMinor(
294 IApiInformationStatics
*iface
, HSTRING contract_name
, UINT16 major_version
,
295 UINT16 minor_version
, BOOLEAN
*value
)
297 FIXME("iface %p, contract_name %s, major_version %u, minor_version %u, value %p stub!\n", iface
,
298 debugstr_hstring(contract_name
), major_version
, minor_version
, value
);
306 static const struct IApiInformationStaticsVtbl api_information_statics_vtbl
=
308 api_information_statics_QueryInterface
,
309 api_information_statics_AddRef
,
310 api_information_statics_Release
,
311 /* IInspectable methods */
312 api_information_statics_GetIids
,
313 api_information_statics_GetRuntimeClassName
,
314 api_information_statics_GetTrustLevel
,
315 /* IApiInformationStatics methods */
316 api_information_statics_IsTypePresent
,
317 api_information_statics_IsMethodPresent
,
318 api_information_statics_IsMethodPresentWithArity
,
319 api_information_statics_IsEventPresent
,
320 api_information_statics_IsPropertyPresent
,
321 api_information_statics_IsReadOnlyPropertyPresent
,
322 api_information_statics_IsWriteablePropertyPresent
,
323 api_information_statics_IsEnumNamedValuePresent
,
324 api_information_statics_IsApiContractPresentByMajor
,
325 api_information_statics_IsApiContractPresentByMajorAndMinor
328 static struct wintypes wintypes
=
330 {&activation_factory_vtbl
},
331 {&api_information_statics_vtbl
},
335 HRESULT WINAPI
DllGetClassObject(REFCLSID clsid
, REFIID riid
, void **out
)
337 FIXME("clsid %s, riid %s, out %p stub!\n", debugstr_guid(clsid
), debugstr_guid(riid
), out
);
338 return CLASS_E_CLASSNOTAVAILABLE
;
341 HRESULT WINAPI
DllGetActivationFactory(HSTRING classid
, IActivationFactory
**factory
)
343 TRACE("classid %s, factory %p.\n", debugstr_hstring(classid
), factory
);
344 *factory
= &wintypes
.IActivationFactory_iface
;
345 IUnknown_AddRef(*factory
);
349 HRESULT WINAPI
RoIsApiContractMajorVersionPresent(const WCHAR
*name
, UINT16 major
, BOOL
*result
)
351 FIXME("name %s, major %u, result %p\n", debugstr_w(name
), major
, result
);
356 HRESULT WINAPI
RoResolveNamespace(HSTRING name
, HSTRING windowsMetaDataDir
,
357 DWORD packageGraphDirsCount
, const HSTRING
*packageGraphDirs
,
358 DWORD
*metaDataFilePathsCount
, HSTRING
**metaDataFilePaths
,
359 DWORD
*subNamespacesCount
, HSTRING
**subNamespaces
)
361 FIXME("name %s, windowsMetaDataDir %s, metaDataFilePaths %p, subNamespaces %p stub!\n",
362 debugstr_hstring(name
), debugstr_hstring(windowsMetaDataDir
),
363 metaDataFilePaths
, subNamespaces
);
365 if (!metaDataFilePaths
&& !subNamespaces
)
368 return RO_E_METADATA_NAME_NOT_FOUND
;