ReactOS 0.4.16-dev-340-g0540c21
dplayx.c File Reference
#include "wine/test.h"
#include <stdio.h>
#include <dplay.h>
#include <dplobby.h>
#include <netfw.h>
Include dependency graph for dplayx.c:

Go to the source code of this file.

Classes

struct  tagCallbackData
 
struct  provider_data
 

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)
 
#define checkGuid(expected, result)
 
#define checkConv(expected, result, function)
 
#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 N_SESSIONS   6
 

Typedefs

typedef struct tagCallbackData CallbackData
 
typedef struct tagCallbackDatalpCallbackData
 

Enumerations

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

Functions

static HRESULT (WINAPI *pDirectPlayEnumerateA)(LPDPENUMDPCALLBACKA
 
 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 LPCSTR dwFlags2str (DWORD dwFlags, DWORD flagType)
 
static char dpid2char (DPID *dpid, DWORD dpidSize, DPID idPlayer)
 
static void check_messages (IDirectPlay4 *pDP, DPID *dpid, DWORD dpidSize, lpCallbackData callbackData)
 
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 void test_EnumAddressTypes (void)
 
static BOOL CALLBACK EnumSessions_cb2 (LPCDPSESSIONDESC2 lpThisSD, LPDWORD lpdwTimeOut, DWORD dwFlags, LPVOID lpContext)
 
static void test_Open (void)
 
static BOOL CALLBACK EnumSessions_cb (LPCDPSESSIONDESC2 lpThisSD, LPDWORD lpdwTimeOut, DWORD dwFlags, LPVOID lpContext)
 
static IDirectPlay4 * create_session (DPSESSIONDESC2 *lpdpsd)
 
static void test_EnumSessions (void)
 
static void test_SessionDesc (void)
 
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_Receive (void)
 
static void test_GetMessageCount (void)
 
static void test_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 LPDIRECTPLAYlplpDP
 
static void *static void *static LPDIRECTPLAY IUnknownpUnk
 

Macro Definition Documentation

◆ 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:2063

Definition at line 32 of file dplayx.c.

◆ checkConv

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

Definition at line 57 of file dplayx.c.

◆ checkFlags

#define checkFlags (   expected,
  result,
  flags 
)
Value:
ok( (expected) == (result), \
"expected=0x%08x(%s) got=0x%08x(%s)\n", \
static LPCSTR dwFlags2str(DWORD dwFlags, DWORD flagType)
Definition: dplayx.c:248
GLbitfield flags
Definition: glext.h:7161

Definition at line 48 of file dplayx.c.

◆ checkGuid

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

Definition at line 53 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:141

Definition at line 40 of file dplayx.c.

◆ checkLP

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

Definition at line 36 of file dplayx.c.

◆ checkStr

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

Definition at line 44 of file dplayx.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 20 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.

◆ N_SESSIONS

#define N_SESSIONS   6

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 6736 of file dplayx.c.

6737{
6738 APP_ADD,
6740};
@ APP_REMOVE
Definition: dplayx.c:6739
@ APP_ADD
Definition: dplayx.c:6738

Function Documentation

◆ callback_providersA()

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

Definition at line 764 of file dplayx.c.

765{
766 struct provider_data *prov = arg;
767
768 if (!prov) return TRUE;
769
770 if (prov->call_count < ARRAY_SIZE(prov->guid_data))
771 {
772 prov->guid_ptr[prov->call_count] = guid;
773 prov->guid_data[prov->call_count] = *guid;
774
775 prov->call_count++;
776 }
777
778 if (prov->ret_value) /* Only trace when looping all providers */
779 trace("Provider #%d '%s' (%d.%d)\n", prov->call_count, name, major, minor);
780 return prov->ret_value;
781}
#define trace
Definition: atltest.h:70
#define ARRAY_SIZE(A)
Definition: main.h:20
#define TRUE
Definition: types.h:120
const GUID * guid
#define minor(rdev)
Definition: propsheet.cpp:929
#define major(rdev)
Definition: propsheet.cpp:928
Definition: name.c:39
int call_count
Definition: dplayx.c:82
GUID * guid_ptr[10]
Definition: dplayx.c:83
GUID guid_data[10]
Definition: dplayx.c:84
BOOL ret_value
Definition: dplayx.c:85
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 783 of file dplayx.c.

784{
785 struct provider_data *prov = arg;
786
787 if (!prov) return TRUE;
788
789 if (prov->call_count < ARRAY_SIZE(prov->guid_data))
790 {
791 prov->guid_ptr[prov->call_count] = guid;
792 prov->guid_data[prov->call_count] = *guid;
793
794 prov->call_count++;
795 }
796
797 return prov->ret_value;
798}

Referenced by test_EnumerateProviders().

◆ check_messages()

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

Definition at line 590 of file dplayx.c.

592{
593 /* Retrieves all messages from the queue of pDP, performing tests
594 * to check if we are receiving what we expect.
595 *
596 * Information about the messages is stores in callbackData:
597 *
598 * callbackData->dwCounter1: Number of messages received.
599 * callbackData->szTrace1: Traces for sender and receiver.
600 * We store the position a dpid holds in the dpid array.
601 * Example:
602 *
603 * trace string: "01,02,03,14"
604 * expanded: [ '01', '02', '03', '14' ]
605 * \ \ \ \
606 * \ \ \ ) message 3: from 1 to 4
607 * \ \ ) message 2: from 0 to 3
608 * \ ) message 1: from 0 to 2
609 * ) message 0: from 0 to 1
610 *
611 * In general terms:
612 * sender of message i = character in place 3*i of the array
613 * receiver of message i = character in place 3*i+1 of the array
614 *
615 * A sender value of 'S' means DPID_SYSMSG, this is, a system message.
616 *
617 * callbackData->szTrace2: Traces for message sizes.
618 */
619
620 DPID idFrom, idTo;
621 UINT i;
622 DWORD dwDataSize = 1024;
623 LPVOID lpData = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwDataSize );
624 HRESULT hr;
625 char temp[5];
626
627 callbackData->szTrace2[0] = '\0';
628
629 i = 0;
630 while ( DP_OK == (hr = IDirectPlayX_Receive( pDP, &idFrom, &idTo, 0,
631 lpData, &dwDataSize )) )
632 {
633
634 callbackData->szTrace1[ 3*i ] = dpid2char( dpid, dpidSize, idFrom );
635 callbackData->szTrace1[ 3*i+1 ] = dpid2char( dpid, dpidSize, idTo );
636 callbackData->szTrace1[ 3*i+2 ] = ',';
637
638 sprintf( temp, "%d,", dwDataSize );
639 strcat( callbackData->szTrace2, temp );
640
641 dwDataSize = 1024;
642 ++i;
643 }
644
646
647 callbackData->szTrace1[ 3*i ] = '\0';
648 callbackData->dwCounter1 = i;
649
650
651 HeapFree( GetProcessHeap(), 0, lpData );
652}
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define IDirectPlayX_Receive(p, a, b, c, d, e)
Definition: dplay.h:890
#define DP_OK
Definition: dplay.h:88
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:577
#define checkHR(expected, result)
Definition: dplayx.c:40
unsigned long DWORD
Definition: ntddk_ex.h:95
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 sprintf(buf, format,...)
Definition: sprintf.c:55
unsigned int UINT
Definition: ndis.h:50
static calc_node_t temp
Definition: rpn_ieee.c:38
HRESULT hr
Definition: shlfolder.c:183
UINT dwCounter1
Definition: dplayx.c:73
char szTrace2[1024]
Definition: dplayx.c:75
char szTrace1[1024]
Definition: dplayx.c:75

◆ create_session()

static IDirectPlay4 * create_session ( DPSESSIONDESC2 lpdpsd)
static

Definition at line 1388 of file dplayx.c.

1389{
1390
1391 IDirectPlay4 *pDP;
1392 DPNAME name;
1393 DPID dpid;
1394 HRESULT hr;
1395
1396 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
1397 &IID_IDirectPlay4A, (LPVOID*) &pDP );
1398 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
1399 if (FAILED(hr)) return NULL;
1400
1401 init_TCPIP_provider( pDP, "127.0.0.1", 0 );
1402
1403 hr = IDirectPlayX_Open( pDP, lpdpsd, DPOPEN_CREATE );
1405
1406 if ( ! (lpdpsd->dwFlags & DPSESSION_NEWPLAYERSDISABLED) )
1407 {
1408 ZeroMemory( &name, sizeof(DPNAME) );
1409 name.dwSize = sizeof(DPNAME);
1410 U1(name).lpszShortNameA = (LPSTR) "bofh";
1411
1412 hr = IDirectPlayX_CreatePlayer( pDP, &dpid, &name, NULL, NULL,
1415 }
1416
1417 return pDP;
1418
1419}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#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
struct tagDPNAME DPNAME
static void init_TCPIP_provider(IDirectPlay4 *pDP, LPCSTR strIPAddressString, WORD port)
Definition: dplayx.c:654
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define todo_wine
Definition: custom.c:89
#define U1(x)
Definition: test.h:202
DWORD dwFlags
Definition: dplay.h:233
#define ZeroMemory
Definition: winbase.h:1737
char * LPSTR
Definition: xmlstorage.h:182

Referenced by test_EnumSessions().

◆ 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  ,
,
,
,
,
,
,
,
,
,
,
 
)

◆ 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 577 of file dplayx.c.

578{
579 UINT i;
580 if ( idPlayer == DPID_SYSMSG )
581 return 'S';
582 for (i=0; i<dpidSize; i++)
583 {
584 if ( idPlayer == dpid[i] )
585 return (char)(i+48);
586 }
587 return '?';
588}
#define DPID_SYSMSG
Definition: dplay.h:161

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

◆ dpMsgType2str()

static LPCSTR dpMsgType2str ( DWORD  dwType)
static

Definition at line 223 of file dplayx.c.

224{
225 switch(dwType)
226 {
227 case DPSYS_CREATEPLAYERORGROUP: return "DPSYS_CREATEPLAYERORGROUP";
228 case DPSYS_DESTROYPLAYERORGROUP: return "DPSYS_DESTROYPLAYERORGROUP";
229 case DPSYS_ADDPLAYERTOGROUP: return "DPSYS_ADDPLAYERTOGROUP";
230 case DPSYS_DELETEPLAYERFROMGROUP: return "DPSYS_DELETEPLAYERFROMGROUP";
231 case DPSYS_SESSIONLOST: return "DPSYS_SESSIONLOST";
232 case DPSYS_HOST: return "DPSYS_HOST";
233 case DPSYS_SETPLAYERORGROUPDATA: return "DPSYS_SETPLAYERORGROUPDATA";
234 case DPSYS_SETPLAYERORGROUPNAME: return "DPSYS_SETPLAYERORGROUPNAME";
235 case DPSYS_SETSESSIONDESC: return "DPSYS_SETSESSIONDESC";
236 case DPSYS_ADDGROUPTOGROUP: return "DPSYS_ADDGROUPTOGROUP";
237 case DPSYS_DELETEGROUPFROMGROUP: return "DPSYS_DELETEGROUPFROMGROUP";
238 case DPSYS_SECUREMESSAGE: return "DPSYS_SECUREMESSAGE";
239 case DPSYS_STARTSESSION: return "DPSYS_STARTSESSION";
240 case DPSYS_CHAT: return "DPSYS_DPSYS_CHAT";
241 case DPSYS_SETGROUPOWNER: return "DPSYS_SETGROUPOWNER";
242 case DPSYS_SENDCOMPLETE: return "DPSYS_SENDCOMPLETE";
243
244 default: return "UNKNOWN";
245 }
246}
#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_SETPLAYERORGROUPDATA
Definition: dplay.h:1103
#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_CREATEPLAYERORGROUP
Definition: dplay.h:1085
#define DPSYS_SESSIONLOST
Definition: dplay.h:1097
#define DPSYS_SETPLAYERORGROUPNAME
Definition: dplay.h:1106
#define DPSYS_ADDPLAYERTOGROUP
Definition: dplay.h:1091
#define DPSYS_STARTSESSION
Definition: dplay.h:1121

Referenced by test_CreateGroup(), test_host_migration(), test_Receive(), test_remote_data_replication(), and test_Send().

◆ dpResult2str()

static LPCSTR dpResult2str ( HRESULT  hr)
static

Definition at line 141 of file dplayx.c.

142{
143 switch (hr)
144 {
145 case DP_OK: return "DP_OK";
146 case DPERR_ALREADYINITIALIZED: return "DPERR_ALREADYINITIALIZED";
147 case DPERR_ACCESSDENIED: return "DPERR_ACCESSDENIED";
148 case DPERR_ACTIVEPLAYERS: return "DPERR_ACTIVEPLAYERS";
149 case DPERR_BUFFERTOOSMALL: return "DPERR_BUFFERTOOSMALL";
150 case DPERR_CANTADDPLAYER: return "DPERR_CANTADDPLAYER";
151 case DPERR_CANTCREATEGROUP: return "DPERR_CANTCREATEGROUP";
152 case DPERR_CANTCREATEPLAYER: return "DPERR_CANTCREATEPLAYER";
153 case DPERR_CANTCREATESESSION: return "DPERR_CANTCREATESESSION";
154 case DPERR_CAPSNOTAVAILABLEYET: return "DPERR_CAPSNOTAVAILABLEYET";
155 case DPERR_EXCEPTION: return "DPERR_EXCEPTION";
156 case DPERR_GENERIC: return "DPERR_GENERIC";
157 case DPERR_INVALIDFLAGS: return "DPERR_INVALIDFLAGS";
158 case DPERR_INVALIDOBJECT: return "DPERR_INVALIDOBJECT";
159 case DPERR_INVALIDPARAMS: return "DPERR_INVALIDPARAMS";
160 /* symbol with the same value: DPERR_INVALIDPARAM */
161 case DPERR_INVALIDPLAYER: return "DPERR_INVALIDPLAYER";
162 case DPERR_INVALIDGROUP: return "DPERR_INVALIDGROUP";
163 case DPERR_NOCAPS: return "DPERR_NOCAPS";
164 case DPERR_NOCONNECTION: return "DPERR_NOCONNECTION";
165 case DPERR_NOMEMORY: return "DPERR_NOMEMORY";
166 /* symbol with the same value: DPERR_OUTOFMEMORY */
167 case DPERR_NOMESSAGES: return "DPERR_NOMESSAGES";
168 case DPERR_NONAMESERVERFOUND: return "DPERR_NONAMESERVERFOUND";
169 case DPERR_NOPLAYERS: return "DPERR_NOPLAYERS";
170 case DPERR_NOSESSIONS: return "DPERR_NOSESSIONS";
171 case DPERR_PENDING: return "DPERR_PENDING";
172 case DPERR_SENDTOOBIG: return "DPERR_SENDTOOBIG";
173 case DPERR_TIMEOUT: return "DPERR_TIMEOUT";
174 case DPERR_UNAVAILABLE: return "DPERR_UNAVAILABLE";
175 case DPERR_UNSUPPORTED: return "DPERR_UNSUPPORTED";
176 case DPERR_BUSY: return "DPERR_BUSY";
177 case DPERR_USERCANCEL: return "DPERR_USERCANCEL";
178 case DPERR_NOINTERFACE: return "DPERR_NOINTERFACE";
179 case DPERR_CANNOTCREATESERVER: return "DPERR_CANNOTCREATESERVER";
180 case DPERR_PLAYERLOST: return "DPERR_PLAYERLOST";
181 case DPERR_SESSIONLOST: return "DPERR_SESSIONLOST";
182 case DPERR_UNINITIALIZED: return "DPERR_UNINITIALIZED";
183 case DPERR_NONEWPLAYERS: return "DPERR_NONEWPLAYERS";
184 case DPERR_INVALIDPASSWORD: return "DPERR_INVALIDPASSWORD";
185 case DPERR_CONNECTING: return "DPERR_CONNECTING";
186 case DPERR_CONNECTIONLOST: return "DPERR_CONNECTIONLOST";
187 case DPERR_UNKNOWNMESSAGE: return "DPERR_UNKNOWNMESSAGE";
188 case DPERR_CANCELFAILED: return "DPERR_CANCELFAILED";
189 case DPERR_INVALIDPRIORITY: return "DPERR_INVALIDPRIORITY";
190 case DPERR_NOTHANDLED: return "DPERR_NOTHANDLED";
191 case DPERR_CANCELLED: return "DPERR_CANCELLED";
192 case DPERR_ABORTED: return "DPERR_ABORTED";
193 case DPERR_BUFFERTOOLARGE: return "DPERR_BUFFERTOOLARGE";
194 case DPERR_CANTCREATEPROCESS: return "DPERR_CANTCREATEPROCESS";
195 case DPERR_APPNOTSTARTED: return "DPERR_APPNOTSTARTED";
196 case DPERR_INVALIDINTERFACE: return "DPERR_INVALIDINTERFACE";
197 case DPERR_NOSERVICEPROVIDER: return "DPERR_NOSERVICEPROVIDER";
198 case DPERR_UNKNOWNAPPLICATION: return "DPERR_UNKNOWNAPPLICATION";
199 case DPERR_NOTLOBBIED: return "DPERR_NOTLOBBIED";
200 case DPERR_SERVICEPROVIDERLOADED: return "DPERR_SERVICEPROVIDERLOADED";
201 case DPERR_ALREADYREGISTERED: return "DPERR_ALREADYREGISTERED";
202 case DPERR_NOTREGISTERED: return "DPERR_NOTREGISTERED";
203 case DPERR_AUTHENTICATIONFAILED: return "DPERR_AUTHENTICATIONFAILED";
204 case DPERR_CANTLOADSSPI: return "DPERR_CANTLOADSSPI";
205 case DPERR_ENCRYPTIONFAILED: return "DPERR_ENCRYPTIONFAILED";
206 case DPERR_SIGNFAILED: return "DPERR_SIGNFAILED";
207 case DPERR_CANTLOADSECURITYPACKAGE: return "DPERR_CANTLOADSECURITYPACKAGE";
208 case DPERR_ENCRYPTIONNOTSUPPORTED: return "DPERR_ENCRYPTIONNOTSUPPORTED";
209 case DPERR_CANTLOADCAPI: return "DPERR_CANTLOADCAPI";
210 case DPERR_NOTLOGGEDIN: return "DPERR_NOTLOGGEDIN";
211 case DPERR_LOGONDENIED: return "DPERR_LOGONDENIED";
212 case CLASS_E_NOAGGREGATION: return "CLASS_E_NOAGGREGATION";
213
214 default:
215 {
217 sprintf( buffer, "%d", HRESULT_CODE(hr) );
218 return buffer;
219 }
220 }
221}
#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:88
GLuint buffer
Definition: glext.h:5915
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
#define HRESULT_CODE(hr)
Definition: winerror.h:76

◆ dwFlags2str()

static LPCSTR dwFlags2str ( DWORD  dwFlags,
DWORD  flagType 
)
static

Definition at line 248 of file dplayx.c.

249{
250
251#define FLAGS_DPCONNECTION (1<<0)
252#define FLAGS_DPENUMPLAYERS (1<<1)
253#define FLAGS_DPENUMGROUPS (1<<2)
254#define FLAGS_DPPLAYER (1<<3)
255#define FLAGS_DPGROUP (1<<4)
256#define FLAGS_DPENUMSESSIONS (1<<5)
257#define FLAGS_DPGETCAPS (1<<6)
258#define FLAGS_DPGET (1<<7)
259#define FLAGS_DPRECEIVE (1<<8)
260#define FLAGS_DPSEND (1<<9)
261#define FLAGS_DPSET (1<<10)
262#define FLAGS_DPMESSAGEQUEUE (1<<11)
263#define FLAGS_DPCONNECT (1<<12)
264#define FLAGS_DPOPEN (1<<13)
265#define FLAGS_DPSESSION (1<<14)
266#define FLAGS_DPLCONNECTION (1<<15)
267#define FLAGS_DPESC (1<<16)
268#define FLAGS_DPCAPS (1<<17)
269
271
272 /* EnumConnections */
273
274 if (flagType & FLAGS_DPCONNECTION)
275 {
277 strcat(flags, "DPCONNECTION_DIRECTPLAY,");
279 strcat(flags, "DPCONNECTION_DIRECTPLAYLOBBY,");
280 }
281
282 /* EnumPlayers,
283 EnumGroups */
284
285 if (flagType & FLAGS_DPENUMPLAYERS)
286 {
288 strcat(flags, "DPENUMPLAYERS_ALL,");
290 strcat(flags, "DPENUMPLAYERS_LOCAL,");
292 strcat(flags, "DPENUMPLAYERS_REMOTE,");
294 strcat(flags, "DPENUMPLAYERS_GROUP,");
296 strcat(flags, "DPENUMPLAYERS_SESSION,");
298 strcat(flags, "DPENUMPLAYERS_SERVERPLAYER,");
300 strcat(flags, "DPENUMPLAYERS_SPECTATOR,");
302 strcat(flags, "DPENUMPLAYERS_OWNER,");
303 }
304 if (flagType & FLAGS_DPENUMGROUPS)
305 {
307 strcat(flags, "DPENUMGROUPS_ALL,");
309 strcat(flags, "DPENUMGROUPS_LOCAL,");
311 strcat(flags, "DPENUMGROUPS_REMOTE,");
313 strcat(flags, "DPENUMGROUPS_GROUP,");
315 strcat(flags, "DPENUMGROUPS_SESSION,");
317 strcat(flags, "DPENUMGROUPS_SHORTCUT,");
319 strcat(flags, "DPENUMGROUPS_STAGINGAREA,");
321 strcat(flags, "DPENUMGROUPS_HIDDEN,");
322 }
323
324 /* CreatePlayer */
325
326 if (flagType & FLAGS_DPPLAYER)
327 {
329 strcat(flags, "DPPLAYER_SERVERPLAYER,");
331 strcat(flags, "DPPLAYER_SPECTATOR,");
333 strcat(flags, "DPPLAYER_LOCAL,");
335 strcat(flags, "DPPLAYER_OWNER,");
336 }
337
338 /* CreateGroup */
339
340 if (flagType & FLAGS_DPGROUP)
341 {
343 strcat(flags, "DPGROUP_STAGINGAREA,");
345 strcat(flags, "DPGROUP_LOCAL,");
347 strcat(flags, "DPGROUP_HIDDEN,");
348 }
349
350 /* EnumSessions */
351
352 if (flagType & FLAGS_DPENUMSESSIONS)
353 {
355 strcat(flags, "DPENUMSESSIONS_AVAILABLE,");
357 strcat(flags, "DPENUMSESSIONS_ALL,");
359 strcat(flags, "DPENUMSESSIONS_ASYNC,");
361 strcat(flags, "DPENUMSESSIONS_STOPASYNC,");
363 strcat(flags, "DPENUMSESSIONS_PASSWORDREQUIRED,");
365 strcat(flags, "DPENUMSESSIONS_RETURNSTATUS,");
366 }
367
368 /* GetCaps,
369 GetPlayerCaps */
370
371 if (flagType & FLAGS_DPGETCAPS)
372 {
374 strcat(flags, "DPGETCAPS_GUARANTEED,");
375 }
376
377 /* GetGroupData,
378 GetPlayerData */
379
380 if (flagType & FLAGS_DPGET)
381 {
382 if (dwFlags == DPGET_REMOTE)
383 strcat(flags, "DPGET_REMOTE,");
384 if (dwFlags & DPGET_LOCAL)
385 strcat(flags, "DPGET_LOCAL,");
386 }
387
388 /* Receive */
389
390 if (flagType & FLAGS_DPRECEIVE)
391 {
393 strcat(flags, "DPRECEIVE_ALL,");
395 strcat(flags, "DPRECEIVE_TOPLAYER,");
397 strcat(flags, "DPRECEIVE_FROMPLAYER,");
399 strcat(flags, "DPRECEIVE_PEEK,");
400 }
401
402 /* Send */
403
404 if (flagType & FLAGS_DPSEND)
405 {
406 /*if (dwFlags == DPSEND_NONGUARANTEED)
407 strcat(flags, "DPSEND_NONGUARANTEED,");*/
408 if (dwFlags == DPSEND_MAX_PRIORITY) /* = DPSEND_MAX_PRI */
409 {
410 strcat(flags, "DPSEND_MAX_PRIORITY,");
411 }
412 else
413 {
415 strcat(flags, "DPSEND_GUARANTEED,");
417 strcat(flags, "DPSEND_HIGHPRIORITY,");
419 strcat(flags, "DPSEND_OPENSTREAM,");
421 strcat(flags, "DPSEND_CLOSESTREAM,");
423 strcat(flags, "DPSEND_SIGNED,");
425 strcat(flags, "DPSEND_ENCRYPTED,");
427 strcat(flags, "DPSEND_LOBBYSYSTEMMESSAGE,");
428 if (dwFlags & DPSEND_ASYNC)
429 strcat(flags, "DPSEND_ASYNC,");
431 strcat(flags, "DPSEND_NOSENDCOMPLETEMSG,");
432 }
433 }
434
435 /* SetGroupData,
436 SetGroupName,
437 SetPlayerData,
438 SetPlayerName,
439 SetSessionDesc */
440
441 if (flagType & FLAGS_DPSET)
442 {
443 if (dwFlags == DPSET_REMOTE)
444 strcat(flags, "DPSET_REMOTE,");
445 if (dwFlags & DPSET_LOCAL)
446 strcat(flags, "DPSET_LOCAL,");
448 strcat(flags, "DPSET_GUARANTEED,");
449 }
450
451 /* GetMessageQueue */
452
453 if (flagType & FLAGS_DPMESSAGEQUEUE)
454 {
456 strcat(flags, "DPMESSAGEQUEUE_SEND,");
458 strcat(flags, "DPMESSAGEQUEUE_RECEIVE,");
459 }
460
461 /* Connect */
462
463 if (flagType & FLAGS_DPCONNECT)
464 {
466 strcat(flags, "DPCONNECT_RETURNSTATUS,");
467 }
468
469 /* Open */
470
471 if (flagType & FLAGS_DPOPEN)
472 {
473 if (dwFlags & DPOPEN_JOIN)
474 strcat(flags, "DPOPEN_JOIN,");
476 strcat(flags, "DPOPEN_CREATE,");
478 strcat(flags, "DPOPEN_RETURNSTATUS,");
479 }
480
481 /* DPSESSIONDESC2 */
482
483 if (flagType & FLAGS_DPSESSION)
484 {
486 strcat(flags, "DPSESSION_NEWPLAYERSDISABLED,");
488 strcat(flags, "DPSESSION_MIGRATEHOST,");
490 strcat(flags, "DPSESSION_NOMESSAGEID,");
492 strcat(flags, "DPSESSION_JOINDISABLED,");
494 strcat(flags, "DPSESSION_KEEPALIVE,");
496 strcat(flags, "DPSESSION_NODATAMESSAGES,");
498 strcat(flags, "DPSESSION_SECURESERVER,");
500 strcat(flags, "DPSESSION_PRIVATE,");
502 strcat(flags, "DPSESSION_PASSWORDREQUIRED,");
504 strcat(flags, "DPSESSION_MULTICASTSERVER,");
506 strcat(flags, "DPSESSION_CLIENTSERVER,");
507
509 strcat(flags, "DPSESSION_DIRECTPLAYPROTOCOL,");
511 strcat(flags, "DPSESSION_NOPRESERVEORDER,");
513 strcat(flags, "DPSESSION_OPTIMIZELATENCY,");
514
515 }
516
517 /* DPLCONNECTION */
518
519 if (flagType & FLAGS_DPLCONNECTION)
520 {
522 strcat(flags, "DPLCONNECTION_CREATESESSION,");
524 strcat(flags, "DPLCONNECTION_JOINSESSION,");
525 }
526
527 /* EnumSessionsCallback2 */
528
529 if (flagType & FLAGS_DPESC)
530 {
532 strcat(flags, "DPESC_TIMEDOUT,");
533 }
534
535 /* GetCaps,
536 GetPlayerCaps */
537
538 if (flagType & FLAGS_DPCAPS)
539 {
541 strcat(flags, "DPCAPS_ISHOST,");
543 strcat(flags, "DPCAPS_GROUPOPTIMIZED,");
545 strcat(flags, "DPCAPS_KEEPALIVEOPTIMIZED,");
547 strcat(flags, "DPCAPS_GUARANTEEDOPTIMIZED,");
549 strcat(flags, "DPCAPS_GUARANTEEDSUPPORTED,");
551 strcat(flags, "DPCAPS_SIGNINGSUPPORTED,");
553 strcat(flags, "DPCAPS_ENCRYPTIONSUPPORTED,");
555 strcat(flags, "DPCAPS_ASYNCCANCELSUPPORTED,");
557 strcat(flags, "DPCAPS_ASYNCCANCELALLSUPPORTED,");
559 strcat(flags, "DPCAPS_SENDTIMEOUTSUPPORTED,");
561 strcat(flags, "DPCAPS_SENDPRIORITYSUPPORTED,");
563 strcat(flags, "DPCAPS_ASYNCSUPPORTED,");
564
566 strcat(flags, "DPPLAYERCAPS_LOCAL,");
567 }
568
569 if ((strlen(flags) == 0) && (dwFlags != 0))
570 strcpy(flags, "UNKNOWN");
571 else
572 flags[strlen(flags)-1] = '\0';
573
574 return flags;
575}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define DPSESSION_MIGRATEHOST
Definition: dplay.h:268
#define DPENUMPLAYERS_LOCAL
Definition: dplay.h:987
#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 DPSESSION_PASSWORDREQUIRED
Definition: dplay.h:275
#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 DPENUMPLAYERS_REMOTE
Definition: dplay.h:988
#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 DPENUMSESSIONS_ASYNC
Definition: dplay.h:1018
#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 DPOPEN_JOIN
Definition: dplay.h:263
#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 DPENUMSESSIONS_STOPASYNC
Definition: dplay.h:1019
#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 DPSESSION_JOINDISABLED
Definition: dplay.h:270
#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 DPESC_TIMEDOUT
Definition: dplay.h:420
#define DPPLAYER_OWNER
Definition: dplay.h:1008
#define DPMESSAGEQUEUE_SEND
Definition: dplay.h:1061
#define DPGET_REMOTE
Definition: dplay.h:1027
#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 DPSESSION_PRIVATE
Definition: dplay.h:274
#define DPPLAYERCAPS_LOCAL
Definition: dplay.h:1075
#define DPPLAYER_LOCAL
Definition: dplay.h:1007
#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
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

Referenced by EnumGroups_cb(), and EnumPlayers_cb().

◆ EnumAddress_cb()

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

Definition at line 3005 of file dplayx.c.

3009{
3010 lpCallbackData callbackData = lpContext;
3011 static REFGUID types[] = { &DPAID_TotalSize,
3012 &DPAID_ServiceProvider,
3013 &DPAID_INet,
3014 &DPAID_INetW };
3015 static DWORD sizes[] = { 4, 16, 12, 24, 4, 16, 10, 20 };
3016
3017
3018 checkGuid( types[callbackData->dwCounter1%4], guidDataType );
3019 check( sizes[callbackData->dwCounter1], dwDataSize );
3020
3021 switch(callbackData->dwCounter1)
3022 {
3023 case 0:
3024 check( 136, *(LPDWORD) lpData );
3025 break;
3026 case 4:
3027 check( 130, *(LPDWORD) lpData );
3028 break;
3029 case 1:
3030 case 5:
3031 checkGuid( &DPSPGUID_TCPIP, lpData );
3032 break;
3033 case 6:
3034 checkStr( "127.0.0.1", (LPSTR) lpData );
3035 break;
3036 default: break;
3037 }
3038
3039
3040 callbackData->dwCounter1++;
3041
3042 return TRUE;
3043}
#define checkGuid(expected, result)
Definition: dplayx.c:53
#define check(expected, result)
Definition: dplayx.c:32
#define checkStr(expected, result)
Definition: dplayx.c:44
static const struct @542 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 873 of file dplayx.c.

