ReactOS  0.4.13-dev-482-ge57f103
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,...)
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) );
#define ok(value,...)
GLuint64EXT * result
Definition: glext.h:11304
BOOL expected
Definition: store.c:2063

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", \
#define ok(value,...)
GLbitfield flags
Definition: glext.h:7161
static LPCSTR dwFlags2str(DWORD dwFlags, DWORD flagType)
Definition: dplayx.c:248
GLuint64EXT * result
Definition: glext.h:11304
BOOL expected
Definition: store.c:2063

Definition at line 48 of file dplayx.c.

◆ checkGuid

#define checkGuid (   expected,
  result 
)
Value:
"expected=%s got=%s\n", \
#define ok(value,...)
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
static LPCSTR Guid2str(const GUID *guid)
Definition: dplayx.c:100
GLuint64EXT * result
Definition: glext.h:11304
BOOL expected
Definition: store.c:2063

Definition at line 53 of file dplayx.c.

◆ checkHR

#define checkHR (   expected,
  result 
)
Value:
ok( (expected) == (result), \
"expected=%s got=%s\n", \
#define ok(value,...)
static LPCSTR dpResult2str(HRESULT hr)
Definition: dplayx.c:141
GLuint64EXT * result
Definition: glext.h:11304
BOOL expected
Definition: store.c:2063

Definition at line 40 of file dplayx.c.

◆ checkLP

#define checkLP (   expected,
  result 
)
Value:
ok( (expected) == (result), \
"expected=%p got=%p\n", \
#define ok(value,...)
GLuint64EXT * result
Definition: glext.h:11304
BOOL expected
Definition: store.c:2063

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", \
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
GLuint64EXT * result
Definition: glext.h:11304
BOOL expected
Definition: store.c:2063

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,
6739  APP_REMOVE
6740 };

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: kmt_test.h:217
#define TRUE
Definition: types.h:120
void * arg
Definition: msvc.h:12
BOOL ret_value
Definition: dplayx.c:85
const GUID * guid
GUID guid_data[10]
Definition: dplayx.c:84
GUID * guid_ptr[10]
Definition: dplayx.c:83
int call_count
Definition: dplayx.c:82
#define ARRAY_SIZE(a)
Definition: main.h:24
#define major(rdev)
Definition: propsheet.cpp:879
Definition: name.c:36
#define minor(rdev)
Definition: propsheet.cpp:880

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 }
#define TRUE
Definition: types.h:120
void * arg
Definition: msvc.h:12
BOOL ret_value
Definition: dplayx.c:85
const GUID * guid
GUID guid_data[10]
Definition: dplayx.c:84
GUID * guid_ptr[10]
Definition: dplayx.c:83
int call_count
Definition: dplayx.c:82
#define ARRAY_SIZE(a)
Definition: main.h:24

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 }
HRESULT hr
Definition: shlfolder.c:183
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
#define DPERR_NOMESSAGES
Definition: dplay.h:110
#define sprintf(buf, format,...)
Definition: sprintf.c:55
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 DP_OK
Definition: dplay.h:88
UINT dwCounter1
Definition: dplayx.c:73
char szTrace1[1024]
Definition: dplayx.c:75
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD DPID
Definition: dplay.h:158
#define IDirectPlayX_Receive(p, a, b, c, d, e)
Definition: dplay.h:890
static calc_node_t temp
Definition: rpn_ieee.c:38
unsigned int UINT
Definition: ndis.h:50
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static char dpid2char(DPID *dpid, DWORD dpidSize, DPID idPlayer)
Definition: dplayx.c:577
char szTrace2[1024]
Definition: dplayx.c:75
#define HeapFree(x, y, z)
Definition: compat.h:394
#define checkHR(expected, result)
Definition: dplayx.c:40

Referenced by test_CreateGroup(), test_GetMessageCount(), test_GetMessageQueue(), test_groups_cs(), test_groups_p2p(), test_PlayerName(), test_remote_data_replication(), test_Send(), and test_SessionDesc().

◆ 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 );
1404  todo_wine checkHR( DP_OK, hr );
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,
1413  0, DPPLAYER_SERVERPLAYER );
1414  todo_wine checkHR( DP_OK, hr );
1415  }
1416 
1417  return pDP;
1418 
1419 }
#define U1(x)
Definition: test.h:172
HRESULT hr
Definition: shlfolder.c:183
#define ZeroMemory
Definition: winbase.h:1635
#define DPSESSION_NEWPLAYERSDISABLED
Definition: dplay.h:267
char * LPSTR
Definition: xmlstorage.h:182
#define IDirectPlayX_Open(p, a, b)
Definition: dplay.h:889
#define DP_OK
Definition: dplay.h:88
#define ok(value,...)
#define IDirectPlayX_CreatePlayer(p, a, b, c, d, e, f)
Definition: dplay.h:871
smooth NULL
Definition: ftsmooth.c:416
struct tagDPNAME DPNAME
#define DPOPEN_CREATE
Definition: dplay.h:264
LONG HRESULT
Definition: typedefs.h:77
DWORD DPID
Definition: dplay.h:158
#define todo_wine
Definition: test.h:154
#define DPPLAYER_SERVERPLAYER
Definition: dplay.h:1005
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
static void init_TCPIP_provider(IDirectPlay4 *pDP, LPCSTR strIPAddressString, WORD port)
Definition: dplayx.c:654
DWORD dwFlags
Definition: dplay.h:233
Definition: name.c:36
#define checkHR(expected, result)
Definition: dplayx.c:40
#define SUCCEEDED(hr)
Definition: intsafe.h:57
GLuint const GLchar * name
Definition: glext.h:6031

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
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
unsigned int UINT
Definition: ndis.h:50

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_SETPLAYERORGROUPNAME
Definition: dplay.h:1106
#define DPSYS_HOST
Definition: dplay.h:1100
#define DPSYS_DESTROYPLAYERORGROUP
Definition: dplay.h:1088
#define DPSYS_SECUREMESSAGE
Definition: dplay.h:1118
#define DPSYS_CHAT
Definition: dplay.h:1124
#define DPSYS_CREATEPLAYERORGROUP
Definition: dplay.h:1085
#define DPSYS_ADDPLAYERTOGROUP
Definition: dplay.h:1091
#define DPSYS_SETPLAYERORGROUPDATA
Definition: dplay.h:1103
#define DPSYS_SESSIONLOST
Definition: dplay.h:1097
#define DPSYS_SETGROUPOWNER
Definition: dplay.h:1127
#define DPSYS_DELETEGROUPFROMGROUP
Definition: dplay.h:1115
#define DPSYS_ADDGROUPTOGROUP
Definition: dplay.h:1112
#define DPSYS_SENDCOMPLETE
Definition: dplay.h:1130
#define DPSYS_DELETEPLAYERFROMGROUP
Definition: dplay.h:1094
#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_NONEWPLAYERS
Definition: dplay.h:126
#define DPERR_UNINITIALIZED
Definition: dplay.h:125
#define DPERR_UNSUPPORTED
Definition: dplay.h:118
#define DPERR_CANTLOADCAPI
Definition: dplay.h:152
#define DPERR_INVALIDPLAYER
Definition: dplay.h:104
#define DPERR_USERCANCEL
Definition: dplay.h:120
#define DPERR_CANTCREATEPLAYER
Definition: dplay.h:95
HRESULT hr
Definition: shlfolder.c:183
#define DPERR_AUTHENTICATIONFAILED
Definition: dplay.h:146
#define DPERR_NOTLOBBIED
Definition: dplay.h:142
#define DPERR_BUFFERTOOSMALL
Definition: dplay.h:92
#define DPERR_CANTLOADSECURITYPACKAGE
Definition: dplay.h:150
#define DPERR_NOCONNECTION
Definition: dplay.h:107
#define DPERR_INVALIDGROUP
Definition: dplay.h:105
#define DPERR_INVALIDPARAMS
Definition: dplay.h:103
#define DPERR_SERVICEPROVIDERLOADED
Definition: dplay.h:143
#define DPERR_ACTIVEPLAYERS
Definition: dplay.h:91
#define DPERR_INVALIDPASSWORD
Definition: dplay.h:127
GLuint buffer
Definition: glext.h:5915
#define DPERR_CONNECTIONLOST
Definition: dplay.h:129
#define DPERR_CANTCREATEPROCESS
Definition: dplay.h:137
char * LPSTR
Definition: xmlstorage.h:182
#define DPERR_INVALIDFLAGS
Definition: dplay.h:100
#define DPERR_NOMESSAGES
Definition: dplay.h:110
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define DPERR_NOCAPS
Definition: dplay.h:106
#define DPERR_INVALIDINTERFACE
Definition: dplay.h:139
#define DPERR_ENCRYPTIONNOTSUPPORTED
Definition: dplay.h:151
#define DPERR_SIGNFAILED
Definition: dplay.h:149
#define DPERR_PENDING
Definition: dplay.h:114
#define DP_OK
Definition: dplay.h:88
#define DPERR_NOPLAYERS
Definition: dplay.h:112
#define DPERR_NOTHANDLED
Definition: dplay.h:133
static LPSTR get_temp_buffer(void)
Definition: dplayx.c:88
#define DPERR_BUSY
Definition: dplay.h:119
#define DPERR_EXCEPTION
Definition: dplay.h:98
#define DPERR_ALREADYREGISTERED
Definition: dplay.h:144
#define DPERR_LOGONDENIED
Definition: dplay.h:154
#define DPERR_TIMEOUT
Definition: dplay.h:116
#define DPERR_CANNOTCREATESERVER
Definition: dplay.h:122
#define DPERR_SENDTOOBIG
Definition: dplay.h:115
#define DPERR_SESSIONLOST
Definition: dplay.h:124
#define DPERR_INVALIDOBJECT
Definition: dplay.h:101
#define DPERR_NOINTERFACE
Definition: dplay.h:121
#define DPERR_APPNOTSTARTED
Definition: dplay.h:138
#define DPERR_NOSESSIONS
Definition: dplay.h:113
#define DPERR_CAPSNOTAVAILABLEYET
Definition: dplay.h:97
#define DPERR_BUFFERTOOLARGE
Definition: dplay.h:136
#define DPERR_INVALIDPRIORITY
Definition: dplay.h:132
#define DPERR_GENERIC
Definition: dplay.h:99
#define DPERR_UNKNOWNMESSAGE
Definition: dplay.h:130
#define DPERR_CONNECTING
Definition: dplay.h:128
#define DPERR_NONAMESERVERFOUND
Definition: dplay.h:111
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
#define DPERR_NOTREGISTERED
Definition: dplay.h:145
#define DPERR_NOTLOGGEDIN
Definition: dplay.h:153
#define DPERR_CANCELLED
Definition: dplay.h:134
#define DPERR_NOSERVICEPROVIDER
Definition: dplay.h:140
#define DPERR_CANCELFAILED
Definition: dplay.h:131
#define DPERR_NOMEMORY
Definition: dplay.h:108
#define DPERR_ENCRYPTIONFAILED
Definition: dplay.h:148
#define DPERR_UNAVAILABLE
Definition: dplay.h:117
#define HRESULT_CODE(hr)
Definition: winerror.h:76
#define DPERR_PLAYERLOST
Definition: dplay.h:123
#define DPERR_UNKNOWNAPPLICATION
Definition: dplay.h:141
#define DPERR_CANTCREATESESSION
Definition: dplay.h:96
#define DPERR_CANTADDPLAYER
Definition: dplay.h:93
#define DPERR_CANTCREATEGROUP
Definition: dplay.h:94
#define DPERR_ACCESSDENIED
Definition: dplay.h:90
#define DPERR_ALREADYINITIALIZED
Definition: dplay.h:89
#define DPERR_CANTLOADSSPI
Definition: dplay.h:147
#define DPERR_ABORTED
Definition: dplay.h:135

