ws2_32/tests: Add some tests for opening the Afd device.
[wine.git] / dlls / inseng / inseng_main.c
blob2c95a2e72bdf1e324f3d756971b1cae3879ada23
1 /*
2 * INSENG Implementation
4 * Copyright 2006 Mike McCormack
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 #define COBJMACROS
24 #include <stdarg.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "ole2.h"
30 #include "rpcproxy.h"
31 #include "initguid.h"
32 #include "inseng.h"
34 #include "wine/debug.h"
35 #include "wine/heap.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(inseng);
39 struct InstallEngine {
40 IInstallEngine2 IInstallEngine2_iface;
41 LONG ref;
44 static inline InstallEngine *impl_from_IInstallEngine2(IInstallEngine2 *iface)
46 return CONTAINING_RECORD(iface, InstallEngine, IInstallEngine2_iface);
49 static HRESULT WINAPI InstallEngine_QueryInterface(IInstallEngine2 *iface, REFIID riid, void **ppv)
51 InstallEngine *This = impl_from_IInstallEngine2(iface);
53 if(IsEqualGUID(&IID_IUnknown, riid)) {
54 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
55 *ppv = &This->IInstallEngine2_iface;
56 }else if(IsEqualGUID(&IID_IInstallEngine, riid)) {
57 TRACE("(%p)->(IID_IInstallEngine %p)\n", This, ppv);
58 *ppv = &This->IInstallEngine2_iface;
59 }else if(IsEqualGUID(&IID_IInstallEngine2, riid)) {
60 TRACE("(%p)->(IID_IInstallEngine2 %p)\n", This, ppv);
61 *ppv = &This->IInstallEngine2_iface;
62 }else {
63 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
64 *ppv = NULL;
65 return E_NOINTERFACE;
68 IUnknown_AddRef((IUnknown*)*ppv);
69 return S_OK;
72 static ULONG WINAPI InstallEngine_AddRef(IInstallEngine2 *iface)
74 InstallEngine *This = impl_from_IInstallEngine2(iface);
75 LONG ref = InterlockedIncrement(&This->ref);
77 TRACE("(%p) ref=%d\n", This, ref);
79 return ref;
82 static ULONG WINAPI InstallEngine_Release(IInstallEngine2 *iface)
84 InstallEngine *This = impl_from_IInstallEngine2(iface);
85 LONG ref = InterlockedDecrement(&This->ref);
87 TRACE("(%p) ref=%d\n", This, ref);
89 if(!ref)
90 heap_free(This);
92 return ref;
95 static HRESULT WINAPI InstallEngine_GetEngineStatus(IInstallEngine2 *iface, DWORD *status)
97 InstallEngine *This = impl_from_IInstallEngine2(iface);
98 FIXME("(%p)->(%p)\n", This, status);
99 return E_NOTIMPL;
102 static HRESULT WINAPI InstallEngine_SetCifFile(IInstallEngine2 *iface, const char *cab_name, const char *cif_name)
104 InstallEngine *This = impl_from_IInstallEngine2(iface);
105 FIXME("(%p)->(%s %s)\n", This, debugstr_a(cab_name), debugstr_a(cif_name));
106 return E_NOTIMPL;
109 static HRESULT WINAPI InstallEngine_DownloadComponents(IInstallEngine2 *iface, DWORD flags)
111 InstallEngine *This = impl_from_IInstallEngine2(iface);
112 FIXME("(%p)->(%x)\n", This, flags);
113 return E_NOTIMPL;
116 static HRESULT WINAPI InstallEngine_InstallComponents(IInstallEngine2 *iface, DWORD flags)
118 InstallEngine *This = impl_from_IInstallEngine2(iface);
119 FIXME("(%p)->(%x)\n", This, flags);
120 return E_NOTIMPL;
123 static HRESULT WINAPI InstallEngine_EnumInstallIDs(IInstallEngine2 *iface, UINT index, char **id)
125 InstallEngine *This = impl_from_IInstallEngine2(iface);
126 FIXME("(%p)->(%d %p)\n", This, index, id);
127 return E_NOTIMPL;
130 static HRESULT WINAPI InstallEngine_EnumDownloadIDs(IInstallEngine2 *iface, UINT index, char **id)
132 InstallEngine *This = impl_from_IInstallEngine2(iface);
133 FIXME("(%p)->(%d %p)\n", This, index, id);
134 return E_NOTIMPL;
137 static HRESULT WINAPI InstallEngine_IsComponentInstalled(IInstallEngine2 *iface, const char *id, DWORD *status)
139 InstallEngine *This = impl_from_IInstallEngine2(iface);
140 FIXME("(%p)->(%s %p)\n", This, debugstr_a(id), status);
141 return E_NOTIMPL;
144 static HRESULT WINAPI InstallEngine_RegisterInstallEngineCallback(IInstallEngine2 *iface, IInstallEngineCallback *callback)
146 InstallEngine *This = impl_from_IInstallEngine2(iface);
147 FIXME("(%p)->(%p)\n", This, callback);
148 return E_NOTIMPL;
151 static HRESULT WINAPI InstallEngine_UnregisterInstallEngineCallback(IInstallEngine2 *iface)
153 InstallEngine *This = impl_from_IInstallEngine2(iface);
154 FIXME("(%p)\n", This);
155 return E_NOTIMPL;
158 static HRESULT WINAPI InstallEngine_SetAction(IInstallEngine2 *iface, const char *id, DWORD action, DWORD priority)
160 InstallEngine *This = impl_from_IInstallEngine2(iface);
161 FIXME("(%p)->(%s %d %d)\n", This, debugstr_a(id), action, priority);
162 return E_NOTIMPL;
165 static HRESULT WINAPI InstallEngine_GetSizes(IInstallEngine2 *iface, const char *id, COMPONENT_SIZES *sizes)
167 InstallEngine *This = impl_from_IInstallEngine2(iface);
168 FIXME("(%p)->(%s %p)\n", This, debugstr_a(id), sizes);
169 return E_NOTIMPL;
172 static HRESULT WINAPI InstallEngine_LaunchExtraCommand(IInstallEngine2 *iface, const char *inf_name, const char *section)
174 InstallEngine *This = impl_from_IInstallEngine2(iface);
175 FIXME("(%p)->(%s %s)\n", This, debugstr_a(inf_name), debugstr_a(section));
176 return E_NOTIMPL;
179 static HRESULT WINAPI InstallEngine_GetDisplayName(IInstallEngine2 *iface, const char *id, const char *name)
181 InstallEngine *This = impl_from_IInstallEngine2(iface);
182 FIXME("(%p)->(%s %s)\n", This, debugstr_a(id), debugstr_a(name));
183 return E_NOTIMPL;
186 static HRESULT WINAPI InstallEngine_SetBaseUrl(IInstallEngine2 *iface, const char *base_name)
188 InstallEngine *This = impl_from_IInstallEngine2(iface);
189 FIXME("(%p)->(%s)\n", This, debugstr_a(base_name));
190 return E_NOTIMPL;
193 static HRESULT WINAPI InstallEngine_SetDownloadDir(IInstallEngine2 *iface, const char *download_dir)
195 InstallEngine *This = impl_from_IInstallEngine2(iface);
196 FIXME("(%p)->(%s)\n", This, debugstr_a(download_dir));
197 return E_NOTIMPL;
200 static HRESULT WINAPI InstallEngine_SetInstallDrive(IInstallEngine2 *iface, char drive)
202 InstallEngine *This = impl_from_IInstallEngine2(iface);
203 FIXME("(%p)->(%c)\n", This, drive);
204 return E_NOTIMPL;
207 static HRESULT WINAPI InstallEngine_SetInstallOptions(IInstallEngine2 *iface, DWORD flags)
209 InstallEngine *This = impl_from_IInstallEngine2(iface);
210 FIXME("(%p)->(%x)\n", This, flags);
211 return E_NOTIMPL;
214 static HRESULT WINAPI InstallEngine_SetHWND(IInstallEngine2 *iface, HWND hwnd)
216 InstallEngine *This = impl_from_IInstallEngine2(iface);
217 FIXME("(%p)->(%p)\n", This, hwnd);
218 return E_NOTIMPL;
221 static HRESULT WINAPI InstallEngine_SetIStream(IInstallEngine2 *iface, IStream *stream)
223 InstallEngine *This = impl_from_IInstallEngine2(iface);
224 FIXME("(%p)->(%p)\n", This, stream);
225 return E_NOTIMPL;
228 static HRESULT WINAPI InstallEngine_Abort(IInstallEngine2 *iface, DWORD flags)
230 InstallEngine *This = impl_from_IInstallEngine2(iface);
231 FIXME("(%p)->(%x)\n", This, flags);
232 return E_NOTIMPL;
235 static HRESULT WINAPI InstallEngine_Suspend(IInstallEngine2 *iface)
237 InstallEngine *This = impl_from_IInstallEngine2(iface);
238 FIXME("(%p)\n", This);
239 return E_NOTIMPL;
242 static HRESULT WINAPI InstallEngine_Resume(IInstallEngine2 *iface)
244 InstallEngine *This = impl_from_IInstallEngine2(iface);
245 FIXME("(%p)\n", This);
246 return E_NOTIMPL;
249 static HRESULT WINAPI InstallEngine2_SetLocalCif(IInstallEngine2 *iface, const char *cif)
251 InstallEngine *This = impl_from_IInstallEngine2(iface);
252 FIXME("(%p)->(%s)\n", This, debugstr_a(cif));
253 return E_NOTIMPL;
256 static HRESULT WINAPI InstallEngine2_GetICifFile(IInstallEngine2 *iface, ICifFile **cif_file)
258 InstallEngine *This = impl_from_IInstallEngine2(iface);
259 FIXME("(%p)->(%p)\n", This, cif_file);
260 return E_NOTIMPL;
263 static const IInstallEngine2Vtbl InstallEngine2Vtbl = {
264 InstallEngine_QueryInterface,
265 InstallEngine_AddRef,
266 InstallEngine_Release,
267 InstallEngine_GetEngineStatus,
268 InstallEngine_SetCifFile,
269 InstallEngine_DownloadComponents,
270 InstallEngine_InstallComponents,
271 InstallEngine_EnumInstallIDs,
272 InstallEngine_EnumDownloadIDs,
273 InstallEngine_IsComponentInstalled,
274 InstallEngine_RegisterInstallEngineCallback,
275 InstallEngine_UnregisterInstallEngineCallback,
276 InstallEngine_SetAction,
277 InstallEngine_GetSizes,
278 InstallEngine_LaunchExtraCommand,
279 InstallEngine_GetDisplayName,
280 InstallEngine_SetBaseUrl,
281 InstallEngine_SetDownloadDir,
282 InstallEngine_SetInstallDrive,
283 InstallEngine_SetInstallOptions,
284 InstallEngine_SetHWND,
285 InstallEngine_SetIStream,
286 InstallEngine_Abort,
287 InstallEngine_Suspend,
288 InstallEngine_Resume,
289 InstallEngine2_SetLocalCif,
290 InstallEngine2_GetICifFile
293 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
295 *ppv = NULL;
297 if(IsEqualGUID(&IID_IUnknown, riid)) {
298 TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
299 *ppv = iface;
300 }else if(IsEqualGUID(&IID_IClassFactory, riid)) {
301 TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
302 *ppv = iface;
305 if(*ppv) {
306 IUnknown_AddRef((IUnknown*)*ppv);
307 return S_OK;
310 FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
311 return E_NOINTERFACE;
314 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
316 return 2;
319 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
321 return 1;
324 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
326 return S_OK;
329 static HRESULT WINAPI InstallEngineCF_CreateInstance(IClassFactory *iface, IUnknown *outer,
330 REFIID riid, void **ppv)
332 InstallEngine *engine;
333 HRESULT hres;
335 TRACE("(%p %s %p)\n", outer, debugstr_guid(riid), ppv);
337 engine = heap_alloc(sizeof(*engine));
338 if(!engine)
339 return E_OUTOFMEMORY;
341 engine->IInstallEngine2_iface.lpVtbl = &InstallEngine2Vtbl;
342 engine->ref = 1;
344 hres = IInstallEngine2_QueryInterface(&engine->IInstallEngine2_iface, riid, ppv);
345 IInstallEngine2_Release(&engine->IInstallEngine2_iface);
346 return hres;
349 static const IClassFactoryVtbl InstallEngineCFVtbl = {
350 ClassFactory_QueryInterface,
351 ClassFactory_AddRef,
352 ClassFactory_Release,
353 InstallEngineCF_CreateInstance,
354 ClassFactory_LockServer
357 static IClassFactory InstallEngineCF = { &InstallEngineCFVtbl };
359 /***********************************************************************
360 * DllGetClassObject (INSENG.@)
362 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
364 if(IsEqualGUID(rclsid, &CLSID_InstallEngine)) {
365 TRACE("(CLSID_InstallEngine %s %p)\n", debugstr_guid(iid), ppv);
366 return IClassFactory_QueryInterface(&InstallEngineCF, iid, ppv);
369 FIXME("(%s %s %p)\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
370 return CLASS_E_CLASSNOTAVAILABLE;
373 BOOL WINAPI CheckTrustEx( LPVOID a, LPVOID b, LPVOID c, LPVOID d, LPVOID e )
375 FIXME("%p %p %p %p %p\n", a, b, c, d, e );
376 return TRUE;
379 /***********************************************************************
380 * DllInstall (INSENG.@)
382 HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline)
384 FIXME("(%s, %s): stub\n", bInstall ? "TRUE" : "FALSE", debugstr_w(cmdline));
385 return S_OK;