From: Zhao Yi <zhaoyi@uniontech.com> Signed-off-by: Zhao Yi <zhaoyi@uniontech.com> --- dlls/wbemprox/tests/Makefile.in | 2 +- dlls/wbemprox/tests/query.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/dlls/wbemprox/tests/Makefile.in b/dlls/wbemprox/tests/Makefile.in index ba603031c2c..38f7b4b6eb8 100644 --- a/dlls/wbemprox/tests/Makefile.in +++ b/dlls/wbemprox/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = wbemprox.dll -IMPORTS = uuid oleaut32 ole32 user32 advapi32 +IMPORTS = uuid oleaut32 ole32 user32 advapi32 ws2_32 SOURCES = \ query.c \ diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c index 59d1ff49042..00023f70a5e 100644 --- a/dlls/wbemprox/tests/query.c +++ b/dlls/wbemprox/tests/query.c @@ -19,6 +19,7 @@ #define COBJMACROS #include <stdio.h> +#include <ws2tcpip.h> #include "windows.h" #include "ocidl.h" #include "sddl.h" @@ -368,6 +369,16 @@ static void test_IEnumWbemClassObject_Next( IWbemServices *services ) SysFreeString( wql ); } +const WCHAR* get_ip_type(const WCHAR* ip) { + struct sockaddr_in sa; + struct sockaddr_in6 sa6; + + if (InetPtonW(AF_INET, ip, &(sa.sin_addr)) == 1) return L"IPv4"; + else if (InetPtonW(AF_INET6, ip, &(sa6.sin6_addr)) == 1) return L"IPv6"; + + return L"Unknow"; +} + static void _check_property( ULONG line, IWbemClassObject *obj, const WCHAR *prop, VARTYPE vartype, CIMTYPE cimtype, BOOL nullable) { @@ -398,6 +409,27 @@ static void _check_property( ULONG line, IWbemClassObject *obj, const WCHAR *pro case VT_BOOL: trace( "%s: %d\n", wine_dbgstr_w(prop), V_BOOL(&val) ); break; + case VT_ARRAY | VT_BSTR: + if (wcscmp(L"IPAddress",prop) == 0) + { + SAFEARRAY *sa; + LONG bound = -1, j; + BSTR ip_str; + sa = V_ARRAY( &val ); + SafeArrayGetUBound( sa, 1, &bound ); + if (bound >= 0) + { + trace( "%s\n", wine_dbgstr_w(L"IPAddresse:") ); + for (j = 0; j <= bound; j++) + { + SafeArrayGetElement( sa, &j, &ip_str ); + trace( "[%02lu]: %s\n", j + 1, wine_dbgstr_w(ip_str) ); + if (j == 0) ok( wcscmp(L"IPv4", get_ip_type(ip_str)) == 0, "%lu: unexpected ip address order %s\n", line, wine_dbgstr_w(ip_str) ); + SysFreeString( ip_str ); + } + } + } + break; default: break; } @@ -1536,6 +1568,7 @@ static void test_Win32_NetworkAdapterConfiguration( IWbemServices *services ) check_property( obj, L"Index", VT_I4, CIM_UINT32 ); check_property( obj, L"IPEnabled", VT_BOOL, CIM_BOOLEAN ); check_property_nullable( obj, L"DNSDomain", VT_BSTR, CIM_STRING ); + check_property( obj, L"IPAddress", VT_ARRAY | VT_BSTR, CIM_FLAG_ARRAY | CIM_STRING ); IWbemClassObject_Release( obj ); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10272