◆ 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  {
287  if (dwFlags == DPENUMPLAYERS_ALL)
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  {
306  if (dwFlags == DPENUMGROUPS_ALL)
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,");
332  if (dwFlags & DPPLAYER_LOCAL)
333  strcat(flags, "DPPLAYER_LOCAL,");
334  if (dwFlags & DPPLAYER_OWNER)
335  strcat(flags, "DPPLAYER_OWNER,");
336  }
337 
338  /* CreateGroup */
339 
340  if (flagType & FLAGS_DPGROUP)
341  {
343  strcat(flags, "DPGROUP_STAGINGAREA,");
344  if (dwFlags & DPGROUP_LOCAL)
345  strcat(flags, "DPGROUP_LOCAL,");
346  if (dwFlags & DPGROUP_HIDDEN)
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  {
392  if (dwFlags & DPRECEIVE_ALL)
393  strcat(flags, "DPRECEIVE_ALL,");
395  strcat(flags, "DPRECEIVE_TOPLAYER,");
397  strcat(flags, "DPRECEIVE_FROMPLAYER,");
398  if (dwFlags & DPRECEIVE_PEEK)
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,");
422  if (dwFlags & DPSEND_SIGNED)
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,");
475  if (dwFlags & DPOPEN_CREATE)
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  {
531  if (dwFlags & DPESC_TIMEDOUT)
532  strcat(flags, "DPESC_TIMEDOUT,");
533  }
534 
535  /* GetCaps,
536  GetPlayerCaps */
537 
538  if (flagType & FLAGS_DPCAPS)
539  {
540  if (dwFlags & DPCAPS_ISHOST)
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 }
#define DPGROUP_HIDDEN
Definition: dplay.h:1013
#define DPSET_REMOTE
Definition: dplay.h:1056
#define DPSEND_SIGNED
Definition: dplay.h:1042
#define DPCAPS_SIGNINGSUPPORTED
Definition: dplay.h:1073
#define DPENUMSESSIONS_RETURNSTATUS
Definition: dplay.h:1021
#define DPOPEN_RETURNSTATUS
Definition: dplay.h:265
#define DPRECEIVE_ALL
Definition: dplay.h:1031
#define FLAGS_DPSESSION
#define DPENUMGROUPS_ALL
Definition: dplay.h:995
#define FLAGS_DPESC
#define DPCAPS_ASYNCSUPPORTED
Definition: dplay.h:1080
#define DPCONNECTION_DIRECTPLAYLOBBY
Definition: dplay.h:983
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
#define DPCAPS_KEEPALIVEOPTIMIZED
Definition: dplay.h:1070
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define DPCAPS_GROUPOPTIMIZED
Definition: dplay.h:1069
#define DPRECEIVE_TOPLAYER
Definition: dplay.h:1032
#define DPSESSION_KEEPALIVE
Definition: dplay.h:271
#define DPCONNECTION_DIRECTPLAY
Definition: dplay.h:982
#define DPENUMGROUPS_HIDDEN
Definition: dplay.h:1001
#define DPSEND_GUARANTEED
Definition: dplay.h:1038
#define DPSESSION_MIGRATEHOST
Definition: dplay.h:268
#define DPGETCAPS_GUARANTEED
Definition: dplay.h:1024
#define FLAGS_DPENUMGROUPS
#define DPENUMPLAYERS_SERVERPLAYER
Definition: dplay.h:991
#define DPENUMSESSIONS_ASYNC
Definition: dplay.h:1018
#define DPGET_LOCAL
Definition: dplay.h:1028
#define DPSESSION_NEWPLAYERSDISABLED
Definition: dplay.h:267
#define DPSEND_ENCRYPTED
Definition: dplay.h:1043
#define DPSET_LOCAL
Definition: dplay.h:1057
char * LPSTR
Definition: xmlstorage.h:182
#define DPSEND_HIGHPRIORITY
Definition: dplay.h:1039
#define FLAGS_DPCONNECTION
#define FLAGS_DPCAPS
#define FLAGS_DPENUMPLAYERS
#define DPGET_REMOTE
Definition: dplay.h:1027
#define DPENUMGROUPS_STAGINGAREA
Definition: dplay.h:1000
#define FLAGS_DPENUMSESSIONS
#define DPSEND_NOSENDCOMPLETEMSG
Definition: dplay.h:1046
#define DPSESSION_NOPRESERVEORDER
Definition: dplay.h:279
#define DPENUMGROUPS_SHORTCUT
Definition: dplay.h:999
#define DPSESSION_CLIENTSERVER
Definition: dplay.h:277
#define DPENUMSESSIONS_STOPASYNC
Definition: dplay.h:1019
#define DPCAPS_GUARANTEEDSUPPORTED
Definition: dplay.h:1072
#define DPCAPS_ISHOST
Definition: dplay.h:1068
#define FLAGS_DPSEND
static LPSTR get_temp_buffer(void)
Definition: dplayx.c:88
#define DPCAPS_GUARANTEEDOPTIMIZED
Definition: dplay.h:1071
#define DPRECEIVE_PEEK
Definition: dplay.h:1034
#define DPSESSION_PASSWORDREQUIRED
Definition: dplay.h:275
#define DPSEND_ASYNC
Definition: dplay.h:1045
#define DPENUMSESSIONS_ALL
Definition: dplay.h:1017
#define DPMESSAGEQUEUE_SEND
Definition: dplay.h:1061
#define DPSESSION_PRIVATE
Definition: dplay.h:274
#define DPSEND_LOBBYSYSTEMMESSAGE
Definition: dplay.h:1044
#define DPENUMPLAYERS_LOCAL
Definition: dplay.h:987
#define FLAGS_DPMESSAGEQUEUE
#define DPSESSION_MULTICASTSERVER
Definition: dplay.h:276
#define DPENUMPLAYERS_ALL
Definition: dplay.h:986
#define DPENUMSESSIONS_AVAILABLE
Definition: dplay.h:1016
#define DPENUMPLAYERS_OWNER
Definition: dplay.h:993
#define FLAGS_DPOPEN
#define DPOPEN_CREATE
Definition: dplay.h:264
#define DPSEND_OPENSTREAM
Definition: dplay.h:1040
#define DPCAPS_ASYNCCANCELSUPPORTED
Definition: dplay.h:1076
#define DPMESSAGEQUEUE_RECEIVE
Definition: dplay.h:1062
#define DPOPEN_JOIN
Definition: dplay.h:263
#define DPSESSION_NODATAMESSAGES
Definition: dplay.h:272
#define DPESC_TIMEDOUT
Definition: dplay.h:420
#define FLAGS_DPGET
#define FLAGS_DPLCONNECTION
#define DPENUMSESSIONS_PASSWORDREQUIRED
Definition: dplay.h:1020
#define DPENUMPLAYERS_REMOTE
Definition: dplay.h:988
#define DPENUMPLAYERS_GROUP
Definition: dplay.h:989
GLbitfield flags
Definition: glext.h:7161
#define DPCONNECT_RETURNSTATUS
Definition: dplay.h:1065
#define DPCAPS_ENCRYPTIONSUPPORTED
Definition: dplay.h:1074
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DPSESSION_DIRECTPLAYPROTOCOL
Definition: dplay.h:278
#define DPRECEIVE_FROMPLAYER
Definition: dplay.h:1033
#define FLAGS_DPGROUP
#define DPSESSION_SECURESERVER
Definition: dplay.h:273
#define DPPLAYER_LOCAL
Definition: dplay.h:1007
#define FLAGS_DPRECEIVE
#define DPPLAYER_SERVERPLAYER
Definition: dplay.h:1005
#define DPLCONNECTION_JOINSESSION
Definition: dplay.h:295
#define DPCAPS_SENDTIMEOUTSUPPORTED
Definition: dplay.h:1078
#define FLAGS_DPSET
#define FLAGS_DPPLAYER
#define FLAGS_DPCONNECT
#define DPGROUP_STAGINGAREA
Definition: dplay.h:1011
#define DPSEND_CLOSESTREAM
Definition: dplay.h:1041
#define DPSESSION_NOMESSAGEID
Definition: dplay.h:269
#define DPGROUP_LOCAL
Definition: dplay.h:1012
#define DPSEND_MAX_PRIORITY
Definition: dplay.h:1049
#define DPLCONNECTION_CREATESESSION
Definition: dplay.h:294
#define DPENUMPLAYERS_SESSION
Definition: dplay.h:990
#define FLAGS_DPGETCAPS
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define DPPLAYER_OWNER
Definition: dplay.h:1008
#define DPPLAYER_SPECTATOR
Definition: dplay.h:1006
#define DPPLAYERCAPS_LOCAL
Definition: dplay.h:1075
#define DPSESSION_JOINDISABLED
Definition: dplay.h:270
#define DPSET_GUARANTEED
Definition: dplay.h:1058
#define DPENUMPLAYERS_SPECTATOR
Definition: dplay.h:992
#define DPCAPS_SENDPRIORITYSUPPORTED
Definition: dplay.h:1079
#define DPCAPS_ASYNCCANCELALLSUPPORTED
Definition: dplay.h:1077
#define DPSESSION_OPTIMIZELATENCY
Definition: dplay.h:280

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 TRUE
Definition: types.h:120
Definition: scsiwmi.h:51
char * LPSTR
Definition: xmlstorage.h:182
static const struct @512 sizes[]
UINT dwCounter1
Definition: dplayx.c:73
#define check(expected, result)
Definition: dplayx.c:32
Definition: cmds.c:130
#define checkGuid(expected, result)
Definition: dplayx.c:53
unsigned long DWORD
Definition: ntddk_ex.h:95
#define checkStr(expected, result)
Definition: dplayx.c:44
uint32_t * LPDWORD
Definition: typedefs.h:57

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 TRUE
Definition: types.h:120
Definition: scsiwmi.h:51
UINT dwCounter2
Definition: dplayx.c:73
const char * wine_dbgstr_guid(const GUID *guid)
static const struct @512 sizes[]
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
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
#define check(expected, result)
Definition: dplayx.c:32
Definition: cmds.c:130
#define checkGuid(expected, result)
Definition: dplayx.c:53
unsigned long DWORD
Definition: ntddk_ex.h:95
#define todo_wine
Definition: test.h:154
#define GUID_NULL
Definition: ks.h:106
#define ARRAY_SIZE(a)
Definition: main.h:24
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
uint32_t * LPDWORD
Definition: typedefs.h:57

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;
937  IDirectPlayLobby_EnumAddress( pDPL, EnumAddress_cb2, lpConnection,
938  dwConnectionSize, callbackData );
939  todo_wine check( 3, callbackData->dwCounter2 );
940 
941  callbackData->dwCounter1++;
942 
944 
945  return TRUE;
946 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
UINT dwCounter2
Definition: dplayx.c:73
#define DPCONNECTION_DIRECTPLAY
Definition: dplay.h:982
#define IDirectPlayLobby_EnumAddress(p, a, b, c, d)
Definition: dplobby.h:460
#define FLAGS_DPCONNECTION
UINT dwCounter1
Definition: dplayx.c:73
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
#define check(expected, result)
Definition: dplayx.c:32
#define IDirectPlayLobby_Release(p)
Definition: dplobby.h:456
LONG HRESULT
Definition: typedefs.h:77
#define checkFlags(expected, result, flags)
Definition: dplayx.c:48
#define todo_wine
Definition: test.h:154
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
DWORD dwFlags
Definition: dplayx.c:74
static BOOL CALLBACK EnumAddress_cb2(REFGUID guidDataType, DWORD dwDataSize, LPCVOID lpData, LPVOID lpContext)
Definition: dplayx.c:873
#define SUCCEEDED(hr)
Definition: intsafe.h:57

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 TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
#define DPERR_INVALIDPARAMS
Definition: dplay.h:103
#define DPERR_INVALIDFLAGS
Definition: dplay.h:100
#define IDirectPlayX_InitializeConnection(p, a, b)
Definition: dplay.h:904
#define DP_OK
Definition: dplay.h:88
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
#define DPERR_ALREADYINITIALIZED
Definition: dplay.h:89
#define checkHR(expected, result)
Definition: dplayx.c:40

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 TRUE
Definition: types.h:120
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define FLAGS_DPENUMGROUPS
UINT dwCounter1
Definition: dplayx.c:73
DPID * dpid
Definition: dplayx.c:76
#define DPPLAYERTYPE_GROUP
Definition: dplay.h:1134
char szTrace1[1024]
Definition: dplayx.c:75
#define check(expected, result)
Definition: dplayx.c:32
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static LPCSTR dwFlags2str(DWORD dwFlags, DWORD flagType)
Definition: dplayx.c:248
static char dpid2char(DPID *dpid, DWORD dpidSize, DPID idPlayer)
Definition: dplayx.c:577
char szTrace2[1024]
Definition: dplayx.c:75
UINT dpidSize
Definition: dplayx.c:77

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 TRUE
Definition: types.h:120
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define FLAGS_DPENUMPLAYERS
UINT dwCounter1
Definition: dplayx.c:73
DPID * dpid
Definition: dplayx.c:76
#define DPPLAYERTYPE_GROUP
Definition: dplay.h:1134
char szTrace1[1024]
Definition: dplayx.c:75
#define check(expected, result)
Definition: dplayx.c:32
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DPPLAYERTYPE_PLAYER
Definition: dplay.h:1135
static LPCSTR dwFlags2str(DWORD dwFlags, DWORD flagType)
Definition: dplayx.c:248
static char dpid2char(DPID *dpid, DWORD dpidSize, DPID idPlayer)
Definition: dplayx.c:577
char szTrace2[1024]
Definition: dplayx.c:75
UINT dpidSize
Definition: dplayx.c:77

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 }
DWORD dwCurrentPlayers
Definition: dplay.h:239
#define TRUE
Definition: types.h:120
#define DPSESSION_NEWPLAYERSDISABLED
Definition: dplay.h:267
DWORD dwSize
Definition: dplay.h:232
UINT dwCounter1
Definition: dplayx.c:73
#define checkLP(expected, result)
Definition: dplayx.c:36
smooth NULL
Definition: ftsmooth.c:416
#define DPSESSION_PASSWORDREQUIRED
Definition: dplay.h:275
#define check(expected, result)
Definition: dplayx.c:32
#define DPESC_TIMEDOUT
Definition: dplay.h:420
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define U2(x)
Definition: wordpad.c:45
DWORD dwFlags
Definition: dplay.h:233

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
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
#define DPERR_INVALIDPASSWORD
Definition: dplay.h:127
#define ZeroMemory
Definition: winbase.h:1635
char * LPSTR
Definition: xmlstorage.h:182
DWORD dwSize
Definition: dplay.h:232
#define IDirectPlayX_Open(p, a, b)
Definition: dplay.h:889
GUID guidApplication
Definition: dplay.h:235
GUID guidInstance
Definition: dplay.h:234
#define DP_OK
Definition: dplay.h:88
#define DPSESSION_PASSWORDREQUIRED
Definition: dplay.h:275
LONG HRESULT
Definition: typedefs.h:77
#define DPOPEN_JOIN
Definition: dplay.h:263
#define DPESC_TIMEDOUT
Definition: dplay.h:420
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define U2(x)
Definition: wordpad.c:45
DWORD dwFlags
Definition: dplay.h:233
struct tagDPSESSIONDESC2 DPSESSIONDESC2
#define checkHR(expected, result)
Definition: dplayx.c:40

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 TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
static BOOL CALLBACK EnumGroups_cb(DPID dpId, DWORD dwPlayerType, LPCDPNAME lpName, DWORD dwFlags, LPVOID lpContext)
Definition: dplayx.c:4011
GUID guidInstance
Definition: dplay.h:234
UINT dwCounter1
Definition: dplayx.c:73
smooth NULL
Definition: ftsmooth.c:416
#define check(expected, result)
Definition: dplayx.c:32
LONG HRESULT
Definition: typedefs.h:77
#define DPESC_TIMEDOUT
Definition: dplay.h:420
#define DPERR_NOSESSIONS
Definition: dplay.h:113
IDirectPlay4 * pDP
Definition: dplayx.c:72
#define DPERR_GENERIC
Definition: dplay.h:99
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DPENUMGROUPS_SESSION
Definition: dplay.h:998
#define checkHR(expected, result)
Definition: dplayx.c:40
#define IDirectPlayX_EnumGroups(p, a, b, c, d)
Definition: dplay.h:876

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;
3732  hr = IDirectPlayX_EnumPlayers( callbackData->pDP, NULL, EnumPlayers_cb,
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 TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
#define IDirectPlayX_EnumPlayers(p, a, b, c, d)
Definition: dplay.h:877
GUID guidInstance
Definition: dplay.h:234
UINT dwCounter1
Definition: dplayx.c:73
smooth NULL
Definition: ftsmooth.c:416
#define check(expected, result)
Definition: dplayx.c:32
LONG HRESULT
Definition: typedefs.h:77
#define DPESC_TIMEDOUT
Definition: dplay.h:420
#define DPERR_NOSESSIONS
Definition: dplay.h:113
IDirectPlay4 * pDP
Definition: dplayx.c:72
#define DPERR_GENERIC
Definition: dplay.h:99
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static BOOL CALLBACK EnumPlayers_cb(DPID dpId, DWORD dwPlayerType, LPCDPNAME lpName, DWORD dwFlags, LPVOID lpContext)
Definition: dplayx.c:3680
#define DPENUMPLAYERS_SESSION
Definition: dplay.h:990
#define checkHR(expected, result)
Definition: dplayx.c:40

Referenced by test_EnumPlayers().

◆ EnumSessions_cb_join()

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

Definition at line 706 of file dplayx.c.

710 {
711  IDirectPlay4 *pDP = lpContext;
712  DPSESSIONDESC2 dpsd;
713  HRESULT hr;
714 
715  if (dwFlags & DPESC_TIMEDOUT)
716  {
717  return FALSE;
718  }
719 
720  ZeroMemory( &dpsd, sizeof(DPSESSIONDESC2) );
721  dpsd.dwSize = sizeof(DPSESSIONDESC2);
722  dpsd.guidApplication = appGuid;
723  dpsd.guidInstance = lpThisSD->guidInstance;
724 
725  hr = IDirectPlayX_Open( pDP, &dpsd, DPOPEN_JOIN );
726  checkHR( DP_OK, hr );
727 
728  return TRUE;
729 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
#define ZeroMemory
Definition: winbase.h:1635
DWORD dwSize
Definition: dplay.h:232
#define IDirectPlayX_Open(p, a, b)
Definition: dplay.h:889
GUID guidApplication
Definition: dplay.h:235
GUID guidInstance
Definition: dplay.h:234
#define DP_OK
Definition: dplay.h:88
LONG HRESULT
Definition: typedefs.h:77
#define DPOPEN_JOIN
Definition: dplay.h:263
#define DPESC_TIMEDOUT
Definition: dplay.h:420
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
struct tagDPSESSIONDESC2 DPSESSIONDESC2
#define checkHR(expected, result)
Definition: dplayx.c:40

Referenced by test_CreatePlayer(), test_EnumGroups(), test_EnumGroupsInGroup(), test_EnumPlayers(), test_GetMessageCount(), test_GetMessageQueue(), test_GetPlayerAccount(), test_GetPlayerAddress(), test_GetPlayerCaps(), test_GetPlayerFlags(), test_GroupOwner(), test_groups_cs(), test_groups_p2p(), test_host_migration(), test_PlayerName(), test_remote_data_replication(), test_Send(), and test_SessionDesc().

◆ 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 U1(x)
Definition: test.h:172
#define TRUE
Definition: types.h:120
#define FLAGS_DPSESSION
HRESULT hr
Definition: shlfolder.c:183
#define ZeroMemory
Definition: winbase.h:1635
char * LPSTR
Definition: xmlstorage.h:182
DWORD dwSize
Definition: dplay.h:232
GUID guidApplication
Definition: dplay.h:235
#define IDirectPlayX_SecureOpen(p, a, b, c, d)
Definition: dplay.h:905
DWORD dwSize
Definition: dplay.h:337
GUID guidInstance
Definition: dplay.h:234
smooth NULL
Definition: ftsmooth.c:416
struct tagDPCREDENTIALS DPCREDENTIALS
#define DPERR_LOGONDENIED
Definition: dplay.h:154
LONG HRESULT
Definition: typedefs.h:77
#define DPOPEN_JOIN
Definition: dplay.h:263
#define DPESC_TIMEDOUT
Definition: dplay.h:420
#define checkFlags(expected, result, flags)
Definition: dplayx.c:48
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DPSESSION_SECURESERVER
Definition: dplay.h:273
#define U2(x)
Definition: wordpad.c:45
DWORD dwFlags
Definition: dplay.h:233
struct tagDPSESSIONDESC2 DPSESSIONDESC2
#define checkHR(expected, result)
Definition: dplayx.c:40

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 }
GLuint index
Definition: glext.h:6031
#define index(s, c)
Definition: various.h:29
unsigned int UINT
Definition: ndis.h:50
static unsigned char buff[32768]
Definition: fatten.c:17

Referenced by dpResult2str(), and dwFlags2str().

◆ 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 }
const char * wine_dbgstr_guid(const GUID *guid)
const GUID * guid
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021

◆ 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 }
HRESULT hr
Definition: shlfolder.c:183
#define DPERR_BUFFERTOOSMALL
Definition: dplay.h:92
#define IDirectPlayX_InitializeConnection(p, a, b)
Definition: dplay.h:904
#define DP_OK
Definition: dplay.h:88
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
#define IDirectPlayLobby_Release(p)
Definition: dplobby.h:456
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LPVOID
Definition: nt_native.h:45
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
struct _GUID GUID
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
USHORT port
Definition: uri.c:227
#define HeapFree(x, y, z)
Definition: compat.h:394
#define IDirectPlayLobby_CreateCompoundAddress(p, a, b, c, d)
Definition: dplobby.h:470
#define checkHR(expected, result)
Definition: dplayx.c:40
#define SUCCEEDED(hr)
Definition: intsafe.h:57

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;
6762  INetFwPolicy *policy = 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 
6783 done:
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 }
HRESULT hr
Definition: shlfolder.c:183
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
short VARIANT_BOOL
Definition: compat.h:1931
static int init
Definition: wintirpc.c:33
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:1935
#define profile
Definition: kernel32.h:12
#define SUCCEEDED(hr)
Definition: intsafe.h:57

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 }
enum _TOKEN_ELEVATION_TYPE TOKEN_ELEVATION_TYPE
#define CloseHandle
Definition: compat.h:398
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
unsigned int BOOL
Definition: ntddk_ex.h:94
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
GLsizeiptr size
Definition: glext.h:5919
#define TOKEN_QUERY
Definition: setypes.h:874
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1168
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:413

