Module: wine Branch: master Commit: be0c5268f1c567f642a54c0d03009efd32032b8b URL: https://gitlab.winehq.org/wine/wine/-/commit/be0c5268f1c567f642a54c0d03009ef...
Author: Mohamad Al-Jaf mohamadaljaf@gmail.com Date: Thu Sep 28 18:43:22 2023 -0400
windows.media.mediacontrol: Implement IMusicDisplayProperties::get/put_Title().
Called by Roon.
---
dlls/windows.media.mediacontrol/main.c | 19 ++++++++++++++----- dlls/windows.media.mediacontrol/tests/mediacontrol.c | 10 +++++----- 2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/dlls/windows.media.mediacontrol/main.c b/dlls/windows.media.mediacontrol/main.c index 15a206f5354..a09fbf50b46 100644 --- a/dlls/windows.media.mediacontrol/main.c +++ b/dlls/windows.media.mediacontrol/main.c @@ -121,6 +121,8 @@ struct music_properties { IMusicDisplayProperties IMusicDisplayProperties_iface; LONG ref; + + HSTRING title; };
static inline struct music_properties *impl_from_IMusicDisplayProperties( IMusicDisplayProperties *iface ) @@ -164,7 +166,11 @@ static ULONG WINAPI music_properties_Release( IMusicDisplayProperties *iface )
TRACE( "iface %p decreasing refcount to %lu.\n", iface, ref );
- if (!ref) free( impl ); + if (!ref) + { + WindowsDeleteString( impl->title ); + free( impl ); + } return ref; }
@@ -188,14 +194,17 @@ static HRESULT WINAPI music_properties_GetTrustLevel( IMusicDisplayProperties *i
static HRESULT WINAPI music_properties_get_Title( IMusicDisplayProperties *iface, HSTRING *value ) { - FIXME( "iface %p, value %p stub!\n", iface, value ); - return E_NOTIMPL; + struct music_properties *impl = impl_from_IMusicDisplayProperties( iface ); + TRACE( "iface %p, value %p\n", iface, value ); + return WindowsDuplicateString( impl->title, value ); }
static HRESULT WINAPI music_properties_put_Title( IMusicDisplayProperties *iface, HSTRING value ) { - FIXME( "iface %p, value %s stub!\n", iface, debugstr_hstring(value) ); - return E_NOTIMPL; + struct music_properties *impl = impl_from_IMusicDisplayProperties( iface ); + TRACE( "iface %p, value %p\n", iface, value ); + WindowsDeleteString( impl->title ); + return WindowsDuplicateString( value, &impl->title ); }
static HRESULT WINAPI music_properties_get_AlbumArtist( IMusicDisplayProperties *iface, HSTRING *value ) diff --git a/dlls/windows.media.mediacontrol/tests/mediacontrol.c b/dlls/windows.media.mediacontrol/tests/mediacontrol.c index c787906b311..d2977ed97f4 100644 --- a/dlls/windows.media.mediacontrol/tests/mediacontrol.c +++ b/dlls/windows.media.mediacontrol/tests/mediacontrol.c @@ -178,17 +178,17 @@ static void test_MediaControlStatics(void) check_interface( music_properties, &IID_IAgileObject );
hr = IMusicDisplayProperties_put_Title( music_properties, NULL ); - todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); hr = WindowsCreateStringReference( L"Wine", wcslen( L"Wine" ), &header, &str ); ok( hr == S_OK, "got hr %#lx.\n", hr ); hr = IMusicDisplayProperties_put_Title( music_properties, str ); - todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); hr = IMusicDisplayProperties_get_Title( music_properties, &ret_str ); - todo_wine ok( hr == S_OK, "got hr %#lx.\n", hr ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); hr = WindowsCompareStringOrdinal( str, ret_str, &res ); ok( hr == S_OK, "got hr %#lx.\n", hr ); - todo_wine ok( !res, "got string %s.\n", debugstr_hstring( ret_str ) ); - todo_wine ok( str != ret_str, "got same HSTRINGs %p, %p.\n", str, ret_str ); + ok( !res, "got string %s.\n", debugstr_hstring( ret_str ) ); + ok( str != ret_str, "got same HSTRINGs %p, %p.\n", str, ret_str ); WindowsDeleteString( str ); WindowsDeleteString( ret_str );