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 struct InstallEngine
{
40 IInstallEngine2 IInstallEngine2_iface
;
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
;
63 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
68 IUnknown_AddRef((IUnknown
*)*ppv
);
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=%ld\n", This
, 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=%ld\n", This
, 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
);
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
));
109 static HRESULT WINAPI
InstallEngine_DownloadComponents(IInstallEngine2
*iface
, DWORD flags
)
111 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
112 FIXME("(%p)->(%lx)\n", This
, flags
);
116 static HRESULT WINAPI
InstallEngine_InstallComponents(IInstallEngine2
*iface
, DWORD flags
)
118 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
119 FIXME("(%p)->(%lx)\n", This
, flags
);
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
);
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
);
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
);
144 static HRESULT WINAPI
InstallEngine_RegisterInstallEngineCallback(IInstallEngine2
*iface
, IInstallEngineCallback
*callback
)
146 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
147 FIXME("(%p)->(%p)\n", This
, callback
);
151 static HRESULT WINAPI
InstallEngine_UnregisterInstallEngineCallback(IInstallEngine2
*iface
)
153 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
154 FIXME("(%p)\n", This
);
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 %ld %ld)\n", This
, debugstr_a(id
), action
, priority
);
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
);
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
));
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
));
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
));
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
));
200 static HRESULT WINAPI
InstallEngine_SetInstallDrive(IInstallEngine2
*iface
, char drive
)
202 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
203 FIXME("(%p)->(%c)\n", This
, drive
);
207 static HRESULT WINAPI
InstallEngine_SetInstallOptions(IInstallEngine2
*iface
, DWORD flags
)
209 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
210 FIXME("(%p)->(%lx)\n", This
, flags
);
214 static HRESULT WINAPI
InstallEngine_SetHWND(IInstallEngine2
*iface
, HWND hwnd
)
216 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
217 FIXME("(%p)->(%p)\n", This
, hwnd
);
221 static HRESULT WINAPI
InstallEngine_SetIStream(IInstallEngine2
*iface
, IStream
*stream
)
223 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
224 FIXME("(%p)->(%p)\n", This
, stream
);
228 static HRESULT WINAPI
InstallEngine_Abort(IInstallEngine2
*iface
, DWORD flags
)
230 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
231 FIXME("(%p)->(%lx)\n", This
, flags
);
235 static HRESULT WINAPI
InstallEngine_Suspend(IInstallEngine2
*iface
)
237 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
238 FIXME("(%p)\n", This
);
242 static HRESULT WINAPI
InstallEngine_Resume(IInstallEngine2
*iface
)
244 InstallEngine
*This
= impl_from_IInstallEngine2(iface
);
245 FIXME("(%p)\n", This
);
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
));
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
);
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
,
287 InstallEngine_Suspend
,
288 InstallEngine_Resume
,
289 InstallEngine2_SetLocalCif
,
290 InstallEngine2_GetICifFile
293 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
297 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
298 TRACE("(%p)->(IID_IUnknown %p)\n", iface
, ppv
);
300 }else if(IsEqualGUID(&IID_IClassFactory
, riid
)) {
301 TRACE("(%p)->(IID_IClassFactory %p)\n", iface
, ppv
);
306 IUnknown_AddRef((IUnknown
*)*ppv
);
310 FIXME("(%p)->(%s %p)\n", iface
, debugstr_guid(riid
), ppv
);
311 return E_NOINTERFACE
;
314 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
319 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
324 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL fLock
)
329 static HRESULT WINAPI
InstallEngineCF_CreateInstance(IClassFactory
*iface
, IUnknown
*outer
,
330 REFIID riid
, void **ppv
)
332 InstallEngine
*engine
;
335 TRACE("(%p %s %p)\n", outer
, debugstr_guid(riid
), ppv
);
337 engine
= heap_alloc(sizeof(*engine
));
339 return E_OUTOFMEMORY
;
341 engine
->IInstallEngine2_iface
.lpVtbl
= &InstallEngine2Vtbl
;
344 hres
= IInstallEngine2_QueryInterface(&engine
->IInstallEngine2_iface
, riid
, ppv
);
345 IInstallEngine2_Release(&engine
->IInstallEngine2_iface
);
349 static const IClassFactoryVtbl InstallEngineCFVtbl
= {
350 ClassFactory_QueryInterface
,
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
);
379 /***********************************************************************
380 * DllInstall (INSENG.@)
382 HRESULT WINAPI
DllInstall(BOOL bInstall
, LPCWSTR cmdline
)
384 FIXME("(%s, %s): stub\n", bInstall
? "TRUE" : "FALSE", debugstr_w(cmdline
));