- check the HTTP status when downloading a package (trying to run XML files in NTVDM is NOT funny)
- cleanup

svn path=/trunk/; revision=66836
This commit is contained in:
Kamil Hornicek 2015-03-20 11:12:00 +00:00
parent 9bf84c49e8
commit 9428e523d2
23 changed files with 78 additions and 30 deletions

View file

@ -199,5 +199,6 @@ BEGIN
IDS_CHOOSE_FOLDER_ERROR "Указали сте несъществуваща папка!"
IDS_APP_REG_REMOVE "Уверен ли сте, че искате да изтриете данните за сложеното приложение от регистъра?"
IDS_INFORMATION "Сведения"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not found!"
IDS_UNABLE_TO_REMOVE "Премахването на данните за приложението от регистъра е невъзможно!"
END

View file

@ -200,5 +200,6 @@ BEGIN
IDS_CHOOSE_FOLDER_ERROR "Zvolená složka neexistuje. Vytvořit?"
IDS_APP_REG_REMOVE "Určitě odstranit data instalovaného programu z registru?"
IDS_INFORMATION "Informace"
IDS_UNABLE_TO_DOWNLOAD "Soubor se nepodařilo stáhnout! Adresa nenalezena!"
IDS_UNABLE_TO_REMOVE "Nepodařilo se odstranit data programu z registru!"
END

View file

@ -195,5 +195,6 @@ BEGIN
IDS_CHOOSE_FOLDER_ERROR "Sie haben ein nicht existierendes Verzeichnis angegeben! Neu anlegen?"
IDS_APP_REG_REMOVE "Sind Sie sich sicher, dass Sie die Daten dieses Programms aus der Registry entfernen möchten?"
IDS_INFORMATION "Informationen"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not found!"
IDS_UNABLE_TO_REMOVE "Konnte die Daten nicht aus der Registry löschen!"
END

View file

@ -195,5 +195,6 @@ BEGIN
IDS_CHOOSE_FOLDER_ERROR "The folder you have specified does not exist. Create it?"
IDS_APP_REG_REMOVE "Are you sure you want to delete the data on the installed program from the registry?"
IDS_INFORMATION "Information"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not found!"
IDS_UNABLE_TO_REMOVE "Unable to remove data on the program from the registry!"
END

View file

@ -198,5 +198,6 @@ BEGIN
IDS_CHOOSE_FOLDER_ERROR "¡La carpeta especificada no existe!"
IDS_APP_REG_REMOVE "¿Está seguro de querer borrar del Registro los datos de instalación del programa?"
IDS_INFORMATION "Información"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not found!"
IDS_UNABLE_TO_REMOVE "¡No se pudieron borrar del Registro los datos de instalación del programa!"
END

View file

@ -195,5 +195,6 @@ BEGIN
IDS_CHOOSE_FOLDER_ERROR "Le dossier que vous avez spécifié n'existe pas. Le créer ?"
IDS_APP_REG_REMOVE "Etes-vous sûr de vouloir supprimer les données du programme installé du registre ?"
IDS_INFORMATION "Information"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not found!"
IDS_UNABLE_TO_REMOVE "Impossible de supprimer les données du programme du registre !"
END

View file

@ -197,5 +197,6 @@ BEGIN
IDS_CHOOSE_FOLDER_ERROR "The folder you have specified does not exist. Create it?"
IDS_APP_REG_REMOVE "Are you sure you want to delete the data on the installed program from the registry?"
IDS_INFORMATION "מידע"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not found!"
IDS_UNABLE_TO_REMOVE "Unable to remove data on the program from the registry!"
END

View file

@ -195,5 +195,6 @@ BEGIN
IDS_CHOOSE_FOLDER_ERROR "La cartella indicata non esiste. Vuoi crearla?"
IDS_APP_REG_REMOVE "Sicuro di voler cancellare dal registry i dati sui programmi installati?"
IDS_INFORMATION "Informazioni"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not found!"
IDS_UNABLE_TO_REMOVE "Impossibile cancellare i dati dal registry!"
END

View file

