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);