wsdapi: Implement IWSDUdpAddress_Get/SetPort.

Signed-off-by: Owen Rudge <orudge@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Owen Rudge 2017-06-28 22:13:18 +01:00 committed by Alexandre Julliard
parent d140cd504a
commit 52ad4d0e66
2 changed files with 29 additions and 15 deletions

View File

@ -37,6 +37,7 @@ typedef struct IWSDUdpAddressImpl {
SOCKADDR_STORAGE sockAddr;
WCHAR ipv4Address[25];
WCHAR ipv6Address[64];
WORD port;
} IWSDUdpAddressImpl;
static inline IWSDUdpAddressImpl *impl_from_IWSDUdpAddress(IWSDUdpAddress *iface)
@ -113,14 +114,27 @@ static HRESULT WINAPI IWSDUdpAddressImpl_Deserialize(IWSDUdpAddress *This, LPCWS
static HRESULT WINAPI IWSDUdpAddressImpl_GetPort(IWSDUdpAddress *This, WORD *pwPort)
{
FIXME("(%p, %p)\n", This, pwPort);
return E_NOTIMPL;
IWSDUdpAddressImpl *impl = impl_from_IWSDUdpAddress(This);
TRACE("(%p, %p)\n", This, pwPort);
if (pwPort == NULL)
{
return E_POINTER;
}
*pwPort = impl->port;
return S_OK;
}
static HRESULT WINAPI IWSDUdpAddressImpl_SetPort(IWSDUdpAddress *This, WORD wPort)
{
FIXME("(%p, %d)\n", This, wPort);
return E_NOTIMPL;
IWSDUdpAddressImpl *impl = impl_from_IWSDUdpAddress(This);
TRACE("(%p, %d)\n", This, wPort);
impl->port = wPort;
return S_OK;
}
static HRESULT WINAPI IWSDUdpAddressImpl_GetTransportAddressEx(IWSDUdpAddress *This, BOOL fSafe, LPCWSTR *ppszAddress)

View File

@ -164,32 +164,32 @@ static void GetSetPort_udp_tests(void)
/* No test for GetPort(NULL) as this causes an access violation exception on Windows */
rc = IWSDUdpAddress_GetPort(udpAddress, &actualPort);
todo_wine ok(rc == S_OK, "GetPort returned unexpected result: %08x\n", rc);
ok(rc == S_OK, "GetPort returned unexpected result: %08x\n", rc);
ok(actualPort == 0, "GetPort returned unexpected port: %d\n", actualPort);
/* Try setting a zero port */
rc = IWSDUdpAddress_SetPort(udpAddress, 0);
todo_wine ok(rc == S_OK, "SetPort returned unexpected result: %08x\n", rc);
ok(rc == S_OK, "SetPort returned unexpected result: %08x\n", rc);
rc = IWSDUdpAddress_GetPort(udpAddress, &actualPort);
todo_wine ok(rc == S_OK, "GetPort returned unexpected result: %08x\n", rc);
ok(rc == S_OK, "GetPort returned unexpected result: %08x\n", rc);
ok(actualPort == 0, "GetPort returned unexpected port: %d\n", actualPort);
/* Set a real port */
rc = IWSDUdpAddress_SetPort(udpAddress, expectedPort1);
todo_wine ok(rc == S_OK, "SetPort returned unexpected result: %08x\n", rc);
ok(rc == S_OK, "SetPort returned unexpected result: %08x\n", rc);
rc = IWSDUdpAddress_GetPort(udpAddress, &actualPort);
todo_wine ok(rc == S_OK, "GetPort returned unexpected result: %08x\n", rc);
todo_wine ok(actualPort == expectedPort1, "GetPort returned unexpected port: %d\n", actualPort);
ok(rc == S_OK, "GetPort returned unexpected result: %08x\n", rc);
ok(actualPort == expectedPort1, "GetPort returned unexpected port: %d\n", actualPort);
/* Now set a different port */
rc = IWSDUdpAddress_SetPort(udpAddress, expectedPort2);
todo_wine ok(rc == S_OK, "SetPort returned unexpected result: %08x\n", rc);
ok(rc == S_OK, "SetPort returned unexpected result: %08x\n", rc);
rc = IWSDUdpAddress_GetPort(udpAddress, &actualPort);
todo_wine ok(rc == S_OK, "GetPort returned unexpected result: %08x\n", rc);
todo_wine ok(actualPort == expectedPort2, "GetPort returned unexpected port: %d\n", actualPort);
ok(rc == S_OK, "GetPort returned unexpected result: %08x\n", rc);
ok(actualPort == expectedPort2, "GetPort returned unexpected port: %d\n", actualPort);
/* Release the object */
ret = IWSDUdpAddress_Release(udpAddress);
@ -330,7 +330,7 @@ static void GetSetSockaddr_udp_tests(void)
/* Check that GetPort doesn't return the port set via the socket */
rc = IWSDUdpAddress_GetPort(udpAddress, &port);
todo_wine ok(rc == S_OK, "GetPort returned unexpected result: %08x\n", rc);
ok(rc == S_OK, "GetPort returned unexpected result: %08x\n", rc);
ok(port == 0, "GetPort returned unexpected port: %d\n", port);
/* Try setting an IPv4 address without a port */
@ -370,7 +370,7 @@ static void GetSetSockaddr_udp_tests(void)
/* Check that GetPort doesn't return the port set via the socket */
rc = IWSDUdpAddress_GetPort(udpAddress, &port);
todo_wine ok(rc == S_OK, "GetPort returned unexpected result: %08x\n", rc);
ok(rc == S_OK, "GetPort returned unexpected result: %08x\n", rc);
ok(port == 0, "GetPort returned unexpected port: %d\n", port);
/* Try setting an IPv6 address without a port */