# HG changeset patch
# User anng888
# Date 1196966603 0
# Node ID dad2c8993342fc7f45fb5cb4017984c6be07baca
# Parent  f4282e4db9f7c9ebeb6f11b82550acd4a57e9470
- Make the Win32 call to "unzip" use a minimized window.
- Clean up process and thread handles from "unzip".

diff -r f4282e4db9f7 -r dad2c8993342 file.cpp
--- a/file.cpp	Thu Dec 06 18:30:29 2007 +0000
+++ b/file.cpp	Thu Dec 06 18:43:23 2007 +0000
@@ -354,6 +354,8 @@
     // Set up members of the STARTUPINFO structure.
     ::ZeroMemory( &siStartInfo, sizeof(STARTUPINFO) );
     siStartInfo.cb = sizeof(STARTUPINFO);
+    siStartInfo.dwFlags = STARTF_USESHOWWINDOW;
+    siStartInfo.wShowWindow = SW_MINIMIZE;
 
     // Create command line.
     QString argv("unzip -o ");
@@ -362,26 +364,32 @@
     argv.append(QDir::convertSeparators(zipDir.path()));
 
     // Create the child process.
-    if( !::CreateProcess(NULL, 
-        (LPWSTR)argv.unicode(), // command line
-        NULL, // process security attributes
-        NULL, // primary thread security attributes
-        TRUE, // handles are inherited
-        0, // creation flags
-        NULL, // use parent's environment
-        NULL, // use parent's current directory
-        &siStartInfo, // STARTUPINFO pointer
-        &piProcInfo) ) // receives PROCESS_INFORMATION
+    if (!::CreateProcess(NULL, 
+                         (LPWSTR) argv.unicode(), // command line
+                         NULL, // process security attributes
+                         NULL, // primary thread security attributes
+                         TRUE, // handles are inherited
+                         0, // creation flags
+                         NULL, // use parent's environment
+                         NULL, // use parent's current directory
+                         &siStartInfo, // STARTUPINFO pointer
+                         &piProcInfo) ) // receives PROCESS_INFORMATION
     {
+		QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
+                               QObject::tr("Couldn't start unzip to decompress data."));
         err = aborted;
     }
     else
     {
         // Wait for it to finish.
-        ::WaitForSingleObject( piProcInfo.hProcess, 10000 );
+        ::WaitForSingleObject( piProcInfo.hProcess, INFINITE );
+
+        // Clean up handles.
+        CloseHandle(piProcInfo.hThread);
+        CloseHandle(piProcInfo.hProcess);
     }
 #endif
-	return err;	
+	return err;
 }
 
 bool loadStringFromDisk (const QString &fname, QString &s)
@@ -495,5 +503,3 @@
 		if (imageFilters.at(i)==filter) return imageTypes.at(i);
 	return QString();	
 }
-
-