diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-07 14:01:31 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-07 14:01:31 +0000 |
commit | 81e32608bbb2da6f58291981fee183b3da913081 (patch) | |
tree | 4cf69575e8b7f333f14ba1742856dc1e875461e1 /base | |
parent | 526fc024687de776e518fa18c86017ab8cecfdd9 (diff) | |
download | chromium_src-81e32608bbb2da6f58291981fee183b3da913081.zip chromium_src-81e32608bbb2da6f58291981fee183b3da913081.tar.gz chromium_src-81e32608bbb2da6f58291981fee183b3da913081.tar.bz2 |
2nd attempt: Write the outcome of the Toast Experiment for system-level installs to the right registry key.
This time with the two boolean parameters in process_util_win.cc:281 flipped to match the function signature.
TBR=cpu
BUG=44378
TEST=None
Review URL: http://codereview.chromium.org/3297015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58693 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/process_util.h | 12 | ||||
-rw-r--r-- | base/process_util_win.cc | 29 |
2 files changed, 31 insertions, 10 deletions
diff --git a/base/process_util.h b/base/process_util.h index dae3d46..4699c9e2 100644 --- a/base/process_util.h +++ b/base/process_util.h @@ -174,6 +174,13 @@ bool GetProcessIntegrityLevel(ProcessHandle process, IntegrityLevel *level); bool LaunchApp(const std::wstring& cmdline, bool wait, bool start_hidden, ProcessHandle* process_handle); +// Same as LaunchApp, except allows the new process to inherit handles of the +// parent process. +bool LaunchAppWithHandleInheritance(const std::wstring& cmdline, + bool wait, + bool start_hidden, + ProcessHandle* process_handle); + // Runs the given application name with the given command line as if the user // represented by |token| had launched it. The caveats about |cmdline| and // |process_handle| explained for LaunchApp above apply as well. @@ -188,10 +195,11 @@ bool LaunchAppAsUser(UserTokenHandle token, const std::wstring& cmdline, bool start_hidden, ProcessHandle* process_handle); // Has the same behavior as LaunchAppAsUser, but offers the boolean option to -// use an empty string for the desktop name. +// use an empty string for the desktop name and a boolean for allowing the +// child process to inherit handles from its parent. bool LaunchAppAsUser(UserTokenHandle token, const std::wstring& cmdline, bool start_hidden, ProcessHandle* process_handle, - bool empty_desktop_name); + bool empty_desktop_name, bool inherit_handles); #elif defined(OS_POSIX) diff --git a/base/process_util_win.cc b/base/process_util_win.cc index fb7bdb8..4e4cce2 100644 --- a/base/process_util_win.cc +++ b/base/process_util_win.cc @@ -191,8 +191,9 @@ bool GetProcessIntegrityLevel(ProcessHandle process, IntegrityLevel *level) { return true; } -bool LaunchApp(const std::wstring& cmdline, - bool wait, bool start_hidden, ProcessHandle* process_handle) { +bool LaunchAppImpl(const std::wstring& cmdline, + bool wait, bool start_hidden, bool inherit_handles, + ProcessHandle* process_handle) { STARTUPINFO startup_info = {0}; startup_info.cb = sizeof(startup_info); startup_info.dwFlags = STARTF_USESHOWWINDOW; @@ -200,7 +201,7 @@ bool LaunchApp(const std::wstring& cmdline, PROCESS_INFORMATION process_info; if (!CreateProcess(NULL, const_cast<wchar_t*>(cmdline.c_str()), NULL, NULL, - FALSE, 0, NULL, NULL, + inherit_handles, 0, NULL, NULL, &startup_info, &process_info)) return false; @@ -219,14 +220,26 @@ bool LaunchApp(const std::wstring& cmdline, return true; } +bool LaunchApp(const std::wstring& cmdline, + bool wait, bool start_hidden, ProcessHandle* process_handle) { + return LaunchAppImpl(cmdline, wait, start_hidden, false, process_handle); +} + +bool LaunchAppWithHandleInheritance( + const std::wstring& cmdline, bool wait, bool start_hidden, + ProcessHandle* process_handle) { + return LaunchAppImpl(cmdline, wait, start_hidden, true, process_handle); +} + bool LaunchAppAsUser(UserTokenHandle token, const std::wstring& cmdline, bool start_hidden, ProcessHandle* process_handle) { - return LaunchAppAsUser(token, cmdline, start_hidden, process_handle, false); + return LaunchAppAsUser(token, cmdline, start_hidden, process_handle, + false, false); } bool LaunchAppAsUser(UserTokenHandle token, const std::wstring& cmdline, bool start_hidden, ProcessHandle* process_handle, - bool empty_desktop_name) { + bool empty_desktop_name, bool inherit_handles) { STARTUPINFO startup_info = {0}; startup_info.cb = sizeof(startup_info); if (empty_desktop_name) @@ -244,7 +257,7 @@ bool LaunchAppAsUser(UserTokenHandle token, const std::wstring& cmdline, BOOL launched = CreateProcessAsUser(token, NULL, const_cast<wchar_t*>(cmdline.c_str()), - NULL, NULL, FALSE, flags, enviroment_block, + NULL, NULL, inherit_handles, flags, enviroment_block, NULL, &startup_info, &process_info); DestroyEnvironmentBlock(enviroment_block); @@ -264,8 +277,8 @@ bool LaunchAppAsUser(UserTokenHandle token, const std::wstring& cmdline, bool LaunchApp(const CommandLine& cl, bool wait, bool start_hidden, ProcessHandle* process_handle) { - return LaunchApp(cl.command_line_string(), wait, - start_hidden, process_handle); + return LaunchAppImpl(cl.command_line_string(), wait, + start_hidden, false, process_handle); } // Attempts to kill the process identified by the given process |