wined3d: Use the correct colour sources in process_vertices_strided().
[wine.git] / dlls / dsquery / main.c
blob7f58502814961d0317fcce78be5c55ac32266e80
1 /*
2 * Copyright 2017 Zebediah Figura for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "config.h"
21 #include <stdarg.h>
23 #define COBJMACROS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "objbase.h"
28 #include "rpcproxy.h"
29 #include "initguid.h"
30 #include "cmnquery.h"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(dsquery);
35 static HINSTANCE instance;
37 /******************************************************************
38 * IClassFactory implementation
40 struct query_class_factory {
41 IClassFactory IClassFactory_iface;
42 LONG ref;
43 HRESULT (*pfnCreateInstance)(IUnknown *outer, REFIID riid, void **out);
46 static inline struct query_class_factory *impl_from_IClassFactory(IClassFactory *iface)
48 return CONTAINING_RECORD(iface, struct query_class_factory, IClassFactory_iface);
51 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **out)
53 TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), out);
55 if (IsEqualGUID(riid, &IID_IClassFactory) || IsEqualGUID(riid, &IID_IUnknown))
57 IClassFactory_AddRef(iface);
58 *out = iface;
59 return S_OK;
62 FIXME("interface %s not implemented\n", debugstr_guid(riid));
63 *out = NULL;
64 return E_NOINTERFACE;
67 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
69 struct query_class_factory *This = impl_from_IClassFactory(iface);
70 ULONG ref = InterlockedIncrement(&This->ref);
72 TRACE("(%p) increasing refcount to %u\n", iface, ref);
74 return ref;
77 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
79 struct query_class_factory *This = impl_from_IClassFactory(iface);
80 ULONG ref = InterlockedDecrement(&This->ref);
82 TRACE("(%p) decreasing refcount to %u\n", iface, ref);
84 if (ref == 0)
85 HeapFree(GetProcessHeap(), 0, This);
87 return ref;
90 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface,
91 IUnknown *outer, REFIID riid, void **out)
93 struct query_class_factory *This = impl_from_IClassFactory(iface);
95 TRACE("(%p)->(%p, %s, %p)\n", iface, outer, debugstr_guid(riid), out);
97 return This->pfnCreateInstance(outer, riid, out);
100 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
102 FIXME("(%p)->(%d)\n", iface, dolock);
104 return S_OK;
107 static const IClassFactoryVtbl query_class_factory_vtbl =
109 ClassFactory_QueryInterface,
110 ClassFactory_AddRef,
111 ClassFactory_Release,
112 ClassFactory_CreateInstance,
113 ClassFactory_LockServer,
116 /******************************************************************
117 * ICommonQuery implementation
119 struct common_query {
120 ICommonQuery ICommonQuery_iface;
121 LONG ref;
124 static inline struct common_query *impl_from_ICommonQuery(ICommonQuery *iface)
126 return CONTAINING_RECORD(iface, struct common_query, ICommonQuery_iface);
129 static HRESULT WINAPI CommonQuery_QueryInterface(ICommonQuery *iface, REFIID riid, void **out)
131 TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), out);
133 if (IsEqualGUID(riid, &IID_ICommonQuery) || IsEqualGUID(riid, &IID_IUnknown))
135 ICommonQuery_AddRef(iface);
136 *out = iface;
137 return S_OK;
140 FIXME("interface %s not implemented\n", debugstr_guid(riid));
141 *out = NULL;
142 return E_NOINTERFACE;
145 static ULONG WINAPI CommonQuery_AddRef(ICommonQuery *iface)
147 struct common_query *This = impl_from_ICommonQuery(iface);
148 ULONG ref = InterlockedIncrement(&This->ref);
150 TRACE("(%p) increasing refcount to %u\n", iface, ref);
152 return ref;
155 static ULONG WINAPI CommonQuery_Release(ICommonQuery *iface)
157 struct common_query *This = impl_from_ICommonQuery(iface);
158 ULONG ref = InterlockedDecrement(&This->ref);
160 TRACE("(%p) decreasing refcount to %u\n", iface, ref);
162 if (ref == 0)
163 HeapFree(GetProcessHeap(), 0, This);
165 return ref;
168 static HRESULT WINAPI CommonQuery_OpenQueryWindow(ICommonQuery *iface,
169 HWND parent, LPOPENQUERYWINDOW query_window, IDataObject **data_object)
171 FIXME("(%p)->(%p, %p, %p) stub!\n", iface, parent, query_window, data_object);
173 return E_NOTIMPL;
176 static const ICommonQueryVtbl CommonQuery_vtbl =
178 CommonQuery_QueryInterface,
179 CommonQuery_AddRef,
180 CommonQuery_Release,
181 CommonQuery_OpenQueryWindow,
184 static HRESULT CommonQuery_create(IUnknown *outer, REFIID riid, void **out)
186 struct common_query *query;
188 TRACE("outer %p, riid %s, out %p\n", outer, debugstr_guid(riid), out);
190 if (outer)
191 return CLASS_E_NOAGGREGATION;
193 if (!(query = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*query))))
194 return E_OUTOFMEMORY;
196 query->ICommonQuery_iface.lpVtbl = &CommonQuery_vtbl;
197 return ICommonQuery_QueryInterface(&query->ICommonQuery_iface, riid, out);
200 /***********************************************************************
201 * DllMain
203 BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, void *reserved)
205 TRACE("(%p, %u, %p)\n", inst, reason, reserved);
207 switch (reason)
209 case DLL_PROCESS_ATTACH:
210 instance = inst;
211 DisableThreadLibraryCalls(inst);
212 break;
215 return TRUE;
218 /***********************************************************************
219 * DllCanUnloadNow (DSQUERY.@)
221 HRESULT WINAPI DllCanUnloadNow(void)
223 return S_FALSE;
226 /***********************************************************************
227 * DllGetClassObject (DSQUERY.@)
229 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **out)
231 TRACE("rclsid %s, riid %s, out %p\n", debugstr_guid(rclsid), debugstr_guid(riid), out);
233 if (!IsEqualGUID( &IID_IClassFactory, riid)
234 && !IsEqualGUID( &IID_IUnknown, riid))
236 FIXME("interface %s not implemented\n", debugstr_guid(riid));
237 *out = NULL;
238 return E_NOINTERFACE;
241 if (IsEqualGUID(&CLSID_CommonQuery, rclsid))
243 struct query_class_factory *factory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*factory));
244 if (!factory) return E_OUTOFMEMORY;
246 factory->IClassFactory_iface.lpVtbl = &query_class_factory_vtbl;
247 factory->ref = 1;
248 factory->pfnCreateInstance = CommonQuery_create;
249 *out = factory;
250 return S_OK;
253 FIXME("%s: no class found\n", debugstr_guid(rclsid));
254 *out = NULL;
255 return CLASS_E_CLASSNOTAVAILABLE;
258 /***********************************************************************
259 * DllRegisterServer (DSQUERY.@)
261 HRESULT WINAPI DllRegisterServer(void)
263 return __wine_register_resources( instance );
266 /***********************************************************************
267 * DllUnregisterServer (DSQUERY.@)
269 HRESULT WINAPI DllUnregisterServer(void)
271 return __wine_unregister_resources( instance );