Referenced by START_TEST().

◆ 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 
6908  data = HeapAlloc(GetProcessHeap(), 0, size);
6909  if (!data) return FALSE;
6910 
6911  if (GetFileVersionInfoA(filename, ver, size, data))
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  }
6919  HeapFree(GetProcessHeap(), 0, data);
6920 
6921  return isstub;
6922 }
int WINAPI lstrcmpiA(LPCSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:42
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
BOOL WINAPI VerQueryValueA(LPCVOID pBlock, LPCSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
Definition: version.c:998
const char * filename
Definition: ioapi.h:135
#define SUBLANG_ENGLISH_US
Definition: nls.h:222
#define sprintf(buf, format,...)
Definition: sprintf.c:55
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
DWORD WINAPI GetFileVersionInfoSizeA(LPCSTR filename, LPDWORD handle)
Definition: version.c:624
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define LANG_ENGLISH
Definition: nls.h:52
BOOL WINAPI GetFileVersionInfoA(LPCSTR filename, DWORD handle, DWORD datasize, LPVOID data)
Definition: version.c:858
#define MAKELANGID(p, s)
Definition: nls.h:15
GLfloat GLfloat p
Definition: glext.h:8902
#define HeapFree(x, y, z)
Definition: compat.h:394

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;
6802  INetFwPolicy *policy = NULL;
6807  WCHAR path[MAX_PATH];
6808 
6810  {
6811  SysFreeString( image );
6812  return E_FAIL;
6813  }
6814 
6816  {
6817  SysFreeString( image );
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 );
6851  SysFreeString( 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 
6869  SysFreeString( image );
6870  image = SysAllocString( path );
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 );
6876  SysFreeString( 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 
6887 done:
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();
6894  SysFreeString( image );
6895  return hr;
6896 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:607
static const WCHAR separator[]
Definition: asmname.c:63
HRESULT hr
Definition: shlfolder.c:183
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:342
OLECHAR * BSTR
Definition: compat.h:1934
#define E_FAIL
Definition: ddrawi.h:102
static int init
Definition: wintirpc.c:33
#define ok(value,...)
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:241
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
Definition: services.c:325
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2312
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:1935
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
Definition: name.c:36
#define profile
Definition: kernel32.h:12
UINT op
Definition: effect.c:223
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define SUCCEEDED(hr)
Definition: intsafe.h:57
GLuint const GLchar * name
Definition: glext.h:6031

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];
6929  HMODULE module;
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  {
6952  hr = set_firewall(APP_ADD);
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();
6969  test_COM_dplobby();
6974  test_GetCaps();
6976 
6977  if (!winetest_interactive)
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 */
6989  test_SessionDesc();
6990 
6991  /* test_CreatePlayer() takes over a minute */
6994  test_PlayerData();
6995  test_PlayerName();
6996 
6997  /* test_GetPlayerAccount() takes over 30s */
7001 
7002  test_CreateGroup();
7003  test_GroupOwner();
7004 
7005  test_EnumPlayers();
7006  test_EnumGroups();
7008 
7009  test_groups_p2p();
7010  test_groups_cs();
7011 
7012  test_Send();
7013  test_Receive();
7016 
7019 
7020 done:
7022  CoUninitialize();
7023  if (firewall_enabled) set_firewall(APP_REMOVE);
7024 }
static void test_groups_cs(void)
Definition: dplayx.c:4790
static void test_GetPlayerFlags(void)
Definition: dplayx.c:3185
#define trace(...)
Definition: kmt_test.h:217
HMODULE module
Definition: main.cpp:47
HRESULT hr
Definition: shlfolder.c:183
static void test_EnumGroupsInGroup(void)
Definition: dplayx.c:4321
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
static void test_EnumPlayers(void)
Definition: dplayx.c:3771
static void test_COM_dplobby(void)
Definition: dplayx.c:6644
static void test_EnumConnections(void)
Definition: dplayx.c:948
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2282
static void test_EnumAddressTypes(void)
Definition: dplayx.c:1134
static void test_DirectPlayCreate(void)
Definition: dplayx.c:734
static BOOL is_process_elevated(void)
Definition: dplayx.c:6742
static void test_SessionDesc(void)
Definition: dplayx.c:1793
int winetest_interactive
static void test_CreateGroup(void)
Definition: dplayx.c:3293
static void test_remote_data_replication(void)
Definition: dplayx.c:6183
static BOOL is_stub_dll(const char *filename)
Definition: dplayx.c:6899
static void test_CreatePlayer(void)
Definition: dplayx.c:1975
unsigned int BOOL
Definition: ntddk_ex.h:94
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static HRESULT set_firewall(enum firewall_op op)
Definition: dplayx.c:6791
smooth NULL
Definition: ftsmooth.c:416
static void test_GetPlayerAccount(void)
Definition: dplayx.c:2861
static void test_Send(void)
Definition: dplayx.c:5027
#define FreeLibrary(x)
Definition: compat.h:405
static void test_groups_p2p(void)
Definition: dplayx.c:4555
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
static void test_Open(void)
Definition: dplayx.c:1225
static void test_GroupOwner(void)
Definition: dplayx.c:3602
static void test_EnumSessions(void)
Definition: dplayx.c:1421
static void test_COM(void)
Definition: dplayx.c:6543
static void test_PlayerData(void)
Definition: dplayx.c:2312
static void test_host_migration(void)
Definition: dplayx.c:6411
static void test_GetMessageCount(void)
Definition: dplayx.c:5647
static void test_InitializeConnection(void)
Definition: dplayx.c:1051
static void test_GetPlayerAddress(void)
Definition: dplayx.c:3045
static void test_GetMessageQueue(void)
Definition: dplayx.c:5870
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
Definition: services.c:325
static void test_GetPlayerCaps(void)
Definition: dplayx.c:2148
static void test_PlayerName(void)
Definition: dplayx.c:2577
#define skip(...)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1897
static BOOL is_firewall_enabled(void)
Definition: dplayx.c:6758
#define GetProcAddress(x, y)
Definition: compat.h:410
static void test_GetCaps(void)
Definition: dplayx.c:1070
#define win_skip
Definition: test.h:141
static void test_Receive(void)
Definition: dplayx.c:5362
static void test_EnumerateProviders(void)
Definition: dplayx.c:800
static void test_EnumGroups(void)
Definition: dplayx.c:4094

◆ 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);
6592  IDirectPlay2_Release(dp2A);
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);
6598  IDirectPlay2_Release(dp2);
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);
6604  IDirectPlay3_Release(dp3A);
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);
6610  IDirectPlay3_Release(dp3);
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);
6616  IDirectPlayX_Release(dp4A);
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);
6623  IDirectPlay_Release(dp);
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);
6633  IDirectPlay_Release(dp);
6634  IDirectPlayX_Release(dp4A);
6635  IDirectPlay3_Release(dp3);
6636  IDirectPlay3_Release(dp3A);
6637  IDirectPlay2_Release(dp2);
6638  IDirectPlay2_Release(dp2A);
6639  IDirectPlayX_Release(dp4);
6640  refcount = IDirectPlayX_Release(dp4);
6641  ok(refcount == 0, "refcount == %u, expected 0\n", refcount);
6642 }
#define IDirectPlayX_AddRef(p)
Definition: dplay.h:865
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT hr
Definition: shlfolder.c:183
struct IDirectPlay2 IDirectPlay2A
Definition: dplay.h:47
#define IDirectPlay_Release(p)
Definition: dplay.h:462
#define IDirectPlayX_Release(p)
Definition: dplay.h:866
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define IDirectPlay2_AddRef(p)
Definition: dplay.h:563
struct IDirectPlay4 IDirectPlay4A
Definition: dplay.h:59
#define ok(value,...)
#define IDirectPlay3_Release(p)
Definition: dplay.h:696
#define IDirectPlay3_AddRef(p)
Definition: dplay.h:695
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
#define IDirectPlay2_Release(p)
Definition: dplay.h:564
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
#define broken(x)
Definition: _sntprintf.h:21
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
#define S_OK
Definition: intsafe.h:59
unsigned int ULONG
Definition: retypes.h:1
struct IDirectPlay3 IDirectPlay3A
Definition: dplay.h:53
#define IDirectPlayX_QueryInterface(p, a, b)
Definition: dplay.h:864

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);
6704  IDirectPlayLobby_Release(dpl2A);
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);
6716  IDirectPlayLobby_Release(dpl3A);
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);
6727  IDirectPlayLobby_Release(dpl3A);
6729  IDirectPlayLobby_Release(dpl2A);
6732  refcount = IDirectPlayLobby_Release(dpl);
6733  ok(refcount == 0, "refcount == %u, expected 0\n", refcount);
6734 }
#define E_NOINTERFACE
Definition: winerror.h:2364
#define IDirectPlayLobby_QueryInterface(p, a, b)
Definition: dplobby.h:454
HRESULT hr
Definition: shlfolder.c:183
struct IDirectPlayLobby3 IDirectPlayLobby3A
Definition: dplobby.h:50
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define ok(value,...)
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define IDirectPlayLobby_Release(p)
Definition: dplobby.h:456
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
#define IDirectPlayLobby_AddRef(p)
Definition: dplobby.h:455
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
#define broken(x)
Definition: _sntprintf.h:21
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
struct IDirectPlayLobby2 IDirectPlayLobby2A
Definition: dplobby.h:44
#define S_OK
Definition: intsafe.h:59
struct IDirectPlayLobby IDirectPlayLobbyA
Definition: dplobby.h:38
unsigned int ULONG
Definition: retypes.h:1
#define IDirectPlayX_QueryInterface(p, a, b)
Definition: dplay.h:864

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,
3485  NULL, NULL, 0, DPGROUP_STAGINGAREA );
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,
3503  NULL, NULL, 0, DPGROUP_STAGINGAREA );
3504  checkHR( DP_OK, hr );
3505 
3506  hr = IDirectPlayX_CreateGroupInGroup( pDP, idGroupParent, &idGroup,
3507  NULL, NULL, 0,
3508  DPGROUP_HIDDEN |
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 DPGROUP_HIDDEN
Definition: dplay.h:1013
#define IDirectPlayX_CreateGroup(p, a, b, c, d, e)
Definition: dplay.h:870
#define IDirectPlayX_Close(p)
Definition: dplay.h:869
#define DPERR_UNINITIALIZED
Definition: dplay.h:125
#define U1(x)
Definition: test.h:172
HRESULT hr
Definition: shlfolder.c:183
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define DPERR_INVALIDGROUP
Definition: dplay.h:105
#define DPERR_INVALIDPARAMS
Definition: dplay.h:103
static LPCSTR dpMsgType2str(DWORD dwType)
Definition: dplayx.c:223
#define ZeroMemory
Definition: winbase.h:1635
#define DPID_SYSMSG
Definition: dplay.h:161
#define IDirectPlayX_Release(p)
Definition: dplay.h:866
char * LPSTR
Definition: xmlstorage.h:182
DWORD dwMaxPlayers
Definition: dplay.h:238
DWORD dwSize
Definition: dplay.h:232
#define IDirectPlayX_CreateGroupInGroup(p, a, b, c, d, e, f)
Definition: dplay.h:899
#define IDirectPlayX_Open(p, a, b)
Definition: dplay.h:889
GUID guidApplication
Definition: dplay.h:235
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
static void check_messages(IDirectPlay4 *pDP, DPID *dpid, DWORD dpidSize, lpCallbackData callbackData)
Definition: dplayx.c:590
#define DP_OK
Definition: dplay.h:88
#define DPSESSION_CLIENTSERVER
Definition: dplay.h:277
#define DPSYS_CREATEPLAYERORGROUP
Definition: dplay.h:1085
#define ok(value,...)
#define IDirectPlayX_CreatePlayer(p, a, b, c, d, e, f)
Definition: dplay.h:871
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
struct tagDPNAME DPNAME
#define DPPLAYERTYPE_GROUP
Definition: dplay.h:1134
char szTrace1[1024]
Definition: dplayx.c:75
#define DPOPEN_CREATE
Definition: dplay.h:264
#define check(expected, result)
Definition: dplayx.c:32
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
#define checkFlags(expected, result, flags)
Definition: dplayx.c:48
#define checkStr(expected, result)
Definition: dplayx.c:44
DWORD DPID
Definition: dplay.h:158
#define todo_wine
Definition: test.h:154
#define FLAGS_DPGROUP
#define IDirectPlayX_Receive(p, a, b, c, d, e)
Definition: dplay.h:890
#define DPPLAYER_SERVERPLAYER
Definition: dplay.h:1005
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
#define DPGROUP_STAGINGAREA
Definition: dplay.h:1011
DWORD dwSize
Definition: dplay.h:188
#define DPGROUP_LOCAL
Definition: dplay.h:1012
unsigned int UINT
Definition: ndis.h:50
static void init_TCPIP_provider(IDirectPlay4 *pDP, LPCSTR strIPAddressString, WORD port)
Definition: dplayx.c:654
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
DWORD dwFlags
Definition: dplay.h:233
struct tagDPSESSIONDESC2 DPSESSIONDESC2
#define win_skip
Definition: test.h:141
#define HeapFree(x, y, z)
Definition: compat.h:394
#define checkConv(expected, result, function)
Definition: dplayx.c:57
#define checkHR(expected, result)
Definition: dplayx.c:40
#define SUCCEEDED(hr)
Definition: intsafe.h:57

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,
2053  0, DPPLAYER_SERVERPLAYER );
2054  checkHR( DP_OK, hr );
2055  check( DPID_SERVERPLAYER, dpid );
2056 
2057  hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
2058  0, DPPLAYER_SERVERPLAYER );
2060 
2061  IDirectPlayX_DestroyPlayer( pDP[0], dpid );
2062 
2063  hr = IDirectPlayX_CreatePlayer( pDP[0], &dpid, NULL, NULL, NULL,
2064  0, DPPLAYER_SERVERPLAYER );
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,
2076  0, DPPLAYER_SERVERPLAYER );
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,
2086  0, ( DPPLAYER_SERVERPLAYER |
2087  DPPLAYER_SPECTATOR ) );
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,
2105  0, DPPLAYER_SERVERPLAYER );
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 );
2118  hr = IDirectPlayX_EnumSessions( pDP[1], &dpsd, 0, EnumSessions_cb_join,
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,
2128  0, DPPLAYER_SERVERPLAYER );
2129  checkHR( DP_OK, hr );
2130  check( DPID_SERVERPLAYER, dpid );
2131 
2132  hr = IDirectPlayX_CreatePlayer( pDP[1], &dpid, NULL, NULL, NULL,
2133  0, DPPLAYER_SERVERPLAYER );
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 IDirectPlayX_Close(p)
Definition: dplay.h:869
#define DPERR_UNINITIALIZED
Definition: dplay.h:125
#define U1(x)
Definition: test.h:172
#define DPERR_CANTCREATEPLAYER
Definition: dplay.h:95
HRESULT hr
Definition: shlfolder.c:183
#define DPERR_INVALIDPARAMS
Definition: dplay.h:103
static BOOL CALLBACK EnumSessions_cb_join(LPCDPSESSIONDESC2 lpThisSD, LPDWORD lpdwTimeOut, DWORD dwFlags, LPVOID lpContext)
Definition: dplayx.c:706
#define ZeroMemory
Definition: winbase.h:1635
#define DPSESSION_NEWPLAYERSDISABLED
Definition: dplay.h:267
#define IDirectPlayX_Release(p)
Definition: dplay.h:866
char * LPSTR
Definition: xmlstorage.h:182
#define DPERR_INVALIDFLAGS
Definition: dplay.h:100
DWORD dwSize
Definition: dplay.h:232
#define IDirectPlayX_Open(p, a, b)
Definition: dplay.h:889
GUID guidApplication
Definition: dplay.h:235
#define DP_OK
Definition: dplay.h:88
#define DPSESSION_CLIENTSERVER
Definition: dplay.h:277
#define ok(value,...)
#define IDirectPlayX_CreatePlayer(p, a, b, c, d, e, f)
Definition: dplay.h:871
smooth NULL
Definition: ftsmooth.c:416
struct tagDPNAME DPNAME
#define IDirectPlayX_DestroyPlayer(p, a)
Definition: dplay.h:874
#define DPOPEN_CREATE
Definition: dplay.h:264
#define check(expected, result)
Definition: dplayx.c:32
LONG HRESULT
Definition: typedefs.h:77
#define DPID_SERVERPLAYER
Definition: dplay.h:163
#define IDirectPlayX_EnumSessions(p, a, b, c, d, e)
Definition: dplay.h:878
DWORD DPID
Definition: dplay.h:158
#define todo_wine
Definition: test.h:154
#define U2(x)
Definition: wordpad.c:45
#define DPPLAYER_SERVERPLAYER
Definition: dplay.h:1005
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
static void init_TCPIP_provider(IDirectPlay4 *pDP, LPCSTR strIPAddressString, WORD port)
Definition: dplayx.c:654
DWORD dwFlags
Definition: dplay.h:233
Definition: name.c:36
struct tagDPSESSIONDESC2 DPSESSIONDESC2
#define DPPLAYER_SPECTATOR
Definition: dplay.h:1006
#define DPERR_ACCESSDENIED
Definition: dplay.h:90
#define win_skip
Definition: test.h:141
#define checkHR(expected, result)
Definition: dplayx.c:40
#define SUCCEEDED(hr)
Definition: intsafe.h:57
GLuint const GLchar * name
Definition: glext.h:6031

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 )
756  IDirectPlayX_Release( pDP );
757  hr = pDirectPlayCreate( (LPGUID) &DPSPGUID_TCPIP, &pDP, NULL );
758  checkHR( DP_OK, hr );
759  if ( hr == DP_OK )
760  IDirectPlayX_Release( pDP );
761 
762 }
HRESULT hr
Definition: shlfolder.c:183
#define DPERR_INVALIDPARAMS
Definition: dplay.h:103
#define IDirectPlayX_Release(p)
Definition: dplay.h:866
#define DP_OK
Definition: dplay.h:88
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define GUID_NULL
Definition: ks.h:106
#define checkHR(expected, result)
Definition: dplayx.c:40

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);
1175  IDirectPlayX_Release(pDP);
1177 
1178  HeapFree( GetProcessHeap(), 0, pAddress );
1179 }
#define IDirectPlayX_Close(p)
Definition: dplay.h:869
HRESULT hr
Definition: shlfolder.c:183
#define DPERR_BUFFERTOOSMALL
Definition: dplay.h:92
#define IDirectPlayX_Release(p)
Definition: dplay.h:866
#define DP_OK
Definition: dplay.h:88
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
#define IDirectPlayLobby_Release(p)
Definition: dplobby.h:456
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
struct _GUID GUID
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
USHORT port
Definition: uri.c:227
#define HeapFree(x, y, z)
Definition: compat.h:394
#define IDirectPlayLobby_CreateCompoundAddress(p, a, b, c, d)
Definition: dplobby.h:470
#define checkHR(expected, result)
Definition: dplayx.c:40
#define SUCCEEDED(hr)
Definition: intsafe.h:57

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;
993  callbackData.dwFlags = DPCONNECTION_DIRECTPLAYLOBBY;
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 DPCONNECTION_DIRECTPLAYLOBBY
Definition: dplay.h:983
HRESULT hr
Definition: shlfolder.c:183
#define DPCONNECTION_DIRECTPLAY
Definition: dplay.h:982
#define DPERR_INVALIDPARAMS
Definition: dplay.h:103
#define IDirectPlayX_Release(p)
Definition: dplay.h:866
#define DPERR_INVALIDFLAGS
Definition: dplay.h:100
#define DP_OK
Definition: dplay.h:88
UINT dwCounter1
Definition: dplayx.c:73
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
static BOOL CALLBACK EnumConnections_cb(LPCGUID lpguidSP, LPVOID lpConnection, DWORD dwConnectionSize, LPCDPNAME lpName, DWORD dwFlags, LPVOID lpContext)
Definition: dplayx.c:909
#define check(expected, result)
Definition: dplayx.c:32