877{
878 lpCallbackData callbackData = lpContext;
879
880 static REFGUID types[] = { &DPAID_TotalSize,
881 &DPAID_ServiceProvider,
882 &GUID_NULL };
883 static DWORD sizes[] = { 4, 16, 0 };
884 static REFGUID sps[] = { &DPSPGUID_SERIAL, &DPSPGUID_MODEM,
885 &DPSPGUID_IPX, &DPSPGUID_TCPIP };
886
887
888 checkGuid( types[ callbackData->dwCounter2 ], guidDataType );
889 check( sizes[ callbackData->dwCounter2 ], dwDataSize );
890
891 if ( IsEqualGUID( types[0], guidDataType ) )
892 {
893 todo_wine check( 80, *((LPDWORD) lpData) );
894 }
895 else if ( IsEqualGUID( types[1], guidDataType ) )
896 {
897 BOOL found = FALSE;
898 int i;
899 for( i=0; i < ARRAY_SIZE(sps) && !found; i++ )
900 found = IsEqualGUID( sps[i], lpData );
901 ok( found, "Unknown Address type found %s\n", wine_dbgstr_guid(lpData) );
902 }
903
904 callbackData->dwCounter2++;
905
906 return TRUE;
907}
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GUID_NULL
Definition: ks.h:106
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
UINT dwCounter2
Definition: dplayx.c:73

Referenced by EnumConnections_cb().

◆ EnumConnections_cb()

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

Definition at line 909 of file dplayx.c.

915{
916
917 lpCallbackData callbackData = lpContext;
918 IDirectPlayLobby *pDPL;
919 HRESULT hr;
920
921
922 if (!callbackData->dwFlags)
923 {
924 callbackData->dwFlags = DPCONNECTION_DIRECTPLAY;
925 }
926
927 checkFlags( callbackData->dwFlags, dwFlags, FLAGS_DPCONNECTION );
928
929 /* Get info from lpConnection */
930 hr = CoCreateInstance( &CLSID_DirectPlayLobby, NULL, CLSCTX_ALL,
931 &IID_IDirectPlayLobby3A, (LPVOID*) &pDPL );
932 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlayLobby / IID_IDirectPlayLobby3A failed\n");
933 if (FAILED(hr))
934 return FALSE;
935
936 callbackData->dwCounter2 = 0;
938 dwConnectionSize, callbackData );
939 todo_wine check( 3, callbackData->dwCounter2 );
940
941 callbackData->dwCounter1++;
942
944
945 return TRUE;
946}
static BOOL CALLBACK EnumAddress_cb2(REFGUID guidDataType, DWORD dwDataSize, LPCVOID lpData, LPVOID lpContext)
Definition: dplayx.c:873
#define checkFlags(expected, result, flags)
Definition: dplayx.c:48
#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:74

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 1021 of file dplayx.c.

1027{
1028 IDirectPlay4 *pDP = lpContext;
1029 HRESULT hr;
1030
1031 /* Incorrect parameters */
1034 hr = IDirectPlayX_InitializeConnection( pDP, lpConnection, 1 );
1036
1037 /* Normal operation.
1038 We're only interested in ensuring that the TCP/IP provider works */
1039
1040 if( IsEqualGUID(lpguidSP, &DPSPGUID_TCPIP) )
1041 {
1042 hr = IDirectPlayX_InitializeConnection( pDP, lpConnection, 0 );
1043 checkHR( DP_OK, hr );
1044 hr = IDirectPlayX_InitializeConnection( pDP, lpConnection, 0 );
1046 }
1047
1048 return TRUE;
1049}
#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 4011 of file dplayx.c.

4016{
4017 lpCallbackData callbackData = lpContext;
4018 char playerIndex = dpid2char( callbackData->dpid,
4019 callbackData->dpidSize,
4020 dpId );
4021
4022
4023 /* Trace to study player ids */
4024 callbackData->szTrace1[ callbackData->dwCounter1 ] = playerIndex;
4025 callbackData->dwCounter1++;
4026 callbackData->szTrace1[ callbackData->dwCounter1 ] = '\0';
4027
4028 /* Trace to study flags received */
4029 strcat( callbackData->szTrace2,
4031 strlen("DPENUMGROUPS_") ) );
4032 strcat( callbackData->szTrace2, ":" );
4033
4034
4035 check( DPPLAYERTYPE_GROUP, dwPlayerType );
4036
4037 return TRUE;
4038}
#define DPPLAYERTYPE_GROUP
Definition: dplay.h:1134
UINT dpidSize
Definition: dplayx.c:77
DPID * dpid
Definition: dplayx.c:76

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 3680 of file dplayx.c.

3685{
3686 lpCallbackData callbackData = lpContext;
3687 char playerIndex = dpid2char( callbackData->dpid,
3688 callbackData->dpidSize,
3689 dpId );
3690
3691
3692 /* Trace to study player ids */
3693 callbackData->szTrace1[ callbackData->dwCounter1 ] = playerIndex;
3694 callbackData->dwCounter1++;
3695 callbackData->szTrace1[ callbackData->dwCounter1 ] = '\0';
3696
3697 /* Trace to study flags received */
3698 strcat( callbackData->szTrace2,
3700 strlen("DPENUMPLAYERS_") ) );
3701 strcat( callbackData->szTrace2, ":" );
3702
3703
3704 if ( playerIndex < '5' )
3705 {
3706 check( DPPLAYERTYPE_PLAYER, dwPlayerType );
3707 }
3708 else
3709 {
3710 check( DPPLAYERTYPE_GROUP, dwPlayerType );
3711 }
3712
3713 return TRUE;
3714
3715}
#define DPPLAYERTYPE_PLAYER
Definition: dplay.h:1135

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 1356 of file dplayx.c.

1360{
1361 lpCallbackData callbackData = lpContext;
1362 callbackData->dwCounter1++;
1363
1364 if ( dwFlags & DPESC_TIMEDOUT )
1365 {
1366 check( TRUE, lpThisSD == NULL );
1367 return FALSE;
1368 }
1369 check( FALSE, lpThisSD == NULL );
1370
1371
1372 if ( U2(*lpThisSD).lpszPasswordA != NULL )
1373 {
1374 check( TRUE, (lpThisSD->dwFlags & DPSESSION_PASSWORDREQUIRED) != 0 );
1375 }
1376
1377 if ( lpThisSD->dwFlags & DPSESSION_NEWPLAYERSDISABLED )
1378 {
1379 check( 0, lpThisSD->dwCurrentPlayers );
1380 }
1381
1382 check( sizeof(*lpThisSD), lpThisSD->dwSize );
1383 checkLP( NULL, U2(*lpThisSD).lpszPasswordA );
1384
1385 return TRUE;
1386}
#define U2(x)
Definition: wordpad.c:46
#define checkLP(expected, result)
Definition: dplayx.c:36
DWORD dwCurrentPlayers
Definition: dplay.h:239
DWORD dwSize
Definition: dplay.h:232

Referenced by test_EnumSessions().

◆ EnumSessions_cb2()

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

Definition at line 1183 of file dplayx.c.

1187{
1188 IDirectPlay4 *pDP = lpContext;
1189 DPSESSIONDESC2 dpsd;
1190 HRESULT hr;
1191
1192 if (dwFlags & DPESC_TIMEDOUT)
1193 return FALSE;
1194
1195
1196 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
1197 dpsd.dwSize = sizeof(DPSESSIONDESC2);
1198 dpsd.guidApplication = appGuid;
1199 dpsd.guidInstance = lpThisSD->guidInstance;
1200
1201 if ( lpThisSD->dwFlags & DPSESSION_PASSWORDREQUIRED )
1202 {
1203 /* Incorrect password */
1204 U2(dpsd).lpszPasswordA = (LPSTR) "sonic boom";
1205 hr = IDirectPlayX_Open( pDP, &dpsd, DPOPEN_JOIN );
1207
1208 /* Correct password */
1209 U2(dpsd).lpszPasswordA = (LPSTR) "hadouken";
1210 hr = IDirectPlayX_Open( pDP, &dpsd, DPOPEN_JOIN );
1211 checkHR( DP_OK, hr );
1212 }
1213 else
1214 {
1215 hr = IDirectPlayX_Open( pDP, &dpsd, DPOPEN_JOIN );
1216 checkHR( DP_OK, hr );
1217 }
1218
1219 hr = IDirectPlayX_Close( pDP );
1220 checkHR( DP_OK, hr );
1221
1222 return TRUE;
1223}
#define IDirectPlayX_Close(p)
Definition: dplay.h:869
struct tagDPSESSIONDESC2 DPSESSIONDESC2
GUID guidApplication
Definition: dplay.h:235
GUID guidInstance
Definition: dplay.h:234

Referenced by test_Open().

◆ EnumSessions_cb_EnumGroups()

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

Definition at line 4040 of file dplayx.c.

4044{
4045 lpCallbackData callbackData = lpContext;
4046 HRESULT hr;
4047
4048 if (dwFlags & DPESC_TIMEDOUT)
4049 {
4050 return FALSE;
4051 }
4052
4053 /* guid = NULL */
4054 callbackData->dwCounter1 = 0;
4055 hr = IDirectPlayX_EnumGroups( callbackData->pDP, NULL,
4056 EnumGroups_cb, &callbackData, 0 );
4058 check( 0, callbackData->dwCounter1 );
4059
4060 /* guid = appGuid */
4061 callbackData->dwCounter1 = 0;
4062 hr = IDirectPlayX_EnumGroups( callbackData->pDP, (LPGUID) &appGuid,
4063 EnumGroups_cb, &callbackData, 0 );
4065 check( 0, callbackData->dwCounter1 );
4066
4067 callbackData->dwCounter1 = 0;
4068 hr = IDirectPlayX_EnumGroups( callbackData->pDP, (LPGUID) &appGuid,
4069 EnumGroups_cb, &callbackData,
4072 check( 0, callbackData->dwCounter1 );
4073
4074 /* guid = guidInstance */
4075 callbackData->dwCounter1 = 0;
4076 hr = IDirectPlayX_EnumGroups( callbackData->pDP,
4077 (LPGUID) &lpThisSD->guidInstance,
4078 EnumGroups_cb, &callbackData, 0 );
4080 check( 0, callbackData->dwCounter1 );
4081
4082 callbackData->dwCounter1 = 0;
4083 hr = IDirectPlayX_EnumGroups( callbackData->pDP,
4084 (LPGUID) &lpThisSD->guidInstance,
4085 EnumGroups_cb, &callbackData,
4087 checkHR( DPERR_GENERIC, hr ); /* Why? */
4088 check( 0, callbackData->dwCounter1 );
4089
4090 return TRUE;
4091
4092}
#define DPENUMGROUPS_SESSION
Definition: dplay.h:998
#define IDirectPlayX_EnumGroups(p, a, b, c, d)
Definition: dplay.h:876
static BOOL CALLBACK EnumGroups_cb(DPID dpId, DWORD dwPlayerType, LPCDPNAME lpName, DWORD dwFlags, LPVOID lpContext)
Definition: dplayx.c:4011
IDirectPlay4 * pDP
Definition: dplayx.c:72

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 3717 of file dplayx.c.

3721{
3722 lpCallbackData callbackData = lpContext;
3723 HRESULT hr;
3724
3725 if (dwFlags & DPESC_TIMEDOUT)
3726 {
3727 return FALSE;
3728 }
3729
3730 /* guid = NULL */
3731 callbackData->dwCounter1 = 0;
3733 &callbackData, 0 );
3735 check( 0, callbackData->dwCounter1 );
3736
3737 /* guid = appGuid */
3738 callbackData->dwCounter1 = 0;
3739 hr = IDirectPlayX_EnumPlayers( callbackData->pDP, (LPGUID) &appGuid,
3740 EnumPlayers_cb, &callbackData, 0 );
3742 check( 0, callbackData->dwCounter1 );
3743
3744 callbackData->dwCounter1 = 0;
3745 hr = IDirectPlayX_EnumPlayers( callbackData->pDP, (LPGUID) &appGuid,
3746 EnumPlayers_cb, &callbackData,
3749 check( 0, callbackData->dwCounter1 );
3750
3751 /* guid = guidInstance */
3752 callbackData->dwCounter1 = 0;
3753 hr = IDirectPlayX_EnumPlayers( callbackData->pDP,
3754 (LPGUID) &lpThisSD->guidInstance,
3755 EnumPlayers_cb, &callbackData, 0 );
3757 check( 0, callbackData->dwCounter1 );
3758
3759 callbackData->dwCounter1 = 0;
3760 hr = IDirectPlayX_EnumPlayers( callbackData->pDP,
3761 (LPGUID) &lpThisSD->guidInstance,
3762 EnumPlayers_cb, &callbackData,
3764 checkHR( DPERR_GENERIC, hr ); /* Why? */
3765 check( 0, callbackData->dwCounter1 );
3766
3767 return TRUE;
3768
3769}
#define IDirectPlayX_EnumPlayers(p, a, b, c, d)
Definition: dplay.h:877
static BOOL CALLBACK EnumPlayers_cb(DPID dpId, DWORD dwPlayerType, LPCDPNAME lpName, DWORD dwFlags, LPVOID lpContext)
Definition: dplayx.c:3680

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 2828 of file dplayx.c.

2832{
2833 IDirectPlay4 *pDP = lpContext;
2834 DPSESSIONDESC2 dpsd;
2835 DPCREDENTIALS dpCredentials;
2836 HRESULT hr;
2837
2838 if (dwFlags & DPESC_TIMEDOUT)
2839 {
2840 return FALSE;
2841 }
2842
2844
2845 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
2846 dpsd.dwSize = sizeof(DPSESSIONDESC2);
2847 dpsd.guidApplication = appGuid;
2848 dpsd.guidInstance = lpThisSD->guidInstance;
2849
2850 ZeroMemory( &dpCredentials, sizeof(DPCREDENTIALS) );
2851 dpCredentials.dwSize = sizeof(DPCREDENTIALS);
2852 U1(dpCredentials).lpszUsernameA = (LPSTR) "user";
2853 U2(dpCredentials).lpszPasswordA = (LPSTR) "pass";
2854 hr = IDirectPlayX_SecureOpen( pDP, &dpsd, DPOPEN_JOIN,
2855 NULL, &dpCredentials );
2856 checkHR( DPERR_LOGONDENIED, hr ); /* TODO: Make this work */
2857
2858 return TRUE;
2859}
#define IDirectPlayX_SecureOpen(p, a, b, c, d)
Definition: dplay.h:905
struct tagDPCREDENTIALS DPCREDENTIALS
DWORD dwSize
Definition: dplay.h:337

Referenced by test_GetPlayerAccount().

◆ get_temp_buffer()

static LPSTR get_temp_buffer ( void  )
static

Definition at line 88 of file dplayx.c.

89{
90 static UINT index = 0;
91 static char buff[10][256];
92
93 index = (index + 1) % 10;
94 *buff[index] = 0;
95
96 return buff[index];
97}
#define index(s, c)
Definition: various.h:29
static unsigned char buff[32768]
Definition: fatten.c:17
GLuint index
Definition: glext.h:6031

Referenced by dpResult2str(), dwFlags2str(), wine_dbgstr_propvariant(), and wine_debugstr_an().

◆ Guid2str()

static LPCSTR Guid2str ( const GUID guid)
static

Definition at line 100 of file dplayx.c.

101{
102 if (!guid) return "(null)";
103
104 /* Service providers */
105 if (IsEqualGUID(guid, &DPSPGUID_IPX))
106 return "DPSPGUID_IPX";
107 if (IsEqualGUID(guid, &DPSPGUID_TCPIP))
108 return "DPSPGUID_TCPIP";
109 if (IsEqualGUID(guid, &DPSPGUID_SERIAL))
110 return "DPSPGUID_SERIAL";
111 if (IsEqualGUID(guid, &DPSPGUID_MODEM))
112 return "DPSPGUID_MODEM";
113 /* DirectPlay Address IDs */
114 if (IsEqualGUID(guid, &DPAID_TotalSize))
115 return "DPAID_TotalSize";
116 if (IsEqualGUID(guid, &DPAID_ServiceProvider))
117 return "DPAID_ServiceProvider";
118 if (IsEqualGUID(guid, &DPAID_LobbyProvider))
119 return "DPAID_LobbyProvider";
120 if (IsEqualGUID(guid, &DPAID_Phone))
121 return "DPAID_Phone";
122 if (IsEqualGUID(guid, &DPAID_PhoneW))
123 return "DPAID_PhoneW";
124 if (IsEqualGUID(guid, &DPAID_Modem))
125 return "DPAID_Modem";
126 if (IsEqualGUID(guid, &DPAID_ModemW))
127 return "DPAID_ModemW";
128 if (IsEqualGUID(guid, &DPAID_INet))
129 return "DPAID_INet";
130 if (IsEqualGUID(guid, &DPAID_INetW))
131 return "DPAID_INetW";
132 if (IsEqualGUID(guid, &DPAID_INetPort))
133 return "DPAID_INetPort";
134 if (IsEqualGUID(guid, &DPAID_ComPort))
135 return "DPAID_ComPort";
136
137 return wine_dbgstr_guid(guid);
138}

◆ HRESULT()

static HRESULT ( WINAPI pDirectPlayEnumerateA)
static

◆ init_TCPIP_provider()

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

Definition at line 654 of file dplayx.c.

655{
656
657 DPCOMPOUNDADDRESSELEMENT addressElements[3];
658 LPVOID pAddress = NULL;
659 DWORD dwAddressSize = 0;
660 IDirectPlayLobby3 *pDPL;
661 HRESULT hr;
662
663 hr = CoCreateInstance( &CLSID_DirectPlayLobby, NULL, CLSCTX_ALL,
664 &IID_IDirectPlayLobby3A, (LPVOID*) &pDPL );
665 ok (SUCCEEDED (hr), "CCI of CLSID_DirectPlayLobby / IID_IDirectPlayLobby3A failed\n");
666 if (FAILED (hr)) return;
667
668 /* Service provider */
669 addressElements[0].guidDataType = DPAID_ServiceProvider;
670 addressElements[0].dwDataSize = sizeof(GUID);
671 addressElements[0].lpData = (LPVOID) &DPSPGUID_TCPIP;
672
673 /* IP address string */
674 addressElements[1].guidDataType = DPAID_INet;
675 addressElements[1].dwDataSize = lstrlenA(strIPAddressString) + 1;
676 addressElements[1].lpData = (LPVOID) strIPAddressString;
677
678 /* Optional Port number */
679 if( port > 0 )
680 {
681 addressElements[2].guidDataType = DPAID_INetPort;
682 addressElements[2].dwDataSize = sizeof(WORD);
683 addressElements[2].lpData = &port;
684 }
685
686
687 hr = IDirectPlayLobby_CreateCompoundAddress( pDPL, addressElements, 2,
688 NULL, &dwAddressSize );
690
691 if( hr == DPERR_BUFFERTOOSMALL )
692 {
693 pAddress = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwAddressSize );
694 hr = IDirectPlayLobby_CreateCompoundAddress( pDPL, addressElements, 2,
695 pAddress, &dwAddressSize );
696 checkHR( DP_OK, hr );
697 }
698
699 hr = IDirectPlayX_InitializeConnection( pDP, pAddress, 0 );
700 checkHR( DP_OK, hr );
701
702 HeapFree( GetProcessHeap(), 0, pAddress );
704}
USHORT port
Definition: uri.c:228
#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_CreateGroup(), 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_GroupOwner(), test_groups_cs(), test_groups_p2p(), test_host_migration(), test_Open(), 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 6758 of file dplayx.c.

6759{
6760 HRESULT hr, init;
6761 INetFwMgr *mgr = NULL;
6764 VARIANT_BOOL enabled = VARIANT_FALSE;
6765
6767
6768 hr = CoCreateInstance( &CLSID_NetFwMgr, NULL, CLSCTX_INPROC_SERVER, &IID_INetFwMgr,
6769 (void **)&mgr );
6770 ok( hr == S_OK, "got %08x\n", hr );
6771 if (hr != S_OK) goto done;
6772
6773 hr = INetFwMgr_get_LocalPolicy( mgr, &policy );
6774 ok( hr == S_OK, "got %08x\n", hr );
6775 if (hr != S_OK) goto done;
6776
6777 hr = INetFwPolicy_get_CurrentProfile( policy, &profile );
6778 if (hr != S_OK) goto done;
6779
6780 hr = INetFwProfile_get_FirewallEnabled( profile, &enabled );
6781 ok( hr == S_OK, "got %08x\n", hr );
6782
6783done:
6784 if (policy) INetFwPolicy_Release( policy );
6785 if (profile) INetFwProfile_Release( profile );
6786 if (mgr) INetFwMgr_Release( mgr );
6787 if (SUCCEEDED( init )) CoUninitialize();
6788 return (enabled == VARIANT_TRUE);
6789}
WINBASEAPI _Check_return_ _Out_ AppPolicyProcessTerminationMethod * policy
Definition: appmodel.h:47
short VARIANT_BOOL
Definition: compat.h:2290
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
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:278
static int init
Definition: wintirpc.c:33

Referenced by START_TEST().

◆ is_process_elevated()

static BOOL is_process_elevated ( void  )
static

Definition at line 6742 of file dplayx.c.

6743{
6744 HANDLE token;
6746 {
6748 DWORD size;
6749 BOOL ret;
6750
6752 CloseHandle( token );
6753 return (ret && type == TokenElevationTypeFull);
6754 }
6755 return FALSE;
6756}
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 CloseHandle
Definition: compat.h:739
#define GetCurrentProcess()
Definition: compat.h:759
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
int ret
enum _TOKEN_ELEVATION_TYPE TOKEN_ELEVATION_TYPE
@ TokenElevationTypeFull
Definition: winnt_old.h:2516
#define TOKEN_QUERY
Definition: setypes.h:928
@ TokenElevationType
Definition: setypes.h:983

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 6899 of file dplayx.c.

6900{
6901 DWORD size, ver;
6902 BOOL isstub = FALSE;
6903 char *p, *data;
6904
6906 if (!size) return FALSE;
6907
6909 if (!data) return FALSE;
6910
6912 {
6913 char buf[256];
6914
6915 sprintf(buf, "\\StringFileInfo\\%04x%04x\\OriginalFilename", MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 1200);
6916 if (VerQueryValueA(data, buf, (void**)&p, &size))
6917 isstub = !lstrcmpiA("wcodstub.dll", p);
6918 }
6920
6921 return isstub;
6922}
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4224
DWORD WINAPI GetFileVersionInfoSizeA(LPCSTR filename, LPDWORD handle)
Definition: version.c:619
BOOL WINAPI VerQueryValueA(LPCVOID pBlock, LPCSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
Definition: version.c:1001
BOOL WINAPI GetFileVersionInfoA(LPCSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition: version.c:853
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLfloat GLfloat p
Definition: glext.h:8902
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().

◆ set_firewall()

static HRESULT set_firewall ( enum firewall_op  op)
static

Definition at line 6791 of file dplayx.c.

6792{
6793 static const WCHAR dplaysvrW[] =
6794 {'d','p','l','a','y','s','v','r','.','e','x','e',0};
6795 static const WCHAR separator[] = {'\\',0};
6796 static const WCHAR clientW[] =
6797 {'d','p','l','a','y','_','c','l','i','e','n','t',0};
6798 static const WCHAR serverW[] =
6799 {'d','p','l','a','y','_','s','e','r','v','e','r',0};
6800 HRESULT hr, init;
6801 INetFwMgr *mgr = NULL;
6808
6810 {
6812 return E_FAIL;
6813 }
6814
6816 {
6818 return E_FAIL;
6819 }
6821 lstrcatW(path, dplaysvrW);
6822
6824
6825 hr = CoCreateInstance( &CLSID_NetFwMgr, NULL, CLSCTX_INPROC_SERVER, &IID_INetFwMgr,
6826 (void **)&mgr );
6827 ok( hr == S_OK, "got %08x\n", hr );
6828 if (hr != S_OK) goto done;
6829
6830 hr = INetFwMgr_get_LocalPolicy( mgr, &policy );
6831 ok( hr == S_OK, "got %08x\n", hr );
6832 if (hr != S_OK) goto done;
6833
6834 hr = INetFwPolicy_get_CurrentProfile( policy, &profile );
6835 if (hr != S_OK) goto done;
6836
6837 hr = INetFwProfile_get_AuthorizedApplications( profile, &apps );
6838 ok( hr == S_OK, "got %08x\n", hr );
6839 if (hr != S_OK) goto done;
6840
6841 hr = CoCreateInstance( &CLSID_NetFwAuthorizedApplication, NULL, CLSCTX_INPROC_SERVER,
6842 &IID_INetFwAuthorizedApplication, (void **)&app );
6843 ok( hr == S_OK, "got %08x\n", hr );
6844 if (hr != S_OK) goto done;
6845
6846 hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image );
6847 if (hr != S_OK) goto done;
6848
6849 name = SysAllocString( clientW );
6850 hr = INetFwAuthorizedApplication_put_Name( app, name );
6852 ok( hr == S_OK, "got %08x\n", hr );
6853 if (hr != S_OK) goto done;
6854
6855 if (op == APP_ADD)
6856 hr = INetFwAuthorizedApplications_Add( apps, app );
6857 else if (op == APP_REMOVE)
6858 hr = INetFwAuthorizedApplications_Remove( apps, image );
6859 else
6860 hr = E_INVALIDARG;
6861 if (hr != S_OK) goto done;
6862
6863 INetFwAuthorizedApplication_Release( app );
6864 hr = CoCreateInstance( &CLSID_NetFwAuthorizedApplication, NULL, CLSCTX_INPROC_SERVER,
6865 &IID_INetFwAuthorizedApplication, (void **)&app );
6866 ok( hr == S_OK, "got %08x\n", hr );
6867 if (hr != S_OK) goto done;
6868
6871 hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image );
6872 if (hr != S_OK) goto done;
6873
6874 name = SysAllocString( serverW );
6875 hr = INetFwAuthorizedApplication_put_Name( app, name );
6877 ok( hr == S_OK, "got %08x\n", hr );
6878 if (hr != S_OK) goto done;
6879
6880 if (op == APP_ADD)
6881 hr = INetFwAuthorizedApplications_Add( apps, app );
6882 else if (op == APP_REMOVE)
6883 hr = INetFwAuthorizedApplications_Remove( apps, image );
6884 else
6885 hr = E_INVALIDARG;
6886
6887done:
6888 if (app) INetFwAuthorizedApplication_Release( app );
6889 if (apps) INetFwAuthorizedApplications_Release( apps );
6890 if (policy) INetFwPolicy_Release( policy );
6891 if (profile) INetFwProfile_Release( profile );
6892 if (mgr) INetFwMgr_Release( mgr );
6893 if (SUCCEEDED( init )) CoUninitialize();
6895 return hr;
6896}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
UINT op
Definition: effect.c:236
OLECHAR * BSTR
Definition: compat.h:2293
#define MAX_PATH
Definition: compat.h:34
static const WCHAR separator[]
Definition: asmname.c:65
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:2313
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( dplayx  )

Definition at line 6924 of file dplayx.c.

6925{
6926 BOOL firewall_enabled;
6927 HRESULT hr;
6928 char path[MAX_PATH];
6930
6932 {
6933 skip("Failed to get systems directory\n");
6934 return;
6935 }
6936 strcat(path, "\\dplayx.dll");
6937
6939 {
6940 win_skip("dpnet is a stub dll, skipping tests\n");
6941 return;
6942 }
6943
6944 if ((firewall_enabled = is_firewall_enabled()) && !is_process_elevated())
6945 {
6946 skip("no privileges, skipping tests to avoid firewall dialog\n");
6947 return;
6948 }
6949
6950 if (firewall_enabled)
6951 {
6953 if (hr != S_OK)
6954 {
6955 skip("can't authorize app in firewall %08x\n", hr);
6956 return;
6957 }
6958 }
6959
6960 CoInitialize( NULL );
6961
6962 module = LoadLibraryA("dplayx.dll");
6963
6964 pDirectPlayEnumerateA = (void *)GetProcAddress(module, "DirectPlayEnumerateA");
6965 pDirectPlayEnumerateW = (void *)GetProcAddress(module, "DirectPlayEnumerateW");
6966 pDirectPlayCreate = (void *)GetProcAddress(module, "DirectPlayCreate");
6967
6968 test_COM();
6974 test_GetCaps();
6976
6978 {
6979 skip("Run in interactive mode to run all dplayx tests.\n");
6980 goto done;
6981 }
6982
6983 trace("Running in interactive mode, tests will take a while\n");
6984
6985 /* test_Open() takes almost a minute, */
6986 test_Open();
6987 /* test_EnumSession takes three minutes */
6990
6991 /* test_CreatePlayer() takes over a minute */
6996
6997 /* test_GetPlayerAccount() takes over 30s */
7001
7004
7008
7011
7012 test_Send();
7013 test_Receive();
7016
7019
7020done:
7023 if (firewall_enabled) set_firewall(APP_REMOVE);
7024}
#define skip(...)
Definition: atltest.h:64
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2283
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
static void test_groups_p2p(void)
Definition: dplayx.c:4555
static void test_EnumerateProviders(void)
Definition: dplayx.c:800
static void test_GetPlayerCaps(void)
Definition: dplayx.c:2148
static void test_host_migration(void)
Definition: dplayx.c:6411
static BOOL is_stub_dll(const char *filename)
Definition: dplayx.c:6899
static void test_CreateGroup(void)
Definition: dplayx.c:3293
static void test_EnumGroups(void)
Definition: dplayx.c:4094
static void test_COM_dplobby(void)
Definition: dplayx.c:6644
static void test_DirectPlayCreate(void)
Definition: dplayx.c:734
static void test_SessionDesc(void)
Definition: dplayx.c:1793
static void test_GetPlayerFlags(void)
Definition: dplayx.c:3185
static HRESULT set_firewall(enum firewall_op op)
Definition: dplayx.c:6791
static void test_GetPlayerAddress(void)
Definition: dplayx.c:3045
static void test_Open(void)
Definition: dplayx.c:1225
static void test_GetMessageCount(void)
Definition: dplayx.c:5647
static void test_EnumPlayers(void)
Definition: dplayx.c:3771
static void test_EnumConnections(void)
Definition: dplayx.c:948
static void test_InitializeConnection(void)
Definition: dplayx.c:1051
static void test_Send(void)
Definition: dplayx.c:5027
static void test_groups_cs(void)
Definition: dplayx.c:4790
static void test_GetCaps(void)
Definition: dplayx.c:1070
static void test_Receive(void)
Definition: dplayx.c:5362
static BOOL is_process_elevated(void)
Definition: dplayx.c:6742
static void test_EnumGroupsInGroup(void)
Definition: dplayx.c:4321
static void test_GetPlayerAccount(void)
Definition: dplayx.c:2861
static void test_EnumSessions(void)
Definition: dplayx.c:1421
static void test_PlayerData(void)
Definition: dplayx.c:2312
static BOOL is_firewall_enabled(void)
Definition: dplayx.c:6758
static void test_GetMessageQueue(void)
Definition: dplayx.c:5870
static void test_PlayerName(void)
Definition: dplayx.c:2577
static void test_CreatePlayer(void)
Definition: dplayx.c:1975
static void test_COM(void)
Definition: dplayx.c:6543
static void test_remote_data_replication(void)
Definition: dplayx.c:6183
static void test_GroupOwner(void)
Definition: dplayx.c:3602
static void test_EnumAddressTypes(void)
Definition: dplayx.c:1134
#define win_skip
Definition: test.h:163
int winetest_interactive

◆ test_COM()

static void test_COM ( void  )
static

Definition at line 6543 of file dplayx.c.

6544{
6545 IDirectPlay *dp;
6546 IDirectPlay2A *dp2A;
6547 IDirectPlay2 *dp2;
6548 IDirectPlay3A *dp3A;
6549 IDirectPlay3 *dp3;
6550 IDirectPlay4A *dp4A;
6551#ifdef __REACTOS__
6552 IDirectPlay4 *dp4 = (IDirectPlay4*)(ULONG_PTR)0xdeadbeefdeadbeefull;
6553#else
6554 IDirectPlay4 *dp4 = (IDirectPlay4*)0xdeadbeef;
6555#endif
6556 IUnknown *unk;
6557 ULONG refcount;
6558 HRESULT hr;
6559
6560 /* COM aggregation */
6561#ifdef __REACTOS__
6562 hr = CoCreateInstance(&CLSID_DirectPlay, (IUnknown*)(ULONG_PTR)0xdeadbeefdeadbeefull, CLSCTX_INPROC_SERVER,
6563 &IID_IUnknown, (void**)&dp4);
6564#else
6565 hr = CoCreateInstance(&CLSID_DirectPlay, (IUnknown*)0xdeadbeef, CLSCTX_INPROC_SERVER,
6566 &IID_IUnknown, (void**)&dp4);
6567#endif
6569 "DirectPlay create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr);
6570#ifdef __REACTOS__
6571 ok(!dp4 || dp4 == (IDirectPlay4*)(ULONG_PTR)0xdeadbeefdeadbeefull, "dp4 = %p\n", dp4);
6572#else
6573 ok(!dp4 || dp4 == (IDirectPlay4*)0xdeadbeef, "dp4 = %p\n", dp4);
6574#endif
6575
6576 /* Invalid RIID */
6577 hr = CoCreateInstance(&CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlayLobby,
6578 (void**)&dp4);
6579 ok(hr == E_NOINTERFACE, "DirectPlay create failed: %08x, expected E_NOINTERFACE\n", hr);
6580
6581 /* Different refcount for all DirectPlay Interfaces */
6582 hr = CoCreateInstance(&CLSID_DirectPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay4,
6583 (void**)&dp4);
6584 ok(hr == S_OK, "DirectPlay create failed: %08x, expected S_OK\n", hr);
6585 refcount = IDirectPlayX_AddRef(dp4);
6586 ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
6587
6588 hr = IDirectPlayX_QueryInterface(dp4, &IID_IDirectPlay2A, (void**)&dp2A);
6589 ok(hr == S_OK, "QueryInterface for IID_IDirectPlay2A failed: %08x\n", hr);
6590 refcount = IDirectPlay2_AddRef(dp2A);
6591 ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
6593
6594 hr = IDirectPlayX_QueryInterface(dp4, &IID_IDirectPlay2, (void**)&dp2);
6595 ok(hr == S_OK, "QueryInterface for IID_IDirectPlay2 failed: %08x\n", hr);
6596 refcount = IDirectPlay2_AddRef(dp2);
6597 ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
6599
6600 hr = IDirectPlayX_QueryInterface(dp4, &IID_IDirectPlay3A, (void**)&dp3A);
6601 ok(hr == S_OK, "QueryInterface for IID_IDirectPlay3A failed: %08x\n", hr);
6602 refcount = IDirectPlay3_AddRef(dp3A);
6603 ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
6605
6606 hr = IDirectPlayX_QueryInterface(dp4, &IID_IDirectPlay3, (void**)&dp3);
6607 ok(hr == S_OK, "QueryInterface for IID_IDirectPlay3 failed: %08x\n", hr);
6608 refcount = IDirectPlay3_AddRef(dp3);
6609 ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
6611
6612 hr = IDirectPlayX_QueryInterface(dp4, &IID_IDirectPlay4A, (void**)&dp4A);
6613 ok(hr == S_OK, "QueryInterface for IID_IDirectPlay4A failed: %08x\n", hr);
6614 refcount = IDirectPlayX_AddRef(dp4A);
6615 ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
6617
6618 /* IDirectPlay and IUnknown share a refcount */
6619 hr = IDirectPlayX_QueryInterface(dp4, &IID_IDirectPlay, (void**)&dp);
6620 ok(hr == S_OK, "QueryInterface for IID_IDirectPlay failed: %08x\n", hr);
6621 refcount = IDirectPlayX_AddRef(dp);
6622 ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
6624
6625 hr = IDirectPlayX_QueryInterface(dp4, &IID_IUnknown, (void**)&unk);
6626 ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
6627 refcount = IUnknown_AddRef(unk);
6628 ok(refcount == 3, "refcount == %u, expected 3\n", refcount);
6629 refcount = IUnknown_Release(unk);
6630 ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
6631
6632 IUnknown_Release(unk);
6640 refcount = IDirectPlayX_Release(dp4);
6641 ok(refcount == 0, "refcount == %u, expected 0\n", refcount);
6642}
#define broken(x)
Definition: atltest.h:178
const GUID IID_IUnknown
#define IDirectPlayX_Release(p)
Definition: dplay.h:866
#define IDirectPlayX_QueryInterface(p, a, b)
Definition: dplay.h:864
#define IDirectPlayX_AddRef(p)
Definition: dplay.h:865
#define IDirectPlay_Release(p)
Definition: dplay.h:462
#define IDirectPlay2_AddRef(p)
Definition: dplay.h:563
#define IDirectPlay2_Release(p)
Definition: dplay.h:564
struct IDirectPlay3 IDirectPlay3A
Definition: dplay.h:53
#define IDirectPlay3_Release(p)
Definition: dplay.h:696
struct IDirectPlay4 IDirectPlay4A
Definition: dplay.h:59
struct IDirectPlay2 IDirectPlay2A
Definition: dplay.h:47
#define IDirectPlay3_AddRef(p)
Definition: dplay.h:695
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
#define E_NOINTERFACE
Definition: winerror.h:2364

Referenced by START_TEST().

◆ test_COM_dplobby()

static void test_COM_dplobby ( void  )
static

Definition at line 6644 of file dplayx.c.

6645{
6646#ifdef __REACTOS__
6647 IDirectPlayLobby *dpl = (IDirectPlayLobby*)(ULONG_PTR)0xdeadbeefdeadbeefull;
6648#else
6649 IDirectPlayLobby *dpl = (IDirectPlayLobby*)0xdeadbeef;
6650#endif
6651 IDirectPlayLobbyA *dplA;
6652 IDirectPlayLobby2A *dpl2A;
6653 IDirectPlayLobby2 *dpl2;
6654 IDirectPlayLobby3A *dpl3A;
6655 IDirectPlayLobby3 *dpl3;
6656 IUnknown *unk;
6657 ULONG refcount;
6658 HRESULT hr;
6659
6660 /* COM aggregation */
6661#ifdef __REACTOS__
6662 hr = CoCreateInstance(&CLSID_DirectPlayLobby, (IUnknown*)(ULONG_PTR)0xdeadbeefdeadbeefull, CLSCTX_INPROC_SERVER,
6663 &IID_IUnknown, (void**)&dpl);
6664#else
6665 hr = CoCreateInstance(&CLSID_DirectPlayLobby, (IUnknown*)0xdeadbeef, CLSCTX_INPROC_SERVER,
6666 &IID_IUnknown, (void**)&dpl);
6667#endif
6669 "DirectPlayLobby create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr);
6670#ifdef __REACTOS__
6671 ok(!dpl || dpl == (IDirectPlayLobby*)(ULONG_PTR)0xdeadbeefdeadbeefull, "dpl = %p\n", dpl);
6672#else
6673 ok(!dpl || dpl == (IDirectPlayLobby*)0xdeadbeef, "dpl = %p\n", dpl);
6674#endif
6675
6676 /* Invalid RIID */
6677 hr = CoCreateInstance(&CLSID_DirectPlayLobby, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay,
6678 (void**)&dpl);
6679 ok(hr == E_NOINTERFACE, "DirectPlayLobby create failed: %08x, expected E_NOINTERFACE\n", hr);
6680
6681 /* Different refcount for all DirectPlayLobby Interfaces */
6682 hr = CoCreateInstance(&CLSID_DirectPlayLobby, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlayLobby,
6683 (void**)&dpl);
6684 ok(hr == S_OK, "DirectPlayLobby create failed: %08x, expected S_OK\n", hr);
6685 refcount = IDirectPlayLobby_AddRef(dpl);
6686 ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
6687
6688 hr = IDirectPlayLobby_QueryInterface(dpl, &IID_IDirectPlayLobbyA, (void**)&dplA);
6689 ok(hr == S_OK, "QueryInterface for IID_IDirectPlayLobbyA failed: %08x\n", hr);
6690 refcount = IDirectPlayLobby_AddRef(dplA);
6691 ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
6693
6694 hr = IDirectPlayLobby_QueryInterface(dpl, &IID_IDirectPlayLobby2, (void**)&dpl2);
6695 ok(hr == S_OK, "QueryInterface for IID_IDirectPlayLobby2 failed: %08x\n", hr);
6696 refcount = IDirectPlayLobby_AddRef(dpl2);
6697 ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
6699
6700 hr = IDirectPlayLobby_QueryInterface(dpl, &IID_IDirectPlayLobby2A, (void**)&dpl2A);
6701 ok(hr == S_OK, "QueryInterface for IID_IDirectPlayLobby2A failed: %08x\n", hr);
6702 refcount = IDirectPlayLobby_AddRef(dpl2A);
6703 ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
6705
6706 hr = IDirectPlayLobby_QueryInterface(dpl, &IID_IDirectPlayLobby3, (void**)&dpl3);
6707 ok(hr == S_OK, "QueryInterface for IID_IDirectPlayLobby3 failed: %08x\n", hr);
6708 refcount = IDirectPlayLobby_AddRef(dpl3);
6709 ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
6711
6712 hr = IDirectPlayLobby_QueryInterface(dpl, &IID_IDirectPlayLobby3A, (void**)&dpl3A);
6713 ok(hr == S_OK, "QueryInterface for IID_IDirectPlayLobby3A failed: %08x\n", hr);
6714 refcount = IDirectPlayLobby_AddRef(dpl3A);
6715 ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
6717
6718 /* IDirectPlayLobby and IUnknown share a refcount */
6719 hr = IDirectPlayX_QueryInterface(dpl, &IID_IUnknown, (void**)&unk);
6720 ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
6721 refcount = IUnknown_AddRef(unk);
6722 ok(refcount == 4, "refcount == %u, expected 4\n", refcount);
6724
6725 IUnknown_Release(unk);
6732 refcount = IDirectPlayLobby_Release(dpl);
6733 ok(refcount == 0, "refcount == %u, expected 0\n", refcount);
6734}
#define IDirectPlayLobby_QueryInterface(p, a, b)
Definition: dplobby.h:454
struct IDirectPlayLobby2 IDirectPlayLobby2A
Definition: dplobby.h:44
struct IDirectPlayLobby3 IDirectPlayLobby3A
Definition: dplobby.h:50
#define IDirectPlayLobby_AddRef(p)
Definition: dplobby.h:455
struct IDirectPlayLobby IDirectPlayLobbyA
Definition: dplobby.h:38

Referenced by START_TEST().

◆ test_CreateGroup()

static void test_CreateGroup ( void  )
static

Definition at line 3293 of file dplayx.c.

3294{
3295
3296 IDirectPlay4 *pDP;
3297 DPSESSIONDESC2 dpsd;
3298 DPID idFrom, idTo, dpid, idGroup, idGroupParent;
3299 DPNAME groupName;
3300 HRESULT hr;
3301 UINT i;
3302
3303 LPCSTR lpData = "data";
3304 DWORD dwDataSize = strlen(lpData)+1;
3307 1024 );
3308 DWORD dwDataSizeGet = 1024;
3309 CallbackData callbackData;
3310
3311
3312 hr= CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
3313 &IID_IDirectPlay4A, (LPVOID*) &pDP );
3314 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
3315 if (FAILED(hr)) return;
3316 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
3317 dpsd.dwSize = sizeof(DPSESSIONDESC2);
3318 dpsd.guidApplication = appGuid;
3319 dpsd.dwMaxPlayers = 10;
3320 ZeroMemory( &groupName, sizeof(DPNAME) );
3321
3322
3323 /* No service provider */
3324 hr = IDirectPlayX_CreateGroup( pDP, &idGroup, NULL, NULL, 0, 0 );
3326
3327 hr = IDirectPlayX_CreateGroupInGroup( pDP, 0, &idGroup, NULL, NULL, 0, 0 );
3329
3330
3331
3332 init_TCPIP_provider( pDP, "127.0.0.1", 0 );
3333
3334
3335 /* No session */
3336 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
3337 NULL, NULL, 0, 0 );
3339
3340 if ( hr == DPERR_UNINITIALIZED )
3341 {
3342 todo_wine win_skip( "CreateGroup not implemented\n" );
3343 return;
3344 }
3345
3346 hr = IDirectPlayX_CreateGroupInGroup( pDP, 0, &idGroup,
3347 NULL, NULL, 0, 0 );
3349
3350 hr = IDirectPlayX_CreateGroupInGroup( pDP, 2, &idGroup,
3351 NULL, NULL, 0, 0 );
3353
3354
3355 hr = IDirectPlayX_Open( pDP, &dpsd, DPOPEN_CREATE );
3356 checkHR( DP_OK, hr );
3357 IDirectPlayX_CreatePlayer( pDP, &dpid,
3358 NULL, NULL, NULL, 0, 0 );
3359
3360
3361
3362 /* With name */
3363 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
3364 NULL, NULL, 0, 0 );
3365 checkHR( DP_OK, hr );
3366
3367 hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroup, &idGroup,
3368 NULL, NULL, 0, 0 );
3369 checkHR( DP_OK, hr );
3370
3371 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
3372 &groupName, NULL, 0, 0 );
3373 checkHR( DP_OK, hr );
3374
3375 hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroup, &idGroup,
3376 &groupName, NULL, 0, 0 );
3377 checkHR( DP_OK, hr );
3378
3379
3380 groupName.dwSize = sizeof(DPNAME);
3381 U1(groupName).lpszShortNameA = (LPSTR) lpData;
3382
3383
3384 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
3385 &groupName, NULL, 0, 0 );
3386 checkHR( DP_OK, hr );
3387
3388 hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroup, &idGroup,
3389 &groupName, NULL, 0, 0 );
3390 checkHR( DP_OK, hr );
3391
3392
3393 /* Message checking */
3394 for (i=0; i<6; i++)
3395 {
3396 dwDataSizeGet = 1024;
3397 hr = IDirectPlayX_Receive( pDP, &idFrom, &idTo, 0, lpDataGet,
3398 &dwDataSizeGet );
3399 checkHR( DP_OK, hr );
3400 if ( NULL == U1(lpDataGet->dpnName).lpszShortNameA )
3401 {
3402 check( 48, dwDataSizeGet );
3403 }
3404 else
3405 {
3406 check( 48 + dwDataSize, dwDataSizeGet );
3407 checkStr( lpData, U1(lpDataGet->dpnName).lpszShortNameA );
3408 }
3409 check( DPID_SYSMSG, idFrom );
3411 check( DPPLAYERTYPE_GROUP, lpDataGet->dwPlayerType );
3413 }
3414 check_messages( pDP, &dpid, 1, &callbackData );
3415 checkStr( "", callbackData.szTrace1 );
3416
3417
3418 /* With data */
3419 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
3420 NULL, (LPVOID) lpData, -1, 0 );
3422
3423 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
3424 NULL, (LPVOID) lpData, 0, 0 );
3425 checkHR( DP_OK, hr );
3426
3427 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
3428 NULL, NULL, dwDataSize, 0 );
3430
3431 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
3432 NULL, (LPVOID) lpData, dwDataSize, 0 );
3433 checkHR( DP_OK, hr );
3434
3435
3436 hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroup, &idGroup,
3437 NULL, (LPVOID) lpData, -1, 0 );
3439
3440 hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroup, &idGroup,
3441 NULL, (LPVOID) lpData, 0, 0 );
3442 checkHR( DP_OK, hr );
3443
3444 hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroup, &idGroup,
3445 NULL, NULL, dwDataSize, 0 );
3447
3448 hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroup, &idGroup,
3449 NULL, (LPVOID)lpData, dwDataSize, 0 );
3450 checkHR( DP_OK, hr );
3451
3452
3453 hr = IDirectPlayX_CreateGroup( pDP, &idGroupParent,
3454 NULL, NULL, 0, 0 );
3455 checkHR( DP_OK, hr );
3456
3457
3458 /* Message checking */
3459 for (i=0; i<5; i++)
3460 {
3461 dwDataSizeGet = 1024;
3462 hr = IDirectPlayX_Receive( pDP, &idFrom, &idTo, 0, lpDataGet,
3463 &dwDataSizeGet );
3464 checkHR( DP_OK, hr );
3465 check( 48 + lpDataGet->dwDataSize, dwDataSizeGet );
3466 check( DPID_SYSMSG, idFrom );
3468 check( DPPLAYERTYPE_GROUP, lpDataGet->dwPlayerType );
3470 }
3471 check_messages( pDP, &dpid, 1, &callbackData );
3472 checkStr( "", callbackData.szTrace1 );
3473
3474
3475 /* Flags and idGroupParent */
3476 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
3477 NULL, NULL, 0, 0 );
3478 checkHR( DP_OK, hr );
3479
3480 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
3481 NULL, NULL, 0, DPGROUP_HIDDEN );
3482 checkHR( DP_OK, hr );
3483
3484 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
3486 checkHR( DP_OK, hr );
3487
3488 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
3489 NULL, NULL, 0,
3491 checkHR( DP_OK, hr );
3492
3493
3494 hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroupParent, &idGroup,
3495 NULL, NULL, 0, 0 );
3496 checkHR( DP_OK, hr );
3497
3498 hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroupParent, &idGroup,
3499 NULL, NULL, 0, DPGROUP_HIDDEN );
3500 checkHR( DP_OK, hr );
3501
3502 hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroupParent, &idGroup,
3504 checkHR( DP_OK, hr );
3505
3506 hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroupParent, &idGroup,
3507 NULL, NULL, 0,
3510 checkHR( DP_OK, hr );
3511
3512
3513 /* Message checking */
3514 for (i=0; i<8; i++)
3515 {
3516 dwDataSizeGet = 1024;
3517 hr = IDirectPlayX_Receive( pDP, &idFrom, &idTo, 0, lpDataGet,
3518 &dwDataSizeGet );
3519 checkHR( DP_OK, hr );
3520 check( 48, dwDataSizeGet );
3521 check( DPID_SYSMSG, idFrom );
3523 check( DPPLAYERTYPE_GROUP, lpDataGet->dwPlayerType );
3524
3525 if ( lpDataGet->dpIdParent != 0 )
3526 {
3527 check( idGroupParent, lpDataGet->dpIdParent );
3528 }
3529
3530 switch (i%4)
3531 {
3532 case 0:
3534 lpDataGet->dwFlags, FLAGS_DPGROUP );
3535 break;
3536 case 1:
3538 lpDataGet->dwFlags, FLAGS_DPGROUP );
3539 break;
3540 case 2:
3542 lpDataGet->dwFlags, FLAGS_DPGROUP );
3543 break;
3544 case 3:
3546 lpDataGet->dwFlags, FLAGS_DPGROUP );
3547 break;
3548 default: break;
3549 }
3550 }
3551 check_messages( pDP, &dpid, 1, &callbackData );
3552 checkStr( "", callbackData.szTrace1 );
3553
3554
3555 /* If a group is created in C/S mode, no messages are sent */
3556
3557 /* - Peer 2 peer */
3558 IDirectPlayX_Close( pDP );
3559
3560 dpsd.dwFlags = 0;
3561 hr = IDirectPlayX_Open( pDP, &dpsd, DPOPEN_CREATE );
3562 checkHR( DP_OK, hr );
3563 hr = IDirectPlayX_CreatePlayer( pDP, &dpid, NULL, NULL, NULL, 0, 0 );
3564 checkHR( DP_OK, hr );
3565
3566 hr = IDirectPlayX_CreateGroup( pDP, &idGroup, NULL, NULL, 0, 0 );
3567 checkHR( DP_OK, hr );
3568
3569 /* Messages are received */
3570 check_messages( pDP, &dpid, 1, &callbackData );
3571 checkStr( "S0,", callbackData.szTrace1 );
3572
3573
3574 /* - Client/Server */
3575 IDirectPlayX_Close( pDP );
3576
3578 hr = IDirectPlayX_Open( pDP, &dpsd, DPOPEN_CREATE );
3579 checkHR( DP_OK, hr );
3580 hr = IDirectPlayX_CreatePlayer( pDP, &dpid,
3581 NULL, NULL, NULL, 0,
3583 checkHR( DP_OK, hr );
3584
3585 hr = IDirectPlayX_CreateGroup( pDP, &idGroup,
3586 NULL, NULL, 0, 0 );
3587 checkHR( DP_OK, hr );
3588
3589 /* No messages */
3590 check_messages( pDP, &dpid, 1, &callbackData );
3591 checkStr( "S0,", callbackData.szTrace1 ); /* Or at least there
3592 shouldn't be messages... */
3593
3594
3595 HeapFree( GetProcessHeap(), 0, lpDataGet );
3596 IDirectPlayX_Release( pDP );
3597
3598}
#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:223
#define checkConv(expected, result, function)
Definition: dplayx.c:57
#define check_messages(a, b, c, d, e, f)
Definition: clipboard.c:1033
DWORD dwSize
Definition: dplay.h:188
DWORD dwMaxPlayers
Definition: dplay.h:238
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by START_TEST().

◆ test_CreatePlayer()

static void test_CreatePlayer ( void  )
static

Definition at line 1975 of file dplayx.c.

1976{
1977
1978 IDirectPlay4 *pDP[2];
1979 DPSESSIONDESC2 dpsd;
1980 DPNAME name;
1981 DPID dpid;
1982 HRESULT hr;
1983
1984
1985 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
1986 &IID_IDirectPlay4A, (LPVOID*) &pDP[0] );
1987 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
1988 if (FAILED(hr)) return;
1989
1990 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
1991 &IID_IDirectPlay4A, (LPVOID*) &pDP[1] );
1992 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
1993 if (FAILED(hr)) return;
1994
1995 ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
1996 ZeroMemory( &name, sizeof(DPNAME) );
1997
1998
1999 /* Connection not initialized */
2000 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL, 0, 0 );
2002
2003
2004 init_TCPIP_provider( pDP[0], "127.0.0.1", 0 );
2005 init_TCPIP_provider( pDP[1], "127.0.0.1", 0 );
2006
2007
2008 /* Session not open */
2009 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL, 0, 0 );
2011
2012 if ( hr == DPERR_UNINITIALIZED )
2013 {
2014 todo_wine win_skip( "CreatePlayer not implemented\n" );
2015 return;
2016 }
2017
2018 dpsd.dwSize = sizeof(DPSESSIONDESC2);
2019 dpsd.guidApplication = appGuid;
2020 IDirectPlayX_Open( pDP[0], &dpsd, DPOPEN_CREATE );
2021
2022
2023 /* Player name */
2024 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL, 0, 0 );
2025 checkHR( DP_OK, hr );
2026
2027
2028 name.dwSize = -1;
2029
2030
2031 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, &name, NULL, NULL, 0, 0 );
2032 checkHR( DP_OK, hr );
2033
2034
2035 name.dwSize = sizeof(DPNAME);
2036 U1(name).lpszShortNameA = (LPSTR) "test";
2037 U2(name).lpszLongNameA = NULL;
2038
2039
2040 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, &name, NULL, NULL,
2041 0, 0 );
2042 checkHR( DP_OK, hr );
2043
2044
2045 /* Null dpid */
2047 0, 0 );
2049
2050
2051 /* There can only be one server player */
2052 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
2054 checkHR( DP_OK, hr );
2055 check( DPID_SERVERPLAYER, dpid );
2056
2057 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
2060
2061 IDirectPlayX_DestroyPlayer( pDP[0], dpid );
2062
2063 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
2065 checkHR( DP_OK, hr );
2066 check( DPID_SERVERPLAYER, dpid );
2067 IDirectPlayX_DestroyPlayer( pDP[0], dpid );
2068
2069
2070 /* Flags */
2071 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
2072 0, 0 );
2073 checkHR( DP_OK, hr );
2074
2075 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
2077 checkHR( DP_OK, hr );
2078 check( DPID_SERVERPLAYER, dpid );
2079 IDirectPlayX_DestroyPlayer( pDP[0], dpid );
2080
2081 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
2082 0, DPPLAYER_SPECTATOR );
2083 checkHR( DP_OK, hr );
2084
2085 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
2088 checkHR( DP_OK, hr );
2089 check( DPID_SERVERPLAYER, dpid );
2090 IDirectPlayX_DestroyPlayer( pDP[0], dpid );
2091
2092
2093 /* Session with DPSESSION_NEWPLAYERSDISABLED */
2094 IDirectPlayX_Close( pDP[0] );
2096 hr = IDirectPlayX_Open( pDP[0], &dpsd, DPOPEN_CREATE );
2097 checkHR( DP_OK, hr );
2098
2099
2100 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
2101 0, 0 );
2103
2104 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
2107
2108 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
2109 0, DPPLAYER_SPECTATOR );
2111
2112
2113 /* Creating players in a Client/Server session */
2114 IDirectPlayX_Close( pDP[0] );
2116 hr = IDirectPlayX_Open( pDP[0], &dpsd, DPOPEN_CREATE );
2117 checkHR( DP_OK, hr );
2119 pDP[1], 0 );
2120 checkHR( DP_OK, hr );
2121
2122
2123 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
2124 0, 0 );
2126
2127 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
2129 checkHR( DP_OK, hr );
2130 check( DPID_SERVERPLAYER, dpid );
2131
2132 hr = IDirectPlayX_CreatePlayer( pDP[1], &dpid, NULL, NULL, NULL,
2135
2136 hr = IDirectPlayX_CreatePlayer( pDP[1], &dpid, NULL, NULL, NULL,
2137 0, 0 );
2138 checkHR( DP_OK, hr );
2139
2140
2141 IDirectPlayX_Release( pDP[0] );
2142 IDirectPlayX_Release( pDP[1] );
2143
2144}
#define DPID_SERVERPLAYER
Definition: dplay.h:163
#define IDirectPlayX_DestroyPlayer(p, a)
Definition: dplay.h:874
#define IDirectPlayX_EnumSessions(p, a, b, c, d, e)
Definition: dplay.h:878
static BOOL CALLBACK EnumSessions_cb_join(LPCDPSESSIONDESC2 lpThisSD, LPDWORD lpdwTimeOut, DWORD dwFlags, LPVOID lpContext)
Definition: dplayx.c:706

