OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <fcntl.h> | 7 #include <fcntl.h> |
8 #include <io.h> | 8 #include <io.h> |
9 #include <windows.h> | 9 #include <windows.h> |
10 #include <userenv.h> | 10 #include <userenv.h> |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
299 bool LaunchProcess(const string16& cmdline, | 299 bool LaunchProcess(const string16& cmdline, |
300 const LaunchOptions& options, | 300 const LaunchOptions& options, |
301 ProcessHandle* process_handle) { | 301 ProcessHandle* process_handle) { |
302 STARTUPINFO startup_info = {}; | 302 STARTUPINFO startup_info = {}; |
303 startup_info.cb = sizeof(startup_info); | 303 startup_info.cb = sizeof(startup_info); |
304 if (options.empty_desktop_name) | 304 if (options.empty_desktop_name) |
305 startup_info.lpDesktop = L""; | 305 startup_info.lpDesktop = L""; |
306 startup_info.dwFlags = STARTF_USESHOWWINDOW; | 306 startup_info.dwFlags = STARTF_USESHOWWINDOW; |
307 startup_info.wShowWindow = options.start_hidden ? SW_HIDE : SW_SHOW; | 307 startup_info.wShowWindow = options.start_hidden ? SW_HIDE : SW_SHOW; |
308 | 308 |
309 if (options.stdin_handle != kNullProcessHandle) { | |
310 startup_info.dwFlags |= STARTF_USESTDHANDLES; | |
rvargas (doing something else)
2012/11/29 01:19:23
Unused handles should be set to INVALID_HANDLE_VAL
Sergey Ulanov
2012/12/01 01:23:00
Done in crrev.com/11419267
| |
311 startup_info.hStdInput = options.stdin_handle; | |
312 } | |
313 if (options.stdout_handle != kNullProcessHandle) { | |
314 startup_info.dwFlags |= STARTF_USESTDHANDLES; | |
315 startup_info.hStdOutput = options.stdout_handle; | |
316 } | |
317 | |
309 DWORD flags = 0; | 318 DWORD flags = 0; |
310 | 319 |
311 if (options.job_handle) { | 320 if (options.job_handle) { |
312 flags |= CREATE_SUSPENDED; | 321 flags |= CREATE_SUSPENDED; |
313 | 322 |
314 // If this code is run under a debugger, the launched process is | 323 // If this code is run under a debugger, the launched process is |
315 // automatically associated with a job object created by the debugger. | 324 // automatically associated with a job object created by the debugger. |
316 // The CREATE_BREAKAWAY_FROM_JOB flag is used to prevent this. | 325 // The CREATE_BREAKAWAY_FROM_JOB flag is used to prevent this. |
317 flags |= CREATE_BREAKAWAY_FROM_JOB; | 326 flags |= CREATE_BREAKAWAY_FROM_JOB; |
318 } | 327 } |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
995 | 1004 |
996 PERFORMANCE_INFORMATION info; | 1005 PERFORMANCE_INFORMATION info; |
997 if (!InternalGetPerformanceInfo(&info, sizeof(info))) { | 1006 if (!InternalGetPerformanceInfo(&info, sizeof(info))) { |
998 DLOG(ERROR) << "Failed to fetch internal performance info."; | 1007 DLOG(ERROR) << "Failed to fetch internal performance info."; |
999 return 0; | 1008 return 0; |
1000 } | 1009 } |
1001 return (info.CommitTotal * system_info.dwPageSize) / 1024; | 1010 return (info.CommitTotal * system_info.dwPageSize) / 1024; |
1002 } | 1011 } |
1003 | 1012 |
1004 } // namespace base | 1013 } // namespace base |
OLD | NEW |