Commit 452db3f1 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

Changed ICOM_THIS definition.

parent 4ca9d755
......@@ -212,6 +212,13 @@ DWORD WINAPI SHGetMalloc(LPMALLOC32 *lpmal)
* IClassFactory Implementation
*/
typedef struct
{
/* IUnknown fields */
ICOM_VTABLE(IClassFactory)* lpvtbl;
DWORD ref;
} IClassFactoryImpl;
static ICOM_VTABLE(IClassFactory) clfvt;
/**************************************************************************
......@@ -220,9 +227,9 @@ static ICOM_VTABLE(IClassFactory) clfvt;
LPCLASSFACTORY IClassFactory_Constructor(void)
{
_IClassFactory* lpclf;
IClassFactoryImpl* lpclf;
lpclf= (_IClassFactory*)HeapAlloc(GetProcessHeap(),0,sizeof(_IClassFactory));
lpclf= (IClassFactoryImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IClassFactoryImpl));
lpclf->ref = 1;
lpclf->lpvtbl = &clfvt;
......@@ -236,18 +243,18 @@ LPCLASSFACTORY IClassFactory_Constructor(void)
static HRESULT WINAPI IClassFactory_fnQueryInterface(
LPCLASSFACTORY iface, REFIID riid, LPVOID *ppvObj)
{
ICOM_THIS(IClassFactory,iface);
ICOM_THIS(IClassFactoryImpl,iface);
char xriid[50];
WINE_StringFromCLSID((LPCLSID)riid,xriid);
TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",this,xriid);
TRACE(shell,"(%p)->(\n\tIID:\t%s)\n",This,xriid);
*ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown)) /*IUnknown*/
{ *ppvObj = this;
{ *ppvObj = This;
}
else if(IsEqualIID(riid, &IID_IClassFactory)) /*IClassFactory*/
{ *ppvObj = (IClassFactory*)this;
{ *ppvObj = (IClassFactory*)This;
}
if(*ppvObj)
......@@ -263,27 +270,27 @@ static HRESULT WINAPI IClassFactory_fnQueryInterface(
*/
static ULONG WINAPI IClassFactory_fnAddRef(LPCLASSFACTORY iface)
{
ICOM_THIS(IClassFactory,iface);
TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
ICOM_THIS(IClassFactoryImpl,iface);
TRACE(shell,"(%p)->(count=%lu)\n",This,This->ref);
shell32_ObjCount++;
return ++(this->ref);
return ++(This->ref);
}
/******************************************************************************
* IClassFactory_Release
*/
static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface)
{
ICOM_THIS(IClassFactory,iface);
TRACE(shell,"(%p)->(count=%lu)\n",this,this->ref);
ICOM_THIS(IClassFactoryImpl,iface);
TRACE(shell,"(%p)->(count=%lu)\n",This,This->ref);
shell32_ObjCount--;
if (!--(this->ref))
{ TRACE(shell,"-- destroying IClassFactory(%p)\n",this);
HeapFree(GetProcessHeap(),0,this);
if (!--(This->ref))
{ TRACE(shell,"-- destroying IClassFactory(%p)\n",This);
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return this->ref;
return This->ref;
}
/******************************************************************************
* IClassFactory_CreateInstance
......@@ -291,13 +298,13 @@ static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface)
static HRESULT WINAPI IClassFactory_fnCreateInstance(
LPCLASSFACTORY iface, LPUNKNOWN pUnknown, REFIID riid, LPVOID *ppObject)
{
ICOM_THIS(IClassFactory,iface);
ICOM_THIS(IClassFactoryImpl,iface);
IUnknown *pObj = NULL;
HRESULT hres;
char xriid[50];
WINE_StringFromCLSID((LPCLSID)riid,xriid);
TRACE(shell,"%p->(%p,\n\tIID:\t%s,%p)\n",this,pUnknown,xriid,ppObject);
TRACE(shell,"%p->(%p,\n\tIID:\t%s,%p)\n",This,pUnknown,xriid,ppObject);
*ppObject = NULL;
......@@ -331,7 +338,7 @@ static HRESULT WINAPI IClassFactory_fnCreateInstance(
hres = pObj->lpvtbl->fnQueryInterface(pObj,riid, ppObject);
pObj->lpvtbl->fnRelease(pObj);
TRACE(shell,"-- Object created: (%p)->%p\n",this,*ppObject);
TRACE(shell,"-- Object created: (%p)->%p\n",This,*ppObject);
return hres;
}
......@@ -340,8 +347,8 @@ static HRESULT WINAPI IClassFactory_fnCreateInstance(
*/
static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface, BOOL32 fLock)
{
ICOM_THIS(IClassFactory,iface);
TRACE(shell,"%p->(0x%x), not implemented\n",this, fLock);
ICOM_THIS(IClassFactoryImpl,iface);
TRACE(shell,"%p->(0x%x), not implemented\n",This, fLock);
return E_NOTIMPL;
}
......
......@@ -652,8 +652,8 @@ BOOL32 WINAPI IsEqualGUID32(REFGUID rguid1,REFGUID rguid2);
#define ICOM_CALL8(xfn, p,a,b,c,d,e,f,g,h) (p)->lpvtbl->fn##xfn(p,a,b,c,d,e,f,g,h)
#define ICOM_THIS(iface,me) struct _##iface* this=(struct _##iface*)me
#define ICOM_CTHIS(iface,me) const _##iface* this=(const _##iface*)me
#define ICOM_THIS(impl,iface) impl* const This=(impl*)iface
#define ICOM_CTHIS(impl,iface) const impl* const This=(const impl*)iface
#endif
......
......@@ -2158,39 +2158,46 @@ HRESULT WINAPI DirectSoundCreate(LPGUID lpGUID,LPDIRECTSOUND *ppDS,IUnknown *pUn
/*******************************************************************************
* DirectSound ClassFactory
*/
typedef struct
{
/* IUnknown fields */
ICOM_VTABLE(IClassFactory)* lpvtbl;
DWORD ref;
} IClassFactoryImpl;
static HRESULT WINAPI
DSCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
ICOM_THIS(IClassFactory,iface);
ICOM_THIS(IClassFactoryImpl,iface);
char buf[80];
if (HIWORD(riid))
WINE_StringFromCLSID(riid,buf);
else
sprintf(buf,"<guid-0x%04x>",LOWORD(riid));
FIXME(dsound,"(%p)->(%s,%p),stub!\n",this,buf,ppobj);
FIXME(dsound,"(%p)->(%s,%p),stub!\n",This,buf,ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI
DSCF_AddRef(LPCLASSFACTORY iface) {
ICOM_THIS(IClassFactory,iface);
return ++(this->ref);
ICOM_THIS(IClassFactoryImpl,iface);
return ++(This->ref);
}
static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface) {
ICOM_THIS(IClassFactory,iface);
ICOM_THIS(IClassFactoryImpl,iface);
/* static class, won't be freed */
return --(this->ref);
return --(This->ref);
}
static HRESULT WINAPI DSCF_CreateInstance(
LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
) {
ICOM_THIS(IClassFactory,iface);
ICOM_THIS(IClassFactoryImpl,iface);
char buf[80];
WINE_StringFromCLSID(riid,buf);
TRACE(dsound,"(%p)->(%p,%s,%p)\n",this,pOuter,buf,ppobj);
TRACE(dsound,"(%p)->(%p,%s,%p)\n",This,pOuter,buf,ppobj);
if (!memcmp(riid,&IID_IDirectSound,sizeof(IID_IDirectSound))) {
/* FIXME: reuse already created dsound if present? */
return DirectSoundCreate(riid,(LPDIRECTSOUND*)ppobj,pOuter);
......@@ -2199,19 +2206,19 @@ static HRESULT WINAPI DSCF_CreateInstance(
}
static HRESULT WINAPI DSCF_LockServer(LPCLASSFACTORY iface,BOOL32 dolock) {
ICOM_THIS(IClassFactory,iface);
FIXME(dsound,"(%p)->(%d),stub!\n",this,dolock);
ICOM_THIS(IClassFactoryImpl,iface);
FIXME(dsound,"(%p)->(%d),stub!\n",This,dolock);
return S_OK;
}
static ICOM_VTABLE(IClassFactory) DSCF_VTable = {
static ICOM_VTABLE(IClassFactory) DSCF_Vtbl = {
DSCF_QueryInterface,
DSCF_AddRef,
DSCF_Release,
DSCF_CreateInstance,
DSCF_LockServer
};
static _IClassFactory DSOUND_CF = {&DSCF_VTable, 1 };
static IClassFactoryImpl DSOUND_CF = {&DSCF_Vtbl, 1 };
/*******************************************************************************
* DllGetClassObject [DSOUND.4]
......@@ -2246,7 +2253,7 @@ DWORD WINAPI DSOUND_DllGetClassObject(REFCLSID rclsid,REFIID riid,LPVOID *ppv)
TRACE(dsound, "(%p,%p,%p)\n", xbuf, buf, ppv);
if (!memcmp(riid,&IID_IClassFactory,sizeof(IID_IClassFactory))) {
*ppv = (LPVOID)&DSOUND_CF;
IClassFactory_AddRef(&DSOUND_CF);
IClassFactory_AddRef((IClassFactory*)*ppv);
return S_OK;
}
FIXME(dsound, "(%p,%p,%p): no interface found.\n", xbuf, buf, ppv);
......
......@@ -45,6 +45,8 @@
#include "objbase.h"
#include "ifs.h"
/****************************************************************************
* COM External Lock structures and methods declaration
*
......@@ -1283,7 +1285,7 @@ HRESULT WINAPI CoCreateInstance(
hres = CoGetClassObject(rclsid,
dwClsContext,
NULL,
(const REFIID) &IID_IClassFactory,
&IID_IClassFactory,
(LPVOID)&lpclf);
if (FAILED(hres))
......
#ifndef __WINE_OLE_IFS_H
#define __WINE_OLE_IFS_H
extern LPMALLOC16 IMalloc16_Constructor();
extern LPMALLOC32 IMalloc32_Constructor();
#endif /* __WINE_OLE_IFS_H */
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