Referenced by START_TEST().

◆ test_DirectPlayCreate()

static void test_DirectPlayCreate ( void  )
static

Definition at line 734 of file dplayx.c.

735{
736
737 IDirectPlay *pDP;
738 HRESULT hr;
739
740 /* TODO: Check how it behaves with pUnk!=NULL */
741
742 /* pDP==NULL */
743 hr = pDirectPlayCreate( NULL, NULL, NULL );
745 hr = pDirectPlayCreate( (LPGUID) &GUID_NULL, NULL, NULL );
747 hr = pDirectPlayCreate( (LPGUID) &DPSPGUID_TCPIP, NULL, NULL );
749
750 /* pUnk==NULL, pDP!=NULL */
751 hr = pDirectPlayCreate( NULL, &pDP, NULL );
753 hr = pDirectPlayCreate( (LPGUID) &GUID_NULL, &pDP, NULL );
754 checkHR( DP_OK, hr );
755 if ( hr == DP_OK )
757 hr = pDirectPlayCreate( (LPGUID) &DPSPGUID_TCPIP, &pDP, NULL );
758 checkHR( DP_OK, hr );
759 if ( hr == DP_OK )
761
762}

Referenced by START_TEST().

◆ test_EnumAddressTypes()

static void test_EnumAddressTypes ( void  )
static

Definition at line 1134 of file dplayx.c.

1135{
1136 IDirectPlay4 *pDP;
1137 HRESULT hr;
1138 DPCOMPOUNDADDRESSELEMENT addressElements[2];
1139 LPVOID pAddress = NULL;
1140 DWORD dwAddressSize = 0;
1141 IDirectPlayLobby3 *pDPL;
1142 WORD port = 6001;
1143
1144 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
1145 &IID_IDirectPlay4A, (LPVOID*) &pDP );
1146 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
1147 if (FAILED(hr))
1148 return;
1149
1150 hr = CoCreateInstance( &CLSID_DirectPlayLobby, NULL, CLSCTX_ALL,
1151 &IID_IDirectPlayLobby3A, (LPVOID*) &pDPL );
1152 ok (SUCCEEDED (hr), "CCI of CLSID_DirectPlayLobby / IID_IDirectPlayLobby3A failed\n");
1153 if (FAILED (hr)) return;
1154
1155 addressElements[0].guidDataType = DPAID_ServiceProvider;
1156 addressElements[0].dwDataSize = sizeof(GUID);
1157 addressElements[0].lpData = (void*) &DPSPGUID_TCPIP;
1158
1159 addressElements[1].guidDataType = invalid_guid;
1160 addressElements[1].dwDataSize = sizeof(WORD);
1161 addressElements[1].lpData = &port;
1162
1163 hr = IDirectPlayLobby_CreateCompoundAddress( pDPL, addressElements, 2, NULL, &dwAddressSize );
1165
1166 if( hr == DPERR_BUFFERTOOSMALL )
1167 {
1168 pAddress = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwAddressSize );
1169 hr = IDirectPlayLobby_CreateCompoundAddress( pDPL, addressElements, 2,
1170 pAddress, &dwAddressSize );
1171 checkHR( DP_OK, hr );
1172 }
1173
1174 IDirectPlayX_Close(pDP);
1177
1178 HeapFree( GetProcessHeap(), 0, pAddress );
1179}

Referenced by START_TEST().

◆ test_EnumConnections()

static void test_EnumConnections ( void  )
static

Definition at line 948 of file dplayx.c.

