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
34 #include "wine/debug.h"
35 #include "wine/heap.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(inseng
);
39 static HINSTANCE instance
;
41 struct InstallEngine
{
42 IInstallEngine2 IInstallEngine2_iface
;
46 static inline InstallEngine
*impl_from_IInstallEngine2(IInstallEngine2
*iface
)
48 return CONTAINING_RECORD(iface
, InstallEngine
, IInstallEngine2_iface
);
51 static HRESULT WINAPI
InstallEngine_QueryInterface(IInstallEngine2
*iface
, REFIID riid
, void **ppv
)
53 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
55 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
56 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
57 *ppv
= &This
->IInstallEngine2_iface
;
58 }else if(IsEqualGUID(&IID_IInstallEngine
, riid
)) {
59 TRACE("(%p)->(IID_IInstallEngine %p)\n", This
, ppv
);
60 *ppv
= &This
->IInstallEngine2_iface
;
61 }else if(IsEqualGUID(&IID_IInstallEngine2
, riid
)) {
62 TRACE("(%p)->(IID_IInstallEngine2 %p)\n", This
, ppv
);
63 *ppv
= &This
->IInstallEngine2_iface
;
65 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
70 IUnknown_AddRef((IUnknown
*)*ppv
);
74 static ULONG WINAPI
InstallEngine_AddRef(IInstallEngine2
*iface
)
76 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
77 LONG ref
= InterlockedIncrement(&This
->ref
);
79 TRACE("(%p) ref=%d\n", This
, ref
);
84 static ULONG WINAPI
InstallEngine_Release(IInstallEngine2
*iface
)
86 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
87 LONG ref
= InterlockedDecrement(&This
->ref
);
89 TRACE("(%p) ref=%d\n", This
, ref
);
97 static HRESULT WINAPI
InstallEngine_GetEngineStatus(IInstallEngine2
*iface
, DWORD
*status
)
99 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
100 FIXME("(%p)->(%p)\n", This
, status
);
104 static HRESULT WINAPI
InstallEngine_SetCifFile(IInstallEngine2
*iface
, const char *cab_name
, const char *cif_name
)
106 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
107 FIXME("(%p)->(%s %s)\n", This
, debugstr_a(cab_name
), debugstr_a(cif_name
));
111 static HRESULT WINAPI
InstallEngine_DownloadComponents(IInstallEngine2
*iface
, DWORD flags
)
113 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
114 FIXME("(%p)->(%x)\n", This
, flags
);
118 static HRESULT WINAPI
InstallEngine_InstallComponents(IInstallEngine2
*iface
, DWORD flags
)
120 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
121 FIXME("(%p)->(%x)\n", This
, flags
);
125 static HRESULT WINAPI
InstallEngine_EnumInstallIDs(IInstallEngine2
*iface
, UINT index
, char **id
)
127 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
128 FIXME("(%p)->(%d %p)\n", This
, index
, id
);
132 static HRESULT WINAPI
InstallEngine_EnumDownloadIDs(IInstallEngine2
*iface
, UINT index
, char **id
)
134 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
135 FIXME("(%p)->(%d %p)\n", This
, index
, id
);
139 static HRESULT WINAPI
InstallEngine_IsComponentInstalled(IInstallEngine2
*iface
, const char *id
, DWORD
*status
)
141 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
142 FIXME("(%p)->(%s %p)\n", This
, debugstr_a(id
), status
);
146 static HRESULT WINAPI
InstallEngine_RegisterInstallEngineCallback(IInstallEngine2
*iface
, IInstallEngineCallback
*callback
)
148 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
149 FIXME("(%p)->(%p)\n", This
, callback
);
153 static HRESULT WINAPI
InstallEngine_UnregisterInstallEngineCallback(IInstallEngine2
*iface
)
155 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
156 FIXME("(%p)\n", This
);
160 static HRESULT WINAPI
InstallEngine_SetAction(IInstallEngine2
*iface
, const char *id
, DWORD action
, DWORD priority
)
162 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
163 FIXME("(%p)->(%s %d %d)\n", This
, debugstr_a(id
), action
, priority
);
167 static HRESULT WINAPI
InstallEngine_GetSizes(IInstallEngine2
*iface
, const char *id
, COMPONENT_SIZES
*sizes
)
169 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
170 FIXME("(%p)->(%s %p)\n", This
, debugstr_a(id
), sizes
);
174 static HRESULT WINAPI
InstallEngine_LaunchExtraCommand(IInstallEngine2
*iface
, const char *inf_name
, const char *section
)
176 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
177 FIXME("(%p)->(%s %s)\n", This
, debugstr_a(inf_name
), debugstr_a(section
));
181 static HRESULT WINAPI
InstallEngine_GetDisplayName(IInstallEngine2
*iface
, const char *id
, const char *name
)
183 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
184 FIXME("(%p)->(%s %s)\n", This
, debugstr_a(id
), debugstr_a(name
));
188 static HRESULT WINAPI
InstallEngine_SetBaseUrl(IInstallEngine2
*iface
, const char *base_name
)
190 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
191 FIXME("(%p)->(%s)\n", This
, debugstr_a(base_name
));
195 static HRESULT WINAPI
InstallEngine_SetDownloadDir(IInstallEngine2
*iface
, const char *download_dir
)
197 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
198 FIXME("(%p)->(%s)\n", This
, debugstr_a(download_dir
));
202 static HRESULT WINAPI
InstallEngine_SetInstallDrive(IInstallEngine2
*iface
, char drive
)
204 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
205 FIXME("(%p)->(%c)\n", This
, drive
);
209 static HRESULT WINAPI
InstallEngine_SetInstallOptions(IInstallEngine2
*iface
, DWORD flags
)
211 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
212 FIXME("(%p)->(%x)\n", This
, flags
);
216 static HRESULT WINAPI
InstallEngine_SetHWND(IInstallEngine2
*iface
, HWND hwnd
)
218 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
219 FIXME("(%p)->(%p)\n", This
, hwnd
);
223 static HRESULT WINAPI
InstallEngine_SetIStream(IInstallEngine2
*iface
, IStream
*stream
)
225 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
226 FIXME("(%p)->(%p)\n", This
, stream
);
230 static HRESULT WINAPI
InstallEngine_Abort(IInstallEngine2
*iface
, DWORD flags
)
232 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
233 FIXME("(%p)->(%x)\n", This
, flags
);
237 static HRESULT WINAPI
InstallEngine_Suspend(IInstallEngine2
*iface
)
239 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
240 FIXME("(%p)\n", This
);
244 static HRESULT WINAPI
InstallEngine_Resume(IInstallEngine2
*iface
)
246 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
247 FIXME("(%p)\n", This
);
251 static HRESULT WINAPI
InstallEngine2_SetLocalCif(IInstallEngine2
*iface
, const char *cif
)
253 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
254 FIXME("(%p)->(%s)\n", This
, debugstr_a(cif
));
258 static HRESULT WINAPI
InstallEngine2_GetICifFile(IInstallEngine2
*iface
, ICifFile
**cif_file
)
260 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
261 FIXME("(%p)->(%p)\n", This
, cif_file
);
265 static const IInstallEngine2Vtbl InstallEngine2Vtbl
= {
266 InstallEngine_QueryInterface
,
267 InstallEngine_AddRef
,
268 InstallEngine_Release
,
269 InstallEngine_GetEngineStatus
,
270 InstallEngine_SetCifFile
,
271 InstallEngine_DownloadComponents
,
272 InstallEngine_InstallComponents
,
273 InstallEngine_EnumInstallIDs
,
274 InstallEngine_EnumDownloadIDs
,
275 InstallEngine_IsComponentInstalled
,
276 InstallEngine_RegisterInstallEngineCallback
,
277 InstallEngine_UnregisterInstallEngineCallback
,
278 InstallEngine_SetAction
,
279 InstallEngine_GetSizes
,
280 InstallEngine_LaunchExtraCommand
,
281 InstallEngine_GetDisplayName
,
282 InstallEngine_SetBaseUrl
,
283 InstallEngine_SetDownloadDir
,
284 InstallEngine_SetInstallDrive
,
285 InstallEngine_SetInstallOptions
,
286 InstallEngine_SetHWND
,
287 InstallEngine_SetIStream
,
289 InstallEngine_Suspend
,
290 InstallEngine_Resume
,
291 InstallEngine2_SetLocalCif
,
292 InstallEngine2_GetICifFile
295 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
299 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
300 TRACE("(%p)->(IID_IUnknown %p)\n", iface
, ppv
);
302 }else if(IsEqualGUID(&IID_IClassFactory
, riid
)) {
303 TRACE("(%p)->(IID_IClassFactory %p)\n", iface
, ppv
);
308 IUnknown_AddRef((IUnknown
*)*ppv
);
312 FIXME("(%p)->(%s %p)\n", iface
, debugstr_guid(riid
), ppv
);
313 return E_NOINTERFACE
;
316 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
321 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
326 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL fLock
)
331 static HRESULT WINAPI
InstallEngineCF_CreateInstance(IClassFactory
*iface
, IUnknown
*outer
,
332 REFIID riid
, void **ppv
)
334 InstallEngine
*engine
;
337 TRACE("(%p %s %p)\n", outer
, debugstr_guid(riid
), ppv
);
339 engine
= heap_alloc(sizeof(*engine
));
341 return E_OUTOFMEMORY
;
343 engine
->IInstallEngine2_iface
.lpVtbl
= &InstallEngine2Vtbl
;
346 hres
= IInstallEngine2_QueryInterface(&engine
->IInstallEngine2_iface
, riid
, ppv
);
347 IInstallEngine2_Release(&engine
->IInstallEngine2_iface
);
351 static const IClassFactoryVtbl InstallEngineCFVtbl
= {
352 ClassFactory_QueryInterface
,
354 ClassFactory_Release
,
355 InstallEngineCF_CreateInstance
,
356 ClassFactory_LockServer
359 static IClassFactory InstallEngineCF
= { &InstallEngineCFVtbl
};
361 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpv
)
365 case DLL_PROCESS_ATTACH
:
367 DisableThreadLibraryCalls(hInstDLL
);
373 /***********************************************************************
374 * DllGetClassObject (INSENG.@)
376 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID iid
, LPVOID
*ppv
)
378 if(IsEqualGUID(rclsid
, &CLSID_InstallEngine
)) {
379 TRACE("(CLSID_InstallEngine %s %p)\n", debugstr_guid(iid
), ppv
);
380 return IClassFactory_QueryInterface(&InstallEngineCF
, iid
, ppv
);
383 FIXME("(%s %s %p)\n", debugstr_guid(rclsid
), debugstr_guid(iid
), ppv
);
384 return CLASS_E_CLASSNOTAVAILABLE
;
387 /***********************************************************************
388 * DllCanUnloadNow (INSENG.@)
390 HRESULT WINAPI
DllCanUnloadNow(void)
395 /***********************************************************************
396 * DllRegisterServer (INSENG.@)
398 HRESULT WINAPI
DllRegisterServer(void)
400 return __wine_register_resources( instance
);
403 /***********************************************************************
404 * DllUnregisterServer (INSENG.@)
406 HRESULT WINAPI
DllUnregisterServer(void)
408 return __wine_unregister_resources( instance
);
411 BOOL WINAPI
CheckTrustEx( LPVOID a
, LPVOID b
, LPVOID c
, LPVOID d
, LPVOID e
)
413 FIXME("%p %p %p %p %p\n", a
, b
, c
, d
, e
);
417 /***********************************************************************
418 * DllInstall (INSENG.@)
420 HRESULT WINAPI
DllInstall(BOOL bInstall
, LPCWSTR cmdline
)
422 FIXME("(%s, %s): stub\n", bInstall
? "TRUE" : "FALSE", debugstr_w(cmdline
));