ReactOS 0.4.17-dev-966-gf06eace
dplayx.c File Reference
#include "wine/test.h"
#include <stdio.h>
#include <dplay.h>
#include <dplobby.h>
#include <netfw.h>
#include <winsock2.h>
#include "pshpack1.h"
#include "poppack.h"
Include dependency graph for dplayx.c:

Go to the source code of this file.

Classes

struct  tagCallbackData
 
struct  provider_data
 
struct  EnumSessionsParam
 
struct  OpenParam
 
struct  CreatePlayerParam
 
struct  SpHeader
 
struct  MessageHeader
 
struct  SpData
 
struct  PackedPlayer
 
struct  SuperPackedPlayer
 
struct  EnumSessionsRequest
 
struct  EnumSessionsReply
 
struct  RequestPlayerId
 
struct  RequestPlayerReply
 
struct  AddForwardRequest
 
struct  SuperEnumPlayersReply
 
struct  AddForwardReply
 
struct  AddForward
 
struct  AddForwardAck
 
struct  CreatePlayer
 
struct  GameMessage
 
struct  Ping
 
struct  AddPlayerToGroup
 
struct  GroupDataChanged
 
struct  ExpectedPlayer
 
struct  CheckPlayerListCallbackData
 
struct  ExpectedSession
 
struct  CheckSessionListCallbackData
 
struct  GetPlayerIdsCallbackData
 

Macros

#define COBJMACROS
 
#define INITGUID
 
#define check(expected, result)
 
#define checkLP(expected, result)
 
#define checkHR(expected, result)
 
#define checkStr(expected, result)
 
#define checkFlags(expected, result, flags)   checkFlags_(__LINE__, expected, result, flags)
 
#define checkGuid(expected, result)
 
#define checkConv(expected, result, function)
 
#define AW(str, ansi)   ((ansi) ? (const void *) str : (const void *) L##str)
 
#define FLAGS_DPCONNECTION   (1<<0)
 
#define FLAGS_DPENUMPLAYERS   (1<<1)
 
#define FLAGS_DPENUMGROUPS   (1<<2)
 
#define FLAGS_DPPLAYER   (1<<3)
 
#define FLAGS_DPGROUP   (1<<4)
 
#define FLAGS_DPENUMSESSIONS   (1<<5)
 
#define FLAGS_DPGETCAPS   (1<<6)
 
#define FLAGS_DPGET   (1<<7)
 
#define FLAGS_DPRECEIVE   (1<<8)
 
#define FLAGS_DPSEND   (1<<9)
 
#define FLAGS_DPSET   (1<<10)
 
#define FLAGS_DPMESSAGEQUEUE   (1<<11)
 
#define FLAGS_DPCONNECT   (1<<12)
 
#define FLAGS_DPOPEN   (1<<13)
 
#define FLAGS_DPSESSION   (1<<14)
 
#define FLAGS_DPLCONNECTION   (1<<15)
 
#define FLAGS_DPESC   (1<<16)
 
#define FLAGS_DPCAPS   (1<<17)
 
#define bindUdp(port)   bindUdp_( __LINE__, port )
 
#define listenTcp(port)   listenTcp_( __LINE__, port )
 
#define acceptTcp(listenSock)   acceptTcp_( __LINE__, listenSock )
 
#define checkNoMoreAccepts(listenSock)   checkNoMoreAccepts_( __LINE__, listenSock )
 
#define connectTcp(port)   connectTcp_( __LINE__, port )
 
#define connectUdp(port)   connectUdp_( __LINE__, port)
 
#define receiveMessage(sock, buffer, size)   receiveMessage_( __LINE__, sock, buffer, size )
 
#define checkNoMoreMessages(sock)   checkNoMoreMessages_( __LINE__, sock )
 
#define checkSpHeader(header, expectedSize)   checkSpHeader_( __LINE__, header, expectedSize )
 
#define checkMessageHeader(header, expectedCommand)   checkMessageHeader_( __LINE__, header, expectedCommand )
 
#define checkSpData(spData)   checkSpData_( __LINE__, spData, udpPort )
 
#define checkPackedPlayer(player, expectedFlags, expectedId, expectedShortNameLength, expectedLongNameLength, expectedPlayerDataSize, expectedSystemPlayerId)
 
#define checkGameMessage(message, expectedFromId, expectedToId)    checkGameMessage_( __LINE__, message, expectedFromId, expectedToId )
 
#define receiveEnumSessionsRequest(sock, expectedAppGuid, expectedPassword, expectedFlags)    receiveEnumSessionsRequest_( __LINE__, sock, expectedAppGuid, expectedPassword, expectedFlags )
 
#define sendEnumSessionsReply(sock, port, dpsd)   sendEnumSessionsReply_( __LINE__, sock, port, dpsd )
 
#define receiveRequestPlayerId(sock, expectedFlags)   receiveRequestPlayerId_( __LINE__, sock, expectedFlags )
 
#define sendRequestPlayerReply(sock, port, id, result)   sendRequestPlayerReply_( __LINE__, sock, port, id, result )
 
#define receiveAddForwardRequest(sock, expectedPlayerId, expectedPassword, expectedTickCount, udpPort)    receiveAddForwardRequest_( __LINE__, sock, expectedPlayerId, expectedPassword, expectedTickCount, udpPort )
 
#define sendSuperEnumPlayersReply(sock, tcpPort, udpPort, dpsd, sessionName)    sendSuperEnumPlayersReply_( __LINE__, sock, tcpPort, udpPort, dpsd, sessionName )
 
#define SHORT_NAME   L"short name"
 
#define LONG_NAME   L"long name"
 
#define sendAddForwardReply(sock, port, result)   sendAddForwardReply_( __LINE__, sock, port, result )
 
#define sendAddForward(sock, port, tcpPort, udpPort)   sendAddForward_( __LINE__, sock, port, tcpPort, udpPort )
 
#define receiveAddForwardAck(sock, expectedPlayerId)   receiveAddForwardAck_( __LINE__, sock, expectedPlayerId )
 
#define receiveCreatePlayer(sock, expectedPlayerId, expectedFlags, expectedShortName, expectedLongName, expectedPlayerData, expectedPlayerDataSize)
 
#define sendCreatePlayer(sock, tcpPort, udpPort, shortName, longName, playerData, playerDataSize)    sendCreatePlayer_( __LINE__, sock, tcpPort, udpPort, shortName, longName, playerData, playerDataSize )
 
#define receiveGuaranteedGameMessage(sock, expectedFromId, expectedToId, expectedData, expectedDataSize)    receiveGuaranteedGameMessage_( __LINE__, sock, expectedFromId, expectedToId, expectedData, expectedDataSize )
 
#define receiveGameMessage(sock, expectedFromId, expectedToId, expectedData, expectedDataSize)    receiveGameMessage_( __LINE__, sock, expectedFromId, expectedToId, expectedData, expectedDataSize )
 
#define sendGuaranteedGameMessage(sock, port, fromId, toId, data, dataSize)    sendGuaranteedGameMessage_( __LINE__, sock, port, fromId, toId, data, dataSize )
 
#define sendGameMessage(sock, fromId, toId, data, dataSize)    sendGameMessage_( __LINE__, sock, fromId, toId, data, dataSize )
 
#define sendPing(sock, port, fromId, tickCount)    sendPing_( __LINE__, sock, port, fromId, tickCount )
 
#define receivePingReply(sock, expectedFromId, expectedTickCount)    receivePingReply_( __LINE__, sock, expectedFromId, expectedTickCount )
 
#define receiveAddPlayerToGroup(sock, expectedPlayerId, expectedGroupId)    receiveAddPlayerToGroup_( __LINE__, sock, expectedPlayerId, expectedGroupId )
 
#define sendGroupDataChanged(sock, port, groupId, data, dataSize)    sendGroupDataChanged_( __LINE__, sock, port, groupId, data, dataSize )
 
#define checkPlayerList(dp, expectedPlayers, expectedPlayerCount)    checkPlayerList_( __LINE__, dp, expectedPlayers, expectedPlayerCount )
 
#define checkGroupPlayerList(dp, group, expectedPlayers, expectedPlayerCount)    checkGroupPlayerList_( __LINE__, dp, group, expectedPlayers, expectedPlayerCount )
 
#define checkGroupList(dp, expectedGroups, expectedGroupCount)    checkGroupList_( __LINE__, dp, expectedGroups, expectedGroupCount )
 
#define checkPlayerExists(dp, expectedDpid, expectedPlayerType, expectedShortName, expectedLongName, expectedFlags, expectedPlayerData, expectedPlayerDataSize)
 
#define check_Open(dp, dpsd, serverDpsd, idRequestExpected, forwardRequestExpected, listenPort, expectedPassword, idReplyHr, addForwardReplyHr, expectedHr)
 
#define joinSession(dp, dpsd, serverDpsd, sendSock, recvSock, udpPort)    joinSession_( __LINE__, dp, dpsd, serverDpsd, sendSock, recvSock, udpPort )
 
#define check_EnumSessions(dp, dpsd, flags, expectedHr, expectedSessionCount, timeoutExpected, requestExpected, expectedPassword, replyCount, ansi, hrTodo)
 
#define check_EnumSessions_async(dpsd, dp, ansi)   check_EnumSessions_async_( __LINE__, dpsd, dp, ansi )
 
#define N_SESSIONS   6
 
#define checkCreatePlayerOrGroupMessage(dp, expectedType, expectedDpid, expectedCurrentPlayers, expectedPlayerData, expectedPlayerDataSize, expectedShortName, expectedLongName, expectedParent, expectedFlags)
 
#define checkPlayerMessage(dp, expectedFromId, expectedData, expectedDataSize)    checkPlayerMessage_( __LINE__, dp, expectedFromId, expectedData, expectedDataSize )
 
#define checkNoMorePlayerMessages(dp)   checkNoMorePlayerMessages_( __LINE__, dp )
 
#define checkCreatePlayerOrGroupMessages(dp, expectedType, expectedDpid, expectedCurrentPlayers, expectedPlayerData, expectedPlayerDataSize, expectedShortName, expectedLongName, expectedParent, expectedFlags)
 
#define check_CreatePlayer(dp, dpid, name, flags, expectedHr, expectedDpid, recvSock, requestExpected, expectedFlags, expectedShortName, expectedShortNameA, expectedLongName, expectedLongNameA, expectedCurrentPlayers)
 
#define createPlayer(dp, inDpid, event, data, dataSize, flags, sendSock, recvSock)    createPlayer_( __LINE__, dp, inDpid, event, data, dataSize, flags, sendSock, recvSock )
 
#define checkAddPlayerToGroupMessage(dp, expectedGroupId, expectedPlayerId)    checkAddPlayerToGroupMessage_( __LINE__, dp, expectedGroupId, expectedPlayerId )
 
#define checkSetPlayerOrGroupDataMessage(dp, expectedPlayerType, expectedDpid, expectedData, expectedDataSize)    checkSetPlayerOrGroupDataMessage_( __LINE__, dp, expectedPlayerType, expectedDpid, expectedData, expectedDataSize )
 

Typedefs

typedef struct tagCallbackData CallbackData
 
typedef struct tagCallbackData * lpCallbackData
 

Enumerations

enum  firewall_op {
  APP_ADD , APP_REMOVE , APP_ADD , APP_REMOVE ,
  APP_ADD , APP_REMOVE
}
 

Functions

static HRESULT (WINAPI *pDirectPlayEnumerateA)(LPDPENUMDPCALLBACKA
 
static LPCSTR dwFlags2str (DWORD dwFlags, DWORD flagType)
 
static void checkFlags_ (unsigned line, DWORD expected, DWORD result, DWORD flags)
 
static const char * dbgStrAW (const void *str, BOOL ansi)
 
static int strcmpAW (const void *str0, const void *str1, BOOL ansi)
 
 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)
 
 DEFINE_GUID (GUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
 
 DEFINE_GUID (invalid_guid, 0x7b48b707, 0x0034, 0xc000, 0x02, 0x00, 0x00, 0x00, 0xec, 0xf6, 0x32, 0x00)
 
static LPSTR get_temp_buffer (void)
 
static LPCSTR Guid2str (const GUID *guid)
 
static LPCSTR dpResult2str (HRESULT hr)
 
static LPCSTR dpMsgType2str (DWORD dwType)
 
static char dpid2char (DPID *dpid, DWORD dpidSize, DPID idPlayer)
 
static void check_messages (IDirectPlay4 *pDP, DPID *dpid, DWORD dpidSize, lpCallbackData callbackData)
 
static DWORD CALLBACK enumSessionsProc (void *p)
 
static HANDLE enumSessionsAsync (IDirectPlay4 *dp, DPSESSIONDESC2 *dpsd, DWORD timeout, LPDPENUMSESSIONSCALLBACK2 callback, void *context, DWORD flags)
 
static HRESULT enumSessionsAsyncWait (EnumSessionsParam *param, DWORD timeout)
 
static DWORD CALLBACK openProc (void *p)
 
static OpenParam * openAsync (IDirectPlay4 *dp, DPSESSIONDESC2 *dpsd, DWORD flags)
 
static HRESULT openAsyncWait (OpenParam *param, DWORD timeout)
 
static DWORD CALLBACK createPlayerProc (void *p)
 
static CreatePlayerParam * createPlayerAsync (IDirectPlay4 *dp, DPID *dpid, DPNAME *name, HANDLE event, void *data, DWORD dataSize, DWORD flags)
 
static HRESULT createPlayerAsyncWait (CreatePlayerParam *param, DWORD timeout)
 
static SOCKET bindUdp_ (int line, unsigned short port)
 
static SOCKET listenTcp_ (int line, unsigned short port)
 
static SOCKET acceptTcp_ (int line, SOCKET listenSock)
 
static void checkNoMoreAccepts_ (int line, SOCKET listenSock)
 
static SOCKET connectTcp_ (int line, unsigned short port)
 
static SOCKET connectUdp_ (int line, unsigned short port)
 
static int receiveMessage_ (int line, SOCKET sock, void *buffer, int size)
 
static void checkNoMoreMessages_ (int line, SOCKET sock)
 
static unsigned short checkSpHeader_ (int line, SpHeader *header, DWORD expectedSize)
 
static void checkMessageHeader_ (int line, MessageHeader *header, WORD expectedCommand)
 
static void checkSpData_ (int line, SpData *spData, unsigned short *udpPort)
 
static void checkPackedPlayer_ (int line, PackedPlayer *player, DWORD expectedFlags, DPID expectedId, DWORD expectedShortNameLength, DWORD expectedLongNameLength, DWORD expectedPlayerDataSize, DPID expectedSystemPlayerId)
 
static void checkGameMessage_ (int line, GameMessage *message, DPID expectedFromId, DPID expectedToId)
 
static unsigned short receiveEnumSessionsRequest_ (int line, SOCKET sock, const GUID *expectedAppGuid, const WCHAR *expectedPassword, DWORD expectedFlags)
 
static void sendEnumSessionsReply_ (int line, SOCKET sock, unsigned short port, const DPSESSIONDESC2 *dpsd)
 
static unsigned short receiveRequestPlayerId_ (int line, SOCKET sock, DWORD expectedFlags)
 
static void sendRequestPlayerReply_ (int line, SOCKET sock, unsigned short port, DPID id, HRESULT result)
 
static unsigned short receiveAddForwardRequest_ (int line, SOCKET sock, DPID expectedPlayerId, const WCHAR *expectedPassword, DWORD expectedTickCount, unsigned short *udpPort)
 
static void sendSuperEnumPlayersReply_ (int line, SOCKET sock, unsigned short tcpPort, unsigned short udpPort, const DPSESSIONDESC2 *dpsd, const WCHAR *sessionName)
 
static void sendAddForwardReply_ (int line, SOCKET sock, unsigned short port, HRESULT result)
 
static void sendAddForward_ (int line, SOCKET sock, unsigned short port, unsigned short tcpPort, unsigned short udpPort)
 
static unsigned short receiveAddForwardAck_ (int line, SOCKET sock, DPID expectedPlayerId)
 
static unsigned short receiveCreatePlayer_ (int line, SOCKET sock, DPID expectedPlayerId, DWORD expectedFlags, const WCHAR *expectedShortName, const WCHAR *expectedLongName, void *expectedPlayerData, DWORD expectedPlayerDataSize)
 
static void sendCreatePlayer_ (int line, SOCKET sock, unsigned short tcpPort, unsigned short udpPort, const WCHAR *shortName, const WCHAR *longName, void *playerData, DWORD playerDataSize)
 
static unsigned short receiveGuaranteedGameMessage_ (int line, SOCKET sock, DPID expectedFromId, DPID expectedToId, void *expectedData, DWORD expectedDataSize)
 
static void receiveGameMessage_ (int line, SOCKET sock, DPID expectedFromId, DPID expectedToId, void *expectedData, DWORD expectedDataSize)
 
static void sendGuaranteedGameMessage_ (int line, SOCKET sock, unsigned short port, DPID fromId, DPID toId, void *data, DWORD dataSize)
 
static void sendGameMessage_ (int line, SOCKET sock, DPID fromId, DPID toId, void *data, DWORD dataSize)
 
static void sendPing_ (int line, SOCKET sock, unsigned short port, DPID fromId, DWORD tickCount)
 
static unsigned short receivePingReply_ (int line, SOCKET sock, DPID expectedFromId, DWORD expectedTickCount)
 
static unsigned short receiveAddPlayerToGroup_ (int line, SOCKET sock, DPID expectedPlayerId, DPID expectedGroupId)
 
static void sendGroupDataChanged_ (int line, SOCKET sock, unsigned short port, DPID groupId, void *data, DWORD dataSize)
 
static void init_TCPIP_provider (IDirectPlay4 *pDP, LPCSTR strIPAddressString, WORD port)
 
static BOOL CALLBACK EnumSessions_cb_join (LPCDPSESSIONDESC2 lpThisSD, LPDWORD lpdwTimeOut, DWORD dwFlags, LPVOID lpContext)
 
static void test_DirectPlayCreate (void)
 
static BOOL CALLBACK callback_providersA (GUID *guid, char *name, DWORD major, DWORD minor, void *arg)
 
static BOOL CALLBACK callback_providersW (GUID *guid, WCHAR *name, DWORD major, DWORD minor, void *arg)
 
static void test_EnumerateProviders (void)
 
static BOOL CALLBACK EnumAddress_cb2 (REFGUID guidDataType, DWORD dwDataSize, LPCVOID lpData, LPVOID lpContext)
 
static BOOL CALLBACK EnumConnections_cb (LPCGUID lpguidSP, LPVOID lpConnection, DWORD dwConnectionSize, LPCDPNAME lpName, DWORD dwFlags, LPVOID lpContext)
 
static void test_EnumConnections (void)
 
static BOOL CALLBACK EnumConnections_cb2 (LPCGUID lpguidSP, LPVOID lpConnection, DWORD dwConnectionSize, LPCDPNAME lpName, DWORD dwFlags, LPVOID lpContext)
 
static void test_InitializeConnection (void)
 
static void test_GetCaps (void)
 
static BOOL CALLBACK EnumAddressesCallback (REFGUID guidDataType, DWORD size, const void *data, void *context)
 
static void test_EnumAddresses (void)
 
static BOOL CALLBACK EnumAddressTypeCallback (REFGUID guidDataType, LPVOID lpContext, DWORD flags)
 
static void test_EnumAddressTypes (void)
 
static BOOL CALLBACK EnumSessions_cb2 (LPCDPSESSIONDESC2 lpThisSD, LPDWORD lpdwTimeOut, DWORD dwFlags, LPVOID lpContext)
 
static BOOL CALLBACK checkPlayerListCallback (DPID dpid, DWORD playerType, const DPNAME *name, DWORD flags, void *context)
 
static void checkPlayerList_ (int line, IDirectPlay4 *dp, ExpectedPlayer *expectedPlayers, int expectedPlayerCount)
 
static void checkGroupPlayerList_ (int line, DPID group, IDirectPlay4 *dp, ExpectedPlayer *expectedPlayers, int expectedPlayerCount)
 
static void checkGroupList_ (int line, IDirectPlay4 *dp, ExpectedPlayer *expectedGroups, int expectedGroupCount)
 
static void checkPlayerExists_ (int line, IDirectPlay4 *dp, DPID expectedDpid, DWORD expectedPlayerType, const char *expectedShortName, const char *expectedLongName, DWORD expectedFlags, BYTE *expectedPlayerData, DWORD expectedPlayerDataSize)
 
static void check_Open_ (int line, IDirectPlay4A *dp, DPSESSIONDESC2 *dpsd, const DPSESSIONDESC2 *serverDpsd, BOOL idRequestExpected, BOOL forwardRequestExpected, unsigned short listenPort, const WCHAR *expectedPassword, HRESULT idReplyHr, HRESULT addForwardReplyHr, HRESULT expectedHr)
 
static BOOL CALLBACK countSessionsCallback (const DPSESSIONDESC2 *thisSd, DWORD *timeout, DWORD flags, void *context)
 
static void test_Open (void)
 
static void test_interactive_Open (void)
 
static void joinSession_ (int line, IDirectPlay4 *dp, DPSESSIONDESC2 *dpsd, DPSESSIONDESC2 *serverDpsd, SOCKET *sendSock, SOCKET *recvSock, unsigned short *udpPort)
 
static void test_ADDFORWARD (void)
 
static BOOL CALLBACK EnumSessions_cb (LPCDPSESSIONDESC2 lpThisSD, LPDWORD lpdwTimeOut, DWORD dwFlags, LPVOID lpContext)
 
static IDirectPlay4 * create_session (DPSESSIONDESC2 *lpdpsd)
 
static BOOL CALLBACK checkSessionListCallback (const DPSESSIONDESC2 *thisSd, DWORD *timeout, DWORD flags, void *context)
 
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 ansi, BOOL hrTodo)
 
static void check_EnumSessions_async_ (int line, DPSESSIONDESC2 *dpsd, IDirectPlay4 *dp, BOOL ansi)
 
static void test_EnumSessions (void)
 
static void test_interactive_EnumSessions (void)
 
static void test_SessionDesc (void)
 
static DPID checkCreatePlayerOrGroupMessage_ (int line, IDirectPlay4 *dp, DWORD expectedType, DPID expectedDpid, DWORD expectedCurrentPlayers, void *expectedPlayerData, DWORD expectedPlayerDataSize, const char *expectedShortName, const char *expectedLongName, DPID expectedParent, DWORD expectedFlags)
 
static DPID checkPlayerMessage_ (int line, IDirectPlay4 *dp, DPID expectedFromId, void *expectedData, DWORD expectedDataSize)
 
static void checkNoMorePlayerMessages_ (int line, IDirectPlay4 *dp)
 
static BOOL CALLBACK getPlayerIdsCallback (DPID dpid, DWORD playerType, const DPNAME *name, DWORD flags, void *context)
 
static void checkCreatePlayerOrGroupMessages_ (int line, IDirectPlay4 *dp, DWORD expectedType, DPID expectedDpid, DWORD expectedCurrentPlayers, void *expectedPlayerData, DWORD expectedPlayerDataSize, const char *expectedShortName, const char *expectedLongName, DPID expectedParent, DWORD expectedFlags)
 
static void check_CreatePlayer_ (int line, IDirectPlay4 *dp, DPID *dpid, DPNAME *name, DWORD flags, HRESULT expectedHr, DPID expectedDpid, SOCKET recvSock, BOOL requestExpected, DWORD expectedFlags, const WCHAR *expectedShortName, const char *expectedShortNameA, const WCHAR *expectedLongName, const char *expectedLongNameA, DWORD expectedCurrentPlayers)
 
static void test_CreatePlayer (void)
 
static void test_interactive_CreatePlayer (void)
 
static void createPlayer_ (int line, IDirectPlay4 *dp, DPID inDpid, HANDLE event, void *data, DWORD dataSize, DWORD flags, SOCKET sendSock, SOCKET recvSock)
 
static void test_CREATEPLAYER (void)
 
static void test_GetPlayerCaps (void)
 
static void test_PlayerData (void)
 
static void test_PlayerName (void)
 
static BOOL CALLBACK EnumSessions_cb_join_secure (LPCDPSESSIONDESC2 lpThisSD, LPDWORD lpdwTimeOut, DWORD dwFlags, LPVOID lpContext)
 
static void test_GetPlayerAccount (void)
 
static BOOL CALLBACK EnumAddress_cb (REFGUID guidDataType, DWORD dwDataSize, LPCVOID lpData, LPVOID lpContext)
 
static void test_GetPlayerAddress (void)
 
static void test_GetPlayerFlags (void)
 
static void test_CreateGroup (void)
 
static void test_GroupOwner (void)
 
static BOOL CALLBACK EnumPlayers_cb (DPID dpId, DWORD dwPlayerType, LPCDPNAME lpName, DWORD dwFlags, LPVOID lpContext)
 
static BOOL CALLBACK EnumSessions_cb_EnumPlayers (LPCDPSESSIONDESC2 lpThisSD, LPDWORD lpdwTimeOut, DWORD dwFlags, LPVOID lpContext)
 
static void test_EnumPlayers (void)
 
static BOOL CALLBACK EnumGroups_cb (DPID dpId, DWORD dwPlayerType, LPCDPNAME lpName, DWORD dwFlags, LPVOID lpContext)
 
static BOOL CALLBACK EnumSessions_cb_EnumGroups (LPCDPSESSIONDESC2 lpThisSD, LPDWORD lpdwTimeOut, DWORD dwFlags, LPVOID lpContext)
 
static void test_EnumGroups (void)
 
static void test_EnumGroupsInGroup (void)
 
static void test_groups_p2p (void)
 
static void test_groups_cs (void)
 
static void test_Send (void)
 
static void test_interactive_Send (void)
 
static void test_Receive (void)
 
static void test_interactive_Receive (void)
 
static void test_PING (void)
 
static DPID checkAddPlayerToGroupMessage_ (int line, IDirectPlay4 *dp, DPID expectedGroupId, DPID expectedPlayerId)
 
static void test_AddPlayerToGroup (void)
 
static DPID checkSetPlayerOrGroupDataMessage_ (int line, IDirectPlay4 *dp, DWORD expectedPlayerType, DPID expectedDpid, void *expectedData, DWORD expectedDataSize)
 
static void test_GROUPDATACHANGED (void)
 
static void test_GetMessageCount (void)
 
static void test_GetMessageQueue (void)
 
static void test_interactive_GetMessageQueue (void)
 
static void test_remote_data_replication (void)
 
static void test_host_migration (void)
 
static void test_COM (void)
 
static void test_COM_dplobby (void)
 
static BOOL is_process_elevated (void)
 
static BOOL is_firewall_enabled (void)
 
static HRESULT set_firewall (enum firewall_op op)
 
static BOOL is_stub_dll (const char *filename)
 
 START_TEST (dplayx)
 

Variables

static void *static void *static LPDIRECTPLAY * lplpDP
 
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
 
static int enum_addresses_cb_count = 0
 
static int enum_address_cb_count = 0
 

Macro Definition Documentation

◆ acceptTcp

#define acceptTcp (   listenSock)    acceptTcp_( __LINE__, listenSock )

Definition at line 1074 of file dplayx.c.

◆ AW

#define AW (   str,
  ansi 
)    ((ansi) ? (const void *) str : (const void *) L##str)

Definition at line 78 of file dplayx.c.

◆ bindUdp

#define bindUdp (   port)    bindUdp_( __LINE__, port )

Definition at line 1023 of file dplayx.c.

◆ check

#define check (   expected,
  result 
)
Value:
ok( (expected) == (result), \
"expected=%d got=%d\n", \
(int)(expected), (int)(result) );
#define ok(value,...)
Definition: atltest.h:57
GLuint64EXT * result
Definition: glext.h:11304
BOOL expected
Definition: store.c:2000

Definition at line 43 of file dplayx.c.

◆ check_CreatePlayer

#define check_CreatePlayer (   dp,
  dpid,
  name,
  flags,
  expectedHr,
  expectedDpid,
  recvSock,
  requestExpected,
  expectedFlags,
  expectedShortName,
  expectedShortNameA,
  expectedLongName,
  expectedLongNameA,
  expectedCurrentPlayers 
)
Value:
check_CreatePlayer_( __LINE__, dp, dpid, name, flags, expectedHr, expectedDpid, recvSock, requestExpected, \
expectedFlags, expectedShortName, expectedShortNameA, expectedLongName, expectedLongNameA, \
expectedCurrentPlayers )
static void check_CreatePlayer_(int line, IDirectPlay4 *dp, DPID *dpid, DPNAME *name, DWORD flags, HRESULT expectedHr, DPID expectedDpid, SOCKET recvSock, BOOL requestExpected, DWORD expectedFlags, const WCHAR *expectedShortName, const char *expectedShortNameA, const WCHAR *expectedLongName, const char *expectedLongNameA, DWORD expectedCurrentPlayers)
Definition: dplayx.c:4887
GLbitfield flags
Definition: glext.h:7161
Definition: name.c:39

Definition at line 4881 of file dplayx.c.

◆ check_EnumSessions

#define check_EnumSessions (   dp,
  dpsd,
  flags,
  expectedHr,
  expectedSessionCount,
  timeoutExpected,
  requestExpected,
  expectedPassword,
  replyCount,
  ansi,
  hrTodo 
)
Value:
check_EnumSessions_( __LINE__, dp, dpsd, flags, expectedHr, expectedSessionCount, timeoutExpected, \
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 ansi, BOOL hrTodo)
Definition: dplayx.c:3816
static UINT WPARAM LPARAM BOOL ansi
Definition: misc.c:135

Definition at line 3812 of file dplayx.c.

◆ check_EnumSessions_async

#define check_EnumSessions_async (   dpsd,
  dp,
  ansi 
)    check_EnumSessions_async_( __LINE__, dpsd, dp, ansi )

Definition at line 3920 of file dplayx.c.

◆ check_Open

#define check_Open (   dp,
  dpsd,
  serverDpsd,
  idRequestExpected,
  forwardRequestExpected,
  listenPort,
  expectedPassword,
  idReplyHr,
  addForwardReplyHr,
  expectedHr 
)
Value:
check_Open_( __LINE__, dp, dpsd, serverDpsd, idRequestExpected, forwardRequestExpected, listenPort, expectedPassword, \
idReplyHr, addForwardReplyHr, expectedHr )
static void check_Open_(int line, IDirectPlay4A *dp, DPSESSIONDESC2 *dpsd, const DPSESSIONDESC2 *serverDpsd, BOOL idRequestExpected, BOOL forwardRequestExpected, unsigned short listenPort, const WCHAR *expectedPassword, HRESULT idReplyHr, HRESULT addForwardReplyHr, HRESULT expectedHr)
Definition: dplayx.c:3156

Definition at line 3152 of file dplayx.c.

◆ checkAddPlayerToGroupMessage

#define checkAddPlayerToGroupMessage (   dp,
  expectedGroupId,
  expectedPlayerId 
)     checkAddPlayerToGroupMessage_( __LINE__, dp, expectedGroupId, expectedPlayerId )

Definition at line 9141 of file dplayx.c.

◆ checkConv

#define checkConv (   expected,
  result,
  function 
)
Value:
ok( (expected) == (result), \
"expected=0x%08x(%s) got=0x%08lx(%s)\n", \
expected, function(expected), \
result, function(result) );

Definition at line 72 of file dplayx.c.

◆ checkCreatePlayerOrGroupMessage

#define checkCreatePlayerOrGroupMessage (   dp,
  expectedType,
  expectedDpid,
  expectedCurrentPlayers,
  expectedPlayerData,
  expectedPlayerDataSize,
  expectedShortName,
  expectedLongName,
  expectedParent,
  expectedFlags 
)
Value:
checkCreatePlayerOrGroupMessage_( __LINE__, dp, expectedType, expectedDpid, expectedCurrentPlayers, \
expectedPlayerData, expectedPlayerDataSize, expectedShortName, \
expectedLongName, expectedParent, expectedFlags )
static DPID checkCreatePlayerOrGroupMessage_(int line, IDirectPlay4 *dp, DWORD expectedType, DPID expectedDpid, DWORD expectedCurrentPlayers, void *expectedPlayerData, DWORD expectedPlayerDataSize, const char *expectedShortName, const char *expectedLongName, DPID expectedParent, DWORD expectedFlags)
Definition: dplayx.c:4714

Definition at line 4708 of file dplayx.c.

◆ checkCreatePlayerOrGroupMessages

#define checkCreatePlayerOrGroupMessages (   dp,
  expectedType,
  expectedDpid,
  expectedCurrentPlayers,
  expectedPlayerData,
  expectedPlayerDataSize,
  expectedShortName,
  expectedLongName,
  expectedParent,
  expectedFlags 
)
Value:
checkCreatePlayerOrGroupMessages_( __LINE__, dp, expectedType, expectedDpid, expectedCurrentPlayers, \
expectedPlayerData, expectedPlayerDataSize, expectedShortName, \
expectedLongName, expectedParent, expectedFlags )
static void checkCreatePlayerOrGroupMessages_(int line, IDirectPlay4 *dp, DWORD expectedType, DPID expectedDpid, DWORD expectedCurrentPlayers, void *expectedPlayerData, DWORD expectedPlayerDataSize, const char *expectedShortName, const char *expectedLongName, DPID expectedParent, DWORD expectedFlags)
Definition: dplayx.c:4850

Definition at line 4844 of file dplayx.c.

◆ checkFlags

#define checkFlags (   expected,
  result,
  flags 
)    checkFlags_(__LINE__, expected, result, flags)

Definition at line 60 of file dplayx.c.

◆ checkGameMessage

#define checkGameMessage (   message,
  expectedFromId,
  expectedToId 
)     checkGameMessage_( __LINE__, message, expectedFromId, expectedToId )

Definition at line 1254 of file dplayx.c.

◆ checkGroupList

#define checkGroupList (   dp,
  expectedGroups,
  expectedGroupCount 
)     checkGroupList_( __LINE__, dp, expectedGroups, expectedGroupCount )

Definition at line 3093 of file dplayx.c.

◆ checkGroupPlayerList

#define checkGroupPlayerList (   dp,
  group,
  expectedPlayers,
  expectedPlayerCount 
)     checkGroupPlayerList_( __LINE__, dp, group, expectedPlayers, expectedPlayerCount )

Definition at line 3070 of file dplayx.c.

◆ checkGuid

#define checkGuid (   expected,
  result 
)
Value:
"expected=%s got=%s\n", \
static LPCSTR Guid2str(const GUID *guid)
Definition: dplayx.c:126
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147

Definition at line 68 of file dplayx.c.

◆ checkHR

#define checkHR (   expected,
  result 
)
Value:
ok( (expected) == (result), \
"expected=%s got=%s\n", \
static LPCSTR dpResult2str(HRESULT hr)
Definition: dplayx.c:167

Definition at line 51 of file dplayx.c.

◆ checkLP

#define checkLP (   expected,
  result 
)
Value:
ok( (expected) == (result), \
"expected=%p got=%p\n", \

Definition at line 47 of file dplayx.c.

◆ checkMessageHeader

#define checkMessageHeader (   header,
  expectedCommand 
)    checkMessageHeader_( __LINE__, header, expectedCommand )

Definition at line 1201 of file dplayx.c.

◆ checkNoMoreAccepts

#define checkNoMoreAccepts (   listenSock)    checkNoMoreAccepts_( __LINE__, listenSock )

Definition at line 1097 of file dplayx.c.

◆ checkNoMoreMessages

#define checkNoMoreMessages (   sock)    checkNoMoreMessages_( __LINE__, sock )

Definition at line 1171 of file dplayx.c.

◆ checkNoMorePlayerMessages

#define checkNoMorePlayerMessages (   dp)    checkNoMorePlayerMessages_( __LINE__, dp )

Definition at line 4811 of file dplayx.c.

◆ checkPackedPlayer

#define checkPackedPlayer (   player,
  expectedFlags,
  expectedId,
  expectedShortNameLength,
  expectedLongNameLength,
  expectedPlayerDataSize,
  expectedSystemPlayerId 
)
Value:
checkPackedPlayer_( __LINE__, player, expectedFlags, expectedId, expectedShortNameLength, expectedLongNameLength, \
expectedPlayerDataSize, expectedSystemPlayerId )
static void checkPackedPlayer_(int line, PackedPlayer *player, DWORD expectedFlags, DPID expectedId, DWORD expectedShortNameLength, DWORD expectedLongNameLength, DWORD expectedPlayerDataSize, DPID expectedSystemPlayerId)
Definition: dplayx.c:1230

Definition at line 1226 of file dplayx.c.

◆ checkPlayerExists

#define checkPlayerExists (   dp,
  expectedDpid,
  expectedPlayerType,
  expectedShortName,
  expectedLongName,
  expectedFlags,
  expectedPlayerData,
  expectedPlayerDataSize 
)
Value:
checkPlayerExists_( __LINE__, dp, expectedDpid, expectedPlayerType, expectedShortName, expectedLongName, \
expectedFlags, expectedPlayerData, expectedPlayerDataSize )
static void checkPlayerExists_(int line, IDirectPlay4 *dp, DPID expectedDpid, DWORD expectedPlayerType, const char *expectedShortName, const char *expectedLongName, DWORD expectedFlags, BYTE *expectedPlayerData, DWORD expectedPlayerDataSize)
Definition: dplayx.c:3119

Definition at line 3115 of file dplayx.c.

◆ checkPlayerList

#define checkPlayerList (   dp,
  expectedPlayers,
  expectedPlayerCount 
)     checkPlayerList_( __LINE__, dp, expectedPlayers, expectedPlayerCount )

Definition at line 3048 of file dplayx.c.

◆ checkPlayerMessage

#define checkPlayerMessage (   dp,
  expectedFromId,
  expectedData,
  expectedDataSize 
)     checkPlayerMessage_( __LINE__, dp, expectedFromId, expectedData, expectedDataSize )

Definition at line 4787 of file dplayx.c.

◆ checkSetPlayerOrGroupDataMessage

#define checkSetPlayerOrGroupDataMessage (   dp,
  expectedPlayerType,
  expectedDpid,
  expectedData,
  expectedDataSize 
)     checkSetPlayerOrGroupDataMessage_( __LINE__, dp, expectedPlayerType, expectedDpid, expectedData, expectedDataSize )

Definition at line 9223 of file dplayx.c.

◆ checkSpData

#define checkSpData (   spData)    checkSpData_( __LINE__, spData, udpPort )

Definition at line 1208 of file dplayx.c.

◆ checkSpHeader

#define checkSpHeader (   header,
  expectedSize 
)    checkSpHeader_( __LINE__, header, expectedSize )

Definition at line 1189 of file dplayx.c.

◆ checkStr

#define checkStr (   expected,
  result 
)
Value:
ok( (result != NULL) && (!strcmp(expected, result)), \
"expected=%s got=%s\n", \
#define NULL
Definition: types.h:112
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3324

Definition at line 55 of file dplayx.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 20 of file dplayx.c.

◆ connectTcp

#define connectTcp (   port)    connectTcp_( __LINE__, port )

Definition at line 1112 of file dplayx.c.

◆ connectUdp

#define connectUdp (   port)    connectUdp_( __LINE__, port)

Definition at line 1131 of file dplayx.c.

◆ createPlayer

#define createPlayer (   dp,
  inDpid,
  event,
  data,
  dataSize,
  flags,
  sendSock,
  recvSock 
)     createPlayer_( __LINE__, dp, inDpid, event, data, dataSize, flags, sendSock, recvSock )

Definition at line 5198 of file dplayx.c.

◆ FLAGS_DPCAPS

#define FLAGS_DPCAPS   (1<<17)

◆ FLAGS_DPCONNECT

#define FLAGS_DPCONNECT   (1<<12)

◆ FLAGS_DPCONNECTION

#define FLAGS_DPCONNECTION   (1<<0)

◆ FLAGS_DPENUMGROUPS

#define FLAGS_DPENUMGROUPS   (1<<2)

◆ FLAGS_DPENUMPLAYERS

#define FLAGS_DPENUMPLAYERS   (1<<1)

◆ FLAGS_DPENUMSESSIONS

#define FLAGS_DPENUMSESSIONS   (1<<5)

◆ FLAGS_DPESC

#define FLAGS_DPESC   (1<<16)

◆ FLAGS_DPGET

#define FLAGS_DPGET   (1<<7)

◆ FLAGS_DPGETCAPS

#define FLAGS_DPGETCAPS   (1<<6)

◆ FLAGS_DPGROUP

#define FLAGS_DPGROUP   (1<<4)

◆ FLAGS_DPLCONNECTION

#define FLAGS_DPLCONNECTION   (1<<15)

◆ FLAGS_DPMESSAGEQUEUE

#define FLAGS_DPMESSAGEQUEUE   (1<<11)

◆ FLAGS_DPOPEN

#define FLAGS_DPOPEN   (1<<13)

◆ FLAGS_DPPLAYER

#define FLAGS_DPPLAYER   (1<<3)

◆ FLAGS_DPRECEIVE

#define FLAGS_DPRECEIVE   (1<<8)

◆ FLAGS_DPSEND

#define FLAGS_DPSEND   (1<<9)

◆ FLAGS_DPSESSION

#define FLAGS_DPSESSION   (1<<14)

◆ FLAGS_DPSET

#define FLAGS_DPSET   (1<<10)

◆ INITGUID

#define INITGUID

Definition at line 23 of file dplayx.c.

◆ joinSession

#define joinSession (   dp,
  dpsd,
  serverDpsd,
  sendSock,
  recvSock,
  udpPort 
)     joinSession_( __LINE__, dp, dpsd, serverDpsd, sendSock, recvSock, udpPort )

Definition at line 3570 of file dplayx.c.

◆ listenTcp

#define listenTcp (   port)    listenTcp_( __LINE__, port )

Definition at line 1046 of file dplayx.c.

◆ LONG_NAME

#define LONG_NAME   L"long name"

◆ N_SESSIONS

#define N_SESSIONS   6

◆ receiveAddForwardAck

#define receiveAddForwardAck (   sock,
  expectedPlayerId 
)    receiveAddForwardAck_( __LINE__, sock, expectedPlayerId )

Definition at line 1811 of file dplayx.c.

◆ receiveAddForwardRequest

#define receiveAddForwardRequest (   sock,
  expectedPlayerId,
  expectedPassword,
  expectedTickCount,
  udpPort 
)     receiveAddForwardRequest_( __LINE__, sock, expectedPlayerId, expectedPassword, expectedTickCount, udpPort )

Definition at line 1419 of file dplayx.c.

◆ receiveAddPlayerToGroup

#define receiveAddPlayerToGroup (   sock,
  expectedPlayerId,
  expectedGroupId 
)     receiveAddPlayerToGroup_( __LINE__, sock, expectedPlayerId, expectedGroupId )

Definition at line 2211 of file dplayx.c.

◆ receiveCreatePlayer

#define receiveCreatePlayer (   sock,
  expectedPlayerId,
  expectedFlags,
  expectedShortName,
  expectedLongName,
  expectedPlayerData,
  expectedPlayerDataSize 
)
Value:
receiveCreatePlayer_( __LINE__, sock, expectedPlayerId, expectedFlags, expectedShortName, expectedLongName, \
expectedPlayerData, expectedPlayerDataSize )
static unsigned short receiveCreatePlayer_(int line, SOCKET sock, DPID expectedPlayerId, DWORD expectedFlags, const WCHAR *expectedShortName, const WCHAR *expectedLongName, void *expectedPlayerData, DWORD expectedPlayerDataSize)
Definition: dplayx.c:1837
Definition: tcpcore.h:1455

Definition at line 1833 of file dplayx.c.

◆ receiveEnumSessionsRequest

#define receiveEnumSessionsRequest (   sock,
  expectedAppGuid,
  expectedPassword,
  expectedFlags 
)     receiveEnumSessionsRequest_( __LINE__, sock, expectedAppGuid, expectedPassword, expectedFlags )

Definition at line 1262 of file dplayx.c.

◆ receiveGameMessage

#define receiveGameMessage (   sock,
  expectedFromId,
  expectedToId,
  expectedData,
  expectedDataSize 
)     receiveGameMessage_( __LINE__, sock, expectedFromId, expectedToId, expectedData, expectedDataSize )

Definition at line 2057 of file dplayx.c.

◆ receiveGuaranteedGameMessage

#define receiveGuaranteedGameMessage (   sock,
  expectedFromId,
  expectedToId,
  expectedData,
  expectedDataSize 
)     receiveGuaranteedGameMessage_( __LINE__, sock, expectedFromId, expectedToId, expectedData, expectedDataSize )

Definition at line 2029 of file dplayx.c.

◆ receiveMessage

#define receiveMessage (   sock,
  buffer,
  size 
)    receiveMessage_( __LINE__, sock, buffer, size )

Definition at line 1150 of file dplayx.c.

◆ receivePingReply

#define receivePingReply (   sock,
  expectedFromId,
  expectedTickCount 
)     receivePingReply_( __LINE__, sock, expectedFromId, expectedTickCount )

Definition at line 2185 of file dplayx.c.

◆ receiveRequestPlayerId

#define receiveRequestPlayerId (   sock,
  expectedFlags 
)    receiveRequestPlayerId_( __LINE__, sock, expectedFlags )

Definition at line 1358 of file dplayx.c.

◆ sendAddForward

#define sendAddForward (   sock,
  port,
  tcpPort,
  udpPort 
)    sendAddForward_( __LINE__, sock, port, tcpPort, udpPort )

Definition at line 1742 of file dplayx.c.

◆ sendAddForwardReply

#define sendAddForwardReply (   sock,
  port,
  result 
)    sendAddForwardReply_( __LINE__, sock, port, result )

Definition at line 1705 of file dplayx.c.

◆ sendCreatePlayer

#define sendCreatePlayer (   sock,
  tcpPort,
  udpPort,
  shortName,
  longName,
  playerData,
  playerDataSize 
)     sendCreatePlayer_( __LINE__, sock, tcpPort, udpPort, shortName, longName, playerData, playerDataSize )

Definition at line 1925 of file dplayx.c.

◆ sendEnumSessionsReply

#define sendEnumSessionsReply (   sock,
  port,
  dpsd 
)    sendEnumSessionsReply_( __LINE__, sock, port, dpsd )

Definition at line 1309 of file dplayx.c.

◆ sendGameMessage

#define sendGameMessage (   sock,
  fromId,
  toId,
  data,
  dataSize 
)     sendGameMessage_( __LINE__, sock, fromId, toId, data, dataSize )

Definition at line 2117 of file dplayx.c.

◆ sendGroupDataChanged

#define sendGroupDataChanged (   sock,
  port,
  groupId,
  data,
  dataSize 
)     sendGroupDataChanged_( __LINE__, sock, port, groupId, data, dataSize )

Definition at line 2242 of file dplayx.c.

◆ sendGuaranteedGameMessage

#define sendGuaranteedGameMessage (   sock,
  port,
  fromId,
  toId,
  data,
  dataSize 
)     sendGuaranteedGameMessage_( __LINE__, sock, port, fromId, toId, data, dataSize )

Definition at line 2080 of file dplayx.c.

◆ sendPing

#define sendPing (   sock,
  port,
  fromId,
  tickCount 
)     sendPing_( __LINE__, sock, port, fromId, tickCount )

Definition at line 2146 of file dplayx.c.

◆ sendRequestPlayerReply

#define sendRequestPlayerReply (   sock,
  port,
  id,
  result 
)    sendRequestPlayerReply_( __LINE__, sock, port, id, result )

Definition at line 1381 of file dplayx.c.

◆ sendSuperEnumPlayersReply

#define sendSuperEnumPlayersReply (   sock,
  tcpPort,
  udpPort,
  dpsd,
  sessionName 
)     sendSuperEnumPlayersReply_( __LINE__, sock, tcpPort, udpPort, dpsd, sessionName )

Definition at line 1473 of file dplayx.c.

◆ SHORT_NAME

#define SHORT_NAME   L"short name"

Typedef Documentation

◆ CallbackData

◆ lpCallbackData

Enumeration Type Documentation

◆ firewall_op

Enumerator
APP_ADD 
APP_REMOVE 
APP_ADD 
APP_REMOVE 
APP_ADD 
APP_REMOVE 

Definition at line 10552 of file dplayx.c.

10553{
10554 APP_ADD,
10556};
@ APP_REMOVE
Definition: dplayx.c:10555
@ APP_ADD
Definition: dplayx.c:10554

Function Documentation

◆ acceptTcp_()

static SOCKET acceptTcp_ ( int  line,
SOCKET  listenSock 
)
static

Definition at line 1075 of file dplayx.c.

1076{
1077 struct timeval timeout;
1079 int addrSize;
1080 int wsResult;
1081 SOCKET sock;
1082 fd_set fds;
1083
1084 FD_ZERO( &fds );
1085 FD_SET( listenSock, &fds );
1086 timeout.tv_sec = 2;
1087 timeout.tv_usec = 0;
1088 wsResult = select( listenSock + 1, &fds, NULL, &fds, &timeout );
1089 ok_( __FILE__, line )( wsResult != SOCKET_ERROR, "select() returned %d.\n", wsResult );
1090
1091 addrSize = sizeof( addr );
1092 sock = accept( listenSock, (SOCKADDR *) &addr, &addrSize );
1093
1094 return sock;
1095}
#define ok_(x1, x2)
Definition: atltest.h:61
INT WSAAPI select(IN INT s, IN OUT LPFD_SET readfds, IN OUT LPFD_SET writefds, IN OUT LPFD_SET exceptfds, IN CONST struct timeval *timeout)
Definition: select.c:41
GLenum const GLvoid * addr
Definition: glext.h:9621
SOCKET WSAAPI accept(IN SOCKET s, OUT LPSOCKADDR addr, OUT INT FAR *addrlen)
Definition: socklife.c:23
Definition: winsock.h:60
Definition: parser.c:49
Definition: dhcpd.h:248
#define FD_ZERO(set)
Definition: winsock.h:90
UINT_PTR SOCKET
Definition: winsock.h:41
#define SOCKET_ERROR
Definition: winsock.h:327
#define FD_SET(fd, set)
Definition: winsock.h:83

Referenced by check_Open_(), and joinSession_().

◆ bindUdp_()

static SOCKET bindUdp_ ( int  line,
unsigned short  port 
)
static

Definition at line 1024 of file dplayx.c.

1025{
1026 u_long nbio = 1;
1028 int wsResult;
1029 SOCKET sock;
1030
1032 ok_( __FILE__, line) ( sock != INVALID_SOCKET, "got UDP socket %#Ix.\n", sock );
1033
1034 addr.sin_family = AF_INET;
1035 addr.sin_port = htons( port );
1036 addr.sin_addr.s_addr = htonl( INADDR_ANY );
1037 wsResult = bind( sock, (SOCKADDR *) &addr, sizeof( addr ) );
1038 ok_( __FILE__, line)( !wsResult, "bind() returned %d.\n", wsResult );
1039
1040 wsResult = ioctlsocket( sock, FIONBIO, &nbio );
1041 ok_( __FILE__, line)( !wsResult, "ioctlsocket() returned %d.\n", wsResult );
1042
1043 return sock;
1044}
__msvcrt_ulong u_long
Definition: types.h:53
USHORT port
Definition: uri.c:210
#define IPPROTO_UDP
Definition: ip.h:198
#define AF_INET
Definition: tcpip.h:117
#define INADDR_ANY
Definition: inet.h:80
#define htons(x)
Definition: module.h:215
#define htonl(x)
Definition: module.h:214
#define ioctlsocket
Definition: ncftp.h:481
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36
#define INVALID_SOCKET
Definition: winsock.h:326
#define SOCK_DGRAM
Definition: winsock.h:330
#define FIONBIO
Definition: winsock.h:143

Referenced by check_EnumSessions_(), check_EnumSessions_async_(), and joinSession_().

◆ callback_providersA()

static BOOL CALLBACK callback_providersA ( GUID *  guid,
char *  name,
DWORD  major,
DWORD  minor,
void *  arg 
)
static

Definition at line 2398 of file dplayx.c.

2399{
2400 struct provider_data *prov = arg;
2401
2402 if (!prov) return TRUE;
2403
2404 if (prov->call_count < ARRAY_SIZE(prov->guid_data))
2405 {
2406 prov->guid_ptr[prov->call_count] = guid;
2407 prov->guid_data[prov->call_count] = *guid;
2408
2409 prov->call_count++;
2410 }
2411
2412 if (prov->ret_value) /* Only trace when looping all providers */
2413 trace("Provider #%d '%s' (%ld.%ld)\n", prov->call_count, name, major, minor);
2414 return prov->ret_value;
2415}
#define trace
Definition: atltest.h:70
#define ARRAY_SIZE(A)
Definition: main.h:20
#define TRUE
Definition: types.h:120
GUID guid
Definition: version.c:147
#define minor(rdev)
Definition: propsheet.cpp:929
#define major(rdev)
Definition: propsheet.cpp:928
int call_count
Definition: dplayx.c:108
GUID * guid_ptr[10]
Definition: dplayx.c:109
GUID guid_data[10]
Definition: dplayx.c:110
BOOL ret_value
Definition: dplayx.c:111
void * arg
Definition: msvc.h:10

Referenced by test_EnumerateProviders().

◆ callback_providersW()

static BOOL CALLBACK callback_providersW ( GUID *  guid,
WCHAR *  name,
DWORD  major,
DWORD  minor,
void *  arg 
)
static

Definition at line 2417 of file dplayx.c.

2418{
2419 struct provider_data *prov = arg;
2420
2421 if (!prov) return TRUE;
2422
2423 if (prov->call_count < ARRAY_SIZE(prov->guid_data))
2424 {
2425 prov->guid_ptr[prov->call_count] = guid;
2426 prov->guid_data[prov->call_count] = *guid;
2427
2428 prov->call_count++;
2429 }
2430
2431 return prov->ret_value;
2432}

Referenced by test_EnumerateProviders().

◆ check_CreatePlayer_()

static void check_CreatePlayer_ ( int  line,
IDirectPlay4 *  dp,
DPID *  dpid,
DPNAME *  name,
DWORD  flags,
HRESULT  expectedHr,
DPID  expectedDpid,
SOCKET  recvSock,
BOOL  requestExpected,
DWORD  expectedFlags,
const WCHAR *  expectedShortName,
const char *  expectedShortNameA,
const WCHAR *  expectedLongName,
const char *  expectedLongNameA,
DWORD  expectedCurrentPlayers 
)
static

Definition at line 4887 of file dplayx.c.

4892{
4893 BYTE playerData[] = { 1, 2, 3, 4, 5, 6, 7, 8, };
4895 SOCKET sendSock;
4896 HRESULT hr;
4897
4898 param = createPlayerAsync( dp, dpid, name, NULL, playerData, sizeof( playerData ), flags );
4899
4900 if ( requestExpected )
4901 {
4902 unsigned short port;
4903
4904 port = receiveRequestPlayerId_( line, recvSock, expectedFlags );
4905
4906 sendSock = connectTcp_( line, port );
4907
4908 sendRequestPlayerReply_( line, sendSock, 2349, expectedDpid, DP_OK );
4909 receiveCreatePlayer_( line, recvSock, expectedDpid, expectedFlags, expectedShortName, expectedLongName,
4910 playerData, sizeof( playerData ) );
4911
4912 hr = createPlayerAsyncWait( param, 2000 );
4913 ok_( __FILE__, line )( hr == expectedHr, "CreatePlayer() returned %#lx.\n", hr );
4914 if ( dpid )
4915 ok_( __FILE__, line )( *dpid == expectedDpid, "got dpid %#lx.\n", *dpid );
4916
4917 checkPlayerExists_( line, dp, expectedDpid, DPPLAYERTYPE_PLAYER, expectedShortNameA, expectedLongNameA,
4918 expectedFlags, playerData, sizeof( playerData ) );
4919
4920 if ( hr == DP_OK )
4921 checkCreatePlayerOrGroupMessages_( line, dp, DPPLAYERTYPE_PLAYER, expectedDpid, expectedCurrentPlayers,
4922 playerData, sizeof( playerData ), expectedShortNameA, expectedLongNameA,
4923 0, expectedFlags );
4924
4926
4927 closesocket( sendSock );
4928 }
4929 else
4930 {
4931 hr = createPlayerAsyncWait( param, 2000 );
4932 ok_( __FILE__, line )( hr == expectedHr, "CreatePlayer() returned %#lx.\n", hr );
4933 if ( dpid )
4934 ok_( __FILE__, line )( *dpid == expectedDpid, "got dpid %#lx.\n", *dpid );
4935 }
4936
4937 if ( recvSock != INVALID_SOCKET )
4938 checkNoMoreMessages_( line, recvSock );
4939}
HRESULT hr
Definition: delayimp.cpp:582
#define DPPLAYERTYPE_PLAYER
Definition: dplay.h:1135
#define DP_OK
Definition: dplay.h:88
static HRESULT createPlayerAsyncWait(CreatePlayerParam *param, DWORD timeout)
Definition: dplayx.c:835
static void checkNoMorePlayerMessages_(int line, IDirectPlay4 *dp)
Definition: dplayx.c:4812
static void sendRequestPlayerReply_(int line, SOCKET sock, unsigned short port, DPID id, HRESULT result)
Definition: dplayx.c:1382
static SOCKET connectTcp_(int line, unsigned short port)
Definition: dplayx.c:1113
static CreatePlayerParam * createPlayerAsync(IDirectPlay4 *dp, DPID *dpid, DPNAME *name, HANDLE event, void *data, DWORD dataSize, DWORD flags)
Definition: dplayx.c:815
static unsigned short receiveRequestPlayerId_(int line, SOCKET sock, DWORD expectedFlags)
Definition: dplayx.c:1359
static void checkNoMoreMessages_(int line, SOCKET sock)
Definition: dplayx.c:1172
GLfloat param
Definition: glext.h:5796
#define closesocket
Definition: ncftp.h:477
unsigned char BYTE
Definition: xxhash.c:193

◆ check_EnumSessions_()

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  ansi,
BOOL  hrTodo 
)
static

Definition at line 3816 of file dplayx.c.

3819{
3820 DPSESSIONDESC2 replyDpsds[] =
3821 {
3822 {
3823 .dwSize = sizeof( DPSESSIONDESC2 ),
3824 .dwFlags = 0,
3825 .guidInstance = appGuid,
3826 .guidApplication = appGuid,
3827 .dwMaxPlayers = 10,
3828 .dwCurrentPlayers = 0,
3829 .lpszSessionName = (WCHAR *) L"normal",
3830 .dwReserved1 = 0x11223344,
3831 .dwReserved2 = 0,
3832 .dwUser1 = 1,
3833 .dwUser2 = 2,
3834 .dwUser3 = 3,
3835 .dwUser4 = 4,
3836 },
3837 {
3838 .dwSize = sizeof( DPSESSIONDESC2 ),
3840 .guidInstance = appGuid2,
3841 .guidApplication = appGuid2,
3842 .dwMaxPlayers = 10,
3843 .dwCurrentPlayers = 10,
3844 .lpszSessionName = (WCHAR *) L"private",
3845 .dwReserved1 = 0xaabbccdd,
3846 .dwReserved2 = 0,
3847 .dwUser1 = 5,
3848 .dwUser2 = 6,
3849 .dwUser3 = 7,
3850 .dwUser4 = 8,
3851 },
3852 };
3853 ExpectedSession expectedSessions[ ARRAYSIZE( replyDpsds ) ];
3854 CheckSessionListCallbackData callbackData;
3856 unsigned short port = 0;
3857 WSADATA wsaData;
3858 SOCKET enumSock;
3859 int tryIndex;
3860 int wsResult;
3861 SOCKET sock;
3862 HRESULT hr;
3863 int i;
3864
3865 wsResult = WSAStartup( MAKEWORD( 2, 0 ), &wsaData );
3866 ok_( __FILE__, line )( !wsResult, "WSAStartup() returned %d.\n", wsResult );
3867
3868 enumSock = bindUdp_( line, 47624 );
3869
3870 for ( tryIndex = 0; ; ++tryIndex )
3871 {
3872 memset( &expectedSessions, 0, sizeof( expectedSessions ) );
3873 expectedSessions[ 0 ].dpsd = replyDpsds [ 0 ];
3874 expectedSessions[ 0 ].dpsd.lpszSessionNameA = (char *) AW( "normal", ansi );
3875 expectedSessions[ 1 ].dpsd = replyDpsds [ 1 ];
3876 expectedSessions[ 1 ].dpsd.lpszSessionNameA = (char *) AW( "private", ansi );
3877
3878 memset( &callbackData, 0, sizeof( callbackData ) );
3879 callbackData.line = line;
3880 callbackData.expectedSessions = expectedSessions;
3881 callbackData.expectedCount = expectedSessionCount;
3882 callbackData.ansi = ansi;
3883
3884 param = enumSessionsAsync( dp, dpsd, 100, checkSessionListCallback, &callbackData, flags );
3885
3886 if ( requestExpected )
3887 port = receiveEnumSessionsRequest_( line, enumSock, &appGuid, expectedPassword, flags );
3888
3889 for ( i = 0; i < replyCount; ++i )
3890 {
3891 sock = connectTcp_( line, port );
3892 if ( sock == INVALID_SOCKET )
3893 continue;
3894
3895 sendEnumSessionsReply_( line, sock, 2349 - i, &replyDpsds[ i ] );
3896
3897 closesocket( sock );
3898 }
3899
3900 checkNoMoreMessages_( line, enumSock );
3901
3902 hr = enumSessionsAsyncWait( param, 2000 );
3903 todo_wine_if( hrTodo ) ok_( __FILE__, line )( hr == expectedHr, "got hr %#lx.\n", hr );
3904
3905 if ( tryIndex < 19 && callbackData.actualCount < callbackData.expectedCount )
3906 continue;
3907
3908 ok_( __FILE__, line )( callbackData.actualCount == callbackData.expectedCount, "got session count %d.\n",
3909 callbackData.actualCount );
3910 ok_( __FILE__, line )( !!callbackData.timeoutCount == timeoutExpected, "got timeout count %d.\n",
3911 callbackData.timeoutCount );
3912
3913 break;
3914 }
3915
3916 closesocket( enumSock );
3917 WSACleanup();
3918}
#define ARRAYSIZE(a)
Definition: cat.c:25
#define DPSESSION_PASSWORDREQUIRED
Definition: dplay.h:275
#define DPSESSION_JOINDISABLED
Definition: dplay.h:270
#define DPSESSION_PRIVATE
Definition: dplay.h:274
struct tagDPSESSIONDESC2 DPSESSIONDESC2
static HRESULT enumSessionsAsyncWait(EnumSessionsParam *param, DWORD timeout)
Definition: dplayx.c:723
static void sendEnumSessionsReply_(int line, SOCKET sock, unsigned short port, const DPSESSIONDESC2 *dpsd)
Definition: dplayx.c:1310
static unsigned short receiveEnumSessionsRequest_(int line, SOCKET sock, const GUID *expectedAppGuid, const WCHAR *expectedPassword, DWORD expectedFlags)
Definition: dplayx.c:1264
#define AW(str, ansi)
Definition: dplayx.c:78
static SOCKET bindUdp_(int line, unsigned short port)
Definition: dplayx.c:1024
static BOOL CALLBACK checkSessionListCallback(const DPSESSIONDESC2 *thisSd, DWORD *timeout, DWORD flags, void *context)
Definition: dplayx.c:3751
static HANDLE enumSessionsAsync(IDirectPlay4 *dp, DPSESSIONDESC2 *dpsd, DWORD timeout, LPDPENUMSESSIONSCALLBACK2 callback, void *context, DWORD flags)
Definition: dplayx.c:704
#define L(x)
Definition: resources.c:13
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define todo_wine_if(is_todo)
Definition: minitest.h:81
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
short WCHAR
Definition: pedump.c:58
#define memset(x, y, z)
Definition: compat.h:39
ExpectedSession * expectedSessions
Definition: dplayx.c:3744
DPSESSIONDESC2 dpsd
Definition: dplayx.c:3737
LPSTR lpszSessionNameA
Definition: dplay.h:244
DWORD dwSize
Definition: dplay.h:232
#define MAKEWORD(a, b)
Definition: typedefs.h:248
INT WINAPI WSAStartup(IN WORD wVersionRequested, OUT LPWSADATA lpWSAData)
Definition: startup.c:113
int PASCAL FAR WSACleanup(void)
Definition: startup.c:60

◆ check_EnumSessions_async_()

static void check_EnumSessions_async_ ( int  line,
DPSESSIONDESC2 *  dpsd,
IDirectPlay4 *  dp,
BOOL  ansi 
)
static

Definition at line 3921 of file dplayx.c.

3922{
3923 DPSESSIONDESC2 replyDpsds[] =
3924 {
3925 {
3926 .dwSize = sizeof( DPSESSIONDESC2 ),
3927 .dwFlags = 0,
3928 .guidInstance = appGuid,
3929 .guidApplication = appGuid,
3930 .dwMaxPlayers = 10,
3931 .dwCurrentPlayers = 0,
3932 .lpszSessionName = (WCHAR *) L"normal",
3933 .dwReserved1 = 0x11223344,
3934 .dwReserved2 = 0,
3935 .dwUser1 = 1,
3936 .dwUser2 = 2,
3937 .dwUser3 = 3,
3938 .dwUser4 = 4,
3939 },
3940 {
3941 .dwSize = sizeof( DPSESSIONDESC2 ),
3943 .guidInstance = appGuid2,
3944 .guidApplication = appGuid2,
3945 .dwMaxPlayers = 10,
3946 .dwCurrentPlayers = 10,
3947 .lpszSessionName = (WCHAR *) L"private",
3948 .dwReserved1 = 0xaabbccdd,
3949 .dwReserved2 = 0,
3950 .dwUser1 = 5,
3951 .dwUser2 = 6,
3952 .dwUser3 = 7,
3953 .dwUser4 = 8,
3954 },
3955 };
3956 CheckSessionListCallbackData callbackData;
3957 ExpectedSession expectedSessions[ 2 ];
3959 unsigned short port;
3960 SOCKET enumSock;
3961 int tryIndex;
3962 SOCKET sock;
3963 HRESULT hr;
3964 int i;
3965
3966 enumSock = bindUdp_( line, 47624 );
3967
3968 for ( tryIndex = 0; ; ++tryIndex )
3969 {
3970 memset( expectedSessions, 0, sizeof( expectedSessions ) );
3971 expectedSessions[ 0 ].dpsd = replyDpsds [ 0 ];
3972 expectedSessions[ 0 ].dpsd.lpszSessionNameA = (char *) AW( "normal", ansi );
3973
3974 memset( &callbackData, 0, sizeof( callbackData ) );
3975 callbackData.line = line;
3976 callbackData.expectedSessions = expectedSessions;
3977 callbackData.expectedCount = 1;
3978 callbackData.ansi = ansi;
3979
3980 /* Do a sync enumeration first to fill the cache */
3981 param = enumSessionsAsync( dp, dpsd, 100, checkSessionListCallback, &callbackData, 0 );
3982
3983 port = receiveEnumSessionsRequest_( line, enumSock, &appGuid, NULL, 0 );
3984
3985 sock = connectTcp_( line, port );
3986
3987 if ( sock != INVALID_SOCKET )
3988 {
3989 sendEnumSessionsReply_( line, sock, 2349, &replyDpsds[ 0 ] );
3990
3991 closesocket( sock );
3992 }
3993
3994 checkNoMoreMessages_( line, enumSock );
3995
3996 hr = enumSessionsAsyncWait( param, 2000 );
3997 ok_( __FILE__, line )( hr == DP_OK, "got hr %#lx.\n", hr );
3998
3999 if ( tryIndex < 19 && callbackData.actualCount < callbackData.expectedCount )
4000 continue;
4001
4002 ok_( __FILE__, line )( callbackData.actualCount == callbackData.expectedCount, "got session count %d.\n",
4003 callbackData.actualCount );
4004 ok_( __FILE__, line )( callbackData.timeoutCount, "got timeout count %d.\n", callbackData.timeoutCount );
4005
4006 break;
4007 }
4008
4009 memset( expectedSessions, 0, sizeof( expectedSessions ) );
4010 expectedSessions[ 0 ].dpsd = replyDpsds [ 0 ];
4011 expectedSessions[ 0 ].dpsd.lpszSessionNameA = (char *) AW( "normal", ansi );
4012
4013 memset( &callbackData, 0, sizeof( callbackData ) );
4014 callbackData.line = line;
4015 callbackData.expectedSessions = expectedSessions;
4016 callbackData.expectedCount = 1;
4017 callbackData.ansi = ansi;
4018
4019 /* Read cache of last sync enumeration */
4020 param = enumSessionsAsync( dp, dpsd, 100, checkSessionListCallback, &callbackData, DPENUMSESSIONS_ASYNC );
4021
4023
4024 hr = enumSessionsAsyncWait( param, 2000 );
4025 ok_( __FILE__, line )( hr == DP_OK, "got hr %#lx.\n", hr );
4026
4027 ok_( __FILE__, line )( callbackData.actualCount == callbackData.expectedCount, "got session count %d.\n",
4028 callbackData.actualCount );
4029 ok_( __FILE__, line )( callbackData.timeoutCount, "got timeout count %d.\n", callbackData.timeoutCount );
4030
4031 /* Check that requests are sent periodically */
4032 for ( i = 0; i < 2; ++i )
4034
4035 for ( i = 0; i < ARRAYSIZE( replyDpsds ); ++i )
4036 {
4037 sock = connectTcp_( line, port );
4038 if ( sock == INVALID_SOCKET )
4039 continue;
4040
4041 sendEnumSessionsReply_( line, sock, 2349 - i, &replyDpsds[ i ] );
4042
4043 closesocket( sock );
4044 }
4045
4046 for ( tryIndex = 0; ; ++tryIndex )
4047 {
4048 memset( expectedSessions, 0, sizeof( expectedSessions ) );
4049 expectedSessions[ 0 ].dpsd = replyDpsds [ 0 ];
4050 expectedSessions[ 0 ].dpsd.lpszSessionNameA = (char *) AW( "normal", ansi );
4051 expectedSessions[ 1 ].dpsd = replyDpsds [ 1 ];
4052 expectedSessions[ 1 ].dpsd.lpszSessionNameA = (char *) AW( "private", ansi );
4053
4054 memset( &callbackData, 0, sizeof( callbackData ) );
4055 callbackData.line = line;
4056 callbackData.expectedSessions = expectedSessions;
4057 callbackData.expectedCount = ARRAYSIZE( expectedSessions );
4058 callbackData.ansi = ansi;
4059
4060 /* Retrieve results */
4061 param = enumSessionsAsync( dp, dpsd, 100, checkSessionListCallback, &callbackData, DPENUMSESSIONS_ASYNC );
4062 hr = enumSessionsAsyncWait( param, 2000 );
4063 ok_( __FILE__, line )( hr == DP_OK, "got hr %#lx.\n", hr );
4064
4065 if ( tryIndex < 19 && callbackData.actualCount < callbackData.expectedCount )
4066 continue;
4067
4068 ok_( __FILE__, line )( callbackData.actualCount == callbackData.expectedCount, "got session count %d.\n",
4069 callbackData.actualCount );
4070 ok_( __FILE__, line )( callbackData.timeoutCount, "got timeout count %d.\n", callbackData.timeoutCount );
4071
4072 break;
4073 }
4074
4075 memset( &callbackData, 0, sizeof( callbackData ) );
4076 callbackData.line = line;
4077 callbackData.expectedSessions = NULL;
4078 callbackData.expectedCount = 0;
4079 callbackData.ansi = ansi;
4080
4081 /* Stop enumeration */
4083 hr = enumSessionsAsyncWait( param, 2000 );
4084 ok_( __FILE__, line )( hr == DP_OK, "got hr %#lx.\n", hr );
4085
4086 ok_( __FILE__, line )( !callbackData.actualCount, "got session count %d.\n", callbackData.actualCount );
4087 todo_wine ok_( __FILE__, line )( callbackData.timeoutCount, "got timeout count %d.\n", callbackData.timeoutCount );
4088
4089 closesocket( enumSock );
4090}
#define DPENUMSESSIONS_ASYNC
Definition: dplay.h:1018
#define DPENUMSESSIONS_STOPASYNC
Definition: dplay.h:1019
#define todo_wine
Definition: minitest.h:80

◆ check_messages()

static void check_messages ( IDirectPlay4 *  pDP,
DPID *  dpid,
DWORD  dpidSize,
lpCallbackData  callbackData 
)
static

Definition at line 616 of file dplayx.c.

618{
619 /* Retrieves all messages from the queue of pDP, performing tests
620 * to check if we are receiving what we expect.
621 *
622 * Information about the messages is stores in callbackData:
623 *
624 * callbackData->dwCounter1: Number of messages received.
625 * callbackData->szTrace1: Traces for sender and receiver.
626 * We store the position a dpid holds in the dpid array.
627 * Example:
628 *
629 * trace string: "01,02,03,14"
630 * expanded: [ '01', '02', '03', '14' ]
631 * \ \ \ \
632 * \ \ \ ) message 3: from 1 to 4
633 * \ \ ) message 2: from 0 to 3
634 * \ ) message 1: from 0 to 2
635 * ) message 0: from 0 to 1
636 *
637 * In general terms:
638 * sender of message i = character in place 3*i of the array
639 * receiver of message i = character in place 3*i+1 of the array
640 *
641 * A sender value of 'S' means DPID_SYSMSG, this is, a system message.
642 *
643 * callbackData->szTrace2: Traces for message sizes.
644 */
645
646 DPID idFrom, idTo;
647 UINT i;
648 DWORD dwDataSize = 1024;
649 LPVOID lpData = calloc( 1, dwDataSize );
650 HRESULT hr;
651 char temp[5];
652
653 callbackData->szTrace2[0] = '\0';
654
655 i = 0;
656 while ( DP_OK == (hr = IDirectPlayX_Receive( pDP, &idFrom, &idTo, 0,
657 lpData, &dwDataSize )) )
658 {
659
660 callbackData->szTrace1[ 3*i ] = dpid2char( dpid, dpidSize, idFrom );
661 callbackData->szTrace1[ 3*i+1 ] = dpid2char( dpid, dpidSize, idTo );
662 callbackData->szTrace1[ 3*i+2 ] = ',';
663
664 sprintf( temp, "%ld,", dwDataSize );
665 strcat( callbackData->szTrace2, temp );
666
667 dwDataSize = 1024;
668 ++i;
669 }
670
672
673 callbackData->szTrace1[ 3*i ] = '\0';
674 callbackData->dwCounter1 = i;
675
676
677 free( lpData );
678}
#define free
Definition: debug_ros.c:5
#define IDirectPlayX_Receive(p, a, b, c, d, e)
Definition: dplay.h:890
DWORD DPID
Definition: dplay.h:158
#define DPERR_NOMESSAGES
Definition: dplay.h:110
static char dpid2char(DPID *dpid, DWORD dpidSize, DPID idPlayer)
Definition: dplayx.c:603
#define checkHR(expected, result)
Definition: dplayx.c:51
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned int UINT
Definition: sysinfo.c:13
#define sprintf
Definition: sprintf.c:45
#define calloc
Definition: rosglue.h:14
static calc_node_t temp
Definition: rpn_ieee.c:38
strcat
Definition: string.h:92
UINT dwCounter1
Definition: dplayx.c:99
char szTrace2[1024]
Definition: dplayx.c:101
char szTrace1[1024]
Definition: dplayx.c:101

◆ check_Open_()

static void check_Open_ ( int  line,
IDirectPlay4A *  dp,
DPSESSIONDESC2 *  dpsd,
const DPSESSIONDESC2 *  serverDpsd,
BOOL  idRequestExpected,
BOOL  forwardRequestExpected,
unsigned short  listenPort,
const WCHAR *  expectedPassword,
HRESULT  idReplyHr,
HRESULT  addForwardReplyHr,
HRESULT  expectedHr 
)
static

Definition at line 3156 of file dplayx.c.

3160{
3161 SOCKET listenSock;
3163 WSADATA wsaData;
3164 SOCKET recvSock;
3165 SOCKET sendSock;
3166 int wsResult;
3167 HRESULT hr;
3168
3169 wsResult = WSAStartup( MAKEWORD( 2, 0 ), &wsaData );
3170 ok_( __FILE__, line )( !wsResult, "WSAStartup() returned %d.\n", wsResult );
3171
3172 listenSock = listenTcp_( line, listenPort );
3173
3174 param = openAsync( dp, dpsd, DPOPEN_JOIN );
3175
3176 if ( idRequestExpected )
3177 {
3178 unsigned short port;
3179
3180 recvSock = acceptTcp_( line, listenSock );
3181 ok_( __FILE__, line )( recvSock != INVALID_SOCKET, "accept() returned %#Ix.\n", recvSock );
3182
3183 port = receiveRequestPlayerId_( line, recvSock, 0x9 );
3184
3185 sendSock = connectTcp_( line, port );
3186
3187 sendRequestPlayerReply_( line, sendSock, listenPort, 0x12345678, idReplyHr );
3188
3189 if ( forwardRequestExpected )
3190 {
3191 receiveAddForwardRequest_( line, recvSock, 0x12345678, expectedPassword, serverDpsd->dwReserved1, NULL );
3192
3193 if ( addForwardReplyHr == DP_OK )
3194 sendSuperEnumPlayersReply_( line, sendSock, listenPort, 2399, serverDpsd, L"normal" );
3195 else
3196 sendAddForwardReply_( line, sendSock, listenPort, addForwardReplyHr );
3197
3198 hr = openAsyncWait( param, 7000 );
3199 ok_( __FILE__, line )( hr == expectedHr, "Open() returned %#lx.\n", hr );
3200
3201 checkNoMoreMessages_( line, recvSock );
3202
3203 if ( hr == DP_OK )
3204 {
3205 BYTE expectedPlayerData[] = { 1, 2, 3, 4, };
3206 ExpectedPlayer expectedPlayers[] = {
3207 {
3208 .expectedDpid = 0x1337,
3209 .expectedPlayerType = DPPLAYERTYPE_PLAYER,
3210 .expectedShortName = "short name",
3211 .expectedLongName = "long name",
3212 .expectedFlags = DPENUMPLAYERS_REMOTE,
3213 .expectedPlayerData = expectedPlayerData,
3214 .expectedPlayerDataSize = sizeof( expectedPlayerData ),
3215 },
3216 {
3217 .expectedDpid = 0xd00de,
3218 .expectedPlayerType = DPPLAYERTYPE_PLAYER,
3219 .expectedFlags = DPENUMPLAYERS_REMOTE,
3220 },
3221 };
3222 ExpectedPlayer expectedGroups[] =
3223 {
3224 {
3225 .expectedDpid = 0x5e7,
3226 .expectedPlayerType = DPPLAYERTYPE_GROUP,
3227 .expectedShortName = "short name",
3228 .expectedLongName = "long name",
3229 .expectedFlags = DPENUMPLAYERS_REMOTE,
3230 .expectedPlayerData = expectedPlayerData,
3231 .expectedPlayerDataSize = sizeof( expectedPlayerData ),
3232 },
3233 };
3234 ExpectedPlayer expectedGroupPlayers[] =
3235 {
3236 {
3237 .expectedDpid = 0xd00de,
3238 .expectedPlayerType = DPPLAYERTYPE_PLAYER,
3239 .expectedFlags = DPENUMPLAYERS_REMOTE,
3240 },
3241 };
3242
3243 checkPlayerList_( line, dp, expectedPlayers, ARRAYSIZE( expectedPlayers ) );
3244 checkGroupList_( line, dp, expectedGroups, ARRAYSIZE( expectedGroups ) );
3245 checkGroupPlayerList_( line, 0x5e7, dp, expectedGroupPlayers, ARRAYSIZE( expectedGroupPlayers ) );
3246
3247 hr = IDirectPlayX_Close( dp );
3248 checkHR( DP_OK, hr );
3249 }
3250 }
3251 else
3252 {
3253 hr = openAsyncWait( param, 7000 );
3254 ok_( __FILE__, line )( hr == expectedHr, "Open() returned %#lx.\n", hr );
3255 }
3256 closesocket( sendSock );
3257 closesocket( recvSock );
3258 }
3259 else
3260 {
3261 hr = openAsyncWait( param, 7000 );
3262 ok_( __FILE__, line )( hr == expectedHr, "Open() returned %#lx.\n", hr );
3263 }
3264
3265 checkNoMoreAccepts_( line, listenSock );
3266
3267 closesocket( listenSock );
3268 WSACleanup();
3269}
#define DPENUMPLAYERS_REMOTE
Definition: dplay.h:988
#define DPOPEN_JOIN
Definition: dplay.h:263
#define DPPLAYERTYPE_GROUP
Definition: dplay.h:1134
#define IDirectPlayX_Close(p)
Definition: dplay.h:869
static void sendSuperEnumPlayersReply_(int line, SOCKET sock, unsigned short tcpPort, unsigned short udpPort, const DPSESSIONDESC2 *dpsd, const WCHAR *sessionName)
Definition: dplayx.c:1475
static OpenParam * openAsync(IDirectPlay4 *dp, DPSESSIONDESC2 *dpsd, DWORD flags)
Definition: dplayx.c:759
static SOCKET listenTcp_(int line, unsigned short port)
Definition: dplayx.c:1047
static HRESULT openAsyncWait(OpenParam *param, DWORD timeout)
Definition: dplayx.c:774
static void checkGroupList_(int line, IDirectPlay4 *dp, ExpectedPlayer *expectedGroups, int expectedGroupCount)
Definition: dplayx.c:3095
static void checkNoMoreAccepts_(int line, SOCKET listenSock)
Definition: dplayx.c:1098
static void checkGroupPlayerList_(int line, DPID group, IDirectPlay4 *dp, ExpectedPlayer *expectedPlayers, int expectedPlayerCount)
Definition: dplayx.c:3072
static unsigned short receiveAddForwardRequest_(int line, SOCKET sock, DPID expectedPlayerId, const WCHAR *expectedPassword, DWORD expectedTickCount, unsigned short *udpPort)
Definition: dplayx.c:1421
static SOCKET acceptTcp_(int line, SOCKET listenSock)
Definition: dplayx.c:1075
static void sendAddForwardReply_(int line, SOCKET sock, unsigned short port, HRESULT result)
Definition: dplayx.c:1706
static void checkPlayerList_(int line, IDirectPlay4 *dp, ExpectedPlayer *expectedPlayers, int expectedPlayerCount)
Definition: dplayx.c:3050
DPID expectedDpid
Definition: dplayx.c:2910
DWORD dwReserved1
Definition: dplay.h:253

◆ checkAddPlayerToGroupMessage_()

static DPID checkAddPlayerToGroupMessage_ ( int  line,
IDirectPlay4 *  dp,
DPID  expectedGroupId,
DPID  expectedPlayerId 
)
static

Definition at line 9143 of file dplayx.c.

9144{
9146 BYTE msgData[ 256 ];
9147 DWORD msgDataSize;
9148 DPID fromId, toId;
9149 HRESULT hr;
9150
9151 memset( &msgData, 0, sizeof( msgData ) );
9152 msgDataSize = sizeof( msgData );
9153 fromId = 0xdeadbeef;
9154 toId = 0xdeadbeef;
9155 hr = IDirectPlayX_Receive( dp, &fromId, &toId, 0, msgData, &msgDataSize );
9156 ok_( __FILE__, line )( hr == DP_OK, "got hr %#lx.\n", hr );
9157 ok_( __FILE__, line )( fromId == DPID_SYSMSG, "got source id %#lx.\n", fromId );
9158
9160 ok_( __FILE__, line )( msg->dwType == DPSYS_ADDPLAYERTOGROUP, "got message type %#lx.\n", msg->dwType );
9161 ok_( __FILE__, line )( msg->dpIdGroup == expectedGroupId, "got id %#lx.\n", msg->dpIdGroup );
9162 ok_( __FILE__, line )( msg->dpIdPlayer == expectedPlayerId, "got id %#lx.\n", msg->dpIdPlayer );
9163
9164 return toId;
9165}
#define msg(x)
Definition: auth_time.c:54
#define DPID_SYSMSG
Definition: dplay.h:161
#define DPSYS_ADDPLAYERTOGROUP
Definition: dplay.h:1091
static const BYTE msgData[]
Definition: message.c:93

◆ checkCreatePlayerOrGroupMessage_()

static DPID checkCreatePlayerOrGroupMessage_ ( int  line,
IDirectPlay4 *  dp,
DWORD  expectedType,
DPID  expectedDpid,
DWORD  expectedCurrentPlayers,
void *  expectedPlayerData,
DWORD  expectedPlayerDataSize,
const char *  expectedShortName,
const char *  expectedLongName,
DPID  expectedParent,
DWORD  expectedFlags 
)
static

Definition at line 4714 of file dplayx.c.

4718{
4720 DWORD expectedShortNameSize;
4721 DWORD expectedLongNameSize;
4722 DWORD expectedMsgDataSize;
4723 BYTE msgData[ 256 ];
4724 DWORD msgDataSize;
4725 DPID fromId, toId;
4726 HRESULT hr;
4727
4728 memset( &msgData, 0, sizeof( msgData ) );
4729 msgDataSize = sizeof( msgData );
4730 fromId = 0xdeadbeef;
4731 toId = 0xdeadbeef;
4732 hr = IDirectPlayX_Receive( dp, &fromId, &toId, 0, msgData, &msgDataSize );
4733 ok_( __FILE__, line )( hr == DP_OK, "got hr %#lx.\n", hr );
4734 ok_( __FILE__, line )( fromId == DPID_SYSMSG, "got source id %#lx.\n", fromId );
4735
4737 ok_( __FILE__, line )( msg->dwType == DPSYS_CREATEPLAYERORGROUP, "got message type %#lx.\n", msg->dwType );
4738 ok_( __FILE__, line )( msg->dwPlayerType == expectedType, "got player type %#lx.\n", msg->dwPlayerType );
4739 ok_( __FILE__, line )( msg->dpId == expectedDpid, "got id %#lx.\n", msg->dpId );
4740 ok_( __FILE__, line )( msg->dwCurrentPlayers == expectedCurrentPlayers, "got current players %lu.\n",
4741 msg->dwCurrentPlayers );
4742 ok_( __FILE__, line )( msg->dwDataSize == expectedPlayerDataSize, "got player data size %lu.\n", msg->dwDataSize );
4743 if ( expectedPlayerData )
4744 {
4745 ok_( __FILE__, line )( msg->lpData && !memcmp( msg->lpData, expectedPlayerData, expectedPlayerDataSize ),
4746 "player data didn't match.\n" );
4747 }
4748 else
4749 {
4750 ok_( __FILE__, line )( !msg->lpData, "got player data %p.\n", msg->lpData );
4751 }
4752 ok_( __FILE__, line )( msg->dpnName.dwSize == sizeof( DPNAME ), "got name size %lu.\n", msg->dpnName.dwSize );
4753 ok_( __FILE__, line )( !msg->dpnName.dwFlags, "got name flags %#lx.\n", msg->dpnName.dwFlags );
4754 if ( expectedShortName )
4755 {
4756 ok_( __FILE__, line )( msg->dpnName.lpszShortNameA && !strcmp( msg->dpnName.lpszShortNameA, expectedShortName ),
4757 "got short name %s.\n", wine_dbgstr_a( msg->dpnName.lpszShortNameA ) );
4758 }
4759 else
4760 {
4761 ok_( __FILE__, line )( !msg->dpnName.lpszShortNameA, "got short name %s.\n",
4762 wine_dbgstr_a( msg->dpnName.lpszShortNameA ) );
4763 }
4764 if ( expectedLongName )
4765 {
4766 ok_( __FILE__, line )( msg->dpnName.lpszLongNameA && !strcmp( msg->dpnName.lpszLongNameA, expectedLongName ),
4767 "got long name %s.\n", wine_dbgstr_a( msg->dpnName.lpszLongNameA ) );
4768 }
4769 else
4770 {
4771 ok_( __FILE__, line )( !msg->dpnName.lpszLongNameA, "got long name %s.\n",
4772 wine_dbgstr_a( msg->dpnName.lpszLongNameA ) );
4773 }
4774 ok_( __FILE__, line )( msg->dpIdParent == expectedParent, "got parent id %#lx.\n", msg->dpIdParent );
4775 ok_( __FILE__, line )( msg->dwFlags == expectedFlags, "got flags %#lx.\n", msg->dwFlags );
4776
4777 expectedShortNameSize = expectedShortName ? strlen( expectedShortName ) + 1 : 0;
4778 expectedLongNameSize = expectedLongName ? strlen( expectedLongName ) + 1 : 0;
4779 expectedMsgDataSize = sizeof( DPMSG_CREATEPLAYERORGROUP ) + expectedShortNameSize + expectedLongNameSize
4780 + expectedPlayerDataSize;
4781
4782 ok_( __FILE__, line )( msgDataSize == expectedMsgDataSize, "got message size %lu.\n", msgDataSize );
4783
4784 return toId;
4785}
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
struct tagDPNAME DPNAME
struct tagDPMSG_CREATEPLAYERORGROUP DPMSG_CREATEPLAYERORGROUP
#define DPSYS_CREATEPLAYERORGROUP
Definition: dplay.h:1085
int int static __inline const char * wine_dbgstr_a(const char *s)
Definition: debug.h:160

Referenced by checkCreatePlayerOrGroupMessages_().

◆ checkCreatePlayerOrGroupMessages_()

static void checkCreatePlayerOrGroupMessages_ ( int  line,
IDirectPlay4 *  dp,
DWORD  expectedType,
DPID  expectedDpid,
DWORD  expectedCurrentPlayers,
void *  expectedPlayerData,
DWORD  expectedPlayerDataSize,
const char *  expectedShortName,
const char *  expectedLongName,
DPID  expectedParent,
DWORD  expectedFlags 
)
static

Definition at line 4850 of file dplayx.c.

4854{
4856 HRESULT hr;
4857 DPID dpid;
4858 DWORD i;
4859 DWORD j;
4860
4862 ok_( __FILE__, line )( hr == DP_OK, "got hr %#lx.\n", hr );
4863
4864 for ( i = 0; i < data.idCount - 1; ++i )
4865 {
4866 dpid = checkCreatePlayerOrGroupMessage_( line, dp, expectedType, expectedDpid, expectedCurrentPlayers,
4867 expectedPlayerData, expectedPlayerDataSize, expectedShortName,
4868 expectedLongName, expectedParent, expectedFlags );
4869 for ( j = 0; j < data.idCount; ++j )
4870 {
4871 if ( data.ids[ j ] == dpid )
4872 {
4873 data.ids[ j ] = 0;
4874 break;
4875 }
4876 }
4877 ok_( __FILE__, line )( dpid && dpid != expectedDpid && j < data.idCount, "got destination id %#lx.\n", dpid );
4878 }
4879}
#define DPENUMPLAYERS_LOCAL
Definition: dplay.h:987
#define IDirectPlayX_EnumPlayers(p, a, b, c, d)
Definition: dplay.h:877
static BOOL CALLBACK getPlayerIdsCallback(DPID dpid, DWORD playerType, const DPNAME *name, DWORD flags, void *context)
Definition: dplayx.c:4830
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250

Referenced by check_CreatePlayer_().

◆ checkFlags_()

static void checkFlags_ ( unsigned  line,
DWORD  expected,
DWORD  result,
DWORD  flags 
)
static

Definition at line 61 of file dplayx.c.

62{
63 ok_(__FILE__, line)( expected == result,
64 "expected=0x%08lx(%s) got=0x%08lx(%s)\n",
67}
static LPCSTR dwFlags2str(DWORD dwFlags, DWORD flagType)
Definition: dplayx.c:274

◆ checkGameMessage_()

static void checkGameMessage_ ( int  line,
GameMessage *  message,
DPID  expectedFromId,
DPID  expectedToId 
)
static

Definition at line 1256 of file dplayx.c.

1257{
1258 ok_( __FILE__, line )( message->fromId == expectedFromId, "got source id %#lx.\n", message->fromId );
1259 ok_( __FILE__, line )( message->toId == expectedToId, "got destination id %#lx.\n", message->toId );
1260}
Definition: tftpd.h:60

Referenced by receiveGameMessage_(), and receiveGuaranteedGameMessage_().

◆ checkGroupList_()

static void checkGroupList_ ( int  line,
IDirectPlay4 *  dp,
ExpectedPlayer *  expectedGroups,
int  expectedGroupCount 
)
static

Definition at line 3095 of file dplayx.c.

3096{
3098 .line = line,
3099 .dp = dp,
3100 .expectedPlayers = expectedGroups,
3101 .expectedPlayerCount = expectedGroupCount,
3102 };
3103 HRESULT hr;
3104
3106 ok_( __FILE__, line )( hr == DP_OK, "EnumGroups() returned %#lx.\n", hr );
3107
3109 ok_( __FILE__, line )( hr == DP_OK, "EnumGroups() returned %#lx.\n", hr );
3110
3111 ok_( __FILE__, line )( data.actualPlayerCount == data.expectedPlayerCount, "got group count %d.\n",
3112 data.actualPlayerCount );
3113}
#define DPENUMGROUPS_REMOTE
Definition: dplay.h:997
#define IDirectPlayX_EnumGroups(p, a, b, c, d)
Definition: dplay.h:876
#define DPENUMGROUPS_LOCAL
Definition: dplay.h:996
static BOOL CALLBACK checkPlayerListCallback(DPID dpid, DWORD playerType, const DPNAME *name, DWORD flags, void *context)
Definition: dplayx.c:2930

Referenced by check_Open_().

◆ checkGroupPlayerList_()

static void checkGroupPlayerList_ ( int  line,
DPID  group,
IDirectPlay4 *  dp,
ExpectedPlayer *  expectedPlayers,
int  expectedPlayerCount 
)
static

Definition at line 3072 of file dplayx.c.

3074{
3076 .line = line,
3077 .dp = dp,
3078 .expectedPlayers = expectedPlayers,
3079 .expectedPlayerCount = expectedPlayerCount,
3080 };
3081 HRESULT hr;
3082
3084 ok_( __FILE__, line )( hr == DP_OK, "EnumGroupPlayers() returned %#lx.\n", hr );
3085
3087 ok_( __FILE__, line )( hr == DP_OK, "EnumGroupPlayers() returned %#lx.\n", hr );
3088
3089 ok_( __FILE__, line )( data.actualPlayerCount == data.expectedPlayerCount, "got player count %d.\n",
3090 data.actualPlayerCount );
3091}
#define IDirectPlayX_EnumGroupPlayers(p, a, b, c, d, e)
Definition: dplay.h:875
GLboolean GLuint group
Definition: glext.h:11120

Referenced by check_Open_().

◆ checkMessageHeader_()

static void checkMessageHeader_ ( int  line,
MessageHeader *  header,
WORD  expectedCommand 
)
static

Definition at line 1202 of file dplayx.c.

1203{
1204 ok_( __FILE__, line )( header->magic == 0x79616c70, "got magic %#lx.\n", header->magic );
1205 ok_( __FILE__, line )( header->command == expectedCommand, "got command %d.\n", header->command );
1206}

Referenced by receiveAddForwardAck_(), receiveAddForwardRequest_(), receiveAddPlayerToGroup_(), receiveCreatePlayer_(), receiveEnumSessionsRequest_(), receivePingReply_(), and receiveRequestPlayerId_().

◆ checkNoMoreAccepts_()

static void checkNoMoreAccepts_ ( int  line,
SOCKET  listenSock 
)
static

Definition at line 1098 of file dplayx.c.

1099{
1100 struct timeval timeout;
1101 int wsResult;
1102 fd_set fds;
1103
1104 FD_ZERO( &fds );
1105 FD_SET( listenSock, &fds );
1106 timeout.tv_sec = 0;
1107 timeout.tv_usec = 100000;
1108 wsResult = select( listenSock + 1, &fds, NULL, &fds, &timeout );
1109 ok_( __FILE__, line )( !wsResult, "select() returned %d.\n", wsResult );
1110}

Referenced by check_Open_(), and joinSession_().

◆ checkNoMoreMessages_()

static void checkNoMoreMessages_ ( int  line,
SOCKET  sock 
)
static

Definition at line 1172 of file dplayx.c.

1173{
1174 struct timeval timeout;
1175 char buffer[ 1024 ];
1176 int wsResult;
1177 fd_set fds;
1178
1179 FD_ZERO( &fds );
1180 FD_SET( sock, &fds );
1181 timeout.tv_sec = 0;
1182 timeout.tv_usec = 100000;
1183 select( sock + 1, &fds, NULL, &fds, &timeout );
1184
1185 wsResult = recv( sock, buffer, sizeof( buffer ), 0 );
1186 ok_( __FILE__, line )( !wsResult || wsResult == SOCKET_ERROR, "recv() returned %d.\n", wsResult );
1187}
INT WSAAPI recv(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags)
Definition: recv.c:23
GLuint buffer
Definition: glext.h:5915

Referenced by check_CreatePlayer_(), check_EnumSessions_(), check_EnumSessions_async_(), check_Open_(), and joinSession_().

◆ checkNoMorePlayerMessages_()

static void checkNoMorePlayerMessages_ ( int  line,
IDirectPlay4 *  dp 
)
static

Definition at line 4812 of file dplayx.c.

4813{
4814 char msgData[ 256 ];
4815 DWORD msgDataSize;
4816 DPID fromId, toId;
4817 HRESULT hr;
4818
4819 msgDataSize = sizeof( msgData );
4820 hr = IDirectPlayX_Receive( dp, &fromId, &toId, 0, msgData, &msgDataSize );
4821 ok_( __FILE__, line )( hr == DPERR_NOMESSAGES, "got hr %#lx.\n", hr );
4822}

Referenced by check_CreatePlayer_().

◆ checkPackedPlayer_()

static void checkPackedPlayer_ ( int  line,
PackedPlayer *  player,
DWORD  expectedFlags,
DPID  expectedId,
DWORD  expectedShortNameLength,
DWORD  expectedLongNameLength,
DWORD  expectedPlayerDataSize,
DPID  expectedSystemPlayerId 
)
static

Definition at line 1230 of file dplayx.c.

1233{
1234 DWORD expectedSize = sizeof( PackedPlayer ) + expectedShortNameLength + expectedLongNameLength + sizeof( SpData )
1235 + expectedPlayerDataSize;
1236
1237 ok_( __FILE__, line )( player->size == expectedSize, "got player info size %lu.\n", player->size );
1238 ok_( __FILE__, line )( player->flags == expectedFlags, "got flags %#lx.\n", player->flags );
1239 ok_( __FILE__, line )( player->id == expectedId, "got player info player id %#lx.\n", player->id );
1240 ok_( __FILE__, line )( player->shortNameLength == expectedShortNameLength, "got short name length %lu.\n",
1241 player->shortNameLength );
1242 ok_( __FILE__, line )( player->longNameLength == expectedLongNameLength, "got long name length %lu.\n",
1243 player->longNameLength );
1244 ok_( __FILE__, line )( player->spDataSize == sizeof( SpData ), "got SP data size %lu.\n", player->spDataSize );
1245 ok_( __FILE__, line )( player->playerDataSize == expectedPlayerDataSize, "got player data size %lu.\n",
1246 player->playerDataSize );
1247 ok_( __FILE__, line )( !player->playerCount, "got player count %lu.\n", player->playerCount );
1248 ok_( __FILE__, line )( player->systemPlayerId == expectedSystemPlayerId, "got system player id %#lx.\n",
1249 player->systemPlayerId );
1250 ok_( __FILE__, line )( player->fixedSize == sizeof( PackedPlayer ), "got fixed size %lu.\n", player->fixedSize );
1251 ok_( __FILE__, line )( !player->parentId, "got parent id %#lx.\n", player->parentId );
1252}
DWORD shortNameLength
Definition: dplayx.c:877
DWORD longNameLength
Definition: dplayx.c:878
DWORD spDataSize
Definition: dplayx.c:879
DWORD size
Definition: dplayx.c:874
DWORD playerDataSize
Definition: dplayx.c:880
DWORD playerCount
Definition: dplayx.c:881
DWORD flags
Definition: dplayx.c:875
DPID id
Definition: dplayx.c:876
DPID parentId
Definition: dplayx.c:885
DWORD fixedSize
Definition: dplayx.c:883
DPID systemPlayerId
Definition: dplayx.c:882
Definition: dplayx.c:867

Referenced by receiveAddForwardRequest_(), and receiveCreatePlayer_().

◆ checkPlayerExists_()

static void checkPlayerExists_ ( int  line,
IDirectPlay4 *  dp,
DPID  expectedDpid,
DWORD  expectedPlayerType,
const char *  expectedShortName,
const char *  expectedLongName,
DWORD  expectedFlags,
BYTE *  expectedPlayerData,
DWORD  expectedPlayerDataSize 
)
static

Definition at line 3119 of file dplayx.c.

3122{
3123 ExpectedPlayer expectedPlayer =
3124 {
3125 .expectedDpid = expectedDpid,
3126 .expectedPlayerType = expectedPlayerType,
3127 .expectedShortName = expectedShortName,
3128 .expectedLongName = expectedLongName,
3129 .expectedFlags = expectedFlags,
3130 .expectedPlayerData = expectedPlayerData,
3131 .expectedPlayerDataSize = expectedPlayerDataSize,
3132 };
3134 {
3135 .line = line,
3136 .dp = dp,
3137 .expectedPlayers = &expectedPlayer,
3138 .expectedPlayerCount = 1,
3139 .ignoreUnexpected = TRUE,
3140 };
3141 HRESULT hr;
3142
3144 ok_( __FILE__, line )( hr == DP_OK, "EnumPlayers() returned %#lx.\n", hr );
3145
3147 ok_( __FILE__, line )( hr == DP_OK, "EnumPlayers() returned %#lx.\n", hr );
3148
3149 ok_( __FILE__, line )( expectedPlayer.actualCount == 1, "got player count %d.\n", expectedPlayer.actualCount );
3150}
int actualCount
Definition: dplayx.c:2917

Referenced by check_CreatePlayer_().

◆ checkPlayerList_()

static void checkPlayerList_ ( int  line,
IDirectPlay4 *  dp,
ExpectedPlayer *  expectedPlayers,
int  expectedPlayerCount 
)
static

Definition at line 3050 of file dplayx.c.

3051{
3053 .line = line,
3054 .dp = dp,
3055 .expectedPlayers = expectedPlayers,
3056 .expectedPlayerCount = expectedPlayerCount,
3057 };
3058 HRESULT hr;
3059
3061 ok_( __FILE__, line )( hr == DP_OK, "EnumPlayers() returned %#lx.\n", hr );
3062
3064 ok_( __FILE__, line )( hr == DP_OK, "EnumPlayers() returned %#lx.\n", hr );
3065
3066 ok_( __FILE__, line )( data.actualPlayerCount == data.expectedPlayerCount, "got player count %d.\n",
3067 data.actualPlayerCount );
3068}

Referenced by check_Open_().

◆ checkPlayerListCallback()

static BOOL CALLBACK checkPlayerListCallback ( DPID  dpid,
DWORD  playerType,
const DPNAME *  name,
DWORD  flags,
void *  context 
)
static

Definition at line 2930 of file dplayx.c.

2932{
2934 int i;
2935
2936 for ( i = 0; i < data->expectedPlayerCount; ++i )
2937 {
2938 ExpectedPlayer *player = &data->expectedPlayers[ i ];
2939 if ( player->expectedDpid == dpid )
2940 {
2941 BYTE playerData[ 256 ];
2942 DWORD playerDataSize;
2943 BYTE nameData[ 256 ];
2944 DWORD nameDataSize;
2945 char *shortName;
2946 char *longName;
2947 HRESULT hr;
2948
2949 if ( player->actualCount )
2950 ok_( __FILE__, data->line )( 0, "duplicate player dpid %#lx.\n", dpid );
2951 ok_( __FILE__, data->line )( playerType == player->expectedPlayerType, "got player type %lu.\n",
2952 playerType );
2953 if ( player->expectedShortName )
2954 {
2955 ok_( __FILE__, data->line )( name->lpszShortNameA && !strcmp( name->lpszShortNameA, player->expectedShortName ),
2956 "got short name %s.\n", wine_dbgstr_a( name->lpszShortNameA ) );
2957 }
2958 else
2959 {
2960 ok_( __FILE__, data->line )( !name->lpszShortNameA, "got short name %s.\n",
2961 wine_dbgstr_a( name->lpszShortNameA ) );
2962 }
2963 if ( player->expectedLongName )
2964 {
2965 ok_( __FILE__, data->line )( name->lpszLongNameA && !strcmp( name->lpszLongNameA, player->expectedLongName ),
2966 "got long name %s.\n", wine_dbgstr_a( name->lpszLongNameA ) );
2967 }
2968 else
2969 {
2970 ok_( __FILE__, data->line )( !name->lpszLongNameA, "got long name %s.\n",
2971 wine_dbgstr_a( name->lpszLongNameA ) );
2972 }
2973 ok_( __FILE__, data->line )( flags == player->expectedFlags, "got flags %#lx.\n", flags );
2974
2975 memset( &playerData, 0xcc, sizeof( playerData ) );
2976 playerDataSize = sizeof( playerData );
2977 if ( playerType == DPPLAYERTYPE_PLAYER )
2978 hr = IDirectPlayX_GetPlayerData( data->dp, dpid, playerData, &playerDataSize, DPGET_REMOTE );
2979 else
2980 hr = IDirectPlayX_GetGroupData( data->dp, dpid, playerData, &playerDataSize, DPGET_REMOTE );
2981 ok_( __FILE__, data->line )( hr == DP_OK, "GetPlayerData() returned %#lx.\n", hr );
2982 ok_( __FILE__, data->line )( playerDataSize == player->expectedPlayerDataSize,
2983 "got player data size %lu.\n", playerDataSize );
2984 ok_( __FILE__, data->line )( !memcmp( playerData, player->expectedPlayerData, player->expectedPlayerDataSize ),
2985 "player data doesn't match.\n" );
2986
2987 memset( &nameData, 0xcc, sizeof( nameData ) );
2988 nameDataSize = sizeof( nameData );
2989 if ( playerType == DPPLAYERTYPE_PLAYER )
2990 hr = IDirectPlayX_GetPlayerName( data->dp, dpid, &nameData, &nameDataSize );
2991 else
2992 hr = IDirectPlayX_GetGroupName( data->dp, dpid, &nameData, &nameDataSize );
2993 ok_( __FILE__, data->line )( hr == DP_OK, "GetPlayerName() returned %#lx.\n", hr );
2994 ok_( __FILE__, data->line )( ((DPNAME *) nameData)->dwSize == sizeof( DPNAME ),
2995 "got name size %lu.\n", ((DPNAME *) nameData)->dwSize );
2996 ok_( __FILE__, data->line )( !((DPNAME *) nameData)->dwFlags, "got name flags %#lx.\n",
2997 ((DPNAME *) nameData)->dwFlags );
2998 shortName = ((DPNAME *) nameData)->lpszShortNameA;
2999 if ( player->expectedShortName )
3000 {
3001 if ( (char *) nameData <= shortName && shortName < (char *) nameData + nameDataSize )
3002 {
3003 ok_( __FILE__, data->line )( shortName && !strcmp( shortName, player->expectedShortName ),
3004 "got short name %s.\n", wine_dbgstr_a( shortName ) );
3005 }
3006 else
3007 {
3008 ok_( __FILE__, data->line)( 0, "got short name %p.\n", shortName );
3009 }
3010 }
3011 else
3012 {
3013 ok_( __FILE__, data->line )( !shortName, "got short name %s.\n", wine_dbgstr_a( shortName ) );
3014 }
3015 longName = ((DPNAME *) nameData)->lpszLongNameA;
3016 if ( player->expectedLongName )
3017 {
3018 if ( (char *) nameData <= longName && longName < (char *) nameData + nameDataSize )
3019 {
3020 ok_( __FILE__, data->line )( longName && !strcmp( longName, player->expectedLongName ),
3021 "got long name %s.\n", wine_dbgstr_a( longName ) );
3022 }
3023 else
3024 {
3025 ok_( __FILE__, data->line)( 0, "got long name %p.\n", longName );
3026 }
3027 }
3028 else
3029 {
3030 ok_( __FILE__, data->line )( !longName, "got long name %s.\n", wine_dbgstr_a( longName ) );
3031 }
3032
3033 ++player->actualCount;
3034 ++data->actualPlayerCount;
3035
3036 return TRUE;
3037 }
3038 }
3039
3040 if ( !data->ignoreUnexpected )
3041 ok_( __FILE__, data->line )( 0, "unexpected player dpid %#lx.\n", dpid );
3042
3043 ++data->actualPlayerCount;
3044
3045 return TRUE;
3046}
#define IDirectPlayX_GetPlayerName(p, a, b, c)
Definition: dplay.h:886
#define IDirectPlayX_GetGroupData(p, a, b, c, d)
Definition: dplay.h:880
#define IDirectPlayX_GetGroupName(p, a, b, c)
Definition: dplay.h:881
#define IDirectPlayX_GetPlayerData(p, a, b, c, d)
Definition: dplay.h:885
#define DPGET_REMOTE
Definition: dplay.h:1027
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
const char * expectedShortName
Definition: dplayx.c:2912
const char * expectedLongName
Definition: dplayx.c:2913
BYTE * expectedPlayerData
Definition: dplayx.c:2915
DWORD expectedFlags
Definition: dplayx.c:2914
DWORD expectedPlayerDataSize
Definition: dplayx.c:2916
DWORD expectedPlayerType
Definition: dplayx.c:2911
Definition: http.c:7252

Referenced by checkGroupList_(), checkGroupPlayerList_(), checkPlayerExists_(), and checkPlayerList_().

◆ checkPlayerMessage_()

static DPID checkPlayerMessage_ ( int  line,
IDirectPlay4 *  dp,
DPID  expectedFromId,
void *  expectedData,
DWORD  expectedDataSize 
)
static

Definition at line 4789 of file dplayx.c.

4791{
4792 DPID fromId, toId;
4793 BYTE data[ 1024 ];
4795 HRESULT hr;
4796
4797 fromId = 0xdeadbeef;
4798 toId = 0xdeadbeef;
4799 memset( data, 0xcc, sizeof( data ) );
4800 dataSize = sizeof( data );
4801 hr = IDirectPlayX_Receive( dp, &fromId, &toId, 0, data, &dataSize );
4802 ok_( __FILE__, line )( hr == DP_OK, "got hr %#lx.\n", hr );
4803
4804 ok_( __FILE__, line )( fromId == expectedFromId, "got source id %#lx.\n", fromId );
4805 ok_( __FILE__, line )( !memcmp( data, expectedData, expectedDataSize ), "message data didn't match.\n" );
4806 ok_( __FILE__, line )( dataSize == expectedDataSize, "got data size %lu.\n", dataSize );
4807
4808 return toId;
4809}
GLenum GLsizei dataSize
Definition: glext.h:11123

◆ checkSessionListCallback()

static BOOL CALLBACK checkSessionListCallback ( const DPSESSIONDESC2 *  thisSd,
DWORD *  timeout,
DWORD  flags,
void *  context 
)
static

Definition at line 3751 of file dplayx.c.

3752{
3754 ExpectedSession *expectedSession;
3755 int i;
3756
3757 if ( flags & DPESC_TIMEDOUT )
3758 {
3759 ++data->timeoutCount;
3760
3761 return FALSE;
3762 }
3763
3764 ++data->actualCount;
3765
3766 for ( i = 0; i < data->expectedCount; ++i )
3767 {
3768 expectedSession = &data->expectedSessions[ i ];
3769 if ( !IsEqualGUID( &expectedSession->dpsd.guidInstance, &thisSd->guidInstance ) )
3770 continue;
3771
3772 ok_( __FILE__, data->line )( !expectedSession->actualCount, "duplicate session %s.\n",
3773 wine_dbgstr_guid( &thisSd->guidInstance ) );
3774
3775 ok_( __FILE__, data->line )( thisSd->dwSize == expectedSession->dpsd.dwSize, "got size %lu.\n",
3776 thisSd->dwSize );
3777 ok_( __FILE__, data->line )( thisSd->dwFlags == expectedSession->dpsd.dwFlags, "got flags %#lx.\n",
3778 thisSd->dwFlags );
3779 ok_( __FILE__, data->line )( IsEqualGUID( &thisSd->guidApplication, &expectedSession->dpsd.guidApplication ),
3780 "got application GUID %s.\n", wine_dbgstr_guid( &thisSd->guidApplication ) );
3781 ok_( __FILE__, data->line )( thisSd->dwMaxPlayers == expectedSession->dpsd.dwMaxPlayers,
3782 "got current player count %lu.\n", thisSd->dwMaxPlayers );
3783 ok_( __FILE__, data->line )( thisSd->dwCurrentPlayers == expectedSession->dpsd.dwCurrentPlayers,
3784 "got max player count %lu.\n", thisSd->dwCurrentPlayers );
3785 ok_( __FILE__, data->line )( !strcmpAW( thisSd->lpszSessionNameA, expectedSession->dpsd.lpszSessionNameA, data->ansi ),
3786 "got session name %s.\n", dbgStrAW( thisSd->lpszSessionNameA, data->ansi ) );
3787 ok_( __FILE__, data->line )( !thisSd->lpszPasswordA, "got password %s.\n",
3788 dbgStrAW( thisSd->lpszPasswordA, data->ansi ) );
3789 ok_( __FILE__, data->line )( thisSd->dwReserved1 == expectedSession->dpsd.dwReserved1, "got reserved1 %#lx.\n",
3790 thisSd->dwReserved1 );
3791 ok_( __FILE__, data->line )( thisSd->dwReserved2 == expectedSession->dpsd.dwReserved2, "got reserved2 %#lx.\n",
3792 thisSd->dwReserved2 );
3793 ok_( __FILE__, data->line )( thisSd->dwUser1 == expectedSession->dpsd.dwUser1, "got user1 %#lx.\n",
3794 thisSd->dwUser1 );
3795 ok_( __FILE__, data->line )( thisSd->dwUser2 == expectedSession->dpsd.dwUser2, "got user2 %#lx.\n",
3796 thisSd->dwUser2 );
3797 ok_( __FILE__, data->line )( thisSd->dwUser3 == expectedSession->dpsd.dwUser3, "got user3 %#lx.\n",
3798 thisSd->dwUser3 );
3799 ok_( __FILE__, data->line )( thisSd->dwUser4 == expectedSession->dpsd.dwUser4, "got user4 %#lx.\n",
3800 thisSd->dwUser4 );
3801
3802 ++expectedSession->actualCount;
3803
3804 return TRUE;
3805 }
3806
3807 ok_( __FILE__, data->line )( 0, "unexpected session %s.\n", wine_dbgstr_guid( &thisSd->guidInstance ) );
3808
3809 return TRUE;
3810}
#define FALSE
Definition: types.h:117
#define DPESC_TIMEDOUT
Definition: dplay.h:420
static const char * dbgStrAW(const void *str, BOOL ansi)
Definition: dplayx.c:80
static int strcmpAW(const void *str0, const void *str1, BOOL ansi)
Definition: dplayx.c:85
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:181
DWORD dwUser2
Definition: dplay.h:257
DWORD dwCurrentPlayers
Definition: dplay.h:239
DWORD dwUser1
Definition: dplay.h:256
DWORD dwMaxPlayers
Definition: dplay.h:238
LPSTR lpszPasswordA
Definition: dplay.h:250
DWORD dwFlags
Definition: dplay.h:233
DWORD dwUser3
Definition: dplay.h:258
GUID guidApplication
Definition: dplay.h:235
DWORD dwReserved2
Definition: dplay.h:254
DWORD dwUser4
Definition: dplay.h:259
GUID guidInstance
Definition: dplay.h:234

Referenced by check_EnumSessions_(), and check_EnumSessions_async_().

◆ checkSetPlayerOrGroupDataMessage_()

static DPID checkSetPlayerOrGroupDataMessage_ ( int  line,
IDirectPlay4 *  dp,
DWORD  expectedPlayerType,
DPID  expectedDpid,
void *  expectedData,
DWORD  expectedDataSize 
)
static

Definition at line 9225 of file dplayx.c.

9227{
9229 BYTE msgData[ 256 ];
9230 DWORD msgDataSize;
9231 DPID fromId, toId;
9232 HRESULT hr;
9233
9234 memset( &msgData, 0, sizeof( msgData ) );
9235 msgDataSize = sizeof( msgData );
9236 fromId = 0xdeadbeef;
9237 toId = 0xdeadbeef;
9238 hr = IDirectPlayX_Receive( dp, &fromId, &toId, 0, msgData, &msgDataSize );
9239 ok_( __FILE__, line )( hr == DP_OK, "got hr %#lx.\n", hr );
9240 ok_( __FILE__, line )( fromId == DPID_SYSMSG, "got source id %#lx.\n", fromId );
9241
9243 ok_( __FILE__, line )( msg->dwType == DPSYS_SETPLAYERORGROUPDATA, "got message type %#lx.\n", msg->dwType );
9244 ok_( __FILE__, line )( msg->dwPlayerType == expectedPlayerType, "got player type %#lx.\n", msg->dwPlayerType );
9245 ok_( __FILE__, line )( msg->dpId == expectedDpid, "got dpid %#lx.\n", msg->dpId );
9246 ok_( __FILE__, line )( msg->dwDataSize == expectedDataSize, "got player data size %lu.\n", msg->dwDataSize );
9247 if ( expectedData )
9248 {
9249 ok_( __FILE__, line )( msg->lpData && !memcmp( msg->lpData, expectedData, expectedDataSize ),
9250 "data didn't match.\n" );
9251 }
9252 else
9253 {
9254 ok_( __FILE__, line )( !msg->lpData, "got data %p.\n", msg->lpData );
9255 }
9256
9257 return toId;
9258}
#define DPSYS_SETPLAYERORGROUPDATA
Definition: dplay.h:1103

◆ checkSpData_()

static void checkSpData_ ( int  line,
SpData *  spData,
unsigned short *  udpPort 
)
static

Definition at line 1209 of file dplayx.c.

1210{
1211 ok_( __FILE__, line )( spData->tcpAddr.sin_family == AF_INET, "got TCP family %d.\n", spData->tcpAddr.sin_family );
1212 ok_( __FILE__, line )( 2300 <= ntohs( spData->tcpAddr.sin_port ) && ntohs( spData->tcpAddr.sin_port ) < 2350,
1213 "got TCP port %d.\n", ntohs( spData->tcpAddr.sin_port ) );
1214 ok_( __FILE__, line )( !spData->tcpAddr.sin_addr.s_addr, "got TCP address %#lx.\n",
1215 spData->tcpAddr.sin_addr.s_addr );
1216 ok_( __FILE__, line )( spData->udpAddr.sin_family == AF_INET, "got UDP family %d.\n", spData->udpAddr.sin_family );
1217 ok_( __FILE__, line )( 2350 <= ntohs( spData->udpAddr.sin_port ) && ntohs( spData->udpAddr.sin_port ) < 2400,
1218 "got UDP port %d.\n", ntohs( spData->udpAddr.sin_port ) );
1219 ok_( __FILE__, line )( !spData->udpAddr.sin_addr.s_addr, "got UDP address %#lx.\n",
1220 spData->udpAddr.sin_addr.s_addr );
1221
1222 if ( udpPort )
1223 *udpPort = ntohs( spData->udpAddr.sin_port );
1224}
#define ntohs(x)
Definition: module.h:210
SOCKADDR_IN udpAddr
Definition: dplayx.c:869
SOCKADDR_IN tcpAddr
Definition: dplayx.c:868
struct in_addr sin_addr
Definition: winsock.h:506
short sin_family
Definition: winsock.h:504
u_short sin_port
Definition: winsock.h:505

Referenced by receiveAddForwardRequest_(), and receiveCreatePlayer_().

◆ checkSpHeader_()

static unsigned short checkSpHeader_ ( int  line,
SpHeader *  header,
DWORD  expectedSize 
)
static

Definition at line 1190 of file dplayx.c.

1191{
1192 ok_( __FILE__, line )( header->mixed == 0xfab00000 + expectedSize, "got mixed %#lx.\n", header->mixed );
1193 ok_( __FILE__, line )( header->addr.sin_family == AF_INET, "got family %d.\n", header->addr.sin_family );
1194 ok_( __FILE__, line )( 2300 <= ntohs( header->addr.sin_port ) && ntohs( header->addr.sin_port ) < 2350,
1195 "got port %d.\n", ntohs( header->addr.sin_port ) );
1196 ok_( __FILE__, line )( !header->addr.sin_addr.s_addr, "got address %#lx.\n", header->addr.sin_addr.s_addr );
1197
1198 return ntohs( header->addr.sin_port );
1199}

Referenced by receiveAddForwardAck_(), receiveAddForwardRequest_(), receiveAddPlayerToGroup_(), receiveCreatePlayer_(), receiveEnumSessionsRequest_(), receiveGuaranteedGameMessage_(), receivePingReply_(), and receiveRequestPlayerId_().

◆ connectTcp_()

static SOCKET connectTcp_ ( int  line,
unsigned short  port 
)
static

Definition at line 1113 of file dplayx.c.

1114{
1116 int wsResult;
1117 SOCKET sock;
1118
1120 ok_( __FILE__, line)( sock != INVALID_SOCKET, "got send socket %#Ix.\n", sock );
1121
1122 addr.sin_family = AF_INET;
1123 addr.sin_port = htons( port );
1124 addr.sin_addr.s_addr = htonl( INADDR_LOOPBACK );
1125 wsResult = connect( sock, (SOCKADDR *) &addr, sizeof( addr ) );
1126 ok_( __FILE__, line)( !wsResult, "connect returned %d.\n", wsResult );
1127
1128 return sock;
1129}
#define IPPROTO_TCP
Definition: ip.h:197
#define SOCK_STREAM
Definition: tcpip.h:118
#define INADDR_LOOPBACK
Definition: inet.h:78

Referenced by check_CreatePlayer_(), check_EnumSessions_(), check_EnumSessions_async_(), check_Open_(), and joinSession_().

◆ connectUdp_()

static SOCKET connectUdp_ ( int  line,
unsigned short  port 
)
static

Definition at line 1132 of file dplayx.c.

1133{
1135 int wsResult;
1136 SOCKET sock;
1137
1139 ok_( __FILE__, line)( sock != INVALID_SOCKET, "got send socket %#Ix.\n", sock );
1140
1141 addr.sin_family = AF_INET;
1142 addr.sin_port = htons( port );
1143 addr.sin_addr.s_addr = htonl( INADDR_LOOPBACK );
1144 wsResult = connect( sock, (SOCKADDR *) &addr, sizeof( addr ) );
1145 ok_( __FILE__, line)( !wsResult, "connect returned %d.\n", wsResult );
1146
1147 return sock;
1148}

◆ countSessionsCallback()

static BOOL CALLBACK countSessionsCallback ( const DPSESSIONDESC2 *  thisSd,
DWORD *  timeout,
DWORD  flags,
void *  context 
)
static

Definition at line 3271 of file dplayx.c.

3275{
3276 int *count = context;
3277
3278 if (flags & DPESC_TIMEDOUT)
3279 return FALSE;
3280
3281 ++*count;
3282
3283 return TRUE;
3284}
GLuint GLuint GLsizei count
Definition: gl.h:1545

Referenced by joinSession_(), and test_Open().

◆ create_session()

static IDirectPlay4 * create_session ( DPSESSIONDESC2 *  lpdpsd)
static

Definition at line 3702 of file dplayx.c.

3703{
3704
3705 IDirectPlay4 *pDP;
3706 DPNAME name;
3707 DPID dpid;
3708 HRESULT hr;
3709
3710 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
3711 &IID_IDirectPlay4A, (LPVOID*) &pDP );
3712 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
3713 if (FAILED(hr)) return NULL;
3714
3715 init_TCPIP_provider( pDP, "127.0.0.1", 0 );
3716
3717 hr = IDirectPlayX_Open( pDP, lpdpsd, DPOPEN_CREATE );
3719
3720 if ( ! (lpdpsd->dwFlags & DPSESSION_NEWPLAYERSDISABLED) )
3721 {
3722 ZeroMemory( &name, sizeof(DPNAME) );
3723 name.dwSize = sizeof(DPNAME);
3724 name.lpszShortNameA = (LPSTR) "bofh";
3725
3726 hr = IDirectPlayX_CreatePlayer( pDP, &dpid, &name, NULL, NULL,
3729 }
3730
3731 return pDP;
3732
3733}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
#define IDirectPlayX_Open(p, a, b)
Definition: dplay.h:889
#define IDirectPlayX_CreatePlayer(p, a, b, c, d, e, f)
Definition: dplay.h:871
#define DPPLAYER_SERVERPLAYER
Definition: dplay.h:1005
#define DPOPEN_CREATE
Definition: dplay.h:264
#define DPSESSION_NEWPLAYERSDISABLED
Definition: dplay.h:267
static void init_TCPIP_provider(IDirectPlay4 *pDP, LPCSTR strIPAddressString, WORD port)
Definition: dplayx.c:2288
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define ZeroMemory
Definition: minwinbase.h:31
char * LPSTR
Definition: typedefs.h:51

Referenced by test_interactive_EnumSessions().

◆ createPlayer_()

static void createPlayer_ ( int  line,
IDirectPlay4 *  dp,
DPID  inDpid,
HANDLE  event,
void *  data,
DWORD  dataSize,
DWORD  flags,
SOCKET  sendSock,
SOCKET  recvSock 
)
static

Definition at line 5200 of file dplayx.c.

5202{
5204 HRESULT hr;
5205 DPID dpid;
5206
5207 dpid = 0xdeadbeef;
5208 param = createPlayerAsync( dp, &dpid, NULL, event, data, dataSize, flags );
5209
5211
5212 sendRequestPlayerReply_( line, sendSock, 2349, inDpid, DP_OK );
5213
5214 receiveCreatePlayer_( line, recvSock, inDpid, flags | DPPLAYER_LOCAL, NULL, NULL, data, dataSize );
5215
5216 hr = createPlayerAsyncWait( param, 2000 );
5217 ok_( __FILE__, line )( hr == DP_OK, "got hr %#lx.\n", hr );
5218 ok_( __FILE__, line )( dpid == inDpid, "got dpid %#lx.\n", dpid );
5219}
#define DPPLAYER_LOCAL
Definition: dplay.h:1007
Definition: filter.c:185

◆ createPlayerAsync()

static CreatePlayerParam * createPlayerAsync ( IDirectPlay4 *  dp,
DPID *  dpid,
DPNAME *  name,
HANDLE  event,
void *  data,
DWORD  dataSize,
DWORD  flags 
)
static

Definition at line 815 of file dplayx.c.

817{
819
820 param = calloc( 1, sizeof( CreatePlayerParam ) );
821
822 param->dp = dp;
823 param->dpid = dpid;
824 param->name = name;
825 param->event = event;
826 param->data = data;
827 param->dataSize = dataSize;
828 param->flags = flags;
829
830 param->thread = CreateThread( NULL, 0, createPlayerProc, param, 0, NULL );
831
832 return param;
833}
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
static DWORD CALLBACK createPlayerProc(void *p)
Definition: dplayx.c:805

Referenced by check_CreatePlayer_(), createPlayer_(), and test_GetMessageQueue().

◆ createPlayerAsyncWait()

static HRESULT createPlayerAsyncWait ( CreatePlayerParam *  param,
DWORD  timeout 
)
static

Definition at line 835 of file dplayx.c.

836{
837 HRESULT hr = 0xdeadbeef;
838 DWORD waitResult;
839
840 waitResult = WaitForSingleObject( param->thread, timeout );
841 CloseHandle( param->thread );
842 if ( waitResult == WAIT_OBJECT_0 )
843 {
844 hr = param->hr;
845 free( param );
846 }
847
848 return hr;
849}
#define CloseHandle
Definition: compat.h:739
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define WAIT_OBJECT_0
Definition: winbase.h:383

Referenced by check_CreatePlayer_(), createPlayer_(), and test_GetMessageQueue().

◆ createPlayerProc()

static DWORD CALLBACK createPlayerProc ( void *  p)
static

Definition at line 805 of file dplayx.c.

806{
808
809 param->hr = IDirectPlayX_CreatePlayer( param->dp, param->dpid, param->name, param->event, param->data,
810 param->dataSize, param->flags );
811
812 return 0;
813}
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by createPlayerAsync().

◆ dbgStrAW()

static const char * dbgStrAW ( const void *  str,
BOOL  ansi 
)
static

Definition at line 80 of file dplayx.c.

81{
82 return ansi ? wine_dbgstr_a( str ) : wine_dbgstr_w( str );
83}
#define wine_dbgstr_w
Definition: kernel32.h:34
const WCHAR * str

Referenced by checkSessionListCallback().

◆ DEFINE_GUID() [1/4]

DEFINE_GUID ( appGuid  ,
0xbdcfe03e  ,
0xf0ec  ,
0x415b  ,
0x82  ,
0x11  ,
0x6f  ,
0x86  ,
0xd8  ,
0x19  ,
0x7f  ,
0xe1   
)

◆ DEFINE_GUID() [2/4]

DEFINE_GUID ( appGuid2  ,
0x93417d3f  ,
0x7d26  ,
0x46ba  ,
0xb5  ,
0x76  ,
0xfe  ,
0x4b  ,
0x20  ,
0xbb  ,
0xad  ,
0x70   
)

◆ DEFINE_GUID() [3/4]

DEFINE_GUID ( GUID_NULL  ,
0  ,
0  ,
0  ,
0  ,
0  ,
0  ,
0  ,
0  ,
0  ,
0  ,
0   
)

◆ DEFINE_GUID() [4/4]

DEFINE_GUID ( invalid_guid  ,
0x7b48b707  ,
0x0034  ,
0xc000  ,
0x02  ,
0x00  ,
0x00  ,
0x00  ,
0xec  ,
0xf6  ,
0x32  ,
0x00   
)

◆ dpid2char()

static char dpid2char ( DPID *  dpid,
DWORD  dpidSize,
DPID  idPlayer 
)
static

Definition at line 603 of file dplayx.c.

604{
605 UINT i;
606 if ( idPlayer == DPID_SYSMSG )
607 return 'S';
608 for (i=0; i<dpidSize; i++)
609 {
610 if ( idPlayer == dpid[i] )
611 return (char)(i+48);
612 }
613 return '?';
614}

Referenced by check_messages(), EnumGroups_cb(), and EnumPlayers_cb().

◆ dpMsgType2str()

static LPCSTR dpMsgType2str ( DWORD  dwType)
static

Definition at line 249 of file dplayx.c.

250{
251 switch(dwType)
252 {
253 case DPSYS_CREATEPLAYERORGROUP: return "DPSYS_CREATEPLAYERORGROUP";
254 case DPSYS_DESTROYPLAYERORGROUP: return "DPSYS_DESTROYPLAYERORGROUP";
255 case DPSYS_ADDPLAYERTOGROUP: return "DPSYS_ADDPLAYERTOGROUP";
256 case DPSYS_DELETEPLAYERFROMGROUP: return "DPSYS_DELETEPLAYERFROMGROUP";
257 case DPSYS_SESSIONLOST: return "DPSYS_SESSIONLOST";
258 case DPSYS_HOST: return "DPSYS_HOST";
259 case DPSYS_SETPLAYERORGROUPDATA: return "DPSYS_SETPLAYERORGROUPDATA";
260 case DPSYS_SETPLAYERORGROUPNAME: return "DPSYS_SETPLAYERORGROUPNAME";
261 case DPSYS_SETSESSIONDESC: return "DPSYS_SETSESSIONDESC";
262 case DPSYS_ADDGROUPTOGROUP: return "DPSYS_ADDGROUPTOGROUP";
263 case DPSYS_DELETEGROUPFROMGROUP: return "DPSYS_DELETEGROUPFROMGROUP";
264 case DPSYS_SECUREMESSAGE: return "DPSYS_SECUREMESSAGE";
265 case DPSYS_STARTSESSION: return "DPSYS_STARTSESSION";
266 case DPSYS_CHAT: return "DPSYS_DPSYS_CHAT";
267 case DPSYS_SETGROUPOWNER: return "DPSYS_SETGROUPOWNER";
268 case DPSYS_SENDCOMPLETE: return "DPSYS_SENDCOMPLETE";
269
270 default: return "UNKNOWN";
271 }
272}
#define DPSYS_SETSESSIONDESC
Definition: dplay.h:1109
#define DPSYS_CHAT
Definition: dplay.h:1124
#define DPSYS_DESTROYPLAYERORGROUP
Definition: dplay.h:1088
#define DPSYS_SECUREMESSAGE
Definition: dplay.h:1118
#define DPSYS_SENDCOMPLETE
Definition: dplay.h:1130
#define DPSYS_SETGROUPOWNER
Definition: dplay.h:1127
#define DPSYS_HOST
Definition: dplay.h:1100
#define DPSYS_ADDGROUPTOGROUP
Definition: dplay.h:1112
#define DPSYS_DELETEPLAYERFROMGROUP
Definition: dplay.h:1094
#define DPSYS_DELETEGROUPFROMGROUP
Definition: dplay.h:1115
#define DPSYS_SESSIONLOST
Definition: dplay.h:1097
#define DPSYS_SETPLAYERORGROUPNAME
Definition: dplay.h:1106
#define DPSYS_STARTSESSION
Definition: dplay.h:1121

Referenced by test_CreateGroup(), test_host_migration(), test_interactive_Receive(), test_interactive_Send(), and test_remote_data_replication().

◆ dpResult2str()

static LPCSTR dpResult2str ( HRESULT  hr)
static

Definition at line 167 of file dplayx.c.

168{
169 switch (hr)
170 {
171 case DP_OK: return "DP_OK";
172 case DPERR_ALREADYINITIALIZED: return "DPERR_ALREADYINITIALIZED";
173 case DPERR_ACCESSDENIED: return "DPERR_ACCESSDENIED";
174 case DPERR_ACTIVEPLAYERS: return "DPERR_ACTIVEPLAYERS";
175 case DPERR_BUFFERTOOSMALL: return "DPERR_BUFFERTOOSMALL";
176 case DPERR_CANTADDPLAYER: return "DPERR_CANTADDPLAYER";
177 case DPERR_CANTCREATEGROUP: return "DPERR_CANTCREATEGROUP";
178 case DPERR_CANTCREATEPLAYER: return "DPERR_CANTCREATEPLAYER";
179 case DPERR_CANTCREATESESSION: return "DPERR_CANTCREATESESSION";
180 case DPERR_CAPSNOTAVAILABLEYET: return "DPERR_CAPSNOTAVAILABLEYET";
181 case DPERR_EXCEPTION: return "DPERR_EXCEPTION";
182 case DPERR_GENERIC: return "DPERR_GENERIC";
183 case DPERR_INVALIDFLAGS: return "DPERR_INVALIDFLAGS";
184 case DPERR_INVALIDOBJECT: return "DPERR_INVALIDOBJECT";
185 case DPERR_INVALIDPARAMS: return "DPERR_INVALIDPARAMS";
186 /* symbol with the same value: DPERR_INVALIDPARAM */
187 case DPERR_INVALIDPLAYER: return "DPERR_INVALIDPLAYER";
188 case DPERR_INVALIDGROUP: return "DPERR_INVALIDGROUP";
189 case DPERR_NOCAPS: return "DPERR_NOCAPS";
190 case DPERR_NOCONNECTION: return "DPERR_NOCONNECTION";
191 case DPERR_NOMEMORY: return "DPERR_NOMEMORY";
192 /* symbol with the same value: DPERR_OUTOFMEMORY */
193 case DPERR_NOMESSAGES: return "DPERR_NOMESSAGES";
194 case DPERR_NONAMESERVERFOUND: return "DPERR_NONAMESERVERFOUND";
195 case DPERR_NOPLAYERS: return "DPERR_NOPLAYERS";
196 case DPERR_NOSESSIONS: return "DPERR_NOSESSIONS";
197 case DPERR_PENDING: return "DPERR_PENDING";
198 case DPERR_SENDTOOBIG: return "DPERR_SENDTOOBIG";
199 case DPERR_TIMEOUT: return "DPERR_TIMEOUT";
200 case DPERR_UNAVAILABLE: return "DPERR_UNAVAILABLE";
201 case DPERR_UNSUPPORTED: return "DPERR_UNSUPPORTED";
202 case DPERR_BUSY: return "DPERR_BUSY";
203 case DPERR_USERCANCEL: return "DPERR_USERCANCEL";
204 case DPERR_NOINTERFACE: return "DPERR_NOINTERFACE";
205 case DPERR_CANNOTCREATESERVER: return "DPERR_CANNOTCREATESERVER";
206 case DPERR_PLAYERLOST: return "DPERR_PLAYERLOST";
207 case DPERR_SESSIONLOST: return "DPERR_SESSIONLOST";
208 case DPERR_UNINITIALIZED: return "DPERR_UNINITIALIZED";
209 case DPERR_NONEWPLAYERS: return "DPERR_NONEWPLAYERS";
210 case DPERR_INVALIDPASSWORD: return "DPERR_INVALIDPASSWORD";
211 case DPERR_CONNECTING: return "DPERR_CONNECTING";
212 case DPERR_CONNECTIONLOST: return "DPERR_CONNECTIONLOST";
213 case DPERR_UNKNOWNMESSAGE: return "DPERR_UNKNOWNMESSAGE";
214 case DPERR_CANCELFAILED: return "DPERR_CANCELFAILED";
215 case DPERR_INVALIDPRIORITY: return "DPERR_INVALIDPRIORITY";
216 case DPERR_NOTHANDLED: return "DPERR_NOTHANDLED";
217 case DPERR_CANCELLED: return "DPERR_CANCELLED";
218 case DPERR_ABORTED: return "DPERR_ABORTED";
219 case DPERR_BUFFERTOOLARGE: return "DPERR_BUFFERTOOLARGE";
220 case DPERR_CANTCREATEPROCESS: return "DPERR_CANTCREATEPROCESS";
221 case DPERR_APPNOTSTARTED: return "DPERR_APPNOTSTARTED";
222 case DPERR_INVALIDINTERFACE: return "DPERR_INVALIDINTERFACE";
223 case DPERR_NOSERVICEPROVIDER: return "DPERR_NOSERVICEPROVIDER";
224 case DPERR_UNKNOWNAPPLICATION: return "DPERR_UNKNOWNAPPLICATION";
225 case DPERR_NOTLOBBIED: return "DPERR_NOTLOBBIED";
226 case DPERR_SERVICEPROVIDERLOADED: return "DPERR_SERVICEPROVIDERLOADED";
227 case DPERR_ALREADYREGISTERED: return "DPERR_ALREADYREGISTERED";
228 case DPERR_NOTREGISTERED: return "DPERR_NOTREGISTERED";
229 case DPERR_AUTHENTICATIONFAILED: return "DPERR_AUTHENTICATIONFAILED";
230 case DPERR_CANTLOADSSPI: return "DPERR_CANTLOADSSPI";
231 case DPERR_ENCRYPTIONFAILED: return "DPERR_ENCRYPTIONFAILED";
232 case DPERR_SIGNFAILED: return "DPERR_SIGNFAILED";
233 case DPERR_CANTLOADSECURITYPACKAGE: return "DPERR_CANTLOADSECURITYPACKAGE";
234 case DPERR_ENCRYPTIONNOTSUPPORTED: return "DPERR_ENCRYPTIONNOTSUPPORTED";
235 case DPERR_CANTLOADCAPI: return "DPERR_CANTLOADCAPI";
236 case DPERR_NOTLOGGEDIN: return "DPERR_NOTLOGGEDIN";
237 case DPERR_LOGONDENIED: return "DPERR_LOGONDENIED";
238 case CLASS_E_NOAGGREGATION: return "CLASS_E_NOAGGREGATION";
239
240 default:
241 {
243 sprintf( buffer, "%ld", HRESULT_CODE(hr) );
244 return buffer;
245 }
246 }
247}
#define DPERR_INVALIDOBJECT
Definition: dplay.h:101
#define DPERR_BUSY
Definition: dplay.h:119
#define DPERR_NOCAPS
Definition: dplay.h:106
#define DPERR_ACCESSDENIED
Definition: dplay.h:90
#define DPERR_UNKNOWNAPPLICATION
Definition: dplay.h:141
#define DPERR_GENERIC
Definition: dplay.h:99
#define DPERR_NOTLOGGEDIN
Definition: dplay.h:153
#define DPERR_NOSESSIONS
Definition: dplay.h:113
#define DPERR_LOGONDENIED
Definition: dplay.h:154
#define DPERR_NOTREGISTERED
Definition: dplay.h:145
#define DPERR_PENDING
Definition: dplay.h:114
#define DPERR_CANTADDPLAYER
Definition: dplay.h:93
#define DPERR_NOSERVICEPROVIDER
Definition: dplay.h:140
#define DPERR_BUFFERTOOLARGE
Definition: dplay.h:136
#define DPERR_SESSIONLOST
Definition: dplay.h:124
#define DPERR_NONEWPLAYERS
Definition: dplay.h:126
#define DPERR_UNINITIALIZED
Definition: dplay.h:125
#define DPERR_CANTCREATEPLAYER
Definition: dplay.h:95
#define DPERR_ALREADYREGISTERED
Definition: dplay.h:144
#define DPERR_INVALIDGROUP
Definition: dplay.h:105
#define DPERR_AUTHENTICATIONFAILED
Definition: dplay.h:146
#define DPERR_ENCRYPTIONFAILED
Definition: dplay.h:148
#define DPERR_INVALIDINTERFACE
Definition: dplay.h:139
#define DPERR_EXCEPTION
Definition: dplay.h:98
#define DPERR_NOINTERFACE
Definition: dplay.h:121
#define DPERR_ABORTED
Definition: dplay.h:135
#define DPERR_CANNOTCREATESERVER
Definition: dplay.h:122
#define DPERR_CANTLOADCAPI
Definition: dplay.h:152
#define DPERR_ENCRYPTIONNOTSUPPORTED
Definition: dplay.h:151
#define DPERR_CAPSNOTAVAILABLEYET
Definition: dplay.h:97
#define DPERR_CONNECTING
Definition: dplay.h:128
#define DPERR_NOMEMORY
Definition: dplay.h:108
#define DPERR_CONNECTIONLOST
Definition: dplay.h:129
#define DPERR_BUFFERTOOSMALL
Definition: dplay.h:92
#define DPERR_ALREADYINITIALIZED
Definition: dplay.h:89
#define DPERR_INVALIDFLAGS
Definition: dplay.h:100
#define DPERR_CANTLOADSSPI
Definition: dplay.h:147
#define DPERR_TIMEOUT
Definition: dplay.h:116
#define DPERR_SERVICEPROVIDERLOADED
Definition: dplay.h:143
#define DPERR_UNSUPPORTED
Definition: dplay.h:118
#define DPERR_PLAYERLOST
Definition: dplay.h:123
#define DPERR_UNKNOWNMESSAGE
Definition: dplay.h:130
#define DPERR_CANTCREATEGROUP
Definition: dplay.h:94
#define DPERR_CANCELLED
Definition: dplay.h:134
#define DPERR_UNAVAILABLE
Definition: dplay.h:117
#define DPERR_NONAMESERVERFOUND
Definition: dplay.h:111
#define DPERR_CANCELFAILED
Definition: dplay.h:131
#define DPERR_APPNOTSTARTED
Definition: dplay.h:138
#define DPERR_SIGNFAILED
Definition: dplay.h:149
#define DPERR_INVALIDPLAYER
Definition: dplay.h:104
#define DPERR_USERCANCEL
Definition: dplay.h:120
#define DPERR_NOTLOBBIED
Definition: dplay.h:142
#define DPERR_NOCONNECTION
Definition: dplay.h:107
#define DPERR_INVALIDPARAMS
Definition: dplay.h:103
#define DPERR_INVALIDPASSWORD
Definition: dplay.h:127
#define DPERR_ACTIVEPLAYERS
Definition: dplay.h:91
#define DPERR_CANTCREATEPROCESS
Definition: dplay.h:137
#define DPERR_INVALIDPRIORITY
Definition: dplay.h:132
#define DPERR_CANTCREATESESSION
Definition: dplay.h:96
#define DPERR_NOTHANDLED
Definition: dplay.h:133
#define DPERR_SENDTOOBIG
Definition: dplay.h:115
#define DPERR_NOPLAYERS
Definition: dplay.h:112
#define DPERR_CANTLOADSECURITYPACKAGE
Definition: dplay.h:150
static LPSTR get_temp_buffer(void)
Definition: dplayx.c:114
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:3771
#define HRESULT_CODE(hr)
Definition: winerror.h:188

◆ dwFlags2str()

static LPCSTR dwFlags2str ( DWORD  dwFlags,
DWORD  flagType 
)
static

Definition at line 274 of file dplayx.c.

275{
276
277#define FLAGS_DPCONNECTION (1<<0)
278#define FLAGS_DPENUMPLAYERS (1<<1)
279#define FLAGS_DPENUMGROUPS (1<<2)
280#define FLAGS_DPPLAYER (1<<3)
281#define FLAGS_DPGROUP (1<<4)
282#define FLAGS_DPENUMSESSIONS (1<<5)
283#define FLAGS_DPGETCAPS (1<<6)
284#define FLAGS_DPGET (1<<7)
285#define FLAGS_DPRECEIVE (1<<8)
286#define FLAGS_DPSEND (1<<9)
287#define FLAGS_DPSET (1<<10)
288#define FLAGS_DPMESSAGEQUEUE (1<<11)
289#define FLAGS_DPCONNECT (1<<12)
290#define FLAGS_DPOPEN (1<<13)
291#define FLAGS_DPSESSION (1<<14)
292#define FLAGS_DPLCONNECTION (1<<15)
293#define FLAGS_DPESC (1<<16)
294#define FLAGS_DPCAPS (1<<17)
295
297
298 /* EnumConnections */
299
300 if (flagType & FLAGS_DPCONNECTION)
301 {
303 strcat(flags, "DPCONNECTION_DIRECTPLAY,");
305 strcat(flags, "DPCONNECTION_DIRECTPLAYLOBBY,");
306 }
307
308 /* EnumPlayers,
309 EnumGroups */
310
311 if (flagType & FLAGS_DPENUMPLAYERS)
312 {
314 strcat(flags, "DPENUMPLAYERS_ALL,");
316 strcat(flags, "DPENUMPLAYERS_LOCAL,");
318 strcat(flags, "DPENUMPLAYERS_REMOTE,");
320 strcat(flags, "DPENUMPLAYERS_GROUP,");
322 strcat(flags, "DPENUMPLAYERS_SESSION,");
324 strcat(flags, "DPENUMPLAYERS_SERVERPLAYER,");
326 strcat(flags, "DPENUMPLAYERS_SPECTATOR,");
328 strcat(flags, "DPENUMPLAYERS_OWNER,");
329 }
330 if (flagType & FLAGS_DPENUMGROUPS)
331 {
333 strcat(flags, "DPENUMGROUPS_ALL,");
335 strcat(flags, "DPENUMGROUPS_LOCAL,");
337 strcat(flags, "DPENUMGROUPS_REMOTE,");
339 strcat(flags, "DPENUMGROUPS_GROUP,");
341 strcat(flags, "DPENUMGROUPS_SESSION,");
343 strcat(flags, "DPENUMGROUPS_SHORTCUT,");
345 strcat(flags, "DPENUMGROUPS_STAGINGAREA,");
347 strcat(flags, "DPENUMGROUPS_HIDDEN,");
348 }
349
350 /* CreatePlayer */
351
352 if (flagType & FLAGS_DPPLAYER)
353 {
355 strcat(flags, "DPPLAYER_SERVERPLAYER,");
357 strcat(flags, "DPPLAYER_SPECTATOR,");
359 strcat(flags, "DPPLAYER_LOCAL,");
361 strcat(flags, "DPPLAYER_OWNER,");
362 }
363
364 /* CreateGroup */
365
366 if (flagType & FLAGS_DPGROUP)
367 {
369 strcat(flags, "DPGROUP_STAGINGAREA,");
371 strcat(flags, "DPGROUP_LOCAL,");
373 strcat(flags, "DPGROUP_HIDDEN,");
374 }
375
376 /* EnumSessions */
377
378 if (flagType & FLAGS_DPENUMSESSIONS)
379 {
381 strcat(flags, "DPENUMSESSIONS_AVAILABLE,");
383 strcat(flags, "DPENUMSESSIONS_ALL,");
385 strcat(flags, "DPENUMSESSIONS_ASYNC,");
387 strcat(flags, "DPENUMSESSIONS_STOPASYNC,");
389 strcat(flags, "DPENUMSESSIONS_PASSWORDREQUIRED,");
391 strcat(flags, "DPENUMSESSIONS_RETURNSTATUS,");
392 }
393
394 /* GetCaps,
395 GetPlayerCaps */
396
397 if (flagType & FLAGS_DPGETCAPS)
398 {
400 strcat(flags, "DPGETCAPS_GUARANTEED,");
401 }
402
403 /* GetGroupData,
404 GetPlayerData */
405
406 if (flagType & FLAGS_DPGET)
407 {
408 if (dwFlags == DPGET_REMOTE)
409 strcat(flags, "DPGET_REMOTE,");
410 if (dwFlags & DPGET_LOCAL)
411 strcat(flags, "DPGET_LOCAL,");
412 }
413
414 /* Receive */
415
416 if (flagType & FLAGS_DPRECEIVE)
417 {
419 strcat(flags, "DPRECEIVE_ALL,");
421 strcat(flags, "DPRECEIVE_TOPLAYER,");
423 strcat(flags, "DPRECEIVE_FROMPLAYER,");
425 strcat(flags, "DPRECEIVE_PEEK,");
426 }
427
428 /* Send */
429
430 if (flagType & FLAGS_DPSEND)
431 {
432 /*if (dwFlags == DPSEND_NONGUARANTEED)
433 strcat(flags, "DPSEND_NONGUARANTEED,");*/
434 if (dwFlags == DPSEND_MAX_PRIORITY) /* = DPSEND_MAX_PRI */
435 {
436 strcat(flags, "DPSEND_MAX_PRIORITY,");
437 }
438 else
439 {
441 strcat(flags, "DPSEND_GUARANTEED,");
443 strcat(flags, "DPSEND_HIGHPRIORITY,");
445 strcat(flags, "DPSEND_OPENSTREAM,");
447 strcat(flags, "DPSEND_CLOSESTREAM,");
449 strcat(flags, "DPSEND_SIGNED,");
451 strcat(flags, "DPSEND_ENCRYPTED,");
453 strcat(flags, "DPSEND_LOBBYSYSTEMMESSAGE,");
454 if (dwFlags & DPSEND_ASYNC)
455 strcat(flags, "DPSEND_ASYNC,");
457 strcat(flags, "DPSEND_NOSENDCOMPLETEMSG,");
458 }
459 }
460
461 /* SetGroupData,
462 SetGroupName,
463 SetPlayerData,
464 SetPlayerName,
465 SetSessionDesc */
466
467 if (flagType & FLAGS_DPSET)
468 {
469 if (dwFlags == DPSET_REMOTE)
470 strcat(flags, "DPSET_REMOTE,");
471 if (dwFlags & DPSET_LOCAL)
472 strcat(flags, "DPSET_LOCAL,");
474 strcat(flags, "DPSET_GUARANTEED,");
475 }
476
477 /* GetMessageQueue */
478
479 if (flagType & FLAGS_DPMESSAGEQUEUE)
480 {
482 strcat(flags, "DPMESSAGEQUEUE_SEND,");
484 strcat(flags, "DPMESSAGEQUEUE_RECEIVE,");
485 }
486
487 /* Connect */
488
489 if (flagType & FLAGS_DPCONNECT)
490 {
492 strcat(flags, "DPCONNECT_RETURNSTATUS,");
493 }
494
495 /* Open */
496
497 if (flagType & FLAGS_DPOPEN)
498 {
499 if (dwFlags & DPOPEN_JOIN)
500 strcat(flags, "DPOPEN_JOIN,");
502 strcat(flags, "DPOPEN_CREATE,");
504 strcat(flags, "DPOPEN_RETURNSTATUS,");
505 }
506
507 /* DPSESSIONDESC2 */
508
509 if (flagType & FLAGS_DPSESSION)
510 {
512 strcat(flags, "DPSESSION_NEWPLAYERSDISABLED,");
514 strcat(flags, "DPSESSION_MIGRATEHOST,");
516 strcat(flags, "DPSESSION_NOMESSAGEID,");
518 strcat(flags, "DPSESSION_JOINDISABLED,");
520 strcat(flags, "DPSESSION_KEEPALIVE,");
522 strcat(flags, "DPSESSION_NODATAMESSAGES,");
524 strcat(flags, "DPSESSION_SECURESERVER,");
526 strcat(flags, "DPSESSION_PRIVATE,");
528 strcat(flags, "DPSESSION_PASSWORDREQUIRED,");
530 strcat(flags, "DPSESSION_MULTICASTSERVER,");
532 strcat(flags, "DPSESSION_CLIENTSERVER,");
533
535 strcat(flags, "DPSESSION_DIRECTPLAYPROTOCOL,");
537 strcat(flags, "DPSESSION_NOPRESERVEORDER,");
539 strcat(flags, "DPSESSION_OPTIMIZELATENCY,");
540
541 }
542
543 /* DPLCONNECTION */
544
545 if (flagType & FLAGS_DPLCONNECTION)
546 {
548 strcat(flags, "DPLCONNECTION_CREATESESSION,");
550 strcat(flags, "DPLCONNECTION_JOINSESSION,");
551 }
552
553 /* EnumSessionsCallback2 */
554
555 if (flagType & FLAGS_DPESC)
556 {
558 strcat(flags, "DPESC_TIMEDOUT,");
559 }
560
561 /* GetCaps,
562 GetPlayerCaps */
563
564 if (flagType & FLAGS_DPCAPS)
565 {
567 strcat(flags, "DPCAPS_ISHOST,");
569 strcat(flags, "DPCAPS_GROUPOPTIMIZED,");
571 strcat(flags, "DPCAPS_KEEPALIVEOPTIMIZED,");
573 strcat(flags, "DPCAPS_GUARANTEEDOPTIMIZED,");
575 strcat(flags, "DPCAPS_GUARANTEEDSUPPORTED,");
577 strcat(flags, "DPCAPS_SIGNINGSUPPORTED,");
579 strcat(flags, "DPCAPS_ENCRYPTIONSUPPORTED,");
581 strcat(flags, "DPCAPS_ASYNCCANCELSUPPORTED,");
583 strcat(flags, "DPCAPS_ASYNCCANCELALLSUPPORTED,");
585 strcat(flags, "DPCAPS_SENDTIMEOUTSUPPORTED,");
587 strcat(flags, "DPCAPS_SENDPRIORITYSUPPORTED,");
589 strcat(flags, "DPCAPS_ASYNCSUPPORTED,");
590
592 strcat(flags, "DPPLAYERCAPS_LOCAL,");
593 }
594
595 if ((strlen(flags) == 0) && (dwFlags != 0))
596 strcpy(flags, "UNKNOWN");
597 else
598 flags[strlen(flags)-1] = '\0';
599
600 return flags;
601}
#define DPSESSION_MIGRATEHOST
Definition: dplay.h:268
#define DPCAPS_GUARANTEEDSUPPORTED
Definition: dplay.h:1072
#define DPENUMPLAYERS_ALL
Definition: dplay.h:986
#define DPCAPS_KEEPALIVEOPTIMIZED
Definition: dplay.h:1070
#define DPSESSION_CLIENTSERVER
Definition: dplay.h:277
#define DPSEND_HIGHPRIORITY
Definition: dplay.h:1039
#define DPENUMPLAYERS_GROUP
Definition: dplay.h:989
#define DPGROUP_HIDDEN
Definition: dplay.h:1013
#define DPSESSION_NOMESSAGEID
Definition: dplay.h:269
#define DPSET_REMOTE
Definition: dplay.h:1056
#define DPENUMGROUPS_STAGINGAREA
Definition: dplay.h:1000
#define DPGET_LOCAL
Definition: dplay.h:1028
#define DPSET_LOCAL
Definition: dplay.h:1057
#define DPRECEIVE_TOPLAYER
Definition: dplay.h:1032
#define DPGROUP_STAGINGAREA
Definition: dplay.h:1011
#define DPENUMSESSIONS_PASSWORDREQUIRED
Definition: dplay.h:1020
#define DPENUMGROUPS_ALL
Definition: dplay.h:995
#define DPSEND_LOBBYSYSTEMMESSAGE
Definition: dplay.h:1044
#define DPSEND_CLOSESTREAM
Definition: dplay.h:1041
#define DPSEND_NOSENDCOMPLETEMSG
Definition: dplay.h:1046
#define DPENUMPLAYERS_SESSION
Definition: dplay.h:990
#define DPPLAYER_SPECTATOR
Definition: dplay.h:1006
#define DPCAPS_ASYNCSUPPORTED
Definition: dplay.h:1080
#define DPGROUP_LOCAL
Definition: dplay.h:1012
#define DPENUMPLAYERS_SPECTATOR
Definition: dplay.h:992
#define DPCONNECTION_DIRECTPLAY
Definition: dplay.h:982
#define DPSEND_GUARANTEED
Definition: dplay.h:1038
#define DPENUMGROUPS_SHORTCUT
Definition: dplay.h:999
#define DPSESSION_SECURESERVER
Definition: dplay.h:273
#define DPOPEN_RETURNSTATUS
Definition: dplay.h:265
#define DPENUMPLAYERS_SERVERPLAYER
Definition: dplay.h:991
#define DPCONNECT_RETURNSTATUS
Definition: dplay.h:1065
#define DPSESSION_MULTICASTSERVER
Definition: dplay.h:276
#define DPENUMPLAYERS_OWNER
Definition: dplay.h:993
#define DPCAPS_SIGNINGSUPPORTED
Definition: dplay.h:1073
#define DPRECEIVE_PEEK
Definition: dplay.h:1034
#define DPCAPS_GROUPOPTIMIZED
Definition: dplay.h:1069
#define DPSEND_SIGNED
Definition: dplay.h:1042
#define DPSESSION_KEEPALIVE
Definition: dplay.h:271
#define DPRECEIVE_ALL
Definition: dplay.h:1031
#define DPCAPS_ASYNCCANCELSUPPORTED
Definition: dplay.h:1076
#define DPLCONNECTION_CREATESESSION
Definition: dplay.h:294
#define DPMESSAGEQUEUE_RECEIVE
Definition: dplay.h:1062
#define DPCAPS_SENDPRIORITYSUPPORTED
Definition: dplay.h:1079
#define DPENUMSESSIONS_ALL
Definition: dplay.h:1017
#define DPSESSION_NODATAMESSAGES
Definition: dplay.h:272
#define DPSEND_OPENSTREAM
Definition: dplay.h:1040
#define DPCAPS_SENDTIMEOUTSUPPORTED
Definition: dplay.h:1078
#define DPSET_GUARANTEED
Definition: dplay.h:1058
#define DPPLAYER_OWNER
Definition: dplay.h:1008
#define DPMESSAGEQUEUE_SEND
Definition: dplay.h:1061
#define DPENUMGROUPS_HIDDEN
Definition: dplay.h:1001
#define DPCAPS_GUARANTEEDOPTIMIZED
Definition: dplay.h:1071
#define DPRECEIVE_FROMPLAYER
Definition: dplay.h:1033
#define DPSEND_ENCRYPTED
Definition: dplay.h:1043
#define DPENUMSESSIONS_AVAILABLE
Definition: dplay.h:1016
#define DPCAPS_ISHOST
Definition: dplay.h:1068
#define DPSEND_MAX_PRIORITY
Definition: dplay.h:1049
#define DPCAPS_ENCRYPTIONSUPPORTED
Definition: dplay.h:1074
#define DPSESSION_DIRECTPLAYPROTOCOL
Definition: dplay.h:278
#define DPPLAYERCAPS_LOCAL
Definition: dplay.h:1075
#define DPSESSION_OPTIMIZELATENCY
Definition: dplay.h:280
#define DPLCONNECTION_JOINSESSION
Definition: dplay.h:295
#define DPSEND_ASYNC
Definition: dplay.h:1045
#define DPGETCAPS_GUARANTEED
Definition: dplay.h:1024
#define DPCONNECTION_DIRECTPLAYLOBBY
Definition: dplay.h:983
#define DPSESSION_NOPRESERVEORDER
Definition: dplay.h:279
#define DPENUMSESSIONS_RETURNSTATUS
Definition: dplay.h:1021
#define DPCAPS_ASYNCCANCELALLSUPPORTED
Definition: dplay.h:1077
#define FLAGS_DPCONNECT
#define FLAGS_DPOPEN
#define FLAGS_DPGET
#define FLAGS_DPPLAYER
#define FLAGS_DPSET
#define FLAGS_DPLCONNECTION
#define FLAGS_DPESC
#define FLAGS_DPSEND
#define FLAGS_DPCONNECTION
#define FLAGS_DPGETCAPS
#define FLAGS_DPSESSION
#define FLAGS_DPENUMGROUPS
#define FLAGS_DPGROUP
#define FLAGS_DPENUMSESSIONS
#define FLAGS_DPMESSAGEQUEUE
#define FLAGS_DPENUMPLAYERS
#define FLAGS_DPRECEIVE
#define FLAGS_DPCAPS
strcpy
Definition: string.h:131

Referenced by checkFlags_(), EnumGroups_cb(), and EnumPlayers_cb().

◆ EnumAddress_cb()

static BOOL CALLBACK EnumAddress_cb ( REFGUID  guidDataType,
DWORD  dwDataSize,
LPCVOID  lpData,
LPVOID  lpContext 
)
static

Definition at line 6138 of file dplayx.c.

6142{
6143 lpCallbackData callbackData = lpContext;
6144 static REFGUID types[] = { &DPAID_TotalSize,
6145 &DPAID_ServiceProvider,
6146 &DPAID_INet,
6147 &DPAID_INetW };
6148 static DWORD sizes[] = { 4, 16, 12, 24, 4, 16, 10, 20 };
6149
6150
6151 checkGuid( types[callbackData->dwCounter1%4], guidDataType );
6152 check( sizes[callbackData->dwCounter1], dwDataSize );
6153
6154 switch(callbackData->dwCounter1)
6155 {
6156 case 0:
6157 check( 136, *(LPDWORD) lpData );
6158 break;
6159 case 4:
6160 check( 130, *(LPDWORD) lpData );
6161 break;
6162 case 1:
6163 case 5:
6164 checkGuid( &DPSPGUID_TCPIP, lpData );
6165 break;
6166 case 6:
6167 checkStr( "127.0.0.1", (LPSTR) lpData );
6168 break;
6169 default: break;
6170 }
6171
6172
6173 callbackData->dwCounter1++;
6174
6175 return TRUE;
6176}
#define checkGuid(expected, result)
Definition: dplayx.c:68
#define check(expected, result)
Definition: dplayx.c:43
#define checkStr(expected, result)
Definition: dplayx.c:55
static const struct @662 sizes[]
Definition: scsiwmi.h:51
Definition: cmds.c:130
uint32_t * LPDWORD
Definition: typedefs.h:59

Referenced by test_GetPlayerAddress().

◆ EnumAddress_cb2()

static BOOL CALLBACK EnumAddress_cb2 ( REFGUID  guidDataType,
DWORD  dwDataSize,
LPCVOID  lpData,
LPVOID  lpContext 
)
static

Definition at line 2507 of file dplayx.c.

2511{
2512 lpCallbackData callbackData = lpContext;
2513
2514 static REFGUID types[] = { &DPAID_TotalSize,
2515 &DPAID_ServiceProvider,
2516 &GUID_NULL };
2517 static DWORD sizes[] = { 4, 16, 0 };
2518 static REFGUID sps[] = { &DPSPGUID_SERIAL, &DPSPGUID_MODEM,
2519 &DPSPGUID_IPX, &DPSPGUID_TCPIP };
2520
2521
2522 checkGuid( types[ callbackData->dwCounter2 ], guidDataType );
2523 check( sizes[ callbackData->dwCounter2 ], dwDataSize );
2524
2525 if ( IsEqualGUID( types[0], guidDataType ) )
2526 {
2527 todo_wine check( 80, *((LPDWORD) lpData) );
2528 }
2529 else if ( IsEqualGUID( types[1], guidDataType ) )
2530 {
2531 BOOL found = FALSE;
2532 int i;
2533 for( i=0; i < ARRAY_SIZE(sps) && !found; i++ )
2534 found = IsEqualGUID( sps[i], lpData );
2535 ok( found, "Unknown Address type found %s\n", wine_dbgstr_guid(lpData) );
2536 }
2537
2538 callbackData->dwCounter2++;
2539
2540 return TRUE;
2541}
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GUID_NULL
Definition: ks.h:106
UINT dwCounter2
Definition: dplayx.c:99

Referenced by EnumConnections_cb().

◆ EnumAddressesCallback()

static BOOL CALLBACK EnumAddressesCallback ( REFGUID  guidDataType,
DWORD  size,
const void *  data,
void *  context 
)
static

Definition at line 2769 of file dplayx.c.

2770{
2771 if (IsEqualGUID(guidDataType, &DPAID_TotalSize))
2773 else if (IsEqualGUID(guidDataType, &DPAID_ServiceProvider))
2775 else if(IsEqualGUID(guidDataType, &invalid_guid))
2777 else
2778 ok(0, "guidDataType %s\n", wine_dbgstr_guid(guidDataType));
2779
2780 return TRUE;
2781}
static int enum_addresses_cb_count
Definition: dplayx.c:2768

Referenced by test_EnumAddresses().

◆ EnumAddressTypeCallback()

static BOOL CALLBACK EnumAddressTypeCallback ( REFGUID  guidDataType,
LPVOID  lpContext,
DWORD  flags 
)
static

Definition at line 2836 of file dplayx.c.

2837{
2838 if (IsEqualGUID(guidDataType, &DPAID_INet))
2840 else
2841 ok(0, "guidDataType %s\n", wine_dbgstr_guid(guidDataType));
2842
2843 return TRUE;
2844}
static int enum_address_cb_count
Definition: dplayx.c:2835

Referenced by test_EnumAddressTypes().

◆ EnumConnections_cb()

static BOOL CALLBACK EnumConnections_cb ( LPCGUID  lpguidSP,
LPVOID  lpConnection,
DWORD  dwConnectionSize,
LPCDPNAME  lpName,
DWORD  dwFlags,
LPVOID  lpContext 
)
static

Definition at line 2543 of file dplayx.c.

2549{
2550
2551 lpCallbackData callbackData = lpContext;
2552 IDirectPlayLobby *pDPL;
2553 HRESULT hr;
2554
2555
2556 if (!callbackData->dwFlags)
2557 {
2558 callbackData->dwFlags = DPCONNECTION_DIRECTPLAY;
2559 }
2560
2561 checkFlags( callbackData->dwFlags, dwFlags, FLAGS_DPCONNECTION );
2562
2563 /* Get info from lpConnection */
2564 hr = CoCreateInstance( &CLSID_DirectPlayLobby, NULL, CLSCTX_ALL,
2565 &IID_IDirectPlayLobby3A, (LPVOID*) &pDPL );
2566 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlayLobby / IID_IDirectPlayLobby3A failed\n");
2567 if (FAILED(hr))
2568 return FALSE;
2569
2570 callbackData->dwCounter2 = 0;
2571 IDirectPlayLobby_EnumAddress( pDPL, EnumAddress_cb2, lpConnection,
2572 dwConnectionSize, callbackData );
2573 todo_wine check( 3, callbackData->dwCounter2 );
2574
2575 callbackData->dwCounter1++;
2576
2578
2579 return TRUE;
2580}
static BOOL CALLBACK EnumAddress_cb2(REFGUID guidDataType, DWORD dwDataSize, LPCVOID lpData, LPVOID lpContext)
Definition: dplayx.c:2507
#define checkFlags(expected, result, flags)
Definition: dplayx.c:60
#define IDirectPlayLobby_Release(p)
Definition: dplobby.h:456
#define IDirectPlayLobby_EnumAddress(p, a, b, c, d)
Definition: dplobby.h:460
DWORD dwFlags
Definition: dplayx.c:100

Referenced by test_EnumConnections().

◆ EnumConnections_cb2()

static BOOL CALLBACK EnumConnections_cb2 ( LPCGUID  lpguidSP,
LPVOID  lpConnection,
DWORD  dwConnectionSize,
LPCDPNAME  lpName,
DWORD  dwFlags,
LPVOID  lpContext 
)
static

Definition at line 2655 of file dplayx.c.

2661{
2662 IDirectPlay4 *pDP = lpContext;
2663 HRESULT hr;
2664
2665 /* Incorrect parameters */
2668 hr = IDirectPlayX_InitializeConnection( pDP, lpConnection, 1 );
2670
2671 /* Normal operation.
2672 We're only interested in ensuring that the TCP/IP provider works */
2673
2674 if( IsEqualGUID(lpguidSP, &DPSPGUID_TCPIP) )
2675 {
2676 hr = IDirectPlayX_InitializeConnection( pDP, lpConnection, 0 );
2677 checkHR( DP_OK, hr );
2678 hr = IDirectPlayX_InitializeConnection( pDP, lpConnection, 0 );
2680 }
2681
2682 return TRUE;
2683}
#define IDirectPlayX_InitializeConnection(p, a, b)
Definition: dplay.h:904

Referenced by test_InitializeConnection().

◆ EnumGroups_cb()

static BOOL CALLBACK EnumGroups_cb ( DPID  dpId,
DWORD  dwPlayerType,
LPCDPNAME  lpName,
DWORD  dwFlags,
LPVOID  lpContext 
)
static

Definition at line 7142 of file dplayx.c.

7147{
7148 lpCallbackData callbackData = lpContext;
7149 char playerIndex = dpid2char( callbackData->dpid,
7150 callbackData->dpidSize,
7151 dpId );
7152
7153
7154 /* Trace to study player ids */
7155 callbackData->szTrace1[ callbackData->dwCounter1 ] = playerIndex;
7156 callbackData->dwCounter1++;
7157 callbackData->szTrace1[ callbackData->dwCounter1 ] = '\0';
7158
7159 /* Trace to study flags received */
7160 strcat( callbackData->szTrace2,
7162 strlen("DPENUMGROUPS_") ) );
7163 strcat( callbackData->szTrace2, ":" );
7164
7165
7166 check( DPPLAYERTYPE_GROUP, dwPlayerType );
7167
7168 return TRUE;
7169}
UINT dpidSize
Definition: dplayx.c:103
DPID * dpid
Definition: dplayx.c:102

Referenced by EnumSessions_cb_EnumGroups(), test_EnumGroups(), and test_EnumGroupsInGroup().

◆ EnumPlayers_cb()

static BOOL CALLBACK EnumPlayers_cb ( DPID  dpId,
DWORD  dwPlayerType,
LPCDPNAME  lpName,
DWORD  dwFlags,
LPVOID  lpContext 
)
static

Definition at line 6811 of file dplayx.c.

6816{
6817 lpCallbackData callbackData = lpContext;
6818 char playerIndex = dpid2char( callbackData->dpid,
6819 callbackData->dpidSize,
6820 dpId );
6821
6822
6823 /* Trace to study player ids */
6824 callbackData->szTrace1[ callbackData->dwCounter1 ] = playerIndex;
6825 callbackData->dwCounter1++;
6826 callbackData->szTrace1[ callbackData->dwCounter1 ] = '\0';
6827
6828 /* Trace to study flags received */
6829 strcat( callbackData->szTrace2,
6831 strlen("DPENUMPLAYERS_") ) );
6832 strcat( callbackData->szTrace2, ":" );
6833
6834
6835 if ( playerIndex < '5' )
6836 {
6837 check( DPPLAYERTYPE_PLAYER, dwPlayerType );
6838 }
6839 else
6840 {
6841 check( DPPLAYERTYPE_GROUP, dwPlayerType );
6842 }
6843
6844 return TRUE;
6845
6846}

Referenced by EnumSessions_cb_EnumPlayers(), and test_EnumPlayers().

◆ EnumSessions_cb()

static BOOL CALLBACK EnumSessions_cb ( LPCDPSESSIONDESC2  lpThisSD,
LPDWORD  lpdwTimeOut,
DWORD  dwFlags,
LPVOID  lpContext 
)
static

Definition at line 3670 of file dplayx.c.

3674{
3675 lpCallbackData callbackData = lpContext;
3676 callbackData->dwCounter1++;
3677
3678 if ( dwFlags & DPESC_TIMEDOUT )
3679 {
3680 check( TRUE, lpThisSD == NULL );
3681 return FALSE;
3682 }
3683 check( FALSE, lpThisSD == NULL );
3684
3685
3686 if ( lpThisSD->lpszPasswordA != NULL )
3687 {
3688 check( TRUE, (lpThisSD->dwFlags & DPSESSION_PASSWORDREQUIRED) != 0 );
3689 }
3690
3691 if ( lpThisSD->dwFlags & DPSESSION_NEWPLAYERSDISABLED )
3692 {
3693 check( 0, lpThisSD->dwCurrentPlayers );
3694 }
3695
3696 check( sizeof(*lpThisSD), lpThisSD->dwSize );
3697 checkLP( NULL, lpThisSD->lpszPasswordA );
3698
3699 return TRUE;
3700}
#define checkLP(expected, result)
Definition: dplayx.c:47

Referenced by test_interactive_EnumSessions().

◆ EnumSessions_cb2()

static BOOL CALLBACK EnumSessions_cb2 ( LPCDPSESSIONDESC2  lpThisSD,
LPDWORD  lpdwTimeOut,
DWORD  dwFlags,
LPVOID  lpContext 
)
static

Definition at line 2866 of file dplayx.c.

2870{
2871 IDirectPlay4 *pDP = lpContext;
2872 DPSESSIONDESC2 dpsd;
2873 HRESULT hr;
2874
2875 if (dwFlags & DPESC_TIMEDOUT)
2876 return FALSE;
2877
2878
2879 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
2880 dpsd.dwSize = sizeof(DPSESSIONDESC2);
2881 dpsd.guidApplication = appGuid;
2882 dpsd.guidInstance = lpThisSD->guidInstance;
2883
2884 if ( lpThisSD->dwFlags & DPSESSION_PASSWORDREQUIRED )
2885 {
2886 /* Incorrect password */
2887 dpsd.lpszPasswordA = (LPSTR) "sonic boom";
2888 hr = IDirectPlayX_Open( pDP, &dpsd, DPOPEN_JOIN );
2890
2891 /* Correct password */
2892 dpsd.lpszPasswordA = (LPSTR) "hadouken";
2893 hr = IDirectPlayX_Open( pDP, &dpsd, DPOPEN_JOIN );
2894 checkHR( DP_OK, hr );
2895 }
2896 else
2897 {
2898 hr = IDirectPlayX_Open( pDP, &dpsd, DPOPEN_JOIN );
2899 checkHR( DP_OK, hr );
2900 }
2901
2902 hr = IDirectPlayX_Close( pDP );
2903 checkHR( DP_OK, hr );
2904
2905 return TRUE;
2906}

Referenced by test_interactive_Open().

◆ EnumSessions_cb_EnumGroups()

static BOOL CALLBACK EnumSessions_cb_EnumGroups ( LPCDPSESSIONDESC2  lpThisSD,
LPDWORD  lpdwTimeOut,
DWORD  dwFlags,
LPVOID  lpContext 
)
static

Definition at line 7171 of file dplayx.c.

7175{
7176 lpCallbackData callbackData = lpContext;
7177 HRESULT hr;
7178
7179 if (dwFlags & DPESC_TIMEDOUT)
7180 {
7181 return FALSE;
7182 }
7183
7184 /* guid = NULL */
7185 callbackData->dwCounter1 = 0;
7186 hr = IDirectPlayX_EnumGroups( callbackData->pDP, NULL,
7187 EnumGroups_cb, &callbackData, 0 );
7189 check( 0, callbackData->dwCounter1 );
7190
7191 /* guid = appGuid */
7192 callbackData->dwCounter1 = 0;
7193 hr = IDirectPlayX_EnumGroups( callbackData->pDP, (LPGUID) &appGuid,
7194 EnumGroups_cb, &callbackData, 0 );
7196 check( 0, callbackData->dwCounter1 );
7197
7198 callbackData->dwCounter1 = 0;
7199 hr = IDirectPlayX_EnumGroups( callbackData->pDP, (LPGUID) &appGuid,
7200 EnumGroups_cb, &callbackData,
7203 check( 0, callbackData->dwCounter1 );
7204
7205 /* guid = guidInstance */
7206 callbackData->dwCounter1 = 0;
7207 hr = IDirectPlayX_EnumGroups( callbackData->pDP,
7208 (LPGUID) &lpThisSD->guidInstance,
7209 EnumGroups_cb, &callbackData, 0 );
7211 check( 0, callbackData->dwCounter1 );
7212
7213 callbackData->dwCounter1 = 0;
7214 hr = IDirectPlayX_EnumGroups( callbackData->pDP,
7215 (LPGUID) &lpThisSD->guidInstance,
7216 EnumGroups_cb, &callbackData,
7218 checkHR( DPERR_GENERIC, hr ); /* Why? */
7219 check( 0, callbackData->dwCounter1 );
7220
7221 return TRUE;
7222
7223}
#define DPENUMGROUPS_SESSION
Definition: dplay.h:998
static BOOL CALLBACK EnumGroups_cb(DPID dpId, DWORD dwPlayerType, LPCDPNAME lpName, DWORD dwFlags, LPVOID lpContext)
Definition: dplayx.c:7142
IDirectPlay4 * pDP
Definition: dplayx.c:98

Referenced by test_EnumGroups(), and test_EnumGroupsInGroup().

◆ EnumSessions_cb_EnumPlayers()

static BOOL CALLBACK EnumSessions_cb_EnumPlayers ( LPCDPSESSIONDESC2  lpThisSD,
LPDWORD  lpdwTimeOut,
DWORD  dwFlags,
LPVOID  lpContext 
)
static

Definition at line 6848 of file dplayx.c.

6852{
6853 lpCallbackData callbackData = lpContext;
6854 HRESULT hr;
6855
6856 if (dwFlags & DPESC_TIMEDOUT)
6857 {
6858 return FALSE;
6859 }
6860
6861 /* guid = NULL */
6862 callbackData->dwCounter1 = 0;
6864 &callbackData, 0 );
6866 check( 0, callbackData->dwCounter1 );
6867
6868 /* guid = appGuid */
6869 callbackData->dwCounter1 = 0;
6870 hr = IDirectPlayX_EnumPlayers( callbackData->pDP, (LPGUID) &appGuid,
6871 EnumPlayers_cb, &callbackData, 0 );
6873 check( 0, callbackData->dwCounter1 );
6874
6875 callbackData->dwCounter1 = 0;
6876 hr = IDirectPlayX_EnumPlayers( callbackData->pDP, (LPGUID) &appGuid,
6877 EnumPlayers_cb, &callbackData,
6880 check( 0, callbackData->dwCounter1 );
6881
6882 /* guid = guidInstance */
6883 callbackData->dwCounter1 = 0;
6884 hr = IDirectPlayX_EnumPlayers( callbackData->pDP,
6885 (LPGUID) &lpThisSD->guidInstance,
6886 EnumPlayers_cb, &callbackData, 0 );
6888 check( 0, callbackData->dwCounter1 );
6889
6890 callbackData->dwCounter1 = 0;
6891 hr = IDirectPlayX_EnumPlayers( callbackData->pDP,
6892 (LPGUID) &lpThisSD->guidInstance,
6893 EnumPlayers_cb, &callbackData,
6895 checkHR( DPERR_GENERIC, hr ); /* Why? */
6896 check( 0, callbackData->dwCounter1 );
6897
6898 return TRUE;
6899
6900}
static BOOL CALLBACK EnumPlayers_cb(DPID dpId, DWORD dwPlayerType, LPCDPNAME lpName, DWORD dwFlags, LPVOID lpContext)
Definition: dplayx.c:6811

Referenced by test_EnumPlayers().

◆ EnumSessions_cb_join()

static BOOL CALLBACK EnumSessions_cb_join ( LPCDPSESSIONDESC2  lpThisSD,
LPDWORD  lpdwTimeOut,
DWORD  dwFlags,
LPVOID  lpContext 
)
static

◆ EnumSessions_cb_join_secure()

static BOOL CALLBACK EnumSessions_cb_join_secure ( LPCDPSESSIONDESC2  lpThisSD,
LPDWORD  lpdwTimeOut,
DWORD  dwFlags,
LPVOID  lpContext 
)
static

Definition at line 5961 of file dplayx.c.

5965{
5966 IDirectPlay4 *pDP = lpContext;
5967 DPSESSIONDESC2 dpsd;
5968 DPCREDENTIALS dpCredentials;
5969 HRESULT hr;
5970
5971 if (dwFlags & DPESC_TIMEDOUT)
5972 {
5973 return FALSE;
5974 }
5975
5977
5978 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
5979 dpsd.dwSize = sizeof(DPSESSIONDESC2);
5980 dpsd.guidApplication = appGuid;
5981 dpsd.guidInstance = lpThisSD->guidInstance;
5982
5983 ZeroMemory( &dpCredentials, sizeof(DPCREDENTIALS) );
5984 dpCredentials.dwSize = sizeof(DPCREDENTIALS);
5985 dpCredentials.lpszUsernameA = (LPSTR) "user";
5986 dpCredentials.lpszPasswordA = (LPSTR) "pass";
5987 hr = IDirectPlayX_SecureOpen( pDP, &dpsd, DPOPEN_JOIN,
5988 NULL, &dpCredentials );
5989 checkHR( DPERR_LOGONDENIED, hr ); /* TODO: Make this work */
5990
5991 return TRUE;
5992}
#define IDirectPlayX_SecureOpen(p, a, b, c, d)
Definition: dplay.h:905
struct tagDPCREDENTIALS DPCREDENTIALS
DWORD dwSize
Definition: dplay.h:337
LPSTR lpszUsernameA
Definition: dplay.h:342
LPSTR lpszPasswordA
Definition: dplay.h:347

Referenced by test_GetPlayerAccount().

◆ enumSessionsAsync()

static HANDLE enumSessionsAsync ( IDirectPlay4 *  dp,
DPSESSIONDESC2 *  dpsd,
DWORD  timeout,
LPDPENUMSESSIONSCALLBACK2  callback,
void *  context,
DWORD  flags 
)
static

Definition at line 704 of file dplayx.c.

706{
708
709 param = calloc( 1, sizeof( EnumSessionsParam ) );
710
711 param->dp = dp;
712 param->dpsd = dpsd;
713 param->timeout = timeout;
714 param->callback = callback;
715 param->context = context;
716 param->flags = flags;
717
718 param->thread = CreateThread( NULL, 0, enumSessionsProc, param, 0, NULL );
719
720 return param;
721}
static DWORD CALLBACK enumSessionsProc(void *p)
Definition: dplayx.c:694
static IPrintDialogCallback callback
Definition: printdlg.c:325

Referenced by check_EnumSessions_(), check_EnumSessions_async_(), joinSession_(), and test_Open().

◆ enumSessionsAsyncWait()

static HRESULT enumSessionsAsyncWait ( EnumSessionsParam *  param,
DWORD  timeout 
)
static

Definition at line 723 of file dplayx.c.

724{
725 HRESULT hr = 0xdeadbeef;
726 DWORD waitResult;
727
728 waitResult = WaitForSingleObject( param->thread, timeout );
729 CloseHandle( param->thread );
730 if ( waitResult == WAIT_OBJECT_0 )
731 {
732 hr = param->hr;
733 free( param );
734 }
735
736 return hr;
737}

Referenced by check_EnumSessions_(), check_EnumSessions_async_(), joinSession_(), and test_Open().

◆ enumSessionsProc()

static DWORD CALLBACK enumSessionsProc ( void *  p)
static

Definition at line 694 of file dplayx.c.

695{
697
698 param->hr = IDirectPlayX_EnumSessions( param->dp, param->dpsd, param->timeout, param->callback,
699 param->context, param->flags );
700
701 return 0;
702}
#define IDirectPlayX_EnumSessions(p, a, b, c, d, e)
Definition: dplay.h:878

Referenced by enumSessionsAsync().

◆ get_temp_buffer()

static LPSTR get_temp_buffer ( void  )
static

Definition at line 114 of file dplayx.c.

115{
116 static UINT index = 0;
117 static char buff[10][256];
118
119 index = (index + 1) % 10;
120 *buff[index] = 0;
121
122 return buff[index];
123}
#define index(s, c)
Definition: various.h:29
GLuint index
Definition: glext.h:6031
static const char *static const char const char DWORD void DWORD *static const char const char DWORD void DWORD *static const char DWORD DWORD void * buff
Definition: shcore.c:41

Referenced by dpResult2str(), and dwFlags2str().

◆ getPlayerIdsCallback()

static BOOL CALLBACK getPlayerIdsCallback ( DPID  dpid,
DWORD  playerType,
const DPNAME *  name,
DWORD  flags,
void *  context 
)
static

Definition at line 4830 of file dplayx.c.

4832{
4834
4835 if ( data->idCount >= ARRAYSIZE( data->ids ) )
4836 return FALSE;
4837
4838 data->ids[ data->idCount ] = dpid;
4839 ++data->idCount;
4840
4841 return TRUE;
4842}

Referenced by checkCreatePlayerOrGroupMessages_().

◆ Guid2str()

static LPCSTR Guid2str ( const GUID *  guid)
static

Definition at line 126 of file dplayx.c.

127{
128 if (!guid) return "(null)";
129
130 /* Service providers */
131 if (IsEqualGUID(guid, &DPSPGUID_IPX))
132 return "DPSPGUID_IPX";
133 if (IsEqualGUID(guid, &DPSPGUID_TCPIP))
134 return "DPSPGUID_TCPIP";
135 if (IsEqualGUID(guid, &DPSPGUID_SERIAL))
136 return "DPSPGUID_SERIAL";
137 if (IsEqualGUID(guid, &DPSPGUID_MODEM))
138 return "DPSPGUID_MODEM";
139 /* DirectPlay Address IDs */
140 if (IsEqualGUID(guid, &DPAID_TotalSize))
141 return "DPAID_TotalSize";
142 if (IsEqualGUID(guid, &DPAID_ServiceProvider))
143 return "DPAID_ServiceProvider";
144 if (IsEqualGUID(guid, &DPAID_LobbyProvider))
145 return "DPAID_LobbyProvider";
146 if (IsEqualGUID(guid, &DPAID_Phone))
147 return "DPAID_Phone";
148 if (IsEqualGUID(guid, &DPAID_PhoneW))
149 return "DPAID_PhoneW";
150 if (IsEqualGUID(guid, &DPAID_Modem))
151 return "DPAID_Modem";
152 if (IsEqualGUID(guid, &DPAID_ModemW))
153 return "DPAID_ModemW";
154 if (IsEqualGUID(guid, &DPAID_INet))
155 return "DPAID_INet";
156 if (IsEqualGUID(guid, &DPAID_INetW))
157 return "DPAID_INetW";
158 if (IsEqualGUID(guid, &DPAID_INetPort))
159 return "DPAID_INetPort";
160 if (IsEqualGUID(guid, &DPAID_ComPort))
161 return "DPAID_ComPort";
162
163 return wine_dbgstr_guid(guid);
164}

◆ HRESULT()

static HRESULT ( WINAPI *  pDirectPlayEnumerateA)
static

◆ init_TCPIP_provider()

static void init_TCPIP_provider ( IDirectPlay4 *  pDP,
LPCSTR  strIPAddressString,
WORD  port 
)
static

Definition at line 2288 of file dplayx.c.

2289{
2290
2291 DPCOMPOUNDADDRESSELEMENT addressElements[3];
2292 LPVOID pAddress = NULL;
2293 DWORD dwAddressSize = 0;
2294 IDirectPlayLobby3 *pDPL;
2295 HRESULT hr;
2296
2297 hr = CoCreateInstance( &CLSID_DirectPlayLobby, NULL, CLSCTX_ALL,
2298 &IID_IDirectPlayLobby3A, (LPVOID*) &pDPL );
2299 ok (SUCCEEDED (hr), "CCI of CLSID_DirectPlayLobby / IID_IDirectPlayLobby3A failed\n");
2300 if (FAILED (hr)) return;
2301
2302 /* Service provider */
2303 addressElements[0].guidDataType = DPAID_ServiceProvider;
2304 addressElements[0].dwDataSize = sizeof(GUID);
2305 addressElements[0].lpData = (LPVOID) &DPSPGUID_TCPIP;
2306
2307 /* IP address string */
2308 addressElements[1].guidDataType = DPAID_INet;
2309 addressElements[1].dwDataSize = lstrlenA(strIPAddressString) + 1;
2310 addressElements[1].lpData = (LPVOID) strIPAddressString;
2311
2312 /* Optional Port number */
2313 if( port > 0 )
2314 {
2315 addressElements[2].guidDataType = DPAID_INetPort;
2316 addressElements[2].dwDataSize = sizeof(WORD);
2317 addressElements[2].lpData = &port;
2318 }
2319
2320
2321 hr = IDirectPlayLobby_CreateCompoundAddress( pDPL, addressElements, 2,
2322 NULL, &dwAddressSize );
2324
2325 if( hr == DPERR_BUFFERTOOSMALL )
2326 {
2327 pAddress = calloc( 1, dwAddressSize );
2328 hr = IDirectPlayLobby_CreateCompoundAddress( pDPL, addressElements, 2,
2329 pAddress, &dwAddressSize );
2330 checkHR( DP_OK, hr );
2331 }
2332
2333 hr = IDirectPlayX_InitializeConnection( pDP, pAddress, 0 );
2334 checkHR( DP_OK, hr );
2335
2336 free( pAddress );
2338}
#define IDirectPlayLobby_CreateCompoundAddress(p, a, b, c, d)
Definition: dplobby.h:470
unsigned short WORD
Definition: ntddk_ex.h:93
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define LPVOID
Definition: nt_native.h:45

Referenced by create_session(), test_ADDFORWARD(), test_AddPlayerToGroup(), test_CreateGroup(), test_CreatePlayer(), test_CREATEPLAYER(), test_EnumGroups(), test_EnumGroupsInGroup(), test_EnumPlayers(), test_EnumSessions(), test_GetCaps(), test_GetMessageCount(), test_GetMessageQueue(), test_GetPlayerAccount(), test_GetPlayerAddress(), test_GetPlayerCaps(), test_GetPlayerFlags(), test_GROUPDATACHANGED(), test_GroupOwner(), test_groups_cs(), test_groups_p2p(), test_host_migration(), test_interactive_CreatePlayer(), test_interactive_EnumSessions(), test_interactive_GetMessageQueue(), test_interactive_Open(), test_interactive_Receive(), test_interactive_Send(), test_Open(), test_PING(), test_PlayerData(), test_PlayerName(), test_Receive(), test_remote_data_replication(), test_Send(), and test_SessionDesc().

◆ is_firewall_enabled()

static BOOL is_firewall_enabled ( void  )
static

Definition at line 10574 of file dplayx.c.

10575{
10576 HRESULT hr, init;
10577 INetFwMgr *mgr = NULL;
10580 VARIANT_BOOL enabled = VARIANT_FALSE;
10581
10583
10584 hr = CoCreateInstance( &CLSID_NetFwMgr, NULL, CLSCTX_INPROC_SERVER, &IID_INetFwMgr,
10585 (void **)&mgr );
10586 ok( hr == S_OK, "got %08lx\n", hr );
10587 if (hr != S_OK) goto done;
10588
10589 hr = INetFwMgr_get_LocalPolicy( mgr, &policy );
10590 ok( hr == S_OK, "got %08lx\n", hr );
10591 if (hr != S_OK) goto done;
10592
10593 hr = INetFwPolicy_get_CurrentProfile( policy, &profile );
10594 if (hr != S_OK) goto done;
10595
10596 hr = INetFwProfile_get_FirewallEnabled( profile, &enabled );
10597 ok( hr == S_OK, "got %08lx\n", hr );
10598
10599done:
10600 if (policy) INetFwPolicy_Release( policy );
10601 if (profile) INetFwProfile_Release( profile );
10602 if (mgr) INetFwMgr_Release( mgr );
10603 if (SUCCEEDED( init )) CoUninitialize();
10604 return (enabled == VARIANT_TRUE);
10605}
WINBASEAPI _Check_return_ _Out_ AppPolicyProcessTerminationMethod * policy
Definition: appmodel.h:78
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(void *reserved, DWORD model)
Definition: combase.c:2803
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
short VARIANT_BOOL
Definition: compat.h:2290
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
#define S_OK
Definition: intsafe.h:52
#define profile
Definition: kernel32.h:12
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:279
static int init
Definition: wintirpc.c:33

Referenced by START_TEST().

◆ is_process_elevated()

static BOOL is_process_elevated ( void  )
static

Definition at line 10558 of file dplayx.c.

10559{
10560 HANDLE token;
10562 {
10564 DWORD size;
10565 BOOL ret;
10566
10568 CloseHandle( token );
10569 return (ret && type == TokenElevationTypeFull);
10570 }
10571 return FALSE;
10572}
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:411
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:294
#define GetCurrentProcess()
Definition: compat.h:759
return ret
Definition: mutex.c:147
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
enum _TOKEN_ELEVATION_TYPE TOKEN_ELEVATION_TYPE
@ TokenElevationTypeFull
Definition: winnt_old.h:2718
#define TOKEN_QUERY
Definition: setypes.h:940
@ TokenElevationType
Definition: setypes.h:995

Referenced by START_TEST(), test_appsearch_complocator(), test_command_line_parsing(), test_concurrentinstall(), test_create_remove_folder(), test_create_remove_shortcut(), test_delete_services(), test_duplicate_files(), test_envvar(), test_find_related_products(), test_ini_values(), test_install_remove_odbc(), test_install_services(), test_Installer_InstallProduct(), test_move_files(), test_MsiConfigureProductEx(), test_MsiEnumComponents(), test_MsiEnumComponentsEx(), test_MsiEnumProducts(), test_MsiGetFeatureInfo(), test_MsiProvideComponent(), test_MsiProvideQualifiedComponentEx(), test_MsiSetFeatureAttributes(), test_MsiSourceListAddMediaDisk(), test_MsiSourceListAddSource(), test_MsiSourceListAddSourceEx(), test_MsiSourceListSetInfo(), test_patch_registration(), test_process_components(), test_publish(), test_publish_assemblies(), test_publish_components(), test_publish_features(), test_publish_product(), test_publish_sourcelist(), test_register_class_info(), test_register_extension_info(), test_register_font(), test_register_mime_info(), test_register_product(), test_register_progid_info(), test_register_typelib(), test_register_user(), test_remove_duplicate_files(), test_remove_existing_products(), test_remove_files(), test_self_registration(), test_setpropertyfolder(), test_simple_patch(), test_sourcedir_props(), test_states(), test_system_tables(), test_validate_product_id(), and test_write_registry_values().

◆ is_stub_dll()

static BOOL is_stub_dll ( const char *  filename)
static

Definition at line 10707 of file dplayx.c.

10708{
10709 UINT size;
10710 DWORD ver;
10711 BOOL isstub = FALSE;
10712 char *p, *data;
10713
10715 if (!size) return FALSE;
10716
10717 data = malloc(size);
10718 if (!data) return FALSE;
10719
10721 {
10722 char buf[256];
10723
10724 sprintf(buf, "\\StringFileInfo\\%04x%04x\\OriginalFilename", MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 1200);
10725 if (VerQueryValueA(data, buf, (void**)&p, &size))
10726 isstub = !lstrcmpiA("wcodstub.dll", p);
10727 }
10728 free(data);
10729
10730 return isstub;
10731}
#define malloc
Definition: debug_ros.c:4
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4133
DWORD WINAPI GetFileVersionInfoSizeA(LPCSTR filename, LPDWORD handle)
Definition: version.c:746
BOOL WINAPI VerQueryValueA(LPCVOID pBlock, LPCSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
Definition: version.c:1115
BOOL WINAPI GetFileVersionInfoA(LPCSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition: version.c:975
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
const char * filename
Definition: ioapi.h:137
#define MAKELANGID(p, s)
Definition: nls.h:15
#define LANG_ENGLISH
Definition: nls.h:52
#define SUBLANG_ENGLISH_US
Definition: nls.h:222

Referenced by START_TEST().

◆ joinSession_()

static void joinSession_ ( int  line,
IDirectPlay4 *  dp,
DPSESSIONDESC2 *  dpsd,
DPSESSIONDESC2 *  serverDpsd,
SOCKET *  sendSock,
SOCKET *  recvSock,
unsigned short *  udpPort 
)
static

Definition at line 3572 of file dplayx.c.

3574{
3575 EnumSessionsParam *enumSessionsParam;
3576 OpenParam *openParam;
3577 unsigned short port;
3578 SOCKET listenSock;
3579 SOCKET enumSock;
3580 int tryIndex;
3581 HRESULT hr;
3582
3583 enumSock = bindUdp_( line, 47624 );
3584
3585 listenSock = listenTcp_( line, 2349 );
3586
3587 for ( tryIndex = 0; ; ++tryIndex )
3588 {
3589 int count = 0;
3590
3591 enumSessionsParam = enumSessionsAsync( dp, dpsd, 100, countSessionsCallback, &count, 0 );
3592
3593 port = receiveEnumSessionsRequest_( line, enumSock, &appGuid, NULL, 0 );
3594
3595 *sendSock = connectTcp_( line, port );
3596
3597 sendEnumSessionsReply_( line, *sendSock, 2349, serverDpsd );
3598
3599 hr = enumSessionsAsyncWait( enumSessionsParam, 2000 );
3600 ok_( __FILE__, line )( hr == DP_OK, "EnumSessions() returned %#lx.\n", hr );
3601
3602 if ( tryIndex < 19 && count < 1 )
3603 continue;
3604
3605 ok( count == 1, "got session count %d.\n", count );
3606
3607 break;
3608 }
3609
3610 openParam = openAsync( dp, dpsd, DPOPEN_JOIN );
3611
3612 *recvSock = acceptTcp_( line, listenSock );
3613 ok_( __FILE__, line )( *recvSock != INVALID_SOCKET, "accept() returned %#Ix.\n", *recvSock );
3614
3615 receiveRequestPlayerId_( line, *recvSock, 0x9 );
3616 sendRequestPlayerReply_( line, *sendSock, 2349, 0x12345678, DP_OK );
3617 receiveAddForwardRequest_( line, *recvSock, 0x12345678, L"", serverDpsd->dwReserved1, udpPort );
3618 sendSuperEnumPlayersReply_( line, *sendSock, 2349, 2399, serverDpsd, L"normal" );
3619 checkNoMoreMessages_( line, *recvSock );
3620
3621 checkNoMoreAccepts_( line, listenSock );
3622
3623 hr = openAsyncWait( openParam, 2000 );
3624 ok_( __FILE__, line )( hr == DP_OK, "Open() returned %#lx.\n", hr );
3625
3626 closesocket( listenSock );
3627 closesocket( enumSock );
3628}
static BOOL CALLBACK countSessionsCallback(const DPSESSIONDESC2 *thisSd, DWORD *timeout, DWORD flags, void *context)
Definition: dplayx.c:3271

◆ listenTcp_()

static SOCKET listenTcp_ ( int  line,
unsigned short  port 
)
static

Definition at line 1047 of file dplayx.c.

1048{
1049 u_long nbio = 1;
1051 int wsResult;
1052 SOCKET sock;
1053
1055 ok_( __FILE__, line)( sock != INVALID_SOCKET, "got TCP listen socket %#Ix.\n", sock );
1056
1057 memset( &addr, 0, sizeof( addr ) );
1058 addr.sin_family = AF_INET;
1059 addr.sin_port = htons( port );
1060 addr.sin_addr.s_addr = INADDR_ANY;
1061
1062 wsResult = bind( sock, (SOCKADDR *) &addr, sizeof( addr ) );
1063 ok_( __FILE__, line )( wsResult != SOCKET_ERROR, "bind() returned %d.\n", wsResult );
1064
1065 wsResult = listen( sock, SOMAXCONN );
1066 ok_( __FILE__, line )( wsResult != SOCKET_ERROR, "listen() returned %d.\n", wsResult );
1067
1068 wsResult = ioctlsocket( sock, FIONBIO, &nbio );
1069 ok_( __FILE__, line)( wsResult != SOCKET_ERROR, "ioctlsocket() returned %d.\n", wsResult );
1070
1071 return sock;
1072}
INT WSAAPI listen(IN SOCKET s, IN INT backlog)
Definition: sockctrl.c:123
#define SOMAXCONN
Definition: winsock.h:393

Referenced by check_Open_(), and joinSession_().

◆ openAsync()

static OpenParam * openAsync ( IDirectPlay4 *  dp,
DPSESSIONDESC2 *  dpsd,
DWORD  flags 
)
static

Definition at line 759 of file dplayx.c.

760{
762
763 param = calloc( 1, sizeof( OpenParam ) );
764
765 param->dp = dp;
766 param->dpsd = dpsd;
767 param->flags = flags;
768
769 param->thread = CreateThread( NULL, 0, openProc, param, 0, NULL );
770
771 return param;
772}
static DWORD CALLBACK openProc(void *p)
Definition: dplayx.c:750

Referenced by check_Open_(), and joinSession_().

◆ openAsyncWait()

static HRESULT openAsyncWait ( OpenParam *  param,
DWORD  timeout 
)
static

Definition at line 774 of file dplayx.c.

775{
776 HRESULT hr = 0xdeadbeef;
777 DWORD waitResult;
778
779 waitResult = WaitForSingleObject( param->thread, timeout );
780 CloseHandle( param->thread );
781 if ( waitResult == WAIT_OBJECT_0 )
782 {
783 hr = param->hr;
784 free( param );
785 }
786
787 return hr;
788}

Referenced by check_Open_(), and joinSession_().

◆ openProc()

static DWORD CALLBACK openProc ( void *  p)
static

Definition at line 750 of file dplayx.c.

751{
752 OpenParam *param = p;
753
754 param->hr = IDirectPlayX_Open( param->dp, param->dpsd, param->flags );
755
756 return 0;
757}

Referenced by openAsync().

◆ receiveAddForwardAck_()

static unsigned short receiveAddForwardAck_ ( int  line,
SOCKET  sock,
DPID  expectedPlayerId 
)
static

Definition at line 1812 of file dplayx.c.

1813{
1814#include "pshpack1.h"
1815 struct
1816 {
1817 SpHeader spHeader;
1819 } request;
1820#include "poppack.h"
1821 unsigned short port;
1822 int wsResult;
1823
1824 wsResult = receiveMessage_( line, sock, &request, sizeof( request ) );
1825 ok_( __FILE__, line )( wsResult == sizeof( request ), "recv() returned %d.\n", wsResult );
1826
1827 port = checkSpHeader_( line, &request.spHeader, sizeof( request ) );
1828 checkMessageHeader_( line, &request.request.header, 47 );
1829
1830 return port;
1831}
static int receiveMessage_(int line, SOCKET sock, void *buffer, int size)
Definition: dplayx.c:1151
static unsigned short checkSpHeader_(int line, SpHeader *header, DWORD expectedSize)
Definition: dplayx.c:1190
static void checkMessageHeader_(int line, MessageHeader *header, WORD expectedCommand)
Definition: dplayx.c:1202
Definition: tftpd.h:86

◆ receiveAddForwardRequest_()

static unsigned short receiveAddForwardRequest_ ( int  line,
SOCKET  sock,
DPID  expectedPlayerId,
const WCHAR *  expectedPassword,
DWORD  expectedTickCount,
unsigned short *  udpPort 
)
static

Definition at line 1421 of file dplayx.c.

1424{
1425#include "pshpack1.h"
1426 struct
1427 {
1428 SpHeader spHeader;
1430 } request;
1431#include "poppack.h"
1432 DWORD expectedPasswordSize;
1433 WCHAR password[ 256 ];
1434 unsigned short port;
1435 DWORD expectedSize;
1436 DWORD tickCount;
1437 int wsResult;
1438
1439 expectedPasswordSize = (lstrlenW( expectedPassword ) + 1) * sizeof( WCHAR );
1440 expectedSize = sizeof( request ) + expectedPasswordSize + sizeof( DWORD );
1441
1442 wsResult = receiveMessage_( line, sock, &request, sizeof( request ) );
1443 ok_( __FILE__, line )( wsResult == sizeof( request ), "recv() returned %d.\n", wsResult );
1444 if ( wsResult == SOCKET_ERROR )
1445 return 0;
1446
1447 port = checkSpHeader_( line, &request.spHeader, expectedSize );
1448 checkMessageHeader_( line, &request.request.header, 19 );
1449 ok_( __FILE__, line )( !request.request.toId, "got destination id %#lx.\n", request.request.toId );
1450 ok_( __FILE__, line )( request.request.playerId == expectedPlayerId, "got player id %#lx.\n",
1451 request.request.playerId );
1452 ok_( __FILE__, line )( !request.request.groupId, "got group id %#lx.\n", request.request.groupId );
1453 ok_( __FILE__, line )( request.request.createOffset == 28, "got create offset %lu.\n",
1454 request.request.createOffset );
1455 ok_( __FILE__, line )( request.request.passwordOffset == 108, "got password offset %lu.\n",
1456 request.request.passwordOffset );
1457 checkPackedPlayer_( line, &request.request.playerInfo, 0x9, expectedPlayerId, 0, 0, 0, expectedPlayerId );
1458 checkSpData_( line, &request.request.spData, udpPort );
1459
1460 wsResult = receiveMessage_( line, sock, password, expectedPasswordSize );
1461
1462 ok_( __FILE__, line )( wsResult == expectedPasswordSize, "recv() returned %d.\n", wsResult );
1463 ok_( __FILE__, line )( !lstrcmpW( password, expectedPassword ), "got password %s.\n", wine_dbgstr_w( password ) );
1464
1465 wsResult = receiveMessage_( line, sock, &tickCount, sizeof( DWORD ) );
1466
1467 ok_( __FILE__, line )( wsResult == sizeof( DWORD ), "recv() returned %d.\n", wsResult );
1468 ok_( __FILE__, line )( tickCount == expectedTickCount, "got tick count %#lx.\n", tickCount );
1469
1470 return port;
1471}
static UCHAR password[]
Definition: bcrypt.c:520
#define lstrlenW
Definition: compat.h:750
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
static void checkSpData_(int line, SpData *spData, unsigned short *udpPort)
Definition: dplayx.c:1209
#define DWORD
Definition: nt_native.h:44

Referenced by check_Open_(), and joinSession_().

◆ receiveAddPlayerToGroup_()

static unsigned short receiveAddPlayerToGroup_ ( int  line,
SOCKET  sock,
DPID  expectedPlayerId,
DPID  expectedGroupId 
)
static

Definition at line 2213 of file dplayx.c.

2214{
2215#include "pshpack1.h"
2216 struct
2217 {
2218 SpHeader spHeader;
2220 } request;
2221#include "poppack.h"
2222 unsigned short port;
2223 int wsResult;
2224
2225 wsResult = receiveMessage_( line, sock, &request, sizeof( request ) );
2226 ok_( __FILE__, line )( wsResult == sizeof( request ), "recv() returned %d.\n", wsResult );
2227
2228 port = checkSpHeader_( line, &request.spHeader, sizeof( request ) );
2229 checkMessageHeader_( line, &request.request.header, 13 );
2230
2231 ok_( __FILE__, line )( !request.request.toId, "got destination id %#lx.\n", request.request.toId );
2232 ok_( __FILE__, line )( request.request.playerId == expectedPlayerId, "got player id %#lx.\n",
2233 request.request.playerId );
2234 ok_( __FILE__, line )( request.request.groupId == expectedGroupId, "got group id %#lx.\n",
2235 request.request.groupId );
2236 ok_( __FILE__, line )( !request.request.createOffset, "got create offset %lu.\n", request.request.createOffset );
2237 ok_( __FILE__, line )( !request.request.passwordOffset, "got password offset %lu.\n", request.request.passwordOffset );
2238
2239 return port;
2240}

◆ receiveCreatePlayer_()

static unsigned short receiveCreatePlayer_ ( int  line,
SOCKET  sock,
DPID  expectedPlayerId,
DWORD  expectedFlags,
const WCHAR *  expectedShortName,
const WCHAR *  expectedLongName,
void *  expectedPlayerData,
DWORD  expectedPlayerDataSize 
)
static

Definition at line 1837 of file dplayx.c.

1840{
1841#include "pshpack1.h"
1842 struct
1843 {
1844 SpHeader spHeader;
1846 } request;
1847#include "poppack.h"
1848 DWORD expectedShortNameSize;
1849 DWORD expectedLongNameSize;
1850 WCHAR shortName[ 256 ];
1851 BYTE playerData[ 256 ];
1852 WCHAR longName[ 256 ];
1853 unsigned short port;
1854 DWORD expectedSize;
1856 WORD reserved1;
1857 SpData spData;
1858 int wsResult;
1859
1860 expectedShortNameSize = expectedShortName ? (lstrlenW( expectedShortName ) + 1) * sizeof( WCHAR ) : 0;
1861 expectedLongNameSize = expectedLongName ? (lstrlenW( expectedLongName ) + 1) * sizeof( WCHAR ) : 0;
1862 expectedSize = sizeof( request ) + expectedShortNameSize + expectedLongNameSize + sizeof( spData )
1863 + expectedPlayerDataSize + sizeof( reserved1 ) + sizeof( reserved2 );
1864
1865 wsResult = receiveMessage_( line, sock, &request, sizeof( request ) );
1866 ok_( __FILE__, line )( wsResult == sizeof( request ), "recv() returned %d.\n", wsResult );
1867
1868 port = checkSpHeader_( line, &request.spHeader, expectedSize );
1869 checkMessageHeader_( line, &request.request.header, 8 );
1870 ok_( __FILE__, line )( !request.request.toId, "got destination id %#lx.\n", request.request.toId );
1871 ok_( __FILE__, line )( request.request.playerId == expectedPlayerId, "got player id %#lx.\n",
1872 request.request.playerId );
1873 ok_( __FILE__, line )( !request.request.groupId, "got group id %#lx.\n", request.request.groupId );
1874 ok_( __FILE__, line )( request.request.createOffset == 28, "got create offset %lu.\n",
1875 request.request.createOffset );
1876 ok_( __FILE__, line )( !request.request.passwordOffset, "got password offset %lu.\n",
1877 request.request.passwordOffset );
1878 checkPackedPlayer_( line, &request.request.playerInfo, expectedFlags, expectedPlayerId, expectedShortNameSize,
1879 expectedLongNameSize, expectedPlayerDataSize, 0x12345678 );
1880
1881 if ( expectedShortName )
1882 {
1883 wsResult = receiveMessage_( line, sock, shortName, expectedShortNameSize );
1884
1885 ok_( __FILE__, line )( wsResult == expectedShortNameSize, "recv() returned %d.\n", wsResult );
1886 ok_( __FILE__, line )( !lstrcmpW( shortName, expectedShortName ), "got short name %s.\n",
1887 wine_dbgstr_w( shortName ) );
1888 }
1889
1890 if ( expectedLongName )
1891 {
1892 wsResult = receiveMessage_( line, sock, longName, expectedLongNameSize );
1893
1894 ok_( __FILE__, line )( wsResult == expectedLongNameSize, "recv() returned %d.\n", wsResult );
1895 ok_( __FILE__, line )( !lstrcmpW( longName, expectedLongName ), "got long name %s.\n",
1896 wine_dbgstr_w( longName ) );
1897 }
1898
1899 wsResult = receiveMessage_( line, sock, &spData, sizeof( spData ) );
1900 ok_( __FILE__, line )( wsResult == sizeof( spData ), "recv() returned %d.\n", wsResult );
1901 checkSpData_( line, &spData, NULL );
1902
1903 if ( expectedPlayerDataSize )
1904 {
1905 wsResult = receiveMessage_( line, sock, playerData, expectedPlayerDataSize );
1906
1907 ok_( __FILE__, line )( wsResult == expectedPlayerDataSize, "recv() returned %d.\n", wsResult );
1908 ok_( __FILE__, line )( !memcmp( playerData, expectedPlayerData, expectedPlayerDataSize ),
1909 "player data didn't match.\n" );
1910 }
1911
1912 wsResult = receiveMessage_( line, sock, &reserved1, sizeof( reserved1 ) );
1913
1914 ok_( __FILE__, line )( wsResult == sizeof( reserved1 ), "recv() returned %d.\n", wsResult );
1915 ok_( __FILE__, line )( !reserved1, "got reserved1 %d.\n", reserved1 );
1916
1917 wsResult = receiveMessage_( line, sock, &reserved2, sizeof( reserved2 ) );
1918
1919 ok_( __FILE__, line )( wsResult == sizeof( reserved2 ), "recv() returned %d.\n", wsResult );
1920 ok_( __FILE__, line )( !reserved2, "got reserved2 %lu.\n", reserved2 );
1921
1922 return port;
1923}
uint8_t reserved2[12]
Definition: fsck.fat.h:23

Referenced by check_CreatePlayer_(), and createPlayer_().

◆ receiveEnumSessionsRequest_()

static unsigned short receiveEnumSessionsRequest_ ( int  line,
SOCKET  sock,
const GUID *  expectedAppGuid,
const WCHAR *  expectedPassword,
DWORD  expectedFlags 
)
static

Definition at line 1264 of file dplayx.c.

1266{
1267#include "pshpack1.h"
1268 struct
1269 {
1270 SpHeader spHeader;
1272 WCHAR password[ 256 ];
1273 } request;
1274#include "poppack.h"
1275 DWORD expectedPasswordSize;
1276 unsigned short port;
1277 DWORD expectedSize;
1278 int wsResult;
1279
1280 expectedPasswordSize = expectedPassword ? (lstrlenW( expectedPassword ) + 1) * sizeof( WCHAR ) : 0;
1281 expectedSize = sizeof( request.spHeader ) + sizeof( request.request ) + expectedPasswordSize;
1282
1283 wsResult = receiveMessage_( line, sock, &request, sizeof( request ) );
1284 ok_( __FILE__, line )( wsResult == expectedSize, "recv() returned %d.\n", wsResult );
1285 if ( wsResult == SOCKET_ERROR )
1286 return 0;
1287
1288 port = checkSpHeader_( line, &request.spHeader, expectedSize );
1289 checkMessageHeader_( line, &request.request.header, 2 );
1290 ok_( __FILE__, line )( IsEqualGUID( &request.request.appGuid, expectedAppGuid ), "got app guid %s.\n",
1291 wine_dbgstr_guid( &request.request.appGuid ) );
1292 if ( expectedPassword )
1293 {
1294 ok_( __FILE__, line )( request.request.passwordOffset == 32, "got password offset %lu.\n",
1295 request.request.passwordOffset );
1296 ok_( __FILE__, line )( !lstrcmpW( request.password, expectedPassword ), "got password %s.\n",
1298 }
1299 else
1300 {
1301 ok_( __FILE__, line )( !request.request.passwordOffset, "got password offset %lu.\n",
1302 request.request.passwordOffset );
1303 }
1304 ok_( __FILE__, line )( request.request.flags == expectedFlags, "got flags %#lx.\n", request.request.flags );
1305
1306 return port;
1307}
enum request_flags flags
WCHAR * password

Referenced by check_EnumSessions_(), check_EnumSessions_async_(), and joinSession_().

◆ receiveGameMessage_()

static void receiveGameMessage_ ( int  line,
SOCKET  sock,
DPID  expectedFromId,
DPID  expectedToId,
void *  expectedData,
DWORD  expectedDataSize 
)
static

Definition at line 2059 of file dplayx.c.

2061{
2062#include "pshpack1.h"
2063 struct
2064 {
2066 BYTE data[ 256 ];
2067 } request;
2068#include "poppack.h"
2069 int wsResult;
2070
2071 DWORD expectedSize = sizeof( request.request ) + expectedDataSize;
2072
2073 wsResult = receiveMessage_( line, sock, &request, expectedSize );
2074 ok_( __FILE__, line )( wsResult == expectedSize, "recv() returned %d.\n", wsResult );
2075
2076 checkGameMessage_( line, &request.request, expectedFromId, expectedToId );
2077 ok_( __FILE__, line )( !memcmp( &request.data, expectedData, expectedDataSize ), "message data didn't match.\n" );
2078}
static void checkGameMessage_(int line, GameMessage *message, DPID expectedFromId, DPID expectedToId)
Definition: dplayx.c:1256

◆ receiveGuaranteedGameMessage_()

static unsigned short receiveGuaranteedGameMessage_ ( int  line,
SOCKET  sock,
DPID  expectedFromId,
DPID  expectedToId,
void *  expectedData,
DWORD  expectedDataSize 
)
static

Definition at line 2031 of file dplayx.c.

2033{
2034#include "pshpack1.h"
2035 struct
2036 {
2037 SpHeader spHeader;
2039 BYTE data[ 256 ];
2040 } request;
2041#include "poppack.h"
2042 unsigned short port;
2043 int wsResult;
2044
2045 DWORD expectedSize = sizeof( request.spHeader ) + sizeof( request.request ) + expectedDataSize;
2046
2047 wsResult = receiveMessage_( line, sock, &request, expectedSize );
2048 ok_( __FILE__, line )( wsResult == expectedSize, "recv() returned %d.\n", wsResult );
2049
2050 port = checkSpHeader_( line, &request.spHeader, expectedSize );
2051 checkGameMessage_( line, &request.request, expectedFromId, expectedToId );
2052 ok_( __FILE__, line )( !memcmp( &request.data, expectedData, expectedDataSize ), "message data didn't match.\n" );
2053
2054 return port;
2055}

◆ receiveMessage_()

static int receiveMessage_ ( int  line,
SOCKET  sock,
void *  buffer,
int  size 
)
static

Definition at line 1151 of file dplayx.c.

1152{
1153 struct timeval timeout;
1154 int recvResult;
1155 int wsResult;
1156 fd_set fds;
1157
1158 FD_ZERO( &fds );
1159 FD_SET( sock, &fds );
1160 timeout.tv_sec = 2;
1161 timeout.tv_usec = 0;
1162 wsResult = select( sock + 1, &fds, NULL, &fds, &timeout );
1163 ok_( __FILE__, line )( wsResult != SOCKET_ERROR, "select() returned %d.\n", wsResult );
1164
1165 memset( buffer, 0xcc, size );
1166 recvResult = recv( sock, buffer, size, 0 );
1167
1168 return recvResult;
1169}

Referenced by receiveAddForwardAck_(), receiveAddForwardRequest_(), receiveAddPlayerToGroup_(), receiveCreatePlayer_(), receiveEnumSessionsRequest_(), receiveGameMessage_(), receiveGuaranteedGameMessage_(), receivePingReply_(), and receiveRequestPlayerId_().

◆ receivePingReply_()

static unsigned short receivePingReply_ ( int  line,
SOCKET  sock,
DPID  expectedFromId,
DWORD  expectedTickCount 
)
static

Definition at line 2187 of file dplayx.c.

2188{
2189#include "pshpack1.h"
2190 struct
2191 {
2192 SpHeader spHeader;
2193 Ping request;
2194 } request;
2195#include "poppack.h"
2196 unsigned short port;
2197 int wsResult;
2198
2199 wsResult = receiveMessage_( line, sock, &request, sizeof( request ) );
2200 ok_( __FILE__, line )( wsResult == sizeof( request ), "recv() returned %d.\n", wsResult );
2201
2202 port = checkSpHeader_( line, &request.spHeader, sizeof( request ) );
2203 checkMessageHeader_( line, &request.request.header, 23 );
2204 ok_( __FILE__, line )( request.request.fromId == expectedFromId, "got source id %#lx.\n", request.request.fromId );
2205 ok_( __FILE__, line )( request.request.tickCount == expectedTickCount, "got tick count %#lx.\n",
2206 request.request.tickCount );
2207
2208 return port;
2209}
Definition: dplayx.c:996

◆ receiveRequestPlayerId_()

static unsigned short receiveRequestPlayerId_ ( int  line,
SOCKET  sock,
DWORD  expectedFlags 
)
static

Definition at line 1359 of file dplayx.c.

1360{
1361#include "pshpack1.h"
1362 struct
1363 {
1364 SpHeader spHeader;
1366 } request;
1367#include "poppack.h"
1368 unsigned short port;
1369 int wsResult;
1370
1371 wsResult = receiveMessage_( line, sock, &request, sizeof( request ) );
1372 ok_( __FILE__, line )( wsResult == sizeof( request ), "recv() returned %d.\n", wsResult );
1373
1374 port = checkSpHeader_( line, &request.spHeader, sizeof( request ) );
1375 checkMessageHeader_( line, &request.request.header, 5 );
1376 ok_( __FILE__, line )( request.request.flags == expectedFlags, "got flags %#lx.\n", request.request.flags );
1377
1378 return port;
1379}

Referenced by check_CreatePlayer_(), check_Open_(), createPlayer_(), and joinSession_().

◆ sendAddForward_()

static void sendAddForward_ ( int  line,
SOCKET  sock,
unsigned short  port,
unsigned short  tcpPort,
unsigned short  udpPort 
)
static

Definition at line 1743 of file dplayx.c.

1744{
1745#include "pshpack1.h"
1746 struct
1747 {
1748 SpHeader spHeader;
1749 AddForward reply;
1750 } reply =
1751 {
1752 .spHeader =
1753 {
1754 .mixed = 0xfab00000 + sizeof( reply ),
1755 .addr =
1756 {
1757 .sin_family = AF_INET,
1758 .sin_port = htons( port ),
1759 },
1760 },
1761 .reply =
1762 {
1763 .header =
1764 {
1765 .magic = 0x79616c70,
1766 .command = 46,
1767 .version = 14,
1768 },
1769 .toId = 0,
1770 .playerId = 0x07734,
1771 .groupId = 0,
1772 .createOffset = 28,
1773 .passwordOffset = 0,
1774 .playerInfo =
1775 {
1776 .size = 48 + sizeof( SpData ),
1777 .flags = 0x5,
1778 .id = 0x07734,
1779 .shortNameLength = 0,
1780 .longNameLength = 0,
1781 .spDataSize = sizeof( SpData ),
1782 .playerDataSize = 0,
1783 .playerCount = 0,
1784 .systemPlayerId = 0x07734,
1785 .fixedSize = 48,
1786 .playerVersion = 14,
1787 .parentId = 0,
1788 },
1789 .spData = {
1790 .tcpAddr =
1791 {
1792 .sin_family = AF_INET,
1793 .sin_port = htons( tcpPort ),
1794 },
1795 .udpAddr =
1796 {
1797 .sin_family = AF_INET,
1798 .sin_port = htons( udpPort ),
1799 },
1800 },
1801 },
1802 };
1803#include "poppack.h"
1804
1805 int wsResult;
1806
1807 wsResult = send( sock, (char *) &reply, sizeof( reply ), 0 );
1808 ok_( __FILE__, line )( wsResult == sizeof( reply ), "send() returned %d.\n", wsResult );
1809}
INT WSAAPI send(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags)
Definition: send.c:23

◆ sendAddForwardReply_()

static void sendAddForwardReply_ ( int  line,
SOCKET  sock,
unsigned short  port,
HRESULT  result 
)
static

Definition at line 1706 of file dplayx.c.

1707{
1708#include "pshpack1.h"
1709 struct
1710 {
1711 SpHeader spHeader;
1712 AddForwardReply reply;
1713 } reply =
1714 {
1715 .spHeader =
1716 {
1717 .mixed = 0xfab00000 + sizeof( reply ),
1718 .addr =
1719 {
1720 .sin_family = AF_INET,
1721 .sin_port = htons( port ),
1722 },
1723 },
1724 .reply =
1725 {
1726 .header =
1727 {
1728 .magic = 0x79616c70,
1729 .command = 36,
1730 .version = 14,
1731 },
1732 .result = result,
1733 },
1734 };
1735#include "poppack.h"
1736 int wsResult;
1737
1738 wsResult = send( sock, (char *) &reply, sizeof( reply ), 0 );
1739 ok_( __FILE__, line )( wsResult == sizeof( reply ), "send() returned %d.\n", wsResult );
1740}

Referenced by check_Open_().

◆ sendCreatePlayer_()

static void sendCreatePlayer_ ( int  line,
SOCKET  sock,
unsigned short  tcpPort,
unsigned short  udpPort,
const WCHAR *  shortName,
const WCHAR *  longName,
void *  playerData,
DWORD  playerDataSize 
)
static

Definition at line 1927 of file dplayx.c.

1929{
1930#include "pshpack1.h"
1931 struct
1932 {
1933 SpHeader spHeader;
1935 } request =
1936 {
1937 .spHeader =
1938 {
1939 .mixed = 0xfab00000,
1940 .addr =
1941 {
1942 .sin_family = AF_INET,
1943 .sin_port = htons( tcpPort ),
1944 },
1945 },
1946 .request =
1947 {
1948 .header =
1949 {
1950 .magic = 0x79616c70,
1951 .command = 8,
1952 .version = 14,
1953 },
1954 .toId = 0,
1955 .playerId = 0x07734,
1956 .groupId = 0,
1957 .createOffset = 28,
1958 .passwordOffset = 0,
1959 .playerInfo =
1960 {
1961 .size = sizeof( request.request.playerInfo ) + sizeof( SpData ),
1962 .flags = 0x8,
1963 .id = 0x07734,
1964 .shortNameLength = 0,
1965 .longNameLength = 0,
1966 .spDataSize = sizeof( SpData ),
1967 .playerDataSize = 0,
1968 .playerCount = 0,
1969 .systemPlayerId = 0x51573,
1970 .fixedSize = 48,
1971 .playerVersion = 14,
1972 .parentId = 0,
1973 },
1974 },
1975 };
1976#include "poppack.h"
1977 SpData spData = {
1979 .tcpAddr.sin_port = htons( tcpPort ),
1980 .udpAddr.sin_family = AF_INET,
1981 .udpAddr.sin_port = htons( udpPort ),
1982 };
1983 char reserved[ 6 ] = { 0 };
1984 DWORD shortNameSize = 0;
1985 DWORD longNameSize = 0;
1986 int wsResult;
1987
1988 if ( shortName )
1989 shortNameSize = (wcslen( shortName ) + 1) * sizeof( WCHAR );
1990
1991 if ( longName )
1992 longNameSize = (wcslen( longName ) + 1) * sizeof( WCHAR );
1993
1994 request.spHeader.mixed += sizeof( request ) + shortNameSize + longNameSize + sizeof( spData )
1995 + playerDataSize + sizeof( reserved );
1996 request.request.playerInfo.size += shortNameSize + longNameSize + playerDataSize;
1997 request.request.playerInfo.shortNameLength = shortNameSize;
1998 request.request.playerInfo.longNameLength = longNameSize;
1999 request.request.playerInfo.playerDataSize = playerDataSize;
2000
2001 wsResult = send( sock, (char *) &request, sizeof( request ), 0 );
2002 ok_( __FILE__, line )( wsResult == sizeof( request ), "send() returned %d.\n", wsResult );
2003
2004 if ( shortName )
2005 {
2006 wsResult = send( sock, (char *) shortName, shortNameSize, 0 );
2007 ok_( __FILE__, line )( wsResult == shortNameSize, "send() returned %d.\n", wsResult );
2008 }
2009
2010 if ( longName )
2011 {
2012 wsResult = send( sock, (char *) longName, longNameSize, 0 );
2013 ok_( __FILE__, line )( wsResult == longNameSize, "send() returned %d.\n", wsResult );
2014 }
2015
2016 wsResult = send( sock, (char *) &spData, sizeof( spData ), 0 );
2017 ok_( __FILE__, line )( wsResult == sizeof( spData ), "send() returned %d.\n", wsResult );
2018
2019 if ( playerData )
2020 {
2021 wsResult = send( sock, playerData, playerDataSize, 0 );
2022 ok_( __FILE__, line )( wsResult == playerDataSize, "send() returned %d.\n", wsResult );
2023 }
2024
2025 wsResult = send( sock, reserved, sizeof( reserved ), 0 );
2026 ok_( __FILE__, line )( wsResult == sizeof( reserved ), "send() returned %d.\n", wsResult );
2027}
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
r reserved
Definition: btrfs.c:3006

◆ sendEnumSessionsReply_()

static void sendEnumSessionsReply_ ( int  line,
SOCKET  sock,
unsigned short  port,
const DPSESSIONDESC2 *  dpsd 
)
static

Definition at line 1310 of file dplayx.c.

1311{
1312#include "pshpack1.h"
1313 struct
1314 {
1315 SpHeader spHeader;
1316 EnumSessionsReply reply;
1317 WCHAR name[ 256 ];
1318 } reply =
1319 {
1320 .spHeader =
1321 {
1322 .mixed = 0xfab00000,
1323 .addr =
1324 {
1325 .sin_family = AF_INET,
1326 .sin_port = htons( port ),
1327 },
1328 },
1329 .reply =
1330 {
1331 .header =
1332 {
1333 .magic = 0x79616c70,
1334 .command = 1,
1335 .version = 14,
1336 },
1337 .dpsd = *dpsd,
1338 .nameOffset = sizeof( reply.reply ),
1339 },
1340 };
1341#include "poppack.h"
1342 DWORD passwordSize;
1343 int wsResult;
1344 DWORD size;
1345
1346 passwordSize = (lstrlenW( dpsd->lpszSessionName ) + 1) * sizeof( WCHAR );
1347 size = sizeof( reply.spHeader ) + sizeof( reply.reply ) + passwordSize;
1348
1349 reply.spHeader.mixed += size;
1350 reply.reply.dpsd.lpszSessionName = NULL;
1351 reply.reply.dpsd.lpszPassword = NULL;
1352 memcpy( reply.name, dpsd->lpszSessionName, passwordSize );
1353
1354 wsResult = send( sock, (char *) &reply, size, 0 );
1355 ok_( __FILE__, line )( wsResult == size, "send() returned %d.\n", wsResult );
1356}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
LPWSTR lpszSessionName
Definition: dplay.h:243

Referenced by check_EnumSessions_(), check_EnumSessions_async_(), and joinSession_().

◆ sendGameMessage_()

static void sendGameMessage_ ( int  line,
SOCKET  sock,
DPID  fromId,
DPID  toId,
void *  data,
DWORD  dataSize 
)
static

Definition at line 2119 of file dplayx.c.

2120{
2121#include "pshpack1.h"
2122 struct
2123 {
2125 BYTE data[ 256 ];
2126 } request =
2127 {
2128 .request =
2129 {
2130 .fromId = fromId,
2131 .toId = toId,
2132 }
2133 };
2134#include "poppack.h"
2135 int wsResult;
2136 DWORD size;
2137
2138 size = sizeof( request.request ) + dataSize;
2139
2140 memcpy( request.data, data, dataSize );
2141
2142 wsResult = send( sock, (char *) &request, size, 0 );
2143 ok_( __FILE__, line )( wsResult == size, "send() returned %d.\n", wsResult );
2144}

◆ sendGroupDataChanged_()

static void sendGroupDataChanged_ ( int  line,
SOCKET  sock,
unsigned short  port,
DPID  groupId,
void *  data,
DWORD  dataSize 
)
static

Definition at line 2244 of file dplayx.c.

2245{
2246#include "pshpack1.h"
2247 struct
2248 {
2249 SpHeader spHeader;
2251 BYTE data[ 256 ];
2252 } request =
2253 {
2254 .spHeader =
2255 {
2256 .mixed = 0xfab00000 + sizeof( request ),
2257 .addr =
2258 {
2259 .sin_family = AF_INET,
2260 .sin_port = htons( port ),
2261 },
2262 },
2263 .request =
2264 {
2265 .header =
2266 {
2267 .magic = 0x79616c70,
2268 .command = 17,
2269 .version = 14,
2270 },
2271 .toId = 0,
2272 .groupId = groupId,
2273 .dataSize = dataSize,
2274 .dataOffset = sizeof( request.request ),
2275 },
2276 };
2277#include "poppack.h"
2278 int wsResult;
2279 int size;
2280
2281 size = sizeof( request ) + dataSize;
2282 memcpy( &request.data, data, dataSize );
2283
2284 wsResult = send( sock, (char *) &request, size, 0 );
2285 ok_( __FILE__, line )( wsResult == size, "send() returned %d.\n", wsResult );
2286}

◆ sendGuaranteedGameMessage_()

static void sendGuaranteedGameMessage_ ( int  line,
SOCKET  sock,
unsigned short  port,
DPID  fromId,
DPID  toId,
void *  data,
DWORD  dataSize 
)
static

Definition at line 2082 of file dplayx.c.

2084{
2085#include "pshpack1.h"
2086 struct
2087 {
2088 SpHeader spHeader;
2090 } request =
2091 {
2092 .spHeader =
2093 {
2094 .mixed = 0xfab00000 + sizeof( request ) + dataSize,
2095 .addr =
2096 {
2097 .sin_family = AF_INET,
2098 .sin_port = htons( port ),
2099 },
2100 },
2101 .request =
2102 {
2103 .fromId = fromId,
2104 .toId = toId,
2105 }
2106 };
2107#include "poppack.h"
2108 int wsResult;
2109
2110 wsResult = send( sock, (char *) &request, sizeof( request ), 0 );
2111 ok_( __FILE__, line )( wsResult == sizeof( request ), "send() returned %d.\n", wsResult );
2112
2113 wsResult = send( sock, data, dataSize, 0 );
2114 ok_( __FILE__, line )( wsResult == dataSize, "send() returned %d.\n", wsResult );
2115}

◆ sendPing_()

static void sendPing_ ( int  line,
SOCKET  sock,
unsigned short  port,
DPID  fromId,
DWORD  tickCount 
)
static

Definition at line 2148 of file dplayx.c.

2149{
2150#include "pshpack1.h"
2151 struct
2152 {
2153 SpHeader spHeader;
2154 Ping request;
2155 } request =
2156 {
2157 .spHeader =
2158 {
2159 .mixed = 0xfab00000 + sizeof( request ),
2160 .addr =
2161 {
2162 .sin_family = AF_INET,
2163 .sin_port = htons( port ),
2164 },
2165 },
2166 .request =
2167 {
2168 .header =
2169 {
2170 .magic = 0x79616c70,
2171 .command = 22,
2172 .version = 14,
2173 },
2174 .fromId = fromId,
2175 .tickCount = tickCount,
2176 }
2177 };
2178#include "poppack.h"
2179 int wsResult;
2180
2181 wsResult = send( sock, (char *) &request, sizeof( request ), 0 );
2182 ok_( __FILE__, line )( wsResult == sizeof( request ), "send() returned %d.\n", wsResult );
2183}

◆ sendRequestPlayerReply_()

static void sendRequestPlayerReply_ ( int  line,
SOCKET  sock,
unsigned short  port,
DPID  id,
HRESULT  result 
)
static

Definition at line 1382 of file dplayx.c.

1383{
1384#include "pshpack1.h"
1385 struct
1386 {
1387 SpHeader spHeader;
1388 RequestPlayerReply reply;
1389 } reply =
1390 {
1391 .spHeader =
1392 {
1393 .mixed = 0xfab00000 + sizeof( reply ),
1394 .addr =
1395 {
1396 .sin_family = AF_INET,
1397 .sin_port = htons( port ),
1398 },
1399 },
1400 .reply =
1401 {
1402 .header =
1403 {
1404 .magic = 0x79616c70,
1405 .command = 7,
1406 .version = 14,
1407 },
1408 .id = id,
1409 .result = result,
1410 },
1411 };
1412#include "poppack.h"
1413 int wsResult;
1414
1415 wsResult = send( sock, (char *) &reply, sizeof( reply ), 0 );
1416 ok_( __FILE__, line )( wsResult == sizeof( reply ), "send() returned %d.\n", wsResult );
1417}
GLuint id
Definition: glext.h:5910

Referenced by check_CreatePlayer_(), check_Open_(), createPlayer_(), and joinSession_().

◆ sendSuperEnumPlayersReply_()

static void sendSuperEnumPlayersReply_ ( int  line,
SOCKET  sock,
unsigned short  tcpPort,
unsigned short  udpPort,
const DPSESSIONDESC2 *  dpsd,
const WCHAR *  sessionName 
)
static

Definition at line 1475 of file dplayx.c.

1477{
1478#define SHORT_NAME L"short name"
1479#define LONG_NAME L"long name"
1480#include "pshpack1.h"
1481 struct
1482 {
1483 SpHeader spHeader;
1485 DPSESSIONDESC2 dpsd;
1486 WCHAR sessionName[ 256 ];
1487 struct
1488 {
1489 SuperPackedPlayer superPackedPlayer;
1490 BYTE spDataLength;
1491 SpData spData;
1492 } player0;
1493 struct
1494 {
1495 SuperPackedPlayer superPackedPlayer;
1496 BYTE spDataLength;
1497 SpData spData;
1498 } player1;
1499 struct
1500 {
1501 SuperPackedPlayer superPackedPlayer;
1502 WCHAR shortName[ ARRAYSIZE( SHORT_NAME ) ];
1503 WCHAR longName[ ARRAYSIZE( LONG_NAME ) ];
1504 BYTE playerDataLength;
1505 BYTE playerData[ 4 ];
1506 BYTE spDataLength;
1507 SpData spData;
1508 } player2;
1509 struct
1510 {
1511 SuperPackedPlayer superPackedPlayer;
1512 BYTE spDataLength;
1513 SpData spData;
1514 } player3;
1515 struct
1516 {
1517 SuperPackedPlayer superPackedPlayer;
1518 WCHAR shortName[ ARRAYSIZE( SHORT_NAME ) ];
1519 WCHAR longName[ ARRAYSIZE( LONG_NAME ) ];
1520 BYTE playerDataLength;
1521 BYTE playerData[ 4 ];
1522 BYTE spDataLength;
1523 SpData spData;
1524 BYTE playerCount;
1525 DPID playerIds[ 1 ];
1526 } group0;
1527 } reply =
1528 {
1529 .spHeader =
1530 {
1531 .mixed = 0xfab00000 + sizeof( reply ),
1532 .addr =
1533 {
1534 .sin_family = AF_INET,
1535 .sin_port = htons( tcpPort ),
1536 },
1537 },
1538 .reply =
1539 {
1540 .header =
1541 {
1542 .magic = 0x79616c70,
1543 .command = 41,
1544 .version = 14,
1545 },
1546 .playerCount = 4,
1547 .groupCount = 1,
1548 .packedOffset = sizeof( reply.reply ) + sizeof( reply.dpsd ) + sizeof( reply.sessionName ),
1549 .shortcutCount = 0,
1550 .descriptionOffset = sizeof( reply.reply ),
1551 .nameOffset = sizeof( reply.reply ) + sizeof( reply.dpsd ),
1552 .passwordOffset = 0,
1553 },
1554 .dpsd = *dpsd,
1555 .player0 =
1556 {
1557 .superPackedPlayer =
1558 {
1559 .size = 16,
1560 .flags = 0x5,
1561 .id = 0x12345678,
1562 .infoMask = 0x4,
1563 .versionOrSystemPlayerId = 14,
1564 },
1565 .spDataLength = sizeof( SpData ),
1566 .spData =
1567 {
1568 .tcpAddr =
1569 {
1570 .sin_family = AF_INET,
1571 .sin_port = htons( tcpPort ),
1572 },
1573 .udpAddr =
1574 {
1575 .sin_family = AF_INET,
1576 .sin_port = htons( udpPort ),
1577 },
1578 },
1579 },
1580 .player1 =
1581 {
1582 .superPackedPlayer =
1583 {
1584 .size = 16,
1585 .flags = 0xf,
1586 .id = 0x51573,
1587 .infoMask = 0x4,
1588 .versionOrSystemPlayerId = 14,
1589 },
1590 .spDataLength = sizeof( SpData ),
1591 .spData =
1592 {
1593 .tcpAddr =
1594 {
1595 .sin_family = AF_INET,
1596 .sin_port = htons( tcpPort ),
1597 },
1598 .udpAddr =
1599 {
1600 .sin_family = AF_INET,
1601 .sin_port = htons( udpPort ),
1602 },
1603 },
1604 },
1605 .player2 =
1606 {
1607 .superPackedPlayer =
1608 {
1609 .size = 16,
1610 .flags = 0x8,
1611 .id = 0x1337,
1612 .infoMask = 0x17,
1613 .versionOrSystemPlayerId = 0x51573,
1614 },
1615 .shortName = SHORT_NAME,
1616 .longName = LONG_NAME,
1617 .playerDataLength = 4,
1618 .playerData = { 1, 2, 3, 4, },
1619 .spDataLength = sizeof( SpData ),
1620 .spData =
1621 {
1622 .tcpAddr =
1623 {
1624 .sin_family = AF_INET,
1625 .sin_port = htons( tcpPort ),
1626 },
1627 .udpAddr =
1628 {
1629 .sin_family = AF_INET,
1630 .sin_port = htons( udpPort ),
1631 },
1632 },
1633 },
1634 .player3 =
1635 {
1636 .superPackedPlayer =
1637 {
1638 .size = 16,
1639 .flags = 0x8,
1640 .id = 0xd00de,
1641 .infoMask = 0x4,
1642 .versionOrSystemPlayerId = 0x51573,
1643 },
1644 .spDataLength = sizeof( SpData ),
1645 .spData =
1646 {
1647 .tcpAddr =
1648 {
1649 .sin_family = AF_INET,
1650 .sin_port = htons( tcpPort ),
1651 },
1652 .udpAddr =
1653 {
1654 .sin_family = AF_INET,
1655 .sin_port = htons( udpPort ),
1656 },
1657 },
1658 },
1659 .group0 =
1660 {
1661 .superPackedPlayer =
1662 {
1663 .size = 16,
1664 .flags = 0x48,
1665 .id = 0x5e7,
1666 .infoMask = 0x57,
1667 .versionOrSystemPlayerId = 0x51573,
1668 },
1669 .shortName = SHORT_NAME,
1670 .longName = LONG_NAME,
1671 .playerDataLength = 4,
1672 .playerData = { 1, 2, 3, 4, },
1673 .spDataLength = sizeof( SpData ),
1674 .spData =
1675 {
1676 .tcpAddr =
1677 {
1678 .sin_family = AF_INET,
1679 .sin_port = htons( tcpPort ),
1680 },
1681 .udpAddr =
1682 {
1683 .sin_family = AF_INET,
1684 .sin_port = htons( udpPort ),
1685 },
1686 },
1687 .playerCount = 1,
1688 .playerIds = { 0xd00de, },
1689 },
1690 };
1691#include "poppack.h"
1692#undef LONG_NAME
1693#undef SHORT_NAME
1694 int wsResult;
1695
1696 reply.dpsd.lpszSessionName = NULL;
1697 reply.dpsd.lpszPassword = NULL;
1698
1699 lstrcpyW( reply.sessionName, sessionName );
1700
1701 wsResult = send( sock, (char *) &reply, sizeof( reply ), 0 );
1702 ok_( __FILE__, line )( wsResult == sizeof( reply ), "send() returned %d.\n", wsResult );
1703}
#define lstrcpyW
Definition: compat.h:749
#define LONG_NAME
#define SHORT_NAME

Referenced by check_Open_(), and joinSession_().

◆ set_firewall()

static HRESULT set_firewall ( enum firewall_op  op)
static

Definition at line 10607 of file dplayx.c.

10608{
10609 HRESULT hr, init;
10610 INetFwMgr *mgr = NULL;
10617
10619 {
10621 return E_FAIL;
10622 }
10623
10625 {
10627 return E_FAIL;
10628 }
10629 lstrcatW( path, L"\\dplaysvr.exe" );
10630
10632
10633 hr = CoCreateInstance( &CLSID_NetFwMgr, NULL, CLSCTX_INPROC_SERVER, &IID_INetFwMgr,
10634 (void **)&mgr );
10635 ok( hr == S_OK, "got %08lx\n", hr );
10636 if (hr != S_OK) goto done;
10637
10638 hr = INetFwMgr_get_LocalPolicy( mgr, &policy );
10639 ok( hr == S_OK, "got %08lx\n", hr );
10640 if (hr != S_OK) goto done;
10641
10642 hr = INetFwPolicy_get_CurrentProfile( policy, &profile );
10643 if (hr != S_OK) goto done;
10644
10645 hr = INetFwProfile_get_AuthorizedApplications( profile, &apps );
10646 ok( hr == S_OK, "got %08lx\n", hr );
10647 if (hr != S_OK) goto done;
10648
10649 hr = CoCreateInstance( &CLSID_NetFwAuthorizedApplication, NULL, CLSCTX_INPROC_SERVER,
10650 &IID_INetFwAuthorizedApplication, (void **)&app );
10651 ok( hr == S_OK, "got %08lx\n", hr );
10652 if (hr != S_OK) goto done;
10653
10654 hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image );
10655 if (hr != S_OK) goto done;
10656
10657 name = SysAllocString( L"dplay_client" );
10658 hr = INetFwAuthorizedApplication_put_Name( app, name );
10660 ok( hr == S_OK, "got %08lx\n", hr );
10661 if (hr != S_OK) goto done;
10662
10663 if (op == APP_ADD)
10664 hr = INetFwAuthorizedApplications_Add( apps, app );
10665 else if (op == APP_REMOVE)
10666 hr = INetFwAuthorizedApplications_Remove( apps, image );
10667 else
10668 hr = E_INVALIDARG;
10669 if (hr != S_OK) goto done;
10670
10671 INetFwAuthorizedApplication_Release( app );
10672 hr = CoCreateInstance( &CLSID_NetFwAuthorizedApplication, NULL, CLSCTX_INPROC_SERVER,
10673 &IID_INetFwAuthorizedApplication, (void **)&app );
10674 ok( hr == S_OK, "got %08lx\n", hr );
10675 if (hr != S_OK) goto done;
10676
10679 hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image );
10680 if (hr != S_OK) goto done;
10681
10682 name = SysAllocString( L"dplay_server" );
10683 hr = INetFwAuthorizedApplication_put_Name( app, name );
10685 ok( hr == S_OK, "got %08lx\n", hr );
10686 if (hr != S_OK) goto done;
10687
10688 if (op == APP_ADD)
10689 hr = INetFwAuthorizedApplications_Add( apps, app );
10690 else if (op == APP_REMOVE)
10691 hr = INetFwAuthorizedApplications_Remove( apps, image );
10692 else
10693 hr = E_INVALIDARG;
10694
10695done:
10696 if (app) INetFwAuthorizedApplication_Release( app );
10697 if (apps) INetFwAuthorizedApplications_Release( apps );
10698 if (policy) INetFwPolicy_Release( policy );
10699 if (profile) INetFwProfile_Release( profile );
10700 if (mgr) INetFwMgr_Release( mgr );
10701 if (SUCCEEDED( init )) CoUninitialize();
10703 return hr;
10704}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
UINT op
Definition: effect.c:235
OLECHAR * BSTR
Definition: compat.h:2293
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2331
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:240
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:273
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:341
Definition: image.c:84

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( dplayx  )

Definition at line 10733 of file dplayx.c.

10734{
10735 BOOL firewall_enabled;
10736 HRESULT hr;
10737 char path[MAX_PATH];
10739
10741 {
10742 skip("Failed to get systems directory\n");
10743 return;
10744 }
10745 strcat(path, "\\dplayx.dll");
10746
10748 {
10749 win_skip("dplayx is missing or a stub dll, skipping tests\n");
10750 return;
10751 }
10752
10753 if ((firewall_enabled = is_firewall_enabled()) && !is_process_elevated())
10754 {
10755 skip("no privileges, skipping tests to avoid firewall dialog\n");
10756 return;
10757 }
10758
10759 if (firewall_enabled)
10760 {
10762 if (hr != S_OK)
10763 {
10764 skip("can't authorize app in firewall %08lx\n", hr);
10765 return;
10766 }
10767 }
10768
10769 CoInitialize( NULL );
10770
10771 module = LoadLibraryA("dplayx.dll");
10772
10773 pDirectPlayEnumerateA = (void *)GetProcAddress(module, "DirectPlayEnumerateA");
10774 pDirectPlayEnumerateW = (void *)GetProcAddress(module, "DirectPlayEnumerateW");
10775 pDirectPlayCreate = (void *)GetProcAddress(module, "DirectPlayCreate");
10776
10777 test_COM();
10783 test_GetCaps();
10787 test_Open();
10791 test_Send();
10792 test_Receive();
10793 test_PING();
10797
10799 {
10800 skip("Run in interactive mode to run all dplayx tests.\n");
10801 goto done;
10802 }
10803
10804 trace("Running in interactive mode, tests will take a while\n");
10805
10806 /* test_interactive_Open() takes almost a minute, */
10808 /* test_interactive_EnumSessions takes three minutes */
10811
10812 /* test_interactive_CreatePlayer() takes over a minute */
10817
10818 /* test_GetPlayerAccount() takes over 30s */
10822
10825
10829
10832
10837
10840
10841done:
10844 if (firewall_enabled) set_firewall(APP_REMOVE);
10845}
#define skip(...)
Definition: atltest.h:64
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:620
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2301
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:531
static void test_groups_p2p(void)
Definition: dplayx.c:7686
static void test_EnumerateProviders(void)
Definition: dplayx.c:2434
static void test_GetPlayerCaps(void)
Definition: dplayx.c:5282
static void test_interactive_Receive(void)
Definition: dplayx.c:8810
static void test_host_migration(void)
Definition: dplayx.c:10275
static BOOL is_stub_dll(const char *filename)
Definition: dplayx.c:10707
static void test_CreateGroup(void)
Definition: dplayx.c:6426
static void test_EnumGroups(void)
Definition: dplayx.c:7225
static void test_GROUPDATACHANGED(void)
Definition: dplayx.c:9260
static void test_COM_dplobby(void)
Definition: dplayx.c:10481
static void test_DirectPlayCreate(void)
Definition: dplayx.c:2368
static void test_SessionDesc(void)
Definition: dplayx.c:4526
static void test_GetPlayerFlags(void)
Definition: dplayx.c:6318
static HRESULT set_firewall(enum firewall_op op)
Definition: dplayx.c:10607
static void test_interactive_GetMessageQueue(void)
Definition: dplayx.c:9736
static void test_GetPlayerAddress(void)
Definition: dplayx.c:6178
static void test_Open(void)
Definition: dplayx.c:3286
static void test_GetMessageCount(void)
Definition: dplayx.c:9326
static void test_EnumPlayers(void)
Definition: dplayx.c:6902
static void test_interactive_CreatePlayer(void)
Definition: dplayx.c:5027
static void test_interactive_EnumSessions(void)
Definition: dplayx.c:4154
static void test_EnumConnections(void)
Definition: dplayx.c:2582
static void test_InitializeConnection(void)
Definition: dplayx.c:2685
static void test_Send(void)
Definition: dplayx.c:8158
static void test_interactive_Open(void)
Definition: dplayx.c:3441
static void test_groups_cs(void)
Definition: dplayx.c:7921
static void test_GetCaps(void)
Definition: dplayx.c:2704
static void test_Receive(void)
Definition: dplayx.c:8580
static void test_ADDFORWARD(void)
Definition: dplayx.c:3630
static void test_CREATEPLAYER(void)
Definition: dplayx.c:5221
static BOOL is_process_elevated(void)
Definition: dplayx.c:10558
static void test_PING(void)
Definition: dplayx.c:9092
static void test_EnumGroupsInGroup(void)
Definition: dplayx.c:7452
static void test_GetPlayerAccount(void)
Definition: dplayx.c:5994
static void test_interactive_Send(void)
Definition: dplayx.c:8245
static void test_EnumSessions(void)
Definition: dplayx.c:4092
static void test_PlayerData(void)
Definition: dplayx.c:5446
static BOOL is_firewall_enabled(void)
Definition: dplayx.c:10574
static void test_GetMessageQueue(void)
Definition: dplayx.c:9549
static void test_AddPlayerToGroup(void)
Definition: dplayx.c:9167
static void test_PlayerName(void)
Definition: dplayx.c:5710
static void test_CreatePlayer(void)
Definition: dplayx.c:4941
static void test_COM(void)
Definition: dplayx.c:10405
static void test_remote_data_replication(void)
Definition: dplayx.c:10049
static void test_GroupOwner(void)
Definition: dplayx.c:6733
static void test_EnumAddresses(void)
Definition: dplayx.c:2783
static void test_EnumAddressTypes(void)
Definition: dplayx.c:2846
#define win_skip
Definition: minitest.h:67
int winetest_interactive
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23

◆ strcmpAW()

static int strcmpAW ( const void *  str0,
const void *  str1,
BOOL  ansi 
)
static

Definition at line 85 of file dplayx.c.

86{
87 return ansi ? strcmp( str0, str1 ) : lstrcmpW( str0, str1 );
88}
XML_HIDDEN void xmlParserErrors const char const xmlChar * str1
Definition: parser.h:35

Referenced by checkSessionListCallback().

◆ test_ADDFORWARD()

static void test_ADDFORWARD ( void  )
static

Definition at line 3630 of file dplayx.c.

3631{
3632 DPSESSIONDESC2 appGuidDpsd =
3633 {
3634 .dwSize = sizeof( DPSESSIONDESC2 ),
3635 .guidInstance = appGuid,
3636 .guidApplication = appGuid,
3637 };
3638 DPSESSIONDESC2 serverDpsd =
3639 {
3640 .dwSize = sizeof( DPSESSIONDESC2 ),
3641 .guidApplication = appGuid,
3642 .guidInstance = appGuid,
3643 .lpszSessionName = (WCHAR *) L"normal",
3644 .dwReserved1 = 0xaabbccdd,
3645 };
3646 IDirectPlay4A *dp;
3647 SOCKET sendSock;
3648 SOCKET recvSock;
3649 HRESULT hr;
3650
3651 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay4A, (void **) &dp );
3652 ok( hr == DP_OK, "got hr %#lx.\n", hr );
3653
3654 init_TCPIP_provider( dp, "127.0.0.1", 0 );
3655
3656 joinSession( dp, &appGuidDpsd, &serverDpsd, &sendSock, &recvSock, NULL );
3657
3658 sendAddForward( sendSock, 2349, 2348, 2398 );
3659 receiveAddForwardAck( recvSock, 0x07734 );
3660 checkNoMoreMessages( recvSock );
3661
3662 closesocket( recvSock );
3663 closesocket( sendSock );
3664
3666}
#define IDirectPlayX_Release(p)
Definition: dplay.h:866
struct IDirectPlay4 IDirectPlay4A
Definition: dplay.h:59
#define joinSession(dp, dpsd, serverDpsd, sendSock, recvSock, udpPort)
Definition: dplayx.c:3570
#define checkNoMoreMessages(sock)
Definition: dplayx.c:1171
#define receiveAddForwardAck(sock, expectedPlayerId)
Definition: dplayx.c:1811
#define sendAddForward(sock, port, tcpPort, udpPort)
Definition: dplayx.c:1742

Referenced by START_TEST().

◆ test_AddPlayerToGroup()

static void test_AddPlayerToGroup ( void  )
static

Definition at line 9167 of file dplayx.c.

9168{
9169 DPSESSIONDESC2 appGuidDpsd =
9170 {
9171 .dwSize = sizeof( DPSESSIONDESC2 ),
9172 .guidApplication = appGuid,
9173 .guidInstance = appGuid,
9174 };
9175 DPSESSIONDESC2 serverDpsd =
9176 {
9177 .dwSize = sizeof( DPSESSIONDESC2 ),
9178 .guidApplication = appGuid,
9179 .guidInstance = appGuid,
9180 .lpszSessionName = (WCHAR *) L"normal",
9181 .dwReserved1 = 0xaabbccdd,
9182 };
9183 IDirectPlay4 *dp;
9184 SOCKET sendSock;
9185 SOCKET recvSock;
9186 HRESULT hr;
9187 DPID dpid;
9188
9189 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay4A, (void **) &dp );
9190 ok( hr == DP_OK, "got hr %#lx.\n", hr );
9191
9192 hr = IDirectPlayX_AddPlayerToGroup( dp, 0x5e7, 0x07734 );
9193 ok( hr == DPERR_UNINITIALIZED, "got hr %#lx.\n", hr );
9194
9195 init_TCPIP_provider( dp, "127.0.0.1", 0 );
9196
9197 joinSession( dp, &appGuidDpsd, &serverDpsd, &sendSock, &recvSock, NULL );
9198
9199 hr = IDirectPlayX_AddPlayerToGroup( dp, 0x5e7, 0x07734 );
9200 ok( hr == DPERR_INVALIDPLAYER, "got hr %#lx.\n", hr );
9201
9202 createPlayer( dp, 0x07734, NULL, NULL, 0, 0, sendSock, recvSock );
9203
9204 hr = IDirectPlayX_AddPlayerToGroup( dp, 0x5e7, 0x07734 );
9205 ok( hr == DP_OK, "got hr %#lx.\n", hr );
9206
9207 dpid = checkAddPlayerToGroupMessage( dp, 0x5e7, 0x07734 );
9208 ok( dpid == 0x07734, "got destination id %#lx.\n", dpid );
9209
9210 receiveAddPlayerToGroup( recvSock, 0x07734, 0x5e7 );
9211
9213 checkNoMoreMessages( recvSock );
9214
9215 closesocket( recvSock );
9216 closesocket( sendSock );
9217
9219}
#define IDirectPlayX_AddPlayerToGroup(p, a, b)
Definition: dplay.h:868
#define receiveAddPlayerToGroup(sock, expectedPlayerId, expectedGroupId)
Definition: dplayx.c:2211
#define createPlayer(dp, inDpid, event, data, dataSize, flags, sendSock, recvSock)
Definition: dplayx.c:5198
#define checkAddPlayerToGroupMessage(dp, expectedGroupId, expectedPlayerId)
Definition: dplayx.c:9141
#define checkNoMorePlayerMessages(dp)
Definition: dplayx.c:4811

Referenced by START_TEST().

◆ test_COM()

static void test_COM ( void  )
static

Definition at line 10405 of file dplayx.c.

10406{
10407 IDirectPlay *dp;
10408 IDirectPlay2A *dp2A;
10409 IDirectPlay2 *dp2;
10410 IDirectPlay3A *dp3A;
10411 IDirectPlay3 *dp3;
10412 IDirectPlay4A *dp4A;
10413#ifdef __REACTOS__ /* MSVC C4312: widen the sentinel so the cast is not narrowing on Win64 */
10414 IDirectPlay4 *dp4 = (IDirectPlay4*)(ULONG_PTR)0xdeadbeefdeadbeefull;
10415#else
10416 IDirectPlay4 *dp4 = (IDirectPlay4*)0xdeadbeef;
10417#endif
10418 IUnknown *unk;
10419 ULONG refcount;
10420 HRESULT hr;
10421
10422 /* COM aggregation */
10423#ifdef __REACTOS__
10424 hr = CoCreateInstance(&CLSID_DirectPlay, (IUnknown*)(ULONG_PTR)0xdeadbeefdeadbeefull, CLSCTX_INPROC_SERVER,
10425 &IID_IUnknown, (void**)&dp4);
10426#else
10427 hr = CoCreateInstance(&CLSID_DirectPlay, (IUnknown*)0xdeadbeef, CLSCTX_INPROC_SERVER,
10428 &IID_IUnknown, (void**)&dp4);
10429#endif
10431 "DirectPlay create failed: %08lx, expected CLASS_E_NOAGGREGATION\n", hr);
10432#ifdef __REACTOS__
10433 ok(!dp4 || dp4 == (IDirectPlay4*)(ULONG_PTR)0xdeadbeefdeadbeefull, "dp4 = %p\n", dp4);
10434#else
10435 ok(!dp4 || dp4 == (IDirectPlay4*)0xdeadbeef, "dp4 = %p\n", dp4);
10436#endif
10437
10438 /* Invalid RIID */
10439 hr = CoCreateInstance(&CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlayLobby,
10440 (void**)&dp4);
10441 ok(hr == E_NOINTERFACE, "DirectPlay create failed: %08lx, expected E_NOINTERFACE\n", hr);
10442
10443 /* Different refcount for all DirectPlay Interfaces */
10444 hr = CoCreateInstance(&CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay4,
10445 (void**)&dp4);
10446 ok(hr == S_OK, "DirectPlay create failed: %08lx, expected S_OK\n", hr);
10447
10448 hr = IDirectPlayX_QueryInterface(dp4, &IID_IDirectPlay2A, (void**)&dp2A);
10449 ok(hr == S_OK, "QueryInterface for IID_IDirectPlay2A failed: %08lx\n", hr);
10451
10452 hr = IDirectPlayX_QueryInterface(dp4, &IID_IDirectPlay2, (void**)&dp2);
10453 ok(hr == S_OK, "QueryInterface for IID_IDirectPlay2 failed: %08lx\n", hr);
10455
10456 hr = IDirectPlayX_QueryInterface(dp4, &IID_IDirectPlay3A, (void**)&dp3A);
10457 ok(hr == S_OK, "QueryInterface for IID_IDirectPlay3A failed: %08lx\n", hr);
10459
10460 hr = IDirectPlayX_QueryInterface(dp4, &IID_IDirectPlay3, (void**)&dp3);
10461 ok(hr == S_OK, "QueryInterface for IID_IDirectPlay3 failed: %08lx\n", hr);
10463
10464 hr = IDirectPlayX_QueryInterface(dp4, &IID_IDirectPlay4A, (void**)&dp4A);
10465 ok(hr == S_OK, "QueryInterface for IID_IDirectPlay4A failed: %08lx\n", hr);
10467
10468 /* IDirectPlay and IUnknown share a refcount */
10469 hr = IDirectPlayX_QueryInterface(dp4, &IID_IDirectPlay, (void**)&dp);
10470 ok(hr == S_OK, "QueryInterface for IID_IDirectPlay failed: %08lx\n", hr);
10472
10473 hr = IDirectPlayX_QueryInterface(dp4, &IID_IUnknown, (void**)&unk);
10474 ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08lx\n", hr);
10475
10476 IUnknown_Release(unk);
10477 refcount = IDirectPlayX_Release(dp4);
10478 ok(refcount == 0, "refcount == %lu, expected 0\n", refcount);
10479}
#define broken(x)
Definition: atltest.h:178
const GUID IID_IUnknown
#define IDirectPlayX_QueryInterface(p, a, b)
Definition: dplay.h:864
#define IDirectPlay_Release(p)
Definition: dplay.h:462
#define IDirectPlay2_Release(p)
Definition: dplay.h:564
struct IDirectPlay3 IDirectPlay3A
Definition: dplay.h:53
#define IDirectPlay3_Release(p)
Definition: dplay.h:696
struct IDirectPlay2 IDirectPlay2A
Definition: dplay.h:47
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
#define E_NOINTERFACE
Definition: winerror.h:3479

Referenced by START_TEST().

◆ test_COM_dplobby()

static void test_COM_dplobby ( void  )
static

Definition at line 10481 of file dplayx.c.

10482{
10483#ifdef __REACTOS__ /* MSVC C4312: widen the sentinel so the cast is not narrowing on Win64 */
10484 IDirectPlayLobby *dpl = (IDirectPlayLobby*)(ULONG_PTR)0xdeadbeefdeadbeefull;
10485#else
10486 IDirectPlayLobby *dpl = (IDirectPlayLobby*)0xdeadbeef;
10487#endif
10488 IDirectPlayLobbyA *dplA;
10489 IDirectPlayLobby2A *dpl2A;
10490 IDirectPlayLobby2 *dpl2;
10491 IDirectPlayLobby3A *dpl3A;
10492 IDirectPlayLobby3 *dpl3;
10493 IUnknown *unk;
10494 ULONG refcount;
10495 HRESULT hr;
10496
10497 /* COM aggregation */
10498#ifdef __REACTOS__
10499 hr = CoCreateInstance(&CLSID_DirectPlayLobby, (IUnknown*)(ULONG_PTR)0xdeadbeefdeadbeefull, CLSCTX_INPROC_SERVER,
10500 &IID_IUnknown, (void**)&dpl);
10501#else
10502 hr = CoCreateInstance(&CLSID_DirectPlayLobby, (IUnknown*)0xdeadbeef, CLSCTX_INPROC_SERVER,
10503 &IID_IUnknown, (void**)&dpl);
10504#endif
10506 "DirectPlayLobby create failed: %08lx, expected CLASS_E_NOAGGREGATION\n", hr);
10507#ifdef __REACTOS__
10508 ok(!dpl || dpl == (IDirectPlayLobby*)(ULONG_PTR)0xdeadbeefdeadbeefull, "dpl = %p\n", dpl);
10509#else
10510 ok(!dpl || dpl == (IDirectPlayLobby*)0xdeadbeef, "dpl = %p\n", dpl);
10511#endif
10512
10513 /* Invalid RIID */
10514 hr = CoCreateInstance(&CLSID_DirectPlayLobby, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay,
10515 (void**)&dpl);
10516 ok(hr == E_NOINTERFACE, "DirectPlayLobby create failed: %08lx, expected E_NOINTERFACE\n", hr);
10517
10518 /* Different refcount for all DirectPlayLobby Interfaces */
10519 hr = CoCreateInstance(&CLSID_DirectPlayLobby, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlayLobby,
10520 (void**)&dpl);
10521 ok(hr == S_OK, "DirectPlayLobby create failed: %08lx, expected S_OK\n", hr);
10522
10523 hr = IDirectPlayLobby_QueryInterface(dpl, &IID_IDirectPlayLobbyA, (void**)&dplA);
10524 ok(hr == S_OK, "QueryInterface for IID_IDirectPlayLobbyA failed: %08lx\n", hr);
10526
10527 hr = IDirectPlayLobby_QueryInterface(dpl, &IID_IDirectPlayLobby2, (void**)&dpl2);
10528 ok(hr == S_OK, "QueryInterface for IID_IDirectPlayLobby2 failed: %08lx\n", hr);
10530
10531 hr = IDirectPlayLobby_QueryInterface(dpl, &IID_IDirectPlayLobby2A, (void**)&dpl2A);
10532 ok(hr == S_OK, "QueryInterface for IID_IDirectPlayLobby2A failed: %08lx\n", hr);
10534
10535 hr = IDirectPlayLobby_QueryInterface(dpl, &IID_IDirectPlayLobby3, (void**)&dpl3);
10536 ok(hr == S_OK, "QueryInterface for IID_IDirectPlayLobby3 failed: %08lx\n", hr);
10538
10539 hr = IDirectPlayLobby_QueryInterface(dpl, &IID_IDirectPlayLobby3A, (void**)&dpl3A);
10540 ok(hr == S_OK, "QueryInterface for IID_IDirectPlayLobby3A failed: %08lx\n", hr);
10542
10543 /* IDirectPlayLobby and IUnknown share a refcount */
10544 hr = IDirectPlayX_QueryInterface(dpl, &IID_IUnknown, (void**)&unk);
10545 ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08lx\n", hr);
10546 IUnknown_Release(unk);
10547
10548 refcount = IDirectPlayLobby_Release(dpl);
10549 ok(refcount == 0, "refcount == %lu, expected 0\n", refcount);
10550}
#define IDirectPlayLobby_QueryInterface(p, a, b)
Definition: dplobby.h:454
struct IDirectPlayLobby2 IDirectPlayLobby2A
Definition: dplobby.h:44
struct IDirectPlayLobby3 IDirectPlayLobby3A
Definition: dplobby.h:50
struct IDirectPlayLobby IDirectPlayLobbyA
Definition: dplobby.h:38

Referenced by START_TEST().

◆ test_CreateGroup()

static void test_CreateGroup ( void  )
static

Definition at line 6426 of file dplayx.c.

6427{
6428
6429 IDirectPlay4 *pDP;
6430 DPSESSIONDESC2 dpsd;
6431 DPID idFrom, idTo, dpid, idGroup, idGroupParent;
6432 DPNAME groupName;
6433 HRESULT hr;
6434 UINT i;
6435
6436 LPCSTR lpData = "data";
6437 DWORD dwDataSize = strlen(lpData)+1;
6438 LPDPMSG_CREATEPLAYERORGROUP lpDataGet = calloc( 1, 1024 );
6439 DWORD dwDataSizeGet = 1024;
6440 CallbackData callbackData;
6441
6442
6443 hr= CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
6444 &IID_IDirectPlay4A, (LPVOID*) &pDP );
6445 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
6446 if (FAILED(hr)) return;
6447 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
6448 dpsd.dwSize = sizeof(DPSESSIONDESC2);
6449 dpsd.guidApplication = appGuid;
6450 dpsd.dwMaxPlayers = 10;
6451 ZeroMemory( &groupName, sizeof(DPNAME) );
6452
6453
6454 /* No service provider */
6455 hr = IDirectPlayX_CreateGroup( pDP, &idGroup, NULL, NULL, 0, 0 );
6457
6458 hr = IDirectPlayX_CreateGroupInGroup( pDP, 0, &idGroup, NULL, NULL, 0, 0 );
6460
6461
6462
6463 init_TCPIP_provider( pDP, "127.0.0.1", 0 );
6464
6465
6466 /* No session */
6467 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
6468 NULL, NULL, 0, 0 );
6470
6471 if ( hr == DPERR_UNINITIALIZED )
6472 {
6473 todo_wine win_skip( "CreateGroup not implemented\n" );
6474 return;
6475 }
6476
6477 hr = IDirectPlayX_CreateGroupInGroup( pDP, 0, &idGroup,
6478 NULL, NULL, 0, 0 );
6480
6481 hr = IDirectPlayX_CreateGroupInGroup( pDP, 2, &idGroup,
6482 NULL, NULL, 0, 0 );
6484
6485
6486 hr = IDirectPlayX_Open( pDP, &dpsd, DPOPEN_CREATE );
6487 checkHR( DP_OK, hr );
6488 IDirectPlayX_CreatePlayer( pDP, &dpid,
6489 NULL, NULL, NULL, 0, 0 );
6490
6491
6492
6493 /* With name */
6494 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
6495 NULL, NULL, 0, 0 );
6496 checkHR( DP_OK, hr );
6497
6498 hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroup, &idGroup,
6499 NULL, NULL, 0, 0 );
6500 checkHR( DP_OK, hr );
6501
6502 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
6503 &groupName, NULL, 0, 0 );
6504 checkHR( DP_OK, hr );
6505
6506 hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroup, &idGroup,
6507 &groupName, NULL, 0, 0 );
6508 checkHR( DP_OK, hr );
6509
6510
6511 groupName.dwSize = sizeof(DPNAME);
6512 groupName.lpszShortNameA = (LPSTR) lpData;
6513
6514
6515 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
6516 &groupName, NULL, 0, 0 );
6517 checkHR( DP_OK, hr );
6518
6519 hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroup, &idGroup,
6520 &groupName, NULL, 0, 0 );
6521 checkHR( DP_OK, hr );
6522
6523
6524 /* Message checking */
6525 for (i=0; i<6; i++)
6526 {
6527 dwDataSizeGet = 1024;
6528 hr = IDirectPlayX_Receive( pDP, &idFrom, &idTo, 0, lpDataGet,
6529 &dwDataSizeGet );
6530 checkHR( DP_OK, hr );
6531 if ( NULL == lpDataGet->dpnName.lpszShortNameA )
6532 {
6533 check( 48, dwDataSizeGet );
6534 }
6535 else
6536 {
6537 check( 48 + dwDataSize, dwDataSizeGet );
6538 checkStr( lpData, lpDataGet->dpnName.lpszShortNameA );
6539 }
6540 check( DPID_SYSMSG, idFrom );
6542 check( DPPLAYERTYPE_GROUP, lpDataGet->dwPlayerType );
6544 }
6545 check_messages( pDP, &dpid, 1, &callbackData );
6546 checkStr( "", callbackData.szTrace1 );
6547
6548
6549 /* With data */
6550 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
6551 NULL, (LPVOID) lpData, -1, 0 );
6553
6554 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
6555 NULL, (LPVOID) lpData, 0, 0 );
6556 checkHR( DP_OK, hr );
6557
6558 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
6559 NULL, NULL, dwDataSize, 0 );
6561
6562 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
6563 NULL, (LPVOID) lpData, dwDataSize, 0 );
6564 checkHR( DP_OK, hr );
6565
6566
6567 hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroup, &idGroup,
6568 NULL, (LPVOID) lpData, -1, 0 );
6570
6571 hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroup, &idGroup,
6572 NULL, (LPVOID) lpData, 0, 0 );
6573 checkHR( DP_OK, hr );
6574
6575 hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroup, &idGroup,
6576 NULL, NULL, dwDataSize, 0 );
6578
6579 hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroup, &idGroup,
6580 NULL, (LPVOID)lpData, dwDataSize, 0 );
6581 checkHR( DP_OK, hr );
6582
6583
6584 hr = IDirectPlayX_CreateGroup( pDP, &idGroupParent,
6585 NULL, NULL, 0, 0 );
6586 checkHR( DP_OK, hr );
6587
6588
6589 /* Message checking */
6590 for (i=0; i<5; i++)
6591 {
6592 dwDataSizeGet = 1024;
6593 hr = IDirectPlayX_Receive( pDP, &idFrom, &idTo, 0, lpDataGet,
6594 &dwDataSizeGet );
6595 checkHR( DP_OK, hr );
6596 check( 48 + lpDataGet->dwDataSize, dwDataSizeGet );
6597 check( DPID_SYSMSG, idFrom );
6599 check( DPPLAYERTYPE_GROUP, lpDataGet->dwPlayerType );
6601 }
6602 check_messages( pDP, &dpid, 1, &callbackData );
6603 checkStr( "", callbackData.szTrace1 );
6604
6605
6606 /* Flags and idGroupParent */
6607 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
6608 NULL, NULL, 0, 0 );
6609 checkHR( DP_OK, hr );
6610
6611 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
6612 NULL, NULL, 0, DPGROUP_HIDDEN );
6613 checkHR( DP_OK, hr );
6614
6615 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
6617 checkHR( DP_OK, hr );
6618
6619 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
6620 NULL, NULL, 0,
6622 checkHR( DP_OK, hr );
6623
6624
6625 hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroupParent, &idGroup,
6626 NULL, NULL, 0, 0 );
6627 checkHR( DP_OK, hr );
6628
6629 hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroupParent, &idGroup,
6630 NULL, NULL, 0, DPGROUP_HIDDEN );
6631 checkHR( DP_OK, hr );
6632
6633 hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroupParent, &idGroup,
6635 checkHR( DP_OK, hr );
6636
6637 hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroupParent, &idGroup,
6638 NULL, NULL, 0,
6641 checkHR( DP_OK, hr );
6642
6643
6644 /* Message checking */
6645 for (i=0; i<8; i++)
6646 {
6647 dwDataSizeGet = 1024;
6648 hr = IDirectPlayX_Receive( pDP, &idFrom, &idTo, 0, lpDataGet,
6649 &dwDataSizeGet );
6650 checkHR( DP_OK, hr );
6651 check( 48, dwDataSizeGet );
6652 check( DPID_SYSMSG, idFrom );
6654 check( DPPLAYERTYPE_GROUP, lpDataGet->dwPlayerType );
6655
6656 if ( lpDataGet->dpIdParent != 0 )
6657 {
6658 check( idGroupParent, lpDataGet->dpIdParent );
6659 }
6660
6661 switch (i%4)
6662 {
6663 case 0:
6665 lpDataGet->dwFlags, FLAGS_DPGROUP );
6666 break;
6667 case 1:
6669 lpDataGet->dwFlags, FLAGS_DPGROUP );
6670 break;
6671 case 2:
6673 lpDataGet->dwFlags, FLAGS_DPGROUP );
6674 break;
6675 case 3:
6677 lpDataGet->dwFlags, FLAGS_DPGROUP );
6678 break;
6679 default: break;
6680 }
6681 }
6682 check_messages( pDP, &dpid, 1, &callbackData );
6683 checkStr( "", callbackData.szTrace1 );
6684
6685
6686 /* If a group is created in C/S mode, no messages are sent */
6687
6688 /* - Peer 2 peer */
6689 IDirectPlayX_Close( pDP );
6690
6691 dpsd.dwFlags = 0;
6692 hr = IDirectPlayX_Open( pDP, &dpsd, DPOPEN_CREATE );
6693 checkHR( DP_OK, hr );
6694 hr = IDirectPlayX_CreatePlayer( pDP, &dpid, NULL, NULL, NULL, 0, 0 );
6695 checkHR( DP_OK, hr );
6696
6697 hr = IDirectPlayX_CreateGroup( pDP, &idGroup, NULL, NULL, 0, 0 );
6698 checkHR( DP_OK, hr );
6699
6700 /* Messages are received */
6701 check_messages( pDP, &dpid, 1, &callbackData );
6702 checkStr( "S0,", callbackData.szTrace1 );
6703
6704
6705 /* - Client/Server */
6706 IDirectPlayX_Close( pDP );
6707
6709 hr = IDirectPlayX_Open( pDP, &dpsd, DPOPEN_CREATE );
6710 checkHR( DP_OK, hr );
6711 hr = IDirectPlayX_CreatePlayer( pDP, &dpid,
6712 NULL, NULL, NULL, 0,
6714 checkHR( DP_OK, hr );
6715
6716 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
6717 NULL, NULL, 0, 0 );
6718 checkHR( DP_OK, hr );
6719
6720 /* No messages */
6721 check_messages( pDP, &dpid, 1, &callbackData );
6722 checkStr( "S0,", callbackData.szTrace1 ); /* Or at least there
6723 shouldn't be messages... */
6724
6725
6726 free( lpDataGet );
6727 IDirectPlayX_Release( pDP );
6728
6729}
#define IDirectPlayX_CreateGroup(p, a, b, c, d, e)
Definition: dplay.h:870
#define IDirectPlayX_CreateGroupInGroup(p, a, b, c, d, e, f)
Definition: dplay.h:899
static LPCSTR dpMsgType2str(DWORD dwType)
Definition: dplayx.c:249
#define checkConv(expected, result, function)
Definition: dplayx.c:72
#define check_messages(a, b, c, d, e, f)
Definition: clipboard.c:1145
LPSTR lpszShortNameA
Definition: dplay.h:194
DWORD dwSize
Definition: dplay.h:188
const char * LPCSTR
Definition: typedefs.h:52

Referenced by START_TEST().

◆ test_CreatePlayer()

static void test_CreatePlayer ( void  )
static

Definition at line 4941 of file dplayx.c.

4942{
4943 DPSESSIONDESC2 appGuidDpsd =
4944 {
4945 .dwSize = sizeof( DPSESSIONDESC2 ),
4946 .guidApplication = appGuid,
4947 .guidInstance = appGuid,
4948 };
4949 DPSESSIONDESC2 serverDpsd =
4950 {
4951 .dwSize = sizeof( DPSESSIONDESC2 ),
4952 .guidApplication = appGuid,
4953 .guidInstance = appGuid,
4954 .lpszSessionName = (WCHAR *) L"normal",
4955 .dwReserved1 = 0xaabbccdd,
4956 };
4958 {
4959 .dwSize = sizeof( DPNAME ),
4960 .lpszShortNameA = (char *) "short player name",
4961 .lpszLongNameA = (char *) "long player name",
4962 };
4963 DPNAME nullName =
4964 {
4965 .dwSize = sizeof( DPNAME ),
4966 };
4967 IDirectPlay4 *dp;
4968 SOCKET sendSock;
4969 SOCKET recvSock;
4970 DPNAME name;
4971 HRESULT hr;
4972 DPID dpid;
4973
4974 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay4A, (void **) &dp );
4975 ok( hr == DP_OK, "got hr %#lx.\n", hr );
4976
4977 /* Connection not initialized */
4978 dpid = 0xdeadbeef;
4979 check_CreatePlayer( dp, &dpid, NULL, 0, DPERR_UNINITIALIZED, 0xdeadbeef, INVALID_SOCKET, FALSE, 0, NULL, NULL,
4980 NULL, NULL, 0 );
4981
4982 init_TCPIP_provider( dp, "127.0.0.1", 0 );
4983
4984 /* Session not open */
4985 dpid = 0xdeadbeef;
4986 check_CreatePlayer( dp, &dpid, NULL, 0, DPERR_INVALIDPARAMS, 0xdeadbeef, INVALID_SOCKET, FALSE, 0, NULL, NULL,
4987 NULL, NULL, 0 );
4988
4989 /* Join to normal session */
4990 joinSession( dp, &appGuidDpsd, &serverDpsd, &sendSock, &recvSock, NULL );
4991
4992 /* Player name */
4993 dpid = 0xdeadbeef;
4994 check_CreatePlayer( dp, &dpid, NULL, 0, DP_OK, 2, recvSock, TRUE, 0x8, NULL, NULL, NULL, NULL, 2 );
4995
4996 dpid = 0xdeadbeef;
4997 check_CreatePlayer( dp, &dpid, &fullName, 0, DP_OK, 3, recvSock, TRUE, 0x8, L"short player name",
4998 "short player name", L"long player name", "long player name", 3 );
4999
5000 name = fullName;
5001 name.dwSize = 1;
5002 dpid = 0xdeadbeef;
5003 check_CreatePlayer( dp, &dpid, &name, 0, DP_OK, 4, recvSock, TRUE, 0x8, L"short player name", "short player name",
5004 L"long player name", "long player name", 4 );
5005
5006 dpid = 0xdeadbeef;
5007 check_CreatePlayer( dp, &dpid, &nullName, 0, DP_OK, 5, recvSock, TRUE, 0x8, NULL, NULL, NULL, NULL, 5 );
5008
5009 /* Null dpid */
5010 dpid = 0xdeadbeef;
5011 check_CreatePlayer( dp, NULL, NULL, 0, DPERR_INVALIDPARAMS, 0, recvSock, FALSE, 0, NULL, NULL, NULL, NULL, 0 );
5012
5013 /* Flags */
5014 dpid = 0xdeadbeef;
5015 check_CreatePlayer( dp, &dpid, NULL, 0, DP_OK, 6, recvSock, TRUE, 0x8, NULL, NULL, NULL, NULL, 6 );
5016
5017 dpid = 0xdeadbeef;
5018 check_CreatePlayer( dp, &dpid, NULL, DPPLAYER_SPECTATOR, DP_OK, 7, recvSock, TRUE, 0x208, NULL, NULL, NULL, NULL,
5019 7 );
5020
5021 closesocket( recvSock );
5022 closesocket( sendSock );
5023
5025}
static WCHAR fullName[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1969
#define check_CreatePlayer(dp, dpid, name, flags, expectedHr, expectedDpid, recvSock, requestExpected, expectedFlags, expectedShortName, expectedShortNameA, expectedLongName, expectedLongNameA, expectedCurrentPlayers)
Definition: dplayx.c:4881

Referenced by START_TEST().

◆ test_CREATEPLAYER()

static void test_CREATEPLAYER ( void  )
static

Definition at line 5221 of file dplayx.c.

5222{
5223 BYTE playerData[] = { 4, 3, 2, 1, };
5224 DPSESSIONDESC2 appGuidDpsd =
5225 {
5226 .dwSize = sizeof( DPSESSIONDESC2 ),
5227 .guidInstance = appGuid,
5228 .guidApplication = appGuid,
5229 };
5230 DPSESSIONDESC2 serverDpsd =
5231 {
5232 .dwSize = sizeof( DPSESSIONDESC2 ),
5233 .guidApplication = appGuid,
5234 .guidInstance = appGuid,
5235 .lpszSessionName = (WCHAR *) L"normal",
5236 .dwReserved1 = 0xaabbccdd,
5237 };
5238 IDirectPlay4A *dp;
5239 DWORD waitResult;
5240 SOCKET sendSock;
5241 SOCKET recvSock;
5242 HANDLE event;
5243 HRESULT hr;
5244 DPID dpid;
5245
5246 event = CreateEventA( NULL, FALSE, FALSE, NULL );
5247
5248 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay4A, (void **) &dp );
5249 ok( hr == DP_OK, "got hr %#lx.\n", hr );
5250
5251 init_TCPIP_provider( dp, "127.0.0.1", 0 );
5252
5253 joinSession( dp, &appGuidDpsd, &serverDpsd, &sendSock, &recvSock, NULL );
5254
5255 createPlayer( dp, 0x11223344, event, NULL, 0, 0, sendSock, recvSock );
5256
5257 sendCreatePlayer( sendSock, 2349, 2399, L"new player short name", L"new player long name", playerData,
5258 sizeof( playerData ) );
5259
5260 waitResult = WaitForSingleObject( event, 2000 );
5261 ok( waitResult == WAIT_OBJECT_0, "message wait returned %lu\n", waitResult );
5262
5263 checkPlayerExists( dp, 0x07734, DPPLAYERTYPE_PLAYER, "new player short name", "new player long name",
5264 DPENUMPLAYERS_REMOTE, playerData, sizeof( playerData ) );
5265
5266 dpid = checkCreatePlayerOrGroupMessage( dp, DPPLAYERTYPE_PLAYER, 0x07734, 4, playerData, sizeof( playerData ),
5267 "new player short name", "new player long name", 0, 0 );
5268 ok( dpid == 0x11223344, "got destination id %#lx.\n", dpid );
5269
5271
5272 closesocket( recvSock );
5273 closesocket( sendSock );
5274
5276
5277 CloseHandle( event );
5278}
#define sendCreatePlayer(sock, tcpPort, udpPort, shortName, longName, playerData, playerDataSize)
Definition: dplayx.c:1925
#define checkPlayerExists(dp, expectedDpid, expectedPlayerType, expectedShortName, expectedLongName, expectedFlags, expectedPlayerData, expectedPlayerDataSize)
Definition: dplayx.c:3115
#define checkCreatePlayerOrGroupMessage(dp, expectedType, expectedDpid, expectedCurrentPlayers, expectedPlayerData, expectedPlayerDataSize, expectedShortName, expectedLongName, expectedParent, expectedFlags)
Definition: dplayx.c:4708
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:573

Referenced by START_TEST().

◆ test_DirectPlayCreate()

static void test_DirectPlayCreate ( void  )
static

Definition at line 2368 of file dplayx.c.

2369{
2370
2371 IDirectPlay *pDP;
2372 HRESULT hr;
2373
2374 /* TODO: Check how it behaves with pUnk!=NULL */
2375
2376 /* pDP==NULL */
2377 hr = pDirectPlayCreate( NULL, NULL, NULL );
2379 hr = pDirectPlayCreate( (LPGUID) &GUID_NULL, NULL, NULL );
2381 hr = pDirectPlayCreate( (LPGUID) &DPSPGUID_TCPIP, NULL, NULL );
2383
2384 /* pUnk==NULL, pDP!=NULL */
2385 hr = pDirectPlayCreate( NULL, &pDP, NULL );
2387 hr = pDirectPlayCreate( (LPGUID) &GUID_NULL, &pDP, NULL );
2388 checkHR( DP_OK, hr );
2389 if ( hr == DP_OK )
2390 IDirectPlayX_Release( pDP );
2391 hr = pDirectPlayCreate( (LPGUID) &DPSPGUID_TCPIP, &pDP, NULL );
2392 checkHR( DP_OK, hr );
2393 if ( hr == DP_OK )
2394 IDirectPlayX_Release( pDP );
2395
2396}

Referenced by START_TEST().

◆ test_EnumAddresses()

static void test_EnumAddresses ( void  )
static

Definition at line 2783 of file dplayx.c.

2784{
2785 IDirectPlay4 *pDP;
2786 HRESULT hr;
2787 DPCOMPOUNDADDRESSELEMENT addressElements[2];
2788 LPVOID pAddress = NULL;
2789 DWORD dwAddressSize = 0;
2790 IDirectPlayLobby3 *pDPL;
2791 WORD port = 6001;
2792
2793 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
2794 &IID_IDirectPlay4A, (LPVOID*) &pDP );
2795 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
2796 if (FAILED(hr))
2797 return;
2798
2799 hr = CoCreateInstance( &CLSID_DirectPlayLobby, NULL, CLSCTX_ALL,
2800 &IID_IDirectPlayLobby3A, (LPVOID*) &pDPL );
2801 ok (SUCCEEDED (hr), "CCI of CLSID_DirectPlayLobby / IID_IDirectPlayLobby3A failed\n");
2802 if (FAILED (hr)) return;
2803
2804 addressElements[0].guidDataType = DPAID_ServiceProvider;
2805 addressElements[0].dwDataSize = sizeof(GUID);
2806 addressElements[0].lpData = (void*) &DPSPGUID_TCPIP;
2807
2808 addressElements[1].guidDataType = invalid_guid;
2809 addressElements[1].dwDataSize = sizeof(WORD);
2810 addressElements[1].lpData = &port;
2811
2812 hr = IDirectPlayLobby_CreateCompoundAddress( pDPL, addressElements, 2, NULL, &dwAddressSize );
2814
2815 if( hr == DPERR_BUFFERTOOSMALL )
2816 {
2817 pAddress = calloc( 1, dwAddressSize );
2818 hr = IDirectPlayLobby_CreateCompoundAddress( pDPL, addressElements, 2,
2819 pAddress, &dwAddressSize );
2820 checkHR( DP_OK, hr );
2821 }
2822
2824 hr = IDirectPlayLobby_EnumAddress(pDPL, EnumAddressesCallback, pAddress, dwAddressSize, NULL);
2825 ok (SUCCEEDED (hr), "IDirectPlayLobby3A_EnumAddress %lx\n", hr);
2826 todo_wine ok (enum_addresses_cb_count == 3, "wrong count %d\n", enum_addresses_cb_count);
2827
2828 IDirectPlayX_Close(pDP);
2831
2832 free( pAddress );
2833}
static BOOL CALLBACK EnumAddressesCallback(REFGUID guidDataType, DWORD size, const void *data, void *context)
Definition: dplayx.c:2769

Referenced by START_TEST().

◆ test_EnumAddressTypes()

static void test_EnumAddressTypes ( void  )
static

Definition at line 2846 of file dplayx.c.

2847{
2848 HRESULT hr;
2849 IDirectPlayLobby3 *pDPL;
2850
2851 hr = CoCreateInstance( &CLSID_DirectPlayLobby, NULL, CLSCTX_ALL,
2852 &IID_IDirectPlayLobby3A, (LPVOID*) &pDPL );
2853 ok (SUCCEEDED (hr), "CCI of CLSID_DirectPlayLobby / IID_IDirectPlayLobby3A failed\n");
2854 if (FAILED (hr)) return;
2855
2858 ok (SUCCEEDED (hr), "IDirectPlayLobby3A_EnumAddress %lx\n", hr);
2859 todo_wine ok (enum_address_cb_count == 1, "IDirectPlayLobby3A_EnumAddress %lx\n", hr);
2860
2862}
static BOOL CALLBACK EnumAddressTypeCallback(REFGUID guidDataType, LPVOID lpContext, DWORD flags)
Definition: dplayx.c:2836
#define IDirectPlayLobby_EnumAddressTypes(p, a, b, c, d)
Definition: dplobby.h:461

Referenced by START_TEST().

◆ test_EnumConnections()

static void test_EnumConnections ( void  )
static

Definition at line 2582 of file dplayx.c.

2583{
2584
2585 IDirectPlay4 *pDP;
2586 CallbackData callbackData;
2587 HRESULT hr;
2588
2589
2590 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
2591 &IID_IDirectPlay4A, (LPVOID*) &pDP );
2592
2593 ok (SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n");
2594 if (FAILED(hr)) return;
2595
2596 callbackData.dwCounter1 = 0;
2597 callbackData.dwFlags = 0;
2599 &callbackData, callbackData.dwFlags );
2600 checkHR( DP_OK, hr );
2601 ok( callbackData.dwCounter1 == 4 || callbackData.dwCounter1 == 3, "got=%d\n", callbackData.dwCounter1 );
2602
2603 callbackData.dwCounter1 = 0;
2604 callbackData.dwFlags = 0;
2606 &callbackData, callbackData.dwFlags );
2607 checkHR( DP_OK, hr );
2608 ok( callbackData.dwCounter1 == 4 || callbackData.dwCounter1 == 3, "got=%d\n", callbackData.dwCounter1 );
2609
2610 callbackData.dwCounter1 = 0;
2611 callbackData.dwFlags = 0;
2612 hr = IDirectPlayX_EnumConnections( pDP, &appGuid, NULL,
2613 &callbackData, callbackData.dwFlags );
2615 check( 0, callbackData.dwCounter1 );
2616
2617
2618 /* Flag tests */
2619 callbackData.dwCounter1 = 0;
2620 callbackData.dwFlags = DPCONNECTION_DIRECTPLAY;
2622 &callbackData, callbackData.dwFlags );
2623 checkHR( DP_OK, hr );
2624 ok( callbackData.dwCounter1 == 4 || callbackData.dwCounter1 == 3, "got=%d\n", callbackData.dwCounter1 );
2625
2626 callbackData.dwCounter1 = 0;
2629 &callbackData, callbackData.dwFlags );
2630 checkHR( DP_OK, hr );
2631 check( 0, callbackData.dwCounter1 );
2632
2633 callbackData.dwCounter1 = 0;
2634 callbackData.dwFlags = ( DPCONNECTION_DIRECTPLAY |
2637 &callbackData, callbackData.dwFlags );
2638 checkHR( DP_OK, hr );
2639 ok( callbackData.dwCounter1 == 4 || callbackData.dwCounter1 == 3, "got=%d\n", callbackData.dwCounter1 );
2640
2641 callbackData.dwCounter1 = 0;
2642 callbackData.dwFlags = ~( DPCONNECTION_DIRECTPLAY |
2645 &callbackData, callbackData.dwFlags );
2647 check( 0, callbackData.dwCounter1 );
2648
2649
2650 IDirectPlayX_Release( pDP );
2651}
#define IDirectPlayX_EnumConnections(p, a, b, c, d)
Definition: dplay.h:901
static BOOL CALLBACK EnumConnections_cb(LPCGUID lpguidSP, LPVOID lpConnection, DWORD dwConnectionSize, LPCDPNAME lpName, DWORD dwFlags, LPVOID lpContext)
Definition: dplayx.c:2543

Referenced by START_TEST().

◆ test_EnumerateProviders()

static void test_EnumerateProviders ( void  )
static

Definition at line 2434 of file dplayx.c.

2435{
2436 HRESULT hr;
2437 int i;
2438 struct provider_data arg;
2439
2440 memset(&arg, 0, sizeof(arg));
2441 arg.ret_value = TRUE;
2442
2443 hr = pDirectPlayEnumerateA(callback_providersA, NULL);
2444 ok(SUCCEEDED(hr), "DirectPlayEnumerateA failed\n");
2445
2446 SetLastError(0xdeadbeef);
2447 hr = pDirectPlayEnumerateA(NULL, &arg);
2448 ok(FAILED(hr), "DirectPlayEnumerateA expected to fail\n");
2449 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got 0x%lx\n", GetLastError());
2450
2451 SetLastError(0xdeadbeef);
2452 hr = pDirectPlayEnumerateA(NULL, NULL);
2453 ok(FAILED(hr), "DirectPlayEnumerateA expected to fail\n");
2454 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got 0x%lx\n", GetLastError());
2455
2456 hr = pDirectPlayEnumerateA(callback_providersA, &arg);
2457 ok(SUCCEEDED(hr), "DirectPlayEnumerateA failed\n");
2458 ok(arg.call_count > 0, "Expected at least one valid provider\n");
2459 trace("Found %d providers\n", arg.call_count);
2460
2461 /* The returned GUID values must have persisted after enumeration (bug 37185) */
2462 for(i = 0; i < arg.call_count; i++)
2463 {
2464 ok(IsEqualGUID(arg.guid_ptr[i], &arg.guid_data[i]), "#%d Expected equal GUID values\n", i);
2465 }
2466
2467 memset(&arg, 0, sizeof(arg));
2468 arg.ret_value = FALSE;
2469 hr = pDirectPlayEnumerateA(callback_providersA, &arg);
2470 ok(SUCCEEDED(hr), "DirectPlayEnumerateA failed\n");
2471 ok(arg.call_count == 1, "Expected 1, got %d\n", arg.call_count);
2472
2473 hr = pDirectPlayEnumerateW(callback_providersW, NULL);
2474 ok(SUCCEEDED(hr), "DirectPlayEnumerateW failed\n");
2475
2476 SetLastError(0xdeadbeef);
2477 hr = pDirectPlayEnumerateW(NULL, &arg);
2478 ok(FAILED(hr), "DirectPlayEnumerateW expected to fail\n");
2479 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got 0x%lx\n", GetLastError());
2480
2481 SetLastError(0xdeadbeef);
2482 hr = pDirectPlayEnumerateW(NULL, NULL);
2483 ok(FAILED(hr), "DirectPlayEnumerateW expected to fail\n");
2484 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got 0x%lx\n", GetLastError());
2485
2486 memset(&arg, 0, sizeof(arg));
2487 arg.ret_value = TRUE;
2488 hr = pDirectPlayEnumerateW(callback_providersW, &arg);
2489 ok(SUCCEEDED(hr), "DirectPlayEnumerateW failed\n");
2490 ok(arg.call_count > 0, "Expected at least one valid provider\n");
2491
2492 /* The returned GUID values must have persisted after enumeration (bug 37185) */
2493 for(i = 0; i < arg.call_count; i++)
2494 {
2495 ok(IsEqualGUID(arg.guid_ptr[i], &arg.guid_data[i]), "#%d Expected equal GUID values\n", i);
2496 }
2497
2498 memset(&arg, 0, sizeof(arg));
2499 arg.ret_value = FALSE;
2500 hr = pDirectPlayEnumerateW(callback_providersW, &arg);
2501 ok(SUCCEEDED(hr), "DirectPlayEnumerateW failed\n");
2502 ok(arg.call_count == 1, "Expected 1, got %d\n", arg.call_count);
2503}
#define SetLastError(x)
Definition: compat.h:752
static BOOL CALLBACK callback_providersW(GUID *guid, WCHAR *name, DWORD major, DWORD minor, void *arg)
Definition: dplayx.c:2417
static BOOL CALLBACK callback_providersA(GUID *guid, char *name, DWORD major, DWORD minor, void *arg)
Definition: dplayx.c:2398
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by START_TEST().

◆ test_EnumGroups()

static void test_EnumGroups ( void  )
static

Definition at line 7225 of file dplayx.c.

7226{
7227 IDirectPlay4 *pDP[3];
7228 DPSESSIONDESC2 dpsd[3];
7229 DPID dpid[5];
7230 CallbackData callbackData;
7231 HRESULT hr;
7232 UINT i;
7233
7234
7235 for (i=0; i<3; i++)
7236 {
7237 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
7238 &IID_IDirectPlay4A, (LPVOID*) &pDP[i] );
7239 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
7240 if (FAILED(hr)) return;
7241
7242 ZeroMemory( &dpsd[i], sizeof(DPSESSIONDESC2) );
7243 dpsd[i].dwSize = sizeof(DPSESSIONDESC2);
7244 }
7245
7246 dpsd[0].guidApplication = appGuid;
7247 dpsd[1].guidApplication = appGuid2;
7248 dpsd[2].guidApplication = GUID_NULL;
7249
7250 callbackData.dpid = dpid;
7251 callbackData.dpidSize = 5;
7252
7253
7254 /* Uninitialized service provider */
7255 callbackData.dwCounter1 = 0;
7257 &callbackData, 0 );
7259 check( 0, callbackData.dwCounter1 );
7260
7261
7262 init_TCPIP_provider( pDP[0], "127.0.0.1", 0 );
7263 init_TCPIP_provider( pDP[1], "127.0.0.1", 0 );
7264 init_TCPIP_provider( pDP[2], "127.0.0.1", 0 );
7265
7266
7267 /* No session */
7268 callbackData.dwCounter1 = 0;
7270 &callbackData, 0 );
7272 check( 0, callbackData.dwCounter1 );
7273
7274 if ( hr == DPERR_UNINITIALIZED )
7275 {
7276 todo_wine win_skip( "EnumGroups not implemented\n" );
7277 return;
7278 }
7279
7280 callbackData.dwCounter1 = 0;
7281 hr = IDirectPlayX_EnumGroups( pDP[0], (LPGUID) &appGuid, EnumGroups_cb,
7282 &callbackData, 0 );
7284 check( 0, callbackData.dwCounter1 );
7285
7286 callbackData.dwCounter1 = 0;
7287 hr = IDirectPlayX_EnumGroups( pDP[0], (LPGUID) &appGuid, EnumGroups_cb,
7288 &callbackData, DPENUMGROUPS_SESSION );
7290 check( 0, callbackData.dwCounter1 );
7291
7292
7293 hr = IDirectPlayX_Open( pDP[0], &dpsd[0], DPOPEN_CREATE );
7294 checkHR( DP_OK, hr );
7295 hr = IDirectPlayX_Open( pDP[1], &dpsd[1], DPOPEN_CREATE );
7296 checkHR( DP_OK, hr );
7297
7298
7299 /* No groups */
7300 callbackData.dwCounter1 = 0;
7302 &callbackData, 0 );
7303 checkHR( DP_OK, hr );
7304 check( 0, callbackData.dwCounter1 );
7305
7306
7307 /* Create groups */
7308 hr = IDirectPlayX_CreateGroup( pDP[0], &dpid[0],
7309 NULL, NULL, 0, 0 );
7310 checkHR( DP_OK, hr );
7311 hr = IDirectPlayX_CreateGroupInGroup( pDP[0], dpid[0], &dpid[3],
7312 NULL, NULL, 0, 0 );
7313 checkHR( DP_OK, hr ); /* Not a superior level group,
7314 won't appear in the enumerations */
7315 hr = IDirectPlayX_CreateGroup( pDP[1], &dpid[1],
7316 NULL, NULL, 0, 0 );
7317 checkHR( DP_OK, hr );
7318 hr = IDirectPlayX_CreateGroup( pDP[0], &dpid[2],
7319 NULL, NULL, 0, DPGROUP_HIDDEN );
7320 checkHR( DP_OK, hr );
7321
7322
7323 /* Invalid parameters */
7324 callbackData.dwCounter1 = 0;
7325 hr = IDirectPlayX_EnumGroups( pDP[0], (LPGUID) &appGuid, NULL,
7326 &callbackData, 0 );
7328 check( 0, callbackData.dwCounter1 );
7329
7330 callbackData.dwCounter1 = 0;
7332 &callbackData, DPENUMGROUPS_SESSION );
7334 check( 0, callbackData.dwCounter1 );
7335
7336
7337 /* Regular operation */
7338 callbackData.dwCounter1 = 0;
7339 callbackData.szTrace2[0] = 0;
7341 &callbackData, 0 );
7342 checkHR( DP_OK, hr );
7343 check( 2, callbackData.dwCounter1 );
7344 checkStr( "02", callbackData.szTrace1 );
7345 checkStr( "ALL:HIDDEN:", callbackData.szTrace2 );
7346
7347 callbackData.dwCounter1 = 0;
7348 callbackData.szTrace2[0] = 0;
7350 &callbackData, 0 );
7351 checkHR( DP_OK, hr );
7352 check( 1, callbackData.dwCounter1 );
7353 checkStr( "1", callbackData.szTrace1 );
7354 checkStr( "ALL:", callbackData.szTrace2 );
7355
7356 callbackData.dwCounter1 = 0;
7357 callbackData.szTrace2[0] = 0;
7358 hr = IDirectPlayX_EnumGroups( pDP[0], (LPGUID) &appGuid, EnumGroups_cb,
7359 &callbackData, 0 );
7360 checkHR( DP_OK, hr );
7361 check( 2, callbackData.dwCounter1 ); /* Guid is ignored */
7362 checkStr( "02", callbackData.szTrace1 );
7363 checkStr( "ALL:HIDDEN:", callbackData.szTrace2 );
7364
7365
7366 /* Enumerating from a remote session */
7367 /* - Session not open */
7368 callbackData.pDP = pDP[2];
7369 hr = IDirectPlayX_EnumSessions( pDP[2], &dpsd[2], 0,
7371 &callbackData, 0 );
7372 checkHR( DP_OK, hr );
7373
7374 /* - Open session */
7375 callbackData.pDP = pDP[2];
7376 hr = IDirectPlayX_EnumSessions( pDP[2], &dpsd[0], 0, EnumSessions_cb_join,
7377 pDP[2], 0 );
7378 checkHR( DP_OK, hr );
7379
7380 hr = IDirectPlayX_CreateGroup( pDP[2], &dpid[3],
7381 NULL, NULL, 0, 0 );
7382 checkHR( DP_OK, hr );
7383 hr = IDirectPlayX_CreateGroup( pDP[2], &dpid[4],
7385 checkHR( DP_OK, hr );
7386
7387
7388 callbackData.dwCounter1 = 0;
7389 callbackData.szTrace2[0] = 0;
7391 &callbackData, 0 );
7392 checkHR( DP_OK, hr );
7393 check( 4, callbackData.dwCounter1 );
7394 checkStr( "0234", callbackData.szTrace1 );
7395 checkStr( "ALL:HIDDEN:ALL:STAGINGAREA:", callbackData.szTrace2 );
7396
7397 /* Flag tests */
7398 callbackData.dwCounter1 = 0;
7399 callbackData.szTrace2[0] = 0;
7401 &callbackData, DPENUMGROUPS_ALL );
7402 checkHR( DP_OK, hr );
7403 check( 4, callbackData.dwCounter1 );
7404 checkStr( "0234", callbackData.szTrace1 );
7405 checkStr( "ALL:HIDDEN:ALL:STAGINGAREA:", callbackData.szTrace2 );
7406
7407 callbackData.dwCounter1 = 0;
7408 callbackData.szTrace2[0] = 0;
7410 &callbackData, DPENUMGROUPS_HIDDEN );
7411 checkHR( DP_OK, hr );
7412 check( 1, callbackData.dwCounter1 );
7413 checkStr( "2", callbackData.szTrace1 );
7414 checkStr( "HIDDEN:", callbackData.szTrace2 );
7415
7416 callbackData.dwCounter1 = 0;
7417 callbackData.szTrace2[0] = 0;
7419 &callbackData, DPENUMGROUPS_LOCAL );
7420 checkHR( DP_OK, hr );
7421 check( 2, callbackData.dwCounter1 );
7422 checkStr( "34", callbackData.szTrace1 );
7423 checkStr( "LOCAL:"
7424 "LOCAL,DPENUMGROUPS_STAGINGAREA:", callbackData.szTrace2 );
7425
7426 callbackData.dwCounter1 = 0;
7427 callbackData.szTrace2[0] = 0;
7429 &callbackData, DPENUMGROUPS_REMOTE );
7430 checkHR( DP_OK, hr );
7431 check( 2, callbackData.dwCounter1 );
7432 checkStr( "02", callbackData.szTrace1 );
7433 checkStr( "REMOTE:"
7434 "REMOTE,DPENUMGROUPS_HIDDEN:", callbackData.szTrace2 );
7435
7436 callbackData.dwCounter1 = 0;
7437 callbackData.szTrace2[0] = 0;
7439 &callbackData, DPENUMGROUPS_STAGINGAREA );
7440 checkHR( DP_OK, hr );
7441 check( 1, callbackData.dwCounter1 );
7442 checkStr( "4", callbackData.szTrace1 );
7443 checkStr( "STAGINGAREA:", callbackData.szTrace2 );
7444
7445
7446 IDirectPlayX_Release( pDP[0] );
7447 IDirectPlayX_Release( pDP[1] );
7448 IDirectPlayX_Release( pDP[2] );
7449
7450}
static BOOL CALLBACK EnumSessions_cb_EnumGroups(LPCDPSESSIONDESC2 lpThisSD, LPDWORD lpdwTimeOut, DWORD dwFlags, LPVOID lpContext)
Definition: dplayx.c:7171
static BOOL CALLBACK EnumSessions_cb_join(LPCDPSESSIONDESC2 lpThisSD, LPDWORD lpdwTimeOut, DWORD dwFlags, LPVOID lpContext)
Definition: dplayx.c:2340

Referenced by START_TEST().

◆ test_EnumGroupsInGroup()

static void test_EnumGroupsInGroup ( void  )
static

Definition at line 7452 of file dplayx.c.

7453{
7454 IDirectPlay4 *pDP[2];
7455 DPSESSIONDESC2 dpsd[2];
7456 DPID dpid[6];
7457 CallbackData callbackData;
7458 HRESULT hr;
7459 UINT i;
7460
7461
7462 for (i=0; i<2; i++)
7463 {
7464 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
7465 &IID_IDirectPlay4A, (LPVOID*) &pDP[i] );
7466 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
7467 if (FAILED(hr)) return;
7468
7469 ZeroMemory( &dpsd[i], sizeof(DPSESSIONDESC2) );
7470 dpsd[i].dwSize = sizeof(DPSESSIONDESC2);
7471 }
7472
7473 dpsd[0].guidApplication = appGuid;
7474 dpsd[1].guidApplication = GUID_NULL;
7475
7476 callbackData.dpid = dpid;
7477 callbackData.dpidSize = 6;
7478
7479
7480 /* Uninitialized service provider */
7481 callbackData.dwCounter1 = 0;
7483 &callbackData, 0 );
7485 check( 0, callbackData.dwCounter1 );
7486
7487
7488 init_TCPIP_provider( pDP[0], "127.0.0.1", 0 );
7489 init_TCPIP_provider( pDP[1], "127.0.0.1", 0 );
7490
7491 hr = IDirectPlayX_Open( pDP[0], &dpsd[0], DPOPEN_CREATE );
7493
7494 if ( hr == DPERR_UNINITIALIZED )
7495 {
7496 todo_wine win_skip( "EnumGroupsInGroup not implemented\n" );
7497 return;
7498 }
7499
7500 /* Create groups */
7501 /*
7502 * 0
7503 * / 2
7504 * 1 | 3
7505 * | 4
7506 * \ 5 (shortcut)
7507 */
7508 hr = IDirectPlayX_CreateGroup( pDP[0], &dpid[0],
7509 NULL, NULL, 0, 0 );
7510 checkHR( DP_OK, hr );
7511 hr = IDirectPlayX_CreateGroup( pDP[0], &dpid[1],
7512 NULL, NULL, 0, 0 );
7513 checkHR( DP_OK, hr );
7514 hr = IDirectPlayX_CreateGroupInGroup( pDP[0], dpid[1], &dpid[2],
7515 NULL, NULL, 0, 0 );
7516 checkHR( DP_OK, hr );
7517 hr = IDirectPlayX_CreateGroupInGroup( pDP[0], dpid[1], &dpid[3],
7518 NULL, NULL, 0,
7520 checkHR( DP_OK, hr );
7521 hr = IDirectPlayX_CreateGroupInGroup( pDP[0], dpid[1], &dpid[4],
7522 NULL, NULL, 0,
7524 checkHR( DP_OK, hr );
7525 hr = IDirectPlayX_CreateGroup( pDP[0], &dpid[5],
7526 NULL, NULL, 0, 0 );
7527 checkHR( DP_OK, hr );
7528
7529 hr = IDirectPlayX_AddGroupToGroup( pDP[0], dpid[1], dpid[5] );
7530 checkHR( DP_OK, hr );
7531
7532
7533 /* Invalid parameters */
7534 callbackData.dwCounter1 = 0;
7536 &callbackData, 0 );
7538 check( 0, callbackData.dwCounter1 );
7539
7540 callbackData.dwCounter1 = 0;
7542 &callbackData, 0 );
7544 check( 0, callbackData.dwCounter1 );
7545
7546 callbackData.dwCounter1 = 0;
7547 hr = IDirectPlayX_EnumGroupsInGroup( pDP[0], dpid[1], (LPGUID) &appGuid,
7548 NULL, &callbackData, 0 );
7550 check( 0, callbackData.dwCounter1 );
7551
7552 callbackData.dwCounter1 = 0;
7554 &callbackData, DPENUMGROUPS_SESSION );
7556 check( 0, callbackData.dwCounter1 );
7557
7558
7559 /* Regular operation */
7560 callbackData.dwCounter1 = 0;
7562 &callbackData, 0 );
7563 checkHR( DP_OK, hr );
7564 check( 0, callbackData.dwCounter1 );
7565
7566 callbackData.dwCounter1 = 0;
7567 callbackData.szTrace2[0] = 0;
7569 &callbackData, 0 );
7570 checkHR( DP_OK, hr );
7571 check( 4, callbackData.dwCounter1 );
7572 checkStr( "5432", callbackData.szTrace1 );
7573 checkStr( "SHORTCUT:STAGINGAREA:HIDDEN:ALL:", callbackData.szTrace2 );
7574
7575 callbackData.dwCounter1 = 0;
7576 callbackData.szTrace2[0] = 0;
7577 hr = IDirectPlayX_EnumGroupsInGroup( pDP[0], dpid[1], (LPGUID) &appGuid,
7578 EnumGroups_cb, &callbackData, 0 );
7579 checkHR( DP_OK, hr );
7580 check( 4, callbackData.dwCounter1 ); /* Guid is ignored */
7581 checkStr( "5432", callbackData.szTrace1 );
7582 checkStr( "SHORTCUT:STAGINGAREA:HIDDEN:ALL:", callbackData.szTrace2 );
7583
7584
7585 /* Enumerating from a remote session */
7586 /* - Session not open */
7587 callbackData.pDP = pDP[1];
7588 hr = IDirectPlayX_EnumSessions( pDP[1], &dpsd[1], 0,
7590 &callbackData, 0 );
7591 checkHR( DP_OK, hr );
7592
7593 /* - Open session */
7594 hr = IDirectPlayX_EnumSessions( pDP[1], &dpsd[0], 0, EnumSessions_cb_join,
7595 pDP[1], 0 );
7596 checkHR( DP_OK, hr );
7597
7598
7599 callbackData.dwCounter1 = 0;
7600 callbackData.szTrace2[0] = 0;
7602 &callbackData, 0 );
7603 checkHR( DP_OK, hr );
7604 check( 4, callbackData.dwCounter1 );
7605 checkStr( "5432", callbackData.szTrace1 );
7606 checkStr( "SHORTCUT:STAGINGAREA:HIDDEN:ALL:", callbackData.szTrace2 );
7607
7608 /* Flag tests */
7609 callbackData.dwCounter1 = 0;
7610 callbackData.szTrace2[0] = 0;
7612 &callbackData, DPENUMGROUPS_ALL );
7613 checkHR( DP_OK, hr );
7614 check( 4, callbackData.dwCounter1 );
7615 checkStr( "5432", callbackData.szTrace1 );
7616 checkStr( "SHORTCUT:STAGINGAREA:HIDDEN:ALL:", callbackData.szTrace2 );
7617
7618 callbackData.dwCounter1 = 0;
7619 callbackData.szTrace2[0] = 0;
7621 &callbackData, DPENUMGROUPS_HIDDEN );
7622 checkHR( DP_OK, hr );
7623 check( 1, callbackData.dwCounter1 );
7624 checkStr( "3", callbackData.szTrace1 );
7625 checkStr( "HIDDEN:", callbackData.szTrace2 );
7626
7627 callbackData.dwCounter1 = 0;
7628 callbackData.szTrace2[0] = 0;
7630 &callbackData, DPENUMGROUPS_LOCAL );
7631 checkHR( DP_OK, hr );
7632 check( 4, callbackData.dwCounter1 );
7633 checkStr( "5432", callbackData.szTrace1 );
7634 checkStr( "LOCAL,DPENUMGROUPS_SHORTCUT:"
7635 "LOCAL,DPENUMGROUPS_STAGINGAREA:"
7636 "LOCAL,DPENUMGROUPS_HIDDEN:LOCAL:", callbackData.szTrace2 );
7637
7638 callbackData.dwCounter1 = 0;
7640 &callbackData, DPENUMGROUPS_REMOTE );
7641 checkHR( DP_OK, hr );
7642 check( 0, callbackData.dwCounter1 );
7643
7644 callbackData.dwCounter1 = 0;
7646 &callbackData, DPENUMGROUPS_LOCAL );
7647 checkHR( DP_OK, hr );
7648 check( 0, callbackData.dwCounter1 );
7649
7650 callbackData.dwCounter1 = 0;
7651 callbackData.szTrace2[0] = 0;
7653 &callbackData, DPENUMGROUPS_REMOTE );
7654 checkHR( DP_OK, hr );
7655 check( 4, callbackData.dwCounter1 );
7656 checkStr( "5432", callbackData.szTrace1 );
7657 checkStr( "REMOTE,DPENUMGROUPS_SHORTCUT:"
7658 "REMOTE,DPENUMGROUPS_STAGINGAREA:"
7659 "REMOTE,DPENUMGROUPS_HIDDEN:REMOTE:", callbackData.szTrace2 );
7660
7661 callbackData.dwCounter1 = 0;
7662 callbackData.szTrace2[0] = 0;
7664 &callbackData, DPENUMGROUPS_SHORTCUT );
7665 checkHR( DP_OK, hr );
7666 check( 1, callbackData.dwCounter1 );
7667 checkStr( "5", callbackData.szTrace1 );
7668 checkStr( "SHORTCUT:", callbackData.szTrace2 );
7669
7670 callbackData.dwCounter1 = 0;
7671 callbackData.szTrace2[0] = 0;
7673 &callbackData,
7675 checkHR( DP_OK, hr );
7676 check( 1, callbackData.dwCounter1 );
7677 checkStr( "4", callbackData.szTrace1 );
7678 checkStr( "STAGINGAREA:", callbackData.szTrace2 );
7679
7680
7681 IDirectPlayX_Release( pDP[0] );
7682 IDirectPlayX_Release( pDP[1] );
7683
7684}
#define IDirectPlayX_AddGroupToGroup(p, a, b)
Definition: dplay.h:898
#define IDirectPlayX_EnumGroupsInGroup(p, a, b, c, d, e)
Definition: dplay.h:902

Referenced by START_TEST().

◆ test_EnumPlayers()

static void test_EnumPlayers ( void  )
static

Definition at line 6902 of file dplayx.c.

6903{
6904 IDirectPlay4 *pDP[3];
6905 DPSESSIONDESC2 dpsd[3];
6906 DPID dpid[5+2]; /* 5 players, 2 groups */
6907 CallbackData callbackData;
6908 HRESULT hr;
6909 UINT i;
6910
6911
6912 for (i=0; i<3; i++)
6913 {
6914 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
6915 &IID_IDirectPlay4A, (LPVOID*) &pDP[i] );
6916 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
6917 if (FAILED(hr)) return;
6918
6919 ZeroMemory( &dpsd[i], sizeof(DPSESSIONDESC2) );
6920 dpsd[i].dwSize = sizeof(DPSESSIONDESC2);
6921 }
6922
6923 dpsd[0].guidApplication = appGuid;
6924 dpsd[1].guidApplication = appGuid2;
6925 dpsd[2].guidApplication = GUID_NULL;
6926
6927 callbackData.dpid = dpid;
6928 callbackData.dpidSize = 5+2;
6929
6930
6931 /* Uninitialized service provider */
6932 callbackData.dwCounter1 = 0;
6933 hr = IDirectPlayX_EnumPlayers( pDP[0], (LPGUID) &appGuid, NULL,
6934 &callbackData, 0 );
6936 check( 0, callbackData.dwCounter1 );
6937
6938
6939 init_TCPIP_provider( pDP[0], "127.0.0.1", 0 );
6940 init_TCPIP_provider( pDP[1], "127.0.0.1", 0 );
6941 init_TCPIP_provider( pDP[2], "127.0.0.1", 0 );
6942
6943
6944 /* No session */
6945 callbackData.dwCounter1 = 0;
6947 &callbackData, 0 );
6949 check( 0, callbackData.dwCounter1 );
6950
6951 if ( hr == DPERR_UNINITIALIZED )
6952 {
6953 todo_wine win_skip( "EnumPlayers not implemented\n" );
6954 return;
6955 }
6956
6957 callbackData.dwCounter1 = 0;
6958 hr = IDirectPlayX_EnumPlayers( pDP[0], (LPGUID) &appGuid, EnumPlayers_cb,
6959 &callbackData, 0 );
6961 check( 0, callbackData.dwCounter1 );
6962
6963 callbackData.dwCounter1 = 0;
6964 hr = IDirectPlayX_EnumPlayers( pDP[0], (LPGUID) &appGuid, EnumPlayers_cb,
6965 &callbackData, DPENUMPLAYERS_SESSION );
6967 check( 0, callbackData.dwCounter1 );
6968
6969
6970 hr = IDirectPlayX_Open( pDP[0], &dpsd[0], DPOPEN_CREATE );
6971 checkHR( DP_OK, hr );
6972 hr = IDirectPlayX_Open( pDP[1], &dpsd[1], DPOPEN_CREATE );
6973 checkHR( DP_OK, hr );
6974
6975
6976 /* No players */
6977 callbackData.dwCounter1 = 0;
6979 &callbackData, 0 );
6980 checkHR( DP_OK, hr );
6981 check( 0, callbackData.dwCounter1 );
6982
6983
6984 /* Create players */
6985 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid[0],
6986 NULL, NULL, NULL, 0,
6988 checkHR( DP_OK, hr );
6989 hr = IDirectPlayX_CreatePlayer( pDP[1], &dpid[1],
6990 NULL, NULL, NULL, 0,
6991 0 );
6992 checkHR( DP_OK, hr );
6993
6994 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid[2],
6995 NULL, NULL, NULL, 0,
6996 0 );
6997 checkHR( DP_OK, hr );
6998 hr = IDirectPlayX_CreateGroup( pDP[0], &dpid[5],
6999 NULL, NULL, 0, 0 );
7000 checkHR( DP_OK, hr );
7001
7002
7003 /* Invalid parameters */
7004 callbackData.dwCounter1 = 0;
7005 hr = IDirectPlayX_EnumPlayers( pDP[0], (LPGUID) &appGuid, NULL,
7006 &callbackData, 0 );
7008 check( 0, callbackData.dwCounter1 );
7009
7010 callbackData.dwCounter1 = 0;
7012 &callbackData, DPENUMPLAYERS_SESSION );
7014 check( 0, callbackData.dwCounter1 );
7015
7016
7017 /* Regular operation */
7018 callbackData.dwCounter1 = 0;
7019 callbackData.szTrace2[0] = 0;
7021 &callbackData, 0 );
7022 checkHR( DP_OK, hr );
7023 check( 2, callbackData.dwCounter1 );
7024 checkStr( "20", callbackData.szTrace1 );
7025 checkStr( "ALL:SERVERPLAYER:", callbackData.szTrace2 );
7026
7027 callbackData.dwCounter1 = 0;
7028 callbackData.szTrace2[0] = 0;
7030 &callbackData, 0 );
7031 checkHR( DP_OK, hr );
7032 check( 1, callbackData.dwCounter1 );
7033 checkStr( "1", callbackData.szTrace1 );
7034 checkStr( "ALL:", callbackData.szTrace2 );
7035
7036 callbackData.dwCounter1 = 0;
7037 callbackData.szTrace2[0] = 0;
7038 hr = IDirectPlayX_EnumPlayers( pDP[0], (LPGUID) &appGuid, EnumPlayers_cb,
7039 &callbackData, 0 );
7040 checkHR( DP_OK, hr );
7041 check( 2, callbackData.dwCounter1 ); /* Guid is ignored */
7042 checkStr( "20", callbackData.szTrace1 );
7043 checkStr( "ALL:SERVERPLAYER:", callbackData.szTrace2 );
7044
7045
7046 /* Enumerating from a remote session */
7047 /* - Session not open */
7048 callbackData.pDP = pDP[2];
7049 hr = IDirectPlayX_EnumSessions( pDP[2], &dpsd[2], 0,
7051 &callbackData, 0 );
7052 checkHR( DP_OK, hr );
7053
7054
7055 /* - Open session */
7056 callbackData.pDP = pDP[2];
7057 hr = IDirectPlayX_EnumSessions( pDP[2], &dpsd[0], 0, EnumSessions_cb_join,
7058 pDP[2], 0 );
7059 checkHR( DP_OK, hr );
7060 hr = IDirectPlayX_CreatePlayer( pDP[2], &dpid[3],
7061 NULL, NULL, NULL, 0,
7063 checkHR( DP_OK, hr );
7064 hr = IDirectPlayX_CreatePlayer( pDP[2], &dpid[4],
7065 NULL, NULL, NULL, 0,
7066 0 );
7067 checkHR( DP_OK, hr );
7068 hr = IDirectPlayX_CreateGroup( pDP[2], &dpid[6],
7069 NULL, NULL, 0, 0 );
7070 checkHR( DP_OK, hr );
7071
7072 callbackData.dwCounter1 = 0;
7073 callbackData.szTrace2[0] = 0;
7075 &callbackData, 0 );
7076 checkHR( DP_OK, hr );
7077 check( 4, callbackData.dwCounter1 );
7078 checkStr( "4302", callbackData.szTrace1 );
7079 checkStr( "ALL:SPECTATOR:SERVERPLAYER:ALL:", callbackData.szTrace2 );
7080
7081
7082 /* Flag tests */
7083
7084 callbackData.dwCounter1 = 0;
7085 callbackData.szTrace2[0] = 0;
7087 &callbackData, DPENUMPLAYERS_ALL );
7088 checkHR( DP_OK, hr );
7089 check( 4, callbackData.dwCounter1 );
7090 checkStr( "4302", callbackData.szTrace1 );
7091 checkStr( "ALL:SPECTATOR:SERVERPLAYER:ALL:", callbackData.szTrace2 );
7092
7093 callbackData.dwCounter1 = 0;
7094 callbackData.szTrace2[0] = 0;
7096 &callbackData, DPENUMPLAYERS_GROUP );
7097 checkHR( DP_OK, hr );
7098 check( 6, callbackData.dwCounter1 );
7099 checkStr( "430256", callbackData.szTrace1 );
7100 checkStr( "GROUP:"
7101 "GROUP,DPENUMPLAYERS_SPECTATOR:"
7102 "GROUP,DPENUMPLAYERS_SERVERPLAYER:"
7103 "GROUP:ALL:ALL:", callbackData.szTrace2 );
7104
7105 callbackData.dwCounter1 = 0;
7106 callbackData.szTrace2[0] = 0;
7108 &callbackData, DPENUMPLAYERS_LOCAL );
7109 checkHR( DP_OK, hr );
7110 check( 2, callbackData.dwCounter1 );
7111 checkStr( "43", callbackData.szTrace1 );
7112 checkStr( "LOCAL:"
7113 "LOCAL,DPENUMPLAYERS_SPECTATOR:", callbackData.szTrace2 );
7114
7115 callbackData.dwCounter1 = 0;
7116 callbackData.szTrace2[0] = 0;
7118 &callbackData, DPENUMPLAYERS_SERVERPLAYER );
7119 checkHR( DP_OK, hr );
7120 check( 1, callbackData.dwCounter1 );
7121 checkStr( "0", callbackData.szTrace1 );
7122 checkStr( "SERVERPLAYER:", callbackData.szTrace2 );
7123
7124 callbackData.dwCounter1 = 0;
7125 callbackData.szTrace2[0] = 0;
7127 &callbackData, DPENUMPLAYERS_SPECTATOR );
7128 checkHR( DP_OK, hr );
7129 check( 1, callbackData.dwCounter1 );
7130 checkStr( "3", callbackData.szTrace1 );
7131 checkStr( "SPECTATOR:", callbackData.szTrace2 );
7132
7133
7134 IDirectPlayX_Release( pDP[0] );
7135 IDirectPlayX_Release( pDP[1] );
7136 IDirectPlayX_Release( pDP[2] );
7137
7138}
static BOOL CALLBACK EnumSessions_cb_EnumPlayers(LPCDPSESSIONDESC2 lpThisSD, LPDWORD lpdwTimeOut, DWORD dwFlags, LPVOID lpContext)
Definition: dplayx.c:6848

Referenced by START_TEST().

◆ test_EnumSessions()

static void test_EnumSessions ( void  )
static

Definition at line 4092 of file dplayx.c.

4093{
4094 DPSESSIONDESC2 appGuidDpsd =
4095 {
4096 .dwSize = sizeof( DPSESSIONDESC2 ),
4097 .guidApplication = appGuid,
4098 .guidInstance = appGuid,
4099 };
4100 DPSESSIONDESC2 dpsd;
4101 IDirectPlay4 *dpA;
4102 IDirectPlay4 *dp;
4103 HRESULT hr;
4104
4105 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay4A, (void **) &dpA );
4106 ok( hr == DP_OK, "got hr %#lx.\n", hr );
4107 hr = IDirectPlayX_QueryInterface( dpA, &IID_IDirectPlay4, (void **) &dp );
4108 ok( hr == DP_OK, "got hr %#lx.\n", hr );
4109
4110 /* Service provider not initialized */
4111 check_EnumSessions( dpA, &appGuidDpsd, 0, DPERR_UNINITIALIZED, 0, FALSE, FALSE, NULL, 0, TRUE, FALSE );
4112 check_EnumSessions( dp, &appGuidDpsd, 0, DPERR_UNINITIALIZED, 0, FALSE, FALSE, NULL, 0, FALSE, FALSE );
4113
4114 init_TCPIP_provider( dpA, "127.0.0.1", 0 );
4115
4116 /* Session with no size */
4117 dpsd = appGuidDpsd;
4118 dpsd.dwSize = 0;
4119 check_EnumSessions( dpA, &dpsd, 0, DPERR_INVALIDPARAMS, 0, FALSE, FALSE, NULL, 0, TRUE, FALSE );
4120 check_EnumSessions( dp, &dpsd, 0, DPERR_INVALIDPARAMS, 0, FALSE, FALSE, NULL, 0, FALSE, FALSE );
4121
4122 /* No sessions */
4123 check_EnumSessions( dpA, &appGuidDpsd, 0, DP_OK, 0, TRUE, TRUE, NULL, 0, TRUE, FALSE );
4124 check_EnumSessions( dp, &appGuidDpsd, 0, DP_OK, 0, TRUE, TRUE, NULL, 0, FALSE, FALSE );
4125
4126 /* Invalid params */
4127 check_EnumSessions( dpA, &appGuidDpsd, -1, DPERR_INVALIDPARAMS, 0, FALSE, FALSE, NULL, 0, TRUE, TRUE );
4128 check_EnumSessions( dp, &appGuidDpsd, -1, DPERR_INVALIDPARAMS, 0, FALSE, FALSE, NULL, 0, FALSE, TRUE );
4131
4132 /* All sessions are enumerated regardless of flags */
4133 check_EnumSessions( dpA, &appGuidDpsd, 0, DP_OK, 2, TRUE, TRUE, NULL, 2, TRUE, FALSE );
4134 check_EnumSessions( dp, &appGuidDpsd, 0, DP_OK, 2, TRUE, TRUE, NULL, 2, FALSE, FALSE );
4135 check_EnumSessions( dpA, &appGuidDpsd, DPENUMSESSIONS_AVAILABLE, DP_OK, 2, TRUE, TRUE, NULL, 2, TRUE, FALSE );
4136 check_EnumSessions( dp, &appGuidDpsd, DPENUMSESSIONS_AVAILABLE, DP_OK, 2, TRUE, TRUE, NULL, 2, FALSE, FALSE );
4137
4138 /* Async enumeration */
4139 check_EnumSessions_async( &appGuidDpsd, dpA, TRUE );
4140 check_EnumSessions_async( &appGuidDpsd, dp, FALSE );
4141
4142 /* Enumeration with password */
4143 dpsd = appGuidDpsd;
4144 dpsd.lpszPasswordA = (char *) "password";
4145 check_EnumSessions( dpA, &dpsd, 0, DP_OK, 2, TRUE, TRUE, L"password", 2, TRUE, FALSE );
4146 dpsd = appGuidDpsd;
4147 dpsd.lpszPassword = (WCHAR *) L"password";
4148 check_EnumSessions( dp, &dpsd, 0, DP_OK, 2, TRUE, TRUE, L"password", 2, FALSE, FALSE );
4149
4151 IDirectPlayX_Release( dpA );
4152}
#define check_EnumSessions(dp, dpsd, flags, expectedHr, expectedSessionCount, timeoutExpected, requestExpected, expectedPassword, replyCount, ansi, hrTodo)
Definition: dplayx.c:3812
#define check_EnumSessions_async(dpsd, dp, ansi)
Definition: dplayx.c:3920
LPWSTR lpszPassword
Definition: dplay.h:249

Referenced by START_TEST().

◆ test_GetCaps()

static void test_GetCaps ( void  )
static

Definition at line 2704 of file dplayx.c.

2705{
2706
2707 IDirectPlay4 *pDP;
2708 DPCAPS dpcaps;
2709 DWORD dwFlags;
2710 HRESULT hr;
2711
2712
2713 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
2714 &IID_IDirectPlay4A, (LPVOID*) &pDP );
2715 ok (SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n");
2716 if (FAILED(hr)) return;
2717
2718 ZeroMemory( &dpcaps, sizeof(DPCAPS) );
2719
2720 /* Service provider not ininitialized */
2721 hr = IDirectPlayX_GetCaps( pDP, &dpcaps, 0 );
2723
2724 init_TCPIP_provider( pDP, "127.0.0.1", 0 );
2725
2726 /* dpcaps not ininitialized */
2727 hr = IDirectPlayX_GetCaps( pDP, &dpcaps, 0 );
2729
2730 dpcaps.dwSize = sizeof(DPCAPS);
2731
2732 for (dwFlags=0;
2735 {
2736
2737 hr = IDirectPlayX_GetCaps( pDP, &dpcaps, dwFlags );
2738 checkHR( DP_OK, hr );
2739 check( sizeof(DPCAPS), dpcaps.dwSize );
2743 dpcaps.dwFlags );
2744 check( 0, dpcaps.dwMaxQueueSize );
2745 check( 0, dpcaps.dwHundredBaud );
2746 check( 500, dpcaps.dwLatency );
2747 check( 65536, dpcaps.dwMaxLocalPlayers );
2748 check( 20, dpcaps.dwHeaderLength );
2749 check( 5000, dpcaps.dwTimeout );
2750
2751 switch (dwFlags)
2752 {
2753 case 0:
2754 check( 65479, dpcaps.dwMaxBufferSize );
2755 check( 65536, dpcaps.dwMaxPlayers );
2756 break;
2758 check( 1048547, dpcaps.dwMaxBufferSize );
2759 check( 64, dpcaps.dwMaxPlayers );
2760 break;
2761 default: break;
2762 }
2763 }
2764
2765 IDirectPlayX_Release( pDP );
2766}
#define IDirectPlayX_GetCaps(p, a, b)
Definition: dplay.h:879
struct tagDPCAPS DPCAPS
DWORD dwSize
Definition: dplay.h:169
DWORD dwFlags
Definition: dplay.h:170
DWORD dwMaxPlayers
Definition: dplay.h:173
DWORD dwHundredBaud
Definition: dplay.h:174
DWORD dwMaxBufferSize
Definition: dplay.h:171
DWORD dwMaxLocalPlayers
Definition: dplay.h:178
DWORD dwLatency
Definition: dplay.h:177
DWORD dwMaxQueueSize
Definition: dplay.h:172
DWORD dwTimeout
Definition: dplay.h:180
DWORD dwHeaderLength
Definition: dplay.h:179

Referenced by START_TEST().

◆ test_GetMessageCount()

static void test_GetMessageCount ( void  )
static

Definition at line 9326 of file dplayx.c.

9327{
9328
9329 IDirectPlay4 *pDP[2];
9330 DPSESSIONDESC2 dpsd;
9331 DPID dpid[4];
9332 HRESULT hr;
9333 UINT i;
9334 DWORD dwCount;
9335
9336 DWORD dwDataSize = 1024;
9337 LPVOID lpData = calloc( 1, dwDataSize );
9338 CallbackData callbackData;
9339
9340
9341 for (i=0; i<2; i++)
9342 {
9343 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
9344 &IID_IDirectPlay4A, (LPVOID*) &pDP[i] );
9345 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
9346 if (FAILED(hr)) return;
9347 }
9348 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
9349
9350 dwCount = -1;
9351 hr = IDirectPlayX_GetMessageCount( pDP[0], 0, &dwCount );
9353 check( -1, dwCount );
9354
9355 if ( hr == DP_OK )
9356 {
9357 todo_wine win_skip( "GetMessageCount not implemented\n" );
9358 return;
9359 }
9360
9361
9362 init_TCPIP_provider( pDP[0], "127.0.0.1", 0 );
9363 init_TCPIP_provider( pDP[1], "127.0.0.1", 0 );
9364
9365
9366 dwCount = -1;
9367 hr = IDirectPlayX_GetMessageCount( pDP[0], 0, &dwCount );
9368 checkHR( DP_OK, hr );
9369 check( 0, dwCount );
9370
9371
9372 dpsd.dwSize = sizeof(DPSESSIONDESC2);
9373 dpsd.guidApplication = appGuid;
9374 dpsd.dwMaxPlayers = 10;
9375 IDirectPlayX_Open( pDP[0], &dpsd, DPOPEN_CREATE );
9377 pDP[1], 0 );
9378
9379 IDirectPlayX_CreatePlayer( pDP[0], &dpid[0], NULL, NULL, NULL, 0, 0 );
9380 IDirectPlayX_CreatePlayer( pDP[0], &dpid[1], NULL, NULL, NULL, 0, 0 );
9381 IDirectPlayX_CreatePlayer( pDP[1], &dpid[3], NULL, NULL, NULL, 0, 0 );
9382 IDirectPlayX_CreatePlayer( pDP[0], &dpid[2], NULL, NULL, NULL, 0, 0 );
9383
9384
9385 /* Incorrect parameters */
9386 dwCount = -1;
9387 hr = IDirectPlayX_GetMessageCount( pDP[0], dpid[0], NULL );
9389 check( -1, dwCount );
9390
9391 dwCount = -1;
9392 hr = IDirectPlayX_GetMessageCount( pDP[0], 0, NULL );
9394 check( -1, dwCount );
9395
9396 dwCount = -1;
9397 hr = IDirectPlayX_GetMessageCount( pDP[0], -1, &dwCount );
9399 check( -1, dwCount );
9400
9401
9402 /* Correct parameters */
9403 /* Player creation messages */
9404 dwCount = -1;
9405 hr = IDirectPlayX_GetMessageCount( pDP[0], 0, &dwCount );
9406 checkHR( DP_OK, hr );
9407 check( 5, dwCount );
9408
9409 dwCount = -1;
9410 hr = IDirectPlayX_GetMessageCount( pDP[1], 0, &dwCount );
9411 checkHR( DP_OK, hr );
9412 check( 1, dwCount );
9413
9414 dwCount = -1;
9415 hr = IDirectPlayX_GetMessageCount( pDP[0], dpid[0], &dwCount );
9416 checkHR( DP_OK, hr );
9417 check( 3, dwCount );
9418
9419 dwCount = -1;
9420 hr = IDirectPlayX_GetMessageCount( pDP[0], dpid[1], &dwCount );
9421 checkHR( DP_OK, hr );
9422 check( 2, dwCount );
9423
9424 dwCount = -1;
9425 hr = IDirectPlayX_GetMessageCount( pDP[0], dpid[3], &dwCount );
9426 checkHR( DP_OK, hr );
9427 /* Remote player: doesn't throw error but result is 0 and not 1 */
9428 check( 0, dwCount );
9429
9430 dwCount = -1;
9431 hr = IDirectPlayX_GetMessageCount( pDP[1], dpid[3], &dwCount );
9432 checkHR( DP_OK, hr );
9433 check( 1, dwCount );
9434
9435 dwCount = -1;
9436 hr = IDirectPlayX_GetMessageCount( pDP[0], dpid[1], &dwCount );
9437 checkHR( DP_OK, hr );
9438 check( 2, dwCount );
9439
9440
9441 /* Purge queues */
9442 check_messages( pDP[0], dpid, 6, &callbackData );
9443 checkStr( "S0,S1,S0,S1,S0,", callbackData.szTrace1 );
9444 check_messages( pDP[1], dpid, 6, &callbackData );
9445 checkStr( "S3,", callbackData.szTrace1 );
9446
9447
9448 /* Ensure queues is purged */
9449 dwCount = -1;
9450 hr = IDirectPlayX_GetMessageCount( pDP[0], 0, &dwCount );
9451 checkHR( DP_OK, hr );
9452 check( 0, dwCount );
9453
9454 dwCount = -1;
9455 hr = IDirectPlayX_GetMessageCount( pDP[1], 0, &dwCount );
9456 checkHR( DP_OK, hr );
9457 check( 0, dwCount );
9458
9459
9460 /* Send data messages */
9461 for (i=0; i<5; i++)
9462 IDirectPlayX_Send( pDP[0], dpid[0], dpid[1], 0, lpData, dwDataSize );
9463 for (i=0; i<6; i++)
9464 IDirectPlayX_Send( pDP[0], dpid[1], dpid[2], 0, lpData, dwDataSize );
9465 for (i=0; i<7; i++)
9466 IDirectPlayX_Send( pDP[0], dpid[2], dpid[3], 0, lpData, dwDataSize );
9467
9468
9469 /* Check all messages are in the queues */
9470 dwCount = -1;
9471 hr = IDirectPlayX_GetMessageCount( pDP[0], 0, &dwCount );
9472 checkHR( DP_OK, hr );
9473 check( 11, dwCount );
9474
9475 dwCount = -1;
9476 hr = IDirectPlayX_GetMessageCount( pDP[1], 0, &dwCount );
9477 checkHR( DP_OK, hr );
9478 check( 7, dwCount );
9479
9480 dwCount = -1;
9481 hr = IDirectPlayX_GetMessageCount( pDP[0], dpid[0], &dwCount );
9482 checkHR( DP_OK, hr );
9483 check( 0, dwCount );
9484
9485 dwCount = -1;
9486 hr = IDirectPlayX_GetMessageCount( pDP[0], dpid[1], &dwCount );
9487 checkHR( DP_OK, hr );
9488 check( 5, dwCount );
9489
9490 dwCount = -1;
9491 hr = IDirectPlayX_GetMessageCount( pDP[0], dpid[2], &dwCount );
9492 checkHR( DP_OK, hr );
9493 check( 6, dwCount );
9494
9495 dwCount = -1;
9496 hr = IDirectPlayX_GetMessageCount( pDP[1], dpid[3], &dwCount );
9497 checkHR( DP_OK, hr );
9498 check( 7, dwCount );
9499
9500
9501 /* Purge queues again */
9502 check_messages( pDP[0], dpid, 6, &callbackData );
9503 checkStr( "01,01,01,01,01,"
9504 "12,12,12,12,12,12,", callbackData.szTrace1 );
9505 check_messages( pDP[1], dpid, 6, &callbackData );
9506 checkStr( "23,23,23,23,23,23,23,", callbackData.szTrace1 );
9507
9508
9509 /* Check queues are purged */
9510 dwCount = -1;
9511 hr = IDirectPlayX_GetMessageCount( pDP[0], 0, &dwCount );
9512 checkHR( DP_OK, hr );
9513 check( 0, dwCount );
9514
9515 dwCount = -1;
9516 hr = IDirectPlayX_GetMessageCount( pDP[1], 0, &dwCount );
9517 checkHR( DP_OK, hr );
9518 check( 0, dwCount );
9519
9520 dwCount = -1;
9521 hr = IDirectPlayX_GetMessageCount( pDP[0], dpid[0], &dwCount );
9522 checkHR( DP_OK, hr );
9523 check( 0, dwCount );
9524
9525 dwCount = -1;
9526 hr = IDirectPlayX_GetMessageCount( pDP[0], dpid[1], &dwCount );
9527 checkHR( DP_OK, hr );
9528 check( 0, dwCount );
9529
9530 dwCount = -1;
9531 hr = IDirectPlayX_GetMessageCount( pDP[0], dpid[2], &dwCount );
9532 checkHR( DP_OK, hr );
9533 check( 0, dwCount );
9534
9535 dwCount = -1;
9536 hr = IDirectPlayX_GetMessageCount( pDP[1], dpid[3], &dwCount );
9537 checkHR( DP_OK, hr );
9538 check( 0, dwCount );
9539
9540
9541 free( lpData );
9542 IDirectPlayX_Release( pDP[0] );
9543 IDirectPlayX_Release( pDP[1] );
9544
9545}
#define IDirectPlayX_Send(p, a, b, c, d, e)
Definition: dplay.h:891
#define IDirectPlayX_GetMessageCount(p, a, b)
Definition: dplay.h:882

Referenced by START_TEST().

◆ test_GetMessageQueue()

static void test_GetMessageQueue ( void  )
static

Definition at line 9549 of file dplayx.c.

9550{
9551 BYTE playerData[] = { 1, 2, 3, 4, 5, 6, 7, 8, };
9552 BYTE data[] = { 1, 2, 3, 4, };
9553 DPSESSIONDESC2 appGuidDpsd =
9554 {
9555 .dwSize = sizeof( DPSESSIONDESC2 ),
9556 .guidApplication = appGuid,
9557 .guidInstance = appGuid,
9558 };
9559 DPSESSIONDESC2 serverDpsd =
9560 {
9561 .dwSize = sizeof( DPSESSIONDESC2 ),
9562 .guidApplication = appGuid,
9563 .guidInstance = appGuid,
9564 .lpszSessionName = (WCHAR *) L"normal",
9565 .dwReserved1 = 0xaabbccdd,
9566 };
9567 DPNAME name =
9568 {
9569 .dwSize = sizeof( DPNAME ),
9570 .lpszShortNameA = (char *) "short name",
9571 };
9572 DWORD createPlayerMsgSize;
9574 IDirectPlay4 *dpA;
9575 IDirectPlay4 *dp;
9576 DWORD waitResult;
9577 SOCKET sendSock;
9578 SOCKET recvSock;
9580 DWORD msgCount;
9581 HANDLE event;
9582 HRESULT hr;
9583 DPID dpid;
9584
9585 event = CreateEventA( NULL, FALSE, FALSE, NULL );
9586
9587 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay4A, (void **) &dpA );
9588 ok( hr == DP_OK, "got hr %#lx.\n", hr );
9589 hr = IDirectPlayX_QueryInterface( dpA, &IID_IDirectPlay4, (void **) &dp );
9590 ok( hr == DP_OK, "got hr %#lx.\n", hr );
9591
9592 msgCount = 0xdeadbeef;
9593 byteCount = 0xdeadbeef;
9594 hr = IDirectPlayX_GetMessageQueue( dpA, 0, 0, 0, &msgCount, &byteCount );
9595 ok( hr == DPERR_UNINITIALIZED, "got hr %#lx.\n", hr );
9596 ok( msgCount == 0xdeadbeef, "got message count %lu.\n", msgCount );
9597 ok( byteCount == 0xdeadbeef, "got byte count %lu.\n", byteCount );
9598
9599 init_TCPIP_provider( dpA, "127.0.0.1", 0 );
9600
9601 msgCount = 0xdeadbeef;
9602 byteCount = 0xdeadbeef;
9604 ok( hr == DPERR_INVALIDFLAGS, "got hr %#lx.\n", hr );
9605 ok( msgCount == 0xdeadbeef, "got message count %lu.\n", msgCount );
9606 ok( byteCount == 0xdeadbeef, "got byte count %lu.\n", byteCount );
9607
9608 msgCount = 0xdeadbeef;
9609 byteCount = 0xdeadbeef;
9610 hr = IDirectPlayX_GetMessageQueue( dpA, 0, 0, 4, &msgCount, &byteCount );
9611 ok( hr == DPERR_INVALIDFLAGS, "got hr %#lx.\n", hr );
9612 ok( msgCount == 0xdeadbeef, "got message count %lu.\n", msgCount );
9613 ok( byteCount == 0xdeadbeef, "got byte count %lu.\n", byteCount );
9614
9615 msgCount = 0xdeadbeef;
9616 byteCount = 0xdeadbeef;
9617 hr = IDirectPlayX_GetMessageQueue( dpA, 0x07734, 0, DPMESSAGEQUEUE_RECEIVE, &msgCount, &byteCount );
9618 ok( hr == DPERR_INVALIDPLAYER, "got hr %#lx.\n", hr );
9619 ok( msgCount == 0xdeadbeef, "got message count %lu.\n", msgCount );
9620 ok( byteCount == 0xdeadbeef, "got byte count %lu.\n", byteCount );
9621
9622 msgCount = 0xdeadbeef;
9623 byteCount = 0xdeadbeef;
9624 hr = IDirectPlayX_GetMessageQueue( dpA, 0, 0x07734, DPMESSAGEQUEUE_RECEIVE, &msgCount, &byteCount );
9625 ok( hr == DPERR_INVALIDPLAYER, "got hr %#lx.\n", hr );
9626 ok( msgCount == 0xdeadbeef, "got message count %lu.\n", msgCount );
9627 ok( byteCount == 0xdeadbeef, "got byte count %lu.\n", byteCount );
9628
9629 msgCount = 0xdeadbeef;
9630 byteCount = 0xdeadbeef;
9632 ok( hr == DP_OK, "got hr %#lx.\n", hr );
9633 ok( msgCount == 0, "got message count %lu.\n", msgCount );
9634 ok( byteCount == 0, "got byte count %lu.\n", byteCount );
9635
9636 joinSession( dpA, &appGuidDpsd, &serverDpsd, &sendSock, &recvSock, NULL );
9637
9638 createPlayer( dpA, 0x07734, NULL, NULL, 0, 0, sendSock, recvSock );
9639
9640 msgCount = 0xdeadbeef;
9641 byteCount = 0xdeadbeef;
9642 hr = IDirectPlayX_GetMessageQueue( dpA, 0x07734, 0, DPMESSAGEQUEUE_RECEIVE, &msgCount, &byteCount );
9643 ok( hr == DP_OK, "got hr %#lx.\n", hr );
9644 ok( msgCount == 0, "got message count %lu.\n", msgCount );
9645 ok( byteCount == 0, "got byte count %lu.\n", byteCount );
9646
9647 msgCount = 0xdeadbeef;
9648 byteCount = 0xdeadbeef;
9649 hr = IDirectPlayX_GetMessageQueue( dpA, 0, 0x07734, DPMESSAGEQUEUE_RECEIVE, &msgCount, &byteCount );
9650 ok( hr == DP_OK, "got hr %#lx.\n", hr );
9651 ok( msgCount == 0, "got message count %lu.\n", msgCount );
9652 ok( byteCount == 0, "got byte count %lu.\n", byteCount );
9653
9654 msgCount = 0xdeadbeef;
9655 byteCount = 0xdeadbeef;
9656 hr = IDirectPlayX_GetMessageQueue( dpA, 0x1337, 0, DPMESSAGEQUEUE_RECEIVE, &msgCount, &byteCount );
9657 ok( hr == DP_OK, "got hr %#lx.\n", hr );
9658 ok( msgCount == 0, "got message count %lu.\n", msgCount );
9659 ok( byteCount == 0, "got byte count %lu.\n", byteCount );
9660
9661 msgCount = 0xdeadbeef;
9662 byteCount = 0xdeadbeef;
9663 hr = IDirectPlayX_GetMessageQueue( dpA, 0, 0x1337, DPMESSAGEQUEUE_RECEIVE, &msgCount, &byteCount );
9664 ok( hr == DPERR_INVALIDPLAYER, "got hr %#lx.\n", hr );
9665 ok( msgCount == 0xdeadbeef, "got message count %lu.\n", msgCount );
9666 ok( byteCount == 0xdeadbeef, "got byte count %lu.\n", byteCount );
9667
9668 msgCount = 0xdeadbeef;
9669 byteCount = 0xdeadbeef;
9670 hr = IDirectPlayX_GetMessageQueue( dpA, 0x5e7, 0, DPMESSAGEQUEUE_RECEIVE, &msgCount, &byteCount );
9671 ok( hr == DPERR_INVALIDPLAYER, "got hr %#lx.\n", hr );
9672 ok( msgCount == 0xdeadbeef, "got message count %lu.\n", msgCount );
9673 ok( byteCount == 0xdeadbeef, "got byte count %lu.\n", byteCount );
9674
9675 msgCount = 0xdeadbeef;
9676 byteCount = 0xdeadbeef;
9677 hr = IDirectPlayX_GetMessageQueue( dpA, 0, 0x5e7, DPMESSAGEQUEUE_RECEIVE, &msgCount, &byteCount );
9678 ok( hr == DPERR_INVALIDPLAYER, "got hr %#lx.\n", hr );
9679 ok( msgCount == 0xdeadbeef, "got message count %lu.\n", msgCount );
9680 ok( byteCount == 0xdeadbeef, "got byte count %lu.\n", byteCount );
9681
9682 dpid = 0xdeadbeef;
9683 param = createPlayerAsync( dpA, &dpid, &name, event, playerData, sizeof( playerData ), 0 );
9685 sendRequestPlayerReply( sendSock, 2349, 0x14, DP_OK );
9686 receiveCreatePlayer( recvSock, 0x14, DPPLAYER_LOCAL, L"short name", NULL, playerData, sizeof( playerData ) );
9687 hr = createPlayerAsyncWait( param, 2000 );
9688 ok( hr == DP_OK, "got hr %#lx.\n", hr );
9689 ok( dpid == 0x14, "got dpid %#lx.\n", dpid );
9690
9691 sendGuaranteedGameMessage( sendSock, 2349, 0x1337, 0x14, data, sizeof( data ) );
9692
9693 waitResult = WaitForSingleObject( event, 2000 );
9694 ok( waitResult == WAIT_OBJECT_0, "message wait returned %lu\n", waitResult );
9695
9696 /* Both UNICODE and ANSI GetMessageQueue() return the same size. */
9697 createPlayerMsgSize = sizeof( DPMSG_CREATEPLAYERORGROUP ) + sizeof( playerData ) + sizeof( L"short name" );
9698
9699 msgCount = 0xdeadbeef;
9700 byteCount = 0xdeadbeef;
9701 hr = IDirectPlayX_GetMessageQueue( dpA, 0, 0x07734, DPMESSAGEQUEUE_RECEIVE, &msgCount, &byteCount );
9702 ok( hr == DP_OK, "got hr %#lx.\n", hr );
9703 ok( msgCount == 1, "got message count %lu.\n", msgCount );
9704 ok( byteCount == createPlayerMsgSize, "got byte count %lu.\n", byteCount );
9705
9706 msgCount = 0xdeadbeef;
9707 byteCount = 0xdeadbeef;
9708 hr = IDirectPlayX_GetMessageQueue( dp, 0, 0x07734, DPMESSAGEQUEUE_RECEIVE, &msgCount, &byteCount );
9709 ok( hr == DP_OK, "got hr %#lx.\n", hr );
9710 ok( msgCount == 1, "got message count %lu.\n", msgCount );
9711 ok( byteCount == createPlayerMsgSize, "got byte count %lu.\n", byteCount );
9712
9713 msgCount = 0xdeadbeef;
9714 byteCount = 0xdeadbeef;
9715 hr = IDirectPlayX_GetMessageQueue( dpA, 0x1337, 0, DPMESSAGEQUEUE_RECEIVE, &msgCount, &byteCount );
9716 ok( hr == DP_OK, "got hr %#lx.\n", hr );
9717 ok( msgCount == 1, "got message count %lu.\n", msgCount );
9718 ok( byteCount == sizeof( data ), "got byte count %lu.\n", byteCount );
9719
9720 msgCount = 0xdeadbeef;
9721 byteCount = 0xdeadbeef;
9723 ok( hr == DP_OK, "got hr %#lx.\n", hr );
9724 ok( msgCount == 2, "got message count %lu.\n", msgCount );
9725 ok( byteCount == createPlayerMsgSize + sizeof( data ), "got byte count %lu.\n", byteCount );
9726
9727 closesocket( recvSock );
9728 closesocket( sendSock );
9729
9731 IDirectPlayX_Release( dpA );
9732
9733 CloseHandle( event );
9734}
#define IDirectPlayX_GetMessageQueue(p, a, b, c, d, e)
Definition: dplay.h:917
#define receiveRequestPlayerId(sock, expectedFlags)
Definition: dplayx.c:1358
#define sendGuaranteedGameMessage(sock, port, fromId, toId, data, dataSize)
Definition: dplayx.c:2080
#define receiveCreatePlayer(sock, expectedPlayerId, expectedFlags, expectedShortName, expectedLongName, expectedPlayerData, expectedPlayerDataSize)
Definition: dplayx.c:1833
#define sendRequestPlayerReply(sock, port, id, result)
Definition: dplayx.c:1381
UCHAR byteCount
Definition: scsi.h:3755

Referenced by START_TEST().

◆ test_GetPlayerAccount()

static void test_GetPlayerAccount ( void  )
static

Definition at line 5994 of file dplayx.c.

5995{
5996
5997 IDirectPlay4 *pDP[2];
5998 DPSESSIONDESC2 dpsd;
5999 DPID dpid[2];
6000 HRESULT hr;
6001 UINT i;
6002
6003 DWORD dwDataSize = 1024;
6004 LPVOID lpData = calloc( 1, dwDataSize );
6005
6006
6007 for (i=0; i<2; i++)
6008 {
6009 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
6010 &IID_IDirectPlay4A, (LPVOID*) &pDP[i] );
6011 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
6012 if (FAILED(hr)) return;
6013 }
6014 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
6015 dpsd.dwSize = sizeof(DPSESSIONDESC2);
6016 dpsd.guidApplication = appGuid;
6017 dpsd.dwMaxPlayers = 10;
6018
6019 /* Uninitialized service provider */
6020 hr = IDirectPlayX_GetPlayerAccount( pDP[0], 0, 0, lpData, &dwDataSize );
6022
6023 if ( hr == DP_OK )
6024 {
6025 todo_wine win_skip( "GetPlayerAccount not implemented\n" );
6026 return;
6027 }
6028
6029
6030 init_TCPIP_provider( pDP[0], "127.0.0.1", 0 );
6031 init_TCPIP_provider( pDP[1], "127.0.0.1", 0 );
6032
6033
6034 /* No session */
6035 hr = IDirectPlayX_GetPlayerAccount( pDP[0], 0, 0, lpData, &dwDataSize );
6037
6038
6039 IDirectPlayX_Open( pDP[0], &dpsd, DPOPEN_CREATE );
6041 pDP[1], 0 );
6042
6043 for (i=0; i<2; i++)
6044 {
6045 hr = IDirectPlayX_CreatePlayer( pDP[i], &dpid[i], NULL, NULL, NULL,
6046 0, 0 );
6047 checkHR( DP_OK, hr );
6048 }
6049
6050
6051 /* Session is not secure */
6052 dwDataSize = 1024;
6053 hr = IDirectPlayX_GetPlayerAccount( pDP[0], dpid[0], 0,
6054 lpData, &dwDataSize );
6056 check( 1024, dwDataSize );
6057
6058
6059 /* Open a secure session */
6060 for (i=0; i<2; i++)
6061 {
6062 hr = IDirectPlayX_Close( pDP[i] );
6063 checkHR( DP_OK, hr );
6064 }
6065
6067 hr = IDirectPlayX_SecureOpen( pDP[0], &dpsd, DPOPEN_CREATE, NULL, NULL );
6068 checkHR( DP_OK, hr );
6069
6070 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid[0],
6071 NULL, NULL, NULL, 0, 0 );
6072 checkHR( DP_OK, hr );
6073
6074 hr = IDirectPlayX_EnumSessions( pDP[1], &dpsd, 0,
6075 EnumSessions_cb_join_secure, pDP[1], 0 );
6076 checkHR( DP_OK, hr );
6077
6078 hr = IDirectPlayX_CreatePlayer( pDP[1], &dpid[1],
6079 NULL, NULL, NULL, 0, 0 );
6081
6082 /* TODO: Player creation so that this works */
6083
6084 /* Invalid player */
6085 dwDataSize = 1024;
6086 hr = IDirectPlayX_GetPlayerAccount( pDP[0], 0, 0,
6087 lpData, &dwDataSize );
6089 check( 1024, dwDataSize );
6090
6091 /* Invalid flags */
6092 dwDataSize = 1024;
6093 hr = IDirectPlayX_GetPlayerAccount( pDP[0], dpid[0], -1,
6094 lpData, &dwDataSize );
6096 check( 1024, dwDataSize );
6097
6098 dwDataSize = 1024;
6099 hr = IDirectPlayX_GetPlayerAccount( pDP[0], dpid[0], 1,
6100 lpData, &dwDataSize );
6102 check( 1024, dwDataSize );
6103
6104 /* Small buffer */
6105 dwDataSize = 1024;
6106 hr = IDirectPlayX_GetPlayerAccount( pDP[0], dpid[0], 0,
6107 NULL, &dwDataSize );
6109 check( 0, dwDataSize );
6110
6111 dwDataSize = 0;
6112 hr = IDirectPlayX_GetPlayerAccount( pDP[0], dpid[0], 0,
6113 lpData, &dwDataSize );
6115 check( 0, dwDataSize );
6116
6117 hr = IDirectPlayX_GetPlayerAccount( pDP[0], dpid[0], 0,
6118 lpData, &dwDataSize );
6120 check( 0, dwDataSize );
6121
6122 /* Normal operation */
6123 dwDataSize = 1024;
6124 hr = IDirectPlayX_GetPlayerAccount( pDP[0], dpid[0], 0,
6125 lpData, &dwDataSize );
6127 check( 1024, dwDataSize );
6128
6129
6130 free( lpData );
6131 IDirectPlayX_Release( pDP[0] );
6132 IDirectPlayX_Release( pDP[1] );
6133
6134}
#define IDirectPlayX_GetPlayerAccount(p, a, b, c, d)
Definition: dplay.h:911
static BOOL CALLBACK EnumSessions_cb_join_secure(LPCDPSESSIONDESC2 lpThisSD, LPDWORD lpdwTimeOut, DWORD dwFlags, LPVOID lpContext)
Definition: dplayx.c:5961

Referenced by START_TEST().

◆ test_GetPlayerAddress()

static void test_GetPlayerAddress ( void  )
static

Definition at line 6178 of file dplayx.c.

6179{
6180
6181 IDirectPlay4 *pDP[2];
6182 IDirectPlayLobby3 *pDPL;
6183 DPSESSIONDESC2 dpsd;
6184 DPID dpid[2];
6185 CallbackData callbackData;
6186 HRESULT hr;
6187 UINT i;
6188
6189 DWORD dwDataSize = 1024;
6190 LPVOID lpData = calloc( 1, dwDataSize );
6191
6192
6193 for (i=0; i<2; i++)
6194 {
6195 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
6196 &IID_IDirectPlay4A, (LPVOID*) &pDP[i] );
6197 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
6198 if (FAILED(hr)) return;
6199 }
6200 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
6201 hr = CoCreateInstance( &CLSID_DirectPlayLobby, NULL, CLSCTX_ALL,
6202 &IID_IDirectPlayLobby3A, (LPVOID*) &pDPL );
6203 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlayLobby / IID_IDirectPlayLobby3A failed\n" );
6204 if (FAILED(hr)) return;
6205
6206 /* Uninitialized service provider */
6207 hr = IDirectPlayX_GetPlayerAddress( pDP[0], 0, lpData, &dwDataSize );
6209
6210 if ( hr == DP_OK )
6211 {
6212 todo_wine win_skip( "GetPlayerAddress not implemented\n" );
6213 goto cleanup;
6214 }
6215
6216 init_TCPIP_provider( pDP[0], "127.0.0.1", 0 );
6217 init_TCPIP_provider( pDP[1], "127.0.0.1", 0 );
6218
6219
6220 /* No session */
6221 dwDataSize = 1024;
6222 hr = IDirectPlayX_GetPlayerAddress( pDP[0], 0, lpData, &dwDataSize );
6224 check( 1024, dwDataSize );
6225
6226 dwDataSize = 1024;
6227 hr = IDirectPlayX_GetPlayerAddress( pDP[0], 1, lpData, &dwDataSize );
6229 check( 1024, dwDataSize );
6230
6231
6232 dpsd.dwSize = sizeof(DPSESSIONDESC2);
6233 dpsd.guidApplication = appGuid;
6234 dpsd.dwMaxPlayers = 10;
6235 IDirectPlayX_Open( pDP[0], &dpsd, DPOPEN_CREATE );
6237 pDP[1], 0 );
6238
6239 for (i=0; i<2; i++)
6240 {
6241 hr = IDirectPlayX_CreatePlayer( pDP[i], &dpid[i], NULL, NULL, NULL,
6242 0, 0 );
6243 checkHR( DP_OK, hr );
6244 }
6245
6246 /* Invalid player */
6247 dwDataSize = 1024;
6248 hr = IDirectPlayX_GetPlayerAddress( pDP[0], 0,
6249 lpData, &dwDataSize );
6251 check( 1024, dwDataSize );
6252
6253 dwDataSize = 1024;
6254 hr = IDirectPlayX_GetPlayerAddress( pDP[0], 1,
6255 lpData, &dwDataSize );
6257 check( 1024, dwDataSize );
6258
6259 /* Small buffer */
6260 dwDataSize = 1024;
6261 hr = IDirectPlayX_GetPlayerAddress( pDP[0], dpid[0],
6262 NULL, &dwDataSize );
6264 check( 136, dwDataSize );
6265
6266 dwDataSize = 0;
6267 hr = IDirectPlayX_GetPlayerAddress( pDP[0], dpid[0],
6268 lpData, &dwDataSize );
6270 check( 136, dwDataSize );
6271
6272 hr = IDirectPlayX_GetPlayerAddress( pDP[0], dpid[0],
6273 lpData, &dwDataSize );
6274 checkHR( DP_OK, hr );
6275 check( 136, dwDataSize );
6276
6277
6278 /* Regular parameters */
6279 callbackData.dwCounter1 = 0;
6280
6281 /* - Local */
6282 dwDataSize = 1024;
6283 hr = IDirectPlayX_GetPlayerAddress( pDP[0], dpid[0],
6284 lpData, &dwDataSize );
6285 checkHR( DP_OK, hr );
6286 check( 136, dwDataSize );
6287
6288 hr = IDirectPlayLobby_EnumAddress( pDPL, EnumAddress_cb, lpData, dwDataSize,
6289 &callbackData );
6290 checkHR( DP_OK, hr );
6291
6292 check( 4, callbackData.dwCounter1 );
6293
6294 /* - Remote */
6295 dwDataSize = 1024;
6296 hr = IDirectPlayX_GetPlayerAddress( pDP[0], dpid[1],
6297 lpData, &dwDataSize );
6298 checkHR( DP_OK, hr );
6299 check( 130, dwDataSize );
6300
6301 hr = IDirectPlayLobby_EnumAddress( pDPL, EnumAddress_cb, lpData, dwDataSize,
6302 &callbackData );
6303 checkHR( DP_OK, hr );
6304
6305 check( 8, callbackData.dwCounter1 );
6306
6307
6308 free( lpData );
6309
6310cleanup:
6311 IDirectPlayX_Release( pDP[0] );
6312 IDirectPlayX_Release( pDP[1] );
6314}
static void cleanup(void)
Definition: main.c:1335
#define IDirectPlayX_GetPlayerAddress(p, a, b, c)
Definition: dplay.h:883
static BOOL CALLBACK EnumAddress_cb(REFGUID guidDataType, DWORD dwDataSize, LPCVOID lpData, LPVOID lpContext)
Definition: dplayx.c:6138

Referenced by START_TEST().

◆ test_GetPlayerCaps()

static void test_GetPlayerCaps ( void  )
static

Definition at line 5282 of file dplayx.c.

5283{
5284
5285 IDirectPlay4 *pDP[2];
5286 DPSESSIONDESC2 dpsd;
5287 DPID dpid[2];
5288 HRESULT hr;
5289 UINT i;
5290
5291 DPCAPS playerCaps;
5292 DWORD dwFlags;
5293
5294
5295 for (i=0; i<2; i++)
5296 {
5297 hr= CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
5298 &IID_IDirectPlay4A, (LPVOID*) &pDP[i] );
5299 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
5300 if (FAILED(hr)) return;
5301 }
5302 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
5303 dpsd.dwSize = sizeof(DPSESSIONDESC2);
5304 dpsd.guidApplication = appGuid;
5305 dpsd.dwMaxPlayers = 10;
5306
5307 ZeroMemory( &playerCaps, sizeof(DPCAPS) );
5308
5309
5310 /* Uninitialized service provider */
5311 playerCaps.dwSize = 0;
5312 hr = IDirectPlayX_GetPlayerCaps( pDP[0], 0, &playerCaps, 0 );
5314
5315 playerCaps.dwSize = sizeof(DPCAPS);
5316 hr = IDirectPlayX_GetPlayerCaps( pDP[0], 0, &playerCaps, 0 );
5318
5319
5320 init_TCPIP_provider( pDP[0], "127.0.0.1", 0 );
5321 init_TCPIP_provider( pDP[1], "127.0.0.1", 0 );
5322
5323
5324 /* No session */
5325 playerCaps.dwSize = 0;
5326
5327 hr = IDirectPlayX_GetPlayerCaps( pDP[0], 0, &playerCaps, 0 );
5329
5330 if ( hr == DPERR_UNINITIALIZED )
5331 {
5332 todo_wine win_skip( "GetPlayerCaps not implemented\n" );
5333 return;
5334 }
5335
5336 playerCaps.dwSize = sizeof(DPCAPS);
5337
5338 hr = IDirectPlayX_GetPlayerCaps( pDP[0], 0, &playerCaps, 0 );
5340
5341 hr = IDirectPlayX_GetPlayerCaps( pDP[0], 2, &playerCaps, 0 );
5343
5344
5345 hr = IDirectPlayX_Open( pDP[0], &dpsd, DPOPEN_CREATE );
5346 checkHR( DP_OK, hr );
5348 pDP[1], 0 );
5349 checkHR( DP_OK, hr );
5350
5351 for (i=0; i<2; i++)
5352 {
5353 hr = IDirectPlayX_CreatePlayer( pDP[i], &dpid[i],
5354 NULL, NULL, NULL, 0, 0 );
5355 checkHR( DP_OK, hr );
5356 }
5357
5358
5359 /* Uninitialized playerCaps */
5360 playerCaps.dwSize = 0;
5361
5362 hr = IDirectPlayX_GetPlayerCaps( pDP[0], 0, &playerCaps, 0 );
5364
5365 hr = IDirectPlayX_GetPlayerCaps( pDP[0], 2, &playerCaps, 0 );
5367
5368 hr = IDirectPlayX_GetPlayerCaps( pDP[0], dpid[0], &playerCaps, 0 );
5370
5371 /* Invalid player */
5372 playerCaps.dwSize = sizeof(DPCAPS);
5373
5374 hr = IDirectPlayX_GetPlayerCaps( pDP[0], 0, &playerCaps, 0 );
5376
5377 hr = IDirectPlayX_GetPlayerCaps( pDP[0], 2, &playerCaps, 0 );
5379
5380 hr = IDirectPlayX_GetPlayerCaps( pDP[0], dpid[0], &playerCaps, 0 );
5381 checkHR( DP_OK, hr );
5382
5383 hr = IDirectPlayX_GetPlayerCaps( pDP[0], dpid[0], NULL, 0 );
5385
5386 /* Regular parameters */
5387 for (i=0; i<2; i++)
5388 {
5389 for (dwFlags=0;
5392 {
5393
5394 hr = IDirectPlayX_GetPlayerCaps( pDP[0], dpid[i],
5395 &playerCaps, dwFlags );
5396 checkHR( DP_OK, hr );
5397
5398
5399 check( sizeof(DPCAPS), playerCaps.dwSize );
5400 check( 40, playerCaps.dwSize );
5401 check( 0, playerCaps.dwMaxQueueSize );
5402 check( 0, playerCaps.dwHundredBaud );
5403 check( 0, playerCaps.dwLatency );
5404 check( 65536, playerCaps.dwMaxLocalPlayers );
5405 check( 20, playerCaps.dwHeaderLength );
5406
5407 if ( i == 0 )
5408 {
5414 playerCaps.dwFlags, FLAGS_DPCAPS );
5415 }
5416 else
5421 playerCaps.dwFlags, FLAGS_DPCAPS );
5422
5424 {
5425 check( 1048547, playerCaps.dwMaxBufferSize );
5426 check( 64, playerCaps.dwMaxPlayers );
5427 }
5428 else
5429 {
5430 check( 65479, playerCaps.dwMaxBufferSize );
5431 check( 65536, playerCaps.dwMaxPlayers );
5432 }
5433
5434 }
5435 }
5436
5437
5438 IDirectPlayX_Release( pDP[0] );
5439 IDirectPlayX_Release( pDP[1] );
5440
5441}
#define IDirectPlayX_GetPlayerCaps(p, a, b, c)
Definition: dplay.h:884

Referenced by START_TEST().

◆ test_GetPlayerFlags()

static void test_GetPlayerFlags ( void  )
static

Definition at line 6318 of file dplayx.c.

6319{
6320
6321 IDirectPlay4 *pDP[2];
6322 DPSESSIONDESC2 dpsd;
6323 DPID dpid[4];
6324 HRESULT hr;
6325 UINT i;
6326
6327 DWORD dwFlags = 0;
6328
6329
6330 for (i=0; i<2; i++)
6331 {
6332 hr= CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
6333 &IID_IDirectPlay4A, (LPVOID*) &pDP[i] );
6334 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
6335 if (FAILED(hr)) return;
6336 }
6337 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
6338 dpsd.dwSize = sizeof(DPSESSIONDESC2);
6339 dpsd.guidApplication = appGuid;
6340 dpsd.dwMaxPlayers = 10;
6341
6342 /* Uninitialized service provider */
6343 hr = IDirectPlayX_GetPlayerFlags( pDP[0], 0, &dwFlags );
6345
6346 if ( hr == DP_OK )
6347 {
6348 todo_wine win_skip( "GetPlayerFlags not implemented\n" );
6349 return;
6350 }
6351
6352 init_TCPIP_provider( pDP[0], "127.0.0.1", 0 );
6353 init_TCPIP_provider( pDP[1], "127.0.0.1", 0 );
6354
6355
6356 /* No session */
6357 hr = IDirectPlayX_GetPlayerFlags( pDP[0], 0, &dwFlags );
6359
6360 hr = IDirectPlayX_GetPlayerFlags( pDP[0], 1, &dwFlags );
6362
6363
6364 IDirectPlayX_Open( pDP[0], &dpsd, DPOPEN_CREATE );
6366 pDP[1], 0 );
6367
6368 for (i=0; i<2; i++)
6369 {
6370 hr = IDirectPlayX_CreatePlayer( pDP[i], &dpid[i],
6371 NULL, NULL, NULL, 0, 0 );
6372 checkHR( DP_OK, hr );
6373 }
6374 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid[2],
6375 NULL, NULL, NULL,
6376 0, DPPLAYER_SPECTATOR );
6377 checkHR( DP_OK, hr );
6378 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid[3],
6379 NULL, NULL, NULL,
6381 checkHR( DP_OK, hr );
6382
6383
6384 /* Invalid player */
6385 hr = IDirectPlayX_GetPlayerFlags( pDP[0], 0, &dwFlags );
6387
6388 hr = IDirectPlayX_GetPlayerFlags( pDP[0], 2, &dwFlags );
6390
6391 /* Invalid parameters */
6392 hr = IDirectPlayX_GetPlayerFlags( pDP[0], dpid[0], NULL );
6394
6395
6396 /* Regular parameters */
6397 hr = IDirectPlayX_GetPlayerFlags( pDP[0], dpid[0], &dwFlags );
6398 checkHR( DP_OK, hr );
6400
6401 hr = IDirectPlayX_GetPlayerFlags( pDP[1], dpid[1], &dwFlags );
6402 checkHR( DP_OK, hr );
6404
6405 hr = IDirectPlayX_GetPlayerFlags( pDP[0], dpid[1], &dwFlags );
6406 checkHR( DP_OK, hr );
6408
6409 hr = IDirectPlayX_GetPlayerFlags( pDP[0], dpid[2], &dwFlags );
6410 checkHR( DP_OK, hr );
6412
6413 hr = IDirectPlayX_GetPlayerFlags( pDP[1], dpid[3], &dwFlags );
6414 checkHR( DP_OK, hr );
6416
6417
6418 IDirectPlayX_Release( pDP[0] );
6419 IDirectPlayX_Release( pDP[1] );
6420
6421}
#define IDirectPlayX_GetPlayerFlags(p, a, b)
Definition: dplay.h:912

Referenced by START_TEST().

◆ test_GROUPDATACHANGED()

static void test_GROUPDATACHANGED ( void  )
static

Definition at line 9260 of file dplayx.c.

9261{
9262 BYTE expectedGroupData[] = { 8, 7, 6, 5, 4, 3, 2, 1, };
9263 DPSESSIONDESC2 appGuidDpsd =
9264 {
9265 .dwSize = sizeof( DPSESSIONDESC2 ),
9266 .guidInstance = appGuid,
9267 .guidApplication = appGuid,
9268 };
9269 DPSESSIONDESC2 serverDpsd =
9270 {
9271 .dwSize = sizeof( DPSESSIONDESC2 ),
9272 .guidApplication = appGuid,
9273 .guidInstance = appGuid,
9274 .lpszSessionName = (WCHAR *) L"normal",
9275 .dwReserved1 = 0xaabbccdd,
9276 };
9277 BYTE groupData[ 256 ];
9278 DWORD groupDataSize;
9279 IDirectPlay4A *dp;
9280 DWORD waitResult;
9281 SOCKET sendSock;
9282 SOCKET recvSock;
9283 HANDLE event;
9284 HRESULT hr;
9285 DPID dpid;
9286
9287 event = CreateEventA( NULL, FALSE, FALSE, NULL );
9288
9289 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay4A, (void **) &dp );
9290 ok( hr == DP_OK, "got hr %#lx.\n", hr );
9291
9292 init_TCPIP_provider( dp, "127.0.0.1", 0 );
9293
9294 joinSession( dp, &appGuidDpsd, &serverDpsd, &sendSock, &recvSock, NULL );
9295
9296 createPlayer( dp, 0x11223344, event, NULL, 0, 0, sendSock, recvSock );
9297
9298 sendGroupDataChanged( sendSock, 2349, 0x5e7, expectedGroupData, sizeof( expectedGroupData ) );
9299
9300 waitResult = WaitForSingleObject( event, 2000 );
9301 ok( waitResult == WAIT_OBJECT_0, "message wait returned %lu\n", waitResult );
9302
9303 dpid = checkSetPlayerOrGroupDataMessage( dp, DPPLAYERTYPE_GROUP, 0x5e7, expectedGroupData,
9304 sizeof( expectedGroupData ) );
9305 ok( dpid == 0x11223344, "got destination id %#lx.\n", dpid );
9306
9307 memset( groupData, 0xcc, sizeof( groupData ) );
9308 groupDataSize = sizeof( groupData );
9309 hr = IDirectPlayX_GetGroupData( dp, 0x5e7, groupData, &groupDataSize, DPGET_REMOTE );
9310 ok( hr == DP_OK, "got hr %#lx.\n", hr );
9311 ok( groupDataSize == sizeof( expectedGroupData ), "got group data size %lu.\n", groupDataSize );
9312 ok( !memcmp( groupData, expectedGroupData, sizeof( expectedGroupData ) ), "group data didn't match.\n" );
9313
9315
9316 closesocket( recvSock );
9317 closesocket( sendSock );
9318
9320
9321 CloseHandle( event );
9322}
#define checkSetPlayerOrGroupDataMessage(dp, expectedPlayerType, expectedDpid, expectedData, expectedDataSize)
Definition: dplayx.c:9223
#define sendGroupDataChanged(sock, port, groupId, data, dataSize)
Definition: dplayx.c:2242

Referenced by START_TEST().

◆ test_GroupOwner()

static void test_GroupOwner ( void  )
static

Definition at line 6733 of file dplayx.c.

6734{
6735
6736 IDirectPlay4 *pDP[2];
6737 DPSESSIONDESC2 dpsd;
6738 DPID dpid[2], idGroup, idOwner;
6739 HRESULT hr;
6740 UINT i;
6741
6742
6743 for (i=0; i<2; i++)
6744 {
6745 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
6746 &IID_IDirectPlay4A, (LPVOID*) &pDP[i] );
6747 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
6748 if (FAILED(hr)) return;
6749 }
6750 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
6751 dpsd.dwSize = sizeof(DPSESSIONDESC2);
6752 dpsd.guidApplication = appGuid;
6753 dpsd.dwMaxPlayers = 10;
6754 idGroup = 0;
6755 idOwner = 0;
6756
6757 /* Service provider not initialized */
6758 hr = IDirectPlayX_GetGroupOwner( pDP[0], idGroup, &idOwner );
6760 check( 0, idOwner );
6761
6762 if ( hr == DP_OK )
6763 {
6764 todo_wine win_skip( "GetGroupOwner not implemented\n" );
6765 return;
6766 }
6767
6768
6769 for (i=0; i<2; i++)
6770 init_TCPIP_provider( pDP[i], "127.0.0.1", 0 );
6771
6772 hr = IDirectPlayX_Open( pDP[0], &dpsd, DPOPEN_CREATE );
6773 checkHR( DP_OK, hr );
6775 pDP[1], 0 );
6776 checkHR( DP_OK, hr );
6777
6778 for (i=0; i<2; i++)
6779 {
6780 hr = IDirectPlayX_CreatePlayer( pDP[i], &dpid[i],
6781 NULL, NULL, NULL, 0, 0 );
6782 checkHR( DP_OK, hr );
6783 }
6784
6785 /* Invalid group */
6786 hr = IDirectPlayX_GetGroupOwner( pDP[0], idGroup, &idOwner );
6788
6789 hr = IDirectPlayX_CreateGroup( pDP[0], &idGroup, NULL, NULL, 0, 0 );
6790 checkHR( DP_OK, hr );
6791
6792 /* Fails, because we need a lobby session */
6793 hr = IDirectPlayX_GetGroupOwner( pDP[0], idGroup, &idOwner );
6795
6796
6797 /* TODO:
6798 * - Make this work
6799 * - Check migration of the ownership of a group
6800 * when the owner leaves
6801 */
6802
6803
6804 IDirectPlayX_Release( pDP[0] );
6805 IDirectPlayX_Release( pDP[1] );
6806
6807}
#define IDirectPlayX_GetGroupOwner(p, a, b)
Definition: dplay.h:914

Referenced by START_TEST().

◆ test_groups_cs()

static void test_groups_cs ( void  )
static

Definition at line 7921 of file dplayx.c.

7922{
7923
7924 IDirectPlay4 *pDP[2];
7925 DPSESSIONDESC2 dpsd;
7926 DPID idPlayer[6], idGroup[3];
7927 CallbackData callbackData;
7928 HRESULT hr;
7929 UINT i;
7930
7931 DWORD dwDataSize = 1024;
7932 LPVOID lpData = calloc( 1, 1024 );
7933
7934
7935 for (i=0; i<2; i++)
7936 {
7937 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
7938 &IID_IDirectPlay4A, (LPVOID*) &pDP[i] );
7939 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
7940 if (FAILED(hr)) return;
7941 }
7942 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
7943 dpsd.dwSize = sizeof(DPSESSIONDESC2);
7944 dpsd.guidApplication = appGuid;
7945 dpsd.dwMaxPlayers = 10;
7946
7947
7948 init_TCPIP_provider( pDP[0], "127.0.0.1", 0 );
7949 init_TCPIP_provider( pDP[1], "127.0.0.1", 0 );
7950
7952 hr = IDirectPlayX_Open( pDP[0], &dpsd, DPOPEN_CREATE );
7954 dpsd.dwFlags = 0;
7956 pDP[1], 0 );
7958
7959 if ( hr == DPERR_UNINITIALIZED )
7960 {
7961 todo_wine win_skip( "dplay not implemented enough for this test yet\n" );
7962 return;
7963 }
7964
7965
7966 /* Create players */
7967 hr = IDirectPlayX_CreatePlayer( pDP[0], &idPlayer[0],
7968 NULL, NULL, NULL, 0, 0 );
7970 hr = IDirectPlayX_CreatePlayer( pDP[0], &idPlayer[0],
7971 NULL, NULL, NULL, 0,
7973 checkHR( DP_OK, hr );
7974 hr = IDirectPlayX_CreatePlayer( pDP[0], &idPlayer[1],
7975 NULL, NULL, NULL, 0, 0 );
7977 hr = IDirectPlayX_CreatePlayer( pDP[1], &idPlayer[1],
7978 NULL, NULL, NULL, 0, 0 );
7979 checkHR( DP_OK, hr );
7980 hr = IDirectPlayX_CreatePlayer( pDP[1], &idPlayer[2],
7981 NULL, NULL, NULL, 0, 0 );
7982 checkHR( DP_OK, hr );
7983 hr = IDirectPlayX_CreatePlayer( pDP[1], &idPlayer[3],
7984 NULL, NULL, NULL, 0, 0 );
7985 checkHR( DP_OK, hr );
7986 hr = IDirectPlayX_CreatePlayer( pDP[1], &idPlayer[4],
7987 NULL, NULL, NULL, 0, 0 );
7988 checkHR( DP_OK, hr );
7989 hr = IDirectPlayX_CreatePlayer( pDP[1], &idPlayer[5],
7990 NULL, NULL, NULL, 0, 0 );
7991 checkHR( DP_OK, hr );
7992
7993 hr = IDirectPlayX_CreateGroup( pDP[0], &idGroup[0],
7994 NULL, NULL, 0, 0 );
7995 checkHR( DP_OK, hr );
7996 hr = IDirectPlayX_CreateGroup( pDP[1], &idGroup[2],
7997 NULL, NULL, 0, 0 );
7998 checkHR( DP_OK, hr );
7999 hr = IDirectPlayX_CreateGroupInGroup( pDP[1], idGroup[2], &idGroup[1],
8000 NULL, NULL, 0, 0 );
8001 checkHR( DP_OK, hr );
8002
8003
8004 /* Purge queues */
8005 check_messages( pDP[0], idPlayer, 6, &callbackData );
8006 checkStr( "S0,S0,S0,S0,S0,S0,", callbackData.szTrace1 );
8007 check_messages( pDP[1], idPlayer, 6, &callbackData );
8008 checkStr( "S1," "S2,S1," "S3,S2,S1," "S4,S3,S2,S1,"
8009 "S5,S4,S3,S2,S1," "S5,S4,S3,S2,S1,", callbackData.szTrace1 );
8010
8011 /*
8012 * Player 0 | | pDP 0
8013 * Player 1 | Group 0 |
8014 * Player 2 | |
8015 * Player 3 | Group 1 ) |
8016 * Player 4 | | Group 2 | pDP 1
8017 * Player 5 | |
8018 */
8019
8020 /* Build groups */
8021 hr = IDirectPlayX_AddPlayerToGroup( pDP[0], idGroup[0], idPlayer[0] );
8022 checkHR( DP_OK, hr );
8023 hr = IDirectPlayX_AddPlayerToGroup( pDP[0], idGroup[0], idPlayer[1] );
8024 checkHR( DP_OK, hr );
8025 hr = IDirectPlayX_AddPlayerToGroup( pDP[0], idGroup[0], idPlayer[2] );
8026 checkHR( DP_OK, hr );
8027 hr = IDirectPlayX_AddPlayerToGroup( pDP[1], idGroup[1], idPlayer[3] );
8028 checkHR( DP_OK, hr );
8029 hr = IDirectPlayX_AddPlayerToGroup( pDP[1], idGroup[1], idPlayer[4] );
8030 checkHR( DP_OK, hr );
8031 hr = IDirectPlayX_AddPlayerToGroup( pDP[1], idGroup[2], idPlayer[4] );
8032 checkHR( DP_OK, hr );
8033 hr = IDirectPlayX_AddPlayerToGroup( pDP[1], idGroup[2], idPlayer[5] );
8034 checkHR( DP_OK, hr );
8035
8036 hr = IDirectPlayX_AddGroupToGroup( pDP[1], idGroup[2], idGroup[1] );
8037 checkHR( DP_OK, hr );
8038
8039 /* Purge queues */
8040 check_messages( pDP[0], idPlayer, 6, &callbackData );
8041 checkStr( "S0,S0,S0,S0,", callbackData.szTrace1 );
8042 check_messages( pDP[1], idPlayer, 6, &callbackData );
8043 checkStr( "S5," "S4,S3,S2,S1," "S5,S4,S3,S2,S1,"
8044 "S5,S4,S3,S2,S1," "S5,S4,S3,S2,S1,", callbackData.szTrace1 );
8045
8046
8047 /* Sending broadcast messages, and checking who receives them */
8048 dwDataSize = 4;
8049 /* 0 -> * */
8050 hr = IDirectPlayX_Send( pDP[0], idPlayer[0], DPID_ALLPLAYERS, 0,
8051 lpData, dwDataSize );
8052 checkHR( DP_OK, hr );
8053 check_messages( pDP[0], idPlayer, 6, &callbackData );
8054 checkStr( "", callbackData.szTrace1 );
8055 check_messages( pDP[1], idPlayer, 6, &callbackData );
8056 checkStr( "05,04,03,02,01,", callbackData.szTrace1 );
8057
8058 /* 0 -> g0 */
8059 hr = IDirectPlayX_Send( pDP[0], idPlayer[0], idGroup[0], 0,
8060 lpData, dwDataSize );
8061 checkHR( DP_OK, hr );
8062 check_messages( pDP[0], idPlayer, 6, &callbackData );
8063 checkStr( "", callbackData.szTrace1 );
8064 check_messages( pDP[1], idPlayer, 6, &callbackData );
8065 checkStr( "02,01,", callbackData.szTrace1 );
8066 /* 0 -> g1 */
8067 hr = IDirectPlayX_Send( pDP[0], idPlayer[0], idGroup[1], 0,
8068 lpData, dwDataSize );
8070 check_messages( pDP[0], idPlayer, 6, &callbackData );
8071 checkStr( "", callbackData.szTrace1 );
8072 check_messages( pDP[1], idPlayer, 6, &callbackData );
8073 checkStr( "", callbackData.szTrace1 );
8074 /* 0 -> g2 */
8075 hr = IDirectPlayX_Send( pDP[0], idPlayer[0], idGroup[2], 0,
8076 lpData, dwDataSize );
8078 check_messages( pDP[0], idPlayer, 6, &callbackData );
8079 checkStr( "", callbackData.szTrace1 );
8080 check_messages( pDP[1], idPlayer, 6, &callbackData );
8081 checkStr( "", callbackData.szTrace1 );
8082
8083 /* 3 -> * */
8084 hr = IDirectPlayX_Send( pDP[1], idPlayer[3], DPID_ALLPLAYERS, 0,
8085 lpData, dwDataSize );
8086 checkHR( DP_OK, hr );
8087 check_messages( pDP[0], idPlayer, 6, &callbackData );
8088 checkStr( "30,", callbackData.szTrace1 );
8089 check_messages( pDP[1], idPlayer, 6, &callbackData );
8090 checkStr( "35,34,32,31,", callbackData.szTrace1 );
8091 /* 3 -> g0 */
8092 hr = IDirectPlayX_Send( pDP[1], idPlayer[3], idGroup[0], 0,
8093 lpData, dwDataSize );
8095 check_messages( pDP[0], idPlayer, 6, &callbackData );
8096 checkStr( "", callbackData.szTrace1 );
8097 check_messages( pDP[1], idPlayer, 6, &callbackData );
8098 checkStr( "", callbackData.szTrace1 );
8099 /* 3 -> g1 */
8100 hr = IDirectPlayX_Send( pDP[1], idPlayer[3], idGroup[1], 0,
8101 lpData, dwDataSize );
8102 checkHR( DP_OK, hr );
8103 check_messages( pDP[0], idPlayer, 6, &callbackData );
8104 checkStr( "", callbackData.szTrace1 );
8105 check_messages( pDP[1], idPlayer, 6, &callbackData );
8106 checkStr( "34,", callbackData.szTrace1 );
8107 /* 3 -> g2 */
8108 hr = IDirectPlayX_Send( pDP[1], idPlayer[3], idGroup[2], 0,
8109 lpData, dwDataSize );
8110 checkHR( DP_OK, hr );
8111 check_messages( pDP[0], idPlayer, 6, &callbackData );
8112 checkStr( "", callbackData.szTrace1 );
8113 check_messages( pDP[1], idPlayer, 6, &callbackData );
8114 checkStr( "35,34,", callbackData.szTrace1 );
8115
8116 /* 5 -> * */
8117 hr = IDirectPlayX_Send( pDP[1], idPlayer[5], DPID_ALLPLAYERS, 0,
8118 lpData, dwDataSize );
8119 checkHR( DP_OK, hr );
8120 check_messages( pDP[0], idPlayer, 6, &callbackData );
8121 checkStr( "50,", callbackData.szTrace1 );
8122 check_messages( pDP[1], idPlayer, 6, &callbackData );
8123 checkStr( "54,53,52,51,", callbackData.szTrace1 );
8124 /* 5 -> g0 */
8125 hr = IDirectPlayX_Send( pDP[1], idPlayer[5], idGroup[0], 0,
8126 lpData, dwDataSize );
8128 check_messages( pDP[0], idPlayer, 6, &callbackData );
8129 checkStr( "", callbackData.szTrace1 );
8130 check_messages( pDP[1], idPlayer, 6, &callbackData );
8131 checkStr( "", callbackData.szTrace1 );
8132 /* 5 -> g1 */
8133 hr = IDirectPlayX_Send( pDP[1], idPlayer[5], idGroup[1], 0,
8134 lpData, dwDataSize );
8135 checkHR( DP_OK, hr );
8136 check_messages( pDP[0], idPlayer, 6, &callbackData );
8137 checkStr( "", callbackData.szTrace1 );
8138 check_messages( pDP[1], idPlayer, 6, &callbackData );
8139 checkStr( "54,53,", callbackData.szTrace1 );
8140 /* 5 -> g2 */
8141 hr = IDirectPlayX_Send( pDP[1], idPlayer[5], idGroup[2], 0,
8142 lpData, dwDataSize );
8143 checkHR( DP_OK, hr );
8144 check_messages( pDP[0], idPlayer, 6, &callbackData );
8145 checkStr( "", callbackData.szTrace1 );
8146 check_messages( pDP[1], idPlayer, 6, &callbackData );
8147 checkStr( "54,", callbackData.szTrace1 );
8148
8149
8150 free( lpData );
8151 IDirectPlayX_Release( pDP[0] );
8152 IDirectPlayX_Release( pDP[1] );
8153
8154}
#define DPID_ALLPLAYERS
Definition: dplay.h:162

Referenced by START_TEST().

◆ test_groups_p2p()

static void test_groups_p2p ( void  )
static

Definition at line 7686 of file dplayx.c.

7687{
7688
7689 IDirectPlay4 *pDP[2];
7690 DPSESSIONDESC2 dpsd;
7691 DPID idPlayer[6], idGroup[3];
7692 HRESULT hr;
7693 UINT i;
7694
7695 DWORD dwDataSize = 1024;
7696 LPVOID lpData = calloc( 1, 1024 );
7697 CallbackData callbackData;
7698
7699
7700 for (i=0; i<2; i++)
7701 {
7702 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
7703 &IID_IDirectPlay4A, (LPVOID*) &pDP[i] );
7704 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
7705 if (FAILED(hr)) return;
7706 }
7707 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
7708 dpsd.dwSize = sizeof(DPSESSIONDESC2);
7709 dpsd.guidApplication = appGuid;
7710 dpsd.dwMaxPlayers = 10;
7711
7712
7713 init_TCPIP_provider( pDP[0], "127.0.0.1", 0 );
7714 init_TCPIP_provider( pDP[1], "127.0.0.1", 0 );
7715
7716 hr = IDirectPlayX_Open( pDP[0], &dpsd, DPOPEN_CREATE );
7719 pDP[1], 0 );
7721
7722 if ( hr == DPERR_UNINITIALIZED )
7723 {
7724 todo_wine win_skip( "dplay not implemented enough for this test yet\n" );
7725 return;
7726 }
7727
7728
7729 /* Create players */
7730 hr = IDirectPlayX_CreatePlayer( pDP[0], &idPlayer[0],
7731 NULL, NULL, NULL, 0, 0 );
7732 checkHR( DP_OK, hr );
7733 hr = IDirectPlayX_CreatePlayer( pDP[0], &idPlayer[1],
7734 NULL, NULL, NULL, 0, 0 );
7735 checkHR( DP_OK, hr );
7736 hr = IDirectPlayX_CreatePlayer( pDP[0], &idPlayer[2],
7737 NULL, NULL, NULL, 0, 0 );
7738 checkHR( DP_OK, hr );
7739 hr = IDirectPlayX_CreatePlayer( pDP[1], &idPlayer[3],
7740 NULL, NULL, NULL, 0, 0 );
7741 checkHR( DP_OK, hr );
7742 hr = IDirectPlayX_CreatePlayer( pDP[1], &idPlayer[4],
7743 NULL, NULL, NULL, 0, 0 );
7744 checkHR( DP_OK, hr );
7745 hr = IDirectPlayX_CreatePlayer( pDP[1], &idPlayer[5],
7746 NULL, NULL, NULL, 0, 0 );
7747 checkHR( DP_OK, hr );
7748
7749 hr = IDirectPlayX_CreateGroup( pDP[0], &idGroup[0],
7750 NULL, NULL, 0, 0 );
7751 checkHR( DP_OK, hr );
7752 hr = IDirectPlayX_CreateGroup( pDP[1], &idGroup[2],
7753 NULL, NULL, 0, 0 );
7754 checkHR( DP_OK, hr );
7755 hr = IDirectPlayX_CreateGroupInGroup( pDP[1], idGroup[2], &idGroup[1],
7756 NULL, NULL, 0, 0 );
7757 checkHR( DP_OK, hr );
7758
7759
7760 /* Purge queues */
7761 check_messages( pDP[0], idPlayer, 6, &callbackData );
7762 checkStr( "S0," "S1,S0,"
7763 "S2,S1,S0," "S2,S1,S0,"
7764 "S2,S1,S0," "S2,S1,S0,"
7765 "S2,S1,S0," "S2,S1,S0,", callbackData.szTrace1 );
7766 check_messages( pDP[1], idPlayer, 6, &callbackData );
7767 checkStr( "S3," "S4,S3,"
7768 "S5,S4,S3," "S5,S4,S3,"
7769 "S5,S4,S3,", callbackData.szTrace1 );
7770
7771
7772 /*
7773 * Player 0 | |
7774 * Player 1 | Group 0 | pDP 0
7775 * Player 2 | |
7776 * Player 3 | Group 1 ) |
7777 * Player 4 | | Group 2 | pDP 1
7778 * Player 5 | |
7779 */
7780
7781 /* Build groups */
7782 hr = IDirectPlayX_AddPlayerToGroup( pDP[0], idGroup[0], idPlayer[0] );
7783 checkHR( DP_OK, hr );
7784 hr = IDirectPlayX_AddPlayerToGroup( pDP[0], idGroup[0], idPlayer[1] );
7785 checkHR( DP_OK, hr );
7786 hr = IDirectPlayX_AddPlayerToGroup( pDP[0], idGroup[0], idPlayer[2] );
7787 checkHR( DP_OK, hr );
7788 hr = IDirectPlayX_AddPlayerToGroup( pDP[1], idGroup[1], idPlayer[3] );
7789 checkHR( DP_OK, hr );
7790 hr = IDirectPlayX_AddPlayerToGroup( pDP[1], idGroup[1], idPlayer[4] );
7791 checkHR( DP_OK, hr );
7792 hr = IDirectPlayX_AddPlayerToGroup( pDP[1], idGroup[2], idPlayer[4] );
7793 checkHR( DP_OK, hr );
7794 hr = IDirectPlayX_AddPlayerToGroup( pDP[1], idGroup[2], idPlayer[5] );
7795 checkHR( DP_OK, hr );
7796
7797 hr = IDirectPlayX_AddGroupToGroup( pDP[1], idGroup[2], idGroup[1] );
7798 checkHR( DP_OK, hr );
7799
7800 /* Purge queues */
7801 check_messages( pDP[0], idPlayer, 6, &callbackData );
7802 checkStr( "S2,S1,S0," "S2,S1,S0," "S2,S1,S0,"
7803 "S2,S1,S0," "S2,S1,S0," "S2,S1,S0,"
7804 "S2,S1,S0,", callbackData.szTrace1 );
7805 check_messages( pDP[1], idPlayer, 6, &callbackData );
7806 checkStr( "S5,S4,S3," "S5,S4,S3," "S5,S4,S3,"
7807 "S5,S4,S3," "S5,S4,S3," "S5,S4,S3,"
7808 "S5,S4,S3,", callbackData.szTrace1 );
7809
7810
7811 /* Sending broadcast messages, and checking who receives them */
7812
7813 dwDataSize = 4;
7814 /* 0 -> * */
7815 hr = IDirectPlayX_Send( pDP[0], idPlayer[0], DPID_ALLPLAYERS, 0,
7816 lpData, dwDataSize );
7817 checkHR( DP_OK, hr );
7818 check_messages( pDP[0], idPlayer, 6, &callbackData );
7819 checkStr( "02,01,", callbackData.szTrace1 );
7820 check_messages( pDP[1], idPlayer, 6, &callbackData );
7821 checkStr( "05,04,03,", callbackData.szTrace1 );
7822
7823 /* 0 -> g0 */
7824 hr = IDirectPlayX_Send( pDP[0], idPlayer[0], idGroup[0], 0,
7825 lpData, dwDataSize );
7826 checkHR( DP_OK, hr );
7827 check_messages( pDP[0], idPlayer, 6, &callbackData );
7828 checkStr( "02,01,", callbackData.szTrace1 );
7829 check_messages( pDP[1], idPlayer, 6, &callbackData );
7830 checkStr( "", callbackData.szTrace1 );
7831 /* 0 -> g1 */
7832 hr = IDirectPlayX_Send( pDP[0], idPlayer[0], idGroup[1], 0,
7833 lpData, dwDataSize );
7834 checkHR( DP_OK, hr );
7835 check_messages( pDP[0], idPlayer, 6, &callbackData );
7836 checkStr( "", callbackData.szTrace1 );
7837 check_messages( pDP[1], idPlayer, 6, &callbackData );
7838 checkStr( "04,03,", callbackData.szTrace1 );
7839 /* 0 -> g2 */
7840 hr = IDirectPlayX_Send( pDP[0], idPlayer[0], idGroup[2], 0,
7841 lpData, dwDataSize );
7842 checkHR( DP_OK, hr );
7843 check_messages( pDP[0], idPlayer, 6, &callbackData );
7844 checkStr( "", callbackData.szTrace1 );
7845 check_messages( pDP[1], idPlayer, 6, &callbackData );
7846 checkStr( "05,04,", callbackData.szTrace1 );
7847
7848 /* 3 -> * */
7849 hr = IDirectPlayX_Send( pDP[1], idPlayer[3], DPID_ALLPLAYERS, 0,
7850 lpData, dwDataSize );
7851 checkHR( DP_OK, hr );
7852 check_messages( pDP[0], idPlayer, 6, &callbackData );
7853 checkStr( "32,31,30,", callbackData.szTrace1 );
7854 check_messages( pDP[1], idPlayer, 6, &callbackData );
7855 checkStr( "35,34,", callbackData.szTrace1 );
7856 /* 3 -> g0 */
7857 hr = IDirectPlayX_Send( pDP[1], idPlayer[3], idGroup[0], 0,
7858 lpData, dwDataSize );
7859 checkHR( DP_OK, hr );
7860 check_messages( pDP[0], idPlayer, 6, &callbackData );
7861 checkStr( "32,31,30,", callbackData.szTrace1 );
7862 check_messages( pDP[1], idPlayer, 6, &callbackData );
7863 checkStr( "", callbackData.szTrace1 );
7864 /* 3 -> g1 */
7865 hr = IDirectPlayX_Send( pDP[1], idPlayer[3], idGroup[1], 0,
7866 lpData, dwDataSize );
7867 checkHR( DP_OK, hr );
7868 check_messages( pDP[0], idPlayer, 6, &callbackData );
7869 checkStr( "", callbackData.szTrace1 );
7870 check_messages( pDP[1], idPlayer, 6, &callbackData );
7871 checkStr( "34,", callbackData.szTrace1 );
7872 /* 3 -> g2 */
7873 hr = IDirectPlayX_Send( pDP[1], idPlayer[3], idGroup[2], 0,
7874 lpData, dwDataSize );
7875 checkHR( DP_OK, hr );
7876 check_messages( pDP[0], idPlayer, 6, &callbackData );
7877 checkStr( "", callbackData.szTrace1 );
7878 check_messages( pDP[1], idPlayer, 6, &callbackData );
7879 checkStr( "35,34,", callbackData.szTrace1 );
7880
7881 /* 5 -> * */
7882 hr = IDirectPlayX_Send( pDP[1], idPlayer[5], DPID_ALLPLAYERS, 0,
7883 lpData, dwDataSize );
7884 checkHR( DP_OK, hr );
7885 check_messages( pDP[0], idPlayer, 6, &callbackData );
7886 checkStr( "52,51,50,", callbackData.szTrace1 );
7887 check_messages( pDP[1], idPlayer, 6, &callbackData );
7888 checkStr( "54,53,", callbackData.szTrace1 );
7889 /* 5 -> g0 */
7890 hr = IDirectPlayX_Send( pDP[1], idPlayer[5], idGroup[0], 0,
7891 lpData, dwDataSize );
7892 checkHR( DP_OK, hr );
7893 check_messages( pDP[0], idPlayer, 6, &callbackData );
7894 checkStr( "52,51,50,", callbackData.szTrace1 );
7895 check_messages( pDP[1], idPlayer, 6, &callbackData );
7896 checkStr( "", callbackData.szTrace1 );
7897 /* 5 -> g1 */
7898 hr = IDirectPlayX_Send( pDP[1], idPlayer[5], idGroup[1], 0,
7899 lpData, dwDataSize );
7900 checkHR( DP_OK, hr );
7901 check_messages( pDP[0], idPlayer, 6, &callbackData );
7902 checkStr( "", callbackData.szTrace1 );
7903 check_messages( pDP[1], idPlayer, 6, &callbackData );
7904 checkStr( "54,53,", callbackData.szTrace1 );
7905 /* 5 -> g2 */
7906 hr = IDirectPlayX_Send( pDP[1], idPlayer[5], idGroup[2], 0,
7907 lpData, dwDataSize );
7908 checkHR( DP_OK, hr );
7909 check_messages( pDP[0], idPlayer, 6, &callbackData );
7910 checkStr( "", callbackData.szTrace1 );
7911 check_messages( pDP[1], idPlayer, 6, &callbackData );
7912 checkStr( "54,", callbackData.szTrace1 );
7913
7914
7915 free( lpData );
7916 IDirectPlayX_Release( pDP[0] );
7917 IDirectPlayX_Release( pDP[1] );
7918
7919}

Referenced by START_TEST().

◆ test_host_migration()

static void test_host_migration ( void  )
static

Definition at line 10275 of file dplayx.c.

10276{
10277
10278 IDirectPlay4 *pDP[2];
10279 DPSESSIONDESC2 dpsd;
10280 DPID dpid[2], idFrom, idTo;
10281 HRESULT hr;
10282 UINT i;
10283 DWORD dwCount;
10284
10285 DWORD dwDataSize = 1024;
10286 LPDPMSG_DESTROYPLAYERORGROUP lpData = calloc( 1, dwDataSize );
10287
10288
10289 for (i=0; i<2; i++)
10290 {
10291 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
10292 &IID_IDirectPlay4A, (LPVOID*) &pDP[i] );
10293 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
10294 if (FAILED(hr)) return;
10295 init_TCPIP_provider( pDP[i], "127.0.0.1", 0 );
10296 }
10297 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
10298 dpsd.dwSize = sizeof(DPSESSIONDESC2);
10299 dpsd.guidApplication = appGuid;
10300 dpsd.dwMaxPlayers = 10;
10302
10303 /* Host */
10304 hr = IDirectPlayX_Open( pDP[0], &dpsd, DPOPEN_CREATE );
10306
10307 if ( hr != DP_OK )
10308 {
10309 todo_wine win_skip( "dplay not implemented enough for this test yet\n" );
10310 return;
10311 }
10312
10313 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid[0], NULL, NULL, NULL, 0, 0 );
10314 checkHR( DP_OK, hr );
10315
10316 /* Peer */
10318 pDP[1], 0 );
10319 checkHR( DP_OK, hr );
10320
10321 hr = IDirectPlayX_CreatePlayer( pDP[1], &dpid[1], NULL, NULL, NULL, 0, 0 );
10322 checkHR( DP_OK, hr );
10323
10324
10325 /* Host: One message in queue */
10326 IDirectPlayX_GetMessageCount( pDP[0], dpid[0], &dwCount );
10327 check( 1, dwCount );
10328 dwDataSize = 1024;
10329 hr = IDirectPlayX_Receive( pDP[0], &idFrom, &idTo, DPRECEIVE_PEEK,
10330 lpData, &dwDataSize );
10331 checkHR( DP_OK, hr );
10333
10334 /* Peer: No messages */
10335 IDirectPlayX_GetMessageCount( pDP[1], dpid[1], &dwCount );
10336 check( 0, dwCount );
10337 hr = IDirectPlayX_Receive( pDP[1], &idFrom, &idTo, DPRECEIVE_PEEK,
10338 lpData, &dwDataSize );
10340
10341
10342 /* Closing host */
10343 IDirectPlayX_Close( pDP[0] );
10344
10345
10346 /* Host: Queue is cleaned */
10347 IDirectPlayX_GetMessageCount( pDP[0], dpid[0], &dwCount );
10348 check( 0, dwCount );
10349 hr = IDirectPlayX_Receive( pDP[0], &idFrom, &idTo, DPRECEIVE_PEEK,
10350 lpData, &dwDataSize );
10352
10353 /* Peer: gets message of player destruction */
10354 IDirectPlayX_GetMessageCount( pDP[1], dpid[1], &dwCount );
10355 check( 2, dwCount );
10356 dwDataSize = 1024;
10357 hr = IDirectPlayX_Receive( pDP[1], &idFrom, &idTo, DPRECEIVE_PEEK,
10358 lpData, &dwDataSize );
10359 checkHR( DP_OK, hr );
10361
10362
10363 /* Message analysis */
10364 for (i=0; i<2; i++)
10365 {
10366 hr = IDirectPlayX_Receive( pDP[1], &idFrom, &idTo, 0,
10367 lpData, &dwDataSize );
10368 checkHR( DP_OK, hr );
10369 check( DPID_SYSMSG, idFrom );
10370 check( dpid[1], idTo ); /* Peer player id */
10371 switch(i)
10372 {
10373 case 0:
10375 dpMsgType2str );
10377 check( dpid[0], lpData->dpId ); /* Host player id */
10378 checkLP( NULL, lpData->lpLocalData );
10379 check( 0, lpData->dwLocalDataSize );
10380 checkLP( NULL, lpData->lpRemoteData );
10381 check( 0, lpData->dwRemoteDataSize );
10382 checkLP( NULL, lpData->dpnName.lpszShortNameA );
10383 check( 0, lpData->dpIdParent );
10384 checkFlags( 0, lpData->dwFlags,
10386 break;
10387 case 1:
10389 break;
10390 default:
10391 break;
10392 }
10393 dwDataSize = 1024;
10394 }
10395 hr = IDirectPlayX_Receive( pDP[1], &idFrom, &idTo, 0, lpData, &dwDataSize );
10397
10398
10399 free( lpData );
10400 IDirectPlayX_Release( pDP[0] );
10401 IDirectPlayX_Release( pDP[1] );
10402
10403}

Referenced by START_TEST().

◆ test_InitializeConnection()

static void test_InitializeConnection ( void  )
static

Definition at line 2685 of file dplayx.c.

2686{
2687
2688 IDirectPlay4 *pDP;
2689 HRESULT hr;
2690
2691 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
2692 &IID_IDirectPlay4A, (LPVOID*) &pDP );
2693
2694 ok (SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n");
2695 if (FAILED(hr)) return;
2696
2697 IDirectPlayX_EnumConnections( pDP, &appGuid, EnumConnections_cb2, pDP, 0 );
2698
2699 IDirectPlayX_Release( pDP );
2700}
static BOOL CALLBACK EnumConnections_cb2(LPCGUID lpguidSP, LPVOID lpConnection, DWORD dwConnectionSize, LPCDPNAME lpName, DWORD dwFlags, LPVOID lpContext)
Definition: dplayx.c:2655

Referenced by START_TEST().

◆ test_interactive_CreatePlayer()

static void test_interactive_CreatePlayer ( void  )
static

Definition at line 5027 of file dplayx.c.

5028{
5029
5030 IDirectPlay4 *pDP[2];
5031 DPSESSIONDESC2 dpsd;
5032 DPNAME name;
5033 DPID dpid;
5034 HRESULT hr;
5035
5036
5037 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
5038 &IID_IDirectPlay4A, (LPVOID*) &pDP[0] );
5039 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
5040 if (FAILED(hr)) return;
5041
5042 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
5043 &IID_IDirectPlay4A, (LPVOID*) &pDP[1] );
5044 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
5045 if (FAILED(hr)) return;
5046
5047 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
5048 ZeroMemory( &name, sizeof(DPNAME) );
5049
5050
5051 /* Connection not initialized */
5052 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL, 0, 0 );
5054
5055
5056 init_TCPIP_provider( pDP[0], "127.0.0.1", 0 );
5057 init_TCPIP_provider( pDP[1], "127.0.0.1", 0 );
5058
5059
5060 /* Session not open */
5061 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL, 0, 0 );
5063
5064 if ( hr == DPERR_UNINITIALIZED )
5065 {
5066 todo_wine win_skip( "CreatePlayer not implemented\n" );
5067 return;
5068 }
5069
5070 dpsd.dwSize = sizeof(DPSESSIONDESC2);
5071 dpsd.guidApplication = appGuid;
5072 IDirectPlayX_Open( pDP[0], &dpsd, DPOPEN_CREATE );
5073
5074
5075 /* Player name */
5076 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL, 0, 0 );
5077 checkHR( DP_OK, hr );
5078
5079
5080 name.dwSize = -1;
5081
5082
5083 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, &name, NULL, NULL, 0, 0 );
5084 checkHR( DP_OK, hr );
5085
5086
5087 name.dwSize = sizeof(DPNAME);
5088 name.lpszShortNameA = (LPSTR) "test";
5089 name.lpszLongNameA = NULL;
5090
5091
5092 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, &name, NULL, NULL,
5093 0, 0 );
5094 checkHR( DP_OK, hr );
5095
5096
5097 /* Null dpid */
5099 0, 0 );
5101
5102
5103 /* There can only be one server player */
5104 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
5106 checkHR( DP_OK, hr );
5107 check( DPID_SERVERPLAYER, dpid );
5108
5109 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
5112
5113 IDirectPlayX_DestroyPlayer( pDP[0], dpid );
5114
5115 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
5117 checkHR( DP_OK, hr );
5118 check( DPID_SERVERPLAYER, dpid );
5119 IDirectPlayX_DestroyPlayer( pDP[0], dpid );
5120
5121
5122 /* Flags */
5123 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
5124 0, 0 );
5125 checkHR( DP_OK, hr );
5126
5127 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
5129 checkHR( DP_OK, hr );
5130 check( DPID_SERVERPLAYER, dpid );
5131 IDirectPlayX_DestroyPlayer( pDP[0], dpid );
5132
5133 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
5134 0, DPPLAYER_SPECTATOR );
5135 checkHR( DP_OK, hr );
5136
5137 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
5140 checkHR( DP_OK, hr );
5141 check( DPID_SERVERPLAYER, dpid );
5142 IDirectPlayX_DestroyPlayer( pDP[0], dpid );
5143
5144
5145 /* Session with DPSESSION_NEWPLAYERSDISABLED */
5146 IDirectPlayX_Close( pDP[0] );
5148 hr = IDirectPlayX_Open( pDP[0], &dpsd, DPOPEN_CREATE );
5149 checkHR( DP_OK, hr );
5150
5151
5152 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
5153 0, 0 );
5155
5156 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
5159
5160 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
5161 0, DPPLAYER_SPECTATOR );
5163
5164
5165 /* Creating players in a Client/Server session */
5166 IDirectPlayX_Close( pDP[0] );
5168 hr = IDirectPlayX_Open( pDP[0], &dpsd, DPOPEN_CREATE );
5169 checkHR( DP_OK, hr );
5171 pDP[1], 0 );
5172 checkHR( DP_OK, hr );
5173
5174
5175 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
5176 0, 0 );
5178
5179 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
5181 checkHR( DP_OK, hr );
5182 check( DPID_SERVERPLAYER, dpid );
5183
5184 hr = IDirectPlayX_CreatePlayer( pDP[1], &dpid, NULL, NULL, NULL,
5187
5188 hr = IDirectPlayX_CreatePlayer( pDP[1], &dpid, NULL, NULL, NULL,
5189 0, 0 );
5190 checkHR( DP_OK, hr );
5191
5192
5193 IDirectPlayX_Release( pDP[0] );
5194 IDirectPlayX_Release( pDP[1] );
5195
5196}
#define DPID_SERVERPLAYER
Definition: dplay.h:163
#define IDirectPlayX_DestroyPlayer(p, a)
Definition: dplay.h:874

Referenced by START_TEST().

◆ test_interactive_EnumSessions()

static void test_interactive_EnumSessions ( void  )
static

Definition at line 4154 of file dplayx.c.

4155{
4156
4157#define N_SESSIONS 6
4158
4159 IDirectPlay4 *pDP, *pDPserver[N_SESSIONS];
4160 DPSESSIONDESC2 dpsd, dpsd_server[N_SESSIONS];
4161 CallbackData callbackData;
4162 HRESULT hr;
4163 UINT i;
4164
4165
4166 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
4167 &IID_IDirectPlay4A, (LPVOID*) &pDP );
4168 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
4169 if (FAILED(hr)) return;
4170
4171 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
4172 callbackData.dwCounter1 = -1; /* So that after a call to EnumSessions
4173 we get the exact number of sessions */
4174 callbackData.dwFlags = 0;
4175
4176
4177 /* Service provider not initialized */
4179 &callbackData, 0 );
4181
4182
4183 init_TCPIP_provider( pDP, "127.0.0.1", 0 );
4184
4185
4186 /* Session with no size */
4188 &callbackData, 0 );
4190
4191 if ( hr == DPERR_UNINITIALIZED )
4192 {
4193 todo_wine win_skip( "EnumSessions not implemented\n" );
4194 return;
4195 }
4196
4197 dpsd.dwSize = sizeof(DPSESSIONDESC2);
4198
4199
4200 /* No sessions */
4201 callbackData.dwCounter1 = -1;
4203 &callbackData, 0 );
4204 checkHR( DP_OK, hr );
4205 check( 0, callbackData.dwCounter1 );
4206
4207
4208 dpsd.guidApplication = appGuid;
4209
4210 /* Set up sessions */
4211 for (i=0; i<N_SESSIONS; i++)
4212 {
4213 memcpy( &dpsd_server[i], &dpsd, sizeof(DPSESSIONDESC2) );
4214 }
4215
4216 dpsd_server[0].lpszSessionNameA = (LPSTR) "normal";
4217 dpsd_server[0].dwFlags = ( DPSESSION_CLIENTSERVER |
4219 dpsd_server[0].dwMaxPlayers = 10;
4220
4221 dpsd_server[1].lpszSessionNameA = (LPSTR) "full";
4222 dpsd_server[1].dwFlags = ( DPSESSION_CLIENTSERVER |
4224 dpsd_server[1].dwMaxPlayers = 1;
4225
4226 dpsd_server[2].lpszSessionNameA = (LPSTR) "no new";
4227 dpsd_server[2].dwFlags = ( DPSESSION_CLIENTSERVER |
4230 dpsd_server[2].dwMaxPlayers = 10;
4231
4232 dpsd_server[3].lpszSessionNameA = (LPSTR) "no join";
4233 dpsd_server[3].dwFlags = ( DPSESSION_CLIENTSERVER |
4236 dpsd_server[3].dwMaxPlayers = 10;
4237
4238 dpsd_server[4].lpszSessionNameA = (LPSTR) "private";
4239 dpsd_server[4].dwFlags = ( DPSESSION_CLIENTSERVER |
4242 dpsd_server[4].dwMaxPlayers = 10;
4243 dpsd_server[4].lpszPasswordA = (LPSTR) "password";
4244
4245 dpsd_server[5].lpszSessionNameA = (LPSTR) "protected";
4246 dpsd_server[5].dwFlags = ( DPSESSION_CLIENTSERVER |
4249 dpsd_server[5].dwMaxPlayers = 10;
4250 dpsd_server[5].lpszPasswordA = (LPSTR) "password";
4251
4252
4253 for (i=0; i<N_SESSIONS; i++)
4254 {
4255 pDPserver[i] = create_session( &dpsd_server[i] );
4256 if (!pDPserver[i]) return;
4257 }
4258
4259
4260 /* Invalid params */
4261 callbackData.dwCounter1 = -1;
4263 &callbackData, -1 );
4265
4267 &callbackData, 0 );
4269
4270 check( -1, callbackData.dwCounter1 );
4271
4272
4273 /* Flag tests */
4274 callbackData.dwFlags = DPENUMSESSIONS_ALL; /* Doesn't list private,
4275 protected */
4276 callbackData.dwCounter1 = -1;
4278 &callbackData, callbackData.dwFlags );
4279 checkHR( DP_OK, hr );
4280 check( N_SESSIONS-2, callbackData.dwCounter1 );
4281
4282 /* Doesn't list private */
4283 callbackData.dwFlags = ( DPENUMSESSIONS_ALL |
4285 callbackData.dwCounter1 = -1;
4287 &callbackData, callbackData.dwFlags );
4288 checkHR( DP_OK, hr );
4289 check( N_SESSIONS-1, callbackData.dwCounter1 );
4290
4291 /* Doesn't list full, no new, no join, private, protected */
4292 callbackData.dwFlags = DPENUMSESSIONS_AVAILABLE;
4293 callbackData.dwCounter1 = -1;
4295 &callbackData, callbackData.dwFlags );
4296 checkHR( DP_OK, hr );
4297 check( N_SESSIONS-5, callbackData.dwCounter1 );
4298
4299 /* Like with DPENUMSESSIONS_AVAILABLE */
4300 callbackData.dwFlags = 0;
4301 callbackData.dwCounter1 = -1;
4303 &callbackData, callbackData.dwFlags );
4304 checkHR( DP_OK, hr );
4305 check( N_SESSIONS-5, callbackData.dwCounter1 );
4306
4307 /* Doesn't list full, no new, no join, private */
4309 callbackData.dwCounter1 = -1;
4311 &callbackData, callbackData.dwFlags );
4312 checkHR( DP_OK, hr );
4313 check( N_SESSIONS-4, callbackData.dwCounter1 );
4314
4315
4316 /* Async enumeration */
4317 callbackData.dwFlags = DPENUMSESSIONS_ASYNC;
4318 callbackData.dwCounter1 = -1;
4320 &callbackData, callbackData.dwFlags );
4321 checkHR( DP_OK, hr );
4322 check( N_SESSIONS-4, callbackData.dwCounter1 ); /* Read cache of last
4323 sync enumeration */
4324
4325 callbackData.dwFlags = DPENUMSESSIONS_STOPASYNC;
4326 callbackData.dwCounter1 = -1;
4328 &callbackData, callbackData.dwFlags );
4329 checkHR( DP_OK, hr );
4330 check( 0, callbackData.dwCounter1 ); /* Stop enumeration */
4331
4332 callbackData.dwFlags = DPENUMSESSIONS_ASYNC;
4333 callbackData.dwCounter1 = -1;
4335 &callbackData, callbackData.dwFlags );
4336 checkHR( DP_OK, hr );
4337 check( 0, callbackData.dwCounter1 ); /* Start enumeration */
4338
4339 Sleep(500); /* Give time to fill the cache */
4340
4341 callbackData.dwFlags = DPENUMSESSIONS_ASYNC;
4342 callbackData.dwCounter1 = -1;
4344 &callbackData, callbackData.dwFlags );
4345 checkHR( DP_OK, hr );
4346 check( N_SESSIONS-5, callbackData.dwCounter1 ); /* Retrieve results */
4347
4348 callbackData.dwFlags = DPENUMSESSIONS_STOPASYNC;
4349 callbackData.dwCounter1 = -1;
4351 &callbackData, callbackData.dwFlags );
4352 checkHR( DP_OK, hr );
4353 check( 0, callbackData.dwCounter1 ); /* Stop enumeration */
4354
4355
4356 /* Specific tests for passworded sessions */
4357
4358 for (i=0; i<N_SESSIONS; i++)
4359 {
4360 IDirectPlayX_Release( pDPserver[i] );
4361 }
4362
4363 /* - Only session password set */
4364 for (i=4;i<=5;i++)
4365 {
4366 dpsd_server[i].lpszPasswordA = (LPSTR) "password";
4367 dpsd_server[i].dwFlags = 0;
4368 pDPserver[i] = create_session( &dpsd_server[i] );
4369 }
4370
4371 callbackData.dwFlags = 0;
4372 callbackData.dwCounter1 = -1;
4374 &callbackData, callbackData.dwFlags );
4375 checkHR( DP_OK, hr );
4376 check( 0, callbackData.dwCounter1 );
4377
4379 callbackData.dwCounter1 = -1;
4381 &callbackData, callbackData.dwFlags );
4382 checkHR( DP_OK, hr );
4383 check( 2, callbackData.dwCounter1 ); /* Both sessions automatically
4384 set DPSESSION_PASSWORDREQUIRED */
4385
4386 /* - Only session flag set */
4387 for (i=4; i<=5; i++)
4388 {
4389 IDirectPlayX_Release( pDPserver[i] );
4390 dpsd_server[i].lpszPasswordA = NULL;
4391 }
4392 dpsd_server[4].dwFlags = DPSESSION_PRIVATE;
4393 dpsd_server[5].dwFlags = DPSESSION_PASSWORDREQUIRED;
4394 for (i=4; i<=5; i++)
4395 {
4396 pDPserver[i] = create_session( &dpsd_server[i] );
4397 }
4398
4399 callbackData.dwFlags = 0;
4400 callbackData.dwCounter1 = -1;
4402 &callbackData, callbackData.dwFlags );
4403 checkHR( DP_OK, hr );
4404 check( 2, callbackData.dwCounter1 ); /* Without password,
4405 the flag is ignored */
4406
4407 /* - Both session flag and password set */
4408 for (i=4; i<=5; i++)
4409 {
4410 IDirectPlayX_Release( pDPserver[i] );
4411 dpsd_server[i].lpszPasswordA = (LPSTR) "password";
4412 }
4413 dpsd_server[4].dwFlags = DPSESSION_PRIVATE;
4414 dpsd_server[5].dwFlags = DPSESSION_PASSWORDREQUIRED;
4415 for (i=4; i<=5; i++)
4416 {
4417 pDPserver[i] = create_session( &dpsd_server[i] );
4418 }
4419
4420 /* - Listing without password */
4421 callbackData.dwCounter1 = -1;
4423 &callbackData, callbackData.dwFlags );
4424 checkHR( DP_OK, hr );
4425 check( 0, callbackData.dwCounter1 );
4426
4428 callbackData.dwCounter1 = -1;
4430 &callbackData, callbackData.dwFlags );
4431 checkHR( DP_OK, hr );
4432 check( 1, callbackData.dwCounter1 );
4433
4434 /* - Listing with incorrect password */
4435 dpsd.lpszPasswordA = (LPSTR) "bad_password";
4436 callbackData.dwFlags = 0;
4437 callbackData.dwCounter1 = -1;
4439 &callbackData, callbackData.dwFlags );
4440 checkHR( DP_OK, hr );
4441 check( 0, callbackData.dwCounter1 );
4442
4444 callbackData.dwCounter1 = -1;
4446 &callbackData, callbackData.dwFlags );
4447 checkHR( DP_OK, hr );
4448 check( 1, callbackData.dwCounter1 );
4449
4450 /* - Listing with correct password */
4451 dpsd.lpszPasswordA = (LPSTR) "password";
4452 callbackData.dwCounter1 = -1;
4454 &callbackData, callbackData.dwFlags );
4455 checkHR( DP_OK, hr );
4456 check( 2, callbackData.dwCounter1 );
4457
4458
4459 dpsd.lpszPasswordA = NULL;
4460 callbackData.dwFlags = DPENUMSESSIONS_ASYNC;
4461 callbackData.dwCounter1 = -1;
4463 &callbackData, callbackData.dwFlags );
4464 checkHR( DP_OK, hr );
4465 check( 2, callbackData.dwCounter1 ); /* Read cache of last sync enumeration,
4466 even private sessions */
4467
4468
4469 /* GUID tests */
4470
4471 /* - Creating two servers with different application GUIDs */
4472 for (i=4; i<=5; i++)
4473 {
4474 IDirectPlayX_Release( pDPserver[i] );
4475 dpsd_server[i].dwFlags = ( DPSESSION_CLIENTSERVER |
4477 dpsd_server[i].lpszPasswordA = NULL;
4478 dpsd_server[i].dwMaxPlayers = 10;
4479 }
4480 dpsd_server[4].lpszSessionNameA = (LPSTR) "normal1";
4481 dpsd_server[4].guidApplication = appGuid;
4482 dpsd_server[5].lpszSessionNameA = (LPSTR) "normal2";
4483 dpsd_server[5].guidApplication = appGuid2;
4484 for (i=4; i<=5; i++)
4485 {
4486 pDPserver[i] = create_session( &dpsd_server[i] );
4487 }
4488
4489 callbackData.dwFlags = 0;
4490
4491 dpsd.guidApplication = appGuid2;
4492 callbackData.dwCounter1 = -1;
4494 &callbackData, callbackData.dwFlags );
4495 checkHR( DP_OK, hr );
4496 check( 1, callbackData.dwCounter1 ); /* Only one of the sessions */
4497
4498 dpsd.guidApplication = appGuid;
4499 callbackData.dwCounter1 = -1;
4501 &callbackData, callbackData.dwFlags );
4502 checkHR( DP_OK, hr );
4503 check( 1, callbackData.dwCounter1 ); /* The other session */
4504 /* FIXME:
4505 For some reason, if we enum 1st with appGuid and 2nd with appGuid2,
4506 in the second enum we get the 2 sessions. Dplay fault? Elves? */
4507
4509 callbackData.dwCounter1 = -1;
4511 &callbackData, callbackData.dwFlags );
4512 checkHR( DP_OK, hr );
4513 check( 2, callbackData.dwCounter1 ); /* Both sessions */
4514
4515 for (i=4; i<=5; i++)
4516 {
4517 IDirectPlayX_Release( pDPserver[i] );
4518 }
4519 IDirectPlayX_Release( pDP );
4520
4521}
#define N_SESSIONS
static IDirectPlay4 * create_session(DPSESSIONDESC2 *lpdpsd)
Definition: dplayx.c:3702
static BOOL CALLBACK EnumSessions_cb(LPCDPSESSIONDESC2 lpThisSD, LPDWORD lpdwTimeOut, DWORD dwFlags, LPVOID lpContext)
Definition: dplayx.c:3670
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:726

Referenced by START_TEST().

◆ test_interactive_GetMessageQueue()

static void test_interactive_GetMessageQueue ( void  )
static

Definition at line 9736 of file dplayx.c.

9737{
9738
9739 IDirectPlay4 *pDP[2];
9740 DPSESSIONDESC2 dpsd;
9741 DPID dpid[4];
9742 CallbackData callbackData;
9743 HRESULT hr;
9744 UINT i;
9745 DWORD dwNumMsgs, dwNumBytes;
9746
9747 DWORD dwDataSize = 1024;
9748 LPVOID lpData = calloc( 1, dwDataSize );
9749
9750
9751 for (i=0; i<2; i++)
9752 {
9753 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
9754 &IID_IDirectPlay4A, (LPVOID*) &pDP[i] );
9755 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
9756 if (FAILED(hr)) return;
9757 }
9758 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
9759
9760
9761 dwNumMsgs = dwNumBytes = -1;
9762 hr = IDirectPlayX_GetMessageQueue( pDP[0], 0, 0, 0,
9763 &dwNumMsgs, &dwNumBytes );
9765 check( -1, dwNumMsgs );
9766 check( -1, dwNumBytes );
9767
9768 if ( hr == DP_OK )
9769 {
9770 todo_wine win_skip( "GetMessageQueue not implemented\n" );
9771 return;
9772 }
9773
9774
9775 init_TCPIP_provider( pDP[0], "127.0.0.1", 0 );
9776 init_TCPIP_provider( pDP[1], "127.0.0.1", 0 );
9777
9778
9779 dwNumMsgs = dwNumBytes = -1;
9780 hr = IDirectPlayX_GetMessageQueue( pDP[0], 0, 0, 0,
9781 &dwNumMsgs, &dwNumBytes );
9782 checkHR( DP_OK, hr );
9783 check( 0, dwNumMsgs );
9784 check( 0, dwNumBytes );
9785
9786
9787 dpsd.dwSize = sizeof(DPSESSIONDESC2);
9788 dpsd.guidApplication = appGuid;
9789 dpsd.dwMaxPlayers = 10;
9790 IDirectPlayX_Open( pDP[0], &dpsd, DPOPEN_CREATE );
9792 pDP[1], 0 );
9793
9794 IDirectPlayX_CreatePlayer( pDP[0], &dpid[0], NULL, NULL, NULL, 0, 0 );
9795 IDirectPlayX_CreatePlayer( pDP[0], &dpid[1], NULL, NULL, NULL, 0, 0 );
9796 IDirectPlayX_CreatePlayer( pDP[1], &dpid[3], NULL, NULL, NULL, 0, 0 );
9797 IDirectPlayX_CreatePlayer( pDP[0], &dpid[2], NULL, NULL, NULL, 0, 0 );
9798
9799
9800
9801 /* Incorrect parameters */
9802 dwNumMsgs = dwNumBytes = -1;
9803 hr = IDirectPlayX_GetMessageQueue( pDP[0], -1, dpid[1],
9804 0,
9805 &dwNumMsgs, &dwNumBytes );
9807 check( -1, dwNumMsgs );
9808 check( -1, dwNumBytes );
9809
9810 dwNumMsgs = dwNumBytes = -1;
9811 hr = IDirectPlayX_GetMessageQueue( pDP[0], dpid[0], -1,
9812 0,
9813 &dwNumMsgs, &dwNumBytes );
9815 check( -1, dwNumMsgs );
9816 check( -1, dwNumBytes );
9817
9818 dwNumMsgs = dwNumBytes = -1;
9819 hr = IDirectPlayX_GetMessageQueue( pDP[0], dpid[0], dpid[0],
9820 -1,
9821 &dwNumMsgs, &dwNumBytes );
9823 check( -1, dwNumMsgs );
9824 check( -1, dwNumBytes );
9825
9826 dwNumMsgs = dwNumBytes = -1;
9827 hr = IDirectPlayX_GetMessageQueue( pDP[0], dpid[0], dpid[1],
9830 &dwNumMsgs, &dwNumBytes );
9832 check( -1, dwNumMsgs );
9833 check( -1, dwNumBytes );
9834
9835 /* - Remote players */
9836if(0)
9837{
9838 /* Crash under Win7 */
9839 dwNumMsgs = dwNumBytes = -1;
9840 hr = IDirectPlayX_GetMessageQueue( pDP[0], 0, dpid[3],
9842 &dwNumMsgs, &dwNumBytes );
9843 checkHR( DPERR_INVALIDPLAYER, hr ); /* Player 3 is remote */
9844 check( -1, dwNumMsgs );
9845 check( -1, dwNumBytes );
9846}
9847
9848 dwNumMsgs = dwNumBytes = -1;
9849 hr = IDirectPlayX_GetMessageQueue( pDP[0], dpid[3], 0,
9851 &dwNumMsgs, &dwNumBytes );
9852 checkHR( DPERR_INVALIDPLAYER, hr ); /* Player 3 is remote */
9853 check( -1, dwNumMsgs );
9854 check( -1, dwNumBytes );
9855
9856 /* - Remote players, this time in the right place */
9857 dwNumMsgs = dwNumBytes = -1;
9858 hr = IDirectPlayX_GetMessageQueue( pDP[0], 0, dpid[3],
9860 &dwNumMsgs, &dwNumBytes );
9861 checkHR( DP_OK, hr );
9862 check( 0, dwNumMsgs );
9863 check( 0, dwNumBytes );
9864
9865 dwNumMsgs = dwNumBytes = -1;
9866 hr = IDirectPlayX_GetMessageQueue( pDP[0], dpid[3], 0,
9868 &dwNumMsgs, &dwNumBytes );
9869 checkHR( DP_OK, hr );
9870 check( 0, dwNumMsgs );
9871 check( 0, dwNumBytes );
9872
9873
9874 /* Correct parameters */
9875 dwNumMsgs = dwNumBytes = -1;
9876 hr = IDirectPlayX_GetMessageQueue( pDP[0], 0, dpid[1],
9878 &dwNumMsgs, &dwNumBytes );
9879 checkHR( DP_OK, hr );
9880 check( 2, dwNumMsgs );
9881 check( 96, dwNumBytes );
9882
9883 dwNumMsgs = dwNumBytes = -1;
9884 hr = IDirectPlayX_GetMessageQueue( pDP[0], dpid[0], 0,
9886 &dwNumMsgs, &dwNumBytes );
9887 checkHR( DP_OK, hr );
9888 check( 0, dwNumMsgs );
9889 check( 0, dwNumBytes );
9890
9891 dwNumMsgs = dwNumBytes = -1;
9892 hr = IDirectPlayX_GetMessageQueue( pDP[0], 0, 0,
9894 &dwNumMsgs, &dwNumBytes );
9895 checkHR( DP_OK, hr );
9896 check( 5, dwNumMsgs );
9897 check( 240, dwNumBytes );
9898
9899 dwNumMsgs = dwNumBytes = -1;
9900 hr = IDirectPlayX_GetMessageQueue( pDP[0], dpid[0], dpid[1],
9902 NULL, &dwNumBytes );
9903 checkHR( DP_OK, hr );
9904 check( -1, dwNumMsgs );
9905 check( 0, dwNumBytes );
9906
9907 dwNumMsgs = dwNumBytes = -1;
9908 hr = IDirectPlayX_GetMessageQueue( pDP[0], dpid[0], dpid[1],
9910 &dwNumMsgs, NULL );
9911 checkHR( DP_OK, hr );
9912 check( 0, dwNumMsgs );
9913 check( -1, dwNumBytes );
9914
9915 dwNumMsgs = dwNumBytes = -1;
9916 hr = IDirectPlayX_GetMessageQueue( pDP[0], dpid[0], dpid[1],
9918 NULL, NULL );
9919 checkHR( DP_OK, hr );
9920 check( -1, dwNumMsgs );
9921 check( -1, dwNumBytes );
9922
9923 dwNumMsgs = dwNumBytes = -1;
9924 hr = IDirectPlayX_GetMessageQueue( pDP[0], dpid[0], dpid[1],
9926 &dwNumMsgs, &dwNumBytes );
9927 checkHR( DP_OK, hr );
9928 check( 0, dwNumMsgs );
9929 check( 0, dwNumBytes );
9930
9931
9932 /* Purge messages */
9933 check_messages( pDP[0], dpid, 6, &callbackData );
9934 checkStr( "S0,S1,S0,S1,S0,", callbackData.szTrace1 );
9935 check_messages( pDP[1], dpid, 6, &callbackData );
9936 checkStr( "S3,", callbackData.szTrace1 );
9937
9938 /* Check queues are empty */
9939 dwNumMsgs = dwNumBytes = -1;
9940 hr = IDirectPlayX_GetMessageQueue( pDP[0], 0, 0,
9942 &dwNumMsgs, &dwNumBytes );
9943 checkHR( DP_OK, hr );
9944 check( 0, dwNumMsgs );
9945 check( 0, dwNumBytes );
9946
9947
9948 /* Sending 4 data messages from 0 to 1 */
9949 /* 3 from 0 to 3 */
9950 /* 2 from 1 to 3 */
9951 for (i=0; i<4; i++)
9952 IDirectPlayX_Send( pDP[0], dpid[0], dpid[1], 0, lpData, dwDataSize );
9953 for (i=0; i<3; i++)
9954 IDirectPlayX_Send( pDP[0], dpid[0], dpid[3], 0, lpData, dwDataSize );
9955 for (i=0; i<2; i++)
9956 IDirectPlayX_Send( pDP[0], dpid[1], dpid[3], 0, lpData, dwDataSize );
9957
9958
9959 dwNumMsgs = dwNumBytes = -1;
9960 hr = IDirectPlayX_GetMessageQueue( pDP[0], dpid[0], dpid[1],
9962 &dwNumMsgs, &dwNumBytes );
9963 checkHR( DP_OK, hr );
9964 check( 4, dwNumMsgs );
9965 check( 4*dwDataSize, dwNumBytes );
9966
9967 dwNumMsgs = dwNumBytes = -1;
9968 hr = IDirectPlayX_GetMessageQueue( pDP[1], dpid[0], dpid[3],
9970 &dwNumMsgs, &dwNumBytes );
9971 checkHR( DP_OK, hr );
9972 check( 3, dwNumMsgs );
9973 check( 3*dwDataSize, dwNumBytes );
9974
9975 dwNumMsgs = dwNumBytes = -1;
9976 hr = IDirectPlayX_GetMessageQueue( pDP[1], dpid[1], dpid[3],
9978 &dwNumMsgs, &dwNumBytes );
9979 checkHR( DP_OK, hr );
9980 check( 2, dwNumMsgs );
9981 check( 2*dwDataSize, dwNumBytes );
9982
9983 dwNumMsgs = dwNumBytes = -1;
9984 hr = IDirectPlayX_GetMessageQueue( pDP[0], dpid[0], 0,
9986 &dwNumMsgs, &dwNumBytes );
9987 checkHR( DP_OK, hr );
9988 check( 4, dwNumMsgs );
9989 check( 4*dwDataSize, dwNumBytes );
9990
9991 dwNumMsgs = dwNumBytes = -1;
9992 hr = IDirectPlayX_GetMessageQueue( pDP[1], dpid[0], 0,
9994 &dwNumMsgs, &dwNumBytes );
9995 checkHR( DP_OK, hr );
9996 check( 3, dwNumMsgs );
9997 check( 3*dwDataSize, dwNumBytes );
9998
9999 dwNumMsgs = dwNumBytes = -1;
10000 hr = IDirectPlayX_GetMessageQueue( pDP[1], 0, dpid[3],
10002 &dwNumMsgs, &dwNumBytes );
10003 checkHR( DP_OK, hr );
10004 check( 5, dwNumMsgs );
10005 check( 5*dwDataSize, dwNumBytes );
10006
10007 dwNumMsgs = dwNumBytes = -1;
10008 hr = IDirectPlayX_GetMessageQueue( pDP[0], 0, 0,
10010 &dwNumMsgs, &dwNumBytes );
10011 checkHR( DP_OK, hr );
10012 check( 4, dwNumMsgs );
10013 check( 4*dwDataSize, dwNumBytes );
10014
10015 dwNumMsgs = dwNumBytes = -1;
10016 hr = IDirectPlayX_GetMessageQueue( pDP[1], 0, 0,
10018 &dwNumMsgs, &dwNumBytes );
10019 checkHR( DP_OK, hr );
10020 check( 5, dwNumMsgs );
10021 check( 5*dwDataSize, dwNumBytes );
10022
10023
10024 dwNumMsgs = dwNumBytes = -1;
10025 hr = IDirectPlayX_GetMessageQueue( pDP[0], dpid[0], dpid[1],
10027 &dwNumMsgs, &dwNumBytes );
10028 checkHR( DP_OK, hr );
10029 check( 0, dwNumMsgs );
10030 check( 0, dwNumBytes );
10031
10032 dwNumMsgs = dwNumBytes = -1;
10033 hr = IDirectPlayX_GetMessageQueue( pDP[0], dpid[0], dpid[1],
10034 0,
10035 &dwNumMsgs, &dwNumBytes );
10036 checkHR( DP_OK, hr );
10037 check( 0, dwNumMsgs );
10038 check( 0, dwNumBytes );
10039
10040
10041 free( lpData );
10042 IDirectPlayX_Release( pDP[0] );
10043 IDirectPlayX_Release( pDP[1] );
10044
10045}

Referenced by START_TEST().

◆ test_interactive_Open()

static void test_interactive_Open ( void  )
static

Definition at line 3441 of file dplayx.c.

3442{
3443
3444 IDirectPlay4 *pDP, *pDP_server;
3445 DPSESSIONDESC2 dpsd, dpsd_server;
3446 HRESULT hr;
3447
3448
3449 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
3450 &IID_IDirectPlay4A, (LPVOID*) &pDP_server );
3451 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
3452 if (FAILED(hr)) return;
3453
3454 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
3455 &IID_IDirectPlay4A, (LPVOID*) &pDP );
3456 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
3457 if (FAILED(hr)) return;
3458
3459 ZeroMemory( &dpsd_server, sizeof(DPSESSIONDESC2) );
3460 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
3461
3462 /* Service provider not initialized */
3463 hr = IDirectPlayX_Open( pDP_server, &dpsd_server, DPOPEN_CREATE );
3465
3466 init_TCPIP_provider( pDP_server, "127.0.0.1", 0 );
3467 init_TCPIP_provider( pDP, "127.0.0.1", 0 );
3468
3469 /* Uninitialized dpsd */
3470 hr = IDirectPlayX_Open( pDP_server, &dpsd_server, DPOPEN_CREATE );
3472
3473
3474 dpsd_server.dwSize = sizeof(DPSESSIONDESC2);
3475 dpsd_server.guidApplication = appGuid;
3476 dpsd_server.dwMaxPlayers = 10;
3477
3478
3479 /* Regular operation */
3480 hr = IDirectPlayX_Open( pDP_server, &dpsd_server, DPOPEN_CREATE );
3482
3483 /* Opening twice */
3484 hr = IDirectPlayX_Open( pDP_server, &dpsd_server, DPOPEN_CREATE );
3486
3487 /* Session flags */
3488 IDirectPlayX_Close( pDP_server );
3489
3491 hr = IDirectPlayX_Open( pDP_server, &dpsd_server, DPOPEN_CREATE );
3493
3495 hr = IDirectPlayX_Open( pDP_server, &dpsd_server, DPOPEN_CREATE );
3497
3499 hr = IDirectPlayX_Open( pDP_server, &dpsd_server, DPOPEN_CREATE );
3501
3502
3503 /* Joining sessions */
3504 /* - Checking how strict dplay is with sizes */
3505 dpsd.dwSize = 0;
3506 hr = IDirectPlayX_Open( pDP, &dpsd, DPOPEN_JOIN );
3508
3509 dpsd.dwSize = sizeof(DPSESSIONDESC2)-1;
3510 hr = IDirectPlayX_Open( pDP, &dpsd, DPOPEN_JOIN );
3512
3513 dpsd.dwSize = sizeof(DPSESSIONDESC2)+1;
3514 hr = IDirectPlayX_Open( pDP, &dpsd, DPOPEN_JOIN );
3516
3517 dpsd.dwSize = sizeof(DPSESSIONDESC2);
3518 hr = IDirectPlayX_Open( pDP, &dpsd, DPOPEN_JOIN );
3519 todo_wine checkHR( DPERR_NOSESSIONS, hr ); /* Only checks for size, not guids */
3520
3521
3522 dpsd.guidApplication = appGuid;
3523 dpsd.guidInstance = appGuid;
3524
3525
3526 hr = IDirectPlayX_Open( pDP, &dpsd, DPOPEN_JOIN );
3528 hr = IDirectPlayX_Open( pDP, &dpsd, DPOPEN_JOIN | DPOPEN_CREATE );
3529 todo_wine checkHR( DPERR_NOSESSIONS, hr ); /* Second flag is ignored */
3530
3531 dpsd_server.dwFlags = 0;
3532
3533
3534 /* Join to normal session */
3535 hr = IDirectPlayX_Open( pDP_server, &dpsd_server, DPOPEN_CREATE );
3537
3538 IDirectPlayX_EnumSessions( pDP, &dpsd, 0, EnumSessions_cb2, pDP, 0 );
3539
3540
3541 /* Already initialized session */
3542 hr = IDirectPlayX_Open( pDP_server, &dpsd_server, DPOPEN_CREATE );
3544
3545
3546 /* Checking which is the error checking order */
3547 dpsd_server.dwSize = 0;
3548
3549 hr = IDirectPlayX_Open( pDP_server, &dpsd_server, DPOPEN_CREATE );
3551
3552 dpsd_server.dwSize = sizeof(DPSESSIONDESC2);
3553
3554
3555 /* Join to protected session */
3556 IDirectPlayX_Close( pDP_server );
3557 dpsd_server.lpszPasswordA = (LPSTR) "hadouken";
3558 hr = IDirectPlayX_Open( pDP_server, &dpsd_server, DPOPEN_CREATE );
3560
3563
3564
3565 IDirectPlayX_Release( pDP );
3566 IDirectPlayX_Release( pDP_server );
3567
3568}
static BOOL CALLBACK EnumSessions_cb2(LPCDPSESSIONDESC2 lpThisSD, LPDWORD lpdwTimeOut, DWORD dwFlags, LPVOID lpContext)
Definition: dplayx.c:2866

Referenced by START_TEST().

◆ test_interactive_Receive()

static void test_interactive_Receive ( void  )
static

Definition at line 8810 of file dplayx.c.

8811{
8812
8813 IDirectPlay4 *pDP;
8814 DPSESSIONDESC2 dpsd;
8815 DPID dpid[4], idFrom, idTo;
8816 HRESULT hr;
8817 LPCSTR message = "message";
8818 DWORD messageSize = strlen(message) + 1;
8819 DWORD dwDataSize = 1024;
8820 LPDPMSG_GENERIC lpData = calloc( 1, dwDataSize );
8821 LPDPMSG_CREATEPLAYERORGROUP lpDataCreate;
8822 LPDPMSG_DESTROYPLAYERORGROUP lpDataDestroy;
8823
8824 DWORD dwCount;
8825 UINT i;
8826
8827
8828 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
8829 &IID_IDirectPlay4A, (LPVOID*) &pDP );
8830 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
8831 if (FAILED(hr)) return;
8832
8833 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
8834 dpsd.dwSize = sizeof(DPSESSIONDESC2);
8835 dpsd.guidApplication = appGuid;
8836
8837 init_TCPIP_provider( pDP, "127.0.0.1", 0 );
8838
8839 IDirectPlayX_Open( pDP, &dpsd, DPOPEN_CREATE );
8840
8841
8842 /* Invalid parameters */
8843 hr = IDirectPlayX_Receive( pDP, NULL, &idTo, 0,
8844 lpData, &dwDataSize );
8846
8847 if ( hr == DPERR_UNINITIALIZED )
8848 {
8849 todo_wine win_skip( "Receive not implemented\n" );
8850 return;
8851 }
8852
8853 hr = IDirectPlayX_Receive( pDP, &idFrom, NULL, 0,
8854 lpData, &dwDataSize );
8856 hr = IDirectPlayX_Receive( pDP, &idFrom, &idTo, 0,
8857 lpData, NULL );
8859 dwDataSize = -1;
8860 hr = IDirectPlayX_Receive( pDP, &idFrom, &idTo, 0,
8861 lpData, &dwDataSize );
8863
8864 /* No messages yet */
8865 hr = IDirectPlayX_Receive( pDP, &idFrom, &idTo, 0,
8866 NULL, &dwDataSize );
8868 dwDataSize = 0;
8869 hr = IDirectPlayX_Receive( pDP, &idFrom, &idTo, 0,
8870 lpData, &dwDataSize );
8872
8873
8874 IDirectPlayX_CreatePlayer( pDP, &dpid[0], NULL, 0, NULL, 0, 0 );
8875 IDirectPlayX_CreatePlayer( pDP, &dpid[1], NULL, 0, NULL, 0,
8877 IDirectPlayX_CreatePlayer( pDP, &dpid[2], NULL, 0, NULL, 0, 0 );
8878 IDirectPlayX_CreatePlayer( pDP, &dpid[3], NULL, 0, NULL, 0, 0 );
8879
8880
8881 /* 0, 1, 2, 3 */
8882 /* 3, 2, 1, 0 */
8883 for (i=0; i<4; i++)
8884 {
8885 IDirectPlayX_GetMessageCount( pDP, dpid[i], &dwCount );
8886 check( 3-i, dwCount );
8887 }
8888
8889
8890 IDirectPlayX_DestroyPlayer( pDP, dpid[3] );
8891 IDirectPlayX_DestroyPlayer( pDP, dpid[1] );
8892
8893
8894 /* 0, 1, 2, 3 */
8895 /* 5, 5, 3, 3 */
8896 IDirectPlayX_GetMessageCount( pDP, dpid[0], &dwCount );
8897 check( 5, dwCount );
8898 IDirectPlayX_GetMessageCount( pDP, dpid[1], &dwCount );
8899 check( 5, dwCount );
8900 IDirectPlayX_GetMessageCount( pDP, dpid[2], &dwCount );
8901 check( 3, dwCount );
8902 IDirectPlayX_GetMessageCount( pDP, dpid[3], &dwCount );
8903 check( 3, dwCount );
8904
8905
8906 /* Buffer too small */
8907 hr = IDirectPlayX_Receive( pDP, &idFrom, &idFrom, 0,
8908 NULL, &dwDataSize );
8910 check( 48, dwDataSize );
8911 dwDataSize = 0;
8912 hr = IDirectPlayX_Receive( pDP, &idTo, &idFrom, 0,
8913 lpData, &dwDataSize );
8915 check( 48, dwDataSize );
8916
8917
8918 /* Checking the order or reception */
8919 for (i=0; i<11; i++)
8920 {
8921 dwDataSize = 1024;
8922 hr = IDirectPlayX_Receive( pDP, &idFrom, &idTo, 0,
8923 lpData, &dwDataSize );
8924
8925 checkHR( DP_OK, hr );
8926 check( DPID_SYSMSG, idFrom );
8927
8928 if (i<6) /* Player creation */
8929 {
8931 check( 48, dwDataSize );
8932 lpDataCreate = (LPDPMSG_CREATEPLAYERORGROUP) lpData;
8933 check( DPPLAYERTYPE_PLAYER, lpDataCreate->dwPlayerType );
8934 checkLP( NULL, lpDataCreate->lpData );
8935 check( 0, lpDataCreate->dwDataSize );
8936 checkLP( NULL, lpDataCreate->dpnName.lpszShortNameA );
8937 check( 0, lpDataCreate->dpIdParent );
8938 }
8939 else /* Player destruction */
8940 {
8942 dpMsgType2str );
8943 check( 52, dwDataSize );
8944 lpDataDestroy = (LPDPMSG_DESTROYPLAYERORGROUP) lpData;
8945 check( DPPLAYERTYPE_PLAYER, lpDataDestroy->dwPlayerType );
8946 checkLP( NULL, lpDataDestroy->lpLocalData );
8947 check( 0, lpDataDestroy->dwLocalDataSize );
8948 checkLP( NULL, lpDataDestroy->lpRemoteData );
8949 check( 0, lpDataDestroy->dwRemoteDataSize );
8950 checkLP( NULL, lpDataDestroy->dpnName.lpszShortNameA );
8951 check( 0, lpDataDestroy->dpIdParent );
8952 }
8953
8954 switch(i)
8955 {
8956 /* 1 -> 0 */
8957 case 0:
8958 lpDataCreate = (LPDPMSG_CREATEPLAYERORGROUP) lpData;
8959 check( dpid[0], idTo );
8960 check( dpid[1], lpDataCreate->dpId );
8961 check( 1, lpDataCreate->dwCurrentPlayers );
8964 break;
8965
8966 /* 2 -> 1,0 */
8967 case 1:
8968 check( dpid[1], idTo );
8969 lpDataCreate = (LPDPMSG_CREATEPLAYERORGROUP) lpData;
8970 check( dpid[2], lpDataCreate->dpId );
8971 check( 2, lpDataCreate->dwCurrentPlayers );
8972 checkFlags( DPPLAYER_LOCAL, lpDataCreate->dwFlags,
8974 break;
8975 case 2:
8976 check( dpid[0], idTo );
8977 lpDataCreate = (LPDPMSG_CREATEPLAYERORGROUP) lpData;
8978 check( dpid[2], lpDataCreate->dpId );
8979 check( 2, lpDataCreate->dwCurrentPlayers );
8980 checkFlags( DPPLAYER_LOCAL, lpDataCreate->dwFlags,
8982 break;
8983
8984 /* 3 -> 2,1,0 */
8985 case 3:
8986 check( dpid[2], idTo );
8987 lpDataCreate = (LPDPMSG_CREATEPLAYERORGROUP) lpData;
8988 check( dpid[3], lpDataCreate->dpId );
8989 check( 3, lpDataCreate->dwCurrentPlayers );
8990 checkFlags( DPPLAYER_LOCAL, lpDataCreate->dwFlags,
8992 break;
8993 case 4:
8994 check( dpid[1], idTo );
8995 lpDataCreate = (LPDPMSG_CREATEPLAYERORGROUP) lpData;
8996 check( dpid[3], lpDataCreate->dpId );
8997 check( 3, lpDataCreate->dwCurrentPlayers );
8998 checkFlags( DPPLAYER_LOCAL, lpDataCreate->dwFlags,
9000 break;
9001 case 5:
9002 check( dpid[0], idTo );
9003 lpDataCreate = (LPDPMSG_CREATEPLAYERORGROUP) lpData;
9004 check( dpid[3], lpDataCreate->dpId );
9005 check( 3, lpDataCreate->dwCurrentPlayers );
9006 checkFlags( DPPLAYER_LOCAL, lpDataCreate->dwFlags,
9008 break;
9009
9010 /* 3 -> 2,1,0 */
9011 case 6:
9012 check( dpid[2], idTo );
9013 lpDataDestroy = (LPDPMSG_DESTROYPLAYERORGROUP) lpData;
9014 check( dpid[3], lpDataDestroy->dpId );
9015 checkFlags( DPPLAYER_LOCAL, lpDataDestroy->dwFlags,
9017 break;
9018 case 7:
9019 check( dpid[1], idTo );
9020 lpDataDestroy = (LPDPMSG_DESTROYPLAYERORGROUP) lpData;
9021 check( dpid[3], lpDataDestroy->dpId );
9022 checkFlags( DPPLAYER_LOCAL, lpDataDestroy->dwFlags,
9024 break;
9025 case 8:
9026 check( dpid[0], idTo );
9027 lpDataDestroy = (LPDPMSG_DESTROYPLAYERORGROUP) lpData;
9028 check( dpid[3], lpDataDestroy->dpId );
9029 checkFlags( DPPLAYER_LOCAL, lpDataDestroy->dwFlags,
9031 break;
9032
9033 /* 1 -> 2,0 */
9034 case 9:
9035 check( dpid[2], idTo );
9036 lpDataDestroy = (LPDPMSG_DESTROYPLAYERORGROUP) lpData;
9037 check( dpid[1], lpDataDestroy->dpId );
9039 DPPLAYER_SPECTATOR, lpDataDestroy->dwFlags,
9041 break;
9042 case 10:
9043 check( dpid[0], idTo );
9044 lpDataDestroy = (LPDPMSG_DESTROYPLAYERORGROUP) lpData;
9045 check( dpid[1], lpDataDestroy->dpId );
9047 DPPLAYER_SPECTATOR, lpDataDestroy->dwFlags,
9049 break;
9050
9051 default:
9052 trace( "%s\n", dpMsgType2str(lpData->dwType) );
9053 break;
9054 }
9055 }
9056
9057 hr = IDirectPlayX_Receive( pDP, &idFrom, &idTo, 0, lpData, &dwDataSize );
9059
9060
9061 /* New data message */
9062 hr = IDirectPlayX_Send( pDP, dpid[0], dpid[2], 0,
9063 (LPVOID) message, messageSize );
9064 checkHR( DP_OK, hr );
9065
9066
9067 /* Ensuring DPRECEIVE_PEEK doesn't remove the messages from the queue */
9068 for (i=0; i<10; i++)
9069 {
9070 hr = IDirectPlayX_Receive( pDP, &idFrom, &idTo, DPRECEIVE_PEEK,
9071 lpData, &dwDataSize );
9072 checkHR( DP_OK, hr );
9073 checkStr( message, (LPSTR) lpData );
9074 }
9075
9076 /* Removing the message from the queue */
9077 hr = IDirectPlayX_Receive( pDP, &idFrom, &idTo, 0, lpData, &dwDataSize );
9078 checkHR( DP_OK, hr );
9079 check( idFrom, dpid[0] );
9080 check( idTo, dpid[2] );
9081 checkStr( message, (LPSTR) lpData );
9082
9083 hr = IDirectPlayX_Receive( pDP, &idFrom, &idTo, 0, lpData, &dwDataSize );
9085
9086
9087 free( lpData );
9088 IDirectPlayX_Release( pDP );
9089
9090}
struct tagDPMSG_DESTROYPLAYERORGROUP * LPDPMSG_DESTROYPLAYERORGROUP
struct tagDPMSG_CREATEPLAYERORGROUP * LPDPMSG_CREATEPLAYERORGROUP
DWORD dwType
Definition: dplay.h:1141

Referenced by START_TEST().

◆ test_interactive_Send()

static void test_interactive_Send ( void  )
static

Definition at line 8245 of file dplayx.c.

8246{
8247
8248 IDirectPlay4 *pDP[2];
8249 DPSESSIONDESC2 dpsd;
8250 DPID dpid[4], idFrom, idTo;
8251 CallbackData callbackData;
8252 HRESULT hr;
8253 LPCSTR message = "message";
8254 DWORD messageSize = strlen(message) + 1;
8255 DWORD dwDataSize = 1024;
8256 LPDPMSG_GENERIC lpData = calloc( 1, dwDataSize );
8257 LPDPMSG_SECUREMESSAGE lpDataSecure;
8258 UINT i;
8259
8260
8261 for (i=0; i<2; i++)
8262 {
8263 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
8264 &IID_IDirectPlay4A, (LPVOID*) &pDP[i] );
8265 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
8266 if (FAILED(hr)) return;
8267 }
8268 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
8269
8270
8271 /* Uninitialized service provider */
8272 hr = IDirectPlayX_Send( pDP[0], 0, 0, 0,
8273 (LPVOID) message, messageSize );
8275
8276
8277 init_TCPIP_provider( pDP[0], "127.0.0.1", 0 );
8278 init_TCPIP_provider( pDP[1], "127.0.0.1", 0 );
8279
8280 dpsd.dwSize = sizeof(DPSESSIONDESC2);
8281 dpsd.guidApplication = appGuid;
8282 dpsd.dwMaxPlayers = 10;
8283 IDirectPlayX_Open( pDP[0], &dpsd, DPOPEN_CREATE );
8285 pDP[1], 0 );
8286 IDirectPlayX_Open( pDP[0], &dpsd, DPOPEN_CREATE );
8287
8288
8289 /* Incorrect players */
8290 hr = IDirectPlayX_Send( pDP[0], 0, 1, 2,
8291 (LPVOID) message, messageSize );
8293
8294 if ( hr == DPERR_UNINITIALIZED )
8295 {
8296 todo_wine win_skip( "Send not implemented\n" );
8297 return;
8298 }
8299
8300
8301 IDirectPlayX_CreatePlayer( pDP[0], &dpid[0], NULL, NULL, NULL, 0, 0 );
8302 IDirectPlayX_CreatePlayer( pDP[0], &dpid[1], NULL, NULL, NULL, 0, 0 );
8303 IDirectPlayX_CreatePlayer( pDP[0], &dpid[2], NULL, NULL, NULL, 0, 0 );
8304 IDirectPlayX_CreatePlayer( pDP[1], &dpid[3], NULL, NULL, NULL, 0, 0 );
8305
8306 /* Purge player creation messages */
8307 check_messages( pDP[0], dpid, 4, &callbackData );
8308 checkStr( "S0," "S1,S0," "S2,S1,S0,", callbackData.szTrace1 );
8309 check_messages( pDP[1], dpid, 4, &callbackData );
8310 checkStr( "", callbackData.szTrace1 );
8311
8312
8313 /* Message to self: no error, but no message is sent */
8314 hr = IDirectPlayX_Send( pDP[0], dpid[0], dpid[0], 0,
8315 (LPVOID) message, messageSize );
8316 checkHR( DP_OK, hr );
8317
8318 /* Send a message from a remote player */
8319 hr = IDirectPlayX_Send( pDP[1], dpid[0], dpid[1], 0,
8320 (LPVOID) message, messageSize );
8322 hr = IDirectPlayX_Send( pDP[1], dpid[0], dpid[3], 0,
8323 (LPVOID) message, messageSize );
8325
8326 /* Null message */
8327 hr = IDirectPlayX_Send( pDP[0], dpid[0], dpid[1], 0,
8328 NULL, messageSize );
8330 hr = IDirectPlayX_Send( pDP[0], dpid[0], dpid[1], 0,
8331 (LPVOID) message, 0 );
8333
8334
8335 /* Checking no message was sent */
8336 check_messages( pDP[0], dpid, 4, &callbackData );
8337 checkStr( "", callbackData.szTrace1 );
8338 check_messages( pDP[1], dpid, 4, &callbackData );
8339 checkStr( "", callbackData.szTrace1 );
8340
8341
8342 /* Regular parameters */
8343 hr = IDirectPlayX_Send( pDP[0], dpid[0], dpid[1],
8344 0,
8345 (LPVOID) message, messageSize );
8346 checkHR( DP_OK, hr );
8347
8348 hr = IDirectPlayX_Receive( pDP[0], &dpid[0], &dpid[1],
8350 lpData, &dwDataSize );
8351 checkHR( DP_OK, hr );
8352 checkStr( message, (LPSTR) lpData );
8353 check( strlen(message)+1, dwDataSize );
8354
8355 check_messages( pDP[0], dpid, 4, &callbackData );
8356 checkStr( "", callbackData.szTrace1 );
8357 check_messages( pDP[1], dpid, 4, &callbackData );
8358 checkStr( "", callbackData.szTrace1 );
8359
8360
8361 /* Message to a remote player */
8362 hr = IDirectPlayX_Send( pDP[0], dpid[0], dpid[3], 0,
8363 (LPVOID) message, messageSize );
8364 checkHR( DP_OK, hr );
8365
8366 hr = IDirectPlayX_Receive( pDP[0], &dpid[0], &dpid[3],
8368 lpData, &dwDataSize );
8370 hr = IDirectPlayX_Receive( pDP[1], &dpid[0], &dpid[3],
8372 lpData, &dwDataSize );
8373 checkHR( DP_OK, hr );
8374 checkStr( message, (LPSTR) lpData );
8375 check( strlen(message)+1, dwDataSize );
8376
8377 check_messages( pDP[0], dpid, 4, &callbackData );
8378 checkStr( "", callbackData.szTrace1 );
8379 check_messages( pDP[1], dpid, 4, &callbackData );
8380 checkStr( "", callbackData.szTrace1 );
8381
8382
8383 /* Broadcast */
8384
8385 hr = IDirectPlayX_Send( pDP[0], dpid[0], DPID_ALLPLAYERS, 0,
8386 (LPVOID) message, messageSize );
8387 checkHR( DP_OK, hr );
8388
8389 for (i=1; i<3; i++)
8390 {
8391 hr = IDirectPlayX_Receive( pDP[0], &dpid[0], &dpid[i],
8393 lpData, &dwDataSize );
8394 checkHR( DP_OK, hr );
8395 checkStr( message, (LPSTR) lpData );
8396 }
8397 hr = IDirectPlayX_Receive( pDP[1], &dpid[0], &dpid[3],
8399 lpData, &dwDataSize );
8400 checkHR( DP_OK, hr );
8401 checkStr( message, (LPSTR) lpData );
8402
8403 check_messages( pDP[0], dpid, 4, &callbackData );
8404 checkStr( "", callbackData.szTrace1 );
8405 check_messages( pDP[1], dpid, 4, &callbackData );
8406 checkStr( "", callbackData.szTrace1 );
8407
8408
8409 hr = IDirectPlayX_Send( pDP[0], DPID_ALLPLAYERS, dpid[1],
8410 0,
8411 (LPVOID) message, messageSize );
8414 0,
8415 (LPVOID) message, messageSize );
8417
8418
8419 /* Flags */
8420 hr = IDirectPlayX_Send( pDP[0], dpid[0], dpid[1],
8422 (LPVOID) message, messageSize );
8423 checkHR( DP_OK, hr );
8424
8425 hr = IDirectPlayX_Receive( pDP[0], &dpid[0], &dpid[1],
8427 lpData, &dwDataSize );
8428 checkHR( DP_OK, hr );
8429 checkStr( message, (LPSTR)lpData );
8430
8431 /* - Inorrect flags */
8432 hr = IDirectPlayX_Send( pDP[0], dpid[0], dpid[1],
8434 (LPVOID) message, messageSize );
8436 hr = IDirectPlayX_Send( pDP[0], dpid[0], dpid[1],
8438 (LPVOID) message, messageSize );
8440 hr = IDirectPlayX_Send( pDP[0], dpid[0], dpid[1],
8442 (LPVOID) message, messageSize );
8444
8445 /* - Correct flags, but session is not secure */
8446 hr = IDirectPlayX_Send( pDP[0], dpid[0], dpid[1],
8448 (LPVOID) message, messageSize );
8450 hr = IDirectPlayX_Send( pDP[0], dpid[0], dpid[1],
8452 (LPVOID) message, messageSize );
8454 hr = IDirectPlayX_Send( pDP[0], dpid[0], dpid[1],
8458 (LPVOID) message, messageSize );
8460
8461 /* - Correct flags, secure session incorrectly opened (without flags) */
8462 hr = IDirectPlayX_Close( pDP[0] );
8463 checkHR( DP_OK, hr );
8464
8465 dpsd.dwFlags = 0;
8466 hr = IDirectPlayX_SecureOpen( pDP[0], &dpsd, DPOPEN_CREATE, NULL, NULL );
8467 checkHR( DP_OK, hr );
8468 for (i=0; i<2; i++)
8469 IDirectPlayX_CreatePlayer( pDP[0], &dpid[i], NULL, NULL, NULL, 0, 0 );
8470
8471 hr = IDirectPlayX_Send( pDP[0], dpid[0], dpid[1],
8473 (LPVOID) message, messageSize );
8475 hr = IDirectPlayX_Send( pDP[0], dpid[0], dpid[1],
8477 (LPVOID) message, messageSize );
8479 hr = IDirectPlayX_Send( pDP[0], dpid[0], dpid[1],
8483 (LPVOID) message, messageSize );
8485
8486 /* - Correct flags, secure session */
8487 hr = IDirectPlayX_Close( pDP[0] );
8488 checkHR( DP_OK, hr );
8489
8491 hr = IDirectPlayX_SecureOpen( pDP[0], &dpsd, DPOPEN_CREATE, NULL, NULL );
8492 checkHR( DP_OK, hr );
8493 IDirectPlayX_CreatePlayer( pDP[0], &dpid[0], NULL, NULL, NULL, 0, 0 );
8494 IDirectPlayX_CreatePlayer( pDP[0], &dpid[1], NULL, NULL, NULL, 0, 0 );
8495
8496 /* Purge */
8497 check_messages( pDP[0], dpid, 6, &callbackData );
8498 checkStr( "S0,", callbackData.szTrace1 );
8499
8500
8501 hr = IDirectPlayX_Send( pDP[0], dpid[0], dpid[1],
8503 (LPVOID) message, messageSize );
8504 checkHR( DP_OK, hr );
8505 hr = IDirectPlayX_Send( pDP[0], dpid[0], dpid[1],
8507 (LPVOID) message, messageSize );
8508 checkHR( DP_OK, hr );
8509 hr = IDirectPlayX_Send( pDP[0], dpid[0], dpid[1],
8513 (LPVOID) message, messageSize );
8514 checkHR( DP_OK, hr );
8515
8516
8517 for (i=0; i<3; i++)
8518 {
8519 dwDataSize = 1024;
8520 hr = IDirectPlayX_Receive( pDP[0], &idFrom, &idTo, 0, lpData,
8521 &dwDataSize );
8522
8523 lpDataSecure = (LPDPMSG_SECUREMESSAGE) lpData;
8524
8525 checkHR( DP_OK, hr );
8527 check( DPID_SYSMSG, idFrom );
8528 check( dpid[1], idTo );
8529 check( dpid[0], lpDataSecure->dpIdFrom );
8530 checkStr( message, (LPSTR) lpDataSecure->lpData );
8531 check( strlen(message)+1, lpDataSecure->dwDataSize );
8532
8533 switch(i)
8534 {
8535 case 0:
8537 lpDataSecure->dwFlags,
8538 FLAGS_DPSEND );
8539 break;
8540 case 1:
8542 lpDataSecure->dwFlags,
8543 FLAGS_DPSEND );
8544 break;
8545 case 2:
8547 lpDataSecure->dwFlags,
8548 FLAGS_DPSEND );
8549 break;
8550 default: break;
8551 }
8552 }
8553 check_messages( pDP[0], dpid, 4, &callbackData );
8554 checkStr( "", callbackData.szTrace1 );
8555
8556
8557 /* - Even in a secure session, incorrect flags still not working */
8558 hr = IDirectPlayX_Send( pDP[0], dpid[0], dpid[1],
8560 (LPVOID) message, messageSize );
8562 hr = IDirectPlayX_Send( pDP[0], dpid[0], dpid[1],
8564 (LPVOID) message, messageSize );
8566 hr = IDirectPlayX_Send( pDP[0], dpid[0], dpid[1],
8568 (LPVOID) message, messageSize );
8570
8571
8572 free( lpData );
8573 IDirectPlayX_Release( pDP[0] );
8574 IDirectPlayX_Release( pDP[1] );
8575
8576}
struct tagDPMSG_SECUREMESSAGE * LPDPMSG_SECUREMESSAGE

Referenced by START_TEST().

◆ test_Open()

static void test_Open ( void  )
static

Definition at line 3286 of file dplayx.c.

3287{
3288 DPSESSIONDESC2 dpsdZero =
3289 {
3290 .dwSize = sizeof( DPSESSIONDESC2 ),
3291 };
3292 DPSESSIONDESC2 dpsdAppGuid =
3293 {
3294 .dwSize = sizeof( DPSESSIONDESC2 ),
3295 .guidInstance = appGuid,
3296 .guidApplication = appGuid,
3297 };
3298 DPSESSIONDESC2 normalDpsd =
3299 {
3300 .dwSize = sizeof( DPSESSIONDESC2 ),
3301 .guidApplication = appGuid,
3302 .guidInstance = appGuid,
3303 .dwMaxPlayers = 10,
3304 .lpszSessionName = (WCHAR *) L"normal",
3305 .dwReserved1 = 0xaabbccdd,
3306 };
3307 DPSESSIONDESC2 protectedDpsd =
3308 {
3309 .dwSize = sizeof( DPSESSIONDESC2 ),
3311 .guidApplication = appGuid,
3312 .guidInstance = appGuid,
3313 .dwMaxPlayers = 10,
3314 .lpszSessionName = (WCHAR *) L"protected",
3315 .lpszPassword = (WCHAR *) L"hadouken",
3316 .dwReserved1 = 0xaabbccdd,
3317 };
3318 EnumSessionsParam *enumSessionsParam;
3319 DPSESSIONDESC2 replyDpsd;
3320 DPSESSIONDESC2 dpsd;
3321 unsigned short port;
3322 IDirectPlay4 *dp;
3323 SOCKET enumSock;
3324 int tryIndex;
3325 SOCKET sock;
3326 HRESULT hr;
3327
3328 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay4A, (void **) &dp );
3329 ok( hr == DP_OK, "got hr %#lx.\n", hr );
3330
3331 dpsd = dpsdZero;
3332 dpsd.dwSize = 0;
3333 check_Open( dp, &dpsd, NULL, FALSE, FALSE, 2349, NULL, DP_OK, DP_OK, DPERR_INVALIDPARAMS );
3334
3335 check_Open( dp, &dpsdZero, NULL, FALSE, FALSE, 2349, NULL, DP_OK, DP_OK, DPERR_UNINITIALIZED );
3336
3337 init_TCPIP_provider( dp, "127.0.0.1", 0 );
3338
3339 /* Joining sessions */
3340 /* - Checking how strict dplay is with sizes */
3341 dpsd = dpsdZero;
3342 dpsd.dwSize = 0;
3343 check_Open( dp, &dpsd, NULL, FALSE, FALSE, 2349, NULL, DP_OK, DP_OK, DPERR_INVALIDPARAMS );
3344
3345 dpsd = dpsdZero;
3346 dpsd.dwSize = sizeof( DPSESSIONDESC2 ) - 1;
3347 check_Open( dp, &dpsd, NULL, FALSE, FALSE, 2349, NULL, DP_OK, DP_OK, DPERR_INVALIDPARAMS );
3348
3349 dpsd = dpsdZero;
3350 dpsd.dwSize = sizeof( DPSESSIONDESC2 ) + 1;
3351 check_Open( dp, &dpsd, NULL, FALSE, FALSE, 2349, NULL, DP_OK, DP_OK, DPERR_INVALIDPARAMS );
3352
3353 check_Open( dp, &dpsdZero, NULL, FALSE, FALSE, 2349, NULL, DP_OK, DP_OK, DPERR_NOSESSIONS );
3354
3355 check_Open( dp, &dpsdAppGuid, NULL, FALSE, FALSE, 2349, NULL, DP_OK, DP_OK, DPERR_NOSESSIONS );
3356
3357 enumSock = bindUdp( 47624 );
3358
3359 /* Join to normal session */
3360 for ( tryIndex = 0; ; ++tryIndex )
3361 {
3362 int count = 0;
3363
3364 enumSessionsParam = enumSessionsAsync( dp, &dpsdAppGuid, 100, countSessionsCallback, &count, 0 );
3365
3366 port = receiveEnumSessionsRequest( enumSock, &appGuid, NULL, 0 );
3367
3368 sock = connectTcp( port );
3369
3370 sendEnumSessionsReply( sock, 2349, &normalDpsd );
3371
3372 replyDpsd = normalDpsd;
3373 replyDpsd.guidInstance = appGuid2;
3374 sendEnumSessionsReply( sock, 2348, &replyDpsd );
3375
3376 hr = enumSessionsAsyncWait( enumSessionsParam, 2000 );
3377 checkHR( DP_OK, hr );
3378
3379 closesocket( sock );
3380
3381 if ( tryIndex < 19 && count < 2 )
3382 continue;
3383
3384 ok( count == 2, "got session count %d.\n", count );
3385
3386 break;
3387 }
3388
3389 check_Open( dp, &dpsdAppGuid, &normalDpsd, TRUE, FALSE, 2349, L"", DPERR_CANTCREATEPLAYER, DP_OK,
3391
3392 check_Open( dp, &dpsdAppGuid, &normalDpsd, TRUE, TRUE, 2349, L"", DP_OK, DP_OK, DP_OK );
3393
3394 dpsd = dpsdAppGuid;
3395 dpsd.guidInstance = appGuid2;
3396 replyDpsd = normalDpsd;
3397 replyDpsd.guidInstance = appGuid2;
3398 check_Open( dp, &dpsd, &replyDpsd, TRUE, TRUE, 2348, L"", DP_OK, DP_OK, DP_OK );
3399
3400 /* Join to protected session */
3401 for ( tryIndex = 0; ; ++tryIndex )
3402 {
3403 int count = 0;
3404
3405 enumSessionsParam = enumSessionsAsync( dp, &dpsdAppGuid, 100, countSessionsCallback, &count,
3407
3409
3410 sock = connectTcp( port );
3411
3412 sendEnumSessionsReply( sock, 2349, &protectedDpsd );
3413
3414 hr = enumSessionsAsyncWait( enumSessionsParam, 2000 );
3415 checkHR( DP_OK, hr );
3416
3417 closesocket( sock );
3418
3419 if ( tryIndex < 19 && count < 1 )
3420 continue;
3421
3422 ok( count == 1, "got session count %d.\n", count );
3423
3424 break;
3425 }
3426
3427 dpsd = dpsdAppGuid;
3428 dpsd.lpszPasswordA = (char *) "hadouken";
3429 check_Open( dp, &dpsd, &protectedDpsd, TRUE, TRUE, 2349, L"hadouken", DP_OK, DP_OK, DP_OK );
3430
3431 dpsd = dpsdAppGuid;
3432 dpsd.lpszPasswordA = (char *) "sonic boom";
3433 check_Open( dp, &dpsd, &protectedDpsd, TRUE, TRUE, 2349, L"sonic boom", DP_OK, DPERR_INVALIDPASSWORD,
3435
3436 closesocket( enumSock );
3437
3439}
#define sendEnumSessionsReply(sock, port, dpsd)
Definition: dplayx.c:1309
#define bindUdp(port)
Definition: dplayx.c:1023
#define connectTcp(port)
Definition: dplayx.c:1112
#define receiveEnumSessionsRequest(sock, expectedAppGuid, expectedPassword, expectedFlags)
Definition: dplayx.c:1262
#define check_Open(dp, dpsd, serverDpsd, idRequestExpected, forwardRequestExpected, listenPort, expectedPassword, idReplyHr, addForwardReplyHr, expectedHr)
Definition: dplayx.c:3152

Referenced by START_TEST().

◆ test_PING()

static void test_PING ( void  )
static

Definition at line 9092 of file dplayx.c.

9093{
9094 DPSESSIONDESC2 appGuidDpsd =
9095 {
9096 .dwSize = sizeof( DPSESSIONDESC2 ),
9097 .guidInstance = appGuid,
9098 .guidApplication = appGuid,
9099 };
9100 DPSESSIONDESC2 serverDpsd =
9101 {
9102 .dwSize = sizeof( DPSESSIONDESC2 ),
9103 .guidApplication = appGuid,
9104 .guidInstance = appGuid,
9105 .lpszSessionName = (WCHAR *) L"normal",
9106 .dwReserved1 = 0xaabbccdd,
9107 };
9108 unsigned short udpPort;
9109 SOCKET udpSendSock;
9110 SOCKET udpRecvSock;
9111 IDirectPlay4A *dp;
9112 SOCKET sendSock;
9113 SOCKET recvSock;
9114 HRESULT hr;
9115
9116 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay4A, (void **) &dp );
9117 ok( hr == DP_OK, "got hr %#lx.\n", hr );
9118
9119 init_TCPIP_provider( dp, "127.0.0.1", 0 );
9120
9121 joinSession( dp, &appGuidDpsd, &serverDpsd, &sendSock, &recvSock, &udpPort );
9122
9123 udpSendSock = connectUdp( udpPort );
9124
9125 udpRecvSock = bindUdp( 2399 );
9126
9127 sendPing( udpSendSock, 2349, 0x51573, 0x44332211 );
9128 receivePingReply( udpRecvSock, 0x12345678, 0x44332211 );
9129 checkNoMoreMessages( udpRecvSock );
9130
9131 closesocket( udpRecvSock );
9132 closesocket( udpSendSock );
9133 closesocket( recvSock );
9134 closesocket( sendSock );
9135
9137}
#define receivePingReply(sock, expectedFromId, expectedTickCount)
Definition: dplayx.c:2185
#define sendPing(sock, port, fromId, tickCount)
Definition: dplayx.c:2146
#define connectUdp(port)
Definition: dplayx.c:1131

Referenced by START_TEST().

◆ test_PlayerData()

static void test_PlayerData ( void  )
static

Definition at line 5446 of file dplayx.c.

5447{
5448 IDirectPlay4 *pDP;
5449 DPSESSIONDESC2 dpsd;
5450 DPID dpid;
5451 HRESULT hr;
5452
5453 /* lpDataFake has to be bigger than the rest, limits lpDataGet size */
5454 LPCSTR lpDataFake = "big_fake_data_chunk";
5455 DWORD dwDataSizeFake = strlen(lpDataFake)+1;
5456
5457 LPCSTR lpData = "remote_data";
5458 DWORD dwDataSize = strlen(lpData)+1;
5459
5460 LPCSTR lpDataLocal = "local_data";
5461 DWORD dwDataSizeLocal = strlen(lpDataLocal)+1;
5462
5463 LPSTR lpDataGet = calloc( 1, dwDataSizeFake );
5464 DWORD dwDataSizeGet = dwDataSizeFake;
5465
5466
5467 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
5468 &IID_IDirectPlay4A, (LPVOID*) &pDP );
5469 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
5470 if (FAILED(hr)) return;
5471
5472 /* No service provider */
5473 hr = IDirectPlayX_SetPlayerData( pDP, 0, (LPVOID) lpData,
5474 dwDataSize, 0 );
5476
5477 hr = IDirectPlayX_GetPlayerData( pDP, 0, lpDataGet, &dwDataSizeGet, 0 );
5479
5480
5481 init_TCPIP_provider( pDP, "127.0.0.1", 0 );
5482
5483 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
5484 dpsd.dwSize = sizeof(DPSESSIONDESC2);
5485 dpsd.guidApplication = appGuid;
5486 IDirectPlayX_Open( pDP, &dpsd, DPOPEN_CREATE );
5487
5488
5489 /* Invalid player */
5490 hr = IDirectPlayX_SetPlayerData( pDP, 0, (LPVOID) lpData,
5491 dwDataSize, 0 );
5493
5494 hr = IDirectPlayX_GetPlayerData( pDP, 0, lpDataGet, &dwDataSizeGet, 0 );
5496
5497 if ( hr == DPERR_UNINITIALIZED )
5498 {
5499 todo_wine win_skip( "Get/SetPlayerData not implemented\n" );
5500 return;
5501 }
5502
5503 /* Create the player */
5504 /* By default, the data is remote */
5505 hr = IDirectPlayX_CreatePlayer( pDP, &dpid, NULL, NULL, (LPVOID) lpData,
5506 dwDataSize, 0 );
5507 checkHR( DP_OK, hr );
5508
5509 /* Invalid parameters */
5510 hr = IDirectPlayX_SetPlayerData( pDP, dpid, NULL, dwDataSize, 0 );
5512 hr = IDirectPlayX_SetPlayerData( pDP, dpid, lpDataGet, -1, 0 );
5514
5515 hr = IDirectPlayX_GetPlayerData( pDP, dpid, lpDataGet, NULL, 0 );
5517
5518
5519 /*
5520 * Remote data (default)
5521 */
5522
5523
5524 /* Buffer redimension */
5525 dwDataSizeGet = dwDataSizeFake;
5526 strcpy(lpDataGet, lpDataFake);
5527 hr = IDirectPlayX_GetPlayerData( pDP, dpid, NULL,
5528 &dwDataSizeGet, 0 );
5530 check( dwDataSize, dwDataSizeGet );
5531 checkStr( lpDataFake, lpDataGet );
5532
5533 dwDataSizeGet = 2;
5534 strcpy(lpDataGet, lpDataFake);
5535 hr = IDirectPlayX_GetPlayerData( pDP, dpid, lpDataGet, &dwDataSizeGet, 0 );
5537 check( dwDataSize, dwDataSizeGet );
5538
5539 strcpy(lpDataGet, lpDataFake);
5540 hr = IDirectPlayX_GetPlayerData( pDP, dpid, lpDataGet, &dwDataSizeGet, 0 );
5541 checkHR( DP_OK, hr );
5542 check( dwDataSize, dwDataSizeGet );
5543 checkStr( lpData, lpDataGet );
5544
5545 /* Normal operation */
5546 dwDataSizeGet = dwDataSizeFake;
5547 strcpy(lpDataGet, lpDataFake);
5548 hr = IDirectPlayX_GetPlayerData( pDP, dpid, lpDataGet, &dwDataSizeGet, 0 );
5549 checkHR( DP_OK, hr );
5550 check( dwDataSize, dwDataSizeGet );
5551 checkStr( lpData, lpDataGet );
5552
5553 /* Flag tests */
5554 dwDataSizeGet = dwDataSizeFake;
5555 strcpy(lpDataGet, lpDataFake);
5556 hr = IDirectPlayX_GetPlayerData( pDP, dpid, lpDataGet, &dwDataSizeGet, 0 );
5557 checkHR( DP_OK, hr );
5558 check( dwDataSize, dwDataSizeGet ); /* Remote: works as expected */
5559 checkStr( lpData, lpDataGet );
5560
5561 dwDataSizeGet = dwDataSizeFake;
5562 strcpy(lpDataGet, lpDataFake);
5563 hr = IDirectPlayX_GetPlayerData( pDP, dpid, lpDataGet, &dwDataSizeGet,
5564 DPGET_REMOTE );
5565 checkHR( DP_OK, hr );
5566 check( dwDataSize, dwDataSizeGet ); /* Same behaviour as in previous test */
5567 checkStr( lpData, lpDataGet );
5568
5569 dwDataSizeGet = dwDataSizeFake;
5570 strcpy(lpDataGet, lpDataFake);
5571 hr = IDirectPlayX_GetPlayerData( pDP, dpid, lpDataGet, &dwDataSizeGet,
5572 DPGET_LOCAL );
5573 checkHR( DP_OK, hr );
5574 check( 0, dwDataSizeGet ); /* Sets size to 0 (as local data doesn't exist) */
5575 checkStr( lpDataFake, lpDataGet );
5576
5577 dwDataSizeGet = dwDataSizeFake;
5578 strcpy(lpDataGet, lpDataFake);
5579 hr = IDirectPlayX_GetPlayerData( pDP, dpid, lpDataGet, &dwDataSizeGet,
5581 checkHR( DP_OK, hr );
5582 check( 0, dwDataSizeGet ); /* Same behaviour as in previous test */
5583 checkStr( lpDataFake, lpDataGet );
5584
5585 /* Getting local data (which doesn't exist), buffer size is ignored */
5586 dwDataSizeGet = 0;
5587 strcpy(lpDataGet, lpDataFake);
5588 hr = IDirectPlayX_GetPlayerData( pDP, dpid, lpDataGet, &dwDataSizeGet,
5589 DPGET_LOCAL );
5590 checkHR( DP_OK, hr );
5591 check( 0, dwDataSizeGet ); /* Sets size to 0 */
5592 checkStr( lpDataFake, lpDataGet );
5593
5594 dwDataSizeGet = dwDataSizeFake;
5595 strcpy(lpDataGet, lpDataFake);
5596 hr = IDirectPlayX_GetPlayerData( pDP, dpid, NULL, &dwDataSizeGet,
5597 DPGET_LOCAL );
5598 checkHR( DP_OK, hr );
5599 check( 0, dwDataSizeGet ); /* Sets size to 0 */
5600 checkStr( lpDataFake, lpDataGet );
5601
5602
5603 /*
5604 * Local data
5605 */
5606
5607
5608 /* Invalid flags */
5609 hr = IDirectPlayX_SetPlayerData( pDP, dpid, (LPVOID) lpDataLocal,
5610 dwDataSizeLocal,
5613
5614 /* Correct parameters */
5615 hr = IDirectPlayX_SetPlayerData( pDP, dpid, (LPVOID) lpDataLocal,
5616 dwDataSizeLocal, DPSET_LOCAL );
5617 checkHR( DP_OK, hr );
5618
5619 /* Flag tests (again) */
5620 dwDataSizeGet = dwDataSizeFake;
5621 strcpy(lpDataGet, lpDataFake);
5622 hr = IDirectPlayX_GetPlayerData( pDP, dpid, lpDataGet, &dwDataSizeGet, 0 );
5623 checkHR( DP_OK, hr );
5624 check( dwDataSize, dwDataSizeGet ); /* Remote: works as expected */
5625 checkStr( lpData, lpDataGet );
5626
5627 dwDataSizeGet = dwDataSizeFake;
5628 strcpy(lpDataGet, lpDataFake);
5629 hr = IDirectPlayX_GetPlayerData( pDP, dpid, lpDataGet, &dwDataSizeGet,
5630 DPGET_REMOTE );
5631 checkHR( DP_OK, hr );
5632 check( dwDataSize, dwDataSizeGet ); /* Like in previous test */
5633 checkStr( lpData, lpDataGet );
5634
5635 dwDataSizeGet = dwDataSizeFake;
5636 strcpy(lpDataGet, lpDataFake);
5637 hr = IDirectPlayX_GetPlayerData( pDP, dpid, lpDataGet, &dwDataSizeGet,
5638 DPGET_LOCAL );
5639 checkHR( DP_OK, hr );
5640 check( dwDataSizeLocal, dwDataSizeGet ); /* Local: works as expected */
5641 checkStr( lpDataLocal, lpDataGet );
5642
5643 dwDataSizeGet = dwDataSizeFake;
5644 strcpy(lpDataGet, lpDataFake);
5645 hr = IDirectPlayX_GetPlayerData( pDP, dpid, lpDataGet, &dwDataSizeGet,
5647 checkHR( DP_OK, hr );
5648 check( dwDataSizeLocal, dwDataSizeGet ); /* Like in previous test */
5649 checkStr( lpDataLocal, lpDataGet );
5650
5651 /* Small buffer works as expected again */
5652 dwDataSizeGet = 0;
5653 strcpy(lpDataGet, lpDataFake);
5654 hr = IDirectPlayX_GetPlayerData( pDP, dpid, lpDataGet, &dwDataSizeGet,
5655 DPGET_LOCAL );
5657 check( dwDataSizeLocal, dwDataSizeGet );
5658 checkStr( lpDataFake, lpDataGet );
5659
5660 dwDataSizeGet = dwDataSizeFake;
5661 strcpy(lpDataGet, lpDataFake);
5662 hr = IDirectPlayX_GetPlayerData( pDP, dpid, NULL,
5663 &dwDataSizeGet, DPGET_LOCAL );
5665 check( dwDataSizeLocal, dwDataSizeGet );
5666 checkStr( lpDataFake, lpDataGet );
5667
5668
5669 /*
5670 * Changing remote data
5671 */
5672
5673
5674 /* Remote data := local data */
5675 hr = IDirectPlayX_SetPlayerData( pDP, dpid, (LPVOID) lpDataLocal,
5676 dwDataSizeLocal,
5678 checkHR( DP_OK, hr );
5679 hr = IDirectPlayX_SetPlayerData( pDP, dpid, (LPVOID) lpDataLocal,
5680 dwDataSizeLocal, 0 );
5681 checkHR( DP_OK, hr );
5682
5683 dwDataSizeGet = dwDataSizeFake;
5684 strcpy(lpDataGet, lpDataFake);
5685 hr = IDirectPlayX_GetPlayerData( pDP, dpid, lpDataGet, &dwDataSizeGet, 0 );
5686 checkHR( DP_OK, hr );
5687 check( dwDataSizeLocal, dwDataSizeGet );
5688 checkStr( lpDataLocal, lpDataGet );
5689
5690 /* Remote data := fake data */
5691 hr = IDirectPlayX_SetPlayerData( pDP, dpid, (LPVOID) lpDataFake,
5692 dwDataSizeFake, DPSET_REMOTE );
5693 checkHR( DP_OK, hr );
5694
5695 dwDataSizeGet = dwDataSizeFake + 1;
5696 strcpy(lpDataGet, lpData);
5697 hr = IDirectPlayX_GetPlayerData( pDP, dpid, lpDataGet, &dwDataSizeGet, 0 );
5698 checkHR( DP_OK, hr );
5699 check( dwDataSizeFake, dwDataSizeGet );
5700 checkStr( lpDataFake, lpDataGet );
5701
5702
5703 free( lpDataGet );
5704 IDirectPlayX_Release( pDP );
5705}
#define IDirectPlayX_SetPlayerData(p, a, b, c, d)
Definition: dplay.h:894

Referenced by START_TEST().

◆ test_PlayerName()

static void test_PlayerName ( void  )
static

Definition at line 5710 of file dplayx.c.

5711{
5712
5713 IDirectPlay4 *pDP[2];
5714 DPSESSIONDESC2 dpsd;
5715 DPID dpid[2];
5716 HRESULT hr;
5717 UINT i;
5718
5719 DPNAME playerName;
5720 DWORD dwDataSize = 1024;
5721 LPVOID lpData = calloc( 1, dwDataSize );
5722 CallbackData callbackData;
5723
5724
5725 for (i=0; i<2; i++)
5726 {
5727 hr= CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
5728 &IID_IDirectPlay4A, (LPVOID*) &pDP[i] );
5729 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
5730 if (FAILED(hr)) return;
5731 }
5732 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
5733 ZeroMemory( &playerName, sizeof(DPNAME) );
5734
5735
5736 /* Service provider not initialized */
5737 hr = IDirectPlayX_SetPlayerName( pDP[0], 0, &playerName, 0 );
5739
5740 dwDataSize = 1024;
5741 hr = IDirectPlayX_GetPlayerName( pDP[0], 0, lpData, &dwDataSize );
5743 check( 1024, dwDataSize );
5744
5745
5746 init_TCPIP_provider( pDP[0], "127.0.0.1", 0 );
5747 init_TCPIP_provider( pDP[1], "127.0.0.1", 0 );
5748
5749
5750 /* Session not initialized */
5751 hr = IDirectPlayX_SetPlayerName( pDP[0], 0, &playerName, 0 );
5753
5754 if ( hr == DPERR_UNINITIALIZED )
5755 {
5756 todo_wine win_skip( "Get/SetPlayerName not implemented\n" );
5757 return;
5758 }
5759
5760 dwDataSize = 1024;
5761 hr = IDirectPlayX_GetPlayerName( pDP[0], 0, lpData, &dwDataSize );
5763 check( 1024, dwDataSize );
5764
5765
5766 dpsd.dwSize = sizeof(DPSESSIONDESC2);
5767 dpsd.guidApplication = appGuid;
5768 dpsd.dwMaxPlayers = 10;
5769 IDirectPlayX_Open( pDP[0], &dpsd, DPOPEN_CREATE );
5771 pDP[1], 0 );
5772
5773 IDirectPlayX_CreatePlayer( pDP[0], &dpid[0], NULL, NULL, NULL, 0, 0 );
5774 IDirectPlayX_CreatePlayer( pDP[1], &dpid[1], NULL, NULL, NULL, 0, 0 );
5775
5776
5777 /* Name not initialized */
5778 playerName.dwSize = -1;
5779 hr = IDirectPlayX_SetPlayerName( pDP[0], dpid[0], &playerName, 0 );
5780 checkHR( DP_OK, hr );
5781
5782 dwDataSize = 1024;
5783 hr = IDirectPlayX_GetPlayerName( pDP[0], 0, lpData, &dwDataSize );
5785 check( 1024, dwDataSize );
5786
5787
5788 playerName.dwSize = sizeof(DPNAME);
5789 playerName.lpszShortNameA = (LPSTR) "player_name";
5790 playerName.lpszLongNameA = (LPSTR) "player_long_name";
5791
5792
5793 /* Invalid parameters */
5794 hr = IDirectPlayX_SetPlayerName( pDP[0], -1, &playerName, 0 );
5796 hr = IDirectPlayX_SetPlayerName( pDP[0], 0, &playerName, 0 );
5798 hr = IDirectPlayX_SetPlayerName( pDP[0], dpid[0], &playerName, -1 );
5800
5801 dwDataSize = 1024;
5802 hr = IDirectPlayX_GetPlayerName( pDP[0], 0, lpData, &dwDataSize );
5804 check( 1024, dwDataSize );
5805
5806if(0)
5807{
5808 /* Crashes under Win7 */
5809 dwDataSize = -1;
5810 hr = IDirectPlayX_GetPlayerName( pDP[0], dpid[0], lpData, &dwDataSize );
5812 check( -1, dwDataSize );
5813}
5814
5815 hr = IDirectPlayX_GetPlayerName( pDP[0], dpid[0], lpData, NULL );
5817
5818 /* Trying to modify remote player */
5819 hr = IDirectPlayX_SetPlayerName( pDP[0], dpid[1], &playerName, 0 );
5821
5822
5823 /* Regular operation */
5824 hr = IDirectPlayX_SetPlayerName( pDP[0], dpid[0], &playerName, 0 );
5825 checkHR( DP_OK, hr );
5826 dwDataSize = 1024;
5827 hr = IDirectPlayX_GetPlayerName( pDP[0], dpid[0], lpData, &dwDataSize );
5828 checkHR( DP_OK, hr );
5829 check( 45, dwDataSize );
5830 checkStr( playerName.lpszShortNameA, ((LPDPNAME)lpData)->lpszShortNameA );
5831 checkStr( playerName.lpszLongNameA, ((LPDPNAME)lpData)->lpszLongNameA );
5832 check( 0, ((LPDPNAME)lpData)->dwFlags );
5833
5834 hr = IDirectPlayX_SetPlayerName( pDP[0], dpid[0], NULL, 0 );
5835 checkHR( DP_OK, hr );
5836 dwDataSize = 1024;
5837 hr = IDirectPlayX_GetPlayerName( pDP[0], dpid[0], lpData, &dwDataSize );
5838 checkHR( DP_OK, hr );
5839 check( 16, dwDataSize );
5840 checkLP( NULL, ((LPDPNAME)lpData)->lpszShortNameA );
5841 checkLP( NULL, ((LPDPNAME)lpData)->lpszLongNameA );
5842 check( 0, ((LPDPNAME)lpData)->dwFlags );
5843
5844
5845 /* Small buffer in get operation */
5846 dwDataSize = 1024;
5847 hr = IDirectPlayX_GetPlayerName( pDP[0], dpid[0], NULL, &dwDataSize );
5849 check( 16, dwDataSize );
5850
5851 dwDataSize = 0;
5852 hr = IDirectPlayX_GetPlayerName( pDP[0], dpid[0], lpData, &dwDataSize );
5854 check( 16, dwDataSize );
5855
5856 hr = IDirectPlayX_GetPlayerName( pDP[0], dpid[0], lpData, &dwDataSize );
5857 checkHR( DP_OK, hr );
5858 check( 16, dwDataSize );
5859 checkLP( NULL, ((LPDPNAME)lpData)->lpszShortNameA );
5860 checkLP( NULL, ((LPDPNAME)lpData)->lpszLongNameA );
5861 check( 0, ((LPDPNAME)lpData)->dwFlags );
5862
5863
5864 /* Flags */
5865 hr = IDirectPlayX_SetPlayerName( pDP[0], dpid[0], &playerName,
5867 checkHR( DP_OK, hr );
5868 dwDataSize = 1024;
5869 hr = IDirectPlayX_GetPlayerName( pDP[0], dpid[0], lpData, &dwDataSize );
5870 checkHR( DP_OK, hr );
5871 check( 45, dwDataSize );
5872 checkStr( playerName.lpszShortNameA, ((LPDPNAME)lpData)->lpszShortNameA );
5873 checkStr( playerName.lpszLongNameA, ((LPDPNAME)lpData)->lpszLongNameA );
5874 check( 0, ((LPDPNAME)lpData)->dwFlags );
5875
5876 /* - Local (no propagation) */
5877 playerName.lpszShortNameA = (LPSTR) "no_propagation";
5878 hr = IDirectPlayX_SetPlayerName( pDP[0], dpid[0], &playerName,
5879 DPSET_LOCAL );
5880 checkHR( DP_OK, hr );
5881
5882 dwDataSize = 1024;
5883 hr = IDirectPlayX_GetPlayerName( pDP[0], dpid[0],
5884 lpData, &dwDataSize ); /* Local fetch */
5885 checkHR( DP_OK, hr );
5886 check( 48, dwDataSize );
5887 checkStr( "no_propagation", ((LPDPNAME)lpData)->lpszShortNameA );
5888
5889 dwDataSize = 1024;
5890 hr = IDirectPlayX_GetPlayerName( pDP[1], dpid[0],
5891 lpData, &dwDataSize ); /* Remote fetch */
5892 checkHR( DP_OK, hr );
5893 check( 45, dwDataSize );
5894 checkStr( "player_name", ((LPDPNAME)lpData)->lpszShortNameA );
5895
5896 /* -- 2 */
5897
5898 playerName.lpszShortNameA = (LPSTR) "no_propagation_2";
5899 hr = IDirectPlayX_SetPlayerName( pDP[0], dpid[0], &playerName,
5901 checkHR( DP_OK, hr );
5902
5903 dwDataSize = 1024;
5904 hr = IDirectPlayX_GetPlayerName( pDP[0], dpid[0],
5905 lpData, &dwDataSize ); /* Local fetch */
5906 checkHR( DP_OK, hr );
5907 check( 50, dwDataSize );
5908 checkStr( "no_propagation_2", ((LPDPNAME)lpData)->lpszShortNameA );
5909
5910 dwDataSize = 1024;
5911 hr = IDirectPlayX_GetPlayerName( pDP[1], dpid[0],
5912 lpData, &dwDataSize ); /* Remote fetch */
5913 checkHR( DP_OK, hr );
5914 check( 45, dwDataSize );
5915 checkStr( "player_name", ((LPDPNAME)lpData)->lpszShortNameA );
5916
5917 /* - Remote (propagation, default) */
5918 playerName.lpszShortNameA = (LPSTR) "propagation";
5919 hr = IDirectPlayX_SetPlayerName( pDP[0], dpid[0], &playerName,
5920 DPSET_REMOTE );
5921 checkHR( DP_OK, hr );
5922
5923 dwDataSize = 1024;
5924 hr = IDirectPlayX_GetPlayerName( pDP[1], dpid[0],
5925 lpData, &dwDataSize ); /* Remote fetch */
5926 checkHR( DP_OK, hr );
5927 check( 45, dwDataSize );
5928 checkStr( "propagation", ((LPDPNAME)lpData)->lpszShortNameA );
5929
5930 /* -- 2 */
5931 playerName.lpszShortNameA = (LPSTR) "propagation_2";
5932 hr = IDirectPlayX_SetPlayerName( pDP[0], dpid[0], &playerName,
5933 0 );
5934 checkHR( DP_OK, hr );
5935
5936 dwDataSize = 1024;
5937 hr = IDirectPlayX_GetPlayerName( pDP[1], dpid[0],
5938 lpData, &dwDataSize ); /* Remote fetch */
5939 checkHR( DP_OK, hr );
5940 check( 47, dwDataSize );
5941 checkStr( "propagation_2", ((LPDPNAME)lpData)->lpszShortNameA );
5942
5943
5944 /* Checking system messages */
5945 check_messages( pDP[0], dpid, 2, &callbackData );
5946 checkStr( "S0,S0,S0,S0,S0,S0,S0,", callbackData.szTrace1 );
5947 checkStr( "48,28,57,28,57,57,59,", callbackData.szTrace2 );
5948 check_messages( pDP[1], dpid, 2, &callbackData );
5949 checkStr( "S1,S1,S1,S1,S1,S1,", callbackData.szTrace1 );
5950 checkStr( "28,57,28,57,57,59,", callbackData.szTrace2 );
5951
5952
5953 free( lpData );
5954 IDirectPlayX_Release( pDP[0] );
5955 IDirectPlayX_Release( pDP[1] );
5956
5957}
#define IDirectPlayX_SetPlayerName(p, a, b, c)
Definition: dplay.h:895
LPSTR lpszLongNameA
Definition: dplay.h:200

Referenced by START_TEST().

◆ test_Receive()

static void test_Receive ( void  )
static

Definition at line 8580 of file dplayx.c.

8581{
8582 DPSESSIONDESC2 appGuidDpsd =
8583 {
8584 .dwSize = sizeof( DPSESSIONDESC2 ),
8585 .guidApplication = appGuid,
8586 .guidInstance = appGuid,
8587 };
8588 DPSESSIONDESC2 serverDpsd =
8589 {
8590 .dwSize = sizeof( DPSESSIONDESC2 ),
8591 .guidApplication = appGuid,
8592 .guidInstance = appGuid,
8593 .lpszSessionName = (WCHAR *) L"normal",
8594 .dwReserved1 = 0xaabbccdd,
8595 };
8596 BYTE data0[] = { 1, 2, 3, 4, 5, 6, 7, 8, };
8597 BYTE data1[] = { 4, 3, 2, 1, };
8598 unsigned short udpPort;
8599 BYTE msgData[ 256 ];
8600 DWORD msgDataSize;
8601 DPID fromId, toId;
8602 DWORD waitResult;
8603 IDirectPlay4 *dp;
8604 SOCKET sendSock;
8605 SOCKET recvSock;
8606 SOCKET udpSock;
8607 HANDLE event0;
8608 HANDLE event1;
8609 HRESULT hr;
8610
8611 event0 = CreateEventA( NULL, FALSE, FALSE, NULL );
8612 event1 = CreateEventA( NULL, FALSE, FALSE, NULL );
8613
8614 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay4A, (void **) &dp );
8615 ok( hr == DP_OK, "got hr %#lx.\n", hr );
8616
8617 msgDataSize = sizeof( msgData );
8618 hr = IDirectPlayX_Receive( dp, &fromId, &toId, 0, msgData, &msgDataSize );
8619 ok( hr == DPERR_UNINITIALIZED, "got hr %#lx.\n", hr );
8620
8621 init_TCPIP_provider( dp, "127.0.0.1", 0 );
8622
8623 msgDataSize = sizeof( msgData );
8624 hr = IDirectPlayX_Receive( dp, &fromId, &toId, 0, msgData, &msgDataSize );
8625 ok( hr == DPERR_NOMESSAGES, "got hr %#lx.\n", hr );
8626
8627 joinSession( dp, &appGuidDpsd, &serverDpsd, &sendSock, &recvSock, &udpPort );
8628
8629 createPlayer( dp, 0x07734, event0, NULL, 0, 0, sendSock, recvSock );
8630 createPlayer( dp, 0x14, event1, NULL, 0, 0, sendSock, recvSock );
8631
8632 waitResult = WaitForSingleObject( event0, 2000 );
8633 ok( waitResult == WAIT_OBJECT_0, "message wait returned %lu\n", waitResult );
8634
8636
8637 sendGuaranteedGameMessage( sendSock, 2349, 0x1337, 0x07734, data0, sizeof( data0 ) );
8638 sendGuaranteedGameMessage( sendSock, 2349, 0x1337, 0x14, data1, sizeof( data1 ) );
8639
8640 waitResult = WaitForSingleObject( event0, 2000 );
8641 ok( waitResult == WAIT_OBJECT_0, "message wait returned %lu\n", waitResult );
8642 waitResult = WaitForSingleObject( event1, 2000 );
8643 ok( waitResult == WAIT_OBJECT_0, "message wait returned %lu\n", waitResult );
8644
8645 fromId = 0xdeadbeef;
8646 toId = 0xdeadbeef;
8647 msgDataSize = sizeof( data0 ) - 1;
8648 hr = IDirectPlayX_Receive( dp, &fromId, &toId, DPRECEIVE_ALL | DPRECEIVE_PEEK, msgData, &msgDataSize );
8649 ok( hr == DPERR_BUFFERTOOSMALL, "got hr %#lx.\n", hr );
8650 ok( fromId == 0xdeadbeef, "got source id %#lx.\n", fromId );
8651 ok( toId == 0xdeadbeef, "got destination id %#lx.\n", toId );
8652 ok( msgDataSize == sizeof( data0 ), "got message size %lu.\n", msgDataSize );
8653
8654 fromId = 0xdeadbeef;
8655 toId = 0xdeadbeef;
8656 msgDataSize = sizeof( msgData );
8657 hr = IDirectPlayX_Receive( dp, &fromId, &toId, 0, NULL, &msgDataSize );
8658 ok( hr == DPERR_BUFFERTOOSMALL, "got hr %#lx.\n", hr );
8659 ok( fromId == 0xdeadbeef, "got source id %#lx.\n", fromId );
8660 ok( toId == 0xdeadbeef, "got destination id %#lx.\n", toId );
8661 ok( msgDataSize == sizeof( data0 ), "got message size %lu.\n", msgDataSize );
8662
8663 fromId = 0xdeadbeef;
8664 toId = 0xdeadbeef;
8665 memset( msgData, 0xcc, sizeof( msgData ) );
8666 msgDataSize = sizeof( msgData );
8667 hr = IDirectPlayX_Receive( dp, &fromId, &toId, DPRECEIVE_ALL | DPRECEIVE_PEEK, msgData, &msgDataSize );
8668 ok( hr == DP_OK, "got hr %#lx.\n", hr );
8669 ok( fromId == 0x1337, "got source id %#lx.\n", fromId );
8670 ok( toId == 0x07734, "got destination id %#lx.\n", toId );
8671 ok( !memcmp( msgData, data0, sizeof( data0 ) ), "message data didn't match.\n" );
8672 ok( msgDataSize == sizeof( data0 ), "got message size %lu.\n", msgDataSize );
8673
8674 fromId = 0xdeadbeef;
8675 toId = 0xdeadbeef;
8676 memset( msgData, 0xcc, sizeof( msgData ) );
8677 msgDataSize = sizeof( msgData );
8678 hr = IDirectPlayX_Receive( dp, &fromId, &toId, DPRECEIVE_PEEK, msgData, &msgDataSize );
8679 ok( hr == DP_OK, "got hr %#lx.\n", hr );
8680 ok( fromId == 0x1337, "got source id %#lx.\n", fromId );
8681 ok( toId == 0x07734, "got destination id %#lx.\n", toId );
8682 ok( !memcmp( msgData, data0, sizeof( data0 ) ), "message data didn't match.\n" );
8683 ok( msgDataSize == sizeof( data0 ), "got message size %lu.\n", msgDataSize );
8684
8685 fromId = 0xdeadbeef;
8686 toId = 0xdeadbeef;
8687 memset( msgData, 0xcc, sizeof( msgData ) );
8688 msgDataSize = sizeof( msgData );
8689 hr = IDirectPlayX_Receive( dp, &fromId, &toId, 0, msgData, &msgDataSize );
8690 ok( hr == DP_OK, "got hr %#lx.\n", hr );
8691 ok( fromId == 0x1337, "got source id %#lx.\n", fromId );
8692 ok( toId == 0x07734, "got destination id %#lx.\n", toId );
8693 ok( !memcmp( msgData, data0, sizeof( data0 ) ), "message data didn't match.\n" );
8694 ok( msgDataSize == sizeof( data0 ), "got message size %lu.\n", msgDataSize );
8695
8696 fromId = 0xdeadbeef;
8697 toId = 0xdeadbeef;
8698 memset( msgData, 0xcc, sizeof( msgData ) );
8699 msgDataSize = sizeof( msgData );
8700 hr = IDirectPlayX_Receive( dp, &fromId, &toId, 0, msgData, &msgDataSize );
8701 ok( hr == DP_OK, "got hr %#lx.\n", hr );
8702 ok( fromId == 0x1337, "got source id %#lx.\n", fromId );
8703 ok( toId == 0x14, "got destination id %#lx.\n", toId );
8704 ok( !memcmp( msgData, data1, sizeof( data1 ) ), "message data didn't match.\n" );
8705 ok( msgDataSize == sizeof( data1 ), "got message size %lu.\n", msgDataSize );
8706
8707 msgDataSize = sizeof( msgData );
8708 hr = IDirectPlayX_Receive( dp, &fromId, &toId, 0, msgData, &msgDataSize );
8709 ok( hr == DPERR_NOMESSAGES, "got hr %#lx.\n", hr );
8710
8711 sendGuaranteedGameMessage( sendSock, 2349, 0x1337, 0x07734, data0, sizeof( data0 ) );
8712
8713 waitResult = WaitForSingleObject( event0, 2000 );
8714 ok( waitResult == WAIT_OBJECT_0, "message wait returned %lu\n", waitResult );
8715
8716 fromId = 0x14;
8717 toId = 0xdeadbeef;
8718 msgDataSize = sizeof( msgData );
8719 hr = IDirectPlayX_Receive( dp, &fromId, &toId, DPRECEIVE_FROMPLAYER, msgData, &msgDataSize );
8720 ok( hr == DPERR_NOMESSAGES, "got hr %#lx.\n", hr );
8721
8722 fromId = 0x1337;
8723 toId = 0xdeadbeef;
8724 memset( msgData, 0xcc, sizeof( msgData ) );
8725 msgDataSize = sizeof( msgData );
8726 hr = IDirectPlayX_Receive( dp, &fromId, &toId, DPRECEIVE_FROMPLAYER, msgData, &msgDataSize );
8727 ok( hr == DP_OK, "got hr %#lx.\n", hr );
8728 ok( fromId == 0x1337, "got source id %#lx.\n", fromId );
8729 ok( toId == 0x07734, "got destination id %#lx.\n", toId );
8730 ok( !memcmp( msgData, data0, sizeof( data0 ) ), "message data didn't match.\n" );
8731 ok( msgDataSize == sizeof( data0 ), "got message size %lu.\n", msgDataSize );
8732
8733 fromId = 0x1337;
8734 toId = 0xdeadbeef;
8735 msgDataSize = sizeof( msgData );
8736 hr = IDirectPlayX_Receive( dp, &fromId, &toId, DPRECEIVE_FROMPLAYER, msgData, &msgDataSize );
8737 ok( hr == DPERR_NOMESSAGES, "got hr %#lx.\n", hr );
8738
8739 sendGuaranteedGameMessage( sendSock, 2349, 0x1337, DPID_ALLPLAYERS, data0, sizeof( data0 ) );
8740
8741 waitResult = WaitForSingleObject( event0, 2000 );
8742 ok( waitResult == WAIT_OBJECT_0, "message wait returned %lu\n", waitResult );
8743 waitResult = WaitForSingleObject( event1, 2000 );
8744 ok( waitResult == WAIT_OBJECT_0, "message wait returned %lu\n", waitResult );
8745
8746 fromId = 0xdeadbeef;
8747 toId = 0x07734;
8748 memset( msgData, 0xcc, sizeof( msgData ) );
8749 msgDataSize = sizeof( msgData );
8750 hr = IDirectPlayX_Receive( dp, &fromId, &toId, DPRECEIVE_TOPLAYER, msgData, &msgDataSize );
8751 ok( hr == DP_OK, "got hr %#lx.\n", hr );
8752 ok( fromId == 0x1337, "got source id %#lx.\n", fromId );
8753 ok( toId == 0x07734, "got destination id %#lx.\n", toId );
8754 ok( !memcmp( msgData, data0, sizeof( data0 ) ), "message data didn't match.\n" );
8755 ok( msgDataSize == sizeof( data0 ), "got message size %lu.\n", msgDataSize );
8756
8757 toId = 0x07734;
8758 msgDataSize = sizeof( msgData );
8759 hr = IDirectPlayX_Receive( dp, &fromId, &toId, DPRECEIVE_TOPLAYER, msgData, &msgDataSize );
8760 ok( hr == DPERR_NOMESSAGES, "got hr %#lx.\n", hr );
8761
8762 fromId = 0xdeadbeef;
8763 toId = 0x14;
8764 memset( msgData, 0xcc, sizeof( msgData ) );
8765 msgDataSize = sizeof( msgData );
8766 hr = IDirectPlayX_Receive( dp, &fromId, &toId, DPRECEIVE_TOPLAYER, msgData, &msgDataSize );
8767 ok( hr == DP_OK, "got hr %#lx.\n", hr );
8768 ok( fromId == 0x1337, "got source id %#lx.\n", fromId );
8769 ok( toId == 0x14, "got destination id %#lx.\n", toId );
8770 ok( !memcmp( msgData, data0, sizeof( data0 ) ), "message data didn't match.\n" );
8771 ok( msgDataSize == sizeof( data0 ), "got message size %lu.\n", msgDataSize );
8772
8773 toId = 0x14;
8774 msgDataSize = sizeof( msgData );
8775 hr = IDirectPlayX_Receive( dp, &fromId, &toId, DPRECEIVE_TOPLAYER, msgData, &msgDataSize );
8776 ok( hr == DPERR_NOMESSAGES, "got hr %#lx.\n", hr );
8777
8778 udpSock = connectUdp( udpPort );
8779
8780 sendGameMessage( udpSock, 0x1337, 0x07734, data0, sizeof( data0 ) );
8781
8782 waitResult = WaitForSingleObject( event0, 2000 );
8783 ok( waitResult == WAIT_OBJECT_0, "message wait returned %lu\n", waitResult );
8784
8785 fromId = 0xdeadbeef;
8786 toId = 0xdeadbeef;
8787 memset( msgData, 0xcc, sizeof( msgData ) );
8788 msgDataSize = sizeof( msgData );
8789 hr = IDirectPlayX_Receive( dp, &fromId, &toId, 0, msgData, &msgDataSize );
8790 ok( hr == DP_OK, "got hr %#lx.\n", hr );
8791 ok( fromId == 0x1337, "got source id %#lx.\n", fromId );
8792 ok( toId == 0x07734, "got destination id %#lx.\n", toId );
8793 ok( !memcmp( msgData, data0, sizeof( data0 ) ), "message data didn't match.\n" );
8794 ok( msgDataSize == sizeof( data0 ), "got message size %lu.\n", msgDataSize );
8795
8796 msgDataSize = sizeof( msgData );
8797 hr = IDirectPlayX_Receive( dp, &fromId, &toId, 0, msgData, &msgDataSize );
8798 ok( hr == DPERR_NOMESSAGES, "got hr %#lx.\n", hr );
8799
8800 closesocket( udpSock );
8801 closesocket( recvSock );
8802 closesocket( sendSock );
8803
8805
8806 CloseHandle( event1 );
8807 CloseHandle( event0 );
8808}
#define sendGameMessage(sock, fromId, toId, data, dataSize)
Definition: dplayx.c:2117
Definition: tftpd.h:126

Referenced by START_TEST().

◆ test_remote_data_replication()

static void test_remote_data_replication ( void  )
static

Definition at line 10049 of file dplayx.c.

10050{
10051
10052 IDirectPlay4 *pDP[2];
10053 DPSESSIONDESC2 dpsd;
10054 DPID dpid[2], idFrom, idTo;
10055 CallbackData callbackData;
10056 HRESULT hr;
10057 UINT i, j;
10058 DWORD dwFlags, dwDataSize = 1024;
10059 DWORD dwCount;
10060
10061 LPDPMSG_SETPLAYERORGROUPDATA lpData = calloc( 1, dwDataSize );
10062
10063 LPCSTR lpDataLocal[] = { "local_0", "local_1" };
10064 LPCSTR lpDataRemote[] = { "remote_0", "remote_1" };
10065 LPCSTR lpDataFake = "ugly_fake_data";
10066 LPSTR lpDataGet = calloc( 1, 32 );
10067 DWORD dwDataSizeLocal = strlen(lpDataLocal[0])+1,
10068 dwDataSizeRemote = strlen(lpDataRemote[0])+1,
10069 dwDataSizeFake = strlen(lpDataFake)+1,
10070 dwDataSizeGet;
10071
10072
10073 for (i=0; i<2; i++)
10074 {
10075 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
10076 &IID_IDirectPlay4A, (LPVOID*) &pDP[i] );
10077 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
10078 if (FAILED(hr)) return;
10079 init_TCPIP_provider( pDP[i], "127.0.0.1", 0 );
10080 }
10081 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
10082 dpsd.dwSize = sizeof(DPSESSIONDESC2);
10083 dpsd.guidApplication = appGuid;
10084
10085 /* Host */
10086 hr = IDirectPlayX_Open( pDP[0], &dpsd, DPOPEN_CREATE );
10088
10089 if ( hr == DPERR_UNINITIALIZED )
10090 {
10091 todo_wine win_skip( "dplay not implemented enough for this test yet\n" );
10092 return;
10093 }
10094
10095 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid[0],
10096 NULL, NULL, NULL, 0, 0 );
10097 checkHR( DP_OK, hr );
10098
10099 /* Peer */
10101 pDP[1], 0 );
10102 checkHR( DP_OK, hr );
10103
10104 hr = IDirectPlayX_CreatePlayer( pDP[1], &dpid[1],
10105 NULL, NULL, NULL, 0, 0 );
10106 checkHR( DP_OK, hr );
10107
10108 /* Check players */
10109 for (i=0; i<2; i++)
10110 {
10111 /* Local (0,0) (1,1) */
10112 IDirectPlayX_GetPlayerFlags( pDP[i], dpid[i], &dwFlags );
10114 /* Remote (0,1) (1,0) */
10115 IDirectPlayX_GetPlayerFlags( pDP[i], dpid[!i], &dwFlags );
10117 }
10118
10119 /* Set data for a local player */
10120 for (i=0; i<2; i++)
10121 {
10122 hr = IDirectPlayX_SetPlayerData( pDP[i], dpid[i],
10123 (LPVOID) lpDataLocal[i],
10124 dwDataSizeLocal,
10125 DPSET_LOCAL );
10126 checkHR( DP_OK, hr );
10127 hr = IDirectPlayX_SetPlayerData( pDP[i], dpid[i],
10128 (LPVOID) lpDataRemote[i],
10129 dwDataSizeRemote,
10130 DPSET_REMOTE );
10131 checkHR( DP_OK, hr );
10132 }
10133
10134 /* Retrieve data locally (0->0, 1->1) */
10135 for (i=0; i<2; i++)
10136 {
10137 dwDataSizeGet = dwDataSizeFake;
10138 strcpy( lpDataGet, lpDataFake );
10139 hr = IDirectPlayX_GetPlayerData( pDP[i], dpid[i],
10140 lpDataGet, &dwDataSizeGet,
10141 DPGET_LOCAL );
10142 checkHR( DP_OK, hr );
10143 check( dwDataSizeLocal, dwDataSizeGet );
10144 checkStr( lpDataLocal[i], lpDataGet );
10145
10146 dwDataSizeGet = dwDataSizeFake;
10147 strcpy( lpDataGet, lpDataFake );
10148 hr = IDirectPlayX_GetPlayerData( pDP[i], dpid[i],
10149 lpDataGet, &dwDataSizeGet,
10150 DPGET_REMOTE );
10151 checkHR( DP_OK, hr );
10152 check( dwDataSizeRemote, dwDataSizeGet );
10153 checkStr( lpDataRemote[i], lpDataGet );
10154 }
10155
10156
10157 /* Set data for a remote player */
10158 /* This should fail with DPERR_ACCESSDENIED,
10159 but for some reason it doesn't */
10160 for (i=0; i<2; i++)
10161 {
10162 IDirectPlayX_SetPlayerData( pDP[i], dpid[!i],
10163 (LPVOID) lpDataLocal[!i],
10164 dwDataSizeLocal,
10165 DPSET_LOCAL );
10166 checkHR( DP_OK, hr );
10167 IDirectPlayX_SetPlayerData( pDP[i], dpid[!i],
10168 (LPVOID) lpDataRemote[!i],
10169 dwDataSizeRemote,
10170 DPSET_REMOTE );
10171 checkHR( DP_OK, hr );
10172 }
10173
10174 /* Retrieve crossed data (0->1, 1->0) */
10175 for (i=0; i<2; i++)
10176 {
10177 dwDataSizeGet = dwDataSizeFake;
10178 strcpy( lpDataGet, lpDataFake );
10179 hr = IDirectPlayX_GetPlayerData( pDP[i], dpid[!i],
10180 lpDataGet, &dwDataSizeGet,
10181 DPGET_LOCAL );
10182 checkHR( DP_OK, hr );
10183 check( dwDataSizeLocal, dwDataSizeGet );
10184 checkStr( lpDataLocal[!i], lpDataGet );
10185
10186 dwDataSizeGet = dwDataSizeFake;
10187 strcpy( lpDataGet, lpDataFake );
10188 hr = IDirectPlayX_GetPlayerData( pDP[i], dpid[!i],
10189 lpDataGet, &dwDataSizeGet,
10190 DPGET_REMOTE );
10191 checkHR( DP_OK, hr );
10192 check( dwDataSizeRemote, dwDataSizeGet );
10193 checkStr( lpDataRemote[!i], lpDataGet );
10194 }
10195
10196
10197 /* Purge "new player" messages from queue */
10198 hr = IDirectPlayX_Receive( pDP[0], &idFrom, &idTo, 0, lpData, &dwDataSize );
10199 checkHR( DP_OK, hr );
10201
10202 /* Check number of messages in queue */
10203 for (i=0; i<2; i++)
10204 {
10205 IDirectPlayX_GetMessageCount( pDP[i], dpid[i], &dwCount );
10206 check( 2, dwCount );
10207 IDirectPlayX_GetMessageCount( pDP[i], dpid[!i], &dwCount );
10208 check( 0, dwCount );
10209 }
10210
10211 /* Checking system messages */
10212 for (i=0; i<2; i++)
10213 {
10214 for (j=0; j<2; j++)
10215 {
10216 hr = IDirectPlayX_Receive( pDP[i], &idFrom, &idTo, 0, lpData,
10217 &dwDataSize );
10218 checkHR( DP_OK, hr );
10219 check( 29, dwDataSize );
10220 check( DPID_SYSMSG, idFrom );
10221 check( dpid[i], idTo );
10223 dpMsgType2str );
10225 check( dpid[j], lpData->dpId );
10226 checkStr( lpDataRemote[j], (LPSTR) lpData->lpData );
10227 check( dwDataSizeRemote, lpData->dwDataSize );
10228 dwDataSize = 1024;
10229 }
10230 hr = IDirectPlayX_Receive( pDP[i], &idFrom, &idTo, 0,
10231 lpData, &dwDataSize );
10233 }
10234
10235
10236 /* Changing remote data */
10237 hr = IDirectPlayX_SetPlayerData( pDP[0], dpid[0],
10238 (LPVOID) lpDataRemote[0], dwDataSizeRemote,
10239 DPSET_REMOTE );
10240 checkHR( DP_OK, hr );
10241
10242 /* Checking system messages (j=0) */
10243 for (i=0; i<2; i++)
10244 {
10245 hr = IDirectPlayX_Receive( pDP[i], &idFrom, &idTo, 0,
10246 lpData, &dwDataSize );
10247 checkHR( DP_OK, hr );
10248 check( 29, dwDataSize );
10249 check( DPID_SYSMSG, idFrom );
10250 check( dpid[i], idTo );
10253 check( dpid[0], lpData->dpId );
10254 checkStr( lpDataRemote[0], (LPSTR) lpData->lpData );
10255 check( dwDataSizeRemote, lpData->dwDataSize );
10256 dwDataSize = 1024;
10257 }
10258
10259 /* Queue is empty */
10260 check_messages( pDP[0], dpid, 2, &callbackData );
10261 checkStr( "", callbackData.szTrace1 );
10262 check_messages( pDP[1], dpid, 2, &callbackData );
10263 checkStr( "", callbackData.szTrace1 );
10264
10265
10266 free( lpDataGet );
10267 free( lpData );
10268 IDirectPlayX_Release( pDP[0] );
10269 IDirectPlayX_Release( pDP[1] );
10270
10271}

Referenced by START_TEST().

◆ test_Send()

static void test_Send ( void  )
static

Definition at line 8158 of file dplayx.c.

8159{
8160 DPSESSIONDESC2 appGuidDpsd =
8161 {
8162 .dwSize = sizeof( DPSESSIONDESC2 ),
8163 .guidApplication = appGuid,
8164 .guidInstance = appGuid,
8165 };
8166 DPSESSIONDESC2 serverDpsd =
8167 {
8168 .dwSize = sizeof( DPSESSIONDESC2 ),
8169 .guidApplication = appGuid,
8170 .guidInstance = appGuid,
8171 .lpszSessionName = (WCHAR *) L"normal",
8172 .dwReserved1 = 0xaabbccdd,
8173 };
8174 BYTE data[] = { 1, 2, 3, 4, 5, 6, 7, 8, };
8175 IDirectPlay4 *dp;
8176 SOCKET sendSock;
8177 SOCKET recvSock;
8178 SOCKET udpSock;
8179 HRESULT hr;
8180 DPID dpid;
8181
8182 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay4A, (void **) &dp );
8183 ok( hr == DP_OK, "got hr %#lx.\n", hr );
8184
8185 hr = IDirectPlayX_Send( dp, 0x07734, 0x1337, DPSEND_GUARANTEED, data, sizeof( data ) );
8186 ok( hr == DPERR_UNINITIALIZED, "got hr %#lx.\n", hr );
8187
8188 init_TCPIP_provider( dp, "127.0.0.1", 0 );
8189
8190 hr = IDirectPlayX_Send( dp, 0x07734, 0x1337, DPSEND_GUARANTEED, data, sizeof( data ) );
8191 ok( hr == DPERR_INVALIDPLAYER, "got hr %#lx.\n", hr );
8192
8193 joinSession( dp, &appGuidDpsd, &serverDpsd, &sendSock, &recvSock, NULL );
8194
8195 createPlayer( dp, 0x07734, NULL, NULL, 0, 0, sendSock, recvSock );
8196 createPlayer( dp, 0x14, NULL, NULL, 0, 0, sendSock, recvSock );
8197
8199
8200 hr = IDirectPlayX_Send( dp, 0x07734, 0xdeadbeef, DPSEND_GUARANTEED, data, sizeof( data ) );
8201 todo_wine ok( hr == DPERR_INVALIDPARAM, "got hr %#lx.\n", hr );
8202
8203 hr = IDirectPlayX_Send( dp, 0x07734, 0x1337, DPSEND_GUARANTEED, data, sizeof( data ) );
8204 ok( hr == DP_OK, "got hr %#lx.\n", hr );
8205
8206 receiveGuaranteedGameMessage( recvSock, 0x07734, 0x1337, data, sizeof( data ) );
8207
8208 hr = IDirectPlayX_Send( dp, 0x07734, 0x14, DPSEND_GUARANTEED, data, sizeof( data ) );
8209 ok( hr == DP_OK, "got hr %#lx.\n", hr );
8210
8211 dpid = checkPlayerMessage( dp, 0x07734, data, sizeof( data ) );
8212 ok( dpid == 0x14, "got destination id %#lx.\n", dpid );
8213
8214 hr = IDirectPlayX_Send( dp, 0x07734, 0x07734, DPSEND_GUARANTEED, data, sizeof( data ) );
8215 ok( hr == DP_OK, "got hr %#lx.\n", hr );
8216
8218 checkNoMoreMessages( recvSock );
8219
8220 hr = IDirectPlayX_Send( dp, 0x07734, DPID_ALLPLAYERS, DPSEND_GUARANTEED, data, sizeof( data ) );
8221 ok( hr == DP_OK, "got hr %#lx.\n", hr );
8222
8223 dpid = checkPlayerMessage( dp, 0x07734, data, sizeof( data ) );
8224 ok( dpid == 0x14, "got destination id %#lx.\n", dpid );
8225 receiveGuaranteedGameMessage( recvSock, 0x07734, DPID_ALLPLAYERS, data, sizeof( data ) );
8226
8227 udpSock = bindUdp( 2399 );
8228
8229 hr = IDirectPlayX_Send( dp, 0x07734, 0x1337, 0, data, sizeof( data ) );
8230 ok( hr == DP_OK, "got hr %#lx.\n", hr );
8231
8232 receiveGameMessage( udpSock, 0x07734, 0x1337, data, sizeof( data ) );
8233
8235 checkNoMoreMessages( udpSock );
8236 checkNoMoreMessages( recvSock );
8237
8238 closesocket( udpSock );
8239 closesocket( recvSock );
8240 closesocket( sendSock );
8241
8243}
#define DPERR_INVALIDPARAM
Definition: dplay.h:102
#define receiveGuaranteedGameMessage(sock, expectedFromId, expectedToId, expectedData, expectedDataSize)
Definition: dplayx.c:2029
#define checkPlayerMessage(dp, expectedFromId, expectedData, expectedDataSize)
Definition: dplayx.c:4787
#define receiveGameMessage(sock, expectedFromId, expectedToId, expectedData, expectedDataSize)
Definition: dplayx.c:2057

Referenced by START_TEST().

◆ test_SessionDesc()

static void test_SessionDesc ( void  )
static

Definition at line 4526 of file dplayx.c.

4527{
4528
4529 IDirectPlay4 *pDP[2];
4530 DPSESSIONDESC2 dpsd;
4531 LPDPSESSIONDESC2 lpData[2];
4532 LPVOID lpDataMsg;
4533 DPID dpid[2];
4534 DWORD dwDataSize;
4535 HRESULT hr;
4536 UINT i;
4537 CallbackData callbackData;
4538
4539
4540 for (i=0; i<2; i++)
4541 {
4542 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
4543 &IID_IDirectPlay4A, (LPVOID*) &pDP[i] );
4544 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
4545 if (FAILED(hr)) return;
4546 }
4547 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
4548
4549 /* Service provider not initialized */
4550 hr = IDirectPlayX_SetSessionDesc( pDP[0], NULL, 0 );
4552
4555
4556
4557 init_TCPIP_provider( pDP[0], "127.0.0.1", 0 );
4558 init_TCPIP_provider( pDP[1], "127.0.0.1", 0 );
4559
4560
4561 /* No sessions open */
4562 hr = IDirectPlayX_SetSessionDesc( pDP[0], NULL, 0 );
4564
4565 if ( hr == DPERR_UNINITIALIZED )
4566 {
4567 todo_wine win_skip("Get/SetSessionDesc not implemented\n");
4568 return;
4569 }
4570
4573
4574
4575 dpsd.dwSize = sizeof(DPSESSIONDESC2);
4576 dpsd.guidApplication = appGuid;
4577 dpsd.dwMaxPlayers = 10;
4578
4579
4580 /* Host */
4581 IDirectPlayX_Open( pDP[0], &dpsd, DPOPEN_CREATE );
4582 /* Peer */
4584 pDP[1], 0 );
4585
4586 for (i=0; i<2; i++)
4587 {
4588 /* Players, only to receive messages */
4589 IDirectPlayX_CreatePlayer( pDP[i], &dpid[i], NULL, NULL, NULL, 0, 0 );
4590
4591 lpData[i] = calloc( 1, 1024 );
4592 }
4593 lpDataMsg = calloc( 1, 1024 );
4594
4595
4596 /* Incorrect parameters */
4597 hr = IDirectPlayX_SetSessionDesc( pDP[0], NULL, 0 );
4601if(0)
4602{
4603 /* Crashes under Win7 */
4604 hr = IDirectPlayX_GetSessionDesc( pDP[0], lpData[0], NULL );
4606 dwDataSize=-1;
4607 hr = IDirectPlayX_GetSessionDesc( pDP[0], lpData[0], &dwDataSize );
4609 check( -1, dwDataSize );
4610}
4611
4612 /* Get: Insufficient buffer size */
4613 dwDataSize=0;
4614 hr = IDirectPlayX_GetSessionDesc( pDP[0], lpData[0], &dwDataSize );
4616 check( dpsd.dwSize, dwDataSize );
4617 dwDataSize=4;
4618 hr = IDirectPlayX_GetSessionDesc( pDP[0], lpData[0], &dwDataSize );
4620 check( dpsd.dwSize, dwDataSize );
4621 dwDataSize=1024;
4622 hr = IDirectPlayX_GetSessionDesc( pDP[0], NULL, &dwDataSize );
4624 check( dpsd.dwSize, dwDataSize );
4625
4626 /* Get: Regular operation
4627 * i=0: Local session
4628 * i=1: Remote session */
4629 for (i=0; i<2; i++)
4630 {
4631 hr = IDirectPlayX_GetSessionDesc( pDP[i], lpData[i], &dwDataSize );
4632 checkHR( DP_OK, hr );
4633 check( sizeof(DPSESSIONDESC2), dwDataSize );
4634 check( sizeof(DPSESSIONDESC2), lpData[i]->dwSize );
4635 checkGuid( &appGuid, &lpData[i]->guidApplication );
4636 check( dpsd.dwMaxPlayers, lpData[i]->dwMaxPlayers );
4637 }
4638
4639 checkGuid( &lpData[0]->guidInstance, &lpData[1]->guidInstance );
4640
4641 /* Set: Regular operation */
4642 dpsd.lpszSessionNameA = (LPSTR) "Wahaa";
4643 hr = IDirectPlayX_SetSessionDesc( pDP[0], &dpsd, 0 );
4644 checkHR( DP_OK, hr );
4645
4646 dwDataSize = 1024;
4647 hr = IDirectPlayX_GetSessionDesc( pDP[1], lpData[1], &dwDataSize );
4648 checkHR( DP_OK, hr );
4649 checkStr( dpsd.lpszSessionNameA, lpData[1]->lpszSessionNameA );
4650
4651
4652 /* Set: Failing to modify a remote session */
4653 hr = IDirectPlayX_SetSessionDesc( pDP[1], &dpsd, 0 );
4655
4656 /* Trying to change immutable properties */
4657 /* Flags */
4658 hr = IDirectPlayX_SetSessionDesc( pDP[0], &dpsd, 0 );
4659 checkHR( DP_OK, hr );
4661 hr = IDirectPlayX_SetSessionDesc( pDP[0], &dpsd, 0 );
4663 dpsd.dwFlags = 0;
4664 hr = IDirectPlayX_SetSessionDesc( pDP[0], &dpsd, 0 );
4665 checkHR( DP_OK, hr );
4666 /* Size */
4667 dpsd.dwSize = 2048;
4668 hr = IDirectPlayX_SetSessionDesc( pDP[0], &dpsd, 0 );
4670 dpsd.dwSize = sizeof(DPSESSIONDESC2);
4671 hr = IDirectPlayX_SetSessionDesc( pDP[0], &dpsd, 0 );
4672 checkHR( DP_OK, hr );
4673
4674 /* Changing the GUIDs and size is ignored */
4675 dpsd.guidApplication = appGuid2;
4676 hr = IDirectPlayX_SetSessionDesc( pDP[0], &dpsd, 0 );
4677 checkHR( DP_OK, hr );
4678 dpsd.guidInstance = appGuid2;
4679 hr = IDirectPlayX_SetSessionDesc( pDP[0], &dpsd, 0 );
4680 checkHR( DP_OK, hr );
4681
4682 hr = IDirectPlayX_GetSessionDesc( pDP[0], lpData[0], &dwDataSize );
4683 checkHR( DP_OK, hr );
4684 checkGuid( &appGuid, &lpData[0]->guidApplication );
4685 checkGuid( &lpData[1]->guidInstance, &lpData[0]->guidInstance );
4686 check( sizeof(DPSESSIONDESC2), lpData[0]->dwSize );
4687
4688
4689 /* Checking system messages */
4690 check_messages( pDP[0], dpid, 2, &callbackData );
4691 checkStr( "S0,S0,S0,S0,S0,S0,S0,", callbackData.szTrace1 );
4692 checkStr( "48,90,90,90,90,90,90,", callbackData.szTrace2 );
4693 check_messages( pDP[1], dpid, 2, &callbackData );
4694 checkStr( "S1,S1,S1,S1,S1,S1,", callbackData.szTrace1 );
4695 checkStr( "90,90,90,90,90,90,", callbackData.szTrace2 );
4696
4697 free( lpDataMsg );
4698 for (i=0; i<2; i++)
4699 {
4700 free( lpData[i] );
4701 IDirectPlayX_Release( pDP[i] );
4702 }
4703
4704}
#define IDirectPlayX_GetSessionDesc(p, a, b)
Definition: dplay.h:887
#define IDirectPlayX_SetSessionDesc(p, a, b)
Definition: dplay.h:896

Referenced by START_TEST().

Variable Documentation

◆ enum_address_cb_count

int enum_address_cb_count = 0
static

Definition at line 2835 of file dplayx.c.

Referenced by EnumAddressTypeCallback(), and test_EnumAddressTypes().

◆ enum_addresses_cb_count

int enum_addresses_cb_count = 0
static

Definition at line 2768 of file dplayx.c.

Referenced by EnumAddressesCallback(), and test_EnumAddresses().

◆ lplpDP

◆ pUnk

void *static void *static LPDIRECTPLAY IUnknown* pUnk

Definition at line 41 of file dplayx.c.

Referenced by ATL::CComDynamicUnkArray::Add(), AntiMoniker_CreateInstance(), ATL::AtlAdvise(), AtlAdvise(), AtlAxGetControl(), AtlIPersistPropertyBag_Load(), AtlIPersistPropertyBag_Save(), AtlIPersistStreamInit_Load(), AtlIPersistStreamInit_Save(), AtlMarshalPtrInProc(), ClassMoniker_CreateInstance(), CoAllowSetForegroundWindow(), CoGetStandardMarshal(), CompositeMoniker_CreateInstance(), create_node(), create_stub(), CreateConnectionPoint(), CreateStartMenu(), DECLARE_INTERFACE_(), delegating_invoke_test_QI(), delegating_QueryInterface(), DirectPlayCreate(), domdoc_save(), DPL_ConnectEx(), EnumConnections_Next(), EnumConnectionsImpl_Construct(), RecycleBin5::EnumObjects(), ExecResetDefViewFolderSettings(), FileMoniker_CreateInstance(), FileSystemBindData_GetFindData(), FileSystemBindData_SetFindData(), FTMarshalCF_CreateInstance(), GetDefaultRecycleBin(), GetInterfaceOffset(), CFolderItem::GetParentAndItem(), HandlerCF_CreateInstance(), HlinkNavigateString(), HlinkSimpleNavigateToMoniker(), HlinkSimpleNavigateToString(), HTMLElement2_addFilter(), HTMLElement2_removeFilter(), IDirectPlayLobby3AImpl_ConnectEx(), IDirectPlayLobby3Impl_ConnectEx(), IDirectSoundCaptureImpl_CreateCaptureBuffer(), IDirectSoundFullDuplex_IDirectSoundCapture_CreateCaptureBuffer(), IMAPTransportCF_CreateInstance(), INetCfgComponent_fnRaisePropertyUi(), ATL::CComEnumImpl< Base, piid, T, Copy >::Init(), InvokeShellExecuteHook(), IPropertyBag_Read_Proxy(), ITypeInfo_fnCreateInstance(), IUnknown_InitializeCommand(), IUnknown_SetOwner(), list_invoke(), Load(), NdrInterfacePointerFree(), objectset_get__NewEnum(), OleCreate(), OleDraw(), OleLoad(), CTrayBandSite::OnSave(), PointerMoniker_CreateInstance(), POP3TransportCF_CreateInstance(), CInternetToolbar::QIBand(), CDocumentMgr::QueryInterface(), CThreadMgr::QueryInterface(), CContext::QueryInterface(), ReleaseBindInfo(), CBandSiteBase::SetDeskBarSite(), SHELL_InitializeExtension(), SHForwardContextMenuMsg(), SHGetObjectCompatFlags(), SHInvokeCommandOnContextMenu(), SHInvokeCommandOnContextMenuEx(), SHInvokeCommandOnContextMenuInternal(), SHInvokeCommandWithFlagsAndSite(), SHLoadInProc(), CInternetToolbar::ShowDW(), SHWeakQueryInterface(), SMTPTransportCF_CreateInstance(), START_TEST(), StdGlobalInterfaceTable_RegisterInterfaceInGlobal(), test_CoCreateInstance(), test_CoFreeUnusedLibraries(), test_CoGetCallContext(), test_CoGetClassObject(), test_CoGetInterfaceAndReleaseStream(), test_CopyBindInfo(), test_createDebugger(), test_DirectInput8Create(), test_DirectInputCreateEx(), test_get_clipboard_uninitialized(), test_Installer_Products(), Test_InvalidClsid(), test_OleInitialize_InitCounting(), test_pack_RemBINDINFO(), test_QueryInterface(), test_ReleaseBindInfo(), Test_Version(), TestManualInstantiation(), and TestModuleInterfaces().