wined3d: Update UAV read bitmask for ld_raw and ld_structured instructions.
[wine.git] / dlls / inseng / inseng_main.c
blobc95d2c73216bc387e45f37d1546f1b9bcd935ece
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
23 #include "config.h"
25 #include <stdarg.h>
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winuser.h"
30 #include "ole2.h"
31 #include "rpcproxy.h"
32 #include "initguid.h"
33 #include "inseng.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(inseng);
39 static inline void* __WINE_ALLOC_SIZE(1) heap_alloc(size_t size)
41 return HeapAlloc(GetProcessHeap(), 0, size);
44 static inline BOOL heap_free(void *mem)
46 return HeapFree(GetProcessHeap(), 0, mem);
49 static HINSTANCE instance;
51 struct InstallEngine {
52 IInstallEngine2 IInstallEngine2_iface;
53 LONG ref;
56 static inline InstallEngine *impl_from_IInstallEngine2(IInstallEngine2 *iface)
58 return CONTAINING_RECORD(iface, InstallEngine, IInstallEngine2_iface);
61 static HRESULT WINAPI InstallEngine_QueryInterface(IInstallEngine2 *iface, REFIID riid, void **ppv)
63 InstallEngine *This = impl_from_IInstallEngine2(iface);
65 if(IsEqualGUID(&IID_IUnknown, riid)) {
66 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
67 *ppv = &This->IInstallEngine2_iface;
68 }else if(IsEqualGUID(&IID_IInstallEngine, riid)) {
69 TRACE("(%p)->(IID_IInstallEngine %p)\n", This, ppv);
70 *ppv = &This->IInstallEngine2_iface;
71 }else if(IsEqualGUID(&IID_IInstallEngine2, riid)) {
72 TRACE("(%p)->(IID_IInstallEngine2 %p)\n", This, ppv);
73 *ppv = &This->IInstallEngine2_iface;
74 }else {
75 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
76 *ppv = NULL;
77 return E_NOINTERFACE;
80 IUnknown_AddRef((IUnknown*)*ppv);
81 return S_OK;
84 static ULONG WINAPI InstallEngine_AddRef(IInstallEngine2 *iface)
86 InstallEngine *This = impl_from_IInstallEngine2(iface);
87 LONG ref = InterlockedIncrement(&This->ref);
89 TRACE("(%p) ref=%d\n", This, ref);
91 return ref;
94 static ULONG WINAPI InstallEngine_Release(IInstallEngine2 *iface)
96 InstallEngine *This = impl_from_IInstallEngine2(iface);
97 LONG ref = InterlockedDecrement(&This->ref);
99 TRACE("(%p) ref=%d\n", This, ref);
101 if(!ref)
102 heap_free(This);
104 return ref;
107 static HRESULT WINAPI InstallEngine_GetEngineStatus(IInstallEngine2 *iface, DWORD *status)
109 InstallEngine *This = impl_from_IInstallEngine2(iface);
110 FIXME("(%p)->(%p)\n", This, status);
111 return E_NOTIMPL;
114 static HRESULT WINAPI InstallEngine_SetCifFile(IInstallEngine2 *iface, const char *cab_name, const char *cif_name)
116 InstallEngine *This = impl_from_IInstallEngine2(iface);
117 FIXME("(%p)->(%s %s)\n", This, debugstr_a(cab_name), debugstr_a(cif_name));
118 return E_NOTIMPL;
121 static HRESULT WINAPI InstallEngine_DownloadComponents(IInstallEngine2 *iface, DWORD flags)
123 InstallEngine *This = impl_from_IInstallEngine2(iface);
124 FIXME("(%p)->(%x)\n", This, flags);
125 return E_NOTIMPL;
128 static HRESULT WINAPI InstallEngine_InstallComponents(IInstallEngine2 *iface, DWORD flags)
130 InstallEngine *This = impl_from_IInstallEngine2(iface);
131 FIXME("(%p)->(%x)\n", This, flags);
132 return E_NOTIMPL;
135 static HRESULT WINAPI InstallEngine_EnumInstallIDs(IInstallEngine2 *iface, UINT index, char **id)
137 InstallEngine *This = impl_from_IInstallEngine2(iface);
138 FIXME("(%p)->(%d %p)\n", This, index, id);
139 return E_NOTIMPL;
142 static HRESULT WINAPI InstallEngine_EnumDownloadIDs(IInstallEngine2 *iface, UINT index, char **id)
144 InstallEngine *This = impl_from_IInstallEngine2(iface);
145 FIXME("(%p)->(%d %p)\n", This, index, id);
146 return E_NOTIMPL;
149 static HRESULT WINAPI InstallEngine_IsComponentInstalled(IInstallEngine2 *iface, const char *id, DWORD *status)
151 InstallEngine *This = impl_from_IInstallEngine2(iface);
152 FIXME("(%p)->(%s %p)\n", This, debugstr_a(id), status);
153 return E_NOTIMPL;
156 static HRESULT WINAPI InstallEngine_RegisterInstallEngineCallback(IInstallEngine2 *iface, IInstallEngineCallback *callback)
158 InstallEngine *This = impl_from_IInstallEngine2(iface);
159 FIXME("(%p)->(%p)\n", This, callback);
160 return E_NOTIMPL;
163 static HRESULT WINAPI InstallEngine_UnregisterInstallEngineCallback(IInstallEngine2 *iface)
165 InstallEngine *This = impl_from_IInstallEngine2(iface);
166 FIXME("(%p)\n", This);
167 return E_NOTIMPL;
170 static HRESULT WINAPI InstallEngine_SetAction(IInstallEngine2 *iface, const char *id, DWORD action, DWORD priority)
172 InstallEngine *This = impl_from_IInstallEngine2(iface);
173 FIXME("(%p)->(%s %d %d)\n", This, debugstr_a(id), action, priority);
174 return E_NOTIMPL;
177 static HRESULT WINAPI InstallEngine_GetSizes(IInstallEngine2 *iface, const char *id, COMPONENT_SIZES *sizes)
179 InstallEngine *This = impl_from_IInstallEngine2(iface);
180 FIXME("(%p)->(%s %p)\n", This, debugstr_a(id), sizes);
181 return E_NOTIMPL;
184 static HRESULT WINAPI InstallEngine_LaunchExtraCommand(IInstallEngine2 *iface, const char *inf_name, const char *section)
186 InstallEngine *This = impl_from_IInstallEngine2(iface);
187 FIXME("(%p)->(%s %s)\n", This, debugstr_a(inf_name), debugstr_a(section));
188 return E_NOTIMPL;
191 static HRESULT WINAPI InstallEngine_GetDisplayName(IInstallEngine2 *iface, const char *id, const char *name)
193 InstallEngine *This = impl_from_IInstallEngine2(iface);
194 FIXME("(%p)->(%s %s)\n", This, debugstr_a(id), debugstr_a(name));
195 return E_NOTIMPL;
198 static HRESULT WINAPI InstallEngine_SetBaseUrl(IInstallEngine2 *iface, const char *base_name)
200 InstallEngine *This = impl_from_IInstallEngine2(iface);
201 FIXME("(%p)->(%s)\n", This, debugstr_a(base_name));
202 return E_NOTIMPL;
205 static HRESULT WINAPI InstallEngine_SetDownloadDir(IInstallEngine2 *iface, const char *download_dir)
207 InstallEngine *This = impl_from_IInstallEngine2(iface);
208 FIXME("(%p)->(%s)\n", This, debugstr_a(download_dir));
209 return E_NOTIMPL;
212 static HRESULT WINAPI InstallEngine_SetInstallDrive(IInstallEngine2 *iface, char drive)
214 InstallEngine *This = impl_from_IInstallEngine2(iface);
215 FIXME("(%p)->(%c)\n", This, drive);
216 return E_NOTIMPL;
219 static HRESULT WINAPI InstallEngine_SetInstallOptions(IInstallEngine2 *iface, DWORD flags)
221 InstallEngine *This = impl_from_IInstallEngine2(iface);
222 FIXME("(%p)->(%x)\n", This, flags);
223 return E_NOTIMPL;
226 static HRESULT WINAPI InstallEngine_SetHWND(IInstallEngine2 *iface, HWND hwnd)
228 InstallEngine *This = impl_from_IInstallEngine2(iface);
229 FIXME("(%p)->(%p)\n", This, hwnd);
230 return E_NOTIMPL;
233 static HRESULT WINAPI InstallEngine_SetIStream(IInstallEngine2 *iface, IStream *stream)
235 InstallEngine *This = impl_from_IInstallEngine2(iface);
236 FIXME("(%p)->(%p)\n", This, stream);
237 return E_NOTIMPL;
240 static HRESULT WINAPI InstallEngine_Abort(IInstallEngine2 *iface, DWORD flags)
242 InstallEngine *This = impl_from_IInstallEngine2(iface);
243 FIXME("(%p)->(%x)\n", This, flags);
244 return E_NOTIMPL;
247 static HRESULT WINAPI InstallEngine_Suspend(IInstallEngine2 *iface)
249 InstallEngine *This = impl_from_IInstallEngine2(iface);
250 FIXME("(%p)\n", This);
251 return E_NOTIMPL;
254 static HRESULT WINAPI InstallEngine_Resume(IInstallEngine2 *iface)
256 InstallEngine *This = impl_from_IInstallEngine2(iface);
257 FIXME("(%p)\n", This);
258 return E_NOTIMPL;
261 static HRESULT WINAPI InstallEngine2_SetLocalCif(IInstallEngine2 *iface, const char *cif)
263 InstallEngine *This = impl_from_IInstallEngine2(iface);
264 FIXME("(%p)->(%s)\n", This, debugstr_a(cif));
265 return E_NOTIMPL;
268 static HRESULT WINAPI InstallEngine2_GetICifFile(IInstallEngine2 *iface, ICifFile **cif_file)
270 InstallEngine *This = impl_from_IInstallEngine2(iface);
271 FIXME("(%p)->(%p)\n", This, cif_file);
272 return E_NOTIMPL;
275 static const IInstallEngine2Vtbl InstallEngine2Vtbl = {
276 InstallEngine_QueryInterface,
277 InstallEngine_AddRef,
278 InstallEngine_Release,
279 InstallEngine_GetEngineStatus,
280 InstallEngine_SetCifFile,
281 InstallEngine_DownloadComponents,
282 InstallEngine_InstallComponents,
283 InstallEngine_EnumInstallIDs,
284 InstallEngine_EnumDownloadIDs,
285 InstallEngine_IsComponentInstalled,
286 InstallEngine_RegisterInstallEngineCallback,
287 InstallEngine_UnregisterInstallEngineCallback,
288 InstallEngine_SetAction,
289 InstallEngine_GetSizes,
290 InstallEngine_LaunchExtraCommand,
291 InstallEngine_GetDisplayName,
292 InstallEngine_SetBaseUrl,
293 InstallEngine_SetDownloadDir,
294 InstallEngine_SetInstallDrive,
295 InstallEngine_SetInstallOptions,
296 InstallEngine_SetHWND,
297 InstallEngine_SetIStream,
298 InstallEngine_Abort,
299 InstallEngine_Suspend,
300 InstallEngine_Resume,
301 InstallEngine2_SetLocalCif,
302 InstallEngine2_GetICifFile
305 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
307 *ppv = NULL;
309 if(IsEqualGUID(&IID_IUnknown, riid)) {
310 TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
311 *ppv = iface;
312 }else if(IsEqualGUID(&IID_IClassFactory, riid)) {
313 TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
314 *ppv = iface;
317 if(*ppv) {
318 IUnknown_AddRef((IUnknown*)*ppv);
319 return S_OK;
322 FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
323 return E_NOINTERFACE;
326 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
328 return 2;
331 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
333 return 1;
336 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
338 return S_OK;
341 static HRESULT WINAPI InstallEngineCF_CreateInstance(IClassFactory *iface, IUnknown *outer,
342 REFIID riid, void **ppv)
344 InstallEngine *engine;
345 HRESULT hres;
347 TRACE("(%p %s %p)\n", outer, debugstr_guid(riid), ppv);
349 engine = heap_alloc(sizeof(*engine));
350 if(!engine)
351 return E_OUTOFMEMORY;
353 engine->IInstallEngine2_iface.lpVtbl = &InstallEngine2Vtbl;
354 engine->ref = 1;
356 hres = IInstallEngine2_QueryInterface(&engine->IInstallEngine2_iface, riid, ppv);
357 IInstallEngine2_Release(&engine->IInstallEngine2_iface);
358 return hres;
361 static const IClassFactoryVtbl InstallEngineCFVtbl = {
362 ClassFactory_QueryInterface,
363 ClassFactory_AddRef,
364 ClassFactory_Release,
365 InstallEngineCF_CreateInstance,
366 ClassFactory_LockServer
369 static IClassFactory InstallEngineCF = { &InstallEngineCFVtbl };
371 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
373 switch(fdwReason)
375 case DLL_WINE_PREATTACH:
376 return FALSE; /* prefer native version */
377 case DLL_PROCESS_ATTACH:
378 instance = hInstDLL;
379 DisableThreadLibraryCalls(hInstDLL);
380 break;
382 return TRUE;
385 /***********************************************************************
386 * DllGetClassObject (INSENG.@)
388 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
390 if(IsEqualGUID(rclsid, &CLSID_InstallEngine)) {
391 TRACE("(CLSID_InstallEngine %s %p)\n", debugstr_guid(iid), ppv);
392 return IClassFactory_QueryInterface(&InstallEngineCF, iid, ppv);
395 FIXME("(%s %s %p)\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
396 return CLASS_E_CLASSNOTAVAILABLE;
399 /***********************************************************************
400 * DllCanUnloadNow (INSENG.@)
402 HRESULT WINAPI DllCanUnloadNow(void)
404 return S_FALSE;
407 /***********************************************************************
408 * DllRegisterServer (INSENG.@)
410 HRESULT WINAPI DllRegisterServer(void)
412 return __wine_register_resources( instance );
415 /***********************************************************************
416 * DllUnregisterServer (INSENG.@)
418 HRESULT WINAPI DllUnregisterServer(void)
420 return __wine_unregister_resources( instance );
423 BOOL WINAPI CheckTrustEx( LPVOID a, LPVOID b, LPVOID c, LPVOID d, LPVOID e )
425 FIXME("%p %p %p %p %p\n", a, b, c, d, e );
426 return TRUE;
429 /***********************************************************************
430 * DllInstall (INSENG.@)
432 HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline)
434 FIXME("(%s, %s): stub\n", bInstall ? "TRUE" : "FALSE", debugstr_w(cmdline));
435 return S_OK;