2008-02-11 19:18:07 +01:00
|
|
|
/*
|
|
|
|
* Component Category Cache 'Daemon'
|
|
|
|
*
|
|
|
|
* Copyright (C) 2008 Maarten Lankhorst
|
|
|
|
*
|
|
|
|
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winreg.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "shlwapi.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
#include "objbase.h"
|
|
|
|
|
|
|
|
#include "shlguid.h"
|
|
|
|
#include "shlobj.h"
|
|
|
|
|
2018-01-29 22:50:42 +01:00
|
|
|
#include "wine/heap.h"
|
2008-02-11 19:18:07 +01:00
|
|
|
|
|
|
|
#include "browseui.h"
|
|
|
|
#include "resids.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(browseui);
|
|
|
|
|
|
|
|
typedef struct tagCCCD {
|
2010-12-08 22:59:29 +01:00
|
|
|
IRunnableTask IRunnableTask_iface;
|
2008-02-11 19:18:07 +01:00
|
|
|
LONG refCount;
|
|
|
|
CRITICAL_SECTION cs;
|
|
|
|
} CompCatCacheDaemon;
|
|
|
|
|
2010-12-08 22:59:29 +01:00
|
|
|
static inline CompCatCacheDaemon *impl_from_IRunnableTask(IRunnableTask *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, CompCatCacheDaemon, IRunnableTask_iface);
|
|
|
|
}
|
|
|
|
|
2008-02-11 19:18:07 +01:00
|
|
|
static void CompCatCacheDaemon_Destructor(CompCatCacheDaemon *This)
|
|
|
|
{
|
|
|
|
TRACE("destroying %p\n", This);
|
2011-11-14 15:08:39 +01:00
|
|
|
This->cs.DebugInfo->Spare[0] = 0;
|
2008-02-11 19:18:07 +01:00
|
|
|
DeleteCriticalSection(&This->cs);
|
2008-02-22 02:22:59 +01:00
|
|
|
heap_free(This);
|
2015-03-01 03:46:06 +01:00
|
|
|
InterlockedDecrement(&BROWSEUI_refCount);
|
2008-02-11 19:18:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI CompCatCacheDaemon_QueryInterface(IRunnableTask *iface, REFIID iid, LPVOID *ppvOut)
|
|
|
|
{
|
2010-12-08 22:59:29 +01:00
|
|
|
CompCatCacheDaemon *This = impl_from_IRunnableTask(iface);
|
2008-02-11 19:18:07 +01:00
|
|
|
*ppvOut = NULL;
|
|
|
|
|
|
|
|
if (IsEqualIID(iid, &IID_IRunnableTask) || IsEqualIID(iid, &IID_IUnknown))
|
|
|
|
{
|
2015-03-20 09:19:22 +01:00
|
|
|
*ppvOut = &This->IRunnableTask_iface;
|
2008-02-11 19:18:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (*ppvOut)
|
|
|
|
{
|
|
|
|
IRunnableTask_AddRef(iface);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
FIXME("unsupported interface: %s\n", debugstr_guid(iid));
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI CompCatCacheDaemon_AddRef(IRunnableTask *iface)
|
|
|
|
{
|
2010-12-08 22:59:29 +01:00
|
|
|
CompCatCacheDaemon *This = impl_from_IRunnableTask(iface);
|
2008-02-11 19:18:07 +01:00
|
|
|
return InterlockedIncrement(&This->refCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI CompCatCacheDaemon_Release(IRunnableTask *iface)
|
|
|
|
{
|
2010-12-08 22:59:29 +01:00
|
|
|
CompCatCacheDaemon *This = impl_from_IRunnableTask(iface);
|
2008-02-11 19:18:07 +01:00
|
|
|
ULONG ret;
|
|
|
|
|
|
|
|
ret = InterlockedDecrement(&This->refCount);
|
|
|
|
if (ret == 0)
|
|
|
|
CompCatCacheDaemon_Destructor(This);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI CompCatCacheDaemon_Run(IRunnableTask *iface)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI CompCatCacheDaemon_Kill(IRunnableTask *iface, BOOL fWait)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI CompCatCacheDaemon_Suspend(IRunnableTask *iface)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI CompCatCacheDaemon_Resume(IRunnableTask *iface)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI CompCatCacheDaemon_IsRunning(IRunnableTask *iface)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IRunnableTaskVtbl CompCatCacheDaemonVtbl =
|
|
|
|
{
|
|
|
|
CompCatCacheDaemon_QueryInterface,
|
|
|
|
CompCatCacheDaemon_AddRef,
|
|
|
|
CompCatCacheDaemon_Release,
|
|
|
|
CompCatCacheDaemon_Run,
|
|
|
|
CompCatCacheDaemon_Kill,
|
|
|
|
CompCatCacheDaemon_Suspend,
|
|
|
|
CompCatCacheDaemon_Resume,
|
|
|
|
CompCatCacheDaemon_IsRunning
|
|
|
|
};
|
2008-02-22 02:22:59 +01:00
|
|
|
|
|
|
|
HRESULT CompCatCacheDaemon_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
|
|
|
|
{
|
|
|
|
CompCatCacheDaemon *This;
|
|
|
|
if (pUnkOuter)
|
|
|
|
return CLASS_E_NOAGGREGATION;
|
|
|
|
|
|
|
|
This = heap_alloc(sizeof(CompCatCacheDaemon));
|
|
|
|
if (This == NULL)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2010-12-08 22:59:29 +01:00
|
|
|
This->IRunnableTask_iface.lpVtbl = &CompCatCacheDaemonVtbl;
|
2008-02-22 02:22:59 +01:00
|
|
|
This->refCount = 1;
|
|
|
|
InitializeCriticalSection(&This->cs);
|
2011-11-14 15:08:39 +01:00
|
|
|
This->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": CompCatCacheDaemon.cs");
|
2008-02-22 02:22:59 +01:00
|
|
|
|
|
|
|
TRACE("returning %p\n", This);
|
2015-04-04 13:39:26 +02:00
|
|
|
*ppOut = (IUnknown *)&This->IRunnableTask_iface;
|
2015-03-01 03:46:06 +01:00
|
|
|
InterlockedIncrement(&BROWSEUI_refCount);
|
2008-02-22 02:22:59 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|