@ -195,5 +195,6 @@ BEGIN
IDS_CHOOSE_FOLDER_ERROR "指定されたフォルダは存在しません!"
IDS_APP_REG_REMOVE "レジストリからインストールされたプログラムに関するデータを削除してもよろしいですか?"
IDS_INFORMATION "情報"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not found!"
IDS_UNABLE_TO_REMOVE "レジストリからこのプログラムに関するデータを削除できません!"
END

View file

@ -195,5 +195,6 @@ BEGIN
IDS_CHOOSE_FOLDER_ERROR "You have specified a nonexistent folder!"
IDS_APP_REG_REMOVE "Are you sure you want to delete the data on the installed program from the registry?"
IDS_INFORMATION "Information"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not found!"
IDS_UNABLE_TO_REMOVE "Unable to remove data on the program from the registry!"
END

View file

@ -203,5 +203,6 @@ BEGIN
IDS_CHOOSE_FOLDER_ERROR "Wybrałeś nieistniejący katalog! Czy chcesz utworzyć nowy?"
IDS_APP_REG_REMOVE "Czy na pewno chcesz usunąć wpis tego programu z rejestru?"
IDS_INFORMATION "Informacja"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not found!"
IDS_UNABLE_TO_REMOVE "Nie można było usunąć wpisu z rejestru!"
END

View file

@ -197,5 +197,6 @@ BEGIN
IDS_CHOOSE_FOLDER_ERROR "A pasta especificada não existe. Deseja criá-la?"
IDS_APP_REG_REMOVE "Você tem certeza que deseja apagar as informações do programa instalado do registro?"
IDS_INFORMATION "Informações"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not found!"
IDS_UNABLE_TO_REMOVE "Não foi possível remover as informações do programa do registro!"
END

View file

@ -201,5 +201,6 @@ BEGIN
IDS_CHOOSE_FOLDER_ERROR "Dosarul specificat nu există. Doriți crearea lui?"
IDS_APP_REG_REMOVE "Sigur doriți să ștergeți datele din registru pentru această aplicațe?"
IDS_INFORMATION "Informație"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not found!"
IDS_UNABLE_TO_REMOVE "Nu se pot elimina datele din registru pentru acest program!"
END

View file

@ -195,5 +195,6 @@ BEGIN
IDS_CHOOSE_FOLDER_ERROR "Вы указали несуществующую папку!"
IDS_APP_REG_REMOVE "Вы действительно хотите удалить данные об установленной программе из реестра?"
IDS_INFORMATION "Информация"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not found!"
IDS_UNABLE_TO_REMOVE "Не удалось удалить данные о программе из реестра!"
END

View file

@ -200,5 +200,6 @@ BEGIN
IDS_CHOOSE_FOLDER_ERROR "Zvolili ste si neexistujúci priečinok!"
IDS_APP_REG_REMOVE "Naozaj chcete vymazať údaje o nainštalovanom programe z registrov?"
IDS_INFORMATION "Informácie"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not found!"
IDS_UNABLE_TO_REMOVE "Nie je možné odstrániť z registrov údaje o programe!"
END

View file

@ -199,5 +199,6 @@ BEGIN
IDS_CHOOSE_FOLDER_ERROR "Dosja qe keni zgjedhur nuk ekziston. Krijoje?"
IDS_APP_REG_REMOVE "Jeni te sigurt qe do ti fshini informacionet e programit te instaluar nga regjistri?"
IDS_INFORMATION "Informacione"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not found!"
IDS_UNABLE_TO_REMOVE "E pamundur te fshihen informacionet e programit nga regjistri!"
END

View file

@ -202,5 +202,6 @@ BEGIN
IDS_CHOOSE_FOLDER_ERROR "Du har specificrat en ej existerande mapp! Vill du skapa den?"
IDS_APP_REG_REMOVE "Är du säker på att du vill ta bort data det installerade programmets data från registret?"
IDS_INFORMATION "Information"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not found!"
IDS_UNABLE_TO_REMOVE "Det gick ej att ta bort programmets data från registret!"
END

View file

