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
ac5418b1
Commit
ac5418b1
authored
Oct 28, 2016
by
Alistair Leslie-Hughes
Committed by
Alexandre Julliard
Nov 01, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dpnet: Semi-stub IDirectPlay8Peer SetPeerInfo.
Signed-off-by:
Alistair Leslie-Hughes
<
leslie_alistair@hotmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
62d20551
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
136 additions
and
34 deletions
+136
-34
address.c
dlls/dpnet/address.c
+0
-31
dpnet_private.h
dlls/dpnet/dpnet_private.h
+22
-0
peer.c
dlls/dpnet/peer.c
+45
-3
peer.c
dlls/dpnet/tests/peer.c
+69
-0
No files found.
dlls/dpnet/address.c
View file @
ac5418b1
...
...
@@ -39,37 +39,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
dpnet
);
static
inline
void
*
heap_alloc
(
size_t
len
)
{
return
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
}
static
inline
void
*
heap_realloc
(
void
*
mem
,
size_t
len
)
{
return
HeapReAlloc
(
GetProcessHeap
(),
0
,
mem
,
len
);
}
static
inline
BOOL
heap_free
(
void
*
mem
)
{
return
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
}
static
inline
LPWSTR
heap_strdupW
(
LPCWSTR
str
)
{
LPWSTR
ret
=
NULL
;
if
(
str
)
{
DWORD
size
;
size
=
(
strlenW
(
str
)
+
1
)
*
sizeof
(
WCHAR
);
ret
=
heap_alloc
(
size
);
if
(
ret
)
memcpy
(
ret
,
str
,
size
);
}
return
ret
;
}
static
char
*
heap_strdupA
(
const
char
*
str
)
{
char
*
ret
;
...
...
dlls/dpnet/dpnet_private.h
View file @
ac5418b1
...
...
@@ -26,6 +26,7 @@
#endif
#include <wine/list.h>
#include "wine/unicode.h"
#include "dplay8.h"
#include "dplobby8.h"
...
...
@@ -146,6 +147,27 @@ typedef struct {
#define FE(x) { x, #x }
#define GE(x) { &x, #x }
static
inline
void
*
heap_alloc
(
size_t
len
)
{
return
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
}
static
inline
void
*
heap_realloc
(
void
*
mem
,
size_t
len
)
{
return
HeapReAlloc
(
GetProcessHeap
(),
0
,
mem
,
len
);
}
static
inline
BOOL
heap_free
(
void
*
mem
)
{
return
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
}
static
inline
WCHAR
*
heap_strdupW
(
const
WCHAR
*
src
)
{
WCHAR
*
dst
;
if
(
!
src
)
return
NULL
;
if
((
dst
=
heap_alloc
(
(
strlenW
(
src
)
+
1
)
*
sizeof
(
WCHAR
)
)))
strcpyW
(
dst
,
src
);
return
dst
;
}
#endif
dlls/dpnet/peer.c
View file @
ac5418b1
...
...
@@ -48,6 +48,10 @@ typedef struct IDirectPlay8PeerImpl
DWORD
flags
;
void
*
usercontext
;
WCHAR
*
username
;
void
*
data
;
DWORD
datasize
;
DPN_SP_CAPS
spcaps
;
}
IDirectPlay8PeerImpl
;
...
...
@@ -92,7 +96,12 @@ static ULONG WINAPI IDirectPlay8PeerImpl_Release(IDirectPlay8Peer *iface)
TRACE
(
"(%p) ref=%d
\n
"
,
This
,
RefCount
);
if
(
!
RefCount
)
HeapFree
(
GetProcessHeap
(),
0
,
This
);
{
heap_free
(
This
->
username
);
heap_free
(
This
->
data
);
heap_free
(
This
);
}
return
RefCount
;
}
...
...
@@ -310,9 +319,42 @@ static HRESULT WINAPI IDirectPlay8PeerImpl_SetPeerInfo(IDirectPlay8Peer *iface,
const
DPN_PLAYER_INFO
*
const
pdpnPlayerInfo
,
void
*
const
pvAsyncContext
,
DPNHANDLE
*
const
phAsyncHandle
,
const
DWORD
dwFlags
)
{
FIXME
(
"(%p)->(%p,%p,%p,%x): stub
\n
"
,
iface
,
pdpnPlayerInfo
,
pvAsyncContext
,
phAsyncHandle
,
dwFlags
);
IDirectPlay8PeerImpl
*
This
=
impl_from_IDirectPlay8Peer
(
iface
);
return
DPNERR_GENERIC
;
FIXME
(
"(%p)->(%p,%p,%p,%x) Semi-stub.
\n
"
,
This
,
pdpnPlayerInfo
,
pvAsyncContext
,
phAsyncHandle
,
dwFlags
);
if
(
!
pdpnPlayerInfo
)
return
E_POINTER
;
if
(
phAsyncHandle
)
FIXME
(
"Async handle currently not supported.
\n
"
);
if
(
pdpnPlayerInfo
->
dwInfoFlags
&
DPNINFO_NAME
)
{
heap_free
(
This
->
username
);
This
->
username
=
NULL
;
if
(
pdpnPlayerInfo
->
pwszName
)
{
This
->
username
=
heap_strdupW
(
pdpnPlayerInfo
->
pwszName
);
if
(
!
This
->
username
)
return
E_OUTOFMEMORY
;
}
}
if
(
pdpnPlayerInfo
->
dwInfoFlags
&
DPNINFO_DATA
)
{
heap_free
(
This
->
data
);
This
->
datasize
=
pdpnPlayerInfo
->
dwDataSize
;
This
->
data
=
heap_alloc
(
pdpnPlayerInfo
->
dwDataSize
);
if
(
!
This
->
data
)
return
E_OUTOFMEMORY
;
memcpy
(
This
->
data
,
pdpnPlayerInfo
->
pvData
,
pdpnPlayerInfo
->
dwDataSize
);
}
return
S_OK
;
}
static
HRESULT
WINAPI
IDirectPlay8PeerImpl_GetPeerInfo
(
IDirectPlay8Peer
*
iface
,
const
DPNID
dpnid
,
...
...
dlls/dpnet/tests/peer.c
View file @
ac5418b1
...
...
@@ -212,6 +212,74 @@ static void test_get_sp_caps(void)
"expected 0x10000, got 0x%x
\n
"
,
caps
.
dwSystemBufferSize
);
}
static
void
test_player_info
(
void
)
{
HRESULT
hr
;
DPN_PLAYER_INFO
info
;
WCHAR
name
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
0
};
WCHAR
name2
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
'2'
,
0
};
WCHAR
data
[]
=
{
'X'
,
'X'
,
'X'
,
'X'
,
0
};
ZeroMemory
(
&
info
,
sizeof
(
DPN_PLAYER_INFO
)
);
info
.
dwSize
=
sizeof
(
DPN_PLAYER_INFO
);
info
.
dwInfoFlags
=
DPNINFO_NAME
;
hr
=
IDirectPlay8Peer_SetPeerInfo
(
peer
,
NULL
,
NULL
,
NULL
,
DPNSETPEERINFO_SYNC
);
ok
(
hr
==
E_POINTER
,
"got %x
\n
"
,
hr
);
info
.
pwszName
=
NULL
;
hr
=
IDirectPlay8Peer_SetPeerInfo
(
peer
,
&
info
,
NULL
,
NULL
,
DPNSETPEERINFO_SYNC
);
ok
(
hr
==
S_OK
,
"got %x
\n
"
,
hr
);
info
.
pwszName
=
name
;
hr
=
IDirectPlay8Peer_SetPeerInfo
(
peer
,
&
info
,
NULL
,
NULL
,
DPNSETPEERINFO_SYNC
);
ok
(
hr
==
S_OK
,
"got %x
\n
"
,
hr
);
info
.
dwInfoFlags
=
DPNINFO_NAME
;
info
.
pwszName
=
name2
;
hr
=
IDirectPlay8Peer_SetPeerInfo
(
peer
,
&
info
,
NULL
,
NULL
,
DPNSETPEERINFO_SYNC
);
ok
(
hr
==
S_OK
,
"got %x
\n
"
,
hr
);
if
(
0
)
/* Crashes on windows */
{
info
.
dwInfoFlags
=
DPNINFO_DATA
;
info
.
pwszName
=
NULL
;
info
.
pvData
=
NULL
;
info
.
dwDataSize
=
sizeof
(
data
);
hr
=
IDirectPlay8Peer_SetPeerInfo
(
peer
,
&
info
,
NULL
,
NULL
,
DPNSETPEERINFO_SYNC
);
ok
(
hr
==
S_OK
,
"got %x
\n
"
,
hr
);
}
info
.
dwInfoFlags
=
DPNINFO_DATA
;
info
.
pwszName
=
NULL
;
info
.
pvData
=
data
;
info
.
dwDataSize
=
0
;
hr
=
IDirectPlay8Peer_SetPeerInfo
(
peer
,
&
info
,
NULL
,
NULL
,
DPNSETPEERINFO_SYNC
);
ok
(
hr
==
S_OK
,
"got %x
\n
"
,
hr
);
info
.
dwInfoFlags
=
DPNINFO_DATA
;
info
.
pwszName
=
NULL
;
info
.
pvData
=
data
;
info
.
dwDataSize
=
sizeof
(
data
);
hr
=
IDirectPlay8Peer_SetPeerInfo
(
peer
,
&
info
,
NULL
,
NULL
,
DPNSETPEERINFO_SYNC
);
ok
(
hr
==
S_OK
,
"got %x
\n
"
,
hr
);
info
.
dwInfoFlags
=
DPNINFO_DATA
|
DPNINFO_NAME
;
info
.
pwszName
=
name
;
info
.
pvData
=
data
;
info
.
dwDataSize
=
sizeof
(
data
);
hr
=
IDirectPlay8Peer_SetPeerInfo
(
peer
,
&
info
,
NULL
,
NULL
,
DPNSETPEERINFO_SYNC
);
ok
(
hr
==
S_OK
,
"got %x
\n
"
,
hr
);
/* Leave PeerInfo with only the name set. */
info
.
dwInfoFlags
=
DPNINFO_DATA
|
DPNINFO_NAME
;
info
.
pwszName
=
name
;
info
.
pvData
=
NULL
;
info
.
dwDataSize
=
0
;
hr
=
IDirectPlay8Peer_SetPeerInfo
(
peer
,
&
info
,
NULL
,
NULL
,
DPNSETPEERINFO_SYNC
);
ok
(
hr
==
S_OK
,
"got %x
\n
"
,
hr
);
}
static
void
test_cleanup_dp
(
void
)
{
HRESULT
hr
;
...
...
@@ -238,5 +306,6 @@ START_TEST(peer)
test_enum_service_providers
();
test_enum_hosts
();
test_get_sp_caps
();
test_player_info
();
test_cleanup_dp
();
}
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