From: Jactry Zeng jzeng@codeweavers.com
--- include/windows.storage.streams.idl | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/include/windows.storage.streams.idl b/include/windows.storage.streams.idl index 8f2d4f1065f..22e4c63c9b9 100644 --- a/include/windows.storage.streams.idl +++ b/include/windows.storage.streams.idl @@ -20,9 +20,11 @@ #pragma winrt ns_prefix #endif
+#ifndef DO_NO_IMPORTS import "inspectable.idl"; import "eventtoken.idl"; import "windows.foundation.idl"; +#endif
namespace Windows.Storage { interface IStorageFile;
From: Jactry Zeng jzeng@codeweavers.com
--- dlls/wintypes/tests/wintypes.c | 61 ++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+)
diff --git a/dlls/wintypes/tests/wintypes.c b/dlls/wintypes/tests/wintypes.c index 078afa1c224..b7948f7cf18 100644 --- a/dlls/wintypes/tests/wintypes.c +++ b/dlls/wintypes/tests/wintypes.c @@ -36,6 +36,66 @@
static BOOL is_wow64;
+#define check_interface(obj, iid, supported) check_interface_(__LINE__, obj, iid, supported) +static void check_interface_(unsigned int line, void *obj, const IID *iid, BOOL supported) +{ + HRESULT hr, expected_hr; + IUnknown *iface = obj; + IUnknown *unk; + + expected_hr = supported ? S_OK : E_NOINTERFACE; + hr = IUnknown_QueryInterface(iface, iid, (void **)&unk); + ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx.\n", hr); + if (SUCCEEDED(hr)) + IUnknown_Release(unk); +} + +static void test_interfaces(void) +{ + static WCHAR class_name[1024]; + IActivationFactory *factory; + HSTRING str; + HRESULT hr; + + hr = RoInitialize(RO_INIT_MULTITHREADED); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + wcscpy(class_name, L"Windows.Foundation.Metadata.ApiInformation"); + hr = WindowsCreateString(class_name, wcslen(class_name), &str); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = RoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory); + ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG) /* pre-win8 */, "Got hr %#lx.\n", hr); + if (hr == S_OK) + { + check_interface(factory, &IID_IUnknown, TRUE); + check_interface(factory, &IID_IInspectable, TRUE); + check_interface(factory, &IID_IAgileObject, TRUE); + check_interface(factory, &IID_IActivationFactory, TRUE); + check_interface(factory, &IID_IApiInformationStatics, TRUE); + todo_wine check_interface(factory, &IID_IPropertyValueStatics, FALSE); + IActivationFactory_Release(factory); + } + else + win_skip("%s runtimeclass not registered, skipping tests.\n", wine_dbgstr_w(class_name)); + WindowsDeleteString(str); + + wcscpy(class_name, L"Windows.Foundation.PropertyValue"); + hr = WindowsCreateString(class_name, wcslen(class_name), &str); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = RoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + check_interface(factory, &IID_IUnknown, TRUE); + check_interface(factory, &IID_IInspectable, TRUE); + check_interface(factory, &IID_IAgileObject, TRUE); + check_interface(factory, &IID_IActivationFactory, TRUE); + todo_wine check_interface(factory, &IID_IApiInformationStatics, FALSE); + check_interface(factory, &IID_IPropertyValueStatics, TRUE); + IActivationFactory_Release(factory); + WindowsDeleteString(str); + + RoUninitialize(); +} + static void test_IApiInformationStatics(void) { static const struct @@ -965,6 +1025,7 @@ START_TEST(wintypes) { IsWow64Process(GetCurrentProcess(), &is_wow64);
+ test_interfaces(); test_IApiInformationStatics(); test_IPropertyValueStatics(); test_RoParseTypeName();
From: Jactry Zeng jzeng@codeweavers.com
--- dlls/wintypes/main.c | 183 ++++++++++++++++++++++++++------- dlls/wintypes/tests/wintypes.c | 4 +- 2 files changed, 146 insertions(+), 41 deletions(-)
diff --git a/dlls/wintypes/main.c b/dlls/wintypes/main.c index 46c2a1d7911..3fc82c9693d 100644 --- a/dlls/wintypes/main.c +++ b/dlls/wintypes/main.c @@ -57,25 +57,24 @@ static BOOLEAN is_api_contract_present( const HSTRING hname, unsigned int versio return FALSE; }
-struct wintypes +struct api_information_statics { IActivationFactory IActivationFactory_iface; IApiInformationStatics IApiInformationStatics_iface; - IPropertyValueStatics IPropertyValueStatics_iface; LONG ref; };
-static inline struct wintypes *impl_from_IActivationFactory(IActivationFactory *iface) +static inline struct api_information_statics *impl_ais_from_IActivationFactory(IActivationFactory *iface) { - return CONTAINING_RECORD(iface, struct wintypes, IActivationFactory_iface); + return CONTAINING_RECORD(iface, struct api_information_statics, IActivationFactory_iface); }
-static HRESULT STDMETHODCALLTYPE wintypes_QueryInterface(IActivationFactory *iface, REFIID iid, +static HRESULT STDMETHODCALLTYPE api_information_statics_factory_QueryInterface(IActivationFactory *iface, REFIID iid, void **out) { - struct wintypes *impl = impl_from_IActivationFactory(iface); + struct api_information_statics *impl = impl_ais_from_IActivationFactory(iface);
- TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out); + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IInspectable) @@ -94,76 +93,69 @@ static HRESULT STDMETHODCALLTYPE wintypes_QueryInterface(IActivationFactory *ifa return S_OK; }
- if (IsEqualGUID(iid, &IID_IPropertyValueStatics)) - { - IUnknown_AddRef(iface); - *out = &impl->IPropertyValueStatics_iface; - return S_OK; - } - - FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); *out = NULL; return E_NOINTERFACE; }
-static ULONG STDMETHODCALLTYPE wintypes_AddRef(IActivationFactory *iface) +static ULONG STDMETHODCALLTYPE api_information_statics_factory_AddRef(IActivationFactory *iface) { - struct wintypes *impl = impl_from_IActivationFactory(iface); + struct api_information_statics *impl = impl_ais_from_IActivationFactory(iface); ULONG ref = InterlockedIncrement(&impl->ref); TRACE("iface %p, ref %lu.\n", iface, ref); return ref; }
-static ULONG STDMETHODCALLTYPE wintypes_Release(IActivationFactory *iface) +static ULONG STDMETHODCALLTYPE api_information_statics_factory_Release(IActivationFactory *iface) { - struct wintypes *impl = impl_from_IActivationFactory(iface); + struct api_information_statics *impl = impl_ais_from_IActivationFactory(iface); ULONG ref = InterlockedDecrement(&impl->ref); TRACE("iface %p, ref %lu.\n", iface, ref); return ref; }
-static HRESULT STDMETHODCALLTYPE wintypes_GetIids(IActivationFactory *iface, ULONG *iid_count, +static HRESULT STDMETHODCALLTYPE api_information_statics_factory_GetIids(IActivationFactory *iface, ULONG *iid_count, IID **iids) { FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); return E_NOTIMPL; }
-static HRESULT STDMETHODCALLTYPE wintypes_GetRuntimeClassName(IActivationFactory *iface, +static HRESULT STDMETHODCALLTYPE api_information_statics_factory_GetRuntimeClassName(IActivationFactory *iface, HSTRING *class_name) { FIXME("iface %p, class_name %p stub!\n", iface, class_name); return E_NOTIMPL; }
-static HRESULT STDMETHODCALLTYPE wintypes_GetTrustLevel(IActivationFactory *iface, +static HRESULT STDMETHODCALLTYPE api_information_statics_factory_GetTrustLevel(IActivationFactory *iface, TrustLevel *trust_level) { FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); return E_NOTIMPL; }
-static HRESULT STDMETHODCALLTYPE wintypes_ActivateInstance(IActivationFactory *iface, +static HRESULT STDMETHODCALLTYPE api_information_statics_factory_ActivateInstance(IActivationFactory *iface, IInspectable **instance) { FIXME("iface %p, instance %p stub!\n", iface, instance); return E_NOTIMPL; }
-static const struct IActivationFactoryVtbl activation_factory_vtbl = +static const struct IActivationFactoryVtbl api_information_statics_factory_vtbl = { - wintypes_QueryInterface, - wintypes_AddRef, - wintypes_Release, + api_information_statics_factory_QueryInterface, + api_information_statics_factory_AddRef, + api_information_statics_factory_Release, /* IInspectable methods */ - wintypes_GetIids, - wintypes_GetRuntimeClassName, - wintypes_GetTrustLevel, + api_information_statics_factory_GetIids, + api_information_statics_factory_GetRuntimeClassName, + api_information_statics_factory_GetTrustLevel, /* IActivationFactory methods */ - wintypes_ActivateInstance, + api_information_statics_factory_ActivateInstance, };
-DEFINE_IINSPECTABLE(api_information_statics, IApiInformationStatics, struct wintypes, IActivationFactory_iface) +DEFINE_IINSPECTABLE(api_information_statics, IApiInformationStatics, struct api_information_statics, IActivationFactory_iface)
static HRESULT STDMETHODCALLTYPE api_information_statics_IsTypePresent( IApiInformationStatics *iface, HSTRING type_name, BOOLEAN *value) @@ -311,6 +303,111 @@ static const struct IApiInformationStaticsVtbl api_information_statics_vtbl = api_information_statics_IsApiContractPresentByMajorAndMinor };
+static struct api_information_statics api_information_statics = +{ + {&api_information_statics_factory_vtbl}, + {&api_information_statics_vtbl}, + 1 +}; + +struct property_value_statics +{ + IActivationFactory IActivationFactory_iface; + IPropertyValueStatics IPropertyValueStatics_iface; + LONG ref; +}; + +static inline struct property_value_statics *impl_pvs_from_IActivationFactory(IActivationFactory *iface) +{ + return CONTAINING_RECORD(iface, struct property_value_statics, IActivationFactory_iface); +} + +static HRESULT STDMETHODCALLTYPE property_value_statics_factory_QueryInterface(IActivationFactory *iface, REFIID iid, + void **out) +{ + struct property_value_statics *impl = impl_pvs_from_IActivationFactory(iface); + + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) + || IsEqualGUID(iid, &IID_IInspectable) + || IsEqualGUID(iid, &IID_IAgileObject) + || IsEqualGUID(iid, &IID_IActivationFactory)) + { + IUnknown_AddRef(iface); + *out = iface; + return S_OK; + } + + if (IsEqualGUID(iid, &IID_IPropertyValueStatics)) + { + IUnknown_AddRef(iface); + *out = &impl->IPropertyValueStatics_iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE property_value_statics_factory_AddRef(IActivationFactory *iface) +{ + struct property_value_statics *impl = impl_pvs_from_IActivationFactory(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p, ref %lu.\n", iface, ref); + return ref; +} + +static ULONG STDMETHODCALLTYPE property_value_statics_factory_Release(IActivationFactory *iface) +{ + struct property_value_statics *impl = impl_pvs_from_IActivationFactory(iface); + ULONG ref = InterlockedDecrement(&impl->ref); + TRACE("iface %p, ref %lu.\n", iface, ref); + return ref; +} + +static HRESULT STDMETHODCALLTYPE property_value_statics_factory_GetIids(IActivationFactory *iface, ULONG *iid_count, + IID **iids) +{ + FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE property_value_statics_factory_GetRuntimeClassName(IActivationFactory *iface, + HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE property_value_statics_factory_GetTrustLevel(IActivationFactory *iface, + TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE property_value_statics_factory_ActivateInstance(IActivationFactory *iface, + IInspectable **instance) +{ + FIXME("iface %p, instance %p stub!\n", iface, instance); + return E_NOTIMPL; +} + +static const struct IActivationFactoryVtbl property_value_statics_factory_vtbl = +{ + property_value_statics_factory_QueryInterface, + property_value_statics_factory_AddRef, + property_value_statics_factory_Release, + /* IInspectable methods */ + property_value_statics_factory_GetIids, + property_value_statics_factory_GetRuntimeClassName, + property_value_statics_factory_GetTrustLevel, + /* IActivationFactory methods */ + property_value_statics_factory_ActivateInstance, +}; + struct property_value { IPropertyValue IPropertyValue_iface; @@ -865,7 +962,7 @@ static const struct IReference_DOUBLEVtbl iref_double_vtbl = iref_double_get_Value, };
-DEFINE_IINSPECTABLE(property_value_statics, IPropertyValueStatics, struct wintypes, IActivationFactory_iface) +DEFINE_IINSPECTABLE(property_value_statics, IPropertyValueStatics, struct property_value_statics, IActivationFactory_iface)
static HRESULT STDMETHODCALLTYPE property_value_statics_CreateEmpty(IPropertyValueStatics *iface, IInspectable **property_value) @@ -1197,10 +1294,9 @@ static const struct IPropertyValueStaticsVtbl property_value_statics_vtbl = property_value_statics_CreateRectArray, };
-static struct wintypes wintypes = +static struct property_value_statics property_value_statics = { - {&activation_factory_vtbl}, - {&api_information_statics_vtbl}, + {&property_value_statics_factory_vtbl}, {&property_value_statics_vtbl}, 1 }; @@ -1213,10 +1309,19 @@ HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out)
HRESULT WINAPI DllGetActivationFactory(HSTRING classid, IActivationFactory **factory) { + const WCHAR *buffer = WindowsGetStringRawBuffer(classid, NULL); + TRACE("classid %s, factory %p.\n", debugstr_hstring(classid), factory); - *factory = &wintypes.IActivationFactory_iface; - IUnknown_AddRef(*factory); - return S_OK; + + *factory = NULL; + + if (!wcscmp(buffer, L"Windows.Foundation.Metadata.ApiInformation")) + IActivationFactory_AddRef((*factory = &api_information_statics.IActivationFactory_iface)); + if (!wcscmp(buffer, L"Windows.Foundation.PropertyValue")) + IActivationFactory_AddRef((*factory = &property_value_statics.IActivationFactory_iface)); + + if (*factory) return S_OK; + return CLASS_E_CLASSNOTAVAILABLE; }
HRESULT WINAPI RoIsApiContractMajorVersionPresent(const WCHAR *name, UINT16 major, BOOL *result) diff --git a/dlls/wintypes/tests/wintypes.c b/dlls/wintypes/tests/wintypes.c index b7948f7cf18..28f87b1c512 100644 --- a/dlls/wintypes/tests/wintypes.c +++ b/dlls/wintypes/tests/wintypes.c @@ -72,7 +72,7 @@ static void test_interfaces(void) check_interface(factory, &IID_IAgileObject, TRUE); check_interface(factory, &IID_IActivationFactory, TRUE); check_interface(factory, &IID_IApiInformationStatics, TRUE); - todo_wine check_interface(factory, &IID_IPropertyValueStatics, FALSE); + check_interface(factory, &IID_IPropertyValueStatics, FALSE); IActivationFactory_Release(factory); } else @@ -88,7 +88,7 @@ static void test_interfaces(void) check_interface(factory, &IID_IInspectable, TRUE); check_interface(factory, &IID_IAgileObject, TRUE); check_interface(factory, &IID_IActivationFactory, TRUE); - todo_wine check_interface(factory, &IID_IApiInformationStatics, FALSE); + check_interface(factory, &IID_IApiInformationStatics, FALSE); check_interface(factory, &IID_IPropertyValueStatics, TRUE); IActivationFactory_Release(factory); WindowsDeleteString(str);
From: Jactry Zeng jzeng@codeweavers.com
--- dlls/wintypes/Makefile.in | 1 + dlls/wintypes/classes.idl | 1 + dlls/wintypes/main.c | 19 +----- dlls/wintypes/private.h | 39 +++++++++++ dlls/wintypes/storage.c | 118 +++++++++++++++++++++++++++++++++ dlls/wintypes/tests/wintypes.c | 38 +++++++++++ 6 files changed, 200 insertions(+), 16 deletions(-) create mode 100644 dlls/wintypes/private.h create mode 100644 dlls/wintypes/storage.c
diff --git a/dlls/wintypes/Makefile.in b/dlls/wintypes/Makefile.in index b8958cdcd15..840f47abd17 100644 --- a/dlls/wintypes/Makefile.in +++ b/dlls/wintypes/Makefile.in @@ -5,4 +5,5 @@ IMPORTS = combase SOURCES = \ classes.idl \ main.c \ + storage.c \ wintypes_private.idl diff --git a/dlls/wintypes/classes.idl b/dlls/wintypes/classes.idl index 116c764fe6e..648eafddc16 100644 --- a/dlls/wintypes/classes.idl +++ b/dlls/wintypes/classes.idl @@ -28,3 +28,4 @@ #define _WINTYPES #include "windows.foundation.idl" #include "windows.foundation.metadata.idl" +#include "windows.storage.streams.idl" diff --git a/dlls/wintypes/main.c b/dlls/wintypes/main.c index 3fc82c9693d..79540cac3ee 100644 --- a/dlls/wintypes/main.c +++ b/dlls/wintypes/main.c @@ -16,23 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <stdarg.h> - -#define COBJMACROS #include "initguid.h" -#include "windef.h" -#include "winbase.h" -#include "winstring.h" -#include "wine/debug.h" -#include "objbase.h" - -#include "activation.h" -#include "rometadataresolution.h" - -#define WIDL_using_Windows_Foundation -#define WIDL_using_Windows_Foundation_Metadata -#include "windows.foundation.metadata.h" -#include "wintypes_private.h" +#include "private.h"
WINE_DEFAULT_DEBUG_CHANNEL(wintypes);
@@ -1319,6 +1304,8 @@ HRESULT WINAPI DllGetActivationFactory(HSTRING classid, IActivationFactory **fac IActivationFactory_AddRef((*factory = &api_information_statics.IActivationFactory_iface)); if (!wcscmp(buffer, L"Windows.Foundation.PropertyValue")) IActivationFactory_AddRef((*factory = &property_value_statics.IActivationFactory_iface)); + if (!wcscmp(buffer, L"Windows.Storage.Streams.DataWriter")) + IActivationFactory_AddRef((*factory = data_writer_activation_factory));
if (*factory) return S_OK; return CLASS_E_CLASSNOTAVAILABLE; diff --git a/dlls/wintypes/private.h b/dlls/wintypes/private.h new file mode 100644 index 00000000000..34b69e61b82 --- /dev/null +++ b/dlls/wintypes/private.h @@ -0,0 +1,39 @@ +/* + * Copyright 2022-2024 Zhiyi Zhang for CodeWeavers + * Copyright 2025 Jactry Zeng for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" +#include "winstring.h" +#include "wine/debug.h" +#include "objbase.h" + +#include "activation.h" +#include "rometadataresolution.h" + +#define WIDL_using_Windows_Foundation +#define WIDL_using_Windows_Foundation_Metadata +#include "windows.foundation.metadata.h" +#define WIDL_using_Windows_Storage_Streams +#include "windows.storage.streams.h" +#include "wintypes_private.h" + +extern IActivationFactory *data_writer_activation_factory; diff --git a/dlls/wintypes/storage.c b/dlls/wintypes/storage.c new file mode 100644 index 00000000000..b09d8036abc --- /dev/null +++ b/dlls/wintypes/storage.c @@ -0,0 +1,118 @@ +/* + * Copyright 2022-2024 Zhiyi Zhang for CodeWeavers + * Copyright 2025 Jactry Zeng for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wintypes); + +struct data_writer +{ + IActivationFactory IActivationFactory_iface; + LONG ref; +}; + +static inline struct data_writer *impl_data_writer_from_IActivationFactory(IActivationFactory *iface) +{ + return CONTAINING_RECORD(iface, struct data_writer, IActivationFactory_iface); +} + +static HRESULT STDMETHODCALLTYPE data_writer_activation_factory_QueryInterface(IActivationFactory *iface, REFIID iid, + void **out) +{ + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) + || IsEqualGUID(iid, &IID_IInspectable) + || IsEqualGUID(iid, &IID_IAgileObject) + || IsEqualGUID(iid, &IID_IActivationFactory)) + { + IUnknown_AddRef(iface); + *out = iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE data_writer_activation_factory_AddRef(IActivationFactory *iface) +{ + struct data_writer *impl = impl_data_writer_from_IActivationFactory(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p, ref %lu.\n", iface, ref); + return ref; +} + +static ULONG STDMETHODCALLTYPE data_writer_activation_factory_Release(IActivationFactory *iface) +{ + struct data_writer *impl = impl_data_writer_from_IActivationFactory(iface); + ULONG ref = InterlockedDecrement(&impl->ref); + TRACE("iface %p, ref %lu.\n", iface, ref); + return ref; +} + +static HRESULT STDMETHODCALLTYPE data_writer_activation_factory_GetIids(IActivationFactory *iface, ULONG *iid_count, + IID **iids) +{ + FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE data_writer_activation_factory_GetRuntimeClassName(IActivationFactory *iface, + HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE data_writer_activation_factory_GetTrustLevel(IActivationFactory *iface, + TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE data_writer_activation_factory_ActivateInstance(IActivationFactory *iface, + IInspectable **instance) +{ + FIXME("iface %p, instance %p stub!\n", iface, instance); + return E_NOTIMPL; +} + +static const struct IActivationFactoryVtbl data_writer_activation_factory_vtbl = +{ + data_writer_activation_factory_QueryInterface, + data_writer_activation_factory_AddRef, + data_writer_activation_factory_Release, + /* IInspectable methods */ + data_writer_activation_factory_GetIids, + data_writer_activation_factory_GetRuntimeClassName, + data_writer_activation_factory_GetTrustLevel, + /* IActivationFactory methods */ + data_writer_activation_factory_ActivateInstance, +}; + +struct data_writer data_writer = +{ + {&data_writer_activation_factory_vtbl}, + 1 +}; + +IActivationFactory *data_writer_activation_factory = &data_writer.IActivationFactory_iface; diff --git a/dlls/wintypes/tests/wintypes.c b/dlls/wintypes/tests/wintypes.c index 28f87b1c512..3c46cca1c68 100644 --- a/dlls/wintypes/tests/wintypes.c +++ b/dlls/wintypes/tests/wintypes.c @@ -32,6 +32,9 @@ #include "windows.foundation.metadata.h" #include "wintypes_test.h"
+#define WIDL_using_Windows_Storage_Streams +#include "windows.storage.streams.h" + #include "wine/test.h"
static BOOL is_wow64; @@ -54,6 +57,7 @@ static void test_interfaces(void) { static WCHAR class_name[1024]; IActivationFactory *factory; + IUnknown *unk; HSTRING str; HRESULT hr;
@@ -93,6 +97,40 @@ static void test_interfaces(void) IActivationFactory_Release(factory); WindowsDeleteString(str);
+ wcscpy(class_name, L"Windows.Storage.Streams.DataWriter"); + hr = WindowsCreateString(class_name, wcslen(class_name), &str); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = RoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + check_interface(factory, &IID_IUnknown, TRUE); + check_interface(factory, &IID_IInspectable, TRUE); + check_interface(factory, &IID_IAgileObject, TRUE); + check_interface(factory, &IID_IActivationFactory, TRUE); + todo_wine check_interface(factory, &IID_IDataWriterFactory, TRUE); + check_interface(factory, &IID_IRandomAccessStreamReferenceStatics, FALSE); + check_interface(factory, &IID_IApiInformationStatics, FALSE); + check_interface(factory, &IID_IPropertyValueStatics, FALSE); + IActivationFactory_Release(factory); + WindowsDeleteString(str); + + wcscpy(class_name, L"Windows.Storage.Streams.RandomAccessStreamReference"); + hr = WindowsCreateString(class_name, wcslen(class_name), &str); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = RoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory); + todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); + check_interface(factory, &IID_IUnknown, TRUE); + check_interface(factory, &IID_IInspectable, TRUE); + hr = IActivationFactory_QueryInterface(factory, &IID_IAgileObject, (void **)&unk); + ok(hr == S_OK || broken(hr == E_NOINTERFACE) /* pre win10 v1809 */, "Got hr %#lx.\n", hr); + if (SUCCEEDED(hr)) IUnknown_Release(unk); + check_interface(factory, &IID_IActivationFactory, TRUE); + check_interface(factory, &IID_IDataWriterFactory, FALSE); + todo_wine check_interface(factory, &IID_IRandomAccessStreamReferenceStatics, TRUE); + check_interface(factory, &IID_IApiInformationStatics, FALSE); + check_interface(factory, &IID_IPropertyValueStatics, FALSE); + IActivationFactory_Release(factory); + WindowsDeleteString(str); + RoUninitialize(); }
From: Jactry Zeng jzeng@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55155 --- dlls/wintypes/storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wintypes/storage.c b/dlls/wintypes/storage.c index b09d8036abc..096307ed93e 100644 --- a/dlls/wintypes/storage.c +++ b/dlls/wintypes/storage.c @@ -93,7 +93,7 @@ static HRESULT STDMETHODCALLTYPE data_writer_activation_factory_ActivateInstance IInspectable **instance) { FIXME("iface %p, instance %p stub!\n", iface, instance); - return E_NOTIMPL; + return S_OK; }
static const struct IActivationFactoryVtbl data_writer_activation_factory_vtbl =
From: Jactry Zeng jzeng@codeweavers.com
--- dlls/wintypes/main.c | 2 + dlls/wintypes/private.h | 1 + dlls/wintypes/storage.c | 96 ++++++++++++++++++++++++++++++++++ dlls/wintypes/tests/wintypes.c | 2 +- 4 files changed, 100 insertions(+), 1 deletion(-)
diff --git a/dlls/wintypes/main.c b/dlls/wintypes/main.c index 79540cac3ee..79b4e57cc22 100644 --- a/dlls/wintypes/main.c +++ b/dlls/wintypes/main.c @@ -1306,6 +1306,8 @@ HRESULT WINAPI DllGetActivationFactory(HSTRING classid, IActivationFactory **fac IActivationFactory_AddRef((*factory = &property_value_statics.IActivationFactory_iface)); if (!wcscmp(buffer, L"Windows.Storage.Streams.DataWriter")) IActivationFactory_AddRef((*factory = data_writer_activation_factory)); + if (!wcscmp(buffer, L"Windows.Storage.Streams.RandomAccessStreamReference")) + IActivationFactory_AddRef((*factory = stream_reference_statics_activation_factory));
if (*factory) return S_OK; return CLASS_E_CLASSNOTAVAILABLE; diff --git a/dlls/wintypes/private.h b/dlls/wintypes/private.h index 34b69e61b82..96265e735a8 100644 --- a/dlls/wintypes/private.h +++ b/dlls/wintypes/private.h @@ -37,3 +37,4 @@ #include "wintypes_private.h"
extern IActivationFactory *data_writer_activation_factory; +extern IActivationFactory *stream_reference_statics_activation_factory; diff --git a/dlls/wintypes/storage.c b/dlls/wintypes/storage.c index 096307ed93e..fc46ab49bb3 100644 --- a/dlls/wintypes/storage.c +++ b/dlls/wintypes/storage.c @@ -116,3 +116,99 @@ struct data_writer data_writer = };
IActivationFactory *data_writer_activation_factory = &data_writer.IActivationFactory_iface; + +struct stream_reference_statics +{ + IActivationFactory IActivationFactory_iface; + LONG ref; +}; + +static inline struct stream_reference_statics *impl_stream_reference_statics_from_IActivationFactory(IActivationFactory *iface) +{ + return CONTAINING_RECORD(iface, struct stream_reference_statics, IActivationFactory_iface); +} + +static HRESULT STDMETHODCALLTYPE stream_reference_statics_activation_factory_QueryInterface(IActivationFactory *iface, + REFIID iid, void **out) +{ + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) + || IsEqualGUID(iid, &IID_IInspectable) + || IsEqualGUID(iid, &IID_IAgileObject) + || IsEqualGUID(iid, &IID_IActivationFactory)) + { + IUnknown_AddRef(iface); + *out = iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE stream_reference_statics_activation_factory_AddRef(IActivationFactory *iface) +{ + struct stream_reference_statics *impl = impl_stream_reference_statics_from_IActivationFactory(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p, ref %lu.\n", iface, ref); + return ref; +} + +static ULONG STDMETHODCALLTYPE stream_reference_statics_activation_factory_Release(IActivationFactory *iface) +{ + struct stream_reference_statics *impl = impl_stream_reference_statics_from_IActivationFactory(iface); + ULONG ref = InterlockedDecrement(&impl->ref); + TRACE("iface %p, ref %lu.\n", iface, ref); + return ref; +} + +static HRESULT STDMETHODCALLTYPE stream_reference_statics_activation_factory_GetIids(IActivationFactory *iface, + ULONG *iid_count, IID **iids) +{ + FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE stream_reference_statics_activation_factory_GetRuntimeClassName(IActivationFactory *iface, + HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE stream_reference_statics_activation_factory_GetTrustLevel(IActivationFactory *iface, + TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE stream_reference_statics_activation_factory_ActivateInstance(IActivationFactory *iface, + IInspectable **instance) +{ + FIXME("iface %p, instance %p stub!\n", iface, instance); + return S_OK; +} + +static const struct IActivationFactoryVtbl stream_reference_statics_activation_factory_vtbl = +{ + stream_reference_statics_activation_factory_QueryInterface, + stream_reference_statics_activation_factory_AddRef, + stream_reference_statics_activation_factory_Release, + /* IInspectable methods */ + stream_reference_statics_activation_factory_GetIids, + stream_reference_statics_activation_factory_GetRuntimeClassName, + stream_reference_statics_activation_factory_GetTrustLevel, + /* IActivationFactory methods */ + stream_reference_statics_activation_factory_ActivateInstance, +}; + +struct stream_reference_statics stream_reference_statics = +{ + {&stream_reference_statics_activation_factory_vtbl}, + 1 +}; + +IActivationFactory *stream_reference_statics_activation_factory = &stream_reference_statics.IActivationFactory_iface; diff --git a/dlls/wintypes/tests/wintypes.c b/dlls/wintypes/tests/wintypes.c index 3c46cca1c68..497271763d8 100644 --- a/dlls/wintypes/tests/wintypes.c +++ b/dlls/wintypes/tests/wintypes.c @@ -117,7 +117,7 @@ static void test_interfaces(void) hr = WindowsCreateString(class_name, wcslen(class_name), &str); ok(hr == S_OK, "Got hr %#lx.\n", hr); hr = RoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(hr == S_OK, "Got hr %#lx.\n", hr); check_interface(factory, &IID_IUnknown, TRUE); check_interface(factory, &IID_IInspectable, TRUE); hr = IActivationFactory_QueryInterface(factory, &IID_IAgileObject, (void **)&unk);
From: Jactry Zeng jzeng@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55155 --- dlls/wintypes/private.h | 2 + dlls/wintypes/storage.c | 92 ++++++++++++++++++++++++++++++++++ dlls/wintypes/tests/wintypes.c | 2 +- 3 files changed, 95 insertions(+), 1 deletion(-)
diff --git a/dlls/wintypes/private.h b/dlls/wintypes/private.h index 96265e735a8..d01c4f630a0 100644 --- a/dlls/wintypes/private.h +++ b/dlls/wintypes/private.h @@ -32,7 +32,9 @@ #define WIDL_using_Windows_Foundation #define WIDL_using_Windows_Foundation_Metadata #include "windows.foundation.metadata.h" +#define WIDL_using_Windows_Storage #define WIDL_using_Windows_Storage_Streams +#include "windows.media.h" #include "windows.storage.streams.h" #include "wintypes_private.h"
diff --git a/dlls/wintypes/storage.c b/dlls/wintypes/storage.c index fc46ab49bb3..97ba7d9810d 100644 --- a/dlls/wintypes/storage.c +++ b/dlls/wintypes/storage.c @@ -120,6 +120,7 @@ IActivationFactory *data_writer_activation_factory = &data_writer.IActivationFac struct stream_reference_statics { IActivationFactory IActivationFactory_iface; + IRandomAccessStreamReferenceStatics IRandomAccessStreamReferenceStatics_iface; LONG ref; };
@@ -128,9 +129,16 @@ static inline struct stream_reference_statics *impl_stream_reference_statics_fro return CONTAINING_RECORD(iface, struct stream_reference_statics, IActivationFactory_iface); }
+static inline struct stream_reference_statics *impl_stream_reference_statics_from_IRandomAccessStreamReferenceStatics(IRandomAccessStreamReferenceStatics *iface) +{ + return CONTAINING_RECORD(iface, struct stream_reference_statics, IRandomAccessStreamReferenceStatics_iface); +} + static HRESULT STDMETHODCALLTYPE stream_reference_statics_activation_factory_QueryInterface(IActivationFactory *iface, REFIID iid, void **out) { + struct stream_reference_statics *impl = impl_stream_reference_statics_from_IActivationFactory(iface); + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
if (IsEqualGUID(iid, &IID_IUnknown) @@ -142,6 +150,12 @@ static HRESULT STDMETHODCALLTYPE stream_reference_statics_activation_factory_Que *out = iface; return S_OK; } + else if (IsEqualGUID(iid, &IID_IRandomAccessStreamReferenceStatics)) + { + IUnknown_AddRef(iface); + *out = &impl->IRandomAccessStreamReferenceStatics_iface; + return S_OK; + }
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); *out = NULL; @@ -205,9 +219,87 @@ static const struct IActivationFactoryVtbl stream_reference_statics_activation_f stream_reference_statics_activation_factory_ActivateInstance, };
+static HRESULT STDMETHODCALLTYPE stream_reference_statics_statics_QueryInterface(IRandomAccessStreamReferenceStatics *iface, + REFIID iid, void **out) +{ + struct stream_reference_statics *impl = impl_stream_reference_statics_from_IRandomAccessStreamReferenceStatics(iface); + return IActivationFactory_QueryInterface(&impl->IActivationFactory_iface, iid, out); +} + +static ULONG STDMETHODCALLTYPE stream_reference_statics_statics_AddRef(IRandomAccessStreamReferenceStatics *iface) +{ + struct stream_reference_statics *impl = impl_stream_reference_statics_from_IRandomAccessStreamReferenceStatics(iface); + return IActivationFactory_AddRef(&impl->IActivationFactory_iface); +} + +static ULONG STDMETHODCALLTYPE stream_reference_statics_statics_Release(IRandomAccessStreamReferenceStatics *iface) +{ + struct stream_reference_statics *impl = impl_stream_reference_statics_from_IRandomAccessStreamReferenceStatics(iface); + return IActivationFactory_Release(&impl->IActivationFactory_iface); +} + +static HRESULT STDMETHODCALLTYPE stream_reference_statics_statics_GetIids(IRandomAccessStreamReferenceStatics *iface, + ULONG *iid_count, IID **iids) +{ + FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE stream_reference_statics_statics_GetRuntimeClassName(IRandomAccessStreamReferenceStatics *iface, + HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE stream_reference_statics_statics_GetTrustLevel(IRandomAccessStreamReferenceStatics *iface, + TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE stream_reference_statics_statics_CreateFromFile(IRandomAccessStreamReferenceStatics *iface, + IStorageFile *file, IRandomAccessStreamReference **stream_reference_statics) +{ + FIXME("iface %p, file %p, reference %p stub!\n", iface, file, stream_reference_statics); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE stream_reference_statics_statics_CreateFromUri(IRandomAccessStreamReferenceStatics *iface, + IUriRuntimeClass *uri, IRandomAccessStreamReference **stream_reference_statics) +{ + FIXME("iface %p, uri %p, reference %p stub!\n", iface, uri, stream_reference_statics); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE stream_reference_statics_statics_CreateFromStream(IRandomAccessStreamReferenceStatics *iface, + IRandomAccessStream *stream, + IRandomAccessStreamReference **stream_reference_statics) +{ + FIXME("iface %p, stream %p, reference %p stub!\n", iface, stream, stream_reference_statics); + return E_NOTIMPL; +} + +static const struct IRandomAccessStreamReferenceStaticsVtbl stream_reference_statics_statics_vtbl = +{ + stream_reference_statics_statics_QueryInterface, + stream_reference_statics_statics_AddRef, + stream_reference_statics_statics_Release, + /* IInspectable methods */ + stream_reference_statics_statics_GetIids, + stream_reference_statics_statics_GetRuntimeClassName, + stream_reference_statics_statics_GetTrustLevel, + /* IRandomAccessStreamReferenceStatics */ + stream_reference_statics_statics_CreateFromFile, + stream_reference_statics_statics_CreateFromUri, + stream_reference_statics_statics_CreateFromStream +}; + struct stream_reference_statics stream_reference_statics = { {&stream_reference_statics_activation_factory_vtbl}, + {&stream_reference_statics_statics_vtbl}, 1 };
diff --git a/dlls/wintypes/tests/wintypes.c b/dlls/wintypes/tests/wintypes.c index 497271763d8..295a62ef874 100644 --- a/dlls/wintypes/tests/wintypes.c +++ b/dlls/wintypes/tests/wintypes.c @@ -125,7 +125,7 @@ static void test_interfaces(void) if (SUCCEEDED(hr)) IUnknown_Release(unk); check_interface(factory, &IID_IActivationFactory, TRUE); check_interface(factory, &IID_IDataWriterFactory, FALSE); - todo_wine check_interface(factory, &IID_IRandomAccessStreamReferenceStatics, TRUE); + check_interface(factory, &IID_IRandomAccessStreamReferenceStatics, TRUE); check_interface(factory, &IID_IApiInformationStatics, FALSE); check_interface(factory, &IID_IPropertyValueStatics, FALSE); IActivationFactory_Release(factory);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=151024
Your paranoid android.
=== debian11b (64 bit WoW report) ===
user32: input.c:4306: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 0000000001A400EC, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032