diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-06 18:23:54 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-06 18:23:54 +0000 |
commit | e6d9cab22c32de66edee5f70d1263615b03e8801 (patch) | |
tree | 134c00a9baeaf221d91bc20ef09d4d0f1d23900e | |
parent | 947294aa03000bd266a1b306f20f189a8e558b3a (diff) | |
download | chromium_src-e6d9cab22c32de66edee5f70d1263615b03e8801.zip chromium_src-e6d9cab22c32de66edee5f70d1263615b03e8801.tar.gz chromium_src-e6d9cab22c32de66edee5f70d1263615b03e8801.tar.bz2 |
Change Windows LaunchProcess to use the StartupInformation wrapper.
This is part 1 of my nefarious plan to add the ability to pass specified
handles to child processes (on Vista+).
R=brettw@chromium.org, cpu@chromium.org
Review URL: https://codereview.chromium.org/106773005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239242 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/process/launch_win.cc | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/base/process/launch_win.cc b/base/process/launch_win.cc index e11f11e..8882753 100644 --- a/base/process/launch_win.cc +++ b/base/process/launch_win.cc @@ -25,6 +25,7 @@ #include "base/win/object_watcher.h" #include "base/win/scoped_handle.h" #include "base/win/scoped_process_information.h" +#include "base/win/startup_information.h" #include "base/win/windows_version.h" // userenv.dll is required for CreateEnvironmentBlock(). @@ -104,22 +105,23 @@ void RouteStdioToConsole() { bool LaunchProcess(const string16& cmdline, const LaunchOptions& options, win::ScopedHandle* process_handle) { - STARTUPINFO startup_info = {}; - startup_info.cb = sizeof(startup_info); + win::StartupInformation startup_info_wrapper; + STARTUPINFO* startup_info = startup_info_wrapper.startup_info(); + if (options.empty_desktop_name) - startup_info.lpDesktop = L""; - startup_info.dwFlags = STARTF_USESHOWWINDOW; - startup_info.wShowWindow = options.start_hidden ? SW_HIDE : SW_SHOW; + startup_info->lpDesktop = L""; + startup_info->dwFlags = STARTF_USESHOWWINDOW; + startup_info->wShowWindow = options.start_hidden ? SW_HIDE : SW_SHOW; if (options.stdin_handle || options.stdout_handle || options.stderr_handle) { DCHECK(options.inherit_handles); DCHECK(options.stdin_handle); DCHECK(options.stdout_handle); DCHECK(options.stderr_handle); - startup_info.dwFlags |= STARTF_USESTDHANDLES; - startup_info.hStdInput = options.stdin_handle; - startup_info.hStdOutput = options.stdout_handle; - startup_info.hStdError = options.stderr_handle; + startup_info->dwFlags |= STARTF_USESTDHANDLES; + startup_info->hStdInput = options.stdin_handle; + startup_info->hStdOutput = options.stdout_handle; + startup_info->hStdError = options.stderr_handle; } DWORD flags = 0; @@ -151,7 +153,7 @@ bool LaunchProcess(const string16& cmdline, CreateProcessAsUser(options.as_user, NULL, const_cast<wchar_t*>(cmdline.c_str()), NULL, NULL, options.inherit_handles, flags, - enviroment_block, NULL, &startup_info, + enviroment_block, NULL, startup_info, &temp_process_info); DestroyEnvironmentBlock(enviroment_block); if (!launched) { @@ -162,7 +164,7 @@ bool LaunchProcess(const string16& cmdline, if (!CreateProcess(NULL, const_cast<wchar_t*>(cmdline.c_str()), NULL, NULL, options.inherit_handles, flags, NULL, NULL, - &startup_info, &temp_process_info)) { + startup_info, &temp_process_info)) { DPLOG(ERROR); return false; } |