Commit 34ed785f authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

mlang: COM cleanup for the IClassFactory iface.

parent c4cdc507
......@@ -1277,12 +1277,16 @@ HRESULT WINAPI Rfc1766ToLcidA(LCID *lcid, LPCSTR rfc1766A)
* MLANG ClassFactory
*/
typedef struct {
IClassFactory ITF_IClassFactory;
IClassFactory IClassFactory_iface;
LONG ref;
HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj);
} IClassFactoryImpl;
static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
{
return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
}
struct object_creation_info
{
const CLSID *clsid;
......@@ -1295,35 +1299,32 @@ static const struct object_creation_info object_creation[] =
{ &CLSID_CMultiLanguage, "CLSID_CMultiLanguage", MultiLanguage_create },
};
static HRESULT WINAPI
MLANGCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
static HRESULT WINAPI MLANGCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppobj)
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
TRACE("%s\n", debugstr_guid(riid) );
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IClassFactory))
{
IClassFactory_AddRef(iface);
*ppobj = This;
*ppobj = iface;
return S_OK;
}
WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
*ppobj = NULL;
WARN("(%p)->(%s,%p), not found\n", iface, debugstr_guid(riid), ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI MLANGCF_AddRef(LPCLASSFACTORY iface)
static ULONG WINAPI MLANGCF_AddRef(IClassFactory *iface)
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI MLANGCF_Release(LPCLASSFACTORY iface)
static ULONG WINAPI MLANGCF_Release(IClassFactory *iface)
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
ULONG ref = InterlockedDecrement(&This->ref);
if (ref == 0)
......@@ -1335,10 +1336,10 @@ static ULONG WINAPI MLANGCF_Release(LPCLASSFACTORY iface)
return ref;
}
static HRESULT WINAPI MLANGCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter,
REFIID riid, LPVOID *ppobj)
static HRESULT WINAPI MLANGCF_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
REFIID riid, void **ppobj)
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
HRESULT hres;
LPUNKNOWN punk;
......@@ -1354,7 +1355,7 @@ static HRESULT WINAPI MLANGCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOu
return hres;
}
static HRESULT WINAPI MLANGCF_LockServer(LPCLASSFACTORY iface,BOOL dolock)
static HRESULT WINAPI MLANGCF_LockServer(IClassFactory *iface, BOOL dolock)
{
if (dolock)
LockModule();
......@@ -1404,14 +1405,14 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
factory = HeapAlloc(GetProcessHeap(), 0, sizeof(*factory));
if (factory == NULL) return E_OUTOFMEMORY;
factory->ITF_IClassFactory.lpVtbl = &MLANGCF_Vtbl;
factory->IClassFactory_iface.lpVtbl = &MLANGCF_Vtbl;
factory->ref = 1;
factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
*ppv = &(factory->ITF_IClassFactory);
*ppv = &factory->IClassFactory_iface;
TRACE("(%p) <- %p\n", ppv, &(factory->ITF_IClassFactory) );
TRACE("(%p) <- %p\n", ppv, &factory->IClassFactory_iface);
return S_OK;
}
......
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