| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/process_util.h" | 5 #include "base/process_util.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <winternl.h> | 8 #include <winternl.h> |
| 9 #include <psapi.h> | 9 #include <psapi.h> |
| 10 | 10 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 // If the caller wants the process handle, we won't close it. | 136 // If the caller wants the process handle, we won't close it. |
| 137 if (process_handle) { | 137 if (process_handle) { |
| 138 *process_handle = process_info.hProcess; | 138 *process_handle = process_info.hProcess; |
| 139 } else { | 139 } else { |
| 140 CloseHandle(process_info.hProcess); | 140 CloseHandle(process_info.hProcess); |
| 141 } | 141 } |
| 142 return true; | 142 return true; |
| 143 } | 143 } |
| 144 | 144 |
| 145 bool LaunchApp(CommandLine& cl, | 145 bool LaunchApp(const CommandLine& cl, |
| 146 bool wait, bool start_hidden, ProcessHandle* process_handle) { | 146 bool wait, bool start_hidden, ProcessHandle* process_handle) { |
| 147 return LaunchApp(cl.command_line_string(), wait, | 147 return LaunchApp(cl.command_line_string(), wait, |
| 148 start_hidden, process_handle); | 148 start_hidden, process_handle); |
| 149 } | 149 } |
| 150 | 150 |
| 151 // Attempts to kill the process identified by the given process | 151 // Attempts to kill the process identified by the given process |
| 152 // entry structure, giving it the specified exit code. | 152 // entry structure, giving it the specified exit code. |
| 153 // Returns true if this is successful, false otherwise. | 153 // Returns true if this is successful, false otherwise. |
| 154 bool KillProcess(int process_id, int exit_code, bool wait) { | 154 bool KillProcess(int process_id, int exit_code, bool wait) { |
| 155 bool result = false; | 155 bool result = false; |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 void EnableTerminationOnHeapCorruption() { | 609 void EnableTerminationOnHeapCorruption() { |
| 610 // Ignore the result code. Supported on XP SP3 and Vista. | 610 // Ignore the result code. Supported on XP SP3 and Vista. |
| 611 HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0); | 611 HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0); |
| 612 } | 612 } |
| 613 | 613 |
| 614 void RaiseProcessToHighPriority() { | 614 void RaiseProcessToHighPriority() { |
| 615 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); | 615 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); |
| 616 } | 616 } |
| 617 | 617 |
| 618 } // namespace base | 618 } // namespace base |
| OLD | NEW |