[RAPPS]
authorPierre Schweitzer <pierre@reactos.org>
Wed, 30 Apr 2014 22:03:49 +0000 (22:03 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Wed, 30 Apr 2014 22:03:49 +0000 (22:03 +0000)
Close downloaded application before attempting to execute it.

CORE-8134 #resolve

svn path=/trunk/; revision=63085

reactos/base/applications/rapps/loaddlg.c

index 8471c6f..0b58019 100644 (file)
@@ -217,7 +217,7 @@ ThreadFunc(LPVOID Context)
     BOOL bCab = FALSE;
     HINTERNET hOpen = NULL;
     HINTERNET hFile = NULL;
-    HANDLE hOut = NULL;
+    HANDLE hOut = INVALID_HANDLE_VALUE;
     unsigned char lpBuffer[4096];
     const LPWSTR lpszAgent = L"RApps/1.0";
 
@@ -284,6 +284,9 @@ ThreadFunc(LPVOID Context)
     }
     while (dwBytesRead);
 
+    CloseHandle(hOut);
+    hOut = INVALID_HANDLE_VALUE;
+
     if (bCancelled) goto end;
 
     ShowWindow(Dlg, SW_HIDE);
@@ -294,7 +297,7 @@ ThreadFunc(LPVOID Context)
         ShellExecuteW( NULL, L"open", path, NULL, NULL, SW_SHOWNORMAL );
     }
 end:
-    CloseHandle(hOut);
+    if (hOut != INVALID_HANDLE_VALUE) CloseHandle(hOut);
     InternetCloseHandle(hFile);
     InternetCloseHandle(hOpen);