Commit 819e7946 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

Added two macros, ICOM_VFIELD and ICOM_VTBL, so that when implementing

a COM interface one never has to name the lpVtbl field explicitly.
parent deebddf2
......@@ -40,7 +40,7 @@ static ICOM_VTABLE(IDirectPlay4) directPlay4AVT;
struct IDirectPlayImpl
{
/* IUnknown fields */
ICOM_VTABLE(IDirectPlay4)* lpvtbl;
ICOM_VFIELD(IDirectPlay4);
DWORD ref;
CRITICAL_SECTION DP_lock;
/* IDirectPlay3Impl fields */
......@@ -68,10 +68,10 @@ HRESULT directPlay_QueryInterface
return DPERR_OUTOFMEMORY;
}
lpDP->lpvtbl = &directPlay2WVT;
ICOM_VTBL(lpDP) = &directPlay2WVT;
InitializeCriticalSection( &lpDP->DP_lock );
IDirectPlayX_AddRef( (IDirectPlay4*)lpDP );
IDirectPlayX_AddRef( lpDP );
*ppvObj = lpDP;
......@@ -89,9 +89,9 @@ HRESULT directPlay_QueryInterface
return DPERR_OUTOFMEMORY;
}
lpDP->lpvtbl = &directPlay2AVT;
ICOM_VTBL(lpDP) = &directPlay2AVT;
InitializeCriticalSection( &lpDP->DP_lock );
IDirectPlayX_AddRef( (IDirectPlay4*)lpDP );
IDirectPlayX_AddRef( lpDP );
*ppvObj = lpDP;
......@@ -109,9 +109,9 @@ HRESULT directPlay_QueryInterface
return DPERR_OUTOFMEMORY;
}
lpDP->lpvtbl = &directPlay3WVT;
ICOM_VTBL(lpDP) = &directPlay3WVT;
InitializeCriticalSection( &lpDP->DP_lock );
IDirectPlayX_AddRef( (IDirectPlay4*)lpDP );
IDirectPlayX_AddRef( lpDP );
*ppvObj = lpDP;
......@@ -129,9 +129,9 @@ HRESULT directPlay_QueryInterface
return DPERR_OUTOFMEMORY;
}
lpDP->lpvtbl = &directPlay3AVT;
ICOM_VTBL(lpDP) = &directPlay3AVT;
InitializeCriticalSection( &lpDP->DP_lock );
IDirectPlayX_AddRef( (IDirectPlay4*)lpDP );
IDirectPlayX_AddRef( lpDP );
*ppvObj = lpDP;
......@@ -149,9 +149,9 @@ HRESULT directPlay_QueryInterface
return DPERR_OUTOFMEMORY;
}
lpDP->lpvtbl = &directPlay4WVT;
ICOM_VTBL(lpDP) = &directPlay4WVT;
InitializeCriticalSection( &lpDP->DP_lock );
IDirectPlayX_AddRef( (IDirectPlay4*)lpDP );
IDirectPlayX_AddRef( lpDP );
*ppvObj = lpDP;
......@@ -169,9 +169,9 @@ HRESULT directPlay_QueryInterface
return DPERR_OUTOFMEMORY;
}
lpDP->lpvtbl = &directPlay4AVT;
ICOM_VTBL(lpDP) = &directPlay4AVT;
InitializeCriticalSection( &lpDP->DP_lock );
IDirectPlayX_AddRef( (IDirectPlay4*)lpDP );
IDirectPlayX_AddRef( lpDP );
*ppvObj = lpDP;
......
......@@ -69,7 +69,7 @@ typedef struct tagDirectPlayLobby3Data
struct IDirectPlayLobbyImpl
{
ICOM_VTABLE(IDirectPlayLobby)* lpvtbl;
ICOM_VFIELD(IDirectPlayLobby);
/* IUnknown fields */
DirectPlayLobbyIUnknownData* unk;
......@@ -237,7 +237,7 @@ HRESULT directPlayLobby_QueryInterface
return E_OUTOFMEMORY;
}
lpDPL->lpvtbl = &directPlayLobbyWVT;
ICOM_VTBL(lpDPL) = &directPlayLobbyWVT;
if ( DPL_CreateIUnknown( lpDPL ) &&
DPL_CreateLobby1( lpDPL )
......@@ -257,7 +257,7 @@ HRESULT directPlayLobby_QueryInterface
return E_OUTOFMEMORY;
}
lpDPL->lpvtbl = &directPlayLobbyAVT;
ICOM_VTBL(lpDPL) = &directPlayLobbyAVT;
if ( DPL_CreateIUnknown( lpDPL ) &&
DPL_CreateLobby1( lpDPL )
......@@ -277,7 +277,7 @@ HRESULT directPlayLobby_QueryInterface
return E_OUTOFMEMORY;
}
lpDPL->lpvtbl = &directPlayLobby2WVT;
ICOM_VTBL(lpDPL) = &directPlayLobby2WVT;
if ( DPL_CreateIUnknown( lpDPL ) &&
DPL_CreateLobby1( lpDPL ) &&
......@@ -298,7 +298,7 @@ HRESULT directPlayLobby_QueryInterface
return E_OUTOFMEMORY;
}
lpDPL->lpvtbl = &directPlayLobby2AVT;
ICOM_VTBL(lpDPL) = &directPlayLobby2AVT;
if ( DPL_CreateIUnknown( lpDPL ) &&
DPL_CreateLobby1( lpDPL ) &&
......@@ -319,7 +319,7 @@ HRESULT directPlayLobby_QueryInterface
return E_OUTOFMEMORY;
}
lpDPL->lpvtbl = &directPlayLobby3WVT;
ICOM_VTBL(lpDPL) = &directPlayLobby3WVT;
if ( DPL_CreateIUnknown( lpDPL ) &&
DPL_CreateLobby1( lpDPL ) &&
......@@ -341,7 +341,7 @@ HRESULT directPlayLobby_QueryInterface
return E_OUTOFMEMORY;
}
lpDPL->lpvtbl = &directPlayLobby3AVT;
ICOM_VTBL(lpDPL) = &directPlayLobby3AVT;
if ( DPL_CreateIUnknown( lpDPL ) &&
DPL_CreateLobby1( lpDPL ) &&
......@@ -475,7 +475,7 @@ static HRESULT WINAPI IDirectPlayLobby3AImpl_QueryInterface
IsEqualGUID( &IID_IDirectPlayLobby3A, riid )
)
{
IDirectPlayLobby_AddRef( (IDirectPlayLobby*)This );
IDirectPlayLobby_AddRef( This );
*ppvObj = This;
return S_OK;
}
......@@ -498,7 +498,7 @@ static HRESULT WINAPI IDirectPlayLobby3WImpl_QueryInterface
IsEqualGUID( &IID_IDirectPlayLobby3, riid )
)
{
IDirectPlayLobby_AddRef( (IDirectPlayLobby*)This );
IDirectPlayLobby_AddRef( iface );
*ppvObj = This;
return S_OK;
}
......
......@@ -795,7 +795,7 @@ HRESULT WINAPI StringFromCLSID16(
*/
if (!WOWCallback16Ex(
(DWORD)((ICOM_VTABLE(IMalloc16)*)PTR_SEG_TO_LIN(
((LPMALLOC16)PTR_SEG_TO_LIN(mllc))->lpvtbl)
ICOM_VTBL(((LPMALLOC16)PTR_SEG_TO_LIN(mllc))))
)->fnAlloc,
WCB16_CDECL,
2*sizeof(DWORD),
......@@ -828,7 +828,7 @@ HRESULT WINAPI StringFromCLSID(
ret=WINE_StringFromCLSID(id,buf);
if (!ret) {
*idstr = mllc->lpvtbl->fnAlloc(mllc,strlen(buf)*2+2);
*idstr = IMalloc_Alloc(mllc,strlen(buf)*2+2);
lstrcpyAtoW(*idstr,buf);
}
return ret;
......
......@@ -372,8 +372,8 @@ BOOL WINAPI IsValidInterface(
) {
return !(
IsBadReadPtr(punk,4) ||
IsBadReadPtr(punk->lpvtbl,4) ||
IsBadReadPtr(punk->lpvtbl->fnQueryInterface,9) ||
IsBadCodePtr(punk->lpvtbl->fnQueryInterface)
IsBadReadPtr(ICOM_VTBL(punk),4) ||
IsBadReadPtr(ICOM_VTBL(punk)->fnQueryInterface,9) ||
IsBadCodePtr(ICOM_VTBL(punk)->fnQueryInterface)
);
}
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