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
4a9cd630
Commit
4a9cd630
authored
Mar 29, 2013
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Apr 02, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dplayx: Cleanup the DirectPlay object creation.
parent
526851f5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
67 deletions
+35
-67
dpclassfactory.c
dlls/dplayx/dpclassfactory.c
+1
-1
dpinit.h
dlls/dplayx/dpinit.h
+1
-1
dplay.c
dlls/dplayx/dplay.c
+32
-63
dplobby.c
dlls/dplayx/dplobby.c
+1
-2
No files found.
dlls/dplayx/dpclassfactory.c
View file @
4a9cd630
...
...
@@ -101,7 +101,7 @@ static const IClassFactoryVtbl cf_vt = {
IClassFactoryImpl_LockServer
};
static
IClassFactoryImpl
dplay_cf
=
{{
&
cf_vt
},
DP_CreateInterfac
e
};
static
IClassFactoryImpl
dplay_cf
=
{{
&
cf_vt
},
dplay_creat
e
};
static
IClassFactoryImpl
dplaylobby_cf
=
{{
&
cf_vt
},
DPL_CreateInterface
};
...
...
dlls/dplayx/dpinit.h
View file @
4a9cd630
...
...
@@ -26,7 +26,7 @@
#include "wtypes.h"
#include "dplay_global.h"
extern
HRESULT
DP_CreateInterface
(
REFIID
riid
,
LPVOID
*
ppvObj
)
DECLSPEC_HIDDEN
;
extern
HRESULT
dplay_create
(
REFIID
riid
,
void
**
ppv
)
DECLSPEC_HIDDEN
;
extern
HRESULT
DPL_CreateInterface
(
REFIID
riid
,
LPVOID
*
ppvObj
)
DECLSPEC_HIDDEN
;
extern
HRESULT
DPSP_CreateInterface
(
REFIID
riid
,
LPVOID
*
ppvObj
,
IDirectPlay2Impl
*
dp
)
DECLSPEC_HIDDEN
;
...
...
dlls/dplayx/dplay.c
View file @
4a9cd630
...
...
@@ -76,10 +76,6 @@ static BOOL CALLBACK cbRemoveGroupOrPlayer( DPID dpId, DWORD dwPlayerType,
LPVOID
lpContext
);
static
void
DP_DeleteGroup
(
IDirectPlay2Impl
*
This
,
DPID
dpid
);
/* Forward declarations of virtual tables */
static
const
IDirectPlay4Vtbl
directPlay4AVT
;
static
const
IDirectPlay4Vtbl
directPlay4WVT
;
/* Helper methods for player/group interfaces */
static
HRESULT
DP_IF_DeletePlayerFromGroup
(
IDirectPlay2Impl
*
This
,
LPVOID
lpMsgHdr
,
DPID
idGroup
,
...
...
@@ -360,55 +356,6 @@ static BOOL DP_DestroyDirectPlay2( LPVOID lpDP )
}
/* Create a new interface */
HRESULT
DP_CreateInterface
(
REFIID
riid
,
LPVOID
*
ppvObj
)
{
IDirectPlayImpl
*
This
;
TRACE
(
" for %s
\n
"
,
debugstr_guid
(
riid
)
);
This
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
IDirectPlayImpl
)
);
if
(
!
This
)
return
DPERR_OUTOFMEMORY
;
This
->
IDirectPlay4_iface
.
lpVtbl
=
&
directPlay4WVT
;
This
->
IDirectPlay4A_iface
.
lpVtbl
=
&
directPlay4AVT
;
if
(
IsEqualGUID
(
&
IID_IDirectPlay2
,
riid
)
||
IsEqualGUID
(
&
IID_IDirectPlay3
,
riid
)
||
IsEqualGUID
(
&
IID_IDirectPlay4
,
riid
)
)
*
ppvObj
=
&
This
->
IDirectPlay4_iface
;
else
if
(
IsEqualGUID
(
&
IID_IUnknown
,
riid
)
||
IsEqualGUID
(
&
IID_IDirectPlay2A
,
riid
)
||
IsEqualGUID
(
&
IID_IDirectPlay3A
,
riid
)
||
IsEqualGUID
(
&
IID_IDirectPlay4A
,
riid
)
)
*
ppvObj
=
&
This
->
IDirectPlay4A_iface
;
else
{
/* Unsupported interface */
HeapFree
(
GetProcessHeap
(),
0
,
*
ppvObj
);
*
ppvObj
=
NULL
;
return
E_NOINTERFACE
;
}
/* Initialize it */
if
(
DP_CreateDirectPlay2
(
This
)
)
{
InitializeCriticalSection
(
&
This
->
lock
);
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)(
__FILE__
": IDirectPlayImpl.lock"
);
IDirectPlayX_AddRef
(
(
LPDIRECTPLAY2A
)
*
ppvObj
);
return
S_OK
;
}
/* Initialize failed, destroy it */
DP_DestroyDirectPlay2
(
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
*
ppvObj
=
NULL
;
return
DPERR_NOMEMORY
;
}
/* Direct Play methods */
/* Shared between all dplay types */
...
...
@@ -4619,12 +4566,8 @@ static HRESULT WINAPI DirectPlay4WImpl_CancelPriority
}
/* Note: Hack so we can reuse the old functions without compiler warnings */
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
# define XCAST(fun) (typeof(directPlay4WVT.fun))
#else
# define XCAST(fun) (void*)
#endif
static
const
IDirectPlay4Vtbl
directPlay4WVT
=
static
const
IDirectPlay4Vtbl
dp4_vt
=
{
IDirectPlay4Impl_QueryInterface
,
IDirectPlay4Impl_AddRef
,
...
...
@@ -4685,7 +4628,7 @@ static const IDirectPlay4Vtbl directPlay4WVT =
};
#undef XCAST
static
const
IDirectPlay4Vtbl
d
irectPlay4AVT
=
static
const
IDirectPlay4Vtbl
d
p4A_vt
=
{
IDirectPlay4AImpl_QueryInterface
,
IDirectPlay4AImpl_AddRef
,
...
...
@@ -4743,6 +4686,35 @@ static const IDirectPlay4Vtbl directPlay4AVT =
DirectPlay4AImpl_CancelPriority
};
HRESULT
dplay_create
(
REFIID
riid
,
void
**
ppv
)
{
IDirectPlayImpl
*
obj
;
HRESULT
hr
;
TRACE
(
"(%s, %p)
\n
"
,
debugstr_guid
(
riid
),
ppv
);
*
ppv
=
NULL
;
obj
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
obj
)
);
if
(
!
obj
)
return
DPERR_OUTOFMEMORY
;
obj
->
IDirectPlay4A_iface
.
lpVtbl
=
&
dp4A_vt
;
obj
->
IDirectPlay4_iface
.
lpVtbl
=
&
dp4_vt
;
obj
->
ulInterfaceRef
=
1
;
InitializeCriticalSection
(
&
obj
->
lock
);
obj
->
lock
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)(
__FILE__
": IDirectPlayImpl.lock"
);
if
(
DP_CreateDirectPlay2
(
obj
)
)
hr
=
IDirectPlayX_QueryInterface
(
&
obj
->
IDirectPlay4A_iface
,
riid
,
ppv
);
else
hr
=
DPERR_NOMEMORY
;
IDirectPlayX_Release
(
&
obj
->
IDirectPlay4A_iface
);
return
hr
;
}
HRESULT
DP_GetSPPlayerData
(
IDirectPlay2Impl
*
lpDP
,
DPID
idPlayer
,
LPVOID
*
lplpData
)
...
...
@@ -5016,13 +4988,10 @@ HRESULT WINAPI DirectPlayCreate
return
DPERR_INVALIDPARAMS
;
}
/* 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 */
if
(
DP_CreateInterface
(
&
IID_IDirectPlay2A
,
(
LPVOID
*
)
lplpDP
)
!=
DP_OK
)
{
if
(
dplay_create
(
&
IID_IDirectPlay2A
,
(
void
**
)
lplpDP
)
!=
DP_OK
)
return
DPERR_UNAVAILABLE
;
}
if
(
IsEqualGUID
(
&
GUID_NULL
,
lpGUID
)
)
{
...
...
dlls/dplayx/dplobby.c
View file @
4a9cd630
...
...
@@ -494,8 +494,7 @@ static HRESULT DPL_ConnectEx
dwFlags
=
DPCONNECT_RETURNSTATUS
;
}
/* Create the DirectPlay interface */
if
(
(
hr
=
DP_CreateInterface
(
riid
,
lplpDP
)
)
!=
DP_OK
)
if
(
(
hr
=
dplay_create
(
riid
,
lplpDP
)
)
!=
DP_OK
)
{
ERR
(
"error creating interface for %s:%s.
\n
"
,
debugstr_guid
(
riid
),
DPLAYX_HresultToString
(
hr
)
);
...
...
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