Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
42165af8
Commit
42165af8
authored
Jul 31, 2008
by
Ismael Barros
Committed by
Alexandre Julliard
Aug 01, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dplayx: Tests for DirectPlayCreate.
parent
a1b76460
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
135 additions
and
52 deletions
+135
-52
dplay.c
dlls/dplayx/dplay.c
+6
-0
Makefile.in
dlls/dplayx/tests/Makefile.in
+1
-1
dplayx.c
dlls/dplayx/tests/dplayx.c
+128
-51
No files found.
dlls/dplayx/dplay.c
View file @
42165af8
...
@@ -5406,6 +5406,12 @@ HRESULT WINAPI DirectPlayCreate
...
@@ -5406,6 +5406,12 @@ HRESULT WINAPI DirectPlayCreate
return
CLASS_E_NOAGGREGATION
;
return
CLASS_E_NOAGGREGATION
;
}
}
if
(
(
lplpDP
==
NULL
)
||
(
lpGUID
==
NULL
)
)
{
return
DPERR_INVALIDPARAMS
;
}
/* Create an IDirectPlay object. We don't support that so we'll cheat and
/* Create an IDirectPlay object. We don't support that so we'll cheat and
give them an IDirectPlay2A object and hope that doesn't cause problems */
give them an IDirectPlay2A object and hope that doesn't cause problems */
if
(
DP_CreateInterface
(
&
IID_IDirectPlay2A
,
(
LPVOID
*
)
lplpDP
)
!=
DP_OK
)
if
(
DP_CreateInterface
(
&
IID_IDirectPlay2A
,
(
LPVOID
*
)
lplpDP
)
!=
DP_OK
)
...
...
dlls/dplayx/tests/Makefile.in
View file @
42165af8
...
@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
...
@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR
=
@srcdir@
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
VPATH
=
@srcdir@
TESTDLL
=
dplayx.dll
TESTDLL
=
dplayx.dll
IMPORTS
=
ole32 kernel32
IMPORTS
=
dplayx
ole32 kernel32
CTESTS
=
\
CTESTS
=
\
dplayx.c
dplayx.c
...
...
dlls/dplayx/tests/dplayx.c
View file @
42165af8
...
@@ -18,77 +18,154 @@
...
@@ -18,77 +18,154 @@
*/
*/
#include "wine/test.h"
#include "wine/test.h"
#include <stdio.h>
#define INITGUID
#define INITGUID
#include <dplay.h>
#include <dplay.h>
#include <dplobby.h>
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
,
#define checkHR(expected, result) \
DWORD
dwConnectionSize
,
LPCDPNAME
lpName
,
DWORD
dwFlags
,
LPVOID
lpContext
)
ok( (expected) == (result), \
"expected=%s got=%s\n", \
dpResult2str(expected), dpResult2str(result) );
DEFINE_GUID
(
GUID_NULL
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
);
static
LPSTR
get_temp_buffer
(
void
)
{
{
HRESULT
hr
;
static
UINT
index
=
0
;
static
char
buff
[
10
][
256
];
index
=
(
index
+
1
)
%
10
;
*
buff
[
index
]
=
0
;
return
buff
[
index
];
}
static
LPCSTR
dpResult2str
(
HRESULT
hr
)
{
switch
(
hr
)
{
case
DP_OK
:
return
"DP_OK"
;
case
DPERR_ALREADYINITIALIZED
:
return
"DPERR_ALREADYINITIALIZED"
;
case
DPERR_ACCESSDENIED
:
return
"DPERR_ACCESSDENIED"
;
case
DPERR_ACTIVEPLAYERS
:
return
"DPERR_ACTIVEPLAYERS"
;
case
DPERR_BUFFERTOOSMALL
:
return
"DPERR_BUFFERTOOSMALL"
;
case
DPERR_CANTADDPLAYER
:
return
"DPERR_CANTADDPLAYER"
;
case
DPERR_CANTCREATEGROUP
:
return
"DPERR_CANTCREATEGROUP"
;
case
DPERR_CANTCREATEPLAYER
:
return
"DPERR_CANTCREATEPLAYER"
;
case
DPERR_CANTCREATESESSION
:
return
"DPERR_CANTCREATESESSION"
;
case
DPERR_CAPSNOTAVAILABLEYET
:
return
"DPERR_CAPSNOTAVAILABLEYET"
;
case
DPERR_EXCEPTION
:
return
"DPERR_EXCEPTION"
;
case
DPERR_GENERIC
:
return
"DPERR_GENERIC"
;
case
DPERR_INVALIDFLAGS
:
return
"DPERR_INVALIDFLAGS"
;
case
DPERR_INVALIDOBJECT
:
return
"DPERR_INVALIDOBJECT"
;
case
DPERR_INVALIDPARAMS
:
return
"DPERR_INVALIDPARAMS"
;
/* symbol with the same value: DPERR_INVALIDPARAM */
case
DPERR_INVALIDPLAYER
:
return
"DPERR_INVALIDPLAYER"
;
case
DPERR_INVALIDGROUP
:
return
"DPERR_INVALIDGROUP"
;
case
DPERR_NOCAPS
:
return
"DPERR_NOCAPS"
;
case
DPERR_NOCONNECTION
:
return
"DPERR_NOCONNECTION"
;
case
DPERR_NOMEMORY
:
return
"DPERR_NOMEMORY"
;
/* symbol with the same value: DPERR_OUTOFMEMORY */
case
DPERR_NOMESSAGES
:
return
"DPERR_NOMESSAGES"
;
case
DPERR_NONAMESERVERFOUND
:
return
"DPERR_NONAMESERVERFOUND"
;
case
DPERR_NOPLAYERS
:
return
"DPERR_NOPLAYERS"
;
case
DPERR_NOSESSIONS
:
return
"DPERR_NOSESSIONS"
;
case
DPERR_PENDING
:
return
"DPERR_PENDING"
;
case
DPERR_SENDTOOBIG
:
return
"DPERR_SENDTOOBIG"
;
case
DPERR_TIMEOUT
:
return
"DPERR_TIMEOUT"
;
case
DPERR_UNAVAILABLE
:
return
"DPERR_UNAVAILABLE"
;
case
DPERR_UNSUPPORTED
:
return
"DPERR_UNSUPPORTED"
;
case
DPERR_BUSY
:
return
"DPERR_BUSY"
;
case
DPERR_USERCANCEL
:
return
"DPERR_USERCANCEL"
;
case
DPERR_NOINTERFACE
:
return
"DPERR_NOINTERFACE"
;
case
DPERR_CANNOTCREATESERVER
:
return
"DPERR_CANNOTCREATESERVER"
;
case
DPERR_PLAYERLOST
:
return
"DPERR_PLAYERLOST"
;
case
DPERR_SESSIONLOST
:
return
"DPERR_SESSIONLOST"
;
case
DPERR_UNINITIALIZED
:
return
"DPERR_UNINITIALIZED"
;
case
DPERR_NONEWPLAYERS
:
return
"DPERR_NONEWPLAYERS"
;
case
DPERR_INVALIDPASSWORD
:
return
"DPERR_INVALIDPASSWORD"
;
case
DPERR_CONNECTING
:
return
"DPERR_CONNECTING"
;
case
DPERR_CONNECTIONLOST
:
return
"DPERR_CONNECTIONLOST"
;
case
DPERR_UNKNOWNMESSAGE
:
return
"DPERR_UNKNOWNMESSAGE"
;
case
DPERR_CANCELFAILED
:
return
"DPERR_CANCELFAILED"
;
case
DPERR_INVALIDPRIORITY
:
return
"DPERR_INVALIDPRIORITY"
;
case
DPERR_NOTHANDLED
:
return
"DPERR_NOTHANDLED"
;
case
DPERR_CANCELLED
:
return
"DPERR_CANCELLED"
;
case
DPERR_ABORTED
:
return
"DPERR_ABORTED"
;
case
DPERR_BUFFERTOOLARGE
:
return
"DPERR_BUFFERTOOLARGE"
;
case
DPERR_CANTCREATEPROCESS
:
return
"DPERR_CANTCREATEPROCESS"
;
case
DPERR_APPNOTSTARTED
:
return
"DPERR_APPNOTSTARTED"
;
case
DPERR_INVALIDINTERFACE
:
return
"DPERR_INVALIDINTERFACE"
;
case
DPERR_NOSERVICEPROVIDER
:
return
"DPERR_NOSERVICEPROVIDER"
;
case
DPERR_UNKNOWNAPPLICATION
:
return
"DPERR_UNKNOWNAPPLICATION"
;
case
DPERR_NOTLOBBIED
:
return
"DPERR_NOTLOBBIED"
;
case
DPERR_SERVICEPROVIDERLOADED
:
return
"DPERR_SERVICEPROVIDERLOADED"
;
case
DPERR_ALREADYREGISTERED
:
return
"DPERR_ALREADYREGISTERED"
;
case
DPERR_NOTREGISTERED
:
return
"DPERR_NOTREGISTERED"
;
case
DPERR_AUTHENTICATIONFAILED
:
return
"DPERR_AUTHENTICATIONFAILED"
;
case
DPERR_CANTLOADSSPI
:
return
"DPERR_CANTLOADSSPI"
;
case
DPERR_ENCRYPTIONFAILED
:
return
"DPERR_ENCRYPTIONFAILED"
;
case
DPERR_SIGNFAILED
:
return
"DPERR_SIGNFAILED"
;
case
DPERR_CANTLOADSECURITYPACKAGE
:
return
"DPERR_CANTLOADSECURITYPACKAGE"
;
case
DPERR_ENCRYPTIONNOTSUPPORTED
:
return
"DPERR_ENCRYPTIONNOTSUPPORTED"
;
case
DPERR_CANTLOADCAPI
:
return
"DPERR_CANTLOADCAPI"
;
case
DPERR_NOTLOGGEDIN
:
return
"DPERR_NOTLOGGEDIN"
;
case
DPERR_LOGONDENIED
:
return
"DPERR_LOGONDENIED"
;
case
CLASS_E_NOAGGREGATION
:
return
"CLASS_E_NOAGGREGATION"
;
if
(
IsEqualGUID
(
lpguidSP
,
&
DPSPGUID_TCPIP
))
default:
{
{
/*I'm forcing the TCP/IP Service provider*/
LPSTR
buffer
=
get_temp_buffer
();
hr
=
IDirectPlayX_InitializeConnection
((
LPDIRECTPLAY4
)
lpContext
,
lpConnection
,
0
);
sprintf
(
buffer
,
"%d"
,
HRESULT_CODE
(
hr
)
);
if
(
SUCCEEDED
(
hr
))
return
buffer
;
validSP
=
TRUE
;
}
return
FALSE
;
}
}
return
TRUE
;
}
}
static
void
test_session_guid
(
LPDIRECTPLAY4
pDP
)
/* DirectPlayCreate */
static
void
test_DirectPlayCreate
(
void
)
{
{
GUID
appGuid
;
GUID
zeroGuid
;
DPSESSIONDESC2
sessionDesc
;
LPDPSESSIONDESC2
newSession
;
DWORD
sessionSize
;
static
char
name
[]
=
"DPlay conformance test"
;
CoCreateGuid
(
&
appGuid
)
;
LPDIRECTPLAY
pDP
;
IDirectPlayX_EnumConnections
(
pDP
,
&
appGuid
,
EnumConnectionsCallback
,
pDP
,
0
)
;
HRESULT
hr
;
if
(
!
validSP
)
/* TODO: Check how it behaves with pUnk!=NULL */
{
skip
(
"Tests will not work without a valid service provider, skipping.
\n
"
);
/* pDP==NULL */
return
;
hr
=
DirectPlayCreate
(
NULL
,
NULL
,
NULL
);
}
checkHR
(
DPERR_INVALIDPARAMS
,
hr
);
hr
=
DirectPlayCreate
(
(
LPGUID
)
&
GUID_NULL
,
NULL
,
NULL
);
checkHR
(
DPERR_INVALIDPARAMS
,
hr
);
hr
=
DirectPlayCreate
(
(
LPGUID
)
&
DPSPGUID_TCPIP
,
NULL
,
NULL
);
checkHR
(
DPERR_INVALIDPARAMS
,
hr
);
/* pUnk==NULL, pDP!=NULL */
hr
=
DirectPlayCreate
(
NULL
,
&
pDP
,
NULL
);
checkHR
(
DPERR_INVALIDPARAMS
,
hr
);
hr
=
DirectPlayCreate
(
(
LPGUID
)
&
GUID_NULL
,
&
pDP
,
NULL
);
checkHR
(
DP_OK
,
hr
);
if
(
hr
==
DP_OK
)
IDirectPlayX_Release
(
pDP
);
hr
=
DirectPlayCreate
(
(
LPGUID
)
&
DPSPGUID_TCPIP
,
&
pDP
,
NULL
);
todo_wine
checkHR
(
DP_OK
,
hr
);
if
(
hr
==
DP_OK
)
IDirectPlayX_Release
(
pDP
);
memset
(
&
sessionDesc
,
0
,
sizeof
(
DPSESSIONDESC2
));
memset
(
&
zeroGuid
,
0
,
16
);
sessionDesc
.
dwSize
=
sizeof
(
DPSESSIONDESC2
);
memcpy
(
&
sessionDesc
.
guidApplication
,
&
appGuid
,
16
);
sessionDesc
.
dwFlags
=
DPSESSION_CLIENTSERVER
;
U1
(
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
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
newSession
);
}
}
START_TEST
(
dplayx
)
START_TEST
(
dplayx
)
{
{
LPDIRECTPLAY4
pDP
;
CoInitialize
(
NULL
);
CoInitialize
(
NULL
);
CoCreateInstance
(
&
CLSID_DirectPlay
,
NULL
,
CLSCTX_ALL
,
&
IID_IDirectPlay4A
,
(
VOID
**
)
&
pDP
);
test_
session_guid
(
pDP
);
test_
DirectPlayCreate
(
);
IDirectPlayX_Release
(
pDP
);
CoUninitialize
();
CoUninitialize
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment