comcat: Simplify the class factory implementation and make it more similar to the other ones in ole32.
This commit is contained in:
parent
d4f107f54b
commit
f8ff1bd6fb
|
@ -38,7 +38,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
|
||||||
{
|
{
|
||||||
*ppv = NULL;
|
*ppv = NULL;
|
||||||
if (IsEqualGUID(rclsid, &CLSID_StdComponentCategoriesMgr)) {
|
if (IsEqualGUID(rclsid, &CLSID_StdComponentCategoriesMgr)) {
|
||||||
return IClassFactory_QueryInterface((LPCLASSFACTORY)&COMCAT_ClassFactory, iid, ppv);
|
return ComCatCF_Create(iid, ppv);
|
||||||
}
|
}
|
||||||
FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid),debugstr_guid(iid));
|
FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid),debugstr_guid(iid));
|
||||||
return CLASS_E_CLASSNOTAVAILABLE;
|
return CLASS_E_CLASSNOTAVAILABLE;
|
||||||
|
|
|
@ -39,17 +39,7 @@
|
||||||
*/
|
*/
|
||||||
extern LONG dll_ref;
|
extern LONG dll_ref;
|
||||||
|
|
||||||
/**********************************************************************
|
extern HRESULT ComCatCF_Create(REFIID riid, LPVOID *ppv);
|
||||||
* ClassFactory declaration for comcat.dll
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
/* IUnknown fields */
|
|
||||||
const IClassFactoryVtbl *lpVtbl;
|
|
||||||
LONG ref;
|
|
||||||
} ClassFactoryImpl;
|
|
||||||
|
|
||||||
extern ClassFactoryImpl COMCAT_ClassFactory;
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* StdComponentCategoriesMgr declaration for comcat.dll
|
* StdComponentCategoriesMgr declaration for comcat.dll
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
||||||
|
|
||||||
static ULONG WINAPI COMCAT_IClassFactory_AddRef(LPCLASSFACTORY iface);
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* COMCAT_IClassFactory_QueryInterface (also IUnknown)
|
* COMCAT_IClassFactory_QueryInterface (also IUnknown)
|
||||||
|
@ -42,7 +41,7 @@ static HRESULT WINAPI COMCAT_IClassFactory_QueryInterface(
|
||||||
IsEqualGUID(riid, &IID_IClassFactory))
|
IsEqualGUID(riid, &IID_IClassFactory))
|
||||||
{
|
{
|
||||||
*ppvObj = (LPVOID)iface;
|
*ppvObj = (LPVOID)iface;
|
||||||
COMCAT_IClassFactory_AddRef(iface);
|
IUnknown_AddRef(iface);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,16 +53,7 @@ static HRESULT WINAPI COMCAT_IClassFactory_QueryInterface(
|
||||||
*/
|
*/
|
||||||
static ULONG WINAPI COMCAT_IClassFactory_AddRef(LPCLASSFACTORY iface)
|
static ULONG WINAPI COMCAT_IClassFactory_AddRef(LPCLASSFACTORY iface)
|
||||||
{
|
{
|
||||||
ClassFactoryImpl *This = (ClassFactoryImpl *)iface;
|
return 2; /* non-heap based object */
|
||||||
ULONG ref;
|
|
||||||
|
|
||||||
TRACE("\n");
|
|
||||||
|
|
||||||
ref = InterlockedIncrement(&This->ref);
|
|
||||||
if (ref == 1) {
|
|
||||||
InterlockedIncrement(&dll_ref);
|
|
||||||
}
|
|
||||||
return ref;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
|
@ -71,16 +61,7 @@ static ULONG WINAPI COMCAT_IClassFactory_AddRef(LPCLASSFACTORY iface)
|
||||||
*/
|
*/
|
||||||
static ULONG WINAPI COMCAT_IClassFactory_Release(LPCLASSFACTORY iface)
|
static ULONG WINAPI COMCAT_IClassFactory_Release(LPCLASSFACTORY iface)
|
||||||
{
|
{
|
||||||
ClassFactoryImpl *This = (ClassFactoryImpl *)iface;
|
return 1; /* non-heap based object */
|
||||||
ULONG ref;
|
|
||||||
|
|
||||||
TRACE("\n");
|
|
||||||
|
|
||||||
ref = InterlockedDecrement(&This->ref);
|
|
||||||
if (ref == 0) {
|
|
||||||
InterlockedDecrement(&dll_ref);
|
|
||||||
}
|
|
||||||
return ref;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
|
@ -115,20 +96,14 @@ static HRESULT WINAPI COMCAT_IClassFactory_LockServer(
|
||||||
LPCLASSFACTORY iface,
|
LPCLASSFACTORY iface,
|
||||||
BOOL fLock)
|
BOOL fLock)
|
||||||
{
|
{
|
||||||
TRACE("\n");
|
FIXME("(%d), stub!\n",fLock);
|
||||||
|
|
||||||
if (fLock != FALSE) {
|
|
||||||
IClassFactory_AddRef(iface);
|
|
||||||
} else {
|
|
||||||
IClassFactory_Release(iface);
|
|
||||||
}
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* IClassFactory_Vtbl
|
* static ClassFactory instance
|
||||||
*/
|
*/
|
||||||
static const IClassFactoryVtbl IClassFactory_Vtbl =
|
static const IClassFactoryVtbl ComCatCFVtbl =
|
||||||
{
|
{
|
||||||
COMCAT_IClassFactory_QueryInterface,
|
COMCAT_IClassFactory_QueryInterface,
|
||||||
COMCAT_IClassFactory_AddRef,
|
COMCAT_IClassFactory_AddRef,
|
||||||
|
@ -137,7 +112,9 @@ static const IClassFactoryVtbl IClassFactory_Vtbl =
|
||||||
COMCAT_IClassFactory_LockServer
|
COMCAT_IClassFactory_LockServer
|
||||||
};
|
};
|
||||||
|
|
||||||
/**********************************************************************
|
static const IClassFactoryVtbl *ComCatCF = &ComCatCFVtbl;
|
||||||
* static ClassFactory instance
|
|
||||||
*/
|
HRESULT ComCatCF_Create(REFIID riid, LPVOID *ppv)
|
||||||
ClassFactoryImpl COMCAT_ClassFactory = { &IClassFactory_Vtbl, 0 };
|
{
|
||||||
|
return IClassFactory_QueryInterface((IClassFactory *)&ComCatCF, riid, ppv);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue