diff --git a/.gitignore b/.gitignore index 21f12e37a57..772db5f96fb 100644 --- a/.gitignore +++ b/.gitignore @@ -213,6 +213,9 @@ dlls/dnsapi/tests/testlist.c dlls/dplay/libdplay.def dlls/dplay/version.res dlls/dplayx/libdplayx.def +dlls/dplayx/tests/*.ok +dlls/dplayx/tests/dplayx_crosstest.exe +dlls/dplayx/tests/testlist.c dlls/dplayx/version.res dlls/dpnet/libdpnet.def dlls/dpnet/version.res @@ -803,6 +806,7 @@ programs/winetest/d3d9_test.exe programs/winetest/ddraw_test.exe programs/winetest/dinput_test.exe programs/winetest/dnsapi_test.exe +programs/winetest/dplayx_test.exe programs/winetest/dsound_test.exe programs/winetest/gdi32_test.exe programs/winetest/hlink_test.exe diff --git a/Makefile.in b/Makefile.in index 86fa21340b7..bc1d654d766 100644 --- a/Makefile.in +++ b/Makefile.in @@ -216,6 +216,7 @@ ALL_MAKEFILES = \ dlls/dnsapi/tests/Makefile \ dlls/dplay/Makefile \ dlls/dplayx/Makefile \ + dlls/dplayx/tests/Makefile \ dlls/dpnet/Makefile \ dlls/dpnhpast/Makefile \ dlls/dsound/Makefile \ @@ -549,6 +550,7 @@ dlls/dnsapi/Makefile: dlls/dnsapi/Makefile.in dlls/Makedll.rules dlls/dnsapi/tests/Makefile: dlls/dnsapi/tests/Makefile.in dlls/Maketest.rules dlls/dplay/Makefile: dlls/dplay/Makefile.in dlls/Makedll.rules dlls/dplayx/Makefile: dlls/dplayx/Makefile.in dlls/Makedll.rules +dlls/dplayx/tests/Makefile: dlls/dplayx/tests/Makefile.in dlls/Maketest.rules dlls/dpnet/Makefile: dlls/dpnet/Makefile.in dlls/Makedll.rules dlls/dpnhpast/Makefile: dlls/dpnhpast/Makefile.in dlls/Makedll.rules dlls/dsound/Makefile: dlls/dsound/Makefile.in dlls/Makedll.rules diff --git a/configure b/configure index 67f50c2c57e..c7023cfc7d5 100755 --- a/configure +++ b/configure @@ -20563,6 +20563,8 @@ ac_config_files="$ac_config_files dlls/dplay/Makefile" ac_config_files="$ac_config_files dlls/dplayx/Makefile" +ac_config_files="$ac_config_files dlls/dplayx/tests/Makefile" + ac_config_files="$ac_config_files dlls/dpnet/Makefile" ac_config_files="$ac_config_files dlls/dpnhpast/Makefile" @@ -21709,6 +21711,7 @@ do "dlls/dnsapi/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/dnsapi/tests/Makefile" ;; "dlls/dplay/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/dplay/Makefile" ;; "dlls/dplayx/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/dplayx/Makefile" ;; + "dlls/dplayx/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/dplayx/tests/Makefile" ;; "dlls/dpnet/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/dpnet/Makefile" ;; "dlls/dpnhpast/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/dpnhpast/Makefile" ;; "dlls/dsound/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/dsound/Makefile" ;; diff --git a/configure.ac b/configure.ac index f3638686eb0..7c27c342fe2 100644 --- a/configure.ac +++ b/configure.ac @@ -1586,6 +1586,7 @@ AC_CONFIG_FILES([dlls/dnsapi/Makefile]) AC_CONFIG_FILES([dlls/dnsapi/tests/Makefile]) AC_CONFIG_FILES([dlls/dplay/Makefile]) AC_CONFIG_FILES([dlls/dplayx/Makefile]) +AC_CONFIG_FILES([dlls/dplayx/tests/Makefile]) AC_CONFIG_FILES([dlls/dpnet/Makefile]) AC_CONFIG_FILES([dlls/dpnhpast/Makefile]) AC_CONFIG_FILES([dlls/dsound/Makefile]) diff --git a/dlls/Makefile.in b/dlls/Makefile.in index 2e3cafcf4b6..95c98d3e811 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -233,6 +233,7 @@ TESTSUBDIRS = \ ddraw/tests \ dinput/tests \ dnsapi/tests \ + dplayx/tests \ dsound/tests \ gdi32/tests \ hlink/tests \ diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index f5c630ae9c0..3ca90db937e 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -3244,7 +3244,11 @@ static HRESULT WINAPI DP_SetSessionDesc HeapFree( GetProcessHeap(), 0, This->dp2->lpSessionDesc ); This->dp2->lpSessionDesc = lpTempSessDesc; - + if( bInitial ) + { + /*Initializing session GUID*/ + CoCreateGuid( &(This->dp2->lpSessionDesc->guidInstance) ); + } /* Set the new */ DP_CopySessionDesc( This->dp2->lpSessionDesc, lpSessDesc, bAnsi ); diff --git a/dlls/dplayx/tests/Makefile.in b/dlls/dplayx/tests/Makefile.in new file mode 100644 index 00000000000..82a9064ec5b --- /dev/null +++ b/dlls/dplayx/tests/Makefile.in @@ -0,0 +1,14 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +TESTDLL = dplayx.dll +IMPORTS = ole32 kernel32 +EXTRALIBS = -ldxguid + +CTESTS = \ + dplayx.c + +@MAKE_TEST_RULES@ + +@DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/dplayx/tests/dplayx.c b/dlls/dplayx/tests/dplayx.c new file mode 100644 index 00000000000..6568f13566e --- /dev/null +++ b/dlls/dplayx/tests/dplayx.c @@ -0,0 +1,89 @@ +/* DirectPlay Conformance Tests + * + * Copyright 2007 - Alessandro Pignotti + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "wine/test.h" +#include + +static BOOL validSP = FALSE; /*This global variable is needed until wine has a working service provider + implementation*/ + +static BOOL CALLBACK EnumConnectionsCallback(LPCGUID lpguidSP, LPVOID lpConnection, + DWORD dwConnectionSize, LPCDPNAME lpName, DWORD dwFlags, LPVOID lpContext) +{ + HRESULT hr; + + if(IsEqualGUID(lpguidSP,&DPSPGUID_TCPIP)) + { + /*I'm forcing TCP/IP Sevice provider*/ + hr = IDirectPlayX_InitializeConnection((LPDIRECTPLAY4) lpContext, lpConnection, 0); + todo_wine ok( SUCCEEDED( hr ), "It's not possible to initialize TCP/IP service provider\n"); + if( SUCCEEDED( hr )) + validSP = TRUE; + return FALSE; + } + return TRUE; +} + +static void test_session_guid(LPDIRECTPLAY4 pDP) +{ + GUID appGuid; + GUID zeroGuid; + DPSESSIONDESC2 sessionDesc; + LPDPSESSIONDESC2 newSession; + DWORD sessionSize; + static char name[] = "DPlay conformance test"; + + CoCreateGuid( &appGuid ); + IDirectPlayX_EnumConnections(pDP, &appGuid, EnumConnectionsCallback, pDP, 0); + if( validSP ) + { + memset(&sessionDesc, 0, sizeof( DPSESSIONDESC2 )); + memset(&zeroGuid, 0, 16); + + sessionDesc.dwSize = sizeof( DPSESSIONDESC2 ); + memcpy(&sessionDesc.guidApplication, &appGuid, 16); + sessionDesc.dwFlags = DPSESSION_CLIENTSERVER; + sessionDesc.lpszSessionNameA = name; + sessionDesc.dwMaxPlayers = 10; + sessionDesc.dwCurrentPlayers = 0; + IDirectPlayX_Open(pDP, &sessionDesc, DPOPEN_CREATE); + /* I read the sessiondesc from directplay in a fresh memory location, + because directplay does not touch the original struct, but saves + internally a version with the session guid set*/ + IDirectPlayX_GetSessionDesc(pDP, NULL, &sessionSize); + newSession=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sessionSize); + IDirectPlayX_GetSessionDesc(pDP, newSession, &sessionSize); + todo_wine ok( !IsEqualGUID(&newSession->guidInstance, &zeroGuid), "Session guid not initialized"); + HeapFree(GetProcessHeap(), 0, newSession); + } +} + + +START_TEST(dplayx) +{ + LPDIRECTPLAY4 pDP; + + CoInitialize( NULL ); + CoCreateInstance(&CLSID_DirectPlay, NULL, CLSCTX_ALL, &IID_IDirectPlay4A, (VOID**)&pDP); + + test_session_guid( pDP ); + + IDirectPlayX_Release( pDP ); + CoUninitialize(); +} diff --git a/programs/winetest/Makefile.in b/programs/winetest/Makefile.in index f35b768432c..056d636a975 100644 --- a/programs/winetest/Makefile.in +++ b/programs/winetest/Makefile.in @@ -36,6 +36,7 @@ TESTBINS = \ ddraw_test.exe \ dinput_test.exe \ dnsapi_test.exe \ + dplayx_test.exe \ dsound_test.exe \ gdi32_test.exe \ hlink_test.exe \ @@ -109,6 +110,8 @@ dinput_test.exe: $(DLLDIR)/dinput/tests/dinput_test.exe$(DLLEXT) cp $(DLLDIR)/dinput/tests/dinput_test.exe$(DLLEXT) $@ && $(STRIP) $@ dnsapi_test.exe: $(DLLDIR)/dnsapi/tests/dnsapi_test.exe$(DLLEXT) cp $(DLLDIR)/dnsapi/tests/dnsapi_test.exe$(DLLEXT) $@ && $(STRIP) $@ +dplayx_test.exe: $(DLLDIR)/dplayx/tests/dplayx_test.exe$(DLLEXT) + cp $(DLLDIR)/dplayx/tests/dplayx_test.exe$(DLLEXT) $@ && $(STRIP) $@ dsound_test.exe: $(DLLDIR)/dsound/tests/dsound_test.exe$(DLLEXT) cp $(DLLDIR)/dsound/tests/dsound_test.exe$(DLLEXT) $@ && $(STRIP) $@ gdi32_test.exe: $(DLLDIR)/gdi32/tests/gdi32_test.exe$(DLLEXT) diff --git a/programs/winetest/winetest.rc b/programs/winetest/winetest.rc index 423eb1ac583..2401ac1598a 100644 --- a/programs/winetest/winetest.rc +++ b/programs/winetest/winetest.rc @@ -159,6 +159,7 @@ d3d9_test.exe TESTRES "d3d9_test.exe" ddraw_test.exe TESTRES "ddraw_test.exe" dinput_test.exe TESTRES "dinput_test.exe" dnsapi_test.exe TESTRES "dnsapi_test.exe" +dplayx_test.exe TESTRES "dplayx_test.exe" dsound_test.exe TESTRES "dsound_test.exe" gdi32_test.exe TESTRES "gdi32_test.exe" hlink_test.exe TESTRES "hlink_test.exe"