static DWORD WINAPI download_proc(PVOID arg) { WCHAR tmp_dir[MAX_PATH], tmp_file[MAX_PATH]; HRESULT hres; GetTempPathW(sizeof(tmp_dir)/sizeof(WCHAR), tmp_dir); GetTempFileNameW(tmp_dir, NULL, 0, tmp_file); TRACE("using temp file %s\n", debugstr_w(tmp_file)); hres = URLDownloadToFileW(NULL, GeckoUrl, tmp_file, 0, &InstallCallback); if(FAILED(hres)) { ERR("URLDownloadToFile failed: %08x\n", hres); return 0; } if(sha_check(tmp_file)) { install_file(tmp_file); }else { WCHAR message[256]; if(LoadStringW(hApplet, IDS_INVALID_SHA, message, sizeof(message)/sizeof(WCHAR))) { MessageBoxW(NULL, message, NULL, MB_ICONERROR); } } DeleteFileW(tmp_file); EndDialog(install_dialog, 0); return 0; }
static HRESULT WINAPI InstallCallback_OnStopBinding(IBindStatusCallback *iface, HRESULT hresult, LPCWSTR szError) { if(dwl_binding) { IBinding_Release(dwl_binding); dwl_binding = NULL; } if(FAILED(hresult)) { if(hresult == E_ABORT) TRACE("Binding aborted\n"); else ERR("Binding failed %08x\n", hresult); return S_OK; } if(!msi_file) { ERR("No MSI file\n"); return E_FAIL; } set_status(IDS_INSTALLING); EnableWindow(GetDlgItem(install_dialog, IDCANCEL), 0); if(sha_check(msi_file)) { WCHAR *cache_file_name; install_file(msi_file); cache_file_name = get_cache_file_name(TRUE); if(cache_file_name) { CopyFileW(msi_file, cache_file_name, FALSE); heap_free(cache_file_name); } }else { WCHAR message[256]; if(LoadStringW(hInst, IDS_INVALID_SHA, message, ARRAY_SIZE(message))) MessageBoxW(NULL, message, NULL, MB_ICONERROR); } DeleteFileW(msi_file); heap_free(msi_file); msi_file = NULL; EndDialog(install_dialog, 0); return S_OK; }
static enum install_res install_from_cache(void) { WCHAR *cache_file_name; enum install_res res; cache_file_name = get_cache_file_name(FALSE); if(!cache_file_name) return INSTALL_NEXT; if(!sha_check(cache_file_name)) { WARN("could not validate checksum\n"); DeleteFileW(cache_file_name); heap_free(cache_file_name); return INSTALL_NEXT; } res = install_file(cache_file_name); heap_free(cache_file_name); return res; }
static DWORD WINAPI download_proc(PVOID arg) { WCHAR tmp_dir[MAX_PATH], tmp_file[MAX_PATH]; HRESULT hres; GetTempPathW(sizeof(tmp_dir)/sizeof(WCHAR), tmp_dir); GetTempFileNameW(tmp_dir, NULL, 0, tmp_file); TRACE("using temp file %s\n", debugstr_w(tmp_file)); hres = URLDownloadToFileW(NULL, url, tmp_file, 0, &InstallCallback); if(FAILED(hres)) { ERR("URLDownloadToFile failed: %08x\n", hres); return 0; } if(sha_check(tmp_file)) install_file(tmp_file); DeleteFileW(tmp_file); EndDialog(install_dialog, 0); return 0; }