From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/windows.networking.hostname/tests/hostname.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/windows.networking.hostname/tests/hostname.c b/dlls/windows.networking.hostname/tests/hostname.c index 7c6cfd559ea..ad5440a9f65 100644 --- a/dlls/windows.networking.hostname/tests/hostname.c +++ b/dlls/windows.networking.hostname/tests/hostname.c @@ -51,6 +51,7 @@ static void test_HostnameStatics(void) static const WCHAR *ip = L"192.168.0.0"; IHostNameFactory *hostnamefactory; IActivationFactory *factory; + HSTRING_HEADER header; HSTRING str, rawname; IHostName *hostname; HRESULT hr; @@ -75,7 +76,7 @@ static void test_HostnameStatics(void)
hr = IActivationFactory_QueryInterface( factory, &IID_IHostNameFactory, (void **)&hostnamefactory ); ok( hr == S_OK, "got hr %#lx.\n", hr ); - hr = WindowsCreateString( ip, wcslen( ip ), &str ); + hr = WindowsCreateStringReference( ip, wcslen( ip ), &header, &str ); ok( hr == S_OK, "got hr %#lx.\n", hr );
hr = IHostNameFactory_CreateHostName( hostnamefactory, NULL, &hostname ); @@ -100,6 +101,7 @@ static void test_HostnameStatics(void) hr = WindowsCompareStringOrdinal( str, rawname, &res ); ok( hr == S_OK, "got hr %#lx.\n", hr ); ok( !res, "got unexpected string %s.\n", debugstr_hstring(rawname) ); + todo_wine ok( str != rawname, "got same HSTRINGs %p, %p.\n", str, rawname );
WindowsDeleteString( str ); WindowsDeleteString( rawname );
From: Mohamad Al-Jaf mohamadaljaf@gmail.com
--- dlls/windows.networking.hostname/hostname.c | 14 +++++++++++--- dlls/windows.networking.hostname/tests/hostname.c | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/dlls/windows.networking.hostname/hostname.c b/dlls/windows.networking.hostname/hostname.c index c941e7ada89..6f0d3fb9032 100644 --- a/dlls/windows.networking.hostname/hostname.c +++ b/dlls/windows.networking.hostname/hostname.c @@ -120,7 +120,7 @@ struct hostname IHostName IHostName_iface; LONG ref;
- HSTRING rawname; + HSTRING raw_name; };
static inline struct hostname *impl_from_IHostName( IHostName *iface ) @@ -161,7 +161,15 @@ static ULONG WINAPI hostname_Release( IHostName *iface ) { struct hostname *impl = impl_from_IHostName( iface ); ULONG ref = InterlockedDecrement( &impl->ref ); + TRACE( "iface %p decreasing refcount to %lu.\n", iface, ref ); + + if (!ref) + { + WindowsDeleteString( impl->raw_name ); + free( impl ); + } + return ref; }
@@ -196,7 +204,7 @@ static HRESULT WINAPI hostname_get_RawName( IHostName *iface, HSTRING *value ) TRACE( "iface %p, value %p.\n", iface, value );
if (!value) return E_INVALIDARG; - return WindowsDuplicateString( impl->rawname, value ); + return WindowsDuplicateString( impl->raw_name, value ); }
static HRESULT WINAPI hostname_get_DisplayName( IHostName *iface, HSTRING *value ) @@ -255,7 +263,7 @@ static HRESULT WINAPI hostname_factory_CreateHostName( IHostNameFactory *iface,
impl->IHostName_iface.lpVtbl = &hostname_vtbl; impl->ref = 1; - impl->rawname = name; + WindowsDuplicateString( name, &impl->raw_name );
*value = &impl->IHostName_iface; TRACE( "created IHostName %p.\n", *value ); diff --git a/dlls/windows.networking.hostname/tests/hostname.c b/dlls/windows.networking.hostname/tests/hostname.c index ad5440a9f65..e7ecc22cbc9 100644 --- a/dlls/windows.networking.hostname/tests/hostname.c +++ b/dlls/windows.networking.hostname/tests/hostname.c @@ -101,7 +101,7 @@ static void test_HostnameStatics(void) hr = WindowsCompareStringOrdinal( str, rawname, &res ); ok( hr == S_OK, "got hr %#lx.\n", hr ); ok( !res, "got unexpected string %s.\n", debugstr_hstring(rawname) ); - todo_wine ok( str != rawname, "got same HSTRINGs %p, %p.\n", str, rawname ); + ok( str != rawname, "got same HSTRINGs %p, %p.\n", str, rawname );
WindowsDeleteString( str ); WindowsDeleteString( rawname );
This merge request was approved by Rémi Bernon.