32#define check(expected, result) \
33 ok( (expected) == (result), \
34 "expected=%d got=%d\n", \
35 (int)(expected), (int)(result) );
36#define checkLP(expected, result) \
37 ok( (expected) == (result), \
38 "expected=%p got=%p\n", \
40#define checkHR(expected, result) \
41 ok( (expected) == (result), \
42 "expected=%s got=%s\n", \
43 dpResult2str(expected), dpResult2str(result) );
44#define checkStr(expected, result) \
45 ok( (result != NULL) && (!strcmp(expected, result)), \
46 "expected=%s got=%s\n", \
48#define checkFlags(expected, result, flags) \
49 ok( (expected) == (result), \
50 "expected=0x%08x(%s) got=0x%08x(%s)\n", \
51 expected, dwFlags2str(expected, flags), \
52 result, dwFlags2str(result, flags) );
53#define checkGuid(expected, result) \
54 ok( IsEqualGUID(expected, result), \
55 "expected=%s got=%s\n", \
56 Guid2str(expected), Guid2str(result) );
57#define checkConv(expected, result, function) \
58 ok( (expected) == (result), \
59 "expected=0x%08x(%s) got=0x%08x(%s)\n", \
60 expected, function(expected), \
61 result, function(result) );
64DEFINE_GUID(appGuid, 0xbdcfe03e, 0xf0ec, 0x415b, 0x82, 0x11, 0x6f, 0x86, 0xd8, 0x19, 0x7f, 0xe1);
65DEFINE_GUID(appGuid2, 0x93417d3f, 0x7d26, 0x46ba, 0xb5, 0x76, 0xfe, 0x4b, 0x20, 0xbb, 0xad, 0x70);
66DEFINE_GUID(
GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
67DEFINE_GUID(invalid_guid, 0x7b48b707, 0x0034, 0xc000, 0x02, 0x00, 0x00, 0x00, 0xec, 0xf6, 0x32, 0x00);
91 static char buff[10][256];
102 if (!
guid)
return "(null)";
106 return "DPSPGUID_IPX";
108 return "DPSPGUID_TCPIP";
110 return "DPSPGUID_SERIAL";
112 return "DPSPGUID_MODEM";
115 return "DPAID_TotalSize";
117 return "DPAID_ServiceProvider";
119 return "DPAID_LobbyProvider";
121 return "DPAID_Phone";
123 return "DPAID_PhoneW";
125 return "DPAID_Modem";
127 return "DPAID_ModemW";
131 return "DPAID_INetW";
133 return "DPAID_INetPort";
135 return "DPAID_ComPort";
145 case DP_OK:
return "DP_OK";
244 default:
return "UNKNOWN";
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)
582 for (
i=0;
i<dpidSize;
i++)
584 if ( idPlayer == dpid[
i] )
622 DWORD dwDataSize = 1024;
631 lpData, &dwDataSize )) )
659 DWORD dwAddressSize = 0;
660 IDirectPlayLobby3 *pDPL;
664 &IID_IDirectPlayLobby3A, (
LPVOID*) &pDPL );
665 ok (
SUCCEEDED (
hr),
"CCI of CLSID_DirectPlayLobby / IID_IDirectPlayLobby3A failed\n");
669 addressElements[0].
guidDataType = DPAID_ServiceProvider;
676 addressElements[1].
lpData = (
LPVOID) strIPAddressString;
688 NULL, &dwAddressSize );
695 pAddress, &dwAddressSize );
711 IDirectPlay4 *pDP = lpContext;
757 hr = pDirectPlayCreate( (
LPGUID) &DPSPGUID_TCPIP, &pDP,
NULL );
768 if (!prov)
return TRUE;
787 if (!prov)
return TRUE;
814 ok(
FAILED(
hr),
"DirectPlayEnumerateA expected to fail\n");
819 ok(
FAILED(
hr),
"DirectPlayEnumerateA expected to fail\n");
824 ok(
arg.call_count > 0,
"Expected at least one valid provider\n");
825 trace(
"Found %d providers\n",
arg.call_count);
828 for(
i = 0;
i <
arg.call_count;
i++)
837 ok(
arg.call_count == 1,
"Expected 1, got %d\n",
arg.call_count);
844 ok(
FAILED(
hr),
"DirectPlayEnumerateW expected to fail\n");
849 ok(
FAILED(
hr),
"DirectPlayEnumerateW expected to fail\n");
856 ok(
arg.call_count > 0,
"Expected at least one valid provider\n");
859 for(
i = 0;
i <
arg.call_count;
i++)
868 ok(
arg.call_count == 1,
"Expected 1, got %d\n",
arg.call_count);
881 &DPAID_ServiceProvider,
884 static REFGUID sps[] = { &DPSPGUID_SERIAL, &DPSPGUID_MODEM,
885 &DPSPGUID_IPX, &DPSPGUID_TCPIP };
911 DWORD dwConnectionSize,
918 IDirectPlayLobby *pDPL;
931 &IID_IDirectPlayLobby3A, (
LPVOID*) &pDPL );
932 ok(
SUCCEEDED(
hr),
"CCI of CLSID_DirectPlayLobby / IID_IDirectPlayLobby3A failed\n");
938 dwConnectionSize, callbackData );
957 &IID_IDirectPlay4A, (
LPVOID*) &pDP );
959 ok (
SUCCEEDED(
hr),
"CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n");
965 &callbackData, callbackData.
dwFlags );
972 &callbackData, callbackData.
dwFlags );
979 &callbackData, callbackData.
dwFlags );
988 &callbackData, callbackData.
dwFlags );
995 &callbackData, callbackData.
dwFlags );
1003 &callbackData, callbackData.
dwFlags );
1011 &callbackData, callbackData.
dwFlags );
1023 DWORD dwConnectionSize,
1028 IDirectPlay4 *pDP = lpContext;
1058 &IID_IDirectPlay4A, (
LPVOID*) &pDP );
1060 ok (
SUCCEEDED(
hr),
"CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n");
1080 &IID_IDirectPlay4A, (
LPVOID*) &pDP );
1081 ok (
SUCCEEDED(
hr),
"CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n");
1140 DWORD dwAddressSize = 0;
1141 IDirectPlayLobby3 *pDPL;
1145 &IID_IDirectPlay4A, (
LPVOID*) &pDP );
1146 ok(
SUCCEEDED(
hr),
"CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
1151 &IID_IDirectPlayLobby3A, (
LPVOID*) &pDPL );
1152 ok (
SUCCEEDED (
hr),
"CCI of CLSID_DirectPlayLobby / IID_IDirectPlayLobby3A failed\n");
1155 addressElements[0].
guidDataType = DPAID_ServiceProvider;
1157 addressElements[0].
lpData = (
void*) &DPSPGUID_TCPIP;
1170 pAddress, &dwAddressSize );
1188 IDirectPlay4 *pDP = lpContext;
1204 U2(dpsd).lpszPasswordA = (
LPSTR)
"sonic boom";
1209 U2(dpsd).lpszPasswordA = (
LPSTR)
"hadouken";
1228 IDirectPlay4 *pDP, *pDP_server;
1234 &IID_IDirectPlay4A, (
LPVOID*) &pDP_server );
1235 ok(
SUCCEEDED(
hr),
"CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
1239 &IID_IDirectPlay4A, (
LPVOID*) &pDP );
1240 ok(
SUCCEEDED(
hr),
"CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
1341 U2(dpsd_server).lpszPasswordA = (
LPSTR)
"hadouken";
1372 if (
U2(*lpThisSD).lpszPasswordA !=
NULL )
1397 &IID_IDirectPlay4A, (
LPVOID*) &pDP );
1398 ok(
SUCCEEDED(
hr),
"CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
1434 &IID_IDirectPlay4A, (
LPVOID*) &pDP );
1435 ok(
SUCCEEDED(
hr),
"CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
1483 U1(dpsd_server[0]).lpszSessionNameA = (
LPSTR)
"normal";
1488 U1(dpsd_server[1]).lpszSessionNameA = (
LPSTR)
"full";
1493 U1(dpsd_server[2]).lpszSessionNameA = (
LPSTR)
"no new";
1499 U1(dpsd_server[3]).lpszSessionNameA = (
LPSTR)
"no join";
1505 U1(dpsd_server[4]).lpszSessionNameA = (
LPSTR)
"private";
1510 U2(dpsd_server[4]).lpszPasswordA = (
LPSTR)
"password";
1512 U1(dpsd_server[5]).lpszSessionNameA = (
LPSTR)
"protected";
1517 U2(dpsd_server[5]).lpszPasswordA = (
LPSTR)
"password";
1523 if (!pDPserver[
i])
return;
1530 &callbackData, -1 );
1545 &callbackData, callbackData.
dwFlags );
1554 &callbackData, callbackData.
dwFlags );
1562 &callbackData, callbackData.
dwFlags );
1570 &callbackData, callbackData.
dwFlags );
1578 &callbackData, callbackData.
dwFlags );
1587 &callbackData, callbackData.
dwFlags );
1595 &callbackData, callbackData.
dwFlags );
1602 &callbackData, callbackData.
dwFlags );
1611 &callbackData, callbackData.
dwFlags );
1618 &callbackData, callbackData.
dwFlags );
1633 U2(dpsd_server[
i]).lpszPasswordA = (
LPSTR)
"password";
1641 &callbackData, callbackData.
dwFlags );
1648 &callbackData, callbackData.
dwFlags );
1654 for (
i=4;
i<=5;
i++)
1657 U2(dpsd_server[
i]).lpszPasswordA =
NULL;
1661 for (
i=4;
i<=5;
i++)
1669 &callbackData, callbackData.
dwFlags );
1675 for (
i=4;
i<=5;
i++)
1678 U2(dpsd_server[
i]).lpszPasswordA = (
LPSTR)
"password";
1682 for (
i=4;
i<=5;
i++)
1690 &callbackData, callbackData.
dwFlags );
1697 &callbackData, callbackData.
dwFlags );
1702 U2(dpsd).lpszPasswordA = (
LPSTR)
"bad_password";
1706 &callbackData, callbackData.
dwFlags );
1713 &callbackData, callbackData.
dwFlags );
1718 U2(dpsd).lpszPasswordA = (
LPSTR)
"password";
1721 &callbackData, callbackData.
dwFlags );
1726 U2(dpsd).lpszPasswordA =
NULL;
1730 &callbackData, callbackData.
dwFlags );
1739 for (
i=4;
i<=5;
i++)
1744 U2(dpsd_server[
i]).lpszPasswordA =
NULL;
1747 U1(dpsd_server[4]).lpszSessionNameA = (
LPSTR)
"normal1";
1749 U1(dpsd_server[5]).lpszSessionNameA = (
LPSTR)
"normal2";
1751 for (
i=4;
i<=5;
i++)
1761 &callbackData, callbackData.
dwFlags );
1768 &callbackData, callbackData.
dwFlags );
1778 &callbackData, callbackData.
dwFlags );
1782 for (
i=4;
i<=5;
i++)
1796 IDirectPlay4 *pDP[2];
1810 &IID_IDirectPlay4A, (
LPVOID*) &pDP[
i] );
1811 ok(
SUCCEEDED(
hr),
"CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
1876 check( -1, dwDataSize );
1902 checkGuid( &appGuid, &lpData[
i]->guidApplication );
1906 checkGuid( &lpData[0]->guidInstance, &lpData[1]->guidInstance );
1909 U1(dpsd).lpszSessionNameA = (
LPSTR)
"Wahaa";
1916 checkStr(
U1(dpsd).lpszSessionNameA,
U1(*lpData[1]).lpszSessionNameA );
1951 checkGuid( &appGuid, &lpData[0]->guidApplication );
1952 checkGuid( &lpData[1]->guidInstance, &lpData[0]->guidInstance );
1978 IDirectPlay4 *pDP[2];
1986 &IID_IDirectPlay4A, (
LPVOID*) &pDP[0] );
1987 ok(
SUCCEEDED(
hr),
"CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
1991 &IID_IDirectPlay4A, (
LPVOID*) &pDP[1] );
1992 ok(
SUCCEEDED(
hr),
"CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
2151 IDirectPlay4 *pDP[2];
2164 &IID_IDirectPlay4A, (
LPVOID*) &pDP[
i] );
2165 ok(
SUCCEEDED(
hr),
"CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
2320 LPCSTR lpDataFake =
"big_fake_data_chunk";
2323 LPCSTR lpData =
"remote_data";
2326 LPCSTR lpDataLocal =
"local_data";
2331 DWORD dwDataSizeGet = dwDataSizeFake;
2335 &IID_IDirectPlay4A, (
LPVOID*) &pDP );
2336 ok(
SUCCEEDED(
hr),
"CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
2392 dwDataSizeGet = dwDataSizeFake;
2393 strcpy(lpDataGet, lpDataFake);
2395 &dwDataSizeGet, 0 );
2397 check( dwDataSize, dwDataSizeGet );
2401 strcpy(lpDataGet, lpDataFake);
2404 check( dwDataSize, dwDataSizeGet );
2406 strcpy(lpDataGet, lpDataFake);
2409 check( dwDataSize, dwDataSizeGet );
2413 dwDataSizeGet = dwDataSizeFake;
2414 strcpy(lpDataGet, lpDataFake);
2417 check( dwDataSize, dwDataSizeGet );
2421 dwDataSizeGet = dwDataSizeFake;
2422 strcpy(lpDataGet, lpDataFake);
2425 check( dwDataSize, dwDataSizeGet );
2428 dwDataSizeGet = dwDataSizeFake;
2429 strcpy(lpDataGet, lpDataFake);
2433 check( dwDataSize, dwDataSizeGet );
2436 dwDataSizeGet = dwDataSizeFake;
2437 strcpy(lpDataGet, lpDataFake);
2441 check( 0, dwDataSizeGet );
2444 dwDataSizeGet = dwDataSizeFake;
2445 strcpy(lpDataGet, lpDataFake);
2449 check( 0, dwDataSizeGet );
2454 strcpy(lpDataGet, lpDataFake);
2458 check( 0, dwDataSizeGet );
2461 dwDataSizeGet = dwDataSizeFake;
2462 strcpy(lpDataGet, lpDataFake);
2466 check( 0, dwDataSizeGet );
2487 dwDataSizeGet = dwDataSizeFake;
2488 strcpy(lpDataGet, lpDataFake);
2491 check( dwDataSize, dwDataSizeGet );
2494 dwDataSizeGet = dwDataSizeFake;
2495 strcpy(lpDataGet, lpDataFake);
2499 check( dwDataSize, dwDataSizeGet );
2502 dwDataSizeGet = dwDataSizeFake;
2503 strcpy(lpDataGet, lpDataFake);
2507 check( dwDataSizeLocal, dwDataSizeGet );
2508 checkStr( lpDataLocal, lpDataGet );
2510 dwDataSizeGet = dwDataSizeFake;
2511 strcpy(lpDataGet, lpDataFake);
2515 check( dwDataSizeLocal, dwDataSizeGet );
2516 checkStr( lpDataLocal, lpDataGet );
2520 strcpy(lpDataGet, lpDataFake);
2524 check( dwDataSizeLocal, dwDataSizeGet );
2527 dwDataSizeGet = dwDataSizeFake;
2528 strcpy(lpDataGet, lpDataFake);
2532 check( dwDataSizeLocal, dwDataSizeGet );
2547 dwDataSizeLocal, 0 );
2550 dwDataSizeGet = dwDataSizeFake;
2551 strcpy(lpDataGet, lpDataFake);
2554 check( dwDataSizeLocal, dwDataSizeGet );
2555 checkStr( lpDataLocal, lpDataGet );
2562 dwDataSizeGet = dwDataSizeFake + 1;
2563 strcpy(lpDataGet, lpData);
2566 check( dwDataSizeFake, dwDataSizeGet );
2580 IDirectPlay4 *pDP[2];
2587 DWORD dwDataSize = 1024;
2595 &IID_IDirectPlay4A, (
LPVOID*) &pDP[
i] );
2596 ok(
SUCCEEDED(
hr),
"CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
2610 check( 1024, dwDataSize );
2630 check( 1024, dwDataSize );
2652 check( 1024, dwDataSize );
2656 U1(playerName).lpszShortNameA = (
LPSTR)
"player_name";
2657 U2(playerName).lpszLongNameA = (
LPSTR)
"player_long_name";
2671 check( 1024, dwDataSize );
2679 check( -1, dwDataSize );
2696 check( 45, dwDataSize );
2706 check( 16, dwDataSize );
2716 check( 16, dwDataSize );
2721 check( 16, dwDataSize );
2725 check( 16, dwDataSize );
2738 check( 45, dwDataSize );
2744 U1(playerName).lpszShortNameA = (
LPSTR)
"no_propagation";
2751 lpData, &dwDataSize );
2753 check( 48, dwDataSize );
2758 lpData, &dwDataSize );
2760 check( 45, dwDataSize );
2765 U1(playerName).lpszShortNameA = (
LPSTR)
"no_propagation_2";
2772 lpData, &dwDataSize );
2774 check( 50, dwDataSize );
2779 lpData, &dwDataSize );
2781 check( 45, dwDataSize );
2785 U1(playerName).lpszShortNameA = (
LPSTR)
"propagation";
2792 lpData, &dwDataSize );
2794 check( 45, dwDataSize );
2798 U1(playerName).lpszShortNameA = (
LPSTR)
"propagation_2";
2805 lpData, &dwDataSize );
2807 check( 47, dwDataSize );
2833 IDirectPlay4 *pDP = lpContext;
2852 U1(dpCredentials).lpszUsernameA = (
LPSTR)
"user";
2853 U2(dpCredentials).lpszPasswordA = (
LPSTR)
"pass";
2855 NULL, &dpCredentials );
2864 IDirectPlay4 *pDP[2];
2870 DWORD dwDataSize = 1024;
2877 &IID_IDirectPlay4A, (
LPVOID*) &pDP[
i] );
2878 ok(
SUCCEEDED(
hr),
"CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
2921 lpData, &dwDataSize );
2923 check( 1024, dwDataSize );
2954 lpData, &dwDataSize );
2956 check( 1024, dwDataSize );
2961 lpData, &dwDataSize );
2963 check( 1024, dwDataSize );
2967 lpData, &dwDataSize );
2969 check( 1024, dwDataSize );
2974 NULL, &dwDataSize );
2976 check( 0, dwDataSize );
2980 lpData, &dwDataSize );
2982 check( 0, dwDataSize );
2985 lpData, &dwDataSize );
2987 check( 0, dwDataSize );
2992 lpData, &dwDataSize );
2994 check( 1024, dwDataSize );
3012 &DPAID_ServiceProvider,
3015 static DWORD sizes[] = { 4, 16, 12, 24, 4, 16, 10, 20 };
3048 IDirectPlay4 *pDP[2];
3049 IDirectPlayLobby3 *pDPL;
3056 DWORD dwDataSize = 1024;
3063 &IID_IDirectPlay4A, (
LPVOID*) &pDP[
i] );
3064 ok(
SUCCEEDED(
hr),
"CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
3069 &IID_IDirectPlayLobby3A, (
LPVOID*) &pDPL );
3070 ok(
SUCCEEDED(
hr),
"CCI of CLSID_DirectPlayLobby / IID_IDirectPlayLobby3A failed\n" );
3091 check( 1024, dwDataSize );
3096 check( 1024, dwDataSize );
3116 lpData, &dwDataSize );
3118 check( 1024, dwDataSize );
3122 lpData, &dwDataSize );
3124 check( 1024, dwDataSize );
3129 NULL, &dwDataSize );
3131 check( 136, dwDataSize );
3135 lpData, &dwDataSize );
3137 check( 136, dwDataSize );
3140 lpData, &dwDataSize );
3142 check( 136, dwDataSize );
3151 lpData, &dwDataSize );
3153 check( 136, dwDataSize );
3164 lpData, &dwDataSize );
3166 check( 130, dwDataSize );
3188 IDirectPlay4 *pDP[2];
3200 &IID_IDirectPlay4A, (
LPVOID*) &pDP[
i] );
3201 ok(
SUCCEEDED(
hr),
"CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
3298 DPID idFrom, idTo, dpid, idGroup, idGroupParent;
3308 DWORD dwDataSizeGet = 1024;
3313 &IID_IDirectPlay4A, (
LPVOID*) &pDP );
3314 ok(
SUCCEEDED(
hr),
"CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
3372 &groupName,
NULL, 0, 0 );
3376 &groupName,
NULL, 0, 0 );
3381 U1(groupName).lpszShortNameA = (
LPSTR) lpData;
3385 &groupName,
NULL, 0, 0 );
3389 &groupName,
NULL, 0, 0 );
3396 dwDataSizeGet = 1024;
3402 check( 48, dwDataSizeGet );
3406 check( 48 + dwDataSize, dwDataSizeGet );
3461 dwDataSizeGet = 1024;
3516 dwDataSizeGet = 1024;
3520 check( 48, dwDataSizeGet );
3605 IDirectPlay4 *pDP[2];
3607 DPID dpid[2], idGroup, idOwner;
3615 &IID_IDirectPlay4A, (
LPVOID*) &pDP[
i] );
3616 ok(
SUCCEEDED(
hr),
"CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
3629 check( 0, idOwner );
3700 strlen(
"DPENUMPLAYERS_") ) );
3704 if ( playerIndex <
'5' )
3773 IDirectPlay4 *pDP[3];
3784 &IID_IDirectPlay4A, (
LPVOID*) &pDP[
i] );
3785 ok(
SUCCEEDED(
hr),
"CCI of CLSID_DirectPlay / IID_IDirectPlay4A failed\n" );
3796 callbackData.
dpid = dpid;
3917 callbackData.
pDP = pDP[2];
3925 callbackData.
pDP = pDP[2];