Owen Rudge : wsdapi: Implement IWSDUdpAddress_Get/SetPort.
Alexandre Julliard
julliard at winehq.org
Mon Jul 3 15:56:47 CDT 2017
Module: wine
Branch: master
Commit: 52ad4d0e6624041ccc8c13504e4d8480fc92ff9c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=52ad4d0e6624041ccc8c13504e4d8480fc92ff9c
Author: Owen Rudge <orudge at codeweavers.com>
Date: Wed Jun 28 22:13:18 2017 +0100
wsdapi: Implement IWSDUdpAddress_Get/SetPort.
Signed-off-by: Owen Rudge <orudge at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wsdapi/address.c | 22 ++++++++++++++++++----
dlls/wsdapi/tests/address.c | 22 +++++++++++-----------
2 files changed, 29 insertions(+), 15 deletions(-)
diff --git a/dlls/wsdapi/address.c b/dlls/wsdapi/address.c
index 05c4bb9..f225930 100644
--- a/dlls/wsdapi/address.c
+++ b/dlls/wsdapi/address.c
@@ -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)
diff --git a/dlls/wsdapi/tests/address.c b/dlls/wsdapi/tests/address.c
index 2142045..1a18f02 100644
--- a/dlls/wsdapi/tests/address.c
+++ b/dlls/wsdapi/tests/address.c
@@ -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 */
More information about the wine-cvs
mailing list