user32: Move unpack_message call to User32CallWindowProc.
[wine.git] / dlls / windows.devices.enumeration / main.c
blob0e44251de088a301c616080f5aa2ade971fabfd8
1 /* WinRT Windows.Devices.Enumeration implementation
3 * Copyright 2021 Gijs Vermeulen
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #include <stdarg.h>
22 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winstring.h"
26 #include "wine/debug.h"
27 #include "objbase.h"
29 #include "initguid.h"
30 #include "activation.h"
32 #define WIDL_using_Windows_Foundation
33 #define WIDL_using_Windows_Foundation_Collections
34 #include "windows.foundation.h"
35 #define WIDL_using_Windows_Devices_Enumeration
36 #include "windows.devices.enumeration.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(enumeration);
40 static const char *debugstr_hstring(HSTRING hstr)
42 const WCHAR *str;
43 UINT32 len;
44 if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)";
45 str = WindowsGetStringRawBuffer(hstr, &len);
46 return wine_dbgstr_wn(str, len);
49 struct windows_devices_enumeration
51 IActivationFactory IActivationFactory_iface;
52 LONG ref;
55 static inline struct windows_devices_enumeration *impl_from_IActivationFactory(IActivationFactory *iface)
57 return CONTAINING_RECORD(iface, struct windows_devices_enumeration, IActivationFactory_iface);
60 static HRESULT STDMETHODCALLTYPE windows_devices_enumeration_QueryInterface(
61 IActivationFactory *iface, REFIID iid, void **out)
63 TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out);
65 if (IsEqualGUID(iid, &IID_IUnknown) ||
66 IsEqualGUID(iid, &IID_IInspectable) ||
67 IsEqualGUID(iid, &IID_IAgileObject) ||
68 IsEqualGUID(iid, &IID_IActivationFactory))
70 IUnknown_AddRef(iface);
71 *out = iface;
72 return S_OK;
75 FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
76 *out = NULL;
77 return E_NOINTERFACE;
80 static ULONG STDMETHODCALLTYPE windows_devices_enumeration_AddRef(
81 IActivationFactory *iface)
83 struct windows_devices_enumeration *impl = impl_from_IActivationFactory(iface);
84 ULONG ref = InterlockedIncrement(&impl->ref);
85 TRACE("iface %p, ref %lu.\n", iface, ref);
86 return ref;
89 static ULONG STDMETHODCALLTYPE windows_devices_enumeration_Release(
90 IActivationFactory *iface)
92 struct windows_devices_enumeration *impl = impl_from_IActivationFactory(iface);
93 ULONG ref = InterlockedDecrement(&impl->ref);
94 TRACE("iface %p, ref %lu.\n", iface, ref);
95 return ref;
98 static HRESULT STDMETHODCALLTYPE windows_devices_enumeration_GetIids(
99 IActivationFactory *iface, ULONG *iid_count, IID **iids)
101 FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids);
102 return E_NOTIMPL;
105 static HRESULT STDMETHODCALLTYPE windows_devices_enumeration_GetRuntimeClassName(
106 IActivationFactory *iface, HSTRING *class_name)
108 FIXME("iface %p, class_name %p stub!\n", iface, class_name);
109 return E_NOTIMPL;
112 static HRESULT STDMETHODCALLTYPE windows_devices_enumeration_GetTrustLevel(
113 IActivationFactory *iface, TrustLevel *trust_level)
115 FIXME("iface %p, trust_level %p stub!\n", iface, trust_level);
116 return E_NOTIMPL;
119 static HRESULT STDMETHODCALLTYPE windows_devices_enumeration_ActivateInstance(
120 IActivationFactory *iface, IInspectable **instance)
122 FIXME("iface %p, instance %p stub!\n", iface, instance);
123 return E_NOTIMPL;
126 static const struct IActivationFactoryVtbl activation_factory_vtbl =
128 windows_devices_enumeration_QueryInterface,
129 windows_devices_enumeration_AddRef,
130 windows_devices_enumeration_Release,
131 /* IInspectable methods */
132 windows_devices_enumeration_GetIids,
133 windows_devices_enumeration_GetRuntimeClassName,
134 windows_devices_enumeration_GetTrustLevel,
135 /* IActivationFactory methods */
136 windows_devices_enumeration_ActivateInstance,
139 static struct windows_devices_enumeration windows_devices_enumeration =
141 {&activation_factory_vtbl},
145 HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out)
147 FIXME("clsid %s, riid %s, out %p stub!\n", debugstr_guid(clsid), debugstr_guid(riid), out);
148 return CLASS_E_CLASSNOTAVAILABLE;
151 HRESULT WINAPI DllGetActivationFactory(HSTRING classid, IActivationFactory **factory)
153 TRACE("classid %s, factory %p.\n", debugstr_hstring(classid), factory);
154 *factory = &windows_devices_enumeration.IActivationFactory_iface;
155 IUnknown_AddRef(*factory);
156 return S_OK;