With these changes it is now possible to join and play GTA 2 multiplayer sessions created by native dplay.
From: Anton Baskanov baskanov@gmail.com
--- dlls/dplayx/tests/dplayx.c | 161 +++++++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+)
diff --git a/dlls/dplayx/tests/dplayx.c b/dlls/dplayx/tests/dplayx.c index 08d2f48ae82..c2ebb66b2ab 100644 --- a/dlls/dplayx/tests/dplayx.c +++ b/dlls/dplayx/tests/dplayx.c @@ -988,6 +988,15 @@ typedef struct DWORD passwordOffset; } AddPlayerToGroup;
+typedef struct +{ + MessageHeader header; + DPID toId; + DPID groupId; + DWORD dataSize; + DWORD dataOffset; +} GroupDataChanged; + #include "poppack.h"
#define bindUdp( port ) bindUdp_( __LINE__, port ) @@ -2209,6 +2218,52 @@ static unsigned short receiveAddPlayerToGroup_( int line, SOCKET sock, DPID expe return port; }
+#define sendGroupDataChanged( sock, port, groupId, data, dataSize ) \ + sendGroupDataChanged_( __LINE__, sock, port, groupId, data, dataSize ) +static void sendGroupDataChanged_( int line, SOCKET sock, unsigned short port, DPID groupId, void *data, DWORD dataSize ) +{ +#include "pshpack1.h" + struct + { + SpHeader spHeader; + GroupDataChanged request; + BYTE data[ 256 ]; + } request = + { + .spHeader = + { + .mixed = 0xfab00000 + sizeof( request ), + .addr = + { + .sin_family = AF_INET, + .sin_port = htons( port ), + }, + }, + .request = + { + .header = + { + .magic = 0x79616c70, + .command = 17, + .version = 14, + }, + .toId = 0, + .groupId = groupId, + .dataSize = dataSize, + .dataOffset = sizeof( request.request ), + }, + }; +#include "poppack.h" + int wsResult; + int size; + + size = sizeof( request ) + dataSize; + memcpy( &request.data, data, dataSize ); + + wsResult = send( sock, (char *) &request, size, 0 ); + ok_( __FILE__, line )( wsResult == size, "send() returned %d.\n", wsResult ); +} + static void init_TCPIP_provider( IDirectPlay4 *pDP, LPCSTR strIPAddressString, WORD port ) {
@@ -9121,6 +9176,111 @@ static void test_AddPlayerToGroup(void) IDirectPlayX_Release( dp ); }
+/* GROUPDATACHANGED */ + +#define checkSetPlayerOrGroupDataMessage( dp, expectedPlayerType, expectedDpid, expectedData, expectedDataSize ) \ + checkSetPlayerOrGroupDataMessage_( __LINE__, dp, expectedPlayerType, expectedDpid, expectedData, expectedDataSize ) +static DPID checkSetPlayerOrGroupDataMessage_( int line, IDirectPlay4 *dp, DWORD expectedPlayerType, DPID expectedDpid, + void *expectedData, DWORD expectedDataSize ) +{ + DPMSG_SETPLAYERORGROUPDATA *msg; + BYTE msgData[ 256 ]; + DWORD msgDataSize; + DPID fromId, toId; + HRESULT hr; + + memset( &msgData, 0, sizeof( msgData ) ); + msgDataSize = sizeof( msgData ); + fromId = 0xdeadbeef; + toId = 0xdeadbeef; + hr = IDirectPlayX_Receive( dp, &fromId, &toId, 0, msgData, &msgDataSize ); + todo_wine ok_( __FILE__, line )( hr == DP_OK, "got hr %#lx.\n", hr ); + if ( FAILED( hr ) ) + return 0; + ok_( __FILE__, line )( fromId == DPID_SYSMSG, "got source id %#lx.\n", fromId ); + + msg = (DPMSG_SETPLAYERORGROUPDATA *) msgData; + ok_( __FILE__, line )( msg->dwType == DPSYS_SETPLAYERORGROUPDATA, "got message type %#lx.\n", msg->dwType ); + ok_( __FILE__, line )( msg->dwPlayerType == expectedPlayerType, "got player type %#lx.\n", msg->dwPlayerType ); + ok_( __FILE__, line )( msg->dpId == expectedDpid, "got dpid %#lx.\n", msg->dpId ); + ok_( __FILE__, line )( msg->dwDataSize == expectedDataSize, "got player data size %lu.\n", msg->dwDataSize ); + if ( expectedData ) + { + ok_( __FILE__, line )( msg->lpData && !memcmp( msg->lpData, expectedData, expectedDataSize ), + "data didn't match.\n" ); + } + else + { + ok_( __FILE__, line )( !msg->lpData, "got data %p.\n", msg->lpData ); + } + + return toId; +} + +static void test_GROUPDATACHANGED(void) +{ + BYTE expectedGroupData[] = { 8, 7, 6, 5, 4, 3, 2, 1, }; + DPSESSIONDESC2 appGuidDpsd = + { + .dwSize = sizeof( DPSESSIONDESC2 ), + .guidInstance = appGuid, + .guidApplication = appGuid, + }; + DPSESSIONDESC2 serverDpsd = + { + .dwSize = sizeof( DPSESSIONDESC2 ), + .guidApplication = appGuid, + .guidInstance = appGuid, + .lpszSessionName = (WCHAR *) L"normal", + .dwReserved1 = 0xaabbccdd, + }; + BYTE groupData[ 256 ]; + DWORD groupDataSize; + IDirectPlay4A *dp; + DWORD waitResult; + SOCKET sendSock; + SOCKET recvSock; + HANDLE event; + HRESULT hr; + DPID dpid; + + event = CreateEventA( NULL, FALSE, FALSE, NULL ); + + hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay4A, (void **) &dp ); + ok( hr == DP_OK, "got hr %#lx.\n", hr ); + + init_TCPIP_provider( dp, "127.0.0.1", 0 ); + + joinSession( dp, &appGuidDpsd, &serverDpsd, &sendSock, &recvSock, NULL ); + + createPlayer( dp, 0x11223344, event, NULL, 0, 0, sendSock, recvSock ); + + sendGroupDataChanged( sendSock, 2349, 0x5e7, expectedGroupData, sizeof( expectedGroupData ) ); + + waitResult = WaitForSingleObject( event, 2000 ); + todo_wine ok( waitResult == WAIT_OBJECT_0, "message wait returned %lu\n", waitResult ); + + dpid = checkSetPlayerOrGroupDataMessage( dp, DPPLAYERTYPE_GROUP, 0x5e7, expectedGroupData, + sizeof( expectedGroupData ) ); + todo_wine ok( dpid == 0x11223344, "got destination id %#lx.\n", dpid ); + + memset( groupData, 0xcc, sizeof( groupData ) ); + groupDataSize = sizeof( groupData ); + hr = IDirectPlayX_GetGroupData( dp, 0x5e7, groupData, &groupDataSize, DPGET_REMOTE ); + ok( hr == DP_OK, "got hr %#lx.\n", hr ); + todo_wine ok( groupDataSize == sizeof( expectedGroupData ), "got group data size %lu.\n", groupDataSize ); + todo_wine ok( !memcmp( groupData, expectedGroupData, sizeof( expectedGroupData ) ), "group data didn't match.\n" ); + + checkNoMorePlayerMessages( dp ); + + closesocket( recvSock ); + closesocket( sendSock ); + + IDirectPlayX_Release( dp ); + + CloseHandle( event ); +} + /* GetMessageCount */
static void test_GetMessageCount(void) @@ -10379,6 +10539,7 @@ START_TEST(dplayx) test_Receive(); test_PING(); test_AddPlayerToGroup(); + test_GROUPDATACHANGED();
if (!winetest_interactive) {
From: Anton Baskanov baskanov@gmail.com
--- dlls/dplayx/dplay.c | 86 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 85 insertions(+), 1 deletion(-)
diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index 7646f12fa76..47aa0dd0ea9 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -1513,6 +1513,8 @@ static HRESULT DP_IF_CreateGroup( IDirectPlayImpl *This, void *lpMsgHdr, DPID *l return DPERR_UNINITIALIZED; }
+ EnterCriticalSection( &This->lock ); + /* If the name is not specified, we must provide one */ if( DPID_UNKNOWN == *lpidGroup ) { @@ -1534,6 +1536,7 @@ static HRESULT DP_IF_CreateGroup( IDirectPlayImpl *This, void *lpMsgHdr, DPID *l
if( FAILED( hr ) ) { + LeaveCriticalSection( &This->lock ); return hr; }
@@ -1564,6 +1567,8 @@ static HRESULT DP_IF_CreateGroup( IDirectPlayImpl *This, void *lpMsgHdr, DPID *l sizeof( msg ), 0, 0, NULL, NULL ); }
+ LeaveCriticalSection( &This->lock ); + return DP_OK; }
@@ -2308,9 +2313,12 @@ static HRESULT DP_IF_DestroyGroup( IDirectPlayImpl *This, void *lpMsgHdr, DPID i FIXME( "(%p)->(%p,0x%08lx,%u): semi stub\n", This, lpMsgHdr, idGroup, bAnsi );
+ EnterCriticalSection( &This->lock ); + /* Find the group */ if( ( lpGData = DP_FindAnyGroup( This, idGroup ) ) == NULL ) { + LeaveCriticalSection( &This->lock ); return DPERR_INVALIDPLAYER; /* yes player */ }
@@ -2349,6 +2357,8 @@ static HRESULT DP_IF_DestroyGroup( IDirectPlayImpl *This, void *lpMsgHdr, DPID i
FIXME( "Send out a DESTORYPLAYERORGROUP message\n" );
+ LeaveCriticalSection( &This->lock ); + return DP_OK; }
@@ -3090,8 +3100,13 @@ static HRESULT WINAPI IDirectPlay4Impl_GetGroupData( IDirectPlay4 *iface, DPID g
TRACE( "(%p)->(0x%08lx,%p,%p,0x%08lx)\n", This, group, data, size, flags );
+ EnterCriticalSection( &This->lock ); + if ( ( gdata = DP_FindAnyGroup( This, group ) ) == NULL ) + { + LeaveCriticalSection( &This->lock ); return DPERR_INVALIDGROUP; + }
/* How much buffer is required? */ if ( flags & DPSET_LOCAL ) @@ -3109,10 +3124,15 @@ static HRESULT WINAPI IDirectPlay4Impl_GetGroupData( IDirectPlay4 *iface, DPID g
/* Is the user requesting to know how big a buffer is required? */ if ( !data || *size < bufsize ) + { + LeaveCriticalSection( &This->lock ); return DPERR_BUFFERTOOSMALL; + }
CopyMemory( data, src, bufsize );
+ LeaveCriticalSection( &This->lock ); + return DP_OK; }
@@ -3125,8 +3145,11 @@ static HRESULT DP_IF_GetGroupName( IDirectPlayImpl *This, DPID idGroup, void *lp FIXME("(%p)->(0x%08lx,%p,%p,%u) ANSI ignored\n", This, idGroup, lpData, lpdwDataSize, bAnsi );
+ EnterCriticalSection( &This->lock ); + if( ( lpGData = DP_FindAnyGroup( This, idGroup ) ) == NULL ) { + LeaveCriticalSection( &This->lock ); return DPERR_INVALIDGROUP; }
@@ -3137,11 +3160,14 @@ static HRESULT DP_IF_GetGroupName( IDirectPlayImpl *This, DPID idGroup, void *lp ) { *lpdwDataSize = dwRequiredDataSize; + LeaveCriticalSection( &This->lock ); return DPERR_BUFFERTOOSMALL; }
DP_CopyName( lpData, bAnsi ? lpGData->nameA : lpGData->name, bAnsi, bAnsi );
+ LeaveCriticalSection( &This->lock ); + return DP_OK; }
@@ -4060,9 +4086,14 @@ static HRESULT WINAPI IDirectPlay4Impl_SetGroupData( IDirectPlay4 *iface, DPID g if ( !data && size ) return DPERR_INVALIDPARAMS;
+ EnterCriticalSection( &This->lock ); + /* Find the pointer to the data for this player */ if ( ( gdata = DP_FindAnyGroup( This, group ) ) == NULL ) + { + LeaveCriticalSection( &This->lock ); return DPERR_INVALIDOBJECT; + }
if ( !(flags & DPSET_LOCAL) ) { @@ -4080,6 +4111,8 @@ static HRESULT WINAPI IDirectPlay4Impl_SetGroupData( IDirectPlay4 *iface, DPID g if ( !(flags & DPSET_LOCAL) ) FIXME( "Send msg?\n" );
+ LeaveCriticalSection( &This->lock ); + return DP_OK; }
@@ -4093,19 +4126,26 @@ static HRESULT DP_IF_SetGroupName( IDirectPlayImpl *This, DPID idGroup, DPNAME * TRACE( "(%p)->(0x%08lx,%p,0x%08lx,%u)\n", This, idGroup, lpGroupName, dwFlags, bAnsi );
+ EnterCriticalSection( &This->lock ); + if( ( lpGData = DP_FindAnyGroup( This, idGroup ) ) == NULL ) { + LeaveCriticalSection( &This->lock ); return DPERR_INVALIDGROUP; }
name = DP_DuplicateName( lpGroupName, FALSE, bAnsi ); if ( !name ) + { + LeaveCriticalSection( &This->lock ); return DPERR_OUTOFMEMORY; + }
nameA = DP_DuplicateName( lpGroupName, TRUE, bAnsi ); if ( !nameA ) { free( name ); + LeaveCriticalSection( &This->lock ); return DPERR_OUTOFMEMORY; }
@@ -4115,6 +4155,8 @@ static HRESULT DP_IF_SetGroupName( IDirectPlayImpl *This, DPID idGroup, DPNAME * /* Should send a DPMSG_SETPLAYERORGROUPNAME message */ FIXME( "Message not sent and dwFlags ignored\n" );
+ LeaveCriticalSection( &This->lock ); + return DP_OK; }
@@ -4488,16 +4530,27 @@ static HRESULT WINAPI IDirectPlay4Impl_AddGroupToGroup( IDirectPlay4 *iface, DPI if ( This->dp2->connectionInitialized == NO_PROVIDER ) return DPERR_UNINITIALIZED;
+ EnterCriticalSection( &This->lock ); + if ( !DP_FindAnyGroup(This, parent ) ) + { + LeaveCriticalSection( &This->lock ); return DPERR_INVALIDGROUP; + }
if ( ( gdata = DP_FindAnyGroup(This, group ) ) == NULL ) + { + LeaveCriticalSection( &This->lock ); return DPERR_INVALIDGROUP; + }
/* Create a player list (ie "shortcut" ) */ glist = calloc( 1, sizeof( *glist ) ); if ( !glist ) + { + LeaveCriticalSection( &This->lock ); return DPERR_CANTADDPLAYER; + }
/* Add the shortcut */ gdata->uRef++; @@ -4509,6 +4562,8 @@ static HRESULT WINAPI IDirectPlay4Impl_AddGroupToGroup( IDirectPlay4 *iface, DPI /* Send a ADDGROUPTOGROUP message */ FIXME( "Not sending message\n" );
+ LeaveCriticalSection( &This->lock ); + return DP_OK; }
@@ -4527,11 +4582,14 @@ static HRESULT DP_IF_CreateGroupInGroup( IDirectPlayImpl *This, void *lpMsgHdr, return DPERR_UNINITIALIZED; }
+ EnterCriticalSection( &This->lock ); + hr = DP_CreateGroup(This, lpMsgHdr, lpidGroup, lpGroupName, lpData, dwDataSize, dwFlags, idParentGroup, bAnsi );
if( FAILED( hr ) ) { + LeaveCriticalSection( &This->lock ); return hr; }
@@ -4558,6 +4616,8 @@ static HRESULT DP_IF_CreateGroupInGroup( IDirectPlayImpl *This, void *lpMsgHdr, sizeof( msg ), 0, 0, NULL, NULL ); }
+ LeaveCriticalSection( &This->lock ); + return DP_OK; }
@@ -4630,15 +4690,23 @@ static HRESULT WINAPI IDirectPlay4Impl_DeleteGroupFromGroup( IDirectPlay4 *iface
TRACE("(%p)->(0x%08lx,0x%08lx)\n", This, parent, group );
+ EnterCriticalSection( &This->lock ); + /* Is the parent group valid? */ if ( ( parentdata = DP_FindAnyGroup(This, parent ) ) == NULL ) + { + LeaveCriticalSection( &This->lock ); return DPERR_INVALIDGROUP; + }
/* Remove the group from the parent group queue */ DPQ_REMOVE_ENTRY( parentdata->groups, groups, lpGData->dpid, ==, group, glist );
if ( glist == NULL ) + { + LeaveCriticalSection( &This->lock ); return DPERR_INVALIDGROUP; + }
/* Decrement the ref count */ glist->lpGData->uRef--; @@ -4649,6 +4717,8 @@ static HRESULT WINAPI IDirectPlay4Impl_DeleteGroupFromGroup( IDirectPlay4 *iface /* Should send a DELETEGROUPFROMGROUP message */ FIXME( "message not sent\n" );
+ LeaveCriticalSection( &This->lock ); + return DP_OK; }
@@ -4976,8 +5046,13 @@ static HRESULT DP_IF_EnumGroupsInGroup( IDirectPlayImpl *This, DPID group, GUID if ( This->dp2->connectionInitialized == NO_PROVIDER ) return DPERR_UNINITIALIZED;
+ EnterCriticalSection( &This->lock ); + if ( ( gdata = DP_FindAnyGroup(This, group ) ) == NULL ) + { + LeaveCriticalSection( &This->lock ); return DPERR_INVALIDGROUP; + }
for( glist = DPQ_FIRST( gdata->groups ); glist; glist = DPQ_NEXT( glist->groups ) ) { @@ -4994,9 +5069,11 @@ static HRESULT DP_IF_EnumGroupsInGroup( IDirectPlayImpl *This, DPID group, GUID
if ( !(*enumplayercb)( glist->lpGData->dpid, DPPLAYERTYPE_GROUP, ansi ? glist->lpGData->nameA : glist->lpGData->name, groupFlags, context ) ) - return DP_OK; /* User requested break */ + break; /* User requested break */ }
+ LeaveCriticalSection( &This->lock ); + return DP_OK; }
@@ -5551,11 +5628,18 @@ static HRESULT WINAPI IDirectPlay4Impl_GetGroupParent( IDirectPlay4 *iface, DPID
TRACE( "(%p)->(0x%08lx,%p)\n", This, group, parent );
+ EnterCriticalSection( &This->lock ); + if ( ( gdata = DP_FindAnyGroup( This, group ) ) == NULL ) + { + LeaveCriticalSection( &This->lock ); return DPERR_INVALIDGROUP; + }
*parent = gdata->dpid;
+ LeaveCriticalSection( &This->lock ); + return DP_OK; }
From: Anton Baskanov baskanov@gmail.com
--- dlls/dplayx/dplay.c | 76 +++++++++++++++++++++++++++++++++++ dlls/dplayx/dplayx_messages.h | 11 ++++- dlls/dplayx/tests/dplayx.c | 12 +++--- 3 files changed, 91 insertions(+), 8 deletions(-)
diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index 47aa0dd0ea9..b24696060fd 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -427,6 +427,29 @@ static DWORD DP_CopyCreatePlayerOrGroup( DPMSG_GENERIC *genericDst, DPMSG_GENERI return offset; }
+static DWORD DP_CopySetPlayerOrGroupData( DPMSG_GENERIC *genericDst, DPMSG_GENERIC *genericSrc, + DWORD genericSize, BOOL ansi ) +{ + DPMSG_SETPLAYERORGROUPDATA *src = (DPMSG_SETPLAYERORGROUPDATA *) genericSrc; + DPMSG_SETPLAYERORGROUPDATA *dst = (DPMSG_SETPLAYERORGROUPDATA *) genericDst; + DWORD offset = sizeof( DPMSG_SETPLAYERORGROUPDATA ); + + if ( dst ) + *dst = *src; + + if ( src->lpData ) + { + if ( dst ) + { + dst->lpData = (char *) dst + offset; + memcpy( dst->lpData, src->lpData, src->dwDataSize ); + } + offset += src->dwDataSize; + } + + return offset; +} + /* *lplpReply will be non NULL iff there is something to reply */ HRESULT DP_HandleMessage( IDirectPlayImpl *This, void *messageBody, DWORD dwMessageBodySize, void *messageHeader, WORD wCommandId, WORD wVersion, @@ -535,6 +558,59 @@ HRESULT DP_HandleMessage( IDirectPlayImpl *This, void *messageBody, DP_MSG_ReplyReceived( This, wCommandId, messageBody, dwMessageBodySize, messageHeader ); break;
+ case DPMSGCMD_GROUPDATACHANGED: { + DPMSG_SETPLAYERORGROUPDATA setPlayerOrGroupDataMsg; + DPSP_MSG_GROUPDATACHANGED *msg; + struct GroupData *group; + HRESULT hr; + void *data; + + if( dwMessageBodySize < sizeof( DPSP_MSG_GROUPDATACHANGED ) ) + return DPERR_GENERIC; + msg = (DPSP_MSG_GROUPDATACHANGED *)messageBody; + + if( dwMessageBodySize < msg->dataOffset ) + return DPERR_GENERIC; + if( dwMessageBodySize - msg->dataOffset < msg->dataSize ) + return DPERR_GENERIC; + data = (char *)messageBody + msg->dataOffset; + + EnterCriticalSection( &This->lock ); + + if( !This->dp2->bConnectionOpen ) + { + LeaveCriticalSection( &This->lock ); + return DP_OK; + } + + group = DP_FindAnyGroup( This, msg->groupId ); + if( !group ) + { + LeaveCriticalSection( &This->lock ); + return DPERR_GENERIC; + } + + DP_SetGroupData( group, DPSET_REMOTE, data, msg->dataSize ); + + setPlayerOrGroupDataMsg.dwType = DPSYS_SETPLAYERORGROUPDATA; + setPlayerOrGroupDataMsg.dwPlayerType = DPPLAYERTYPE_GROUP; + setPlayerOrGroupDataMsg.dpId = msg->groupId; + setPlayerOrGroupDataMsg.lpData = data; + setPlayerOrGroupDataMsg.dwDataSize = msg->dataSize; + + hr = DP_QueueMessage( This, DPID_SYSMSG, DPID_ALLPLAYERS, 0, &setPlayerOrGroupDataMsg, + DP_CopySetPlayerOrGroupData, 0 ); + if ( FAILED( hr ) ) + { + LeaveCriticalSection( &This->lock ); + return hr; + } + + LeaveCriticalSection( &This->lock ); + + break; + } + case DPMSGCMD_JUSTENVELOPE: TRACE( "GOT THE SELF MESSAGE: %p -> 0x%08lx\n", messageHeader, ((const DWORD *)messageHeader)[1] ); NS_SetLocalAddr( This->dp2->lpNameServerData, messageHeader, 20 ); diff --git a/dlls/dplayx/dplayx_messages.h b/dlls/dplayx/dplayx_messages.h index 5b6ce52663f..9615effd936 100644 --- a/dlls/dplayx/dplayx_messages.h +++ b/dlls/dplayx/dplayx_messages.h @@ -107,7 +107,7 @@ typedef struct #define DPMSGCMD_DELETEGROUP 12 #define DPMSGCMD_ADDPLAYERTOGROUP 13
-#define DPMSGCMD_ENUMGROUPS 17 +#define DPMSGCMD_GROUPDATACHANGED 17
#define DPMSGCMD_FORWARDADDPLAYER 19
@@ -244,6 +244,15 @@ typedef struct DWORD passwordOffset; } DPSP_MSG_ADDPLAYERTOGROUP;
+typedef struct +{ + DPMSG_SENDENVELOPE envelope; + DPID toId; + DPID groupId; + DWORD dataSize; + DWORD dataOffset; +} DPSP_MSG_GROUPDATACHANGED; + typedef struct tagDPMSG_FORWARDADDPLAYER { DPMSG_SENDENVELOPE envelope; diff --git a/dlls/dplayx/tests/dplayx.c b/dlls/dplayx/tests/dplayx.c index c2ebb66b2ab..b70b47846c3 100644 --- a/dlls/dplayx/tests/dplayx.c +++ b/dlls/dplayx/tests/dplayx.c @@ -9194,9 +9194,7 @@ static DPID checkSetPlayerOrGroupDataMessage_( int line, IDirectPlay4 *dp, DWORD fromId = 0xdeadbeef; toId = 0xdeadbeef; hr = IDirectPlayX_Receive( dp, &fromId, &toId, 0, msgData, &msgDataSize ); - todo_wine ok_( __FILE__, line )( hr == DP_OK, "got hr %#lx.\n", hr ); - if ( FAILED( hr ) ) - return 0; + ok_( __FILE__, line )( hr == DP_OK, "got hr %#lx.\n", hr ); ok_( __FILE__, line )( fromId == DPID_SYSMSG, "got source id %#lx.\n", fromId );
msg = (DPMSG_SETPLAYERORGROUPDATA *) msgData; @@ -9258,18 +9256,18 @@ static void test_GROUPDATACHANGED(void) sendGroupDataChanged( sendSock, 2349, 0x5e7, expectedGroupData, sizeof( expectedGroupData ) );
waitResult = WaitForSingleObject( event, 2000 ); - todo_wine ok( waitResult == WAIT_OBJECT_0, "message wait returned %lu\n", waitResult ); + ok( waitResult == WAIT_OBJECT_0, "message wait returned %lu\n", waitResult );
dpid = checkSetPlayerOrGroupDataMessage( dp, DPPLAYERTYPE_GROUP, 0x5e7, expectedGroupData, sizeof( expectedGroupData ) ); - todo_wine ok( dpid == 0x11223344, "got destination id %#lx.\n", dpid ); + ok( dpid == 0x11223344, "got destination id %#lx.\n", dpid );
memset( groupData, 0xcc, sizeof( groupData ) ); groupDataSize = sizeof( groupData ); hr = IDirectPlayX_GetGroupData( dp, 0x5e7, groupData, &groupDataSize, DPGET_REMOTE ); ok( hr == DP_OK, "got hr %#lx.\n", hr ); - todo_wine ok( groupDataSize == sizeof( expectedGroupData ), "got group data size %lu.\n", groupDataSize ); - todo_wine ok( !memcmp( groupData, expectedGroupData, sizeof( expectedGroupData ) ), "group data didn't match.\n" ); + ok( groupDataSize == sizeof( expectedGroupData ), "got group data size %lu.\n", groupDataSize ); + ok( !memcmp( groupData, expectedGroupData, sizeof( expectedGroupData ) ), "group data didn't match.\n" );
checkNoMorePlayerMessages( dp );
From: Anton Baskanov baskanov@gmail.com
--- dlls/dplayx/dplay.c | 321 +++++++++++++++++--------------------------- 1 file changed, 124 insertions(+), 197 deletions(-)
diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index b24696060fd..79aaf439d5e 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -4851,11 +4851,127 @@ static HRESULT WINAPI IDirectPlay3Impl_EnumConnections( IDirectPlay3 *iface, flags ); }
+static HRESULT DP_ReadConnections( const char *searchSubKey, DWORD dwFlags, + const GUID *addressDataType, + LPDPENUMCONNECTIONSCALLBACK lpEnumCallback, void *lpContext ) +{ + HKEY hkResult; + LPCSTR guidDataSubKey = "Guid"; + char subKeyName[51]; + DWORD dwIndex, sizeOfSubKeyName=50; + FILETIME filetime; + + /* Need to loop over the service providers in the registry */ + if( RegOpenKeyExA( HKEY_LOCAL_MACHINE, searchSubKey, + 0, KEY_READ, &hkResult ) != ERROR_SUCCESS ) + { + /* Hmmm. Does this mean that there are no service providers? */ + ERR(": no service providers?\n"); + return DP_OK; + } + + + /* Traverse all the service providers we have available */ + for( dwIndex=0; + RegEnumKeyExA( hkResult, dwIndex, subKeyName, &sizeOfSubKeyName, + NULL, NULL, NULL, &filetime ) != ERROR_NO_MORE_ITEMS; + ++dwIndex, sizeOfSubKeyName=51 ) + { + + HKEY hkServiceProvider; + GUID serviceProviderGUID; + DWORD returnTypeGUID, sizeOfReturnBuffer = 50; + char returnBuffer[51]; + WCHAR buff[51]; + DPNAME dpName; + HRESULT hr; + + DPCOMPOUNDADDRESSELEMENT dpCompoundAddress; + LPVOID lpAddressBuffer = NULL; + DWORD dwAddressBufferSize = 0; + + TRACE(" this time through: %s\n", subKeyName ); + + /* Get a handle for this particular service provider */ + if( RegOpenKeyExA( hkResult, subKeyName, 0, KEY_READ, + &hkServiceProvider ) != ERROR_SUCCESS ) + { + ERR(": what the heck is going on?\n" ); + continue; + } + + if( RegQueryValueExA( hkServiceProvider, guidDataSubKey, + NULL, &returnTypeGUID, (LPBYTE)returnBuffer, + &sizeOfReturnBuffer ) != ERROR_SUCCESS ) + { + ERR(": missing GUID registry data members\n" ); + RegCloseKey(hkServiceProvider); + continue; + } + RegCloseKey(hkServiceProvider); + + /* FIXME: Check return types to ensure we're interpreting data right */ + MultiByteToWideChar( CP_ACP, 0, returnBuffer, -1, buff, ARRAY_SIZE( buff )); + CLSIDFromString( buff, &serviceProviderGUID ); + /* FIXME: Have I got a memory leak on the serviceProviderGUID? */ + + /* Fill in the DPNAME struct for the service provider */ + dpName.dwSize = sizeof( dpName ); + dpName.dwFlags = 0; + dpName.lpszShortNameA = subKeyName; + dpName.lpszLongNameA = NULL; + + /* Create the compound address for the service provider. + * NOTE: This is a gruesome architectural scar right now. DP + * uses DPL and DPL uses DP. Nasty stuff. This may be why the + * native dll just gets around this little bit by allocating an + * 80 byte buffer which isn't even filled with a valid compound + * address. Oh well. Creating a proper compound address is the + * way to go anyways despite this method taking slightly more + * heap space and realtime :) */ + + dpCompoundAddress.guidDataType = *addressDataType; + dpCompoundAddress.dwDataSize = sizeof( GUID ); + dpCompoundAddress.lpData = &serviceProviderGUID; + + if( ( hr = DPL_CreateCompoundAddress( &dpCompoundAddress, 1, lpAddressBuffer, + &dwAddressBufferSize, TRUE ) ) != DPERR_BUFFERTOOSMALL ) + { + ERR( "can't get buffer size: %s\n", DPLAYX_HresultToString( hr ) ); + return hr; + } + + /* Now allocate the buffer */ + lpAddressBuffer = calloc( 1, dwAddressBufferSize ); + + if( ( hr = DPL_CreateCompoundAddress( &dpCompoundAddress, 1, lpAddressBuffer, + &dwAddressBufferSize, TRUE ) ) != DP_OK ) + { + ERR( "can't create address: %s\n", DPLAYX_HresultToString( hr ) ); + free( lpAddressBuffer ); + return hr; + } + + /* The enumeration will return FALSE if we are not to continue */ + if( !lpEnumCallback( &serviceProviderGUID, lpAddressBuffer, dwAddressBufferSize, + &dpName, dwFlags, lpContext ) ) + { + free( lpAddressBuffer ); + return DP_OK; + } + free( lpAddressBuffer ); + } + + return DP_OK; +} + static HRESULT WINAPI IDirectPlay4AImpl_EnumConnections( IDirectPlay4A *iface, const GUID *lpguidApplication, LPDPENUMCONNECTIONSCALLBACK lpEnumCallback, void *lpContext, DWORD dwFlags ) { IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface ); + HRESULT hr; + TRACE("(%p)->(%p,%p,%p,0x%08lx)\n", This, lpguidApplication, lpEnumCallback, lpContext, dwFlags );
/* A default dwFlags (0) is backwards compatible -- DPCONNECTION_DIRECTPLAY */ @@ -4879,208 +4995,19 @@ static HRESULT WINAPI IDirectPlay4AImpl_EnumConnections( IDirectPlay4A *iface, /* Enumerate DirectPlay service providers */ if( dwFlags & DPCONNECTION_DIRECTPLAY ) { - HKEY hkResult; - LPCSTR searchSubKey = "SOFTWARE\Microsoft\DirectPlay\Service Providers"; - LPCSTR guidDataSubKey = "Guid"; - char subKeyName[51]; - DWORD dwIndex, sizeOfSubKeyName=50; - FILETIME filetime; - - /* Need to loop over the service providers in the registry */ - if( RegOpenKeyExA( HKEY_LOCAL_MACHINE, searchSubKey, - 0, KEY_READ, &hkResult ) != ERROR_SUCCESS ) - { - /* Hmmm. Does this mean that there are no service providers? */ - ERR(": no service providers?\n"); - return DP_OK; - } - - - /* Traverse all the service providers we have available */ - for( dwIndex=0; - RegEnumKeyExA( hkResult, dwIndex, subKeyName, &sizeOfSubKeyName, - NULL, NULL, NULL, &filetime ) != ERROR_NO_MORE_ITEMS; - ++dwIndex, sizeOfSubKeyName=51 ) - { - - HKEY hkServiceProvider; - GUID serviceProviderGUID; - DWORD returnTypeGUID, sizeOfReturnBuffer = 50; - char returnBuffer[51]; - WCHAR buff[51]; - DPNAME dpName; - BOOL bBuildPass; - - LPVOID lpAddressBuffer = NULL; - DWORD dwAddressBufferSize = 0; - - TRACE(" this time through: %s\n", subKeyName ); - - /* Get a handle for this particular service provider */ - if( RegOpenKeyExA( hkResult, subKeyName, 0, KEY_READ, - &hkServiceProvider ) != ERROR_SUCCESS ) - { - ERR(": what the heck is going on?\n" ); - continue; - } - - if( RegQueryValueExA( hkServiceProvider, guidDataSubKey, - NULL, &returnTypeGUID, (LPBYTE)returnBuffer, - &sizeOfReturnBuffer ) != ERROR_SUCCESS ) - { - ERR(": missing GUID registry data members\n" ); - RegCloseKey(hkServiceProvider); - continue; - } - RegCloseKey(hkServiceProvider); - - /* FIXME: Check return types to ensure we're interpreting data right */ - MultiByteToWideChar( CP_ACP, 0, returnBuffer, -1, buff, ARRAY_SIZE( buff )); - CLSIDFromString( buff, &serviceProviderGUID ); - /* FIXME: Have I got a memory leak on the serviceProviderGUID? */ - - /* Fill in the DPNAME struct for the service provider */ - dpName.dwSize = sizeof( dpName ); - dpName.dwFlags = 0; - dpName.lpszShortNameA = subKeyName; - dpName.lpszLongNameA = NULL; - - /* Create the compound address for the service provider. - * NOTE: This is a gruesome architectural scar right now. DP - * uses DPL and DPL uses DP. Nasty stuff. This may be why the - * native dll just gets around this little bit by allocating an - * 80 byte buffer which isn't even filled with a valid compound - * address. Oh well. Creating a proper compound address is the - * way to go anyways despite this method taking slightly more - * heap space and realtime :) */ - - bBuildPass = DP_BuildSPCompoundAddr( &serviceProviderGUID, - &lpAddressBuffer, - &dwAddressBufferSize ); - if( !bBuildPass ) - { - ERR( "Can't build compound addr\n" ); - return DPERR_GENERIC; - } - - /* The enumeration will return FALSE if we are not to continue */ - if( !lpEnumCallback( &serviceProviderGUID, lpAddressBuffer, dwAddressBufferSize, - &dpName, dwFlags, lpContext ) ) - { - free( lpAddressBuffer ); - return DP_OK; - } - free( lpAddressBuffer ); - } + hr = DP_ReadConnections( "SOFTWARE\Microsoft\DirectPlay\Service Providers", dwFlags, + &DPAID_ServiceProvider, lpEnumCallback, lpContext ); + if ( FAILED( hr ) ) + return hr; }
/* Enumerate DirectPlayLobby service providers */ if( dwFlags & DPCONNECTION_DIRECTPLAYLOBBY ) { - HKEY hkResult; - LPCSTR searchSubKey = "SOFTWARE\Microsoft\DirectPlay\Lobby Providers"; - LPCSTR guidDataSubKey = "Guid"; - char subKeyName[51]; - DWORD dwIndex, sizeOfSubKeyName=50; - FILETIME filetime; - - /* Need to loop over the service providers in the registry */ - if( RegOpenKeyExA( HKEY_LOCAL_MACHINE, searchSubKey, - 0, KEY_READ, &hkResult ) != ERROR_SUCCESS ) - { - TRACE("No Lobby Providers have been registered.\n"); - return DP_OK; - } - - - /* Traverse all the lobby providers we have available */ - for( dwIndex=0; - RegEnumKeyExA( hkResult, dwIndex, subKeyName, &sizeOfSubKeyName, - NULL, NULL, NULL, &filetime ) != ERROR_NO_MORE_ITEMS; - ++dwIndex, sizeOfSubKeyName=51 ) - { - - HKEY hkServiceProvider; - GUID serviceProviderGUID; - DWORD returnTypeGUID, sizeOfReturnBuffer = 50; - char returnBuffer[51]; - WCHAR buff[51]; - DPNAME dpName; - HRESULT hr; - - DPCOMPOUNDADDRESSELEMENT dpCompoundAddress; - LPVOID lpAddressBuffer = NULL; - DWORD dwAddressBufferSize = 0; - - TRACE(" this time through: %s\n", subKeyName ); - - /* Get a handle for this particular service provider */ - if( RegOpenKeyExA( hkResult, subKeyName, 0, KEY_READ, - &hkServiceProvider ) != ERROR_SUCCESS ) - { - ERR(": what the heck is going on?\n" ); - continue; - } - - if( RegQueryValueExA( hkServiceProvider, guidDataSubKey, - NULL, &returnTypeGUID, (LPBYTE)returnBuffer, - &sizeOfReturnBuffer ) != ERROR_SUCCESS ) - { - ERR(": missing GUID registry data members\n" ); - RegCloseKey(hkServiceProvider); - continue; - } - RegCloseKey(hkServiceProvider); - - /* FIXME: Check return types to ensure we're interpreting data right */ - MultiByteToWideChar( CP_ACP, 0, returnBuffer, -1, buff, ARRAY_SIZE( buff )); - CLSIDFromString( buff, &serviceProviderGUID ); - /* FIXME: Have I got a memory leak on the serviceProviderGUID? */ - - /* Fill in the DPNAME struct for the service provider */ - dpName.dwSize = sizeof( dpName ); - dpName.dwFlags = 0; - dpName.lpszShortNameA = subKeyName; - dpName.lpszLongNameA = NULL; - - /* Create the compound address for the service provider. - NOTE: This is a gruesome architectural scar right now. DP uses DPL and DPL uses DP - nast stuff. This may be why the native dll just gets around this little bit by - allocating an 80 byte buffer which isn't even a filled with a valid compound - address. Oh well. Creating a proper compound address is the way to go anyways - despite this method taking slightly more heap space and realtime :) */ - - dpCompoundAddress.guidDataType = DPAID_LobbyProvider; - dpCompoundAddress.dwDataSize = sizeof( GUID ); - dpCompoundAddress.lpData = &serviceProviderGUID; - - if( ( hr = DPL_CreateCompoundAddress( &dpCompoundAddress, 1, lpAddressBuffer, - &dwAddressBufferSize, TRUE ) ) != DPERR_BUFFERTOOSMALL ) - { - ERR( "can't get buffer size: %s\n", DPLAYX_HresultToString( hr ) ); - return hr; - } - - /* Now allocate the buffer */ - lpAddressBuffer = calloc( 1, dwAddressBufferSize ); - - if( ( hr = DPL_CreateCompoundAddress( &dpCompoundAddress, 1, lpAddressBuffer, - &dwAddressBufferSize, TRUE ) ) != DP_OK ) - { - ERR( "can't create address: %s\n", DPLAYX_HresultToString( hr ) ); - free( lpAddressBuffer ); - return hr; - } - - /* The enumeration will return FALSE if we are not to continue */ - if( !lpEnumCallback( &serviceProviderGUID, lpAddressBuffer, dwAddressBufferSize, - &dpName, dwFlags, lpContext ) ) - { - free( lpAddressBuffer ); - return DP_OK; - } - free( lpAddressBuffer ); - } + hr = DP_ReadConnections( "SOFTWARE\Microsoft\DirectPlay\Lobby Providers", dwFlags, + &DPAID_LobbyProvider, lpEnumCallback, lpContext ); + if ( FAILED( hr ) ) + return hr; }
return DP_OK;
From: Anton Baskanov baskanov@gmail.com
--- dlls/dplayx/dplay.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-)
diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index 79aaf439d5e..acfadd7463a 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -4853,7 +4853,8 @@ static HRESULT WINAPI IDirectPlay3Impl_EnumConnections( IDirectPlay3 *iface,
static HRESULT DP_ReadConnections( const char *searchSubKey, DWORD dwFlags, const GUID *addressDataType, - LPDPENUMCONNECTIONSCALLBACK lpEnumCallback, void *lpContext ) + LPDPENUMCONNECTIONSCALLBACK lpEnumCallback, void *lpContext, + BOOL ansi ) { HKEY hkResult; LPCSTR guidDataSubKey = "Guid"; @@ -4918,8 +4919,10 @@ static HRESULT DP_ReadConnections( const char *searchSubKey, DWORD dwFlags, /* Fill in the DPNAME struct for the service provider */ dpName.dwSize = sizeof( dpName ); dpName.dwFlags = 0; - dpName.lpszShortNameA = subKeyName; + dpName.lpszShortNameA = DP_DuplicateString( subKeyName, ansi, TRUE ); dpName.lpszLongNameA = NULL; + if ( !dpName.lpszShortNameA ) + return DPERR_OUTOFMEMORY;
/* Create the compound address for the service provider. * NOTE: This is a gruesome architectural scar right now. DP @@ -4938,6 +4941,7 @@ static HRESULT DP_ReadConnections( const char *searchSubKey, DWORD dwFlags, &dwAddressBufferSize, TRUE ) ) != DPERR_BUFFERTOOSMALL ) { ERR( "can't get buffer size: %s\n", DPLAYX_HresultToString( hr ) ); + free( dpName.lpszShortNameA ); return hr; }
@@ -4949,6 +4953,7 @@ static HRESULT DP_ReadConnections( const char *searchSubKey, DWORD dwFlags, { ERR( "can't create address: %s\n", DPLAYX_HresultToString( hr ) ); free( lpAddressBuffer ); + free( dpName.lpszShortNameA ); return hr; }
@@ -4957,19 +4962,20 @@ static HRESULT DP_ReadConnections( const char *searchSubKey, DWORD dwFlags, &dpName, dwFlags, lpContext ) ) { free( lpAddressBuffer ); + free( dpName.lpszShortNameA ); return DP_OK; } free( lpAddressBuffer ); + free( dpName.lpszShortNameA ); }
return DP_OK; }
-static HRESULT WINAPI IDirectPlay4AImpl_EnumConnections( IDirectPlay4A *iface, +static HRESULT DP_IF_EnumConnections( IDirectPlayImpl *This, const GUID *lpguidApplication, LPDPENUMCONNECTIONSCALLBACK lpEnumCallback, void *lpContext, - DWORD dwFlags ) + DWORD dwFlags, BOOL ansi ) { - IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface ); HRESULT hr;
TRACE("(%p)->(%p,%p,%p,0x%08lx)\n", This, lpguidApplication, lpEnumCallback, lpContext, dwFlags ); @@ -4996,7 +5002,7 @@ static HRESULT WINAPI IDirectPlay4AImpl_EnumConnections( IDirectPlay4A *iface, if( dwFlags & DPCONNECTION_DIRECTPLAY ) { hr = DP_ReadConnections( "SOFTWARE\Microsoft\DirectPlay\Service Providers", dwFlags, - &DPAID_ServiceProvider, lpEnumCallback, lpContext ); + &DPAID_ServiceProvider, lpEnumCallback, lpContext, ansi ); if ( FAILED( hr ) ) return hr; } @@ -5005,7 +5011,7 @@ static HRESULT WINAPI IDirectPlay4AImpl_EnumConnections( IDirectPlay4A *iface, if( dwFlags & DPCONNECTION_DIRECTPLAYLOBBY ) { hr = DP_ReadConnections( "SOFTWARE\Microsoft\DirectPlay\Lobby Providers", dwFlags, - &DPAID_LobbyProvider, lpEnumCallback, lpContext ); + &DPAID_LobbyProvider, lpEnumCallback, lpContext, ansi ); if ( FAILED( hr ) ) return hr; } @@ -5013,12 +5019,19 @@ static HRESULT WINAPI IDirectPlay4AImpl_EnumConnections( IDirectPlay4A *iface, return DP_OK; }
+static HRESULT WINAPI IDirectPlay4AImpl_EnumConnections( IDirectPlay4A *iface, + const GUID *lpguidApplication, LPDPENUMCONNECTIONSCALLBACK lpEnumCallback, void *lpContext, + DWORD dwFlags ) +{ + IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface ); + return DP_IF_EnumConnections( This, lpguidApplication, lpEnumCallback, lpContext, dwFlags, TRUE ); +} + static HRESULT WINAPI IDirectPlay4Impl_EnumConnections( IDirectPlay4 *iface, const GUID *application, LPDPENUMCONNECTIONSCALLBACK enumcb, void *context, DWORD flags ) { IDirectPlayImpl *This = impl_from_IDirectPlay4( iface ); - return IDirectPlayX_EnumConnections( &This->IDirectPlay4A_iface, application, enumcb, context, - flags ); + return DP_IF_EnumConnections( This, application, enumcb, context, flags, FALSE ); }
static HRESULT WINAPI IDirectPlay3AImpl_EnumGroupsInGroup( IDirectPlay3A *iface, DPID group,
From: Anton Baskanov baskanov@gmail.com
--- dlls/dplayx/tests/dplayx.c | 135 +++++++++++++++++++++++-------------- 1 file changed, 86 insertions(+), 49 deletions(-)
diff --git a/dlls/dplayx/tests/dplayx.c b/dlls/dplayx/tests/dplayx.c index b70b47846c3..93f0dea9d66 100644 --- a/dlls/dplayx/tests/dplayx.c +++ b/dlls/dplayx/tests/dplayx.c @@ -65,6 +65,17 @@ static void checkFlags_(unsigned line, DWORD expected, DWORD result, DWORD flags expected, function(expected), \ result, function(result) );
+#define AW( str, ansi ) ((ansi) ? (const void *) str : (const void *) L##str) + +static const char *dbgStrAW( const void *str, BOOL ansi ) +{ + return ansi ? wine_dbgstr_a( str ) : wine_dbgstr_w( str ); +} + +static int strcmpAW( const void *str0, const void *str1, BOOL ansi ) +{ + return ansi ? strcmp( str0, str1 ) : lstrcmpW( str0, str1 ); +}
DEFINE_GUID(appGuid, 0xbdcfe03e, 0xf0ec, 0x415b, 0x82, 0x11, 0x6f, 0x86, 0xd8, 0x19, 0x7f, 0xe1); DEFINE_GUID(appGuid2, 0x93417d3f, 0x7d26, 0x46ba, 0xb5, 0x76, 0xfe, 0x4b, 0x20, 0xbb, 0xad, 0x70); @@ -1165,10 +1176,11 @@ static void checkNoMoreMessages_( int line, SOCKET sock ) ok_( __FILE__, line )( !wsResult || wsResult == SOCKET_ERROR, "recv() returned %d.\n", wsResult ); }
-#define checkSpHeader( header, expectedSize ) checkSpHeader_( __LINE__, header, expectedSize ) -static unsigned short checkSpHeader_( int line, SpHeader *header, DWORD expectedSize ) +#define checkSpHeader( header, expectedSize, sizeTodo ) checkSpHeader_( __LINE__, header, expectedSize, sizeTodo ) +static unsigned short checkSpHeader_( int line, SpHeader *header, DWORD expectedSize, BOOL sizeTodo ) { - ok_( __FILE__, line )( header->mixed == 0xfab00000 + expectedSize, "got mixed %#lx.\n", header->mixed ); + todo_wine_if( sizeTodo ) + ok_( __FILE__, line )( header->mixed == 0xfab00000 + expectedSize, "got mixed %#lx.\n", header->mixed ); ok_( __FILE__, line )( header->addr.sin_family == AF_INET, "got family %d.\n", header->addr.sin_family ); ok_( __FILE__, line )( 2300 <= ntohs( header->addr.sin_port ) && ntohs( header->addr.sin_port ) < 2350, "got port %d.\n", ntohs( header->addr.sin_port ) ); @@ -1238,10 +1250,11 @@ static void checkGameMessage_( int line, GameMessage *message, DPID expectedFrom ok_( __FILE__, line )( message->toId == expectedToId, "got destination id %#lx.\n", message->toId ); }
-#define receiveEnumSessionsRequest( sock, expectedAppGuid, expectedPassword, expectedFlags ) \ - receiveEnumSessionsRequest_( __LINE__, sock, expectedAppGuid, expectedPassword, expectedFlags ) +#define receiveEnumSessionsRequest( sock, expectedAppGuid, expectedPassword, expectedFlags, passwordTodo ) \ + receiveEnumSessionsRequest_( __LINE__, sock, expectedAppGuid, expectedPassword, expectedFlags, passwordTodo ) static unsigned short receiveEnumSessionsRequest_( int line, SOCKET sock, const GUID *expectedAppGuid, - const WCHAR *expectedPassword, DWORD expectedFlags ) + const WCHAR *expectedPassword, DWORD expectedFlags, + BOOL passwordTodo ) { #include "pshpack1.h" struct @@ -1260,11 +1273,11 @@ static unsigned short receiveEnumSessionsRequest_( int line, SOCKET sock, const expectedSize = sizeof( request.spHeader ) + sizeof( request.request ) + expectedPasswordSize;
wsResult = receiveMessage_( line, sock, &request, sizeof( request ) ); - ok_( __FILE__, line )( wsResult == expectedSize, "recv() returned %d.\n", wsResult ); + todo_wine_if( passwordTodo ) ok_( __FILE__, line )( wsResult == expectedSize, "recv() returned %d.\n", wsResult ); if ( wsResult == SOCKET_ERROR ) return 0;
- port = checkSpHeader_( line, &request.spHeader, expectedSize ); + port = checkSpHeader_( line, &request.spHeader, expectedSize, passwordTodo ); checkMessageHeader_( line, &request.request.header, 2 ); ok_( __FILE__, line )( IsEqualGUID( &request.request.appGuid, expectedAppGuid ), "got app guid %s.\n", wine_dbgstr_guid( &request.request.appGuid ) ); @@ -1272,8 +1285,9 @@ static unsigned short receiveEnumSessionsRequest_( int line, SOCKET sock, const { ok_( __FILE__, line )( request.request.passwordOffset == 32, "got password offset %lu.\n", request.request.passwordOffset ); - ok_( __FILE__, line )( !lstrcmpW( request.password, expectedPassword ), "got password %s.\n", - wine_dbgstr_w( request.password ) ); + todo_wine_if( passwordTodo ) + ok_( __FILE__, line )( !lstrcmpW( request.password, expectedPassword ), "got password %s.\n", + wine_dbgstr_w( request.password ) ); } else { @@ -1350,7 +1364,7 @@ static unsigned short receiveRequestPlayerId_( int line, SOCKET sock, DWORD expe wsResult = receiveMessage_( line, sock, &request, sizeof( request ) ); ok_( __FILE__, line )( wsResult == sizeof( request ), "recv() returned %d.\n", wsResult );
- port = checkSpHeader_( line, &request.spHeader, sizeof( request ) ); + port = checkSpHeader_( line, &request.spHeader, sizeof( request ), FALSE ); checkMessageHeader_( line, &request.request.header, 5 ); ok_( __FILE__, line )( request.request.flags == expectedFlags, "got flags %#lx.\n", request.request.flags );
@@ -1423,7 +1437,7 @@ static unsigned short receiveAddForwardRequest_( int line, SOCKET sock, DPID exp if ( wsResult == SOCKET_ERROR ) return 0;
- port = checkSpHeader_( line, &request.spHeader, expectedSize ); + port = checkSpHeader_( line, &request.spHeader, expectedSize, FALSE ); checkMessageHeader_( line, &request.request.header, 19 ); ok_( __FILE__, line )( !request.request.toId, "got destination id %#lx.\n", request.request.toId ); ok_( __FILE__, line )( request.request.playerId == expectedPlayerId, "got player id %#lx.\n", @@ -1803,7 +1817,7 @@ static unsigned short receiveAddForwardAck_( int line, SOCKET sock, DPID expecte wsResult = receiveMessage_( line, sock, &request, sizeof( request ) ); ok_( __FILE__, line )( wsResult == sizeof( request ), "recv() returned %d.\n", wsResult );
- port = checkSpHeader_( line, &request.spHeader, sizeof( request ) ); + port = checkSpHeader_( line, &request.spHeader, sizeof( request ), FALSE ); checkMessageHeader_( line, &request.request.header, 47 );
return port; @@ -1844,7 +1858,7 @@ static unsigned short receiveCreatePlayer_( int line, SOCKET sock, DPID expected wsResult = receiveMessage_( line, sock, &request, sizeof( request ) ); ok_( __FILE__, line )( wsResult == sizeof( request ), "recv() returned %d.\n", wsResult );
- port = checkSpHeader_( line, &request.spHeader, expectedSize ); + port = checkSpHeader_( line, &request.spHeader, expectedSize, FALSE ); checkMessageHeader_( line, &request.request.header, 8 ); ok_( __FILE__, line )( !request.request.toId, "got destination id %#lx.\n", request.request.toId ); ok_( __FILE__, line )( request.request.playerId == expectedPlayerId, "got player id %#lx.\n", @@ -2026,7 +2040,7 @@ static unsigned short receiveGuaranteedGameMessage_( int line, SOCKET sock, DPID wsResult = receiveMessage_( line, sock, &request, expectedSize ); ok_( __FILE__, line )( wsResult == expectedSize, "recv() returned %d.\n", wsResult );
- port = checkSpHeader_( line, &request.spHeader, expectedSize ); + port = checkSpHeader_( line, &request.spHeader, expectedSize, FALSE ); checkGameMessage_( line, &request.request, expectedFromId, expectedToId ); ok_( __FILE__, line )( !memcmp( &request.data, expectedData, expectedDataSize ), "message data didn't match.\n" );
@@ -2178,7 +2192,7 @@ static unsigned short receivePingReply_( int line, SOCKET sock, DPID expectedFro wsResult = receiveMessage_( line, sock, &request, sizeof( request ) ); ok_( __FILE__, line )( wsResult == sizeof( request ), "recv() returned %d.\n", wsResult );
- port = checkSpHeader_( line, &request.spHeader, sizeof( request ) ); + port = checkSpHeader_( line, &request.spHeader, sizeof( request ), FALSE ); checkMessageHeader_( line, &request.request.header, 23 ); ok_( __FILE__, line )( request.request.fromId == expectedFromId, "got source id %#lx.\n", request.request.fromId ); ok_( __FILE__, line )( request.request.tickCount == expectedTickCount, "got tick count %#lx.\n", @@ -2204,7 +2218,7 @@ static unsigned short receiveAddPlayerToGroup_( int line, SOCKET sock, DPID expe wsResult = receiveMessage_( line, sock, &request, sizeof( request ) ); ok_( __FILE__, line )( wsResult == sizeof( request ), "recv() returned %d.\n", wsResult );
- port = checkSpHeader_( line, &request.spHeader, sizeof( request ) ); + port = checkSpHeader_( line, &request.spHeader, sizeof( request ), FALSE ); checkMessageHeader_( line, &request.request.header, 13 );
ok_( __FILE__, line )( !request.request.toId, "got destination id %#lx.\n", request.request.toId ); @@ -3342,7 +3356,7 @@ static void test_Open(void)
enumSessionsParam = enumSessionsAsync( dp, &dpsdAppGuid, 100, countSessionsCallback, &count, 0 );
- port = receiveEnumSessionsRequest( enumSock, &appGuid, NULL, 0 ); + port = receiveEnumSessionsRequest( enumSock, &appGuid, NULL, 0, FALSE );
sock = connectTcp( port );
@@ -3384,7 +3398,7 @@ static void test_Open(void) enumSessionsParam = enumSessionsAsync( dp, &dpsdAppGuid, 100, countSessionsCallback, &count, DPENUMSESSIONS_PASSWORDREQUIRED );
- port = receiveEnumSessionsRequest( enumSock, &appGuid, NULL, DPENUMSESSIONS_PASSWORDREQUIRED ); + port = receiveEnumSessionsRequest( enumSock, &appGuid, NULL, DPENUMSESSIONS_PASSWORDREQUIRED, FALSE );
sock = connectTcp( port );
@@ -3569,7 +3583,7 @@ static void joinSession_( int line, IDirectPlay4 *dp, DPSESSIONDESC2 *dpsd, DPSE
enumSessionsParam = enumSessionsAsync( dp, dpsd, 100, countSessionsCallback, &count, 0 );
- port = receiveEnumSessionsRequest_( line, enumSock, &appGuid, NULL, 0 ); + port = receiveEnumSessionsRequest_( line, enumSock, &appGuid, NULL, 0, FALSE );
*sendSock = connectTcp_( line, port );
@@ -3724,6 +3738,7 @@ typedef struct int expectedCount; int actualCount; int timeoutCount; + BOOL ansi; } CheckSessionListCallbackData;
static BOOL CALLBACK checkSessionListCallback( const DPSESSIONDESC2 *thisSd, DWORD *timeout, DWORD flags, void *context ) @@ -3760,10 +3775,11 @@ static BOOL CALLBACK checkSessionListCallback( const DPSESSIONDESC2 *thisSd, DWO "got current player count %lu.\n", thisSd->dwMaxPlayers ); ok_( __FILE__, data->line )( thisSd->dwCurrentPlayers == expectedSession->dpsd.dwCurrentPlayers, "got max player count %lu.\n", thisSd->dwCurrentPlayers ); - ok_( __FILE__, data->line )( !strcmp( thisSd->lpszSessionNameA, expectedSession->dpsd.lpszSessionNameA ), - "got session name %s.\n", wine_dbgstr_a( thisSd->lpszSessionNameA ) ); + todo_wine_if( !data->ansi ) + ok_( __FILE__, data->line )( !strcmpAW( thisSd->lpszSessionNameA, expectedSession->dpsd.lpszSessionNameA, data->ansi ), + "got session name %s.\n", dbgStrAW( thisSd->lpszSessionNameA, data->ansi ) ); ok_( __FILE__, data->line )( !thisSd->lpszPasswordA, "got password %s.\n", - wine_dbgstr_a( thisSd->lpszPasswordA ) ); + dbgStrAW( thisSd->lpszPasswordA, data->ansi ) ); ok_( __FILE__, data->line )( thisSd->dwReserved1 == expectedSession->dpsd.dwReserved1, "got reserved1 %#lx.\n", thisSd->dwReserved1 ); ok_( __FILE__, data->line )( thisSd->dwReserved2 == expectedSession->dpsd.dwReserved2, "got reserved2 %#lx.\n", @@ -3788,12 +3804,12 @@ static BOOL CALLBACK checkSessionListCallback( const DPSESSIONDESC2 *thisSd, DWO }
#define check_EnumSessions( dp, dpsd, flags, expectedHr, expectedSessionCount, timeoutExpected, \ - requestExpected, expectedPassword, replyCount, hrTodo ) \ + requestExpected, expectedPassword, replyCount, ansi, hrTodo ) \ check_EnumSessions_( __LINE__, dp, dpsd, flags, expectedHr, expectedSessionCount, timeoutExpected, \ - requestExpected, expectedPassword, replyCount, hrTodo ) + requestExpected, expectedPassword, replyCount, ansi, hrTodo ) static void check_EnumSessions_( int line, IDirectPlay4 *dp, DPSESSIONDESC2 *dpsd, DWORD flags, HRESULT expectedHr, DWORD expectedSessionCount, BOOL timeoutExpected, BOOL requestExpected, - const WCHAR *expectedPassword, DWORD replyCount, BOOL hrTodo ) + const WCHAR *expectedPassword, DWORD replyCount, BOOL ansi, BOOL hrTodo ) { DPSESSIONDESC2 replyDpsds[] = { @@ -3849,19 +3865,21 @@ static void check_EnumSessions_( int line, IDirectPlay4 *dp, DPSESSIONDESC2 *dps { memset( &expectedSessions, 0, sizeof( expectedSessions ) ); expectedSessions[ 0 ].dpsd = replyDpsds [ 0 ]; - expectedSessions[ 0 ].dpsd.lpszSessionNameA = (char *) "normal"; + expectedSessions[ 0 ].dpsd.lpszSessionNameA = (char *) AW( "normal", ansi ); expectedSessions[ 1 ].dpsd = replyDpsds [ 1 ]; - expectedSessions[ 1 ].dpsd.lpszSessionNameA = (char *) "private"; + expectedSessions[ 1 ].dpsd.lpszSessionNameA = (char *) AW( "private", ansi );
memset( &callbackData, 0, sizeof( callbackData ) ); callbackData.line = line; callbackData.expectedSessions = expectedSessions; callbackData.expectedCount = expectedSessionCount; + callbackData.ansi = ansi;
param = enumSessionsAsync( dp, dpsd, 100, checkSessionListCallback, &callbackData, flags );
if ( requestExpected ) - port = receiveEnumSessionsRequest_( line, enumSock, &appGuid, expectedPassword, flags ); + port = receiveEnumSessionsRequest_( line, enumSock, &appGuid, expectedPassword, flags, + !ansi && expectedPassword );
for ( i = 0; i < replyCount; ++i ) { @@ -3894,8 +3912,8 @@ static void check_EnumSessions_( int line, IDirectPlay4 *dp, DPSESSIONDESC2 *dps WSACleanup(); }
-#define check_EnumSessions_async( dpsd, dp ) check_EnumSessions_async_( __LINE__, dpsd, dp ) -static void check_EnumSessions_async_( int line, DPSESSIONDESC2 *dpsd, IDirectPlay4 *dp ) +#define check_EnumSessions_async( dpsd, dp, ansi ) check_EnumSessions_async_( __LINE__, dpsd, dp, ansi ) +static void check_EnumSessions_async_( int line, DPSESSIONDESC2 *dpsd, IDirectPlay4 *dp, BOOL ansi ) { DPSESSIONDESC2 replyDpsds[] = { @@ -3946,17 +3964,18 @@ static void check_EnumSessions_async_( int line, DPSESSIONDESC2 *dpsd, IDirectPl { memset( expectedSessions, 0, sizeof( expectedSessions ) ); expectedSessions[ 0 ].dpsd = replyDpsds [ 0 ]; - expectedSessions[ 0 ].dpsd.lpszSessionNameA = (char *) "normal"; + expectedSessions[ 0 ].dpsd.lpszSessionNameA = (char *) AW( "normal", ansi );
memset( &callbackData, 0, sizeof( callbackData ) ); callbackData.line = line; callbackData.expectedSessions = expectedSessions; callbackData.expectedCount = 1; + callbackData.ansi = ansi;
/* Do a sync enumeration first to fill the cache */ param = enumSessionsAsync( dp, dpsd, 100, checkSessionListCallback, &callbackData, 0 );
- port = receiveEnumSessionsRequest_( line, enumSock, &appGuid, NULL, 0 ); + port = receiveEnumSessionsRequest_( line, enumSock, &appGuid, NULL, 0, FALSE );
sock = connectTcp_( line, port );
@@ -3984,17 +4003,18 @@ static void check_EnumSessions_async_( int line, DPSESSIONDESC2 *dpsd, IDirectPl
memset( expectedSessions, 0, sizeof( expectedSessions ) ); expectedSessions[ 0 ].dpsd = replyDpsds [ 0 ]; - expectedSessions[ 0 ].dpsd.lpszSessionNameA = (char *) "normal"; + expectedSessions[ 0 ].dpsd.lpszSessionNameA = (char *) AW( "normal", ansi );
memset( &callbackData, 0, sizeof( callbackData ) ); callbackData.line = line; callbackData.expectedSessions = expectedSessions; callbackData.expectedCount = 1; + callbackData.ansi = ansi;
/* Read cache of last sync enumeration */ param = enumSessionsAsync( dp, dpsd, 100, checkSessionListCallback, &callbackData, DPENUMSESSIONS_ASYNC );
- receiveEnumSessionsRequest_( line, enumSock, &appGuid, NULL, DPENUMSESSIONS_ASYNC ); + receiveEnumSessionsRequest_( line, enumSock, &appGuid, NULL, DPENUMSESSIONS_ASYNC, FALSE );
hr = enumSessionsAsyncWait( param, 2000 ); ok_( __FILE__, line )( hr == DP_OK, "got hr %#lx.\n", hr ); @@ -4005,7 +4025,7 @@ static void check_EnumSessions_async_( int line, DPSESSIONDESC2 *dpsd, IDirectPl
/* Check that requests are sent periodically */ for ( i = 0; i < 2; ++i ) - port = receiveEnumSessionsRequest_( line, enumSock, &appGuid, NULL, DPENUMSESSIONS_ASYNC ); + port = receiveEnumSessionsRequest_( line, enumSock, &appGuid, NULL, DPENUMSESSIONS_ASYNC, FALSE );
for ( i = 0; i < ARRAYSIZE( replyDpsds ); ++i ) { @@ -4022,14 +4042,15 @@ static void check_EnumSessions_async_( int line, DPSESSIONDESC2 *dpsd, IDirectPl { memset( expectedSessions, 0, sizeof( expectedSessions ) ); expectedSessions[ 0 ].dpsd = replyDpsds [ 0 ]; - expectedSessions[ 0 ].dpsd.lpszSessionNameA = (char *) "normal"; + expectedSessions[ 0 ].dpsd.lpszSessionNameA = (char *) AW( "normal", ansi ); expectedSessions[ 1 ].dpsd = replyDpsds [ 1 ]; - expectedSessions[ 1 ].dpsd.lpszSessionNameA = (char *) "private"; + expectedSessions[ 1 ].dpsd.lpszSessionNameA = (char *) AW( "private", ansi );
memset( &callbackData, 0, sizeof( callbackData ) ); callbackData.line = line; callbackData.expectedSessions = expectedSessions; callbackData.expectedCount = ARRAYSIZE( expectedSessions ); + callbackData.ansi = ansi;
/* Retrieve results */ param = enumSessionsAsync( dp, dpsd, 100, checkSessionListCallback, &callbackData, DPENUMSESSIONS_ASYNC ); @@ -4050,6 +4071,7 @@ static void check_EnumSessions_async_( int line, DPSESSIONDESC2 *dpsd, IDirectPl callbackData.line = line; callbackData.expectedSessions = NULL; callbackData.expectedCount = 0; + callbackData.ansi = ansi;
/* Stop enumeration */ param = enumSessionsAsync( dp, dpsd, 100, checkSessionListCallback, &callbackData, DPENUMSESSIONS_STOPASYNC ); @@ -4071,42 +4093,57 @@ static void test_EnumSessions(void) .guidInstance = appGuid, }; DPSESSIONDESC2 dpsd; + IDirectPlay4 *dpA; IDirectPlay4 *dp; HRESULT hr;
- hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay4A, (void **) &dp ); + hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay4A, (void **) &dpA ); + ok( hr == DP_OK, "got hr %#lx.\n", hr ); + hr = IDirectPlayX_QueryInterface( dpA, &IID_IDirectPlay4, (void **) &dp ); ok( hr == DP_OK, "got hr %#lx.\n", hr );
/* Service provider not initialized */ - check_EnumSessions( dp, &appGuidDpsd, 0, DPERR_UNINITIALIZED, 0, FALSE, FALSE, NULL, 0, FALSE ); + check_EnumSessions( dpA, &appGuidDpsd, 0, DPERR_UNINITIALIZED, 0, FALSE, FALSE, NULL, 0, TRUE, FALSE ); + check_EnumSessions( dp, &appGuidDpsd, 0, DPERR_UNINITIALIZED, 0, FALSE, FALSE, NULL, 0, FALSE, FALSE );
- init_TCPIP_provider( dp, "127.0.0.1", 0 ); + init_TCPIP_provider( dpA, "127.0.0.1", 0 );
/* Session with no size */ dpsd = appGuidDpsd; dpsd.dwSize = 0; - check_EnumSessions( dp, &dpsd, 0, DPERR_INVALIDPARAMS, 0, FALSE, FALSE, NULL, 0, FALSE ); + check_EnumSessions( dpA, &dpsd, 0, DPERR_INVALIDPARAMS, 0, FALSE, FALSE, NULL, 0, TRUE, FALSE ); + check_EnumSessions( dp, &dpsd, 0, DPERR_INVALIDPARAMS, 0, FALSE, FALSE, NULL, 0, FALSE, FALSE );
/* No sessions */ - check_EnumSessions( dp, &appGuidDpsd, 0, DP_OK, 0, TRUE, TRUE, NULL, 0, FALSE ); + check_EnumSessions( dpA, &appGuidDpsd, 0, DP_OK, 0, TRUE, TRUE, NULL, 0, TRUE, FALSE ); + check_EnumSessions( dp, &appGuidDpsd, 0, DP_OK, 0, TRUE, TRUE, NULL, 0, FALSE, FALSE );
/* Invalid params */ - check_EnumSessions( dp, &appGuidDpsd, -1, DPERR_INVALIDPARAMS, 0, FALSE, FALSE, NULL, 0, TRUE ); - check_EnumSessions( dp, NULL, 0, DPERR_INVALIDPARAMS, 0, FALSE, FALSE, NULL, 0, FALSE ); + check_EnumSessions( dpA, &appGuidDpsd, -1, DPERR_INVALIDPARAMS, 0, FALSE, FALSE, NULL, 0, TRUE, TRUE ); + check_EnumSessions( dp, &appGuidDpsd, -1, DPERR_INVALIDPARAMS, 0, FALSE, FALSE, NULL, 0, FALSE, TRUE ); + check_EnumSessions( dpA, NULL, 0, DPERR_INVALIDPARAMS, 0, FALSE, FALSE, NULL, 0, TRUE, FALSE ); + check_EnumSessions( dp, NULL, 0, DPERR_INVALIDPARAMS, 0, FALSE, FALSE, NULL, 0, FALSE, FALSE );
/* All sessions are enumerated regardless of flags */ - check_EnumSessions( dp, &appGuidDpsd, 0, DP_OK, 2, TRUE, TRUE, NULL, 2, FALSE ); - check_EnumSessions( dp, &appGuidDpsd, DPENUMSESSIONS_AVAILABLE, DP_OK, 2, TRUE, TRUE, NULL, 2, FALSE ); + check_EnumSessions( dpA, &appGuidDpsd, 0, DP_OK, 2, TRUE, TRUE, NULL, 2, TRUE, FALSE ); + check_EnumSessions( dp, &appGuidDpsd, 0, DP_OK, 2, TRUE, TRUE, NULL, 2, FALSE, FALSE ); + check_EnumSessions( dpA, &appGuidDpsd, DPENUMSESSIONS_AVAILABLE, DP_OK, 2, TRUE, TRUE, NULL, 2, TRUE, FALSE ); + check_EnumSessions( dp, &appGuidDpsd, DPENUMSESSIONS_AVAILABLE, DP_OK, 2, TRUE, TRUE, NULL, 2, FALSE, FALSE );
/* Async enumeration */ - check_EnumSessions_async( &appGuidDpsd, dp ); + check_EnumSessions_async( &appGuidDpsd, dpA, TRUE ); + check_EnumSessions_async( &appGuidDpsd, dp, FALSE );
/* Enumeration with password */ dpsd = appGuidDpsd; dpsd.lpszPasswordA = (char *) "password"; - check_EnumSessions( dp, &dpsd, 0, DP_OK, 2, TRUE, TRUE, L"password", 2, FALSE ); + check_EnumSessions( dpA, &dpsd, 0, DP_OK, 2, TRUE, TRUE, L"password", 2, TRUE, FALSE ); + dpsd = appGuidDpsd; + dpsd.lpszPassword = (WCHAR *) L"password"; + check_EnumSessions( dp, &dpsd, 0, DP_OK, 2, TRUE, TRUE, L"password", 2, FALSE, FALSE );
IDirectPlayX_Release( dp ); + IDirectPlayX_Release( dpA ); }
static void test_interactive_EnumSessions(void)
From: Anton Baskanov baskanov@gmail.com
--- dlls/dplayx/dplay.c | 39 +++++++++++++++----------- dlls/dplayx/name_server.c | 18 ++++++++++-- dlls/dplayx/name_server.h | 2 +- dlls/dplayx/tests/dplayx.c | 57 +++++++++++++++++--------------------- 4 files changed, 65 insertions(+), 51 deletions(-)
diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index acfadd7463a..13beb86ea3e 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -2801,7 +2801,8 @@ static BOOL DP_InvokeEnumSessionCallbacks ( LPDPENUMSESSIONSCALLBACK2 lpEnumSessionsCallback2, LPVOID lpNSInfo, DWORD *timeout, - LPVOID lpContext ) + LPVOID lpContext, + BOOL ansi ) { LPDPSESSIONDESC2 lpSessionDesc;
@@ -2809,7 +2810,7 @@ static BOOL DP_InvokeEnumSessionCallbacks
/* Enumerate all sessions */ /* FIXME: Need to indicate ANSI */ - while( (lpSessionDesc = NS_WalkSessions( lpNSInfo, NULL ) ) != NULL ) + while( (lpSessionDesc = NS_WalkSessions( lpNSInfo, NULL, ansi ) ) != NULL ) { TRACE( "EnumSessionsCallback2 invoked\n" ); if( !lpEnumSessionsCallback2( lpSessionDesc, timeout, 0, lpContext ) ) @@ -2921,18 +2922,10 @@ static HRESULT WINAPI IDirectPlay3Impl_EnumSessions( IDirectPlay3 *iface, DPSESS context, flags ); }
-static HRESULT WINAPI IDirectPlay4AImpl_EnumSessions( IDirectPlay4A *iface, DPSESSIONDESC2 *sdesc, - DWORD timeout, LPDPENUMSESSIONSCALLBACK2 enumsessioncb, void *context, DWORD flags ) -{ - IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface ); - return IDirectPlayX_EnumSessions( &This->IDirectPlay4_iface, sdesc, timeout, enumsessioncb, - context, flags ); -} - -static HRESULT WINAPI IDirectPlay4Impl_EnumSessions( IDirectPlay4 *iface, DPSESSIONDESC2 *sdesc, - DWORD timeout, LPDPENUMSESSIONSCALLBACK2 enumsessioncb, void *context, DWORD flags ) +static HRESULT DP_IF_EnumSessions( IDirectPlayImpl *This, DPSESSIONDESC2 *sdesc, + DWORD timeout, LPDPENUMSESSIONSCALLBACK2 enumsessioncb, void *context, DWORD flags, + BOOL ansi ) { - IDirectPlayImpl *This = impl_from_IDirectPlay4( iface ); EnumSessionAsyncCallbackData *data; WCHAR *password = NULL; DWORD defaultTimeout; @@ -2999,7 +2992,7 @@ static HRESULT WINAPI IDirectPlay4Impl_EnumSessions( IDirectPlay4 *iface, DPSESS return DP_OK; }
- password = DP_DuplicateString( sdesc->lpszPassword, FALSE, TRUE ); + password = DP_DuplicateString( sdesc->lpszPassword, FALSE, ansi ); if ( !password && sdesc->lpszPassword ) return DPERR_OUTOFMEMORY;
@@ -3033,7 +3026,7 @@ static HRESULT WINAPI IDirectPlay4Impl_EnumSessions( IDirectPlay4 *iface, DPSESS LeaveCriticalSection( &This->lock );
if ( !DP_InvokeEnumSessionCallbacks( enumsessioncb, This->dp2->lpNameServerData, &timeout, - context ) ) + context, ansi ) ) break; }
@@ -3097,6 +3090,20 @@ static HRESULT WINAPI IDirectPlay4Impl_EnumSessions( IDirectPlay4 *iface, DPSESS return DP_OK; }
+static HRESULT WINAPI IDirectPlay4AImpl_EnumSessions( IDirectPlay4A *iface, DPSESSIONDESC2 *sdesc, + DWORD timeout, LPDPENUMSESSIONSCALLBACK2 enumsessioncb, void *context, DWORD flags ) +{ + IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface ); + return DP_IF_EnumSessions( This, sdesc, timeout, enumsessioncb, context, flags, TRUE ); +} + +static HRESULT WINAPI IDirectPlay4Impl_EnumSessions( IDirectPlay4 *iface, DPSESSIONDESC2 *sdesc, + DWORD timeout, LPDPENUMSESSIONSCALLBACK2 enumsessioncb, void *context, DWORD flags ) +{ + IDirectPlayImpl *This = impl_from_IDirectPlay4( iface ); + return DP_IF_EnumSessions( This, sdesc, timeout, enumsessioncb, context, flags, FALSE ); +} + static HRESULT WINAPI IDirectPlay2AImpl_GetCaps( IDirectPlay2A *iface, DPCAPS *caps, DWORD flags ) { IDirectPlayImpl *This = impl_from_IDirectPlay2A( iface ); @@ -3775,7 +3782,7 @@ static HRESULT DP_SecureOpen( IDirectPlayImpl *This, const DPSESSIONDESC2 *lpsd,
for ( ;; ) { - sessionDesc = NS_WalkSessions( This->dp2->lpNameServerData, &spMessageHeader ); + sessionDesc = NS_WalkSessions( This->dp2->lpNameServerData, &spMessageHeader, bAnsi ); if ( !sessionDesc ) return DPERR_NOSESSIONS; if ( IsEqualGUID( &sessionDesc->guidInstance, &lpsd->guidInstance ) ) diff --git a/dlls/dplayx/name_server.c b/dlls/dplayx/name_server.c index 755288a4e57..113b8f0377b 100644 --- a/dlls/dplayx/name_server.c +++ b/dlls/dplayx/name_server.c @@ -48,6 +48,7 @@ struct NSCacheData
DWORD dwTime; /* Time at which data was last known valid */ LPDPSESSIONDESC2 data; + LPDPSESSIONDESC2 dataA;
LPVOID lpNSAddrHdr;
@@ -135,7 +136,7 @@ void NS_AddRemoteComputerAsNameServer( LPCVOID lpcNSAddrHdr dpsd.lpszSessionName = (WCHAR *) (lpcMsg + 1); dpsd.lpszPassword = NULL;
- lpCacheNode->data = DP_DuplicateSessionDesc( &dpsd, TRUE, FALSE ); + lpCacheNode->data = DP_DuplicateSessionDesc( &dpsd, FALSE, FALSE );
if( lpCacheNode->data == NULL ) { @@ -144,6 +145,16 @@ void NS_AddRemoteComputerAsNameServer( LPCVOID lpcNSAddrHdr return; }
+ lpCacheNode->dataA = DP_DuplicateSessionDesc( &dpsd, TRUE, FALSE ); + + if( lpCacheNode->dataA == NULL ) + { + ERR( "no memory for SESSIONDESC2\n" ); + free( lpCacheNode->data ); + free( lpCacheNode ); + return; + } + lpCacheNode->ref = 1; lpCacheNode->dwTime = timeGetTime();
@@ -213,6 +224,7 @@ static DPQ_DECL_DELETECB( cbReleaseNSNode, lpNSCacheData ) if ( ref ) return;
+ free( elem->dataA ); free( elem->data ); free( elem->lpNSAddrHdr ); free( elem ); @@ -280,7 +292,7 @@ void NS_ResetSessionEnumeration( LPVOID lpNSInfo ) ((lpNSCache)lpNSInfo)->present = ((lpNSCache)lpNSInfo)->walkFirst.lpQHFirst; }
-LPDPSESSIONDESC2 NS_WalkSessions( LPVOID lpNSInfo, void **spMessageHeader ) +LPDPSESSIONDESC2 NS_WalkSessions( LPVOID lpNSInfo, void **spMessageHeader, BOOL ansi ) { LPDPSESSIONDESC2 lpSessionDesc; lpNSCache lpCache = (lpNSCache)lpNSInfo; @@ -291,7 +303,7 @@ LPDPSESSIONDESC2 NS_WalkSessions( LPVOID lpNSInfo, void **spMessageHeader ) return NULL; }
- lpSessionDesc = lpCache->present->data; + lpSessionDesc = ansi ? lpCache->present->dataA : lpCache->present->data;
if( spMessageHeader ) *spMessageHeader = lpCache->present->lpNSAddrHdr; diff --git a/dlls/dplayx/name_server.h b/dlls/dplayx/name_server.h index ad51a550b9c..2dbbad1b971 100644 --- a/dlls/dplayx/name_server.h +++ b/dlls/dplayx/name_server.h @@ -53,7 +53,7 @@ void NS_InvalidateSessionCache( LPVOID lpNSInfo );
void NS_ResetSessionEnumeration( LPVOID lpNSInfo ); -LPDPSESSIONDESC2 NS_WalkSessions( LPVOID lpNSInfo, void **spMessageHeader ); +LPDPSESSIONDESC2 NS_WalkSessions( LPVOID lpNSInfo, void **spMessageHeader, BOOL ansi ); void NS_PruneSessionCache( LPVOID lpNSInfo );
#endif /* __WINE_DPLAYX_NAMESERVER */ diff --git a/dlls/dplayx/tests/dplayx.c b/dlls/dplayx/tests/dplayx.c index 93f0dea9d66..3efae753408 100644 --- a/dlls/dplayx/tests/dplayx.c +++ b/dlls/dplayx/tests/dplayx.c @@ -1176,11 +1176,10 @@ static void checkNoMoreMessages_( int line, SOCKET sock ) ok_( __FILE__, line )( !wsResult || wsResult == SOCKET_ERROR, "recv() returned %d.\n", wsResult ); }
-#define checkSpHeader( header, expectedSize, sizeTodo ) checkSpHeader_( __LINE__, header, expectedSize, sizeTodo ) -static unsigned short checkSpHeader_( int line, SpHeader *header, DWORD expectedSize, BOOL sizeTodo ) +#define checkSpHeader( header, expectedSize ) checkSpHeader_( __LINE__, header, expectedSize ) +static unsigned short checkSpHeader_( int line, SpHeader *header, DWORD expectedSize ) { - todo_wine_if( sizeTodo ) - ok_( __FILE__, line )( header->mixed == 0xfab00000 + expectedSize, "got mixed %#lx.\n", header->mixed ); + ok_( __FILE__, line )( header->mixed == 0xfab00000 + expectedSize, "got mixed %#lx.\n", header->mixed ); ok_( __FILE__, line )( header->addr.sin_family == AF_INET, "got family %d.\n", header->addr.sin_family ); ok_( __FILE__, line )( 2300 <= ntohs( header->addr.sin_port ) && ntohs( header->addr.sin_port ) < 2350, "got port %d.\n", ntohs( header->addr.sin_port ) ); @@ -1250,11 +1249,10 @@ static void checkGameMessage_( int line, GameMessage *message, DPID expectedFrom ok_( __FILE__, line )( message->toId == expectedToId, "got destination id %#lx.\n", message->toId ); }
-#define receiveEnumSessionsRequest( sock, expectedAppGuid, expectedPassword, expectedFlags, passwordTodo ) \ - receiveEnumSessionsRequest_( __LINE__, sock, expectedAppGuid, expectedPassword, expectedFlags, passwordTodo ) +#define receiveEnumSessionsRequest( sock, expectedAppGuid, expectedPassword, expectedFlags ) \ + receiveEnumSessionsRequest_( __LINE__, sock, expectedAppGuid, expectedPassword, expectedFlags ) static unsigned short receiveEnumSessionsRequest_( int line, SOCKET sock, const GUID *expectedAppGuid, - const WCHAR *expectedPassword, DWORD expectedFlags, - BOOL passwordTodo ) + const WCHAR *expectedPassword, DWORD expectedFlags ) { #include "pshpack1.h" struct @@ -1273,11 +1271,11 @@ static unsigned short receiveEnumSessionsRequest_( int line, SOCKET sock, const expectedSize = sizeof( request.spHeader ) + sizeof( request.request ) + expectedPasswordSize;
wsResult = receiveMessage_( line, sock, &request, sizeof( request ) ); - todo_wine_if( passwordTodo ) ok_( __FILE__, line )( wsResult == expectedSize, "recv() returned %d.\n", wsResult ); + ok_( __FILE__, line )( wsResult == expectedSize, "recv() returned %d.\n", wsResult ); if ( wsResult == SOCKET_ERROR ) return 0;
- port = checkSpHeader_( line, &request.spHeader, expectedSize, passwordTodo ); + port = checkSpHeader_( line, &request.spHeader, expectedSize ); checkMessageHeader_( line, &request.request.header, 2 ); ok_( __FILE__, line )( IsEqualGUID( &request.request.appGuid, expectedAppGuid ), "got app guid %s.\n", wine_dbgstr_guid( &request.request.appGuid ) ); @@ -1285,9 +1283,8 @@ static unsigned short receiveEnumSessionsRequest_( int line, SOCKET sock, const { ok_( __FILE__, line )( request.request.passwordOffset == 32, "got password offset %lu.\n", request.request.passwordOffset ); - todo_wine_if( passwordTodo ) - ok_( __FILE__, line )( !lstrcmpW( request.password, expectedPassword ), "got password %s.\n", - wine_dbgstr_w( request.password ) ); + ok_( __FILE__, line )( !lstrcmpW( request.password, expectedPassword ), "got password %s.\n", + wine_dbgstr_w( request.password ) ); } else { @@ -1364,7 +1361,7 @@ static unsigned short receiveRequestPlayerId_( int line, SOCKET sock, DWORD expe wsResult = receiveMessage_( line, sock, &request, sizeof( request ) ); ok_( __FILE__, line )( wsResult == sizeof( request ), "recv() returned %d.\n", wsResult );
- port = checkSpHeader_( line, &request.spHeader, sizeof( request ), FALSE ); + port = checkSpHeader_( line, &request.spHeader, sizeof( request ) ); checkMessageHeader_( line, &request.request.header, 5 ); ok_( __FILE__, line )( request.request.flags == expectedFlags, "got flags %#lx.\n", request.request.flags );
@@ -1437,7 +1434,7 @@ static unsigned short receiveAddForwardRequest_( int line, SOCKET sock, DPID exp if ( wsResult == SOCKET_ERROR ) return 0;
- port = checkSpHeader_( line, &request.spHeader, expectedSize, FALSE ); + port = checkSpHeader_( line, &request.spHeader, expectedSize ); checkMessageHeader_( line, &request.request.header, 19 ); ok_( __FILE__, line )( !request.request.toId, "got destination id %#lx.\n", request.request.toId ); ok_( __FILE__, line )( request.request.playerId == expectedPlayerId, "got player id %#lx.\n", @@ -1817,7 +1814,7 @@ static unsigned short receiveAddForwardAck_( int line, SOCKET sock, DPID expecte wsResult = receiveMessage_( line, sock, &request, sizeof( request ) ); ok_( __FILE__, line )( wsResult == sizeof( request ), "recv() returned %d.\n", wsResult );
- port = checkSpHeader_( line, &request.spHeader, sizeof( request ), FALSE ); + port = checkSpHeader_( line, &request.spHeader, sizeof( request ) ); checkMessageHeader_( line, &request.request.header, 47 );
return port; @@ -1858,7 +1855,7 @@ static unsigned short receiveCreatePlayer_( int line, SOCKET sock, DPID expected wsResult = receiveMessage_( line, sock, &request, sizeof( request ) ); ok_( __FILE__, line )( wsResult == sizeof( request ), "recv() returned %d.\n", wsResult );
- port = checkSpHeader_( line, &request.spHeader, expectedSize, FALSE ); + port = checkSpHeader_( line, &request.spHeader, expectedSize ); checkMessageHeader_( line, &request.request.header, 8 ); ok_( __FILE__, line )( !request.request.toId, "got destination id %#lx.\n", request.request.toId ); ok_( __FILE__, line )( request.request.playerId == expectedPlayerId, "got player id %#lx.\n", @@ -2040,7 +2037,7 @@ static unsigned short receiveGuaranteedGameMessage_( int line, SOCKET sock, DPID wsResult = receiveMessage_( line, sock, &request, expectedSize ); ok_( __FILE__, line )( wsResult == expectedSize, "recv() returned %d.\n", wsResult );
- port = checkSpHeader_( line, &request.spHeader, expectedSize, FALSE ); + port = checkSpHeader_( line, &request.spHeader, expectedSize ); checkGameMessage_( line, &request.request, expectedFromId, expectedToId ); ok_( __FILE__, line )( !memcmp( &request.data, expectedData, expectedDataSize ), "message data didn't match.\n" );
@@ -2192,7 +2189,7 @@ static unsigned short receivePingReply_( int line, SOCKET sock, DPID expectedFro wsResult = receiveMessage_( line, sock, &request, sizeof( request ) ); ok_( __FILE__, line )( wsResult == sizeof( request ), "recv() returned %d.\n", wsResult );
- port = checkSpHeader_( line, &request.spHeader, sizeof( request ), FALSE ); + port = checkSpHeader_( line, &request.spHeader, sizeof( request ) ); checkMessageHeader_( line, &request.request.header, 23 ); ok_( __FILE__, line )( request.request.fromId == expectedFromId, "got source id %#lx.\n", request.request.fromId ); ok_( __FILE__, line )( request.request.tickCount == expectedTickCount, "got tick count %#lx.\n", @@ -2218,7 +2215,7 @@ static unsigned short receiveAddPlayerToGroup_( int line, SOCKET sock, DPID expe wsResult = receiveMessage_( line, sock, &request, sizeof( request ) ); ok_( __FILE__, line )( wsResult == sizeof( request ), "recv() returned %d.\n", wsResult );
- port = checkSpHeader_( line, &request.spHeader, sizeof( request ), FALSE ); + port = checkSpHeader_( line, &request.spHeader, sizeof( request ) ); checkMessageHeader_( line, &request.request.header, 13 );
ok_( __FILE__, line )( !request.request.toId, "got destination id %#lx.\n", request.request.toId ); @@ -3356,7 +3353,7 @@ static void test_Open(void)
enumSessionsParam = enumSessionsAsync( dp, &dpsdAppGuid, 100, countSessionsCallback, &count, 0 );
- port = receiveEnumSessionsRequest( enumSock, &appGuid, NULL, 0, FALSE ); + port = receiveEnumSessionsRequest( enumSock, &appGuid, NULL, 0 );
sock = connectTcp( port );
@@ -3398,7 +3395,7 @@ static void test_Open(void) enumSessionsParam = enumSessionsAsync( dp, &dpsdAppGuid, 100, countSessionsCallback, &count, DPENUMSESSIONS_PASSWORDREQUIRED );
- port = receiveEnumSessionsRequest( enumSock, &appGuid, NULL, DPENUMSESSIONS_PASSWORDREQUIRED, FALSE ); + port = receiveEnumSessionsRequest( enumSock, &appGuid, NULL, DPENUMSESSIONS_PASSWORDREQUIRED );
sock = connectTcp( port );
@@ -3583,7 +3580,7 @@ static void joinSession_( int line, IDirectPlay4 *dp, DPSESSIONDESC2 *dpsd, DPSE
enumSessionsParam = enumSessionsAsync( dp, dpsd, 100, countSessionsCallback, &count, 0 );
- port = receiveEnumSessionsRequest_( line, enumSock, &appGuid, NULL, 0, FALSE ); + port = receiveEnumSessionsRequest_( line, enumSock, &appGuid, NULL, 0 );
*sendSock = connectTcp_( line, port );
@@ -3775,9 +3772,8 @@ static BOOL CALLBACK checkSessionListCallback( const DPSESSIONDESC2 *thisSd, DWO "got current player count %lu.\n", thisSd->dwMaxPlayers ); ok_( __FILE__, data->line )( thisSd->dwCurrentPlayers == expectedSession->dpsd.dwCurrentPlayers, "got max player count %lu.\n", thisSd->dwCurrentPlayers ); - todo_wine_if( !data->ansi ) - ok_( __FILE__, data->line )( !strcmpAW( thisSd->lpszSessionNameA, expectedSession->dpsd.lpszSessionNameA, data->ansi ), - "got session name %s.\n", dbgStrAW( thisSd->lpszSessionNameA, data->ansi ) ); + ok_( __FILE__, data->line )( !strcmpAW( thisSd->lpszSessionNameA, expectedSession->dpsd.lpszSessionNameA, data->ansi ), + "got session name %s.\n", dbgStrAW( thisSd->lpszSessionNameA, data->ansi ) ); ok_( __FILE__, data->line )( !thisSd->lpszPasswordA, "got password %s.\n", dbgStrAW( thisSd->lpszPasswordA, data->ansi ) ); ok_( __FILE__, data->line )( thisSd->dwReserved1 == expectedSession->dpsd.dwReserved1, "got reserved1 %#lx.\n", @@ -3878,8 +3874,7 @@ static void check_EnumSessions_( int line, IDirectPlay4 *dp, DPSESSIONDESC2 *dps param = enumSessionsAsync( dp, dpsd, 100, checkSessionListCallback, &callbackData, flags );
if ( requestExpected ) - port = receiveEnumSessionsRequest_( line, enumSock, &appGuid, expectedPassword, flags, - !ansi && expectedPassword ); + port = receiveEnumSessionsRequest_( line, enumSock, &appGuid, expectedPassword, flags );
for ( i = 0; i < replyCount; ++i ) { @@ -3975,7 +3970,7 @@ static void check_EnumSessions_async_( int line, DPSESSIONDESC2 *dpsd, IDirectPl /* Do a sync enumeration first to fill the cache */ param = enumSessionsAsync( dp, dpsd, 100, checkSessionListCallback, &callbackData, 0 );
- port = receiveEnumSessionsRequest_( line, enumSock, &appGuid, NULL, 0, FALSE ); + port = receiveEnumSessionsRequest_( line, enumSock, &appGuid, NULL, 0 );
sock = connectTcp_( line, port );
@@ -4014,7 +4009,7 @@ static void check_EnumSessions_async_( int line, DPSESSIONDESC2 *dpsd, IDirectPl /* Read cache of last sync enumeration */ param = enumSessionsAsync( dp, dpsd, 100, checkSessionListCallback, &callbackData, DPENUMSESSIONS_ASYNC );
- receiveEnumSessionsRequest_( line, enumSock, &appGuid, NULL, DPENUMSESSIONS_ASYNC, FALSE ); + receiveEnumSessionsRequest_( line, enumSock, &appGuid, NULL, DPENUMSESSIONS_ASYNC );
hr = enumSessionsAsyncWait( param, 2000 ); ok_( __FILE__, line )( hr == DP_OK, "got hr %#lx.\n", hr ); @@ -4025,7 +4020,7 @@ static void check_EnumSessions_async_( int line, DPSESSIONDESC2 *dpsd, IDirectPl
/* Check that requests are sent periodically */ for ( i = 0; i < 2; ++i ) - port = receiveEnumSessionsRequest_( line, enumSock, &appGuid, NULL, DPENUMSESSIONS_ASYNC, FALSE ); + port = receiveEnumSessionsRequest_( line, enumSock, &appGuid, NULL, DPENUMSESSIONS_ASYNC );
for ( i = 0; i < ARRAYSIZE( replyDpsds ); ++i ) {
From: Anton Baskanov baskanov@gmail.com
--- dlls/dplayx/dplay.c | 60 ++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 30 deletions(-)
diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index 13beb86ea3e..5efff5e8c2e 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -962,7 +962,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_QueryInterface( IDirectPlay3A *iface, RE void **ppv ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_QueryInterface( &This->IDirectPlay4_iface, riid, ppv ); + return IDirectPlayX_QueryInterface( &This->IDirectPlay4A_iface, riid, ppv ); }
static HRESULT WINAPI IDirectPlay3Impl_QueryInterface( IDirectPlay3 *iface, REFIID riid, @@ -1191,7 +1191,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_AddPlayerToGroup( IDirectPlay3A *iface, DPID player ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_AddPlayerToGroup( &This->IDirectPlay4_iface, group, player ); + return IDirectPlayX_AddPlayerToGroup( &This->IDirectPlay4A_iface, group, player ); }
static HRESULT WINAPI IDirectPlay3Impl_AddPlayerToGroup( IDirectPlay3 *iface, DPID group, @@ -1334,7 +1334,7 @@ static HRESULT WINAPI IDirectPlay2Impl_Close( IDirectPlay2 *iface ) static HRESULT WINAPI IDirectPlay3AImpl_Close( IDirectPlay3A *iface ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_Close( &This->IDirectPlay4_iface ); + return IDirectPlayX_Close( &This->IDirectPlay4A_iface ); }
static HRESULT WINAPI IDirectPlay3Impl_Close( IDirectPlay3 *iface ) @@ -1668,7 +1668,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_CreateGroup( IDirectPlay3A *iface, DPID DPNAME *name, void *data, DWORD size, DWORD flags ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_CreateGroup( &This->IDirectPlay4_iface, group, name, data, size, + return IDirectPlayX_CreateGroup( &This->IDirectPlay4A_iface, group, name, data, size, flags ); }
@@ -2215,7 +2215,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_CreatePlayer( IDirectPlay3A *iface, DPID DPNAME *name, HANDLE event, void *data, DWORD size, DWORD flags ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_CreatePlayer( &This->IDirectPlay4_iface, lpidPlayer, name, event, data, + return IDirectPlayX_CreatePlayer( &This->IDirectPlay4A_iface, lpidPlayer, name, event, data, size, flags ); }
@@ -2269,7 +2269,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_DeletePlayerFromGroup( IDirectPlay3A *if DPID player ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_DeletePlayerFromGroup( &This->IDirectPlay4_iface, group, player ); + return IDirectPlayX_DeletePlayerFromGroup( &This->IDirectPlay4A_iface, group, player ); }
static HRESULT WINAPI IDirectPlay3Impl_DeletePlayerFromGroup( IDirectPlay3 *iface, DPID group, @@ -2453,7 +2453,7 @@ static HRESULT WINAPI IDirectPlay2Impl_DestroyGroup( IDirectPlay2 *iface, DPID g static HRESULT WINAPI IDirectPlay3AImpl_DestroyGroup( IDirectPlay3A *iface, DPID group ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_DestroyGroup( &This->IDirectPlay4_iface, group ); + return IDirectPlayX_DestroyGroup( &This->IDirectPlay4A_iface, group ); }
static HRESULT WINAPI IDirectPlay3Impl_DestroyGroup( IDirectPlay3 *iface, DPID group ) @@ -2581,7 +2581,7 @@ static HRESULT WINAPI IDirectPlay2Impl_DestroyPlayer( IDirectPlay2 *iface, DPID static HRESULT WINAPI IDirectPlay3AImpl_DestroyPlayer( IDirectPlay3A *iface, DPID player ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_DestroyPlayer( &This->IDirectPlay4_iface, player ); + return IDirectPlayX_DestroyPlayer( &This->IDirectPlay4A_iface, player ); }
static HRESULT WINAPI IDirectPlay3Impl_DestroyPlayer( IDirectPlay3 *iface, DPID player ) @@ -2622,7 +2622,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_EnumGroupPlayers( IDirectPlay3A *iface, GUID *instance, LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_EnumGroupPlayers( &This->IDirectPlay4_iface, group, instance, + return IDirectPlayX_EnumGroupPlayers( &This->IDirectPlay4A_iface, group, instance, enumplayercb, context, flags ); }
@@ -2722,7 +2722,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_EnumGroups( IDirectPlay3A *iface, GUID * LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_EnumGroups( &This->IDirectPlay4_iface, instance, enumplayercb, context, + return IDirectPlayX_EnumGroups( &This->IDirectPlay4A_iface, instance, enumplayercb, context, flags ); }
@@ -2768,7 +2768,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_EnumPlayers( IDirectPlay3A *iface, GUID LPDPENUMPLAYERSCALLBACK2 enumplayercb, void *context, DWORD flags ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_EnumPlayers( &This->IDirectPlay4_iface, instance, enumplayercb, context, + return IDirectPlayX_EnumPlayers( &This->IDirectPlay4A_iface, instance, enumplayercb, context, flags ); }
@@ -2910,7 +2910,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_EnumSessions( IDirectPlay3A *iface, DPSE DWORD timeout, LPDPENUMSESSIONSCALLBACK2 enumsessioncb, void *context, DWORD flags ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_EnumSessions( &This->IDirectPlay4_iface, sdesc, timeout, enumsessioncb, + return IDirectPlayX_EnumSessions( &This->IDirectPlay4A_iface, sdesc, timeout, enumsessioncb, context, flags ); }
@@ -3119,7 +3119,7 @@ static HRESULT WINAPI IDirectPlay2Impl_GetCaps( IDirectPlay2 *iface, DPCAPS *cap static HRESULT WINAPI IDirectPlay3AImpl_GetCaps( IDirectPlay3A *iface, DPCAPS *caps, DWORD flags ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_GetCaps( &This->IDirectPlay4_iface, caps, flags ); + return IDirectPlayX_GetCaps( &This->IDirectPlay4A_iface, caps, flags ); }
static HRESULT WINAPI IDirectPlay3Impl_GetCaps( IDirectPlay3 *iface, DPCAPS *caps, DWORD flags ) @@ -3156,7 +3156,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_GetGroupData( IDirectPlay3A *iface, DPID DWORD *size, DWORD flags ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_GetGroupData( &This->IDirectPlay4_iface, group, data, size, flags ); + return IDirectPlayX_GetGroupData( &This->IDirectPlay4A_iface, group, data, size, flags ); }
static HRESULT WINAPI IDirectPlay3Impl_GetGroupData( IDirectPlay3 *iface, DPID group, void *data, @@ -3272,7 +3272,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_GetGroupName( IDirectPlay3A *iface, DPID DWORD *size ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_GetGroupName( &This->IDirectPlay4_iface, group, data, size ); + return IDirectPlayX_GetGroupName( &This->IDirectPlay4A_iface, group, data, size ); }
static HRESULT WINAPI IDirectPlay3Impl_GetGroupName( IDirectPlay3 *iface, DPID group, void *data, @@ -3314,7 +3314,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_GetMessageCount( IDirectPlay3A *iface, D DWORD *count ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_GetMessageCount( &This->IDirectPlay4_iface, player, count ); + return IDirectPlayX_GetMessageCount( &This->IDirectPlay4A_iface, player, count ); }
static HRESULT WINAPI IDirectPlay3Impl_GetMessageCount( IDirectPlay3 *iface, DPID player, @@ -3354,7 +3354,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_GetPlayerAddress( IDirectPlay3A *iface, void *data, DWORD *size ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_GetPlayerAddress( &This->IDirectPlay4_iface, player, data, size ); + return IDirectPlayX_GetPlayerAddress( &This->IDirectPlay4A_iface, player, data, size ); }
static HRESULT WINAPI IDirectPlay3Impl_GetPlayerAddress( IDirectPlay3 *iface, DPID player, @@ -3398,7 +3398,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_GetPlayerCaps( IDirectPlay3A *iface, DPI DPCAPS *caps, DWORD flags ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_GetPlayerCaps( &This->IDirectPlay4_iface, player, caps, flags ); + return IDirectPlayX_GetPlayerCaps( &This->IDirectPlay4A_iface, player, caps, flags ); }
static HRESULT WINAPI IDirectPlay3Impl_GetPlayerCaps( IDirectPlay3 *iface, DPID player, @@ -3459,7 +3459,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_GetPlayerData( IDirectPlay3A *iface, DPI void *data, DWORD *size, DWORD flags ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_GetPlayerData( &This->IDirectPlay4_iface, player, data, size, flags ); + return IDirectPlayX_GetPlayerData( &This->IDirectPlay4A_iface, player, data, size, flags ); }
static HRESULT WINAPI IDirectPlay3Impl_GetPlayerData( IDirectPlay3 *iface, DPID player, @@ -3583,7 +3583,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_GetPlayerName( IDirectPlay3A *iface, DPI void *data, DWORD *size ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_GetPlayerName( &This->IDirectPlay4_iface, player, data, size ); + return IDirectPlayX_GetPlayerName( &This->IDirectPlay4A_iface, player, data, size ); }
static HRESULT WINAPI IDirectPlay3Impl_GetPlayerName( IDirectPlay3 *iface, DPID player, @@ -3662,7 +3662,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_GetSessionDesc( IDirectPlay3A *iface, vo DWORD *size ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_GetSessionDesc( &This->IDirectPlay4_iface, data, size ); + return IDirectPlayX_GetSessionDesc( &This->IDirectPlay4A_iface, data, size ); }
static HRESULT WINAPI IDirectPlay3Impl_GetSessionDesc( IDirectPlay3 *iface, void *data, @@ -3701,7 +3701,7 @@ static HRESULT WINAPI IDirectPlay2Impl_Initialize( IDirectPlay2 *iface, GUID *gu static HRESULT WINAPI IDirectPlay3AImpl_Initialize( IDirectPlay3A *iface, GUID *guid ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_Initialize( &This->IDirectPlay4_iface, guid ); + return IDirectPlayX_Initialize( &This->IDirectPlay4A_iface, guid ); }
static HRESULT WINAPI IDirectPlay3Impl_Initialize( IDirectPlay3 *iface, GUID *guid ) @@ -3959,7 +3959,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_Open( IDirectPlay3A *iface, DPSESSIONDES DWORD flags ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_Open( &This->IDirectPlay4_iface, sdesc, flags ); + return IDirectPlayX_Open( &This->IDirectPlay4A_iface, sdesc, flags ); }
static HRESULT WINAPI IDirectPlay3Impl_Open( IDirectPlay3 *iface, DPSESSIONDESC2 *sdesc, @@ -4058,7 +4058,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_Receive( IDirectPlay3A *iface, DPID *fro DWORD flags, void *data, DWORD *size ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_Receive( &This->IDirectPlay4_iface, from, to, flags, data, size ); + return IDirectPlayX_Receive( &This->IDirectPlay4A_iface, from, to, flags, data, size ); }
static HRESULT WINAPI IDirectPlay3Impl_Receive( IDirectPlay3 *iface, DPID *from, DPID *to, @@ -4100,7 +4100,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_Send( IDirectPlay3A *iface, DPID from, D DWORD flags, void *data, DWORD size ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_Send( &This->IDirectPlay4_iface, from, to, flags, data, size ); + return IDirectPlayX_Send( &This->IDirectPlay4A_iface, from, to, flags, data, size ); }
static HRESULT WINAPI IDirectPlay3Impl_Send( IDirectPlay3 *iface, DPID from, DPID to, @@ -4140,7 +4140,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_SetGroupData( IDirectPlay3A *iface, DPID DWORD size, DWORD flags ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_SetGroupData( &This->IDirectPlay4_iface, group, data, size, flags ); + return IDirectPlayX_SetGroupData( &This->IDirectPlay4A_iface, group, data, size, flags ); }
static HRESULT WINAPI IDirectPlay3Impl_SetGroupData( IDirectPlay3 *iface, DPID group, void *data, @@ -4261,7 +4261,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_SetGroupName( IDirectPlay3A *iface, DPID DPNAME *name, DWORD flags ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_SetGroupName( &This->IDirectPlay4_iface, group, name, flags ); + return IDirectPlayX_SetGroupName( &This->IDirectPlay4A_iface, group, name, flags ); }
static HRESULT WINAPI IDirectPlay3Impl_SetGroupName( IDirectPlay3 *iface, DPID group, @@ -4303,7 +4303,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_SetPlayerData( IDirectPlay3A *iface, DPI void *data, DWORD size, DWORD flags ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_SetPlayerData( &This->IDirectPlay4_iface, player, data, size, flags ); + return IDirectPlayX_SetPlayerData( &This->IDirectPlay4A_iface, player, data, size, flags ); }
static HRESULT WINAPI IDirectPlay3Impl_SetPlayerData( IDirectPlay3 *iface, DPID player, @@ -4429,7 +4429,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_SetPlayerName( IDirectPlay3A *iface, DPI DPNAME *name, DWORD flags ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_SetPlayerName( &This->IDirectPlay4_iface, player, name, flags ); + return IDirectPlayX_SetPlayerName( &This->IDirectPlay4A_iface, player, name, flags ); }
static HRESULT WINAPI IDirectPlay3Impl_SetPlayerName( IDirectPlay3 *iface, DPID player, @@ -4524,7 +4524,7 @@ static HRESULT WINAPI IDirectPlay3AImpl_SetSessionDesc( IDirectPlay3A *iface, DP DWORD flags ) { IDirectPlayImpl *This = impl_from_IDirectPlay3A( iface ); - return IDirectPlayX_SetSessionDesc( &This->IDirectPlay4_iface, sdesc, flags ); + return IDirectPlayX_SetSessionDesc( &This->IDirectPlay4A_iface, sdesc, flags ); }
static HRESULT WINAPI IDirectPlay3Impl_SetSessionDesc( IDirectPlay3 *iface, DPSESSIONDESC2 *sdesc,
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=149793
Your paranoid android.
=== w7u_el (32 bit report) ===
dplayx: dplayx.c:4109: Test failed: recv() returned 52. dplayx.c:4114: Test failed: recv() returned 52. dplayx.c:4124: Test failed: recv() returned 52. dplayx.c:4129: Test failed: recv() returned 52. dplayx.c:4129: Test failed: got flags 0. dplayx.c:4129: Test failed: got flags 0. dplayx.c:4135: Test failed: recv() returned 52. dplayx.c:4138: Test failed: recv() returned 52. dplayx.c:3398: Test failed: got flags 0.
=== debian11 (32 bit ar:MA report) ===
dplayx: dplayx.c:9284: Test failed: got flags 0x1. dplayx.c:9284: Test failed: connect returned -1. dplayx.c:9284: Test failed: send() returned -1.
=== debian11b (32 bit WoW report) ===
dplayx: dplayx.c:4101: Test failed: recv() returned 52. dplayx.c:4113: Test failed: recv() returned 52. dplayx.c:4119: Test failed: recv() returned 52. dplayx.c:4126: Test failed: recv() returned 52. dplayx.c:4129: Test failed: recv() returned 52.
=== debian11b (64 bit WoW report) ===
user32: input.c:4305: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 00000000004B00FE, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032 win.c:4070: Test failed: Expected active window 0000000003650196, got 0000000000000000. win.c:4071: Test failed: Expected focus window 0000000003650196, got 0000000000000000.
This merge request was approved by Alistair Leslie-Hughes.