mirror of
https://github.com/reactos/reactos.git
synced 2024-10-08 02:13:56 +00:00
[APPWIZ] Enable the 'Cancel' button while downloading. Patch by Jared Smudde and 'thc'. CORE-9629
svn path=/trunk/; revision=75217
This commit is contained in:
parent
9e4da13034
commit
5e0896e8ab
|
@ -59,6 +59,7 @@ static const addon_info_t addons_info[] = {
|
||||||
static const addon_info_t *addon;
|
static const addon_info_t *addon;
|
||||||
|
|
||||||
static HWND install_dialog = NULL;
|
static HWND install_dialog = NULL;
|
||||||
|
static IBinding *download_binding;
|
||||||
|
|
||||||
static WCHAR GeckoUrl[] = L"https://svn.reactos.org/amine/wine_gecko-2.40-x86.msi";
|
static WCHAR GeckoUrl[] = L"https://svn.reactos.org/amine/wine_gecko-2.40-x86.msi";
|
||||||
|
|
||||||
|
@ -259,6 +260,9 @@ static HRESULT WINAPI InstallCallback_OnStartBinding(IBindStatusCallback *iface,
|
||||||
DWORD dwReserved, IBinding *pib)
|
DWORD dwReserved, IBinding *pib)
|
||||||
{
|
{
|
||||||
set_status(IDS_DOWNLOADING);
|
set_status(IDS_DOWNLOADING);
|
||||||
|
IBinding_AddRef(pib);
|
||||||
|
download_binding = pib;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,7 +294,15 @@ static HRESULT WINAPI InstallCallback_OnProgress(IBindStatusCallback *iface, ULO
|
||||||
static HRESULT WINAPI InstallCallback_OnStopBinding(IBindStatusCallback *iface,
|
static HRESULT WINAPI InstallCallback_OnStopBinding(IBindStatusCallback *iface,
|
||||||
HRESULT hresult, LPCWSTR szError)
|
HRESULT hresult, LPCWSTR szError)
|
||||||
{
|
{
|
||||||
|
if(download_binding) {
|
||||||
|
IBinding_Release(download_binding);
|
||||||
|
download_binding = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if(FAILED(hresult)) {
|
if(FAILED(hresult)) {
|
||||||
|
if(hresult == E_ABORT)
|
||||||
|
TRACE("Binding aborted\n");
|
||||||
|
else
|
||||||
ERR("Binding failed %08x\n", hresult);
|
ERR("Binding failed %08x\n", hresult);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -350,9 +362,7 @@ static DWORD WINAPI download_proc(PVOID arg)
|
||||||
hres = URLDownloadToFileW(NULL, GeckoUrl, tmp_file, 0, &InstallCallback);
|
hres = URLDownloadToFileW(NULL, GeckoUrl, tmp_file, 0, &InstallCallback);
|
||||||
if(FAILED(hres)) {
|
if(FAILED(hres)) {
|
||||||
ERR("URLDownloadToFile failed: %08x\n", hres);
|
ERR("URLDownloadToFile failed: %08x\n", hres);
|
||||||
return 0;
|
} else {
|
||||||
}
|
|
||||||
|
|
||||||
if(sha_check(tmp_file)) {
|
if(sha_check(tmp_file)) {
|
||||||
install_file(tmp_file);
|
install_file(tmp_file);
|
||||||
}else {
|
}else {
|
||||||
|
@ -362,6 +372,7 @@ static DWORD WINAPI download_proc(PVOID arg)
|
||||||
MessageBoxW(NULL, message, NULL, MB_ICONERROR);
|
MessageBoxW(NULL, message, NULL, MB_ICONERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DeleteFileW(tmp_file);
|
DeleteFileW(tmp_file);
|
||||||
EndDialog(install_dialog, 0);
|
EndDialog(install_dialog, 0);
|
||||||
|
@ -382,13 +393,17 @@ static INT_PTR CALLBACK installer_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch(wParam) {
|
switch(wParam) {
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
|
if(download_binding) {
|
||||||
|
IBinding_Abort(download_binding);
|
||||||
|
}
|
||||||
|
else {
|
||||||
EndDialog(hwnd, 0);
|
EndDialog(hwnd, 0);
|
||||||
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
case ID_DWL_INSTALL:
|
case ID_DWL_INSTALL:
|
||||||
ShowWindow(GetDlgItem(hwnd, ID_DWL_PROGRESS), SW_SHOW);
|
ShowWindow(GetDlgItem(hwnd, ID_DWL_PROGRESS), SW_SHOW);
|
||||||
EnableWindow(GetDlgItem(hwnd, ID_DWL_INSTALL), 0);
|
EnableWindow(GetDlgItem(hwnd, ID_DWL_INSTALL), 0);
|
||||||
EnableWindow(GetDlgItem(hwnd, IDCANCEL), 0); /* FIXME */
|
|
||||||
CloseHandle( CreateThread(NULL, 0, download_proc, NULL, 0, NULL));
|
CloseHandle( CreateThread(NULL, 0, download_proc, NULL, 0, NULL));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue