user32/tests: Test pending redraw state with owner-drawn list box.
[wine.git] / dlls / browseui / compcatcachedaemon.c
blob6de0d87ef38b0718272d43217f0a2983917560e5
1 /*
2 * Component Category Cache 'Daemon'
4 * Copyright (C) 2008 Maarten Lankhorst
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
23 #define COBJMACROS
25 #include "wine/debug.h"
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winreg.h"
29 #include "winuser.h"
30 #include "shlwapi.h"
31 #include "winerror.h"
32 #include "objbase.h"
34 #include "shlguid.h"
35 #include "shlobj.h"
37 #include "wine/heap.h"
39 #include "browseui.h"
40 #include "resids.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(browseui);
44 typedef struct tagCCCD {
45 IRunnableTask IRunnableTask_iface;
46 LONG refCount;
47 CRITICAL_SECTION cs;
48 } CompCatCacheDaemon;
50 static inline CompCatCacheDaemon *impl_from_IRunnableTask(IRunnableTask *iface)
52 return CONTAINING_RECORD(iface, CompCatCacheDaemon, IRunnableTask_iface);
55 static void CompCatCacheDaemon_Destructor(CompCatCacheDaemon *This)
57 TRACE("destroying %p\n", This);
58 This->cs.DebugInfo->Spare[0] = 0;
59 DeleteCriticalSection(&This->cs);
60 heap_free(This);
61 InterlockedDecrement(&BROWSEUI_refCount);
64 static HRESULT WINAPI CompCatCacheDaemon_QueryInterface(IRunnableTask *iface, REFIID iid, LPVOID *ppvOut)
66 CompCatCacheDaemon *This = impl_from_IRunnableTask(iface);
67 *ppvOut = NULL;
69 if (IsEqualIID(iid, &IID_IRunnableTask) || IsEqualIID(iid, &IID_IUnknown))
71 *ppvOut = &This->IRunnableTask_iface;
74 if (*ppvOut)
76 IRunnableTask_AddRef(iface);
77 return S_OK;
80 FIXME("unsupported interface: %s\n", debugstr_guid(iid));
81 return E_NOINTERFACE;
84 static ULONG WINAPI CompCatCacheDaemon_AddRef(IRunnableTask *iface)
86 CompCatCacheDaemon *This = impl_from_IRunnableTask(iface);
87 return InterlockedIncrement(&This->refCount);
90 static ULONG WINAPI CompCatCacheDaemon_Release(IRunnableTask *iface)
92 CompCatCacheDaemon *This = impl_from_IRunnableTask(iface);
93 ULONG ret;
95 ret = InterlockedDecrement(&This->refCount);
96 if (ret == 0)
97 CompCatCacheDaemon_Destructor(This);
98 return ret;
101 static HRESULT WINAPI CompCatCacheDaemon_Run(IRunnableTask *iface)
103 FIXME("stub\n");
104 return S_OK;
107 static HRESULT WINAPI CompCatCacheDaemon_Kill(IRunnableTask *iface, BOOL fWait)
109 FIXME("stub\n");
110 return S_OK;
113 static HRESULT WINAPI CompCatCacheDaemon_Suspend(IRunnableTask *iface)
115 FIXME("stub\n");
116 return S_OK;
119 static HRESULT WINAPI CompCatCacheDaemon_Resume(IRunnableTask *iface)
121 FIXME("stub\n");
122 return S_OK;
125 static ULONG WINAPI CompCatCacheDaemon_IsRunning(IRunnableTask *iface)
127 FIXME("stub\n");
128 return 0;
131 static const IRunnableTaskVtbl CompCatCacheDaemonVtbl =
133 CompCatCacheDaemon_QueryInterface,
134 CompCatCacheDaemon_AddRef,
135 CompCatCacheDaemon_Release,
136 CompCatCacheDaemon_Run,
137 CompCatCacheDaemon_Kill,
138 CompCatCacheDaemon_Suspend,
139 CompCatCacheDaemon_Resume,
140 CompCatCacheDaemon_IsRunning
143 HRESULT CompCatCacheDaemon_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
145 CompCatCacheDaemon *This;
146 if (pUnkOuter)
147 return CLASS_E_NOAGGREGATION;
149 This = heap_alloc(sizeof(CompCatCacheDaemon));
150 if (This == NULL)
151 return E_OUTOFMEMORY;
153 This->IRunnableTask_iface.lpVtbl = &CompCatCacheDaemonVtbl;
154 This->refCount = 1;
155 InitializeCriticalSection(&This->cs);
156 This->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": CompCatCacheDaemon.cs");
158 TRACE("returning %p\n", This);
159 *ppOut = (IUnknown *)&This->IRunnableTask_iface;
160 InterlockedIncrement(&BROWSEUI_refCount);
161 return S_OK;