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:
parent
d140cd504a
commit
52ad4d0e66
|
@ -37,6 +37,7 @@ typedef struct IWSDUdpAddressImpl {
|
||||||
SOCKADDR_STORAGE sockAddr;
|
SOCKADDR_STORAGE sockAddr;
|
||||||
WCHAR ipv4Address[25];
|
WCHAR ipv4Address[25];
|
||||||
WCHAR ipv6Address[64];
|
WCHAR ipv6Address[64];
|
||||||
|
WORD port;
|
||||||
} IWSDUdpAddressImpl;
|
} IWSDUdpAddressImpl;
|
||||||
|
|
||||||
static inline IWSDUdpAddressImpl *impl_from_IWSDUdpAddress(IWSDUdpAddress *iface)
|
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)
|
static HRESULT WINAPI IWSDUdpAddressImpl_GetPort(IWSDUdpAddress *This, WORD *pwPort)
|
||||||
{
|
{
|
||||||
FIXME("(%p, %p)\n", This, pwPort);
|
IWSDUdpAddressImpl *impl = impl_from_IWSDUdpAddress(This);
|
||||||
return E_NOTIMPL;
|
|
||||||
|
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)
|
static HRESULT WINAPI IWSDUdpAddressImpl_SetPort(IWSDUdpAddress *This, WORD wPort)
|
||||||
{
|
{
|
||||||
FIXME("(%p, %d)\n", This, wPort);
|
IWSDUdpAddressImpl *impl = impl_from_IWSDUdpAddress(This);
|
||||||
return E_NOTIMPL;
|
|
||||||
|
TRACE("(%p, %d)\n", This, wPort);
|
||||||
|
|
||||||
|
impl->port = wPort;
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IWSDUdpAddressImpl_GetTransportAddressEx(IWSDUdpAddress *This, BOOL fSafe, LPCWSTR *ppszAddress)
|
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 */
|
/* No test for GetPort(NULL) as this causes an access violation exception on Windows */
|
||||||
|
|
||||||
rc = IWSDUdpAddress_GetPort(udpAddress, &actualPort);
|
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);
|
ok(actualPort == 0, "GetPort returned unexpected port: %d\n", actualPort);
|
||||||
|
|
||||||
/* Try setting a zero port */
|
/* Try setting a zero port */
|
||||||
rc = IWSDUdpAddress_SetPort(udpAddress, 0);
|
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);
|
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);
|
ok(actualPort == 0, "GetPort returned unexpected port: %d\n", actualPort);
|
||||||
|
|
||||||
/* Set a real port */
|
/* Set a real port */
|
||||||
rc = IWSDUdpAddress_SetPort(udpAddress, expectedPort1);
|
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);
|
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);
|
||||||
todo_wine ok(actualPort == expectedPort1, "GetPort returned unexpected port: %d\n", actualPort);
|
ok(actualPort == expectedPort1, "GetPort returned unexpected port: %d\n", actualPort);
|
||||||
|
|
||||||
/* Now set a different port */
|
/* Now set a different port */
|
||||||
rc = IWSDUdpAddress_SetPort(udpAddress, expectedPort2);
|
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);
|
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);
|
||||||
todo_wine ok(actualPort == expectedPort2, "GetPort returned unexpected port: %d\n", actualPort);
|
ok(actualPort == expectedPort2, "GetPort returned unexpected port: %d\n", actualPort);
|
||||||
|
|
||||||
/* Release the object */
|
/* Release the object */
|
||||||
ret = IWSDUdpAddress_Release(udpAddress);
|
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 */
|
/* Check that GetPort doesn't return the port set via the socket */
|
||||||
rc = IWSDUdpAddress_GetPort(udpAddress, &port);
|
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);
|
ok(port == 0, "GetPort returned unexpected port: %d\n", port);
|
||||||
|
|
||||||
/* Try setting an IPv4 address without a 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 */
|
/* Check that GetPort doesn't return the port set via the socket */
|
||||||
rc = IWSDUdpAddress_GetPort(udpAddress, &port);
|
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);
|
ok(port == 0, "GetPort returned unexpected port: %d\n", port);
|
||||||
|
|
||||||
/* Try setting an IPv6 address without a port */
|
/* Try setting an IPv6 address without a port */
|
||||||
|
|
Loading…
Reference in New Issue