Commit 2a63cf67 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

dplayx: Move the DirectPlayLobby data fields to the main object.

parent 185dd369
...@@ -63,13 +63,6 @@ struct DPLMSG ...@@ -63,13 +63,6 @@ struct DPLMSG
}; };
typedef struct DPLMSG* LPDPLMSG; typedef struct DPLMSG* LPDPLMSG;
typedef struct tagDirectPlayLobbyData
{
HKEY hkCallbackKeyHack;
DWORD dwMsgThread;
DPQ_HEAD( DPLMSG ) msgs; /* List of messages received */
} DirectPlayLobbyData;
typedef struct IDirectPlayLobbyImpl typedef struct IDirectPlayLobbyImpl
{ {
IDirectPlayLobby IDirectPlayLobby_iface; IDirectPlayLobby IDirectPlayLobby_iface;
...@@ -81,7 +74,9 @@ typedef struct IDirectPlayLobbyImpl ...@@ -81,7 +74,9 @@ typedef struct IDirectPlayLobbyImpl
LONG numIfaces; /* "in use interfaces" refcount */ LONG numIfaces; /* "in use interfaces" refcount */
LONG ref, refA, ref2, ref2A, ref3, ref3A; LONG ref, refA, ref2, ref2A, ref3, ref3A;
CRITICAL_SECTION lock; CRITICAL_SECTION lock;
DirectPlayLobbyData* dpl; HKEY cbkeyhack;
DWORD msgtid;
DPQ_HEAD( DPLMSG ) msgs; /* List of messages received */
} IDirectPlayLobbyImpl; } IDirectPlayLobbyImpl;
static inline IDirectPlayLobbyImpl *impl_from_IDirectPlayLobby( IDirectPlayLobby *iface ) static inline IDirectPlayLobbyImpl *impl_from_IDirectPlayLobby( IDirectPlayLobby *iface )
...@@ -114,41 +109,12 @@ static inline IDirectPlayLobbyImpl *impl_from_IDirectPlayLobby3A( IDirectPlayLob ...@@ -114,41 +109,12 @@ static inline IDirectPlayLobbyImpl *impl_from_IDirectPlayLobby3A( IDirectPlayLob
return CONTAINING_RECORD( iface, IDirectPlayLobbyImpl, IDirectPlayLobby3A_iface ); return CONTAINING_RECORD( iface, IDirectPlayLobbyImpl, IDirectPlayLobby3A_iface );
} }
static BOOL DPL_CreateLobby1( LPVOID lpDPL )
{
IDirectPlayLobbyImpl *This = lpDPL;
This->dpl = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->dpl) ) );
if ( This->dpl == NULL )
{
return FALSE;
}
DPQ_INIT( This->dpl->msgs );
return TRUE;
}
static BOOL DPL_DestroyLobby1( LPVOID lpDPL )
{
IDirectPlayLobbyImpl *This = lpDPL;
if( This->dpl->dwMsgThread )
{
FIXME( "Should kill the msg thread\n" );
}
DPQ_DELETEQ( This->dpl->msgs, msgs, LPDPLMSG, cbDeleteElemFromHeap );
/* Delete the contents */
HeapFree( GetProcessHeap(), 0, This->dpl );
return TRUE;
}
static void dplobby_destroy(IDirectPlayLobbyImpl *obj) static void dplobby_destroy(IDirectPlayLobbyImpl *obj)
{ {
DPL_DestroyLobby1( obj ); if ( obj->msgtid )
FIXME( "Should kill the msg thread\n" );
DPQ_DELETEQ( obj->msgs, msgs, LPDPLMSG, cbDeleteElemFromHeap );
obj->lock.DebugInfo->Spare[0] = 0; obj->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection( &obj->lock ); DeleteCriticalSection( &obj->lock );
HeapFree( GetProcessHeap(), 0, obj ); HeapFree( GetProcessHeap(), 0, obj );
...@@ -995,7 +961,7 @@ static HRESULT WINAPI IDirectPlayLobby3AImpl_EnumLocalApplications( IDirectPlayL ...@@ -995,7 +961,7 @@ static HRESULT WINAPI IDirectPlayLobby3AImpl_EnumLocalApplications( IDirectPlayL
EnterCriticalSection( &This->lock ); EnterCriticalSection( &This->lock );
memcpy( &This->dpl->hkCallbackKeyHack, &hkServiceProvider, sizeof( hkServiceProvider ) ); memcpy( &This->cbkeyhack, &hkServiceProvider, sizeof( hkServiceProvider ) );
if( !lpEnumLocalAppCallback( &dplAppInfo, lpContext, dwFlags ) ) if( !lpEnumLocalAppCallback( &dplAppInfo, lpContext, dwFlags ) )
{ {
...@@ -1182,7 +1148,7 @@ static BOOL CALLBACK RunApplicationA_EnumLocalApplications ...@@ -1182,7 +1148,7 @@ static BOOL CALLBACK RunApplicationA_EnumLocalApplications
sizeOfReturnBuffer = 200; sizeOfReturnBuffer = 200;
/* Get all the appropriate data from the registry */ /* Get all the appropriate data from the registry */
if( RegQueryValueExA( lpData->This->dpl->hkCallbackKeyHack, clSubKey, if( RegQueryValueExA( lpData->This->cbkeyhack, clSubKey,
NULL, &returnType, (LPBYTE)returnBuffer, NULL, &returnType, (LPBYTE)returnBuffer,
&sizeOfReturnBuffer ) != ERROR_SUCCESS ) &sizeOfReturnBuffer ) != ERROR_SUCCESS )
{ {
...@@ -1196,7 +1162,7 @@ static BOOL CALLBACK RunApplicationA_EnumLocalApplications ...@@ -1196,7 +1162,7 @@ static BOOL CALLBACK RunApplicationA_EnumLocalApplications
sizeOfReturnBuffer = 200; sizeOfReturnBuffer = 200;
if( RegQueryValueExA( lpData->This->dpl->hkCallbackKeyHack, cdSubKey, if( RegQueryValueExA( lpData->This->cbkeyhack, cdSubKey,
NULL, &returnType, (LPBYTE)returnBuffer, NULL, &returnType, (LPBYTE)returnBuffer,
&sizeOfReturnBuffer ) != ERROR_SUCCESS ) &sizeOfReturnBuffer ) != ERROR_SUCCESS )
{ {
...@@ -1210,7 +1176,7 @@ static BOOL CALLBACK RunApplicationA_EnumLocalApplications ...@@ -1210,7 +1176,7 @@ static BOOL CALLBACK RunApplicationA_EnumLocalApplications
sizeOfReturnBuffer = 200; sizeOfReturnBuffer = 200;
if( RegQueryValueExA( lpData->This->dpl->hkCallbackKeyHack, fileSubKey, if( RegQueryValueExA( lpData->This->cbkeyhack, fileSubKey,
NULL, &returnType, (LPBYTE)returnBuffer, NULL, &returnType, (LPBYTE)returnBuffer,
&sizeOfReturnBuffer ) != ERROR_SUCCESS ) &sizeOfReturnBuffer ) != ERROR_SUCCESS )
{ {
...@@ -1224,7 +1190,7 @@ static BOOL CALLBACK RunApplicationA_EnumLocalApplications ...@@ -1224,7 +1190,7 @@ static BOOL CALLBACK RunApplicationA_EnumLocalApplications
sizeOfReturnBuffer = 200; sizeOfReturnBuffer = 200;
if( RegQueryValueExA( lpData->This->dpl->hkCallbackKeyHack, pathSubKey, if( RegQueryValueExA( lpData->This->cbkeyhack, pathSubKey,
NULL, &returnType, (LPBYTE)returnBuffer, NULL, &returnType, (LPBYTE)returnBuffer,
&sizeOfReturnBuffer ) != ERROR_SUCCESS ) &sizeOfReturnBuffer ) != ERROR_SUCCESS )
{ {
...@@ -1433,10 +1399,9 @@ static HRESULT WINAPI IDirectPlayLobby3AImpl_RunApplication( IDirectPlayLobby3A ...@@ -1433,10 +1399,9 @@ static HRESULT WINAPI IDirectPlayLobby3AImpl_RunApplication( IDirectPlayLobby3A
&hStart, &hDeath, &hSettingRead ); &hStart, &hDeath, &hSettingRead );
/* Setup the message thread ID */ /* Setup the message thread ID */
This->dpl->dwMsgThread = This->msgtid = CreateLobbyMessageReceptionThread( hReceiveEvent, hStart, hDeath, hSettingRead );
CreateLobbyMessageReceptionThread( hReceiveEvent, hStart, hDeath, hSettingRead );
DPLAYX_SetLobbyMsgThreadId( newProcessInfo.dwProcessId, This->dpl->dwMsgThread ); DPLAYX_SetLobbyMsgThreadId( newProcessInfo.dwProcessId, This->msgtid );
LeaveCriticalSection( &This->lock ); LeaveCriticalSection( &This->lock );
...@@ -2088,11 +2053,9 @@ HRESULT dplobby_create( REFIID riid, void **ppv ) ...@@ -2088,11 +2053,9 @@ HRESULT dplobby_create( REFIID riid, void **ppv )
InitializeCriticalSection( &obj->lock ); InitializeCriticalSection( &obj->lock );
obj->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IDirectPlayLobbyImpl.lock"); obj->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IDirectPlayLobbyImpl.lock");
DPQ_INIT( obj->msgs );
if ( DPL_CreateLobby1( obj ) ) hr = IDirectPlayLobby_QueryInterface( &obj->IDirectPlayLobby3_iface, riid, ppv );
hr = IDirectPlayLobby_QueryInterface( &obj->IDirectPlayLobby3_iface, riid, ppv );
else
hr = DPERR_NOMEMORY;
IDirectPlayLobby_Release( &obj->IDirectPlayLobby3_iface ); IDirectPlayLobby_Release( &obj->IDirectPlayLobby3_iface );
return hr; return hr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment