wsdapi: Implement Get/SetRetransmitParams.

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-26 22:35:49 +01:00 committed by Alexandre Julliard
parent 7b3024a255
commit 4373eb30a4
2 changed files with 54 additions and 24 deletions

View File

@ -38,6 +38,7 @@ typedef struct IWSDMessageParametersImpl {
typedef struct IWSDUdpMessageParametersImpl { typedef struct IWSDUdpMessageParametersImpl {
IWSDMessageParametersImpl base; IWSDMessageParametersImpl base;
WSDUdpRetransmitParams retransmitParams;
} IWSDUdpMessageParametersImpl; } IWSDUdpMessageParametersImpl;
static inline IWSDMessageParametersImpl *impl_from_IWSDMessageParameters(IWSDMessageParameters *iface) static inline IWSDMessageParametersImpl *impl_from_IWSDMessageParameters(IWSDMessageParameters *iface)
@ -248,14 +249,32 @@ static HRESULT WINAPI IWSDUdpMessageParametersImpl_GetLowerParameters(IWSDUdpMes
static HRESULT WINAPI IWSDUdpMessageParametersImpl_SetRetransmitParams(IWSDUdpMessageParameters *This, const WSDUdpRetransmitParams *pParams) static HRESULT WINAPI IWSDUdpMessageParametersImpl_SetRetransmitParams(IWSDUdpMessageParameters *This, const WSDUdpRetransmitParams *pParams)
{ {
FIXME("(%p, %p)\n", This, pParams); IWSDUdpMessageParametersImpl *impl = impl_from_IWSDUdpMessageParameters(This);
return E_NOTIMPL;
TRACE("(%p, %p)\n", impl, pParams);
if (pParams == NULL)
{
return E_INVALIDARG;
}
impl->retransmitParams = *pParams;
return S_OK;
} }
static HRESULT WINAPI IWSDUdpMessageParametersImpl_GetRetransmitParams(IWSDUdpMessageParameters *This, WSDUdpRetransmitParams *pParams) static HRESULT WINAPI IWSDUdpMessageParametersImpl_GetRetransmitParams(IWSDUdpMessageParameters *This, WSDUdpRetransmitParams *pParams)
{ {
FIXME("(%p, %p)\n", This, pParams); IWSDUdpMessageParametersImpl *impl = impl_from_IWSDUdpMessageParameters(This);
return E_NOTIMPL;
TRACE("(%p, %p)\n", impl, pParams);
if (pParams == NULL)
{
return E_POINTER;
}
* pParams = impl->retransmitParams;
return S_OK;
} }
static const IWSDUdpMessageParametersVtbl udpMsgParamsVtbl = static const IWSDUdpMessageParametersVtbl udpMsgParamsVtbl =
@ -297,6 +316,13 @@ HRESULT WINAPI WSDCreateUdpMessageParameters(IWSDUdpMessageParameters **ppTxPara
obj->base.IWSDMessageParameters_iface.lpVtbl = (IWSDMessageParametersVtbl *)&udpMsgParamsVtbl; obj->base.IWSDMessageParameters_iface.lpVtbl = (IWSDMessageParametersVtbl *)&udpMsgParamsVtbl;
obj->base.ref = 1; obj->base.ref = 1;
/* Populate default retransmit parameters */
obj->retransmitParams.ulSendDelay = 0;
obj->retransmitParams.ulRepeat = 1;
obj->retransmitParams.ulRepeatMinDelay = 50;
obj->retransmitParams.ulRepeatMaxDelay = 250;
obj->retransmitParams.ulRepeatUpperDelay = 450;
*ppTxParams = (IWSDUdpMessageParameters *)&obj->base.IWSDMessageParameters_iface; *ppTxParams = (IWSDUdpMessageParameters *)&obj->base.IWSDMessageParameters_iface;
TRACE("Returning iface %p\n", *ppTxParams); TRACE("Returning iface %p\n", *ppTxParams);

View File

@ -197,17 +197,17 @@ static void RetransmitParams_tests(void)
ok(udpMessageParams != NULL, "WSDCreateUdpMessageParameters(NULL, &udpMessageParams) failed: udpMessageParams == NULL\n"); ok(udpMessageParams != NULL, "WSDCreateUdpMessageParameters(NULL, &udpMessageParams) failed: udpMessageParams == NULL\n");
rc = IWSDUdpMessageParameters_GetRetransmitParams(udpMessageParams, NULL); rc = IWSDUdpMessageParameters_GetRetransmitParams(udpMessageParams, NULL);
todo_wine ok(rc == E_POINTER, "GetRetransmitParams returned unexpected result: %08x\n", rc); ok(rc == E_POINTER, "GetRetransmitParams returned unexpected result: %08x\n", rc);
/* Check if the default values are returned */ /* Check if the default values are returned */
rc = IWSDUdpMessageParameters_GetRetransmitParams(udpMessageParams, &returnedParams); rc = IWSDUdpMessageParameters_GetRetransmitParams(udpMessageParams, &returnedParams);
todo_wine ok(rc == S_OK, "GetRetransmitParams failed: %08x\n", rc); ok(rc == S_OK, "GetRetransmitParams failed: %08x\n", rc);
ok(returnedParams.ulSendDelay == 0, "ulSendDelay = %d\n", returnedParams.ulSendDelay); ok(returnedParams.ulSendDelay == 0, "ulSendDelay = %d\n", returnedParams.ulSendDelay);
todo_wine ok(returnedParams.ulRepeat == 1, "ulRepeat = %d\n", returnedParams.ulRepeat); ok(returnedParams.ulRepeat == 1, "ulRepeat = %d\n", returnedParams.ulRepeat);
todo_wine ok(returnedParams.ulRepeatMinDelay == 50, "ulRepeatMinDelay = %d\n", returnedParams.ulRepeatMinDelay); ok(returnedParams.ulRepeatMinDelay == 50, "ulRepeatMinDelay = %d\n", returnedParams.ulRepeatMinDelay);
todo_wine ok(returnedParams.ulRepeatMaxDelay == 250, "ulRepeatMaxDelay = %d\n", returnedParams.ulRepeatMaxDelay); ok(returnedParams.ulRepeatMaxDelay == 250, "ulRepeatMaxDelay = %d\n", returnedParams.ulRepeatMaxDelay);
todo_wine ok(returnedParams.ulRepeatUpperDelay == 450, "ulRepeatUpperDelay = %d\n", returnedParams.ulRepeatUpperDelay); ok(returnedParams.ulRepeatUpperDelay == 450, "ulRepeatUpperDelay = %d\n", returnedParams.ulRepeatUpperDelay);
/* Now try setting some custom parameters */ /* Now try setting some custom parameters */
origParams.ulSendDelay = 100; origParams.ulSendDelay = 100;
@ -217,18 +217,22 @@ static void RetransmitParams_tests(void)
origParams.ulRepeatUpperDelay = 500; origParams.ulRepeatUpperDelay = 500;
rc = IWSDUdpMessageParameters_SetRetransmitParams(udpMessageParams, &origParams); rc = IWSDUdpMessageParameters_SetRetransmitParams(udpMessageParams, &origParams);
todo_wine ok(rc == S_OK, "SetRetransmitParams failed: %08x\n", rc); ok(rc == S_OK, "SetRetransmitParams failed: %08x\n", rc);
ZeroMemory(&returnedParams, sizeof(WSDUdpRetransmitParams)); ZeroMemory(&returnedParams, sizeof(WSDUdpRetransmitParams));
rc = IWSDUdpMessageParameters_GetRetransmitParams(udpMessageParams, &returnedParams); rc = IWSDUdpMessageParameters_GetRetransmitParams(udpMessageParams, &returnedParams);
todo_wine ok(rc == S_OK, "GetRetransmitParams failed: %08x\n", rc); ok(rc == S_OK, "GetRetransmitParams failed: %08x\n", rc);
todo_wine ok(origParams.ulSendDelay == returnedParams.ulSendDelay, "ulSendDelay = %d\n", returnedParams.ulSendDelay); ok(origParams.ulSendDelay == returnedParams.ulSendDelay, "ulSendDelay = %d\n", returnedParams.ulSendDelay);
todo_wine ok(origParams.ulRepeat == returnedParams.ulRepeat, "ulRepeat = %d\n", returnedParams.ulRepeat); ok(origParams.ulRepeat == returnedParams.ulRepeat, "ulRepeat = %d\n", returnedParams.ulRepeat);
todo_wine ok(origParams.ulRepeatMinDelay == returnedParams.ulRepeatMinDelay, "ulRepeatMinDelay = %d\n", returnedParams.ulRepeatMinDelay); ok(origParams.ulRepeatMinDelay == returnedParams.ulRepeatMinDelay, "ulRepeatMinDelay = %d\n", returnedParams.ulRepeatMinDelay);
todo_wine ok(origParams.ulRepeatMaxDelay == returnedParams.ulRepeatMaxDelay, "ulRepeatMaxDelay = %d\n", returnedParams.ulRepeatMaxDelay); ok(origParams.ulRepeatMaxDelay == returnedParams.ulRepeatMaxDelay, "ulRepeatMaxDelay = %d\n", returnedParams.ulRepeatMaxDelay);
todo_wine ok(origParams.ulRepeatUpperDelay == returnedParams.ulRepeatUpperDelay, "ulRepeatUpperDelay = %d\n", returnedParams.ulRepeatUpperDelay); ok(origParams.ulRepeatUpperDelay == returnedParams.ulRepeatUpperDelay, "ulRepeatUpperDelay = %d\n", returnedParams.ulRepeatUpperDelay);
/* Try setting a null parameter */
rc = IWSDUdpMessageParameters_SetRetransmitParams(udpMessageParams, NULL);
ok(rc == E_INVALIDARG, "SetRetransmitParams returned unexpected result: %08x\n", rc);
/* Now attempt to set some invalid parameters - these appear to be accepted */ /* Now attempt to set some invalid parameters - these appear to be accepted */
origParams.ulSendDelay = INFINITE; origParams.ulSendDelay = INFINITE;
@ -238,18 +242,18 @@ static void RetransmitParams_tests(void)
origParams.ulRepeatUpperDelay = 100; origParams.ulRepeatUpperDelay = 100;
rc = IWSDUdpMessageParameters_SetRetransmitParams(udpMessageParams, &origParams); rc = IWSDUdpMessageParameters_SetRetransmitParams(udpMessageParams, &origParams);
todo_wine ok(rc == S_OK, "SetRetransmitParams failed: %08x\n", rc); ok(rc == S_OK, "SetRetransmitParams failed: %08x\n", rc);
ZeroMemory(&returnedParams, sizeof(WSDUdpRetransmitParams)); ZeroMemory(&returnedParams, sizeof(WSDUdpRetransmitParams));
rc = IWSDUdpMessageParameters_GetRetransmitParams(udpMessageParams, &returnedParams); rc = IWSDUdpMessageParameters_GetRetransmitParams(udpMessageParams, &returnedParams);
todo_wine ok(rc == S_OK, "GetRetransmitParams failed: %08x\n", rc); ok(rc == S_OK, "GetRetransmitParams failed: %08x\n", rc);
todo_wine ok(origParams.ulSendDelay == returnedParams.ulSendDelay, "ulSendDelay = %d\n", returnedParams.ulSendDelay); ok(origParams.ulSendDelay == returnedParams.ulSendDelay, "ulSendDelay = %d\n", returnedParams.ulSendDelay);
todo_wine ok(origParams.ulRepeat == returnedParams.ulRepeat, "ulRepeat = %d\n", returnedParams.ulRepeat); ok(origParams.ulRepeat == returnedParams.ulRepeat, "ulRepeat = %d\n", returnedParams.ulRepeat);
todo_wine ok(origParams.ulRepeatMinDelay == returnedParams.ulRepeatMinDelay, "ulRepeatMinDelay = %d\n", returnedParams.ulRepeatMinDelay); ok(origParams.ulRepeatMinDelay == returnedParams.ulRepeatMinDelay, "ulRepeatMinDelay = %d\n", returnedParams.ulRepeatMinDelay);
todo_wine ok(origParams.ulRepeatMaxDelay == returnedParams.ulRepeatMaxDelay, "ulRepeatMaxDelay = %d\n", returnedParams.ulRepeatMaxDelay); ok(origParams.ulRepeatMaxDelay == returnedParams.ulRepeatMaxDelay, "ulRepeatMaxDelay = %d\n", returnedParams.ulRepeatMaxDelay);
todo_wine ok(origParams.ulRepeatUpperDelay == returnedParams.ulRepeatUpperDelay, "ulRepeatUpperDelay = %d\n", returnedParams.ulRepeatUpperDelay); ok(origParams.ulRepeatUpperDelay == returnedParams.ulRepeatUpperDelay, "ulRepeatUpperDelay = %d\n", returnedParams.ulRepeatUpperDelay);
ret = IWSDUdpMessageParameters_Release(udpMessageParams); ret = IWSDUdpMessageParameters_Release(udpMessageParams);
ok(ret == 0, "IWSDUdpMessageParameters_Release() has %d references, should have 0\n", ret); ok(ret == 0, "IWSDUdpMessageParameters_Release() has %d references, should have 0\n", ret);