Commit 52ad4d0e authored by Owen Rudge's avatar Owen Rudge Committed by Alexandre Julliard

wsdapi: Implement IWSDUdpAddress_Get/SetPort.

parent d140cd50
......@@ -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)
......
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment