Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: installer/src/installer-lib/process.cpp

Issue 6219169376763904: Issue #1686 - Kill iexplore.exe and AdblockplusEngine.exe processes from the installer (Closed)
Patch Set: Log error Created April 13, 2015, 4:43 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « installer/src/installer-lib/process.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: installer/src/installer-lib/process.cpp
===================================================================
--- a/installer/src/installer-lib/process.cpp
+++ b/installer/src/installer-lib/process.cpp
@@ -216,7 +216,7 @@
* - MSDN [WM_QUERYENDSESSION message](http://msdn.microsoft.com/en-us/library/windows/desktop/aa376890%28v=vs.85%29.aspx)
* - MSDN [WM_ENDSESSION message](http://msdn.microsoft.com/en-us/library/windows/desktop/aa376889%28v=vs.85%29.aspx)
*/
-bool ProcessCloser::ShutDown()
+bool ProcessCloser::ShutDown(ImmediateSession& session)
{
/*
* If we're not running, we don't need to shut down.
@@ -280,18 +280,30 @@
case 4:
/*
- * We're out of ways to try to shut down. Oh well. Take cover. It gets violent here.
+ * Oh well. Take cover. It gets violent here. Try to kill all matching processes.
*/
for (auto it = pid_set.begin(); it != pid_set.end(); ++it)
{
HANDLE tmpHandle = OpenProcess(PROCESS_TERMINATE, FALSE, *it);
- if (!tmpHandle) continue;
+ if (!tmpHandle)
+ {
+ std::ostringstream stream;
+ stream << "Can't open process for termination. Error: " << GetLastError();
Eric 2015/05/14 15:09:25 This message should indicate a warning rather than
+ session.Log(stream.str());
+ continue;
+ }
Windows_Handle procHandle(tmpHandle);
- TerminateProcess(tmpHandle, 0);
+ if (!TerminateProcess(tmpHandle, 0))
+ {
+ std::ostringstream stream;
+ stream << "Can't terminate process. Error: " << GetLastError();
+ session.Log(stream.str());
+ }
}
break;
default:
+ // We're out of ways to try to shut down.
return false;
}
« no previous file with comments | « installer/src/installer-lib/process.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld