static HRESULT WINAPI InstallEngine_QueryInterface(IInstallEngine2 *iface, REFIID riid, void **ppv) { InstallEngine *This = impl_from_IInstallEngine2(iface); if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); *ppv = &This->IInstallEngine2_iface; }else if(IsEqualGUID(&IID_IInstallEngine, riid)) { TRACE("(%p)->(IID_IInstallEngine %p)\n", This, ppv); *ppv = &This->IInstallEngine2_iface; }else if(IsEqualGUID(&IID_IInstallEngine2, riid)) { TRACE("(%p)->(IID_IInstallEngine2 %p)\n", This, ppv); *ppv = &This->IInstallEngine2_iface; }else if(IsEqualGUID(&IID_IInstallEngineTiming, riid)) { TRACE("(%p)->(IID_IInstallEngineTiming %p)\n", This, ppv); *ppv = &This->IInstallEngineTiming_iface; }else { FIXME("(%p)->(%s %p) not found\n", This, debugstr_guid(riid), ppv); *ppv = NULL; return E_NOINTERFACE; } IUnknown_AddRef((IUnknown *)*ppv); return S_OK; }
static HRESULT WINAPI InstallEngine_InstallComponents(IInstallEngine2 *iface, DWORD flags) { InstallEngine *This = impl_from_IInstallEngine2(iface); FIXME("(%p)->(%x): stub\n", This, flags); return E_NOTIMPL; }
static HRESULT WINAPI InstallEngine_SetHWND(IInstallEngine2 *iface, HWND hwnd) { InstallEngine *This = impl_from_IInstallEngine2(iface); FIXME("(%p)->(%p): stub\n", This, hwnd); return E_NOTIMPL; }
static HRESULT WINAPI InstallEngine_SetInstallDrive(IInstallEngine2 *iface, char drive) { InstallEngine *This = impl_from_IInstallEngine2(iface); FIXME("(%p)->(%c): stub\n", This, drive); return E_NOTIMPL; }
static HRESULT WINAPI InstallEngine_GetSizes(IInstallEngine2 *iface, const char *id, COMPONENT_SIZES *sizes) { InstallEngine *This = impl_from_IInstallEngine2(iface); FIXME("(%p)->(%s %p): stub\n", This, debugstr_a(id), sizes); return E_NOTIMPL; }
static HRESULT WINAPI InstallEngine_LaunchExtraCommand(IInstallEngine2 *iface, const char *inf_name, const char *section) { InstallEngine *This = impl_from_IInstallEngine2(iface); FIXME("(%p)->(%s %s): stub\n", This, debugstr_a(inf_name), debugstr_a(section)); return E_NOTIMPL; }
static HRESULT WINAPI InstallEngine_GetDisplayName(IInstallEngine2 *iface, const char *id, const char *name) { InstallEngine *This = impl_from_IInstallEngine2(iface); FIXME("(%p)->(%s %s): stub\n", This, debugstr_a(id), debugstr_a(name)); return E_NOTIMPL; }
static HRESULT WINAPI InstallEngine_Resume(IInstallEngine2 *iface) { InstallEngine *This = impl_from_IInstallEngine2(iface); FIXME("(%p): stub\n", This); return E_NOTIMPL; }
static HRESULT WINAPI InstallEngine_SetIStream(IInstallEngine2 *iface, IStream *stream) { InstallEngine *This = impl_from_IInstallEngine2(iface); FIXME("(%p)->(%p): stub\n", This, stream); return E_NOTIMPL; }
static HRESULT WINAPI InstallEngine_SetCifFile(IInstallEngine2 *iface, const char *cab_name, const char *cif_name) { InstallEngine *This = impl_from_IInstallEngine2(iface); FIXME("(%p)->(%s %s): stub\n", This, debugstr_a(cab_name), debugstr_a(cif_name)); return E_NOTIMPL; }
static HRESULT WINAPI InstallEngine_EnumInstallIDs(IInstallEngine2 *iface, UINT index, char **id) { InstallEngine *This = impl_from_IInstallEngine2(iface); FIXME("(%p)->(%u %p): stub\n", This, index, id); return E_NOTIMPL; }
static HRESULT WINAPI InstallEngine_IsComponentInstalled(IInstallEngine2 *iface, const char *id, DWORD *status) { InstallEngine *This = impl_from_IInstallEngine2(iface); FIXME("(%p)->(%s %p): stub\n", This, debugstr_a(id), status); return E_NOTIMPL; }
static ULONG WINAPI InstallEngine_AddRef(IInstallEngine2 *iface) { InstallEngine *This = impl_from_IInstallEngine2(iface); LONG ref = InterlockedIncrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); return ref; }
static HRESULT WINAPI InstallEngine_RegisterInstallEngineCallback(IInstallEngine2 *iface, IInstallEngineCallback *callback) { InstallEngine *This = impl_from_IInstallEngine2(iface); TRACE("(%p)->(%p)\n", This, callback); This->callback = callback; return S_OK; }
static HRESULT WINAPI InstallEngine_UnregisterInstallEngineCallback(IInstallEngine2 *iface) { InstallEngine *This = impl_from_IInstallEngine2(iface); TRACE("(%p)\n", This); This->callback = NULL; return S_OK; }
static HRESULT WINAPI InstallEngine_GetEngineStatus(IInstallEngine2 *iface, DWORD *status) { InstallEngine *This = impl_from_IInstallEngine2(iface); TRACE("(%p)->(%p)\n", This, status); if (!status) return E_FAIL; *status = This->status; return S_OK; }
static ULONG WINAPI InstallEngine_Release(IInstallEngine2 *iface) { InstallEngine *This = impl_from_IInstallEngine2(iface); LONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); if(!ref) heap_free(This); return ref; }
static HRESULT WINAPI InstallEngine_SetDownloadDir(IInstallEngine2 *iface, const char *download_dir) { InstallEngine *This = impl_from_IInstallEngine2(iface); TRACE("(%p)->(%s)\n", This, debugstr_a(download_dir)); if (This->downloaddir) heap_free(This->downloaddir); This->downloaddir = strdupA(download_dir); return This->downloaddir ? S_OK : E_OUTOFMEMORY; }
static HRESULT WINAPI InstallEngine_SetBaseUrl(IInstallEngine2 *iface, const char *base_name) { InstallEngine *This = impl_from_IInstallEngine2(iface); TRACE("(%p)->(%s)\n", This, debugstr_a(base_name)); if (This->baseurl) heap_free(This->baseurl); This->baseurl = strdupA(base_name); return This->baseurl ? S_OK : E_OUTOFMEMORY; }
static HRESULT WINAPI InstallEngine2_GetICifFile(IInstallEngine2 *iface, ICifFile **cif_file) { InstallEngine *This = impl_from_IInstallEngine2(iface); TRACE("(%p)->(%p)\n", This, cif_file); if (!This->icif || !cif_file) return E_FAIL; ICifFile_AddRef(This->icif); *cif_file = This->icif; return S_OK; }
static HRESULT WINAPI InstallEngine_DownloadComponents(IInstallEngine2 *iface, DWORD flags) { InstallEngine *This = impl_from_IInstallEngine2(iface); TRACE("(%p)->(%x)\n", This, flags); /* The interface is not really threadsafe on windows, but we can at least prevent multiple installations */ if (InterlockedCompareExchange((LONG *)&This->status, ENGINESTATUS_INSTALLING, ENGINESTATUS_READY) != ENGINESTATUS_READY) return E_FAIL; if (This->callback) IInstallEngineCallback_OnEngineStatusChange(This->callback, ENGINESTATUS_INSTALLING, 0); return start_installation(This, OP_DOWNLOAD, flags); }
static HRESULT WINAPI InstallEngine_EnumDownloadIDs(IInstallEngine2 *iface, UINT index, char **id) { InstallEngine *This = impl_from_IInstallEngine2(iface); IEnumCifComponents *enum_components; ICifComponent *comp; HRESULT hr; TRACE("(%p)->(%u %p)\n", This, index, id); if (!This->icif || !id) return E_FAIL; hr = ICifFile_EnumComponents(This->icif, &enum_components, 0, NULL); if (FAILED(hr)) return hr; for (;;) { hr = IEnumCifComponents_Next(enum_components, &comp); if (FAILED(hr)) goto done; if (ICifComponent_GetInstallQueueState(comp) != ActionInstall) continue; if (ICifComponent_IsComponentDownloaded(comp) != S_FALSE) continue; if (index == 0) { char *id_src = component_get_id(comp); *id = CoTaskMemAlloc(strlen(id_src) + 1); if (*id) strcpy(*id, id_src); else hr = E_OUTOFMEMORY; goto done; } index--; } done: IEnumCifComponents_Release(enum_components); return hr; }
static ULONG WINAPI InstallEngine_Release(IInstallEngine2 *iface) { InstallEngine *This = impl_from_IInstallEngine2(iface); LONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); if (!ref) { if (This->icif) ICifFile_Release(This->icif); heap_free(This->baseurl); heap_free(This->downloaddir); heap_free(This); } return ref; }
static HRESULT WINAPI InstallEngine_SetAction(IInstallEngine2 *iface, const char *id, DWORD action, DWORD priority) { InstallEngine *This = impl_from_IInstallEngine2(iface); ICifComponent *comp; HRESULT hr; TRACE("(%p)->(%s %u %u)\n", This, debugstr_a(id), action, priority); if (!This->icif) return E_FAIL; /* FIXME: check error code */ hr = ICifFile_FindComponent(This->icif, id, &comp); if (FAILED(hr)) return hr; hr = ICifComponent_SetInstallQueueState(comp, action); if (FAILED(hr)) return hr; hr = ICifComponent_SetCurrentPriority(comp, priority); return hr; }
static HRESULT WINAPI InstallEngine2_SetLocalCif(IInstallEngine2 *iface, const char *cif) { InstallEngine *This = impl_from_IInstallEngine2(iface); HRESULT hr; TRACE("(%p)->(%s)\n", This, debugstr_a(cif)); if (This->icif) ICifFile_Release(This->icif); set_status(This, ENGINESTATUS_LOADING); hr = GetICifFileFromFile(&This->icif, cif); if (SUCCEEDED(hr)) set_status(This, ENGINESTATUS_READY); else { This->icif = NULL; set_status(This, ENGINESTATUS_NOTREADY); } return hr; }
static HRESULT WINAPI InstallEngine_SetDownloadDir(IInstallEngine2 *iface, const char *download_dir) { InstallEngine *This = impl_from_IInstallEngine2(iface); FIXME("(%p)->(%s)\n", This, debugstr_a(download_dir)); return E_NOTIMPL; }
static HRESULT WINAPI InstallEngine_Suspend(IInstallEngine2 *iface) { InstallEngine *This = impl_from_IInstallEngine2(iface); FIXME("(%p)\n", This); return E_NOTIMPL; }
static HRESULT WINAPI InstallEngine2_SetLocalCif(IInstallEngine2 *iface, const char *cif) { InstallEngine *This = impl_from_IInstallEngine2(iface); FIXME("(%p)->(%s)\n", This, debugstr_a(cif)); return E_NOTIMPL; }
static HRESULT WINAPI InstallEngine2_GetICifFile(IInstallEngine2 *iface, ICifFile **cif_file) { InstallEngine *This = impl_from_IInstallEngine2(iface); FIXME("(%p)->(%p)\n", This, cif_file); return E_NOTIMPL; }
static HRESULT WINAPI InstallEngine_Abort(IInstallEngine2 *iface, DWORD flags) { InstallEngine *This = impl_from_IInstallEngine2(iface); FIXME("(%p)->(%x)\n", This, flags); return E_NOTIMPL; }