From: Anton Baskanov baskanov@gmail.com
--- dlls/dplayx/dplay.c | 25 +++++++------------------ dlls/dplayx/tests/dplayx.c | 34 +++++++++++++++++----------------- 2 files changed, 24 insertions(+), 35 deletions(-)
diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index cc7972a7516..f0b6fd2c866 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -3798,7 +3798,7 @@ static HRESULT DP_IF_Receive( IDirectPlayImpl *This, DPID *lpidFrom, DPID *lpidT LPDPMSG lpMsg = NULL; DWORD msgSize;
- FIXME( "(%p)->(%p,%p,0x%08lx,%p,%p,%u): stub\n", + TRACE( "(%p)->(%p,%p,0x%08lx,%p,%p,%u)\n", This, lpidFrom, lpidTo, dwFlags, lpData, lpdwDataSize, bAnsi );
if( This->dp2->connectionInitialized == NO_PROVIDER ) @@ -3806,24 +3806,13 @@ static HRESULT DP_IF_Receive( IDirectPlayImpl *This, DPID *lpidFrom, DPID *lpidT return DPERR_UNINITIALIZED; }
- if( dwFlags == 0 ) - { - dwFlags = DPRECEIVE_ALL; - } - - if( dwFlags & DPRECEIVE_ALL ) - { - lpMsg = This->dp2->receiveMsgs.lpQHFirst; - } - else if( ( dwFlags & DPRECEIVE_TOPLAYER ) || - ( dwFlags & DPRECEIVE_FROMPLAYER ) - ) - { - FIXME( "Find matching message 0x%08lx\n", dwFlags ); - } - else + for( lpMsg = DPQ_FIRST( This->dp2->receiveMsgs ); lpMsg; lpMsg = DPQ_NEXT( lpMsg->msgs ) ) { - ERR( "Hmmm..dwFlags 0x%08lx\n", dwFlags ); + if( ( dwFlags & DPRECEIVE_TOPLAYER ) && ( lpMsg->toId != *lpidTo ) ) + continue; + if( ( dwFlags & DPRECEIVE_FROMPLAYER ) && ( lpMsg->fromId != *lpidFrom ) ) + continue; + break; }
if( lpMsg == NULL ) diff --git a/dlls/dplayx/tests/dplayx.c b/dlls/dplayx/tests/dplayx.c index d921966abe6..c9428aafead 100644 --- a/dlls/dplayx/tests/dplayx.c +++ b/dlls/dplayx/tests/dplayx.c @@ -8182,11 +8182,11 @@ static void test_Receive(void) memset( msgData, 0xcc, sizeof( msgData ) ); msgDataSize = sizeof( msgData ); hr = IDirectPlayX_Receive( dp, &fromId, &toId, DPRECEIVE_PEEK, msgData, &msgDataSize ); - todo_wine ok( hr == DP_OK, "got hr %#lx.\n", hr ); - todo_wine ok( fromId == 0x1337, "got source id %#lx.\n", fromId ); - todo_wine ok( toId == 0x07734, "got destination id %#lx.\n", toId ); - todo_wine ok( !memcmp( msgData, data0, sizeof( data0 ) ), "message data didn't match.\n" ); - todo_wine ok( msgDataSize == sizeof( data0 ), "got message size %lu.\n", msgDataSize ); + ok( hr == DP_OK, "got hr %#lx.\n", hr ); + ok( fromId == 0x1337, "got source id %#lx.\n", fromId ); + ok( toId == 0x07734, "got destination id %#lx.\n", toId ); + ok( !memcmp( msgData, data0, sizeof( data0 ) ), "message data didn't match.\n" ); + ok( msgDataSize == sizeof( data0 ), "got message size %lu.\n", msgDataSize );
fromId = 0xdeadbeef; toId = 0xdeadbeef; @@ -8230,11 +8230,11 @@ static void test_Receive(void) memset( msgData, 0xcc, sizeof( msgData ) ); msgDataSize = sizeof( msgData ); hr = IDirectPlayX_Receive( dp, &fromId, &toId, DPRECEIVE_FROMPLAYER, msgData, &msgDataSize ); - todo_wine ok( hr == DP_OK, "got hr %#lx.\n", hr ); + ok( hr == DP_OK, "got hr %#lx.\n", hr ); ok( fromId == 0x1337, "got source id %#lx.\n", fromId ); - todo_wine ok( toId == 0x07734, "got destination id %#lx.\n", toId ); - todo_wine ok( !memcmp( msgData, data0, sizeof( data0 ) ), "message data didn't match.\n" ); - todo_wine ok( msgDataSize == sizeof( data0 ), "got message size %lu.\n", msgDataSize ); + ok( toId == 0x07734, "got destination id %#lx.\n", toId ); + ok( !memcmp( msgData, data0, sizeof( data0 ) ), "message data didn't match.\n" ); + ok( msgDataSize == sizeof( data0 ), "got message size %lu.\n", msgDataSize );
fromId = 0x1337; toId = 0xdeadbeef; @@ -8254,11 +8254,11 @@ static void test_Receive(void) memset( msgData, 0xcc, sizeof( msgData ) ); msgDataSize = sizeof( msgData ); hr = IDirectPlayX_Receive( dp, &fromId, &toId, DPRECEIVE_TOPLAYER, msgData, &msgDataSize ); - todo_wine ok( hr == DP_OK, "got hr %#lx.\n", hr ); - todo_wine ok( fromId == 0x1337, "got source id %#lx.\n", fromId ); + ok( hr == DP_OK, "got hr %#lx.\n", hr ); + ok( fromId == 0x1337, "got source id %#lx.\n", fromId ); ok( toId == 0x07734, "got destination id %#lx.\n", toId ); - todo_wine ok( !memcmp( msgData, data0, sizeof( data0 ) ), "message data didn't match.\n" ); - todo_wine ok( msgDataSize == sizeof( data0 ), "got message size %lu.\n", msgDataSize ); + ok( !memcmp( msgData, data0, sizeof( data0 ) ), "message data didn't match.\n" ); + ok( msgDataSize == sizeof( data0 ), "got message size %lu.\n", msgDataSize );
toId = 0x07734; msgDataSize = sizeof( msgData ); @@ -8270,11 +8270,11 @@ static void test_Receive(void) memset( msgData, 0xcc, sizeof( msgData ) ); msgDataSize = sizeof( msgData ); hr = IDirectPlayX_Receive( dp, &fromId, &toId, DPRECEIVE_TOPLAYER, msgData, &msgDataSize ); - todo_wine ok( hr == DP_OK, "got hr %#lx.\n", hr ); - todo_wine ok( fromId == 0x1337, "got source id %#lx.\n", fromId ); + ok( hr == DP_OK, "got hr %#lx.\n", hr ); + ok( fromId == 0x1337, "got source id %#lx.\n", fromId ); ok( toId == 0x14, "got destination id %#lx.\n", toId ); - todo_wine ok( !memcmp( msgData, data0, sizeof( data0 ) ), "message data didn't match.\n" ); - todo_wine ok( msgDataSize == sizeof( data0 ), "got message size %lu.\n", msgDataSize ); + ok( !memcmp( msgData, data0, sizeof( data0 ) ), "message data didn't match.\n" ); + ok( msgDataSize == sizeof( data0 ), "got message size %lu.\n", msgDataSize );
toId = 0x14; msgDataSize = sizeof( msgData );