forked from Mirrors/wine-wine
wsdapi: Implement IWSDUdpAddress_SetTransportAddress.
Signed-off-by: Owen Rudge <orudge@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>oldstable
parent
4373eb30a4
commit
4f1dca9db0
|
@ -1,6 +1,6 @@
|
||||||
MODULE = wsdapi.dll
|
MODULE = wsdapi.dll
|
||||||
IMPORTLIB = wsdapi
|
IMPORTLIB = wsdapi
|
||||||
IMPORTS = user32
|
IMPORTS = user32 ws2_32
|
||||||
|
|
||||||
C_SRCS = \
|
C_SRCS = \
|
||||||
address.c \
|
address.c \
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
#define COBJMACROS
|
#define COBJMACROS
|
||||||
|
|
||||||
|
#include "winsock2.h"
|
||||||
|
#include "ws2tcpip.h"
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
@ -32,6 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wsdapi);
|
||||||
typedef struct IWSDUdpAddressImpl {
|
typedef struct IWSDUdpAddressImpl {
|
||||||
IWSDUdpAddress IWSDUdpAddress_iface;
|
IWSDUdpAddress IWSDUdpAddress_iface;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
SOCKADDR_STORAGE sockAddr;
|
||||||
} IWSDUdpAddressImpl;
|
} IWSDUdpAddressImpl;
|
||||||
|
|
||||||
static inline IWSDUdpAddressImpl *impl_from_IWSDUdpAddress(IWSDUdpAddress *iface)
|
static inline IWSDUdpAddressImpl *impl_from_IWSDUdpAddress(IWSDUdpAddress *iface)
|
||||||
|
@ -132,8 +135,31 @@ static HRESULT WINAPI IWSDUdpAddressImpl_GetTransportAddressEx(IWSDUdpAddress *T
|
||||||
|
|
||||||
static HRESULT WINAPI IWSDUdpAddressImpl_SetTransportAddress(IWSDUdpAddress *This, LPCWSTR pszAddress)
|
static HRESULT WINAPI IWSDUdpAddressImpl_SetTransportAddress(IWSDUdpAddress *This, LPCWSTR pszAddress)
|
||||||
{
|
{
|
||||||
FIXME("(%p, %s)\n", This, debugstr_w(pszAddress));
|
IWSDUdpAddressImpl *impl = impl_from_IWSDUdpAddress(This);
|
||||||
return E_NOTIMPL;
|
ADDRINFOW *addrInfo = NULL;
|
||||||
|
ADDRINFOW hints;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
TRACE("(%p, %s)\n", impl, debugstr_w(pszAddress));
|
||||||
|
|
||||||
|
if (pszAddress == NULL)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
ZeroMemory(&hints, sizeof(hints));
|
||||||
|
hints.ai_family = AF_UNSPEC;
|
||||||
|
|
||||||
|
ret = GetAddrInfoW(pszAddress, NULL, &hints, &addrInfo);
|
||||||
|
|
||||||
|
if (ret == 0)
|
||||||
|
{
|
||||||
|
ZeroMemory(&impl->sockAddr, sizeof(SOCKADDR_STORAGE));
|
||||||
|
memcpy(&impl->sockAddr, addrInfo->ai_addr, addrInfo->ai_addrlen);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (addrInfo != NULL)
|
||||||
|
FreeAddrInfoW(addrInfo);
|
||||||
|
|
||||||
|
return HRESULT_FROM_WIN32(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IWSDUdpAddressImpl_SetSockaddr(IWSDUdpAddress *This, const SOCKADDR_STORAGE *pSockAddr)
|
static HRESULT WINAPI IWSDUdpAddressImpl_SetSockaddr(IWSDUdpAddress *This, const SOCKADDR_STORAGE *pSockAddr)
|
||||||
|
|
|
@ -98,15 +98,15 @@ static void GetSetTransportAddress_udp_tests(void)
|
||||||
|
|
||||||
/* Try setting a null address */
|
/* Try setting a null address */
|
||||||
rc = IWSDUdpAddress_SetTransportAddress(udpAddress, NULL);
|
rc = IWSDUdpAddress_SetTransportAddress(udpAddress, NULL);
|
||||||
todo_wine ok(rc == E_INVALIDARG, "SetTransportAddress(NULL) returned unexpected result: %08x\n", rc);
|
ok(rc == E_INVALIDARG, "SetTransportAddress(NULL) returned unexpected result: %08x\n", rc);
|
||||||
|
|
||||||
/* Try setting an invalid address */
|
/* Try setting an invalid address */
|
||||||
rc = IWSDUdpAddress_SetTransportAddress(udpAddress, invalidAddress);
|
rc = IWSDUdpAddress_SetTransportAddress(udpAddress, invalidAddress);
|
||||||
todo_wine ok(rc == HRESULT_FROM_WIN32(WSAHOST_NOT_FOUND), "SetTransportAddress(invalidAddress) returned unexpected result: %08x\n", rc);
|
ok(rc == HRESULT_FROM_WIN32(WSAHOST_NOT_FOUND), "SetTransportAddress(invalidAddress) returned unexpected result: %08x\n", rc);
|
||||||
|
|
||||||
/* Try setting an IPv4 address */
|
/* Try setting an IPv4 address */
|
||||||
rc = IWSDUdpAddress_SetTransportAddress(udpAddress, ipv4Address);
|
rc = IWSDUdpAddress_SetTransportAddress(udpAddress, ipv4Address);
|
||||||
todo_wine ok(rc == S_OK, "SetTransportAddress(ipv4Address) failed: %08x\n", rc);
|
ok(rc == S_OK, "SetTransportAddress(ipv4Address) failed: %08x\n", rc);
|
||||||
|
|
||||||
rc = IWSDUdpAddress_GetTransportAddress(udpAddress, NULL);
|
rc = IWSDUdpAddress_GetTransportAddress(udpAddress, NULL);
|
||||||
todo_wine ok(rc == E_POINTER, "GetTransportAddress(NULL) returned unexpected result: %08x\n", rc);
|
todo_wine ok(rc == E_POINTER, "GetTransportAddress(NULL) returned unexpected result: %08x\n", rc);
|
||||||
|
@ -118,7 +118,7 @@ static void GetSetTransportAddress_udp_tests(void)
|
||||||
|
|
||||||
/* Try setting an IPv6 address */
|
/* Try setting an IPv6 address */
|
||||||
rc = IWSDUdpAddress_SetTransportAddress(udpAddress, ipv6Address);
|
rc = IWSDUdpAddress_SetTransportAddress(udpAddress, ipv6Address);
|
||||||
todo_wine ok(rc == S_OK, "SetTransportAddress(ipv6Address) failed: %08x\n", rc);
|
ok(rc == S_OK, "SetTransportAddress(ipv6Address) failed: %08x\n", rc);
|
||||||
|
|
||||||
rc = IWSDUdpAddress_GetTransportAddress(udpAddress, &returnedAddress);
|
rc = IWSDUdpAddress_GetTransportAddress(udpAddress, &returnedAddress);
|
||||||
todo_wine ok(rc == S_OK, "GetTransportAddress returned unexpected result: %08x\n", rc);
|
todo_wine ok(rc == S_OK, "GetTransportAddress returned unexpected result: %08x\n", rc);
|
||||||
|
@ -264,7 +264,7 @@ static void GetSetSockaddr_udp_tests(void)
|
||||||
|
|
||||||
/* Try setting a transport address */
|
/* Try setting a transport address */
|
||||||
rc = IWSDUdpAddress_SetTransportAddress(udpAddress, expectedIpv6TransportAddr);
|
rc = IWSDUdpAddress_SetTransportAddress(udpAddress, expectedIpv6TransportAddr);
|
||||||
todo_wine ok(rc == S_OK, "SetTransportAddress failed: %08x\n", rc);
|
ok(rc == S_OK, "SetTransportAddress failed: %08x\n", rc);
|
||||||
|
|
||||||
/* A socket address should be returned */
|
/* A socket address should be returned */
|
||||||
rc = IWSDUdpAddress_GetSockaddr(udpAddress, &returnedStorage);
|
rc = IWSDUdpAddress_GetSockaddr(udpAddress, &returnedStorage);
|
||||||
|
|
|
@ -96,7 +96,7 @@ static void LocalAddress_tests(void)
|
||||||
ok(origUdpAddress != NULL, "WSDCreateUdpMessageParameters(NULL, &origUdpAddress) failed: origUdpAddress == NULL\n");
|
ok(origUdpAddress != NULL, "WSDCreateUdpMessageParameters(NULL, &origUdpAddress) failed: origUdpAddress == NULL\n");
|
||||||
|
|
||||||
rc = IWSDUdpAddress_SetTransportAddress(origUdpAddress, address);
|
rc = IWSDUdpAddress_SetTransportAddress(origUdpAddress, address);
|
||||||
todo_wine ok(rc == S_OK, "SetTransportAddress failed: %08x\n", rc);
|
ok(rc == S_OK, "SetTransportAddress failed: %08x\n", rc);
|
||||||
|
|
||||||
rc = IWSDUdpMessageParameters_SetLocalAddress(udpMessageParams, (IWSDAddress *)origUdpAddress);
|
rc = IWSDUdpMessageParameters_SetLocalAddress(udpMessageParams, (IWSDAddress *)origUdpAddress);
|
||||||
ok(rc == S_OK, "SetLocalAddress failed: %08x\n", rc);
|
ok(rc == S_OK, "SetLocalAddress failed: %08x\n", rc);
|
||||||
|
@ -154,7 +154,7 @@ static void RemoteAddress_tests(void)
|
||||||
ok(origUdpAddress != NULL, "WSDCreateUdpMessageParameters(NULL, &origUdpAddress) failed: origUdpAddress == NULL\n");
|
ok(origUdpAddress != NULL, "WSDCreateUdpMessageParameters(NULL, &origUdpAddress) failed: origUdpAddress == NULL\n");
|
||||||
|
|
||||||
rc = IWSDUdpAddress_SetTransportAddress(origUdpAddress, address);
|
rc = IWSDUdpAddress_SetTransportAddress(origUdpAddress, address);
|
||||||
todo_wine ok(rc == S_OK, "SetTransportAddress failed: %08x\n", rc);
|
ok(rc == S_OK, "SetTransportAddress failed: %08x\n", rc);
|
||||||
|
|
||||||
rc = IWSDUdpMessageParameters_SetRemoteAddress(udpMessageParams, (IWSDAddress *)origUdpAddress);
|
rc = IWSDUdpMessageParameters_SetRemoteAddress(udpMessageParams, (IWSDAddress *)origUdpAddress);
|
||||||
ok(rc == S_OK, "SetRemoteAddress failed: %08x\n", rc);
|
ok(rc == S_OK, "SetRemoteAddress failed: %08x\n", rc);
|
||||||
|
|
Loading…
Reference in New Issue