Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
a56fcef7
Commit
a56fcef7
authored
Jul 10, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dplayx: Use nameless unions/structs.
parent
aa9aace5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
121 additions
and
129 deletions
+121
-129
dplay.c
dlls/dplayx/dplay.c
+66
-68
dplayx_global.c
dlls/dplayx/dplayx_global.c
+48
-50
dplobby.c
dlls/dplayx/dplobby.c
+3
-5
name_server.c
dlls/dplayx/name_server.c
+4
-6
No files found.
dlls/dplayx/dplay.c
View file @
a56fcef7
...
...
@@ -22,8 +22,6 @@
#include <stdarg.h>
#include <string.h>
#define NONAMELESSUNION
#include "windef.h"
#include "winerror.h"
#include "winbase.h"
...
...
@@ -1345,8 +1343,8 @@ static lpPlayerData DP_CreatePlayer( IDirectPlayImpl *This, DPID *lpid, DPNAME *
static
void
DP_DeleteDPNameStruct
(
LPDPNAME
lpDPName
)
{
HeapFree
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
lpDPName
->
u1
.
lpszShortNameA
);
HeapFree
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
lpDPName
->
u2
.
lpszLongNameA
);
HeapFree
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
lpDPName
->
lpszShortNameA
);
HeapFree
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
lpDPName
->
lpszLongNameA
);
}
/* This method assumes that all links to it are already deleted */
...
...
@@ -1411,40 +1409,40 @@ static BOOL DP_CopyDPNAMEStruct( LPDPNAME lpDst, const DPNAME *lpSrc, BOOL bAnsi
}
/* Delete any existing pointers */
HeapFree
(
GetProcessHeap
(),
0
,
lpDst
->
u1
.
lpszShortNameA
);
HeapFree
(
GetProcessHeap
(),
0
,
lpDst
->
u2
.
lpszLongNameA
);
HeapFree
(
GetProcessHeap
(),
0
,
lpDst
->
lpszShortNameA
);
HeapFree
(
GetProcessHeap
(),
0
,
lpDst
->
lpszLongNameA
);
/* Copy as required */
CopyMemory
(
lpDst
,
lpSrc
,
lpSrc
->
dwSize
);
if
(
bAnsi
)
{
if
(
lpSrc
->
u1
.
lpszShortNameA
)
if
(
lpSrc
->
lpszShortNameA
)
{
lpDst
->
u1
.
lpszShortNameA
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
lpSrc
->
u1
.
lpszShortNameA
)
+
1
);
strcpy
(
lpDst
->
u1
.
lpszShortNameA
,
lpSrc
->
u1
.
lpszShortNameA
);
lpDst
->
lpszShortNameA
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
lpSrc
->
lpszShortNameA
)
+
1
);
strcpy
(
lpDst
->
lpszShortNameA
,
lpSrc
->
lpszShortNameA
);
}
if
(
lpSrc
->
u2
.
lpszLongNameA
)
if
(
lpSrc
->
lpszLongNameA
)
{
lpDst
->
u2
.
lpszLongNameA
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
lpSrc
->
u2
.
lpszLongNameA
)
+
1
);
strcpy
(
lpDst
->
u2
.
lpszLongNameA
,
lpSrc
->
u2
.
lpszLongNameA
);
lpDst
->
lpszLongNameA
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
lpSrc
->
lpszLongNameA
)
+
1
);
strcpy
(
lpDst
->
lpszLongNameA
,
lpSrc
->
lpszLongNameA
);
}
}
else
{
if
(
lpSrc
->
u1
.
lpszShortNameA
)
if
(
lpSrc
->
lpszShortNameA
)
{
lpDst
->
u1
.
lpszShortName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
lpSrc
->
u1
.
lpszShortName
)
+
1
)
*
sizeof
(
WCHAR
)
);
lstrcpyW
(
lpDst
->
u1
.
lpszShortName
,
lpSrc
->
u1
.
lpszShortName
);
lpDst
->
lpszShortName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
lpSrc
->
lpszShortName
)
+
1
)
*
sizeof
(
WCHAR
)
);
lstrcpyW
(
lpDst
->
lpszShortName
,
lpSrc
->
lpszShortName
);
}
if
(
lpSrc
->
u2
.
lpszLongNameA
)
if
(
lpSrc
->
lpszLongNameA
)
{
lpDst
->
u2
.
lpszLongName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
lpSrc
->
u2
.
lpszLongName
)
+
1
)
*
sizeof
(
WCHAR
)
);
lstrcpyW
(
lpDst
->
u2
.
lpszLongName
,
lpSrc
->
u2
.
lpszLongName
);
lpDst
->
lpszLongName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
lpSrc
->
lpszLongName
)
+
1
)
*
sizeof
(
WCHAR
)
);
lstrcpyW
(
lpDst
->
lpszLongName
,
lpSrc
->
lpszLongName
);
}
}
...
...
@@ -2675,14 +2673,14 @@ static HRESULT DP_IF_GetGroupName( IDirectPlayImpl *This, DPID idGroup, void *lp
dwRequiredDataSize
=
lpGData
->
name
.
dwSize
;
if
(
lpGData
->
name
.
u1
.
lpszShortNameA
)
if
(
lpGData
->
name
.
lpszShortNameA
)
{
dwRequiredDataSize
+=
strlen
(
lpGData
->
name
.
u1
.
lpszShortNameA
)
+
1
;
dwRequiredDataSize
+=
strlen
(
lpGData
->
name
.
lpszShortNameA
)
+
1
;
}
if
(
lpGData
->
name
.
u2
.
lpszLongNameA
)
if
(
lpGData
->
name
.
lpszLongNameA
)
{
dwRequiredDataSize
+=
strlen
(
lpGData
->
name
.
u2
.
lpszLongNameA
)
+
1
;
dwRequiredDataSize
+=
strlen
(
lpGData
->
name
.
lpszLongNameA
)
+
1
;
}
if
(
(
lpData
==
NULL
)
||
...
...
@@ -2696,24 +2694,24 @@ static HRESULT DP_IF_GetGroupName( IDirectPlayImpl *This, DPID idGroup, void *lp
/* Copy the structure */
CopyMemory
(
lpName
,
&
lpGData
->
name
,
lpGData
->
name
.
dwSize
);
if
(
lpGData
->
name
.
u1
.
lpszShortNameA
)
if
(
lpGData
->
name
.
lpszShortNameA
)
{
strcpy
(
((
char
*
)
lpName
)
+
lpGData
->
name
.
dwSize
,
lpGData
->
name
.
u1
.
lpszShortNameA
);
lpGData
->
name
.
lpszShortNameA
);
}
else
{
lpName
->
u1
.
lpszShortNameA
=
NULL
;
lpName
->
lpszShortNameA
=
NULL
;
}
if
(
lpGData
->
name
.
u1
.
lpszShortNameA
)
if
(
lpGData
->
name
.
lpszShortNameA
)
{
strcpy
(
((
char
*
)
lpName
)
+
lpGData
->
name
.
dwSize
,
lpGData
->
name
.
u1
.
lpszShortNameA
);
lpGData
->
name
.
lpszShortNameA
);
}
else
{
lpName
->
u2
.
lpszLongNameA
=
NULL
;
lpName
->
lpszLongNameA
=
NULL
;
}
return
DP_OK
;
...
...
@@ -3002,14 +3000,14 @@ static HRESULT DP_IF_GetPlayerName( IDirectPlayImpl *This, DPID idPlayer, void *
dwRequiredDataSize
=
lpPList
->
lpPData
->
name
.
dwSize
;
if
(
lpPList
->
lpPData
->
name
.
u1
.
lpszShortNameA
)
if
(
lpPList
->
lpPData
->
name
.
lpszShortNameA
)
{
dwRequiredDataSize
+=
strlen
(
lpPList
->
lpPData
->
name
.
u1
.
lpszShortNameA
)
+
1
;
dwRequiredDataSize
+=
strlen
(
lpPList
->
lpPData
->
name
.
lpszShortNameA
)
+
1
;
}
if
(
lpPList
->
lpPData
->
name
.
u2
.
lpszLongNameA
)
if
(
lpPList
->
lpPData
->
name
.
lpszLongNameA
)
{
dwRequiredDataSize
+=
strlen
(
lpPList
->
lpPData
->
name
.
u2
.
lpszLongNameA
)
+
1
;
dwRequiredDataSize
+=
strlen
(
lpPList
->
lpPData
->
name
.
lpszLongNameA
)
+
1
;
}
if
(
(
lpData
==
NULL
)
||
...
...
@@ -3023,24 +3021,24 @@ static HRESULT DP_IF_GetPlayerName( IDirectPlayImpl *This, DPID idPlayer, void *
/* Copy the structure */
CopyMemory
(
lpName
,
&
lpPList
->
lpPData
->
name
,
lpPList
->
lpPData
->
name
.
dwSize
);
if
(
lpPList
->
lpPData
->
name
.
u1
.
lpszShortNameA
)
if
(
lpPList
->
lpPData
->
name
.
lpszShortNameA
)
{
strcpy
(
((
char
*
)
lpName
)
+
lpPList
->
lpPData
->
name
.
dwSize
,
lpPList
->
lpPData
->
name
.
u1
.
lpszShortNameA
);
lpPList
->
lpPData
->
name
.
lpszShortNameA
);
}
else
{
lpName
->
u1
.
lpszShortNameA
=
NULL
;
lpName
->
lpszShortNameA
=
NULL
;
}
if
(
lpPList
->
lpPData
->
name
.
u1
.
lpszShortNameA
)
if
(
lpPList
->
lpPData
->
name
.
lpszShortNameA
)
{
strcpy
(
((
char
*
)
lpName
)
+
lpPList
->
lpPData
->
name
.
dwSize
,
lpPList
->
lpPData
->
name
.
u2
.
lpszLongNameA
);
lpPList
->
lpPData
->
name
.
lpszLongNameA
);
}
else
{
lpName
->
u2
.
lpszLongNameA
=
NULL
;
lpName
->
lpszLongNameA
=
NULL
;
}
return
DP_OK
;
...
...
@@ -3878,28 +3876,28 @@ static DWORD DP_CalcSessionDescSize( LPCDPSESSIONDESC2 lpSessDesc, BOOL bAnsi )
if
(
bAnsi
)
{
if
(
lpSessDesc
->
u1
.
lpszSessionNameA
)
if
(
lpSessDesc
->
lpszSessionNameA
)
{
dwSize
+=
lstrlenA
(
lpSessDesc
->
u1
.
lpszSessionNameA
)
+
1
;
dwSize
+=
lstrlenA
(
lpSessDesc
->
lpszSessionNameA
)
+
1
;
}
if
(
lpSessDesc
->
u2
.
lpszPasswordA
)
if
(
lpSessDesc
->
lpszPasswordA
)
{
dwSize
+=
lstrlenA
(
lpSessDesc
->
u2
.
lpszPasswordA
)
+
1
;
dwSize
+=
lstrlenA
(
lpSessDesc
->
lpszPasswordA
)
+
1
;
}
}
else
/* UNICODE */
{
if
(
lpSessDesc
->
u1
.
lpszSessionName
)
if
(
lpSessDesc
->
lpszSessionName
)
{
dwSize
+=
sizeof
(
WCHAR
)
*
(
lstrlenW
(
lpSessDesc
->
u1
.
lpszSessionName
)
+
1
);
(
lstrlenW
(
lpSessDesc
->
lpszSessionName
)
+
1
);
}
if
(
lpSessDesc
->
u2
.
lpszPassword
)
if
(
lpSessDesc
->
lpszPassword
)
{
dwSize
+=
sizeof
(
WCHAR
)
*
(
lstrlenW
(
lpSessDesc
->
u2
.
lpszPassword
)
+
1
);
(
lstrlenW
(
lpSessDesc
->
lpszPassword
)
+
1
);
}
}
...
...
@@ -3924,38 +3922,38 @@ static void DP_CopySessionDesc( LPDPSESSIONDESC2 lpSessionDest,
if
(
bAnsi
)
{
if
(
lpSessionSrc
->
u1
.
lpszSessionNameA
)
if
(
lpSessionSrc
->
lpszSessionNameA
)
{
lstrcpyA
(
(
LPSTR
)
lpStartOfFreeSpace
,
lpSessionDest
->
u1
.
lpszSessionNameA
);
lpSessionDest
->
u1
.
lpszSessionNameA
=
(
LPSTR
)
lpStartOfFreeSpace
;
lpSessionDest
->
lpszSessionNameA
);
lpSessionDest
->
lpszSessionNameA
=
(
LPSTR
)
lpStartOfFreeSpace
;
lpStartOfFreeSpace
+=
lstrlenA
(
lpSessionDest
->
u1
.
lpszSessionNameA
)
+
1
;
lstrlenA
(
lpSessionDest
->
lpszSessionNameA
)
+
1
;
}
if
(
lpSessionSrc
->
u2
.
lpszPasswordA
)
if
(
lpSessionSrc
->
lpszPasswordA
)
{
lstrcpyA
(
(
LPSTR
)
lpStartOfFreeSpace
,
lpSessionDest
->
u2
.
lpszPasswordA
);
lpSessionDest
->
u2
.
lpszPasswordA
=
(
LPSTR
)
lpStartOfFreeSpace
;
lpSessionDest
->
lpszPasswordA
);
lpSessionDest
->
lpszPasswordA
=
(
LPSTR
)
lpStartOfFreeSpace
;
}
}
else
/* UNICODE */
{
if
(
lpSessionSrc
->
u1
.
lpszSessionName
)
if
(
lpSessionSrc
->
lpszSessionName
)
{
lstrcpyW
(
(
LPWSTR
)
lpStartOfFreeSpace
,
lpSessionDest
->
u1
.
lpszSessionName
);
lpSessionDest
->
u1
.
lpszSessionName
=
(
LPWSTR
)
lpStartOfFreeSpace
;
lpSessionDest
->
lpszSessionName
);
lpSessionDest
->
lpszSessionName
=
(
LPWSTR
)
lpStartOfFreeSpace
;
lpStartOfFreeSpace
+=
sizeof
(
WCHAR
)
*
(
lstrlenW
(
lpSessionDest
->
u1
.
lpszSessionName
)
+
1
);
(
lstrlenW
(
lpSessionDest
->
lpszSessionName
)
+
1
);
}
if
(
lpSessionSrc
->
u2
.
lpszPassword
)
if
(
lpSessionSrc
->
lpszPassword
)
{
lstrcpyW
(
(
LPWSTR
)
lpStartOfFreeSpace
,
lpSessionDest
->
u2
.
lpszPassword
);
lpSessionDest
->
u2
.
lpszPassword
=
(
LPWSTR
)
lpStartOfFreeSpace
;
lpSessionDest
->
lpszPassword
);
lpSessionDest
->
lpszPassword
=
(
LPWSTR
)
lpStartOfFreeSpace
;
}
}
}
...
...
@@ -4339,8 +4337,8 @@ static HRESULT WINAPI IDirectPlay4AImpl_EnumConnections( IDirectPlay4A *iface,
/* Fill in the DPNAME struct for the service provider */
dpName
.
dwSize
=
sizeof
(
dpName
);
dpName
.
dwFlags
=
0
;
dpName
.
u1
.
lpszShortNameA
=
subKeyName
;
dpName
.
u2
.
lpszLongNameA
=
NULL
;
dpName
.
lpszShortNameA
=
subKeyName
;
dpName
.
lpszLongNameA
=
NULL
;
/* Create the compound address for the service provider.
* NOTE: This is a gruesome architectural scar right now. DP
...
...
@@ -4437,8 +4435,8 @@ static HRESULT WINAPI IDirectPlay4AImpl_EnumConnections( IDirectPlay4A *iface,
/* Fill in the DPNAME struct for the service provider */
dpName
.
dwSize
=
sizeof
(
dpName
);
dpName
.
dwFlags
=
0
;
dpName
.
u1
.
lpszShortNameA
=
subKeyName
;
dpName
.
u2
.
lpszLongNameA
=
NULL
;
dpName
.
lpszShortNameA
=
subKeyName
;
dpName
.
lpszLongNameA
=
NULL
;
/* Create the compound address for the service provider.
NOTE: This is a gruesome architectural scar right now. DP uses DPL and DPL uses DP
...
...
dlls/dplayx/dplayx_global.c
View file @
a56fcef7
...
...
@@ -32,8 +32,6 @@
#include <stdarg.h>
#include <string.h>
#define NONAMELESSUNION
#include "wine/debug.h"
#include "windef.h"
#include "winbase.h"
...
...
@@ -562,20 +560,20 @@ static void DPLAYX_CopyConnStructA( LPDPLCONNECTION dest, const DPLCONNECTION *s
*
dest
->
lpSessionDesc
=
*
src
->
lpSessionDesc
;
/* Session names may or may not exist */
if
(
src
->
lpSessionDesc
->
u1
.
lpszSessionNameA
)
if
(
src
->
lpSessionDesc
->
lpszSessionNameA
)
{
strcpy
(
(
LPSTR
)
lpStartOfFreeSpace
,
src
->
lpSessionDesc
->
u1
.
lpszSessionNameA
);
dest
->
lpSessionDesc
->
u1
.
lpszSessionNameA
=
(
LPSTR
)
lpStartOfFreeSpace
;
strcpy
(
(
LPSTR
)
lpStartOfFreeSpace
,
src
->
lpSessionDesc
->
lpszSessionNameA
);
dest
->
lpSessionDesc
->
lpszSessionNameA
=
(
LPSTR
)
lpStartOfFreeSpace
;
lpStartOfFreeSpace
+=
strlen
(
dest
->
lpSessionDesc
->
u1
.
lpszSessionNameA
)
+
1
;
strlen
(
dest
->
lpSessionDesc
->
lpszSessionNameA
)
+
1
;
}
if
(
src
->
lpSessionDesc
->
u2
.
lpszPasswordA
)
if
(
src
->
lpSessionDesc
->
lpszPasswordA
)
{
strcpy
(
(
LPSTR
)
lpStartOfFreeSpace
,
src
->
lpSessionDesc
->
u2
.
lpszPasswordA
);
dest
->
lpSessionDesc
->
u2
.
lpszPasswordA
=
(
LPSTR
)
lpStartOfFreeSpace
;
strcpy
(
(
LPSTR
)
lpStartOfFreeSpace
,
src
->
lpSessionDesc
->
lpszPasswordA
);
dest
->
lpSessionDesc
->
lpszPasswordA
=
(
LPSTR
)
lpStartOfFreeSpace
;
lpStartOfFreeSpace
+=
strlen
(
dest
->
lpSessionDesc
->
u2
.
lpszPasswordA
)
+
1
;
strlen
(
dest
->
lpSessionDesc
->
lpszPasswordA
)
+
1
;
}
}
...
...
@@ -586,20 +584,20 @@ static void DPLAYX_CopyConnStructA( LPDPLCONNECTION dest, const DPLCONNECTION *s
lpStartOfFreeSpace
+=
sizeof
(
DPNAME
);
*
dest
->
lpPlayerName
=
*
src
->
lpPlayerName
;
if
(
src
->
lpPlayerName
->
u1
.
lpszShortNameA
)
if
(
src
->
lpPlayerName
->
lpszShortNameA
)
{
strcpy
(
(
LPSTR
)
lpStartOfFreeSpace
,
src
->
lpPlayerName
->
u1
.
lpszShortNameA
);
dest
->
lpPlayerName
->
u1
.
lpszShortNameA
=
(
LPSTR
)
lpStartOfFreeSpace
;
strcpy
(
(
LPSTR
)
lpStartOfFreeSpace
,
src
->
lpPlayerName
->
lpszShortNameA
);
dest
->
lpPlayerName
->
lpszShortNameA
=
(
LPSTR
)
lpStartOfFreeSpace
;
lpStartOfFreeSpace
+=
strlen
(
dest
->
lpPlayerName
->
u1
.
lpszShortNameA
)
+
1
;
strlen
(
dest
->
lpPlayerName
->
lpszShortNameA
)
+
1
;
}
if
(
src
->
lpPlayerName
->
u2
.
lpszLongNameA
)
if
(
src
->
lpPlayerName
->
lpszLongNameA
)
{
strcpy
(
(
LPSTR
)
lpStartOfFreeSpace
,
src
->
lpPlayerName
->
u2
.
lpszLongNameA
);
dest
->
lpPlayerName
->
u2
.
lpszLongNameA
=
(
LPSTR
)
lpStartOfFreeSpace
;
strcpy
(
(
LPSTR
)
lpStartOfFreeSpace
,
src
->
lpPlayerName
->
lpszLongNameA
);
dest
->
lpPlayerName
->
lpszLongNameA
=
(
LPSTR
)
lpStartOfFreeSpace
;
lpStartOfFreeSpace
+=
strlen
(
(
LPSTR
)
dest
->
lpPlayerName
->
u2
.
lpszLongName
)
+
1
;
strlen
(
(
LPSTR
)
dest
->
lpPlayerName
->
lpszLongName
)
+
1
;
}
}
...
...
@@ -630,20 +628,20 @@ static void DPLAYX_CopyConnStructW( LPDPLCONNECTION dest, const DPLCONNECTION *s
*
dest
->
lpSessionDesc
=
*
src
->
lpSessionDesc
;
/* Session names may or may not exist */
if
(
src
->
lpSessionDesc
->
u1
.
lpszSessionName
)
if
(
src
->
lpSessionDesc
->
lpszSessionName
)
{
lstrcpyW
(
(
LPWSTR
)
lpStartOfFreeSpace
,
src
->
lpSessionDesc
->
u1
.
lpszSessionName
);
dest
->
lpSessionDesc
->
u1
.
lpszSessionName
=
(
LPWSTR
)
lpStartOfFreeSpace
;
lstrcpyW
(
(
LPWSTR
)
lpStartOfFreeSpace
,
src
->
lpSessionDesc
->
lpszSessionName
);
dest
->
lpSessionDesc
->
lpszSessionName
=
(
LPWSTR
)
lpStartOfFreeSpace
;
lpStartOfFreeSpace
+=
sizeof
(
WCHAR
)
*
(
lstrlenW
(
dest
->
lpSessionDesc
->
u1
.
lpszSessionName
)
+
1
);
(
lstrlenW
(
dest
->
lpSessionDesc
->
lpszSessionName
)
+
1
);
}
if
(
src
->
lpSessionDesc
->
u2
.
lpszPassword
)
if
(
src
->
lpSessionDesc
->
lpszPassword
)
{
lstrcpyW
(
(
LPWSTR
)
lpStartOfFreeSpace
,
src
->
lpSessionDesc
->
u2
.
lpszPassword
);
dest
->
lpSessionDesc
->
u2
.
lpszPassword
=
(
LPWSTR
)
lpStartOfFreeSpace
;
lstrcpyW
(
(
LPWSTR
)
lpStartOfFreeSpace
,
src
->
lpSessionDesc
->
lpszPassword
);
dest
->
lpSessionDesc
->
lpszPassword
=
(
LPWSTR
)
lpStartOfFreeSpace
;
lpStartOfFreeSpace
+=
sizeof
(
WCHAR
)
*
(
lstrlenW
(
dest
->
lpSessionDesc
->
u2
.
lpszPassword
)
+
1
);
(
lstrlenW
(
dest
->
lpSessionDesc
->
lpszPassword
)
+
1
);
}
}
...
...
@@ -654,20 +652,20 @@ static void DPLAYX_CopyConnStructW( LPDPLCONNECTION dest, const DPLCONNECTION *s
lpStartOfFreeSpace
+=
sizeof
(
DPNAME
);
*
dest
->
lpPlayerName
=
*
src
->
lpPlayerName
;
if
(
src
->
lpPlayerName
->
u1
.
lpszShortName
)
if
(
src
->
lpPlayerName
->
lpszShortName
)
{
lstrcpyW
(
(
LPWSTR
)
lpStartOfFreeSpace
,
src
->
lpPlayerName
->
u1
.
lpszShortName
);
dest
->
lpPlayerName
->
u1
.
lpszShortName
=
(
LPWSTR
)
lpStartOfFreeSpace
;
lstrcpyW
(
(
LPWSTR
)
lpStartOfFreeSpace
,
src
->
lpPlayerName
->
lpszShortName
);
dest
->
lpPlayerName
->
lpszShortName
=
(
LPWSTR
)
lpStartOfFreeSpace
;
lpStartOfFreeSpace
+=
sizeof
(
WCHAR
)
*
(
lstrlenW
(
dest
->
lpPlayerName
->
u1
.
lpszShortName
)
+
1
);
(
lstrlenW
(
dest
->
lpPlayerName
->
lpszShortName
)
+
1
);
}
if
(
src
->
lpPlayerName
->
u2
.
lpszLongName
)
if
(
src
->
lpPlayerName
->
lpszLongName
)
{
lstrcpyW
(
(
LPWSTR
)
lpStartOfFreeSpace
,
src
->
lpPlayerName
->
u2
.
lpszLongName
);
dest
->
lpPlayerName
->
u2
.
lpszLongName
=
(
LPWSTR
)
lpStartOfFreeSpace
;
lstrcpyW
(
(
LPWSTR
)
lpStartOfFreeSpace
,
src
->
lpPlayerName
->
lpszLongName
);
dest
->
lpPlayerName
->
lpszLongName
=
(
LPWSTR
)
lpStartOfFreeSpace
;
lpStartOfFreeSpace
+=
sizeof
(
WCHAR
)
*
(
lstrlenW
(
dest
->
lpPlayerName
->
u2
.
lpszLongName
)
+
1
);
(
lstrlenW
(
dest
->
lpPlayerName
->
lpszLongName
)
+
1
);
}
}
...
...
@@ -697,14 +695,14 @@ static DWORD DPLAYX_SizeOfLobbyDataA( const DPLCONNECTION *lpConn )
{
dwTotalSize
+=
sizeof
(
DPSESSIONDESC2
);
if
(
lpConn
->
lpSessionDesc
->
u1
.
lpszSessionNameA
)
if
(
lpConn
->
lpSessionDesc
->
lpszSessionNameA
)
{
dwTotalSize
+=
strlen
(
lpConn
->
lpSessionDesc
->
u1
.
lpszSessionNameA
)
+
1
;
dwTotalSize
+=
strlen
(
lpConn
->
lpSessionDesc
->
lpszSessionNameA
)
+
1
;
}
if
(
lpConn
->
lpSessionDesc
->
u2
.
lpszPasswordA
)
if
(
lpConn
->
lpSessionDesc
->
lpszPasswordA
)
{
dwTotalSize
+=
strlen
(
lpConn
->
lpSessionDesc
->
u2
.
lpszPasswordA
)
+
1
;
dwTotalSize
+=
strlen
(
lpConn
->
lpSessionDesc
->
lpszPasswordA
)
+
1
;
}
}
...
...
@@ -712,14 +710,14 @@ static DWORD DPLAYX_SizeOfLobbyDataA( const DPLCONNECTION *lpConn )
{
dwTotalSize
+=
sizeof
(
DPNAME
);
if
(
lpConn
->
lpPlayerName
->
u1
.
lpszShortNameA
)
if
(
lpConn
->
lpPlayerName
->
lpszShortNameA
)
{
dwTotalSize
+=
strlen
(
lpConn
->
lpPlayerName
->
u1
.
lpszShortNameA
)
+
1
;
dwTotalSize
+=
strlen
(
lpConn
->
lpPlayerName
->
lpszShortNameA
)
+
1
;
}
if
(
lpConn
->
lpPlayerName
->
u2
.
lpszLongNameA
)
if
(
lpConn
->
lpPlayerName
->
lpszLongNameA
)
{
dwTotalSize
+=
strlen
(
lpConn
->
lpPlayerName
->
u2
.
lpszLongNameA
)
+
1
;
dwTotalSize
+=
strlen
(
lpConn
->
lpPlayerName
->
lpszLongNameA
)
+
1
;
}
}
...
...
@@ -744,16 +742,16 @@ static DWORD DPLAYX_SizeOfLobbyDataW( const DPLCONNECTION *lpConn )
{
dwTotalSize
+=
sizeof
(
DPSESSIONDESC2
);
if
(
lpConn
->
lpSessionDesc
->
u1
.
lpszSessionName
)
if
(
lpConn
->
lpSessionDesc
->
lpszSessionName
)
{
dwTotalSize
+=
sizeof
(
WCHAR
)
*
(
lstrlenW
(
lpConn
->
lpSessionDesc
->
u1
.
lpszSessionName
)
+
1
);
(
lstrlenW
(
lpConn
->
lpSessionDesc
->
lpszSessionName
)
+
1
);
}
if
(
lpConn
->
lpSessionDesc
->
u2
.
lpszPassword
)
if
(
lpConn
->
lpSessionDesc
->
lpszPassword
)
{
dwTotalSize
+=
sizeof
(
WCHAR
)
*
(
lstrlenW
(
lpConn
->
lpSessionDesc
->
u2
.
lpszPassword
)
+
1
);
(
lstrlenW
(
lpConn
->
lpSessionDesc
->
lpszPassword
)
+
1
);
}
}
...
...
@@ -761,16 +759,16 @@ static DWORD DPLAYX_SizeOfLobbyDataW( const DPLCONNECTION *lpConn )
{
dwTotalSize
+=
sizeof
(
DPNAME
);
if
(
lpConn
->
lpPlayerName
->
u1
.
lpszShortName
)
if
(
lpConn
->
lpPlayerName
->
lpszShortName
)
{
dwTotalSize
+=
sizeof
(
WCHAR
)
*
(
lstrlenW
(
lpConn
->
lpPlayerName
->
u1
.
lpszShortName
)
+
1
);
(
lstrlenW
(
lpConn
->
lpPlayerName
->
lpszShortName
)
+
1
);
}
if
(
lpConn
->
lpPlayerName
->
u2
.
lpszLongName
)
if
(
lpConn
->
lpPlayerName
->
lpszLongName
)
{
dwTotalSize
+=
sizeof
(
WCHAR
)
*
(
lstrlenW
(
lpConn
->
lpPlayerName
->
u2
.
lpszLongName
)
+
1
);
(
lstrlenW
(
lpConn
->
lpPlayerName
->
lpszLongName
)
+
1
);
}
}
...
...
dlls/dplayx/dplobby.c
View file @
a56fcef7
...
...
@@ -20,8 +20,6 @@
#include <string.h>
#define COBJMACROS
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
...
...
@@ -954,9 +952,9 @@ static HRESULT WINAPI IDirectPlayLobby3AImpl_EnumLocalApplications( IDirectPlayL
CLSIDFromString
(
buff
,
&
serviceProviderGUID
);
/* FIXME: Have I got a memory leak on the serviceProviderGUID? */
dplAppInfo
.
dwSize
=
sizeof
(
dplAppInfo
);
dplAppInfo
.
guidApplication
=
serviceProviderGUID
;
dplAppInfo
.
u
.
lpszAppNameA
=
subKeyName
;
dplAppInfo
.
dwSize
=
sizeof
(
dplAppInfo
);
dplAppInfo
.
guidApplication
=
serviceProviderGUID
;
dplAppInfo
.
lpszAppNameA
=
subKeyName
;
EnterCriticalSection
(
&
This
->
lock
);
...
...
dlls/dplayx/name_server.c
View file @
a56fcef7
...
...
@@ -22,8 +22,6 @@
#include <stdarg.h>
#include <string.h>
#define NONAMELESSUNION
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
...
...
@@ -130,10 +128,10 @@ void NS_AddRemoteComputerAsNameServer( LPCVOID lpcNSAddrHdr
*
lpCacheNode
->
data
=
lpcMsg
->
sd
;
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
(
LPCWSTR
)(
lpcMsg
+
1
),
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
((
lpCacheNode
->
data
->
u1
.
lpszSessionNameA
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
)))
if
((
lpCacheNode
->
data
->
lpszSessionNameA
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
)))
{
WideCharToMultiByte
(
CP_ACP
,
0
,
(
LPCWSTR
)(
lpcMsg
+
1
),
-
1
,
lpCacheNode
->
data
->
u1
.
lpszSessionNameA
,
len
,
NULL
,
NULL
);
lpCacheNode
->
data
->
lpszSessionNameA
,
len
,
NULL
,
NULL
);
}
lpCacheNode
->
dwTime
=
timeGetTime
();
...
...
@@ -367,7 +365,7 @@ void NS_ReplyToEnumSessionsRequest( const void *lpcMsg, void **lplpReplyData, DW
FIXME
(
": few fixed + need to check request for response, might need UNICODE input ability.
\n
"
);
dwVariableLen
=
MultiByteToWideChar
(
CP_ACP
,
0
,
lpDP
->
dp2
->
lpSessionDesc
->
u1
.
lpszSessionNameA
,
lpDP
->
dp2
->
lpSessionDesc
->
lpszSessionNameA
,
-
1
,
NULL
,
0
);
dwVariableSize
=
dwVariableLen
*
sizeof
(
WCHAR
);
...
...
@@ -386,6 +384,6 @@ void NS_ReplyToEnumSessionsRequest( const void *lpcMsg, void **lplpReplyData, DW
CopyMemory
(
&
rmsg
->
sd
,
lpDP
->
dp2
->
lpSessionDesc
,
lpDP
->
dp2
->
lpSessionDesc
->
dwSize
);
rmsg
->
dwUnknown
=
0x0000005c
;
MultiByteToWideChar
(
CP_ACP
,
0
,
lpDP
->
dp2
->
lpSessionDesc
->
u1
.
lpszSessionNameA
,
-
1
,
MultiByteToWideChar
(
CP_ACP
,
0
,
lpDP
->
dp2
->
lpSessionDesc
->
lpszSessionNameA
,
-
1
,
(
LPWSTR
)(
rmsg
+
1
),
dwVariableLen
);
}
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