949{
950
951 IDirectPlay4 *pDP;
952 CallbackData callbackData;
953 HRESULT hr;
954
955
956 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
957 &IID_IDirectPlay4A, (LPVOID*) &pDP );
958
959 ok (SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n");
960 if (FAILED(hr)) return;
961
962 callbackData.dwCounter1 = 0;
963 callbackData.dwFlags = 0;
965 &callbackData, callbackData.dwFlags );
966 checkHR( DP_OK, hr );
967 ok( callbackData.dwCounter1 == 4 || callbackData.dwCounter1 == 3, "got=%d\n", callbackData.dwCounter1 );
968
969 callbackData.dwCounter1 = 0;
970 callbackData.dwFlags = 0;
972 &callbackData, callbackData.dwFlags );
973 checkHR( DP_OK, hr );
974 ok( callbackData.dwCounter1 == 4 || callbackData.dwCounter1 == 3, "got=%d\n", callbackData.dwCounter1 );
975
976 callbackData.dwCounter1 = 0;
977 callbackData.dwFlags = 0;
978 hr = IDirectPlayX_EnumConnections( pDP, &appGuid, NULL,
979 &callbackData, callbackData.dwFlags );
981 check( 0, callbackData.dwCounter1 );
982
983
984 /* Flag tests */
985 callbackData.dwCounter1 = 0;
986 callbackData.dwFlags = DPCONNECTION_DIRECTPLAY;
988 &callbackData, callbackData.dwFlags );
989 checkHR( DP_OK, hr );
990 ok( callbackData.dwCounter1 == 4 || callbackData.dwCounter1 == 3, "got=%d\n", callbackData.dwCounter1 );
991
992 callbackData.dwCounter1 = 0;
995 &callbackData, callbackData.dwFlags );
996 checkHR( DP_OK, hr );
997 check( 0, callbackData.dwCounter1 );
998
999 callbackData.dwCounter1 = 0;
1000 callbackData.dwFlags = ( DPCONNECTION_DIRECTPLAY |
1003 &callbackData, callbackData.dwFlags );
1004 checkHR( DP_OK, hr );
1005 ok( callbackData.dwCounter1 == 4 || callbackData.dwCounter1 == 3, "got=%d\n", callbackData.dwCounter1 );
1006
1007 callbackData.dwCounter1 = 0;
1008 callbackData.dwFlags = ~( DPCONNECTION_DIRECTPLAY |
1011 &callbackData, callbackData.dwFlags );
1013 check( 0, callbackData.dwCounter1 );
1014
1015
1016 IDirectPlayX_Release( pDP );
1017}
#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:909

Referenced by START_TEST().

◆ test_EnumerateProviders()

static void test_EnumerateProviders ( void  )
static

Definition at line 800 of file dplayx.c.

801{
802 HRESULT hr;
803 int i;
804 struct provider_data arg;
805
806 memset(&arg, 0, sizeof(arg));
807 arg.ret_value = TRUE;
808
809 hr = pDirectPlayEnumerateA(callback_providersA, NULL);
810 ok(SUCCEEDED(hr), "DirectPlayEnumerateA failed\n");
811
812 SetLastError(0xdeadbeef);
813 hr = pDirectPlayEnumerateA(NULL, &arg);
814 ok(FAILED(hr), "DirectPlayEnumerateA expected to fail\n");
815 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got 0x%x\n", GetLastError());
816
817 SetLastError(0xdeadbeef);
818 hr = pDirectPlayEnumerateA(NULL, NULL);
819 ok(FAILED(hr), "DirectPlayEnumerateA expected to fail\n");
820 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got 0x%x\n", GetLastError());
821
822 hr = pDirectPlayEnumerateA(callback_providersA, &arg);
823 ok(SUCCEEDED(hr), "DirectPlayEnumerateA failed\n");
824 ok(arg.call_count > 0, "Expected at least one valid provider\n");
825 trace("Found %d providers\n", arg.call_count);
826
827 /* The returned GUID values must have persisted after enumeration (bug 37185) */
828 for(i = 0; i < arg.call_count; i++)
829 {
830 ok(IsEqualGUID(arg.guid_ptr[i], &arg.guid_data[i]), "#%d Expected equal GUID values\n", i);
831 }
832
833 memset(&arg, 0, sizeof(arg));
834 arg.ret_value = FALSE;
835 hr = pDirectPlayEnumerateA(callback_providersA, &arg);
836 ok(SUCCEEDED(hr), "DirectPlayEnumerateA failed\n");
837 ok(arg.call_count == 1, "Expected 1, got %d\n", arg.call_count);
838
839 hr = pDirectPlayEnumerateW(callback_providersW, NULL);
840 ok(SUCCEEDED(hr), "DirectPlayEnumerateW failed\n");
841
842 SetLastError(0xdeadbeef);
843 hr = pDirectPlayEnumerateW(NULL, &arg);
844 ok(FAILED(hr), "DirectPlayEnumerateW expected to fail\n");
845 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got 0x%x\n", GetLastError());
846
847 SetLastError(0xdeadbeef);
848 hr = pDirectPlayEnumerateW(NULL, NULL);
849 ok(FAILED(hr), "DirectPlayEnumerateW expected to fail\n");
850 ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got 0x%x\n", GetLastError());
851
852 memset(&arg, 0, sizeof(arg));
853 arg.ret_value = TRUE;
854 hr = pDirectPlayEnumerateW(callback_providersW, &arg);
855 ok(SUCCEEDED(hr), "DirectPlayEnumerateW failed\n");
856 ok(arg.call_count > 0, "Expected at least one valid provider\n");
857
858 /* The returned GUID values must have persisted after enumeration (bug 37185) */
859 for(i = 0; i < arg.call_count; i++)
860 {
861 ok(IsEqualGUID(arg.guid_ptr[i], &arg.guid_data[i]), "#%d Expected equal GUID values\n", i);
862 }
863
864 memset(&arg, 0, sizeof(arg));
865 arg.ret_value = FALSE;
866 hr = pDirectPlayEnumerateW(callback_providersW, &arg);
867 ok(SUCCEEDED(hr), "DirectPlayEnumerateW failed\n");
868 ok(arg.call_count == 1, "Expected 1, got %d\n", arg.call_count);
869}
#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:783
static BOOL CALLBACK callback_providersA(GUID *guid, char *name, DWORD major, DWORD minor, void *arg)
Definition: dplayx.c:764
#define memset(x, y, z)
Definition: compat.h:39
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by START_TEST().

◆ test_EnumGroups()

static void test_EnumGroups ( void  )
static

Definition at line 4094 of file dplayx.c.

4095{
4096 IDirectPlay4 *pDP[3];
4097 DPSESSIONDESC2 dpsd[3];
4098 DPID dpid[5];
4099 CallbackData callbackData;
4100 HRESULT hr;
4101 UINT i;
4102
4103
4104 for (i=0; i<3; i++)
4105 {
4106 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
4107 &IID_IDirectPlay4A, (LPVOID*) &pDP[i] );
4108 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
4109 if (FAILED(hr)) return;
4110
4111 ZeroMemory( &dpsd[i], sizeof(DPSESSIONDESC2) );
4112 dpsd[i].dwSize = sizeof(DPSESSIONDESC2);
4113 }
4114
4115 dpsd[0].guidApplication = appGuid;
4116 dpsd[1].guidApplication = appGuid2;
4117 dpsd[2].guidApplication = GUID_NULL;
4118
4119 callbackData.dpid = dpid;
4120 callbackData.dpidSize = 5;
4121
4122
4123 /* Uninitialized service provider */
4124 callbackData.dwCounter1 = 0;
4126 &callbackData, 0 );
4128 check( 0, callbackData.dwCounter1 );
4129
4130
4131 init_TCPIP_provider( pDP[0], "127.0.0.1", 0 );
4132 init_TCPIP_provider( pDP[1], "127.0.0.1", 0 );
4133 init_TCPIP_provider( pDP[2], "127.0.0.1", 0 );
4134
4135
4136 /* No session */
4137 callbackData.dwCounter1 = 0;
4139 &callbackData, 0 );
4141 check( 0, callbackData.dwCounter1 );
4142
4143 if ( hr == DPERR_UNINITIALIZED )
4144 {
4145 todo_wine win_skip( "EnumGroups not implemented\n" );
4146 return;
4147 }
4148
4149 callbackData.dwCounter1 = 0;
4150 hr = IDirectPlayX_EnumGroups( pDP[0], (LPGUID) &appGuid, EnumGroups_cb,
4151 &callbackData, 0 );
4153 check( 0, callbackData.dwCounter1 );
4154
4155 callbackData.dwCounter1 = 0;
4156 hr = IDirectPlayX_EnumGroups( pDP[0], (LPGUID) &appGuid, EnumGroups_cb,
4157 &callbackData, DPENUMGROUPS_SESSION );
4159 check( 0, callbackData.dwCounter1 );
4160
4161
4162 hr = IDirectPlayX_Open( pDP[0], &dpsd[0], DPOPEN_CREATE );
4163 checkHR( DP_OK, hr );
4164 hr = IDirectPlayX_Open( pDP[1], &dpsd[1], DPOPEN_CREATE );
4165 checkHR( DP_OK, hr );
4166
4167
4168 /* No groups */
4169 callbackData.dwCounter1 = 0;
4171 &callbackData, 0 );
4172 checkHR( DP_OK, hr );
4173 check( 0, callbackData.dwCounter1 );
4174
4175
4176 /* Create groups */
4177 hr = IDirectPlayX_CreateGroup( pDP[0], &dpid[0],
4178 NULL, NULL, 0, 0 );
4179 checkHR( DP_OK, hr );
4180 hr = IDirectPlayX_CreateGroupInGroup( pDP[0], dpid[0], &dpid[3],
4181 NULL, NULL, 0, 0 );
4182 checkHR( DP_OK, hr ); /* Not a superior level group,
4183 won't appear in the enumerations */
4184 hr = IDirectPlayX_CreateGroup( pDP[1], &dpid[1],
4185 NULL, NULL, 0, 0 );
4186 checkHR( DP_OK, hr );
4187 hr = IDirectPlayX_CreateGroup( pDP[0], &dpid[2],
4188 NULL, NULL, 0, DPGROUP_HIDDEN );
4189 checkHR( DP_OK, hr );
4190
4191
4192 /* Invalid parameters */
4193 callbackData.dwCounter1 = 0;
4194 hr = IDirectPlayX_EnumGroups( pDP[0], (LPGUID) &appGuid, NULL,
4195 &callbackData, 0 );
4197 check( 0, callbackData.dwCounter1 );
4198
4199 callbackData.dwCounter1 = 0;
4201 &callbackData, DPENUMGROUPS_SESSION );
4203 check( 0, callbackData.dwCounter1 );
4204
4205
4206 /* Regular operation */
4207 callbackData.dwCounter1 = 0;
4208 callbackData.szTrace2[0] = 0;
4210 &callbackData, 0 );
4211 checkHR( DP_OK, hr );
4212 check( 2, callbackData.dwCounter1 );
4213 checkStr( "02", callbackData.szTrace1 );
4214 checkStr( "ALL:HIDDEN:", callbackData.szTrace2 );
4215
4216 callbackData.dwCounter1 = 0;
4217 callbackData.szTrace2[0] = 0;
4219 &callbackData, 0 );
4220 checkHR( DP_OK, hr );
4221 check( 1, callbackData.dwCounter1 );
4222 checkStr( "1", callbackData.szTrace1 );
4223 checkStr( "ALL:", callbackData.szTrace2 );
4224
4225 callbackData.dwCounter1 = 0;
4226 callbackData.szTrace2[0] = 0;
4227 hr = IDirectPlayX_EnumGroups( pDP[0], (LPGUID) &appGuid, EnumGroups_cb,
4228 &callbackData, 0 );
4229 checkHR( DP_OK, hr );
4230 check( 2, callbackData.dwCounter1 ); /* Guid is ignored */
4231 checkStr( "02", callbackData.szTrace1 );
4232 checkStr( "ALL:HIDDEN:", callbackData.szTrace2 );
4233
4234
4235 /* Enumerating from a remote session */
4236 /* - Session not open */
4237 callbackData.pDP = pDP[2];
4238 hr = IDirectPlayX_EnumSessions( pDP[2], &dpsd[2], 0,
4240 &callbackData, 0 );
4241 checkHR( DP_OK, hr );
4242
4243 /* - Open session */
4244 callbackData.pDP = pDP[2];
4245 hr = IDirectPlayX_EnumSessions( pDP[2], &dpsd[0], 0, EnumSessions_cb_join,
4246 pDP[2], 0 );
4247 checkHR( DP_OK, hr );
4248
4249 hr = IDirectPlayX_CreateGroup( pDP[2], &dpid[3],
4250 NULL, NULL, 0, 0 );
4251 checkHR( DP_OK, hr );
4252 hr = IDirectPlayX_CreateGroup( pDP[2], &dpid[4],
4254 checkHR( DP_OK, hr );
4255
4256
4257 callbackData.dwCounter1 = 0;
4258 callbackData.szTrace2[0] = 0;
4260 &callbackData, 0 );
4261 checkHR( DP_OK, hr );
4262 check( 4, callbackData.dwCounter1 );
4263 checkStr( "0234", callbackData.szTrace1 );
4264 checkStr( "ALL:HIDDEN:ALL:STAGINGAREA:", callbackData.szTrace2 );
4265
4266 /* Flag tests */
4267 callbackData.dwCounter1 = 0;
4268 callbackData.szTrace2[0] = 0;
4270 &callbackData, DPENUMGROUPS_ALL );
4271 checkHR( DP_OK, hr );
4272 check( 4, callbackData.dwCounter1 );
4273 checkStr( "0234", callbackData.szTrace1 );
4274 checkStr( "ALL:HIDDEN:ALL:STAGINGAREA:", callbackData.szTrace2 );
4275
4276 callbackData.dwCounter1 = 0;
4277 callbackData.szTrace2[0] = 0;
4279 &callbackData, DPENUMGROUPS_HIDDEN );
4280 checkHR( DP_OK, hr );
4281 check( 1, callbackData.dwCounter1 );
4282 checkStr( "2", callbackData.szTrace1 );
4283 checkStr( "HIDDEN:", callbackData.szTrace2 );
4284
4285 callbackData.dwCounter1 = 0;
4286 callbackData.szTrace2[0] = 0;
4288 &callbackData, DPENUMGROUPS_LOCAL );
4289 checkHR( DP_OK, hr );
4290 check( 2, callbackData.dwCounter1 );
4291 checkStr( "34", callbackData.szTrace1 );
4292 checkStr( "LOCAL:"
4293 "LOCAL,DPENUMGROUPS_STAGINGAREA:", callbackData.szTrace2 );
4294
4295 callbackData.dwCounter1 = 0;
4296 callbackData.szTrace2[0] = 0;
4298 &callbackData, DPENUMGROUPS_REMOTE );
4299 checkHR( DP_OK, hr );
4300 check( 2, callbackData.dwCounter1 );
4301 checkStr( "02", callbackData.szTrace1 );
4302 checkStr( "REMOTE:"
4303 "REMOTE,DPENUMGROUPS_HIDDEN:", callbackData.szTrace2 );
4304
4305 callbackData.dwCounter1 = 0;
4306 callbackData.szTrace2[0] = 0;
4308 &callbackData, DPENUMGROUPS_STAGINGAREA );
4309 checkHR( DP_OK, hr );
4310 check( 1, callbackData.dwCounter1 );
4311 checkStr( "4", callbackData.szTrace1 );
4312 checkStr( "STAGINGAREA:", callbackData.szTrace2 );
4313
4314
4315 IDirectPlayX_Release( pDP[0] );
4316 IDirectPlayX_Release( pDP[1] );
4317 IDirectPlayX_Release( pDP[2] );
4318
4319}
#define DPENUMGROUPS_REMOTE
Definition: dplay.h:997
#define DPENUMGROUPS_LOCAL
Definition: dplay.h:996
static BOOL CALLBACK EnumSessions_cb_EnumGroups(LPCDPSESSIONDESC2 lpThisSD, LPDWORD lpdwTimeOut, DWORD dwFlags, LPVOID lpContext)
Definition: dplayx.c:4040

Referenced by START_TEST().

◆ test_EnumGroupsInGroup()

static void test_EnumGroupsInGroup ( void  )
static

