Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(944)

Unified Diff: base/process/launch_win.cc

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/process/launch_posix.cc ('k') | base/process/process_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/launch_win.cc
diff --git a/base/process/launch_win.cc b/base/process/launch_win.cc
index a3303a5e08588669aac9d84cf6f9acdb2473b594..3c787fe4ea2880e90db0e080076958787488d302 100644
--- a/base/process/launch_win.cc
+++ b/base/process/launch_win.cc
@@ -244,9 +244,17 @@ bool LaunchProcess(const CommandLine& cmdline,
return rv;
}
-bool LaunchElevatedProcess(const CommandLine& cmdline,
- const LaunchOptions& options,
- ProcessHandle* process_handle) {
+Process LaunchProcess(const CommandLine& cmdline,
+ const LaunchOptions& options) {
+ ProcessHandle process_handle;
+ if (LaunchProcess(cmdline, options, &process_handle))
+ return Process(process_handle);
+
+ return Process();
+}
+
+Process LaunchElevatedProcess(const CommandLine& cmdline,
+ const LaunchOptions& options) {
const string16 file = cmdline.GetProgram().value();
const string16 arguments = cmdline.GetArgumentsString();
@@ -263,20 +271,13 @@ bool LaunchElevatedProcess(const CommandLine& cmdline,
if (!ShellExecuteEx(&shex_info)) {
DPLOG(ERROR);
- return false;
+ return Process();
}
if (options.wait)
WaitForSingleObject(shex_info.hProcess, INFINITE);
- // If the caller wants the process handle give it to them, otherwise just
- // close it. Closing it does not terminate the process.
- if (process_handle)
- *process_handle = shex_info.hProcess;
- else
- CloseHandle(shex_info.hProcess);
-
- return true;
+ return Process(shex_info.hProcess);
}
bool SetJobObjectLimitFlags(HANDLE job_object, DWORD limit_flags) {
« no previous file with comments | « base/process/launch_posix.cc ('k') | base/process/process_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698