Jacek Caban : appwiz.cpl: Allow cancelling download of addons.

Alexandre Julliard julliard at winehq.org
Fri Sep 20 14:21:30 CDT 2013


Module: wine
Branch: master
Commit: 2c9774f002521adc6da7bd07274052f111536697
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2c9774f002521adc6da7bd07274052f111536697

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Sep 20 16:36:19 2013 +0200

appwiz.cpl: Allow cancelling download of addons.

---

 dlls/appwiz.cpl/addons.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/dlls/appwiz.cpl/addons.c b/dlls/appwiz.cpl/addons.c
index be6fb6d..b278a4a 100644
--- a/dlls/appwiz.cpl/addons.c
+++ b/dlls/appwiz.cpl/addons.c
@@ -106,6 +106,7 @@ static const addon_info_t *addon;
 
 static HWND install_dialog = NULL;
 static LPWSTR url = NULL;
+static IBinding *dwl_binding;
 
 static WCHAR * (CDECL *p_wine_get_dos_file_name)(const char*);
 static const WCHAR kernel32_dllW[] = {'k','e','r','n','e','l','3','2','.','d','l','l',0};
@@ -185,6 +186,8 @@ static enum install_res install_file(const WCHAR *file_name)
 {
     ULONG res;
 
+    EnableWindow(GetDlgItem(install_dialog, IDCANCEL), 0);
+
     res = MsiInstallProductW(file_name, NULL);
     if(res != ERROR_SUCCESS) {
         ERR("MsiInstallProduct failed: %u\n", res);
@@ -437,6 +440,10 @@ static HRESULT WINAPI InstallCallback_OnStartBinding(IBindStatusCallback *iface,
         DWORD dwReserved, IBinding *pib)
 {
     set_status(IDS_DOWNLOADING);
+
+    IBinding_AddRef(pib);
+    dwl_binding = pib;
+
     return S_OK;
 }
 
@@ -468,8 +475,16 @@ static HRESULT WINAPI InstallCallback_OnProgress(IBindStatusCallback *iface, ULO
 static HRESULT WINAPI InstallCallback_OnStopBinding(IBindStatusCallback *iface,
         HRESULT hresult, LPCWSTR szError)
 {
+    if(dwl_binding) {
+        IBinding_Release(dwl_binding);
+        dwl_binding = NULL;
+    }
+
     if(FAILED(hresult)) {
-        ERR("Binding failed %08x\n", hresult);
+        if(hresult == E_ABORT)
+            TRACE("Binding aborted\n");
+        else
+            ERR("Binding failed %08x\n", hresult);
         return S_OK;
     }
 
@@ -660,13 +675,14 @@ static INT_PTR CALLBACK installer_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
     case WM_COMMAND:
         switch(wParam) {
         case IDCANCEL:
+            if(dwl_binding)
+                IBinding_Abort(dwl_binding);
             EndDialog(hwnd, 0);
             return FALSE;
 
         case ID_DWL_INSTALL:
             ShowWindow(GetDlgItem(hwnd, ID_DWL_PROGRESS), SW_SHOW);
             EnableWindow(GetDlgItem(hwnd, ID_DWL_INSTALL), 0);
-            EnableWindow(GetDlgItem(hwnd, IDCANCEL), 0); /* FIXME */
             CloseHandle( CreateThread(NULL, 0, download_proc, NULL, 0, NULL));
             return FALSE;
         }




More information about the wine-cvs mailing list