From: Anton Baskanov baskanov@gmail.com
--- dlls/dplayx/dplay.c | 6 ++++++ dlls/dplayx/tests/dplayx.c | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index 1a4edb61ebf..e6dccc2097c 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -3841,6 +3841,12 @@ static HRESULT DP_IF_Receive( IDirectPlayImpl *This, DPID *lpidFrom, DPID *lpidT
msgSize = lpMsg->copyMessage( NULL, lpMsg->msg, lpMsg->genericSize, bAnsi );
+ if( *lpdwDataSize < msgSize ) + { + *lpdwDataSize = msgSize; + return DPERR_BUFFERTOOSMALL; + } + *lpidFrom = lpMsg->fromId; *lpidTo = lpMsg->toId; *lpdwDataSize = msgSize; diff --git a/dlls/dplayx/tests/dplayx.c b/dlls/dplayx/tests/dplayx.c index 73278501884..0ae709a89a1 100644 --- a/dlls/dplayx/tests/dplayx.c +++ b/dlls/dplayx/tests/dplayx.c @@ -8152,9 +8152,9 @@ static void test_Receive(void) toId = 0xdeadbeef; msgDataSize = sizeof( data0 ) - 1; hr = IDirectPlayX_Receive( dp, &fromId, &toId, DPRECEIVE_ALL | DPRECEIVE_PEEK, msgData, &msgDataSize ); - todo_wine ok( hr == DPERR_BUFFERTOOSMALL, "got hr %#lx.\n", hr ); - todo_wine ok( fromId == 0xdeadbeef, "got source id %#lx.\n", fromId ); - todo_wine ok( toId == 0xdeadbeef, "got destination id %#lx.\n", toId ); + ok( hr == DPERR_BUFFERTOOSMALL, "got hr %#lx.\n", hr ); + ok( fromId == 0xdeadbeef, "got source id %#lx.\n", fromId ); + ok( toId == 0xdeadbeef, "got destination id %#lx.\n", toId ); ok( msgDataSize == sizeof( data0 ), "got message size %lu.\n", msgDataSize );
fromId = 0xdeadbeef;