Use the COM macros rather than directly accessing the lpvtbl field.

This commit is contained in:
Francois Gouget 1999-10-13 14:01:40 +00:00 committed by Alexandre Julliard
parent 22d4b0afdd
commit 6e74ec0015
6 changed files with 43 additions and 44 deletions

View File

@ -377,16 +377,16 @@ HRESULT WINAPI AVIFileCreateStreamA(PAVIFILE iface,PAVISTREAM *ppavi,AVISTREAMIN
/* Only the szName at the end is different */
memcpy(&psiw,psi,sizeof(*psi)-sizeof(psi->szName));
lstrcpynAtoW(psiw.szName,psi->szName,sizeof(psi->szName));
return iface->lpvtbl->fnCreateStream(iface,ppavi,&psiw);
return IAVIFile_CreateStream(iface,ppavi,&psiw);
}
HRESULT WINAPI AVIFileCreateStreamW(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi) {
return iface->lpvtbl->fnCreateStream(iface,avis,asi);
return IAVIFile_CreateStream(iface,avis,asi);
}
HRESULT WINAPI AVIFileGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam) {
return iface->lpvtbl->fnGetStream(iface,avis,fccType,lParam);
return IAVIFile_GetStream(iface,avis,fccType,lParam);
}
HRESULT WINAPI AVIFileInfoA(PAVIFILE iface,LPAVIFILEINFOA afi,LONG size) {
@ -395,7 +395,7 @@ HRESULT WINAPI AVIFileInfoA(PAVIFILE iface,LPAVIFILEINFOA afi,LONG size) {
if (size < sizeof(AVIFILEINFOA))
return AVIERR_BADSIZE;
hres = iface->lpvtbl->fnInfo(iface,&afiw,sizeof(afiw));
hres = IAVIFile_Info(iface,&afiw,sizeof(afiw));
memcpy(afi,&afiw,sizeof(*afi)-sizeof(afi->szFileType));
lstrcpynWtoA(afi->szFileType,afiw.szFileType,sizeof(afi->szFileType));
return hres;
@ -403,7 +403,7 @@ HRESULT WINAPI AVIFileInfoA(PAVIFILE iface,LPAVIFILEINFOA afi,LONG size) {
HRESULT WINAPI AVIStreamInfoW(PAVISTREAM iface,AVISTREAMINFOW *asi,LONG
size) {
return iface->lpvtbl->fnInfo(iface,asi,size);
return IAVIFile_Info(iface,asi,size);
}
HRESULT WINAPI AVIStreamInfoA(PAVISTREAM iface,AVISTREAMINFOA *asi,LONG
@ -413,14 +413,14 @@ HRESULT WINAPI AVIStreamInfoA(PAVISTREAM iface,AVISTREAMINFOA *asi,LONG
if (size<sizeof(AVISTREAMINFOA))
return AVIERR_BADSIZE;
hres = iface->lpvtbl->fnInfo(iface,&asiw,sizeof(asiw));
hres = IAVIFile_Info(iface,&asiw,sizeof(asiw));
memcpy(asi,&asiw,sizeof(asiw)-sizeof(asiw.szName));
lstrcpynWtoA(asi->szName,asiw.szName,sizeof(asi->szName));
return hres;
}
HRESULT WINAPI AVIFileInfoW(PAVIFILE iface,LPAVIFILEINFOW afi,LONG size) {
return iface->lpvtbl->fnInfo(iface,afi,size);
return IAVIFile_Info(iface,afi,size);
}
HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM *ppsCompressed,PAVISTREAM ppsSource,AVICOMPRESSOPTIONS *aco,CLSID *pclsidHandler) {
@ -435,7 +435,7 @@ HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM *ppsCompressed,PAVISTREAM ppsS
FIXME_(avifile)("\tdwFlags: 0x%08lx\n",aco->dwFlags);
/* we just create a duplicate for now */
((IUnknown*)ppsSource)->lpvtbl->fnAddRef((IUnknown*)ppsSource);
IAVIStream_AddRef(ppsSource);
*ppsCompressed = ppsSource;
as = (IAVIStreamImpl*)ppsSource;
@ -467,33 +467,33 @@ HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM *ppsCompressed,PAVISTREAM ppsS
}
HRESULT WINAPI AVIStreamSetFormat(PAVISTREAM iface,LONG pos,LPVOID format,LONG formatsize) {
return iface->lpvtbl->fnSetFormat(iface,pos,format,formatsize);
return IAVIStream_SetFormat(iface,pos,format,formatsize);
}
HRESULT WINAPI AVIStreamReadFormat(PAVISTREAM iface,LONG pos,LPVOID format,LONG *formatsize) {
return iface->lpvtbl->fnReadFormat(iface,pos,format,formatsize);
return IAVIStream_ReadFormat(iface,pos,format,formatsize);
}
HRESULT WINAPI AVIStreamWrite(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten) {
return iface->lpvtbl->fnWrite(iface,start,samples,buffer,buffersize,flags,sampwritten,byteswritten);
return IAVIStream_Write(iface,start,samples,buffer,buffersize,flags,sampwritten,byteswritten);
}
HRESULT WINAPI AVIStreamRead(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread) {
return iface->lpvtbl->fnRead(iface,start,samples,buffer,buffersize,bytesread,samplesread);
return IAVIStream_Read(iface,start,samples,buffer,buffersize,bytesread,samplesread);
}
HRESULT WINAPI AVIStreamWriteData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG size) {
return iface->lpvtbl->fnWriteData(iface,fcc,lp,size);
return IAVIStream_WriteData(iface,fcc,lp,size);
}
HRESULT WINAPI AVIStreamReadData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG *lpread) {
return iface->lpvtbl->fnReadData(iface,fcc,lp,lpread);
return IAVIStream_ReadData(iface,fcc,lp,lpread);
}
LONG WINAPI AVIStreamStart(PAVISTREAM iface) {
AVISTREAMINFOW si;
iface->lpvtbl->fnInfo(iface,&si,sizeof(si));
IAVIStream_Info(iface,&si,sizeof(si));
return si.dwStart;
}
@ -501,14 +501,14 @@ LONG WINAPI AVIStreamLength(PAVISTREAM iface) {
AVISTREAMINFOW si;
HRESULT ret;
ret = iface->lpvtbl->fnInfo(iface,&si,sizeof(si));
ret = IAVIStream_Info(iface,&si,sizeof(si));
if (ret) /* error */
return 1;
return si.dwLength;
}
ULONG WINAPI AVIStreamRelease(PAVISTREAM iface) {
return ((LPUNKNOWN)iface)->lpvtbl->fnRelease((LPUNKNOWN)iface);
return IAVIStream_Release(iface);
}
PGETFRAME WINAPI AVIStreamGetFrameOpen(PAVISTREAM iface,LPBITMAPINFOHEADER bmi) {
@ -517,16 +517,16 @@ PGETFRAME WINAPI AVIStreamGetFrameOpen(PAVISTREAM iface,LPBITMAPINFOHEADER bmi)
}
LPVOID WINAPI AVIStreamGetFrame(PGETFRAME pg,LONG pos) {
return pg->lpvtbl->fnGetFrame(pg,pos);
return IGetFrame_GetFrame(pg,pos);
}
HRESULT WINAPI AVIStreamGetFrameClose(PGETFRAME pg) {
if (pg) ((LPUNKNOWN)pg)->lpvtbl->fnRelease((LPUNKNOWN)pg);
if (pg) IGetFrame_Release(pg);
return 0;
}
ULONG WINAPI AVIFileRelease(PAVIFILE iface) {
return ((LPUNKNOWN)iface)->lpvtbl->fnRelease((LPUNKNOWN)iface);
return IAVIFile_Release(iface);
}
void WINAPI AVIFileExit(void) {

View File

@ -50,7 +50,6 @@ struct IDirectPlayImpl
};
/* Get a new interface. To be used by QueryInterface. */
extern
HRESULT directPlay_QueryInterface
@ -72,7 +71,7 @@ HRESULT directPlay_QueryInterface
lpDP->lpvtbl = &directPlay2WVT;
InitializeCriticalSection( &lpDP->DP_lock );
IDirectPlayX_AddRef( lpDP );
IDirectPlayX_AddRef( (IDirectPlay4*)lpDP );
*ppvObj = lpDP;
@ -92,7 +91,7 @@ HRESULT directPlay_QueryInterface
lpDP->lpvtbl = &directPlay2AVT;
InitializeCriticalSection( &lpDP->DP_lock );
IDirectPlayX_AddRef( lpDP );
IDirectPlayX_AddRef( (IDirectPlay4*)lpDP );
*ppvObj = lpDP;
@ -112,7 +111,7 @@ HRESULT directPlay_QueryInterface
lpDP->lpvtbl = &directPlay3WVT;
InitializeCriticalSection( &lpDP->DP_lock );
IDirectPlayX_AddRef( lpDP );
IDirectPlayX_AddRef( (IDirectPlay4*)lpDP );
*ppvObj = lpDP;
@ -132,7 +131,7 @@ HRESULT directPlay_QueryInterface
lpDP->lpvtbl = &directPlay3AVT;
InitializeCriticalSection( &lpDP->DP_lock );
IDirectPlayX_AddRef( lpDP );
IDirectPlayX_AddRef( (IDirectPlay4*)lpDP );
*ppvObj = lpDP;
@ -152,7 +151,7 @@ HRESULT directPlay_QueryInterface
lpDP->lpvtbl = &directPlay4WVT;
InitializeCriticalSection( &lpDP->DP_lock );
IDirectPlayX_AddRef( lpDP );
IDirectPlayX_AddRef( (IDirectPlay4*)lpDP );
*ppvObj = lpDP;
@ -172,7 +171,7 @@ HRESULT directPlay_QueryInterface
lpDP->lpvtbl = &directPlay4AVT;
InitializeCriticalSection( &lpDP->DP_lock );
IDirectPlayX_AddRef( lpDP );
IDirectPlayX_AddRef( (IDirectPlay4*)lpDP );
*ppvObj = lpDP;

View File

@ -131,7 +131,7 @@ BOOL DPL_CreateIUnknown( IDirectPlayLobbyImpl* lpDPL )
{
InitializeCriticalSection( &lpDPL->unk->DPL_lock );
IDirectPlayLobby_AddRef( lpDPL );
IDirectPlayLobby_AddRef( (IDirectPlayLobby*)lpDPL );
return TRUE;
}
@ -475,7 +475,7 @@ static HRESULT WINAPI IDirectPlayLobby3AImpl_QueryInterface
IsEqualGUID( &IID_IDirectPlayLobby3A, riid )
)
{
IDirectPlayLobby_AddRef( This );
IDirectPlayLobby_AddRef( (IDirectPlayLobby*)This );
*ppvObj = This;
return S_OK;
}
@ -498,7 +498,7 @@ static HRESULT WINAPI IDirectPlayLobby3WImpl_QueryInterface
IsEqualGUID( &IID_IDirectPlayLobby3, riid )
)
{
IDirectPlayLobby_AddRef( This );
IDirectPlayLobby_AddRef( (IDirectPlayLobby*)This );
*ppvObj = This;
return S_OK;
}

View File

@ -1230,7 +1230,7 @@ static HRESULT WINAPI ITypeLib_fnQueryInterface( LPTYPELIB This, REFIID riid,
IsEqualIID(riid,&IID_ITypeLib2))
*ppvObject = This;
if(*ppvObject){
(*(LPTYPELIB*)ppvObject)->lpvtbl->fnAddRef(This);
ITypeLib_AddRef(This);
TRACE_(typelib)("-- Interface: (%p)->(%p)\n",ppvObject,*ppvObject);
return S_OK;
}
@ -1626,7 +1626,7 @@ static HRESULT WINAPI ITypeInfo_fnQueryInterface( LPTYPEINFO iface, REFIID riid,
IsEqualIID(riid,&IID_ITypeInfo2))
*ppvObject = This;
if(*ppvObject){
(*(LPTYPEINFO*)ppvObject)->lpvtbl->fnAddRef(iface);
ITypeInfo_AddRef(iface);
TRACE_(typelib)("-- Interface: (%p)->(%p)\n",ppvObject,*ppvObject);
return S_OK;
}
@ -1773,9 +1773,9 @@ static HRESULT WINAPI ITypeInfo_fnGetNames( LPTYPEINFO iface, MEMBERID memid,
result=This->lpvtbl->fnGetRefTypeInfo(iface,
This->impltypelist->reference, &pTInfo);
if(SUCCEEDED(result)){
result=pTInfo->lpvtbl->fnGetNames(pTInfo, memid, rgBstrNames,
result=ITypeInfo_GetNames(pTInfo, memid, rgBstrNames,
cMaxNames, pcNames);
pTInfo->lpvtbl->fnRelease(pTInfo);
ITypeInfo_Release(pTInfo);
return result;
}
WARN_(typelib)("Could not search inherited interface!\n");
@ -1882,11 +1882,11 @@ static HRESULT WINAPI ITypeInfo_fnGetIDsOfNames( LPTYPEINFO iface,
This->TypeAttr.cImplTypes ){
/* recursive search */
ITypeInfo *pTInfo;
ret=This->lpvtbl->fnGetRefTypeInfo(iface,
ret=ITypeInfo_GetRefTypeInfo(iface,
This->impltypelist->reference, &pTInfo);
if(SUCCEEDED(ret)){
ret=pTInfo->lpvtbl->fnGetIDsOfNames(pTInfo, rgszNames, cNames, pMemId );
pTInfo->lpvtbl->fnRelease(pTInfo);
ret=ITypeInfo_GetIDsOfNames(pTInfo, rgszNames, cNames, pMemId );
ITypeInfo_Release(pTInfo);
return ret;
}
WARN_(typelib)("Could not search inherited interface!\n");
@ -1977,10 +1977,10 @@ static HRESULT WINAPI ITypeInfo_fnGetRefTypeInfo( LPTYPEINFO iface,
result=This->lpvtbl->fnGetContainingTypeLib(iface, &pTLib,
&Index);
if(SUCCEEDED(result)){
result=pTLib->lpvtbl->fnGetTypeInfo(pTLib,
result=ITypeLib_GetTypeInfo(pTLib,
HREFTYPE_INDEX(hRefType),
ppTInfo);
pTLib->lpvtbl->fnRelease(pTLib );
ITypeLib_Release(pTLib );
}
} else{
/* imported type lib */
@ -1993,7 +1993,7 @@ static HRESULT WINAPI ITypeInfo_fnGetRefTypeInfo( LPTYPEINFO iface,
return TYPE_E_ELEMENTNOTFOUND; /* FIXME : correct? */
pTypeLib=pRefType->pImpTLInfo->pImpTypeLib;
if(pTypeLib) /* typelib already loaded */
result=pTypeLib->lpvtbl->fnGetTypeInfoOfGuid(
result=ITypeLib_GetTypeInfoOfGuid(
(LPTYPELIB)pTypeLib, &pRefType->guid, ppTInfo);
else{
result=LoadRegTypeLib( &pRefType->pImpTLInfo->guid,
@ -2005,7 +2005,7 @@ static HRESULT WINAPI ITypeInfo_fnGetRefTypeInfo( LPTYPEINFO iface,
SysFreeString(libnam);
}
if(SUCCEEDED(result)){
result=pTypeLib->lpvtbl->fnGetTypeInfoOfGuid(
result=ITypeLib_GetTypeInfoOfGuid(
(LPTYPELIB)pTypeLib, &pRefType->guid, ppTInfo);
pRefType->pImpTLInfo->pImpTypeLib=pTypeLib;
}
@ -2065,7 +2065,7 @@ static HRESULT WINAPI ITypeInfo_fnGetContainingTypeLib( LPTYPEINFO iface,
ICOM_THIS( TLBTypeInfo, iface);
*ppTLib=(LPTYPELIB )(This->pTypeLib);
*pIndex=This->index;
(*ppTLib)->lpvtbl->fnAddRef(*ppTLib);
ITypeLib_AddRef(*ppTLib);
TRACE_(typelib)("(%p) returns (%p) index %d!\n", This, *ppTLib, *pIndex);
return S_OK;
}

View File

@ -168,7 +168,7 @@ Done:
SetCursor(LoadCursorA(0, IDC_ARROWA));
if (lpe)
lpe->lpvtbl->fnRelease(lpe);
IEnumIDList_Release(lpe);
if (pidlTemp )
SHFree(pidlTemp);
}

View File

@ -844,7 +844,7 @@ HRESULT WINAPI SHGetInstanceExplorer (LPUNKNOWN * lpUnknown)
if (!SHELL32_IExplorerInterface)
return E_FAIL;
SHELL32_IExplorerInterface->lpvtbl->fnAddRef(SHELL32_IExplorerInterface);
IUnknown_AddRef(SHELL32_IExplorerInterface);
return NOERROR;
}
/*************************************************************************