Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55759
-- v3: windows.system.profile.systemid: Implement ISystemIdentificationInfo::get_Source(). windows.system.profile.systemid/tests: Add ISystemIdentificationInfo::get_Source() tests. windows.system.profile.systemid: Partially implement ISystemIdentificationStatics::GetSystemIdForPublisher().
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/twinapi.appcore/classes.idl | 1 + include/windows.system.profile.idl | 59 +++++++++++++++++++++++++++++- 2 files changed, 59 insertions(+), 1 deletion(-)
diff --git a/dlls/twinapi.appcore/classes.idl b/dlls/twinapi.appcore/classes.idl index 8a57c8bcaeb..e846c523e9e 100644 --- a/dlls/twinapi.appcore/classes.idl +++ b/dlls/twinapi.appcore/classes.idl @@ -28,6 +28,7 @@ import "eventtoken.idl"; import "windowscontracts.idl"; import "windows.foundation.idl"; import "windows.globalization.idl"; +import "windows.storage.streams.idl";
#define DO_NO_IMPORTS #define _TWINAPI_APPCORE diff --git a/include/windows.system.profile.idl b/include/windows.system.profile.idl index 90a561ced07..ef99a8af730 100644 --- a/include/windows.system.profile.idl +++ b/include/windows.system.profile.idl @@ -31,13 +31,27 @@ import "windows.system.idl"; #endif
namespace Windows.System.Profile { - + typedef enum SystemIdentificationSource SystemIdentificationSource; interface IAnalyticsInfoStatics; interface IAnalyticsInfoStatics2; interface IAnalyticsVersionInfo; interface IAnalyticsVersionInfo2; + interface ISystemIdentificationInfo; + interface ISystemIdentificationStatics; runtimeclass AnalyticsVersionInfo; runtimeclass AnalyticsInfo; + runtimeclass SystemIdentification; + runtimeclass SystemIdentificationInfo; + + [contract(Windows.Foundation.UniversalApiContract, 3.0)] + enum SystemIdentificationSource + { + None = 0, + Tpm = 1, + Uefi = 2, + [contract(Windows.Foundation.UniversalApiContract, 5.0)] + Registry = 3, + };
[ contract(Windows.Foundation.UniversalApiContract, 1.0), @@ -61,6 +75,28 @@ namespace Windows.System.Profile { [propget] HRESULT DeviceFamilyVersion([out, retval] HSTRING *value); }
+ [ + contract(Windows.Foundation.UniversalApiContract, 3.0), + exclusiveto(Windows.System.Profile.SystemIdentificationInfo), + uuid(0c659e7d-c3c2-4d33-a2df-21bc41916eb3) + ] + interface ISystemIdentificationInfo : IInspectable + { + [propget] HRESULT Id([out, retval] Windows.Storage.Streams.IBuffer **value); + [propget] HRESULT Source([out, retval] Windows.System.Profile.SystemIdentificationSource *value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 3.0), + exclusiveto(Windows.System.Profile.SystemIdentification), + uuid(5581f42a-d3df-4d93-a37d-c41a616c6d01) + ] + interface ISystemIdentificationStatics : IInspectable + { + HRESULT GetSystemIdForPublisher([out, retval] Windows.System.Profile.SystemIdentificationInfo **result); + HRESULT GetSystemIdForUser([in] Windows.System.User *user, [out, retval] Windows.System.Profile.SystemIdentificationInfo **result); + } + [ contract(Windows.Foundation.UniversalApiContract, 1.0), marshaling_behavior(agile), @@ -83,4 +119,25 @@ namespace Windows.System.Profile { { }
+#ifndef _TWINAPI_APPCORE + [ + contract(Windows.Foundation.UniversalApiContract, 3.0), + marshaling_behavior(agile), + static(Windows.System.Profile.ISystemIdentificationStatics, Windows.Foundation.UniversalApiContract, 3.0), + threading(both) + ] + runtimeclass SystemIdentification + { + } + + [ + contract(Windows.Foundation.UniversalApiContract, 3.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass SystemIdentificationInfo + { + [default] interface Windows.System.Profile.ISystemIdentificationInfo; + } +#endif }
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- configure.ac | 2 + .../Makefile.in | 6 + .../classes.idl | 24 ++++ dlls/windows.system.profile.systemid/main.c | 136 ++++++++++++++++++ .../windows.system.profile.systemid/private.h | 33 +++++ .../tests/Makefile.in | 5 + .../tests/systemid.c | 83 +++++++++++ .../windows.system.profile.systemid.spec | 3 + include/windows.system.profile.idl | 2 + 9 files changed, 294 insertions(+) create mode 100644 dlls/windows.system.profile.systemid/Makefile.in create mode 100644 dlls/windows.system.profile.systemid/classes.idl create mode 100644 dlls/windows.system.profile.systemid/main.c create mode 100644 dlls/windows.system.profile.systemid/private.h create mode 100644 dlls/windows.system.profile.systemid/tests/Makefile.in create mode 100644 dlls/windows.system.profile.systemid/tests/systemid.c create mode 100644 dlls/windows.system.profile.systemid/windows.system.profile.systemid.spec
diff --git a/configure.ac b/configure.ac index 306cbe03146..91137b86484 100644 --- a/configure.ac +++ b/configure.ac @@ -3256,6 +3256,8 @@ WINE_CONFIG_MAKEFILE(dlls/windows.storage.applicationdata) WINE_CONFIG_MAKEFILE(dlls/windows.storage.applicationdata/tests) WINE_CONFIG_MAKEFILE(dlls/windows.storage) WINE_CONFIG_MAKEFILE(dlls/windows.storage/tests) +WINE_CONFIG_MAKEFILE(dlls/windows.system.profile.systemid) +WINE_CONFIG_MAKEFILE(dlls/windows.system.profile.systemid/tests) WINE_CONFIG_MAKEFILE(dlls/windows.system.profile.systemmanufacturers) WINE_CONFIG_MAKEFILE(dlls/windows.system.profile.systemmanufacturers/tests) WINE_CONFIG_MAKEFILE(dlls/windows.ui.xaml) diff --git a/dlls/windows.system.profile.systemid/Makefile.in b/dlls/windows.system.profile.systemid/Makefile.in new file mode 100644 index 00000000000..d6b490e4784 --- /dev/null +++ b/dlls/windows.system.profile.systemid/Makefile.in @@ -0,0 +1,6 @@ +MODULE = windows.system.profile.systemid.dll +IMPORTS = combase + +SOURCES = \ + classes.idl \ + main.c diff --git a/dlls/windows.system.profile.systemid/classes.idl b/dlls/windows.system.profile.systemid/classes.idl new file mode 100644 index 00000000000..f143f50f092 --- /dev/null +++ b/dlls/windows.system.profile.systemid/classes.idl @@ -0,0 +1,24 @@ +/* + * Runtime Classes for windows.system.profile.systemid.dll + * + * Copyright (C) 2025 Mohamad Al-Jaf + * + * 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 + */ + +#pragma makedep register + +#define _WINDOWS_SYSTEM_PROFILE_SYSTEM_ID +#include "windows.system.profile.idl" diff --git a/dlls/windows.system.profile.systemid/main.c b/dlls/windows.system.profile.systemid/main.c new file mode 100644 index 00000000000..af55ea204d3 --- /dev/null +++ b/dlls/windows.system.profile.systemid/main.c @@ -0,0 +1,136 @@ +/* WinRT Windows.System.Profile.SystemIdentification Implementation + * + * Copyright (C) 2025 Mohamad Al-Jaf + * + * 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 "initguid.h" +#include "private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(systemid); + +struct system_id_statics +{ + IActivationFactory IActivationFactory_iface; + LONG ref; +}; + +static inline struct system_id_statics *impl_from_IActivationFactory( IActivationFactory *iface ) +{ + return CONTAINING_RECORD( iface, struct system_id_statics, IActivationFactory_iface ); +} + +static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID iid, void **out ) +{ + struct system_id_statics *impl = impl_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_IActivationFactory )) + { + *out = &impl->IActivationFactory_iface; + IInspectable_AddRef( *out ); + return S_OK; + } + + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI factory_AddRef( IActivationFactory *iface ) +{ + struct system_id_statics *impl = impl_from_IActivationFactory( iface ); + ULONG ref = InterlockedIncrement( &impl->ref ); + TRACE( "iface %p, ref %lu.\n", iface, ref ); + return ref; +} + +static ULONG WINAPI factory_Release( IActivationFactory *iface ) +{ + struct system_id_statics *impl = impl_from_IActivationFactory( iface ); + ULONG ref = InterlockedDecrement( &impl->ref ); + TRACE( "iface %p, ref %lu.\n", iface, ref ); + return ref; +} + +static HRESULT WINAPI 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 WINAPI factory_GetRuntimeClassName( IActivationFactory *iface, HSTRING *class_name ) +{ + FIXME( "iface %p, class_name %p stub!\n", iface, class_name ); + return E_NOTIMPL; +} + +static HRESULT WINAPI factory_GetTrustLevel( IActivationFactory *iface, TrustLevel *trust_level ) +{ + FIXME( "iface %p, trust_level %p stub!\n", iface, trust_level ); + return E_NOTIMPL; +} + +static HRESULT WINAPI factory_ActivateInstance( IActivationFactory *iface, IInspectable **instance ) +{ + FIXME( "iface %p, instance %p stub!\n", iface, instance ); + return E_NOTIMPL; +} + +static const struct IActivationFactoryVtbl factory_vtbl = +{ + factory_QueryInterface, + factory_AddRef, + factory_Release, + /* IInspectable methods */ + factory_GetIids, + factory_GetRuntimeClassName, + factory_GetTrustLevel, + /* IActivationFactory methods */ + factory_ActivateInstance, +}; + +static struct system_id_statics system_id_statics = +{ + {&factory_vtbl}, + 1, +}; + +static IActivationFactory *system_id_factory = &system_id_statics.IActivationFactory_iface; + +HRESULT WINAPI DllGetClassObject( REFCLSID clsid, REFIID riid, void **out ) +{ + FIXME( "clsid %s, riid %s, out %p stub!\n", debugstr_guid( clsid ), debugstr_guid( riid ), out ); + return CLASS_E_CLASSNOTAVAILABLE; +} + +HRESULT WINAPI DllGetActivationFactory( HSTRING classid, IActivationFactory **factory ) +{ + const WCHAR *name = WindowsGetStringRawBuffer( classid, NULL ); + + TRACE( "classid %s, factory %p.\n", debugstr_hstring( classid ), factory ); + + *factory = NULL; + + if (!wcscmp( name, RuntimeClass_Windows_System_Profile_SystemIdentification )) + IActivationFactory_QueryInterface( system_id_factory, &IID_IActivationFactory, (void **)factory ); + + if (*factory) return S_OK; + return CLASS_E_CLASSNOTAVAILABLE; +} diff --git a/dlls/windows.system.profile.systemid/private.h b/dlls/windows.system.profile.systemid/private.h new file mode 100644 index 00000000000..b55020a999f --- /dev/null +++ b/dlls/windows.system.profile.systemid/private.h @@ -0,0 +1,33 @@ +/* WinRT windows.system.profile.systemid.dll Implementation + * + * Copyright (C) 2025 Mohamad Al-Jaf + * + * 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> +#include <stddef.h> + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" +#include "winstring.h" + +#include "activation.h" + +#include "wine/debug.h" + +#define WIDL_using_Windows_System_Profile +#include "windows.system.profile.h" diff --git a/dlls/windows.system.profile.systemid/tests/Makefile.in b/dlls/windows.system.profile.systemid/tests/Makefile.in new file mode 100644 index 00000000000..9ff4f9b472e --- /dev/null +++ b/dlls/windows.system.profile.systemid/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = windows.system.profile.systemid.dll +IMPORTS = combase + +SOURCES = \ + systemid.c diff --git a/dlls/windows.system.profile.systemid/tests/systemid.c b/dlls/windows.system.profile.systemid/tests/systemid.c new file mode 100644 index 00000000000..6e857bf331a --- /dev/null +++ b/dlls/windows.system.profile.systemid/tests/systemid.c @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2025 Mohamad Al-Jaf + * + * 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 + */ +#define COBJMACROS +#include "initguid.h" +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "winstring.h" + +#include "roapi.h" + +#define WIDL_using_Windows_System_Profile +#include "windows.system.profile.h" + +#include "wine/test.h" + +#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 ) +{ + IUnknown *iface = obj; + IUnknown *unk; + HRESULT hr; + + hr = IUnknown_QueryInterface( iface, iid, (void **)&unk ); + ok_(__FILE__, line)( hr == S_OK || (!supported && hr == E_NOINTERFACE), "got hr %#lx.\n", hr ); + if (SUCCEEDED(hr)) + IUnknown_Release( unk ); +} + +static void test_SystemIdentification_Statics(void) +{ + static const WCHAR *system_id_statics_name = L"Windows.System.Profile.SystemIdentification"; + IActivationFactory *factory = (void *)0xdeadbeef; + HSTRING str = NULL; + HRESULT hr; + LONG ref; + + hr = WindowsCreateString( system_id_statics_name, wcslen( system_id_statics_name ), &str ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + hr = RoGetActivationFactory( str, &IID_IActivationFactory, (void **)&factory ); + WindowsDeleteString( str ); + ok( hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG), "got hr %#lx.\n", hr ); + if (hr == REGDB_E_CLASSNOTREG) + { + win_skip( "%s runtimeclass not registered, skipping tests.\n", wine_dbgstr_w( system_id_statics_name ) ); + return; + } + + check_interface( factory, &IID_IUnknown, TRUE ); + check_interface( factory, &IID_IInspectable, TRUE ); + check_interface( factory, &IID_IAgileObject, FALSE ); + + ref = IActivationFactory_Release( factory ); + ok( ref == 1, "got ref %ld.\n", ref ); +} + +START_TEST(systemid) +{ + HRESULT hr; + + hr = RoInitialize( RO_INIT_MULTITHREADED ); + ok( hr == S_OK, "RoInitialize failed, hr %#lx\n", hr ); + + test_SystemIdentification_Statics(); + + RoUninitialize(); +} diff --git a/dlls/windows.system.profile.systemid/windows.system.profile.systemid.spec b/dlls/windows.system.profile.systemid/windows.system.profile.systemid.spec new file mode 100644 index 00000000000..31a5eafe950 --- /dev/null +++ b/dlls/windows.system.profile.systemid/windows.system.profile.systemid.spec @@ -0,0 +1,3 @@ +@ stdcall -private DllGetActivationFactory(ptr ptr) +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetClassObject(ptr ptr ptr) diff --git a/include/windows.system.profile.idl b/include/windows.system.profile.idl index ef99a8af730..9e0b0ed8411 100644 --- a/include/windows.system.profile.idl +++ b/include/windows.system.profile.idl @@ -97,6 +97,7 @@ namespace Windows.System.Profile { HRESULT GetSystemIdForUser([in] Windows.System.User *user, [out, retval] Windows.System.Profile.SystemIdentificationInfo **result); }
+#ifndef _WINDOWS_SYSTEM_PROFILE_SYSTEM_ID [ contract(Windows.Foundation.UniversalApiContract, 1.0), marshaling_behavior(agile), @@ -118,6 +119,7 @@ namespace Windows.System.Profile { runtimeclass AnalyticsInfo { } +#endif
#ifndef _TWINAPI_APPCORE [
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/windows.system.profile.systemid/main.c | 37 ++++++++++++++++++ .../windows.system.profile.systemid/private.h | 38 +++++++++++++++++++ .../tests/systemid.c | 6 +++ 3 files changed, 81 insertions(+)
diff --git a/dlls/windows.system.profile.systemid/main.c b/dlls/windows.system.profile.systemid/main.c index af55ea204d3..ceacc929622 100644 --- a/dlls/windows.system.profile.systemid/main.c +++ b/dlls/windows.system.profile.systemid/main.c @@ -25,6 +25,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(systemid); struct system_id_statics { IActivationFactory IActivationFactory_iface; + ISystemIdentificationStatics ISystemIdentificationStatics_iface; LONG ref; };
@@ -48,6 +49,13 @@ static HRESULT WINAPI factory_QueryInterface( IActivationFactory *iface, REFIID return S_OK; }
+ if (IsEqualGUID( iid, &IID_ISystemIdentificationStatics )) + { + *out = &impl->ISystemIdentificationStatics_iface; + IInspectable_AddRef( *out ); + return S_OK; + } + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); *out = NULL; return E_NOINTERFACE; @@ -106,9 +114,38 @@ static const struct IActivationFactoryVtbl factory_vtbl = factory_ActivateInstance, };
+DEFINE_IINSPECTABLE( system_id_statics, ISystemIdentificationStatics, struct system_id_statics, IActivationFactory_iface ) + +static HRESULT WINAPI system_id_statics_GetSystemIdForPublisher( ISystemIdentificationStatics *iface, ISystemIdentificationInfo **result ) +{ + FIXME( "iface %p, result %p stub!\n", iface, result ); + return E_NOTIMPL; +} + +static HRESULT WINAPI system_id_statics_GetSystemIdForUser( ISystemIdentificationStatics *iface, __x_ABI_CWindows_CSystem_CIUser *user, ISystemIdentificationInfo **result ) +{ + FIXME( "iface %p, user %p, result %p stub!\n", iface, user, result ); + return E_NOTIMPL; +} + +static const struct ISystemIdentificationStaticsVtbl system_id_statics_vtbl = +{ + system_id_statics_QueryInterface, + system_id_statics_AddRef, + system_id_statics_Release, + /* IInspectable methods */ + system_id_statics_GetIids, + system_id_statics_GetRuntimeClassName, + system_id_statics_GetTrustLevel, + /* ISystemIdentificationStatics methods */ + system_id_statics_GetSystemIdForPublisher, + system_id_statics_GetSystemIdForUser, +}; + static struct system_id_statics system_id_statics = { {&factory_vtbl}, + {&system_id_statics_vtbl}, 1, };
diff --git a/dlls/windows.system.profile.systemid/private.h b/dlls/windows.system.profile.systemid/private.h index b55020a999f..e1a18a958b0 100644 --- a/dlls/windows.system.profile.systemid/private.h +++ b/dlls/windows.system.profile.systemid/private.h @@ -31,3 +31,41 @@
#define WIDL_using_Windows_System_Profile #include "windows.system.profile.h" + +#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \ + static inline impl_type *impl_from( iface_type *iface ) \ + { \ + return CONTAINING_RECORD( iface, impl_type, iface_mem ); \ + } \ + static HRESULT WINAPI pfx##_QueryInterface( iface_type *iface, REFIID iid, void **out ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_QueryInterface( (IInspectable *)(expr), iid, out ); \ + } \ + static ULONG WINAPI pfx##_AddRef( iface_type *iface ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_AddRef( (IInspectable *)(expr) ); \ + } \ + static ULONG WINAPI pfx##_Release( iface_type *iface ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_Release( (IInspectable *)(expr) ); \ + } \ + static HRESULT WINAPI pfx##_GetIids( iface_type *iface, ULONG *iid_count, IID **iids ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetIids( (IInspectable *)(expr), iid_count, iids ); \ + } \ + static HRESULT WINAPI pfx##_GetRuntimeClassName( iface_type *iface, HSTRING *class_name ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetRuntimeClassName( (IInspectable *)(expr), class_name ); \ + } \ + static HRESULT WINAPI pfx##_GetTrustLevel( iface_type *iface, TrustLevel *trust_level ) \ + { \ + impl_type *impl = impl_from( iface ); \ + return IInspectable_GetTrustLevel( (IInspectable *)(expr), trust_level ); \ + } +#define DEFINE_IINSPECTABLE( pfx, iface_type, impl_type, base_iface ) \ + DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, &impl->base_iface ) diff --git a/dlls/windows.system.profile.systemid/tests/systemid.c b/dlls/windows.system.profile.systemid/tests/systemid.c index 6e857bf331a..1187b6f438f 100644 --- a/dlls/windows.system.profile.systemid/tests/systemid.c +++ b/dlls/windows.system.profile.systemid/tests/systemid.c @@ -46,6 +46,7 @@ static void check_interface_( unsigned int line, void *obj, const IID *iid, BOOL static void test_SystemIdentification_Statics(void) { static const WCHAR *system_id_statics_name = L"Windows.System.Profile.SystemIdentification"; + ISystemIdentificationStatics *system_id_statics = (void *)0xdeadbeef; IActivationFactory *factory = (void *)0xdeadbeef; HSTRING str = NULL; HRESULT hr; @@ -66,6 +67,11 @@ static void test_SystemIdentification_Statics(void) check_interface( factory, &IID_IInspectable, TRUE ); check_interface( factory, &IID_IAgileObject, FALSE );
+ hr = IActivationFactory_QueryInterface( factory, &IID_ISystemIdentificationStatics, (void **)&system_id_statics ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + ref = ISystemIdentificationStatics_Release( system_id_statics ); + ok( ref == 2, "got ref %ld.\n", ref ); ref = IActivationFactory_Release( factory ); ok( ref == 1, "got ref %ld.\n", ref ); }
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- .../tests/systemid.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/dlls/windows.system.profile.systemid/tests/systemid.c b/dlls/windows.system.profile.systemid/tests/systemid.c index 1187b6f438f..44a2682f593 100644 --- a/dlls/windows.system.profile.systemid/tests/systemid.c +++ b/dlls/windows.system.profile.systemid/tests/systemid.c @@ -47,6 +47,7 @@ static void test_SystemIdentification_Statics(void) { static const WCHAR *system_id_statics_name = L"Windows.System.Profile.SystemIdentification"; ISystemIdentificationStatics *system_id_statics = (void *)0xdeadbeef; + ISystemIdentificationInfo *system_id_info = (void *)0xdeadbeef; IActivationFactory *factory = (void *)0xdeadbeef; HSTRING str = NULL; HRESULT hr; @@ -70,6 +71,20 @@ static void test_SystemIdentification_Statics(void) hr = IActivationFactory_QueryInterface( factory, &IID_ISystemIdentificationStatics, (void **)&system_id_statics ); ok( hr == S_OK, "got hr %#lx.\n", hr );
+ hr = ISystemIdentificationStatics_GetSystemIdForPublisher( system_id_statics, NULL ); + todo_wine + ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr ); + hr = ISystemIdentificationStatics_GetSystemIdForPublisher( system_id_statics, &system_id_info ); + todo_wine + ok( hr == S_OK, "got hr %#lx.\n", hr ); + if (SUCCEEDED(hr)) + { + check_interface( system_id_info, &IID_IAgileObject, FALSE ); + + ref = ISystemIdentificationInfo_Release( system_id_info ); + ok( ref == 0, "got ref %ld.\n", ref ); + } + ref = ISystemIdentificationStatics_Release( system_id_statics ); ok( ref == 2, "got ref %ld.\n", ref ); ref = IActivationFactory_Release( factory );
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/windows.system.profile.systemid/main.c | 112 +++++++++++++++++- .../windows.system.profile.systemid/private.h | 2 + .../tests/systemid.c | 11 +- 3 files changed, 115 insertions(+), 10 deletions(-)
diff --git a/dlls/windows.system.profile.systemid/main.c b/dlls/windows.system.profile.systemid/main.c index ceacc929622..edd607d547a 100644 --- a/dlls/windows.system.profile.systemid/main.c +++ b/dlls/windows.system.profile.systemid/main.c @@ -114,12 +114,120 @@ static const struct IActivationFactoryVtbl factory_vtbl = factory_ActivateInstance, };
+struct system_identification_info +{ + ISystemIdentificationInfo ISystemIdentificationInfo_iface; + LONG ref; + + SystemIdentificationSource system_id_source; +}; + +static inline struct system_identification_info *impl_from_ISystemIdentificationInfo( ISystemIdentificationInfo *iface ) +{ + return CONTAINING_RECORD( iface, struct system_identification_info, ISystemIdentificationInfo_iface ); +} + +static HRESULT WINAPI system_identification_info_QueryInterface( ISystemIdentificationInfo *iface, REFIID iid, void **out ) +{ + struct system_identification_info *impl = impl_from_ISystemIdentificationInfo( 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_ISystemIdentificationInfo )) + { + *out = &impl->ISystemIdentificationInfo_iface; + IInspectable_AddRef( *out ); + return S_OK; + } + + FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI system_identification_info_AddRef( ISystemIdentificationInfo *iface ) +{ + struct system_identification_info *impl = impl_from_ISystemIdentificationInfo( iface ); + ULONG ref = InterlockedIncrement( &impl->ref ); + TRACE( "iface %p increasing refcount to %lu.\n", iface, ref ); + return ref; +} + +static ULONG WINAPI system_identification_info_Release( ISystemIdentificationInfo *iface ) +{ + struct system_identification_info *impl = impl_from_ISystemIdentificationInfo( iface ); + ULONG ref = InterlockedDecrement( &impl->ref ); + + TRACE( "iface %p decreasing refcount to %lu.\n", iface, ref ); + + if (!ref) free( impl ); + return ref; +} + +static HRESULT WINAPI system_identification_info_GetIids( ISystemIdentificationInfo *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 WINAPI system_identification_info_GetRuntimeClassName( ISystemIdentificationInfo *iface, HSTRING *class_name ) +{ + FIXME( "iface %p, class_name %p stub!\n", iface, class_name ); + return E_NOTIMPL; +} + +static HRESULT WINAPI system_identification_info_GetTrustLevel( ISystemIdentificationInfo *iface, TrustLevel *trust_level ) +{ + FIXME( "iface %p, trust_level %p stub!\n", iface, trust_level ); + return E_NOTIMPL; +} + +static HRESULT WINAPI system_identification_info_get_Id( ISystemIdentificationInfo *iface, IBuffer **value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static HRESULT WINAPI system_identification_info_get_Source( ISystemIdentificationInfo *iface, SystemIdentificationSource *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +static const struct ISystemIdentificationInfoVtbl system_identification_info_vtbl = +{ + system_identification_info_QueryInterface, + system_identification_info_AddRef, + system_identification_info_Release, + /* IInspectable methods */ + system_identification_info_GetIids, + system_identification_info_GetRuntimeClassName, + system_identification_info_GetTrustLevel, + /* ISystemIdentificationInfo methods */ + system_identification_info_get_Id, + system_identification_info_get_Source, +}; + DEFINE_IINSPECTABLE( system_id_statics, ISystemIdentificationStatics, struct system_id_statics, IActivationFactory_iface )
static HRESULT WINAPI system_id_statics_GetSystemIdForPublisher( ISystemIdentificationStatics *iface, ISystemIdentificationInfo **result ) { - FIXME( "iface %p, result %p stub!\n", iface, result ); - return E_NOTIMPL; + struct system_identification_info *impl; + + FIXME( "iface %p, result %p semi-stub!\n", iface, result ); + + if (!result) return E_INVALIDARG; + if (!(impl = calloc( 1, sizeof( *impl ) ))) return E_OUTOFMEMORY; + + impl->ISystemIdentificationInfo_iface.lpVtbl = &system_identification_info_vtbl; + impl->system_id_source = SystemIdentificationSource_None; + impl->ref = 1; + + *result = &impl->ISystemIdentificationInfo_iface; + TRACE( "created ISystemIdentificationInfo %p.\n", *result ); + return S_OK; }
static HRESULT WINAPI system_id_statics_GetSystemIdForUser( ISystemIdentificationStatics *iface, __x_ABI_CWindows_CSystem_CIUser *user, ISystemIdentificationInfo **result ) diff --git a/dlls/windows.system.profile.systemid/private.h b/dlls/windows.system.profile.systemid/private.h index e1a18a958b0..6e11787ab03 100644 --- a/dlls/windows.system.profile.systemid/private.h +++ b/dlls/windows.system.profile.systemid/private.h @@ -30,7 +30,9 @@ #include "wine/debug.h"
#define WIDL_using_Windows_System_Profile +#define WIDL_using_Windows_Storage_Streams #include "windows.system.profile.h" +#include "windows.storage.streams.h"
#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \ static inline impl_type *impl_from( iface_type *iface ) \ diff --git a/dlls/windows.system.profile.systemid/tests/systemid.c b/dlls/windows.system.profile.systemid/tests/systemid.c index 44a2682f593..ac518718414 100644 --- a/dlls/windows.system.profile.systemid/tests/systemid.c +++ b/dlls/windows.system.profile.systemid/tests/systemid.c @@ -72,19 +72,14 @@ static void test_SystemIdentification_Statics(void) ok( hr == S_OK, "got hr %#lx.\n", hr );
hr = ISystemIdentificationStatics_GetSystemIdForPublisher( system_id_statics, NULL ); - todo_wine ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr ); hr = ISystemIdentificationStatics_GetSystemIdForPublisher( system_id_statics, &system_id_info ); - todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr ); - if (SUCCEEDED(hr)) - { - check_interface( system_id_info, &IID_IAgileObject, FALSE );
- ref = ISystemIdentificationInfo_Release( system_id_info ); - ok( ref == 0, "got ref %ld.\n", ref ); - } + check_interface( system_id_info, &IID_IAgileObject, FALSE );
+ ref = ISystemIdentificationInfo_Release( system_id_info ); + ok( ref == 0, "got ref %ld.\n", ref ); ref = ISystemIdentificationStatics_Release( system_id_statics ); ok( ref == 2, "got ref %ld.\n", ref ); ref = IActivationFactory_Release( factory );
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/windows.system.profile.systemid/tests/systemid.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/dlls/windows.system.profile.systemid/tests/systemid.c b/dlls/windows.system.profile.systemid/tests/systemid.c index ac518718414..35e50c1ed03 100644 --- a/dlls/windows.system.profile.systemid/tests/systemid.c +++ b/dlls/windows.system.profile.systemid/tests/systemid.c @@ -48,6 +48,7 @@ static void test_SystemIdentification_Statics(void) static const WCHAR *system_id_statics_name = L"Windows.System.Profile.SystemIdentification"; ISystemIdentificationStatics *system_id_statics = (void *)0xdeadbeef; ISystemIdentificationInfo *system_id_info = (void *)0xdeadbeef; + SystemIdentificationSource system_id_source = 0xdeadbeef; IActivationFactory *factory = (void *)0xdeadbeef; HSTRING str = NULL; HRESULT hr; @@ -78,6 +79,15 @@ static void test_SystemIdentification_Statics(void)
check_interface( system_id_info, &IID_IAgileObject, FALSE );
+ hr = ISystemIdentificationInfo_get_Source( system_id_info, NULL ); + todo_wine + ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr ); + hr = ISystemIdentificationInfo_get_Source( system_id_info, &system_id_source ); + todo_wine + ok( hr == S_OK, "got hr %#lx.\n", hr ); + todo_wine + ok( system_id_source == SystemIdentificationSource_Uefi, "ISystemIdentificationInfo_get_Source returned %u.\n", system_id_source ); + ref = ISystemIdentificationInfo_Release( system_id_info ); ok( ref == 0, "got ref %ld.\n", ref ); ref = ISystemIdentificationStatics_Release( system_id_statics );
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55759 --- dlls/windows.system.profile.systemid/main.c | 10 ++++++++-- dlls/windows.system.profile.systemid/tests/systemid.c | 2 -- 2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/dlls/windows.system.profile.systemid/main.c b/dlls/windows.system.profile.systemid/main.c index edd607d547a..5cef5982580 100644 --- a/dlls/windows.system.profile.systemid/main.c +++ b/dlls/windows.system.profile.systemid/main.c @@ -192,8 +192,14 @@ static HRESULT WINAPI system_identification_info_get_Id( ISystemIdentificationIn
static HRESULT WINAPI system_identification_info_get_Source( ISystemIdentificationInfo *iface, SystemIdentificationSource *value ) { - FIXME( "iface %p, value %p stub!\n", iface, value ); - return E_NOTIMPL; + struct system_identification_info *impl = impl_from_ISystemIdentificationInfo( iface ); + + TRACE( "iface %p, value %p\n", iface, value ); + + if (!value) return E_INVALIDARG; + + *value = impl->system_id_source; + return S_OK; }
static const struct ISystemIdentificationInfoVtbl system_identification_info_vtbl = diff --git a/dlls/windows.system.profile.systemid/tests/systemid.c b/dlls/windows.system.profile.systemid/tests/systemid.c index 35e50c1ed03..b34eae43994 100644 --- a/dlls/windows.system.profile.systemid/tests/systemid.c +++ b/dlls/windows.system.profile.systemid/tests/systemid.c @@ -80,10 +80,8 @@ static void test_SystemIdentification_Statics(void) check_interface( system_id_info, &IID_IAgileObject, FALSE );
hr = ISystemIdentificationInfo_get_Source( system_id_info, NULL ); - todo_wine ok( hr == E_INVALIDARG, "got hr %#lx.\n", hr ); hr = ISystemIdentificationInfo_get_Source( system_id_info, &system_id_source ); - todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr ); todo_wine ok( system_id_source == SystemIdentificationSource_Uefi, "ISystemIdentificationInfo_get_Source returned %u.\n", system_id_source );
This merge request was approved by Rémi Bernon.