diff options
author | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-01 03:28:47 +0000 |
---|---|---|
committer | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-01 03:28:47 +0000 |
commit | e50130bb863d3d904d8c1bccb9ab86c1bdcf88e5 (patch) | |
tree | ecbf141b6c12b41c7111b90a828c357db6beb5f1 /base/process_util.h | |
parent | e7f2be605361283b5ce2ea8d302ef9a8e34c4c69 (diff) | |
download | chromium_src-e50130bb863d3d904d8c1bccb9ab86c1bdcf88e5.zip chromium_src-e50130bb863d3d904d8c1bccb9ab86c1bdcf88e5.tar.gz chromium_src-e50130bb863d3d904d8c1bccb9ab86c1bdcf88e5.tar.bz2 |
Add a utility function to run a process as an arbitrary user
- Only for windows
- Needed in certain upgrade scenarios, useful for all
BUG=32474
TEST= unit tests included
Review URL: http://codereview.chromium.org/555192
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37682 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util.h')
-rw-r--r-- | base/process_util.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/base/process_util.h b/base/process_util.h index 1dc01df..99f68c0 100644 --- a/base/process_util.h +++ b/base/process_util.h @@ -140,6 +140,20 @@ void CloseSuperfluousFds(const base::InjectiveMultimap& saved_map); // that it doesn't leak! bool LaunchApp(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. +// +// Whether the application is visible on the interactive desktop depends on +// the token belonging to an interactive logon session. +// +// To avoid hard to diagnose problems, this function internally loads the +// environment variables associated with the user and if this operation fails +// the entire call fails as well. +bool LaunchAppAsUser(UserTokenHandle token, const std::wstring& cmdline, + bool start_hidden, ProcessHandle* process_handle); + #elif defined(OS_POSIX) // Runs the application specified in argv[0] with the command line argv. // Before launching all FDs open in the parent process will be marked as |