static BOOL install_from_unix_file(const char *file_name) { LPWSTR dos_file_name; int fd; BOOL ret; static WCHAR * (CDECL *wine_get_dos_file_name)(const char*); static const WCHAR kernel32W[] = {'k','e','r','n','e','l','3','2','.','d','l','l',0}; fd = open(file_name, O_RDONLY); if(fd == -1) { TRACE("%s not found\n", debugstr_a(file_name)); return FALSE; } close(fd); if(!wine_get_dos_file_name) wine_get_dos_file_name = (void*)GetProcAddress(GetModuleHandleW(kernel32W), "wine_get_dos_file_name"); if(wine_get_dos_file_name) { /* Wine UNIX mode */ dos_file_name = wine_get_dos_file_name(file_name); if(!dos_file_name) { ERR("Could not get dos file name of %s\n", debugstr_a(file_name)); return FALSE; } } else { /* Windows mode */ UINT res; WARN("Could not get wine_get_dos_file_name function, calling install_cab directly.\n"); res = MultiByteToWideChar( CP_ACP, 0, file_name, -1, 0, 0); dos_file_name = heap_alloc (res*sizeof(WCHAR)); MultiByteToWideChar( CP_ACP, 0, file_name, -1, dos_file_name, res); } ret = install_file(dos_file_name); heap_free(dos_file_name); return ret; }
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; }