| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 // We're screwed. | 112 // We're screwed. |
| 113 NOTREACHED(); | 113 NOTREACHED(); |
| 114 return 0; | 114 return 0; |
| 115 } | 115 } |
| 116 | 116 |
| 117 bool LaunchApp(const std::wstring& cmdline, | 117 bool LaunchApp(const std::wstring& cmdline, |
| 118 bool wait, bool start_hidden, ProcessHandle* process_handle) { | 118 bool wait, bool start_hidden, ProcessHandle* process_handle) { |
| 119 STARTUPINFO startup_info = {0}; | 119 STARTUPINFO startup_info = {0}; |
| 120 startup_info.cb = sizeof(startup_info); | 120 startup_info.cb = sizeof(startup_info); |
| 121 if (start_hidden) { | 121 startup_info.dwFlags = STARTF_USESHOWWINDOW; |
| 122 startup_info.dwFlags = STARTF_USESHOWWINDOW; | 122 startup_info.wShowWindow = start_hidden ? SW_HIDE : SW_SHOW; |
| 123 startup_info.wShowWindow = SW_HIDE; | |
| 124 } | |
| 125 PROCESS_INFORMATION process_info; | 123 PROCESS_INFORMATION process_info; |
| 126 if (!CreateProcess(NULL, | 124 if (!CreateProcess(NULL, |
| 127 const_cast<wchar_t*>(cmdline.c_str()), NULL, NULL, | 125 const_cast<wchar_t*>(cmdline.c_str()), NULL, NULL, |
| 128 FALSE, 0, NULL, NULL, | 126 FALSE, 0, NULL, NULL, |
| 129 &startup_info, &process_info)) | 127 &startup_info, &process_info)) |
| 130 return false; | 128 return false; |
| 131 | 129 |
| 132 // Handles must be closed or they will leak | 130 // Handles must be closed or they will leak |
| 133 CloseHandle(process_info.hThread); | 131 CloseHandle(process_info.hThread); |
| 134 | 132 |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 void EnableTerminationOnHeapCorruption() { | 609 void EnableTerminationOnHeapCorruption() { |
| 612 // Ignore the result code. Supported on XP SP3 and Vista. | 610 // Ignore the result code. Supported on XP SP3 and Vista. |
| 613 HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0); | 611 HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0); |
| 614 } | 612 } |
| 615 | 613 |
| 616 void RaiseProcessToHighPriority() { | 614 void RaiseProcessToHighPriority() { |
| 617 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); | 615 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); |
| 618 } | 616 } |
| 619 | 617 |
| 620 } // namespace process_util | 618 } // namespace process_util |
| OLD | NEW |