@ -197,5 +197,6 @@ BEGIN
IDS_CHOOSE_FOLDER_ERROR "Belirttiğiniz dizin yok. Belirttiğiniz dizin oluşturulsun mu?"
IDS_APP_REG_REMOVE "Kurulan izlencenin girişini değer defterinden silmek istediğinizden emin misiniz?"
IDS_INFORMATION "Bilgi"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not found!"
IDS_UNABLE_TO_REMOVE "İzlencenin girişi değer defterinden silinemiyor."
END

View file

@ -203,5 +203,6 @@ BEGIN
IDS_CHOOSE_FOLDER_ERROR "Ви вказали неіснуючу теку!"
IDS_APP_REG_REMOVE "Ви дійсно хочете видалити дані про встановлену програму з реєстру?"
IDS_INFORMATION "Інформація"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not found!"
IDS_UNABLE_TO_REMOVE "Не вдалося видалити дані про програму з реєстру!"
END

View file

@ -197,5 +197,6 @@ BEGIN
IDS_CHOOSE_FOLDER_ERROR "您选择的文件夹不存在。创建吗?"
IDS_APP_REG_REMOVE "您确定要从注册表删除该程序的数据吗?"
IDS_INFORMATION "信息"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not found!"
IDS_UNABLE_TO_REMOVE "无法从注册表删除该程序的数据!"
END

View file

@ -197,5 +197,6 @@ BEGIN
IDS_CHOOSE_FOLDER_ERROR "您選擇的資料夾不存在。創建嗎?"
IDS_APP_REG_REMOVE "您確定要從登錄檔刪除該程式的資料嗎?"
IDS_INFORMATION "資訊"
IDS_UNABLE_TO_DOWNLOAD "Unable to download the package! Address not found!"
IDS_UNABLE_TO_REMOVE "無法從登錄檔刪除該程式的資料!"
END

View file

@ -191,7 +191,8 @@ CreateDl(HWND Dlg, BOOL *pbCancelled)
IBindStatusCallbackImpl *This;
This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IBindStatusCallbackImpl));
if (!This) return NULL;
if (!This)
return NULL;
This->vtbl = &dlVtbl;
This->ref = 1;
@ -209,9 +210,9 @@ ThreadFunc(LPVOID Context)
WCHAR path[MAX_PATH];
LPWSTR p;
HWND Dlg = (HWND) Context;
DWORD len, dwContentLen, dwBytesWritten, dwBytesRead;
DWORD dwContentLen, dwBytesWritten, dwBytesRead, dwStatus;
DWORD dwCurrentBytesRead = 0;
DWORD dwBufLen = sizeof(dwContentLen);
DWORD dwStatusLen = sizeof(dwStatus);
BOOL bCancelled = FALSE;
BOOL bTempfile = FALSE;
BOOL bCab = FALSE;
@ -225,15 +226,11 @@ ThreadFunc(LPVOID Context)
/* built the path for the download */
p = wcsrchr(AppInfo->szUrlDownload, L'/');
if (!p) goto end;
len = wcslen(AppInfo->szUrlDownload);
if (len > 4)
{
if (AppInfo->szUrlDownload[len - 4] == '.' &&
AppInfo->szUrlDownload[len - 3] == 'c' &&
AppInfo->szUrlDownload[len - 2] == 'a' &&
AppInfo->szUrlDownload[len - 1] == 'b')
if (!p)
goto end;
if (wcscmp(AppInfo->szUrlDownload, APPLICATION_DATABASE_URL) == 0)
{
bCab = TRUE;
if (!GetStorageDirectory(path, sizeof(path) / sizeof(path[0])))
@ -241,14 +238,10 @@ ThreadFunc(LPVOID Context)
}
else
{
if (FAILED(StringCbCopyW(path, sizeof(path),
SettingsInfo.szDownloadDir)))
{
if (FAILED(StringCbCopyW(path, sizeof(path), SettingsInfo.szDownloadDir)))
goto end;
}
}
}
else goto end;
if (GetFileAttributesW(path) == INVALID_FILE_ATTRIBUTES)
{
@ -264,7 +257,9 @@ ThreadFunc(LPVOID Context)
/* download it */
bTempfile = TRUE;
dl = CreateDl(Context, &bCancelled);
if (dl == NULL) goto end;
if (dl == NULL)
goto end;
switch(SettingsInfo.Proxy)
{
@ -281,26 +276,54 @@ ThreadFunc(LPVOID Context)
hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
break;
}
if (!hOpen) goto end;
if (!hOpen)
goto end;
hFile = InternetOpenUrlW(hOpen, AppInfo->szUrlDownload, NULL, 0, INTERNET_FLAG_PRAGMA_NOCACHE|INTERNET_FLAG_KEEP_CONNECTION, 0);
if (!hFile) goto end;
if (!hFile)
goto end;
if (!HttpQueryInfoW(hFile, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &dwStatus, &dwStatusLen, NULL))
goto end;
if(dwStatus != HTTP_STATUS_OK)
{
WCHAR szMsgText[MAX_STR_LEN];
if (!LoadStringW(hInst, IDS_UNABLE_TO_DOWNLOAD, szMsgText, sizeof(szMsgText) / sizeof(WCHAR)))
goto end;
MessageBoxW(hMainWnd, szMsgText, NULL, MB_OK | MB_ICONERROR);
goto end;
}
dwStatusLen = sizeof(dwStatus);
memset(&urlComponents, 0, sizeof(urlComponents));
urlComponents.dwStructSize = sizeof(urlComponents);
if(FAILED(StringCbLengthW(AppInfo->szUrlDownload, sizeof(AppInfo->szUrlDownload), &urlLength))) goto end;
if(FAILED(StringCbLengthW(AppInfo->szUrlDownload, sizeof(AppInfo->szUrlDownload), &urlLength)))
goto end;
urlComponents.dwSchemeLength = urlLength*sizeof(WCHAR);
urlComponents.lpszScheme = malloc(urlComponents.dwSchemeLength);
if(!InternetCrackUrlW(AppInfo->szUrlDownload, urlLength+1, ICU_DECODE | ICU_ESCAPE, &urlComponents)) goto end;
if(!InternetCrackUrlW(AppInfo->szUrlDownload, urlLength+1, ICU_DECODE | ICU_ESCAPE, &urlComponents))
goto end;
if(urlComponents.nScheme == INTERNET_SCHEME_HTTP || urlComponents.nScheme == INTERNET_SCHEME_HTTPS)
HttpQueryInfo(hFile, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, &dwContentLen, &dwBufLen, 0);
HttpQueryInfo(hFile, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, &dwContentLen, &dwStatus, 0);
if(urlComponents.nScheme == INTERNET_SCHEME_FTP)
dwContentLen = FtpGetFileSize(hFile, &dwBufLen);
dwContentLen = FtpGetFileSize(hFile, &dwStatus);
free(urlComponents.lpszScheme);
hOut = CreateFileW(path, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, 0, NULL);
if (hOut == INVALID_HANDLE_VALUE) goto end;
if (hOut == INVALID_HANDLE_VALUE)
goto end;
do
{
@ -314,21 +337,24 @@ ThreadFunc(LPVOID Context)
CloseHandle(hOut);
hOut = INVALID_HANDLE_VALUE;
if (bCancelled) goto end;
if (bCancelled)
goto end;
ShowWindow(Dlg, SW_HIDE);
/* run it */
if (!bCab)
{
ShellExecuteW( NULL, L"open", path, NULL, NULL, SW_SHOWNORMAL );
}
end:
if (hOut != INVALID_HANDLE_VALUE) CloseHandle(hOut);
if (hOut != INVALID_HANDLE_VALUE)
CloseHandle(hOut);
InternetCloseHandle(hFile);
InternetCloseHandle(hOpen);
if (dl) IBindStatusCallback_Release(dl);
if (dl)
IBindStatusCallback_Release(dl);
if (bTempfile)
{

View file

@ -95,6 +95,7 @@
#define IDS_APP_REG_REMOVE 116
#define IDS_INFORMATION 117
#define IDS_UNABLE_TO_REMOVE 118
#define IDS_UNABLE_TO_DOWNLOAD 119
/* Tooltips */
#define IDS_TOOLTIP_INSTALL 200