Definition at line 4321 of file dplayx.c.

4322{
4323 IDirectPlay4 *pDP[2];
4324 DPSESSIONDESC2 dpsd[2];
4325 DPID dpid[6];
4326 CallbackData callbackData;
4327 HRESULT hr;
4328 UINT i;
4329
4330
4331 for (i=0; i<2; i++)
4332 {
4333 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
4334 &IID_IDirectPlay4A, (LPVOID*) &pDP[i] );
4335 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
4336 if (FAILED(hr)) return;
4337
4338 ZeroMemory( &dpsd[i], sizeof(DPSESSIONDESC2) );
4339 dpsd[i].dwSize = sizeof(DPSESSIONDESC2);
4340 }
4341
4342 dpsd[0].guidApplication = appGuid;
4343 dpsd[1].guidApplication = GUID_NULL;
4344
4345 callbackData.dpid = dpid;
4346 callbackData.dpidSize = 6;
4347
4348
4349 /* Uninitialized service provider */
4350 callbackData.dwCounter1 = 0;
4352 &callbackData, 0 );
4354 check( 0, callbackData.dwCounter1 );
4355
4356
4357 init_TCPIP_provider( pDP[0], "127.0.0.1", 0 );
4358 init_TCPIP_provider( pDP[1], "127.0.0.1", 0 );
4359
4360 hr = IDirectPlayX_Open( pDP[0], &dpsd[0], DPOPEN_CREATE );
4362
4363 if ( hr == DPERR_UNINITIALIZED )
4364 {
4365 todo_wine win_skip( "EnumGroupsInGroup not implemented\n" );
4366 return;
4367 }
4368
4369 /* Create groups */
4370 /*
4371 * 0
4372 * / 2
4373 * 1 | 3
4374 * | 4
4375 * \ 5 (shortcut)
4376 */
4377 hr = IDirectPlayX_CreateGroup( pDP[0], &dpid[0],
4378 NULL, NULL, 0, 0 );
4379 checkHR( DP_OK, hr );
4380 hr = IDirectPlayX_CreateGroup( pDP[0], &dpid[1],
4381 NULL, NULL, 0, 0 );
4382 checkHR( DP_OK, hr );
4383 hr = IDirectPlayX_CreateGroupInGroup( pDP[0], dpid[1], &dpid[2],
4384 NULL, NULL, 0, 0 );
4385 checkHR( DP_OK, hr );
4386 hr = IDirectPlayX_CreateGroupInGroup( pDP[0], dpid[1], &dpid[3],
4387 NULL, NULL, 0,
4389 checkHR( DP_OK, hr );
4390 hr = IDirectPlayX_CreateGroupInGroup( pDP[0], dpid[1], &dpid[4],
4391 NULL, NULL, 0,
4393 checkHR( DP_OK, hr );
4394 hr = IDirectPlayX_CreateGroup( pDP[0], &dpid[5],
4395 NULL, NULL, 0, 0 );
4396 checkHR( DP_OK, hr );
4397
4398 hr = IDirectPlayX_AddGroupToGroup( pDP[0], dpid[1], dpid[5] );
4399 checkHR( DP_OK, hr );
4400
4401
4402 /* Invalid parameters */
4403 callbackData.dwCounter1 = 0;
4405 &callbackData, 0 );
4407 check( 0, callbackData.dwCounter1 );
4408
4409 callbackData.dwCounter1 = 0;
4411 &callbackData, 0 );
4413 check( 0, callbackData.dwCounter1 );
4414
4415 callbackData.dwCounter1 = 0;
4416 hr = IDirectPlayX_EnumGroupsInGroup( pDP[0], dpid[1], (LPGUID) &appGuid,
4417 NULL, &callbackData, 0 );
4419 check( 0, callbackData.dwCounter1 );
4420
4421 callbackData.dwCounter1 = 0;
4423 &callbackData, DPENUMGROUPS_SESSION );
4425 check( 0, callbackData.dwCounter1 );
4426
4427
4428 /* Regular operation */
4429 callbackData.dwCounter1 = 0;
4431 &callbackData, 0 );
4432 checkHR( DP_OK, hr );
4433 check( 0, callbackData.dwCounter1 );
4434
4435 callbackData.dwCounter1 = 0;
4436 callbackData.szTrace2[0] = 0;
4438 &callbackData, 0 );
4439 checkHR( DP_OK, hr );
4440 check( 4, callbackData.dwCounter1 );
4441 checkStr( "5432", callbackData.szTrace1 );
4442 checkStr( "SHORTCUT:STAGINGAREA:HIDDEN:ALL:", callbackData.szTrace2 );
4443
4444 callbackData.dwCounter1 = 0;
4445 callbackData.szTrace2[0] = 0;
4446 hr = IDirectPlayX_EnumGroupsInGroup( pDP[0], dpid[1], (LPGUID) &appGuid,
4447 EnumGroups_cb, &callbackData, 0 );
4448 checkHR( DP_OK, hr );
4449 check( 4, callbackData.dwCounter1 ); /* Guid is ignored */
4450 checkStr( "5432", callbackData.szTrace1 );
4451 checkStr( "SHORTCUT:STAGINGAREA:HIDDEN:ALL:", callbackData.szTrace2 );
4452
4453
4454 /* Enumerating from a remote session */
4455 /* - Session not open */
4456 callbackData.pDP = pDP[1];
4457 hr = IDirectPlayX_EnumSessions( pDP[1], &dpsd[1], 0,
4459 &callbackData, 0 );
4460 checkHR( DP_OK, hr );
4461
4462 /* - Open session */
4463 hr = IDirectPlayX_EnumSessions( pDP[1], &dpsd[0], 0, EnumSessions_cb_join,
4464 pDP[1], 0 );
4465 checkHR( DP_OK, hr );
4466
4467
4468 callbackData.dwCounter1 = 0;
4469 callbackData.szTrace2[0] = 0;
4471 &callbackData, 0 );
4472 checkHR( DP_OK, hr );
4473 check( 4, callbackData.dwCounter1 );
4474 checkStr( "5432", callbackData.szTrace1 );
4475 checkStr( "SHORTCUT:STAGINGAREA:HIDDEN:ALL:", callbackData.szTrace2 );
4476
4477 /* Flag tests */
4478 callbackData.dwCounter1 = 0;
4479 callbackData.szTrace2[0] = 0;
4481 &callbackData, DPENUMGROUPS_ALL );
4482 checkHR( DP_OK, hr );
4483 check( 4, callbackData.dwCounter1 );
4484 checkStr( "5432", callbackData.szTrace1 );
4485 checkStr( "SHORTCUT:STAGINGAREA:HIDDEN:ALL:", callbackData.szTrace2 );
4486
4487 callbackData.dwCounter1 = 0;
4488 callbackData.szTrace2[0] = 0;
4490 &callbackData, DPENUMGROUPS_HIDDEN );
4491 checkHR( DP_OK, hr );
4492 check( 1, callbackData.dwCounter1 );
4493 checkStr( "3", callbackData.szTrace1 );
4494 checkStr( "HIDDEN:", callbackData.szTrace2 );
4495
4496 callbackData.dwCounter1 = 0;
4497 callbackData.szTrace2[0] = 0;
4499 &callbackData, DPENUMGROUPS_LOCAL );
4500 checkHR( DP_OK, hr );
4501 check( 4, callbackData.dwCounter1 );
4502 checkStr( "5432", callbackData.szTrace1 );
4503 checkStr( "LOCAL,DPENUMGROUPS_SHORTCUT:"
4504 "LOCAL,DPENUMGROUPS_STAGINGAREA:"
4505 "LOCAL,DPENUMGROUPS_HIDDEN:LOCAL:", callbackData.szTrace2 );
4506
4507 callbackData.dwCounter1 = 0;
4509 &callbackData, DPENUMGROUPS_REMOTE );
4510 checkHR( DP_OK, hr );
4511 check( 0, callbackData.dwCounter1 );
4512
4513 callbackData.dwCounter1 = 0;
4515 &callbackData, DPENUMGROUPS_LOCAL );
4516 checkHR( DP_OK, hr );
4517 check( 0, callbackData.dwCounter1 );
4518
4519 callbackData.dwCounter1 = 0;
4520 callbackData.szTrace2[0] = 0;
4522 &callbackData, DPENUMGROUPS_REMOTE );
4523 checkHR( DP_OK, hr );
4524 check( 4, callbackData.dwCounter1 );
4525 checkStr( "5432", callbackData.szTrace1 );
4526 checkStr( "REMOTE,DPENUMGROUPS_SHORTCUT:"
4527 "REMOTE,DPENUMGROUPS_STAGINGAREA:"
4528 "REMOTE,DPENUMGROUPS_HIDDEN:REMOTE:", callbackData.szTrace2 );
4529
4530 callbackData.dwCounter1 = 0;
4531 callbackData.szTrace2[0] = 0;
4533 &callbackData, DPENUMGROUPS_SHORTCUT );
4534 checkHR( DP_OK, hr );
4535 check( 1, callbackData.dwCounter1 );
4536 checkStr( "5", callbackData.szTrace1 );
4537 checkStr( "SHORTCUT:", callbackData.szTrace2 );
4538
4539 callbackData.dwCounter1 = 0;
4540 callbackData.szTrace2[0] = 0;
4542 &callbackData,
4544 checkHR( DP_OK, hr );
4545 check( 1, callbackData.dwCounter1 );
4546 checkStr( "4", callbackData.szTrace1 );
4547 checkStr( "STAGINGAREA:", callbackData.szTrace2 );
4548
4549
4550 IDirectPlayX_Release( pDP[0] );
4551 IDirectPlayX_Release( pDP[1] );
4552
4553}
#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 3771 of file dplayx.c.

3772{
3773 IDirectPlay4 *pDP[3];
3774 DPSESSIONDESC2 dpsd[3];
3775 DPID dpid[5+2]; /* 5 players, 2 groups */
3776 CallbackData callbackData;
3777 HRESULT hr;
3778 UINT i;
3779
3780
3781 for (i=0; i<3; i++)
3782 {
3783 hr = CoCreateInstance( &CLSID_DirectPlay, NULL, CLSCTX_ALL,
3784 &IID_IDirectPlay4A, (LPVOID*) &pDP[i] );
3785 ok( SUCCEEDED(hr), "CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
3786 if (FAILED(hr)) return;
3787
3788 ZeroMemory( &dpsd[i], sizeof(DPSESSIONDESC2) );
3789 dpsd[i].dwSize = sizeof(DPSESSIONDESC2);
3790 }
3791
3792 dpsd[0].guidApplication = appGuid;
3793 dpsd[1].guidApplication = appGuid2;
3794 dpsd[2].guidApplication = GUID_NULL;
3795
3796 callbackData.dpid = dpid;
3797 callbackData.dpidSize = 5+2;
3798
3799
3800 /* Uninitialized service provider */
3801 callbackData.dwCounter1 = 0;
3802 hr = IDirectPlayX_EnumPlayers( pDP[0], (LPGUID) &appGuid, NULL,
3803 &callbackData, 0 );
3805 check( 0, callbackData.dwCounter1 );
3806
3807
3808 init_TCPIP_provider( pDP[0], "127.0.0.1", 0 );
3809 init_TCPIP_provider( pDP[1], "127.0.0.1", 0 );
3810 init_TCPIP_provider( pDP[2], "127.0.0.1", 0 );
3811
3812
3813 /* No session */
3814 callbackData.dwCounter1 = 0;
3816 &callbackData, 0 );
3818 check( 0, callbackData.dwCounter1 );
3819
3820 if ( hr == DPERR_UNINITIALIZED )
3821 {
3822 todo_wine win_skip( "EnumPlayers not implemented\n" );
3823 return;
3824 }
3825
3826 callbackData.dwCounter1 = 0;
3827 hr = IDirectPlayX_EnumPlayers( pDP[0], (LPGUID) &appGuid, EnumPlayers_cb,
3828 &callbackData, 0 );
3830 check( 0, callbackData.dwCounter1 );
3831
3832 callbackData.dwCounter1 = 0;
3833 hr = IDirectPlayX_EnumPlayers( pDP[0], (LPGUID) &appGuid, EnumPlayers_cb,
3834 &callbackData, DPENUMPLAYERS_SESSION );
3836 check( 0, callbackData.dwCounter1 );
3837
3838
3839 hr = IDirectPlayX_Open( pDP[0], &dpsd[0], DPOPEN_CREATE );
3840 checkHR( DP_OK, hr );
3841 hr = IDirectPlayX_Open( pDP[1], &dpsd[1], DPOPEN_CREATE );
3842 checkHR( DP_OK, hr );
3843
3844
3845 /* No players */
3846 callbackData.dwCounter1 = 0;
3848 &callbackData, 0 );
3849 checkHR( DP_OK, hr );
3850 check( 0, callbackData.dwCounter1 );
3851
3852
3853 /* Create players */
3854 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid[0],
3855 NULL, NULL, NULL, 0,
3857 checkHR( DP_OK, hr );
3858 hr = IDirectPlayX_CreatePlayer( pDP[1], &dpid[1],
3859 NULL, NULL, NULL, 0,
3860 0 );
3861 checkHR( DP_OK, hr );
3862
3863 hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid[2],
3864 NULL, NULL, NULL, 0,
3865 0 );
3866 checkHR( DP_OK, hr );
3867 hr = IDirectPlayX_CreateGroup( pDP[0], &dpid[5],
3868 NULL, NULL, 0, 0 );
3869 checkHR( DP_OK, hr );
3870
3871
3872 /* Invalid parameters */
3873 callbackData.dwCounter1 = 0;
3874 hr = IDirectPlayX_EnumPlayers( pDP[0], (LPGUID) &appGuid, NULL,
3875 &callbackData, 0 );
3877 check( 0, callbackData.dwCounter1 );
3878
3879 callbackData.dwCounter1 = 0;
3881 &callbackData, DPENUMPLAYERS_SESSION );
3883 check( 0, callbackData.dwCounter1 );
3884
3885
3886 /* Regular operation */
3887 callbackData.dwCounter1 = 0;
3888 callbackData.szTrace2[0] = 0;
3890 &callbackData, 0 );
3891 checkHR( DP_OK, hr );
3892 check( 2, callbackData.dwCounter1 );
3893 checkStr( "20", callbackData.szTrace1 );
3894 checkStr( "ALL:SERVERPLAYER:", callbackData.szTrace2 );
3895
3896 callbackData.dwCounter1 = 0;
3897 callbackData.szTrace2[0] = 0;
3899 &callbackData, 0 );
3900 checkHR( DP_OK, hr );
3901 check( 1, callbackData.dwCounter1 );
3902 checkStr( "1", callbackData.szTrace1 );
3903 checkStr( "ALL:", callbackData.szTrace2 );
3904
3905 callbackData.dwCounter1 = 0;
3906 callbackData.szTrace2[0] = 0;
3907 hr = IDirectPlayX_EnumPlayers( pDP[0], (LPGUID) &appGuid, EnumPlayers_cb,
3908 &callbackData, 0 );
3909 checkHR( DP_OK, hr );
3910 check( 2, callbackData.dwCounter1 ); /* Guid is ignored */
3911 checkStr( "20", callbackData.szTrace1 );
3912 checkStr( "ALL:SERVERPLAYER:", callbackData.szTrace2 );
3913
3914
3915 /* Enumerating from a remote session */
3916 /* - Session not open */
3917 callbackData.pDP = pDP[2];
3918 hr = IDirectPlayX_EnumSessions( pDP[2], &dpsd[2], 0,
3920 &callbackData, 0 );
3921 checkHR( DP_OK, hr );
3922
3923
3924 /* - Open session */
3925 callbackData.pDP = pDP[2];
3926 hr = IDirectPlayX_EnumSessions( pDP[2], &dpsd[0], 0, EnumSessions_cb_join,
3927