From: Fabian Maurer dark.shadow4@web.de
--- .../network_information.c | 128 ++++++++++++++++++ .../tests/connectivity.c | 63 +++++++++ 2 files changed, 191 insertions(+)
diff --git a/dlls/windows.networking.connectivity/network_information.c b/dlls/windows.networking.connectivity/network_information.c index 7ac1dfc1244..4d64ba507c4 100644 --- a/dlls/windows.networking.connectivity/network_information.c +++ b/dlls/windows.networking.connectivity/network_information.c @@ -121,6 +121,7 @@ static const struct IActivationFactoryVtbl factory_vtbl = struct connection_profile { IConnectionProfile IConnectionProfile_iface; + IConnectionProfile2 IConnectionProfile2_iface; LONG ref;
INetworkListManager *network_list_manager; @@ -147,6 +148,12 @@ static HRESULT WINAPI connection_profile_QueryInterface( IConnectionProfile *ifa return S_OK; }
+ if (IsEqualGUID( iid, &IID_IConnectionProfile2 )) + { + *out = &impl->IConnectionProfile2_iface; + IInspectable_AddRef( *out ); + return S_OK; + } FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) ); *out = NULL; return E_NOINTERFACE; @@ -287,6 +294,126 @@ static const struct IConnectionProfileVtbl connection_profile_vtbl = connection_profile_get_NetworkSecuritySettings, };
+static inline struct connection_profile *impl_from_IConnectionProfile2( IConnectionProfile2 *iface ) +{ + return CONTAINING_RECORD( iface, struct connection_profile, IConnectionProfile2_iface ); +} + +static HRESULT WINAPI connection_profile2_QueryInterface( IConnectionProfile2 *iface, REFIID iid, void **out ) +{ + struct connection_profile *impl = impl_from_IConnectionProfile2( iface ); + return IConnectionProfile_QueryInterface(&impl->IConnectionProfile_iface, iid, out); +} + +static ULONG WINAPI connection_profile2_AddRef( IConnectionProfile2 *iface ) +{ + struct connection_profile *impl = impl_from_IConnectionProfile2( iface ); + return IConnectionProfile_AddRef(&impl->IConnectionProfile_iface); +} + +static ULONG WINAPI connection_profile2_Release( IConnectionProfile2 *iface ) +{ + struct connection_profile *impl = impl_from_IConnectionProfile2( iface ); + return IConnectionProfile_Release(&impl->IConnectionProfile_iface); +} + +static HRESULT WINAPI connection_profile2_GetIids( IConnectionProfile2 *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 connection_profile2_GetRuntimeClassName( IConnectionProfile2 *iface, HSTRING *class_name ) +{ + FIXME( "iface %p, class_name %p stub!\n", iface, class_name ); + return E_NOTIMPL; +} + +static HRESULT WINAPI connection_profile2_GetTrustLevel( IConnectionProfile2 *iface, TrustLevel *trust_level ) +{ + FIXME( "iface %p, trust_level %p stub!\n", iface, trust_level ); + return E_NOTIMPL; +} + +HRESULT WINAPI connection_profile2_get_IsWwanConnectionProfile( IConnectionProfile2 *iface, boolean *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +HRESULT WINAPI connection_profile2_get_IsWlanConnectionProfile( IConnectionProfile2 *iface, boolean *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +HRESULT WINAPI connection_profile2_get_WwanConnectionProfileDetails( IConnectionProfile2 *iface, IWwanConnectionProfileDetails **value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +HRESULT WINAPI connection_profile2_get_WlanConnectionProfileDetails( IConnectionProfile2 *iface, IWlanConnectionProfileDetails **value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +HRESULT WINAPI connection_profile2_get_ServiceProviderGuid( IConnectionProfile2 *iface, IReference_GUID **value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +HRESULT WINAPI connection_profile2_GetSignalBars( IConnectionProfile2 *iface, IReference_BYTE **value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +HRESULT WINAPI connection_profile2_GetDomainConnectivityLevel( IConnectionProfile2 *iface, DomainConnectivityLevel *value ) +{ + FIXME( "iface %p, value %p stub!\n", iface, value ); + return E_NOTIMPL; +} + +HRESULT WINAPI connection_profile2_GetNetworkUsageAsync( IConnectionProfile2 *iface, DateTime time_start, DateTime time_end, + DataUsageGranularity granularity, NetworkUsageStates states, IAsyncOperation_IVectorView_NetworkUsage **value ) +{ + FIXME( "iface %p, time_start %I64d, time_end %I64d, granularity %d, states %d-%d, value %p stub!\n", + iface, time_start.UniversalTime, time_end.UniversalTime, granularity, states.Roaming, states.Shared, value ); + return E_NOTIMPL; +} + +HRESULT WINAPI connection_profile2_GetConnectivityIntervalsAsync( IConnectionProfile2 *iface, DateTime time_start, DateTime time_end, + NetworkUsageStates states, IAsyncOperation_IVectorView_ConnectivityInterval **value ) +{ + FIXME( "iface %p, time_start %I64d, time_end %I64d, states %d-%d, value %p stub!\n", + iface, time_start.UniversalTime, time_end.UniversalTime, states.Roaming, states.Shared, value ); + return E_NOTIMPL; +} + +static const struct IConnectionProfile2Vtbl connection_profile2_vtbl = +{ + connection_profile2_QueryInterface, + connection_profile2_AddRef, + connection_profile2_Release, + /* IInspectable methods */ + connection_profile2_GetIids, + connection_profile2_GetRuntimeClassName, + connection_profile2_GetTrustLevel, + /* IConnectionProfile2 methods */ + connection_profile2_get_IsWwanConnectionProfile, + connection_profile2_get_IsWlanConnectionProfile, + connection_profile2_get_WwanConnectionProfileDetails, + connection_profile2_get_WlanConnectionProfileDetails, + connection_profile2_get_ServiceProviderGuid, + connection_profile2_GetSignalBars, + connection_profile2_GetDomainConnectivityLevel, + connection_profile2_GetNetworkUsageAsync, + connection_profile2_GetConnectivityIntervalsAsync, +}; + DEFINE_IINSPECTABLE( network_information_statics, INetworkInformationStatics, struct network_information_statics, IActivationFactory_iface )
static HRESULT WINAPI network_information_statics_GetConnectionProfiles( INetworkInformationStatics *iface, IVectorView_ConnectionProfile **value ) @@ -313,6 +440,7 @@ static HRESULT WINAPI network_information_statics_GetInternetConnectionProfile( }
impl->IConnectionProfile_iface.lpVtbl = &connection_profile_vtbl; + impl->IConnectionProfile2_iface.lpVtbl = &connection_profile2_vtbl; impl->ref = 1; impl->network_list_manager = network_list_manager;
diff --git a/dlls/windows.networking.connectivity/tests/connectivity.c b/dlls/windows.networking.connectivity/tests/connectivity.c index cbeda9ade0f..88634cbea95 100644 --- a/dlls/windows.networking.connectivity/tests/connectivity.c +++ b/dlls/windows.networking.connectivity/tests/connectivity.c @@ -53,6 +53,7 @@ static void test_NetworkInformationStatics(void) INetworkInformationStatics *network_information_statics = (void *)0xdeadbeef; INetworkListManager *network_list_manager = (void *)0xdeadbeef; IConnectionProfile *connection_profile = (void *)0xdeadbeef; + IConnectionProfile2 *connection_profile2; NetworkConnectivityLevel network_connectivity_level; IActivationFactory *factory = (void *)0xdeadbeef; NLM_CONNECTIVITY connectivity; @@ -102,6 +103,68 @@ static void test_NetworkInformationStatics(void) goto cleanup; }
+ hr = IConnectionProfile_QueryInterface( connection_profile, &IID_IConnectionProfile2, (void **)&connection_profile2 ); + + if (hr == E_NOINTERFACE) + { + skip ( "IConnectionProfile2 not available, skipping those tests\n" ); + } + else + { + IUnknown *unknown1 = 0, *unknown2 = 0; + IInspectable *inspectable1 = 0, *inspectable2 = 0; + IAgileObject *agile1 = 0, *agile2 = 0; + IConnectionProfile *profile1 = 0; + IConnectionProfile2 *profile2 = 0; + + hr = IUnknown_QueryInterface( connection_profile, &IID_IUnknown, (void **)&unknown1 ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + hr = IUnknown_QueryInterface( connection_profile, &IID_IInspectable, (void **)&inspectable1 ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + hr = IUnknown_QueryInterface( connection_profile, &IID_IAgileObject, (void **)&agile1 ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + hr = IUnknown_QueryInterface( connection_profile2, &IID_IUnknown, (void **)&unknown2 ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + hr = IUnknown_QueryInterface( connection_profile2, &IID_IInspectable, (void **)&inspectable2 ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + hr = IUnknown_QueryInterface( connection_profile2, &IID_IAgileObject, (void **)&agile2 ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + hr = IUnknown_QueryInterface( connection_profile2, &IID_IConnectionProfile, (void **)&profile1 ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + hr = IUnknown_QueryInterface( connection_profile2, &IID_IConnectionProfile2, (void **)&profile2 ); + ok( hr == S_OK, "got hr %#lx.\n", hr ); + + ok( (void*)connection_profile != (void*)connection_profile2, "Interfaces should not be equal\n"); + + ok( (void*)connection_profile == (void*)unknown1, "Interfaces not equal\n"); + ok( (void*)connection_profile == (void*)inspectable1, "Interfaces not equal\n"); + todo_wine ok( (void*)connection_profile != (void*)agile1, "Interfaces should not be equal\n"); + + ok( (void*)unknown1 == (void*)unknown2, "Interfaces not equal\n"); + ok( (void*)inspectable1 == (void*)inspectable2, "Interfaces not equal\n"); + ok( (void*)agile1 == (void*)agile2, "Interfaces not equal\n"); + + ok( (void*)connection_profile2 == (void*)profile2, "Interfaces not equal\n"); + ok( (void*)connection_profile == (void*)profile1, "Interfaces not equal\n"); + + if (unknown1) IUnknown_Release( unknown1 ); + if (unknown2) IUnknown_Release( unknown2 ); + if (inspectable1) IInspectable_Release( inspectable1 ); + if (inspectable2) IInspectable_Release( inspectable2 ); + if (agile1) IAgileObject_Release( agile1 ); + if (agile2) IAgileObject_Release( agile2 ); + if (profile1) IConnectionProfile_Release( profile1 ); + if (profile2) IConnectionProfile2_Release( profile2 ); + IConnectionProfile2_Release( connection_profile2 ); + } + hr = IConnectionProfile_GetNetworkConnectivityLevel( connection_profile, NULL ); ok( hr == E_POINTER, "got hr %#lx.\n", hr ); network_connectivity_level = 0xdeadbeef;