2002-05-14 23:50:56 +02:00
|
|
|
/*
|
|
|
|
* ComCatMgr IUnknown implementation for comcat.dll
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 John K. Hohm
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
2002-12-23 02:39:35 +01:00
|
|
|
#include "comcat_private.h"
|
2002-05-14 23:50:56 +02:00
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ole);
|
|
|
|
|
|
|
|
static ULONG WINAPI COMCAT_IUnknown_AddRef(LPUNKNOWN iface);
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* COMCAT_IUnknown_QueryInterface
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI COMCAT_IUnknown_QueryInterface(
|
|
|
|
LPUNKNOWN iface,
|
|
|
|
REFIID riid,
|
|
|
|
LPVOID *ppvObj)
|
|
|
|
{
|
|
|
|
ICOM_THIS_MULTI(ComCatMgrImpl, unkVtbl, iface);
|
|
|
|
TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
|
|
|
|
|
|
|
|
if (This == NULL || ppvObj == NULL) return E_POINTER;
|
|
|
|
|
|
|
|
if (IsEqualGUID(riid, &IID_IUnknown)) {
|
2005-05-27 22:17:35 +02:00
|
|
|
*ppvObj = &This->unkVtbl;
|
2002-05-14 23:50:56 +02:00
|
|
|
COMCAT_IUnknown_AddRef(iface);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (IsEqualGUID(riid, &IID_ICatRegister)) {
|
2005-05-27 22:17:35 +02:00
|
|
|
*ppvObj = &This->regVtbl;
|
2002-05-14 23:50:56 +02:00
|
|
|
COMCAT_IUnknown_AddRef(iface);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (IsEqualGUID(riid, &IID_ICatInformation)) {
|
2005-05-27 22:17:35 +02:00
|
|
|
*ppvObj = &This->infVtbl;
|
2002-05-14 23:50:56 +02:00
|
|
|
COMCAT_IUnknown_AddRef(iface);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* COMCAT_IUnknown_AddRef
|
|
|
|
*/
|
|
|
|
static ULONG WINAPI COMCAT_IUnknown_AddRef(LPUNKNOWN iface)
|
|
|
|
{
|
|
|
|
ICOM_THIS_MULTI(ComCatMgrImpl, unkVtbl, iface);
|
2005-01-10 13:25:29 +01:00
|
|
|
ULONG ref;
|
|
|
|
|
2002-05-14 23:50:56 +02:00
|
|
|
TRACE("\n");
|
|
|
|
|
|
|
|
if (This == NULL) return E_POINTER;
|
|
|
|
|
2005-01-10 13:25:29 +01:00
|
|
|
ref = InterlockedIncrement(&This->ref);
|
|
|
|
if (ref == 1) {
|
2002-05-14 23:50:56 +02:00
|
|
|
InterlockedIncrement(&dll_ref);
|
|
|
|
}
|
2005-01-10 13:25:29 +01:00
|
|
|
return ref;
|
2002-05-14 23:50:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* COMCAT_IUnknown_Release
|
|
|
|
*/
|
|
|
|
static ULONG WINAPI COMCAT_IUnknown_Release(LPUNKNOWN iface)
|
|
|
|
{
|
|
|
|
ICOM_THIS_MULTI(ComCatMgrImpl, unkVtbl, iface);
|
2005-01-10 13:25:29 +01:00
|
|
|
ULONG ref;
|
|
|
|
|
2002-05-14 23:50:56 +02:00
|
|
|
TRACE("\n");
|
|
|
|
|
|
|
|
if (This == NULL) return E_POINTER;
|
|
|
|
|
2005-01-10 13:25:29 +01:00
|
|
|
ref = InterlockedDecrement(&This->ref);
|
|
|
|
if (ref == 0) {
|
2002-05-14 23:50:56 +02:00
|
|
|
InterlockedDecrement(&dll_ref);
|
|
|
|
}
|
2005-01-10 13:25:29 +01:00
|
|
|
return ref;
|
2002-05-14 23:50:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* COMCAT_IUnknown_Vtbl
|
|
|
|
*/
|
2005-05-27 22:17:35 +02:00
|
|
|
static const IUnknownVtbl COMCAT_IUnknown_Vtbl =
|
2002-05-14 23:50:56 +02:00
|
|
|
{
|
|
|
|
COMCAT_IUnknown_QueryInterface,
|
|
|
|
COMCAT_IUnknown_AddRef,
|
|
|
|
COMCAT_IUnknown_Release
|
|
|
|
};
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* static ComCatMgr instance
|
|
|
|
*/
|
2005-05-27 22:17:35 +02:00
|
|
|
const ComCatMgrImpl COMCAT_ComCatMgr =
|
2002-05-14 23:50:56 +02:00
|
|
|
{
|
|
|
|
&COMCAT_IUnknown_Vtbl,
|
|
|
|
&COMCAT_ICatRegister_Vtbl,
|
|
|
|
&COMCAT_ICatInformation_Vtbl,
|
|
|
|
0
|
|
|
|
};
|