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

Unified Diff: base/process/launch_win.cc

Issue 2338133005: Add real_path option to LaunchProcess (Closed)
Patch Set: Add real_path option to LaunchProcess Created 4 years, 3 months 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
« base/process/launch.h ('K') | « base/process/launch_posix.cc ('k') | no next file » | 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 1349b3e4af3d101d4515e04d5ae081195e73016a..47e2c7412ac235024f1fa05b7d1816e01afef28d 100644
--- a/base/process/launch_win.cc
+++ b/base/process/launch_win.cc
@@ -272,6 +272,8 @@ Process LaunchProcess(const string16& cmdline,
: options.current_directory.value().c_str();
string16 writable_cmdline(cmdline);
+ const char16* executable_path = !options.real_path.empty() ?
+ options.real_path.value().c_str() : nullptr;
if (options.as_user) {
flags |= CREATE_UNICODE_ENVIRONMENT;
void* enviroment_block = nullptr;
@@ -282,8 +284,8 @@ Process LaunchProcess(const string16& cmdline,
}
BOOL launched = CreateProcessAsUser(
- options.as_user, nullptr, &writable_cmdline[0], nullptr, nullptr,
- inherit_handles, flags, enviroment_block, current_directory,
+ options.as_user, executable_path, &writable_cmdline[0], nullptr,
+ nullptr, inherit_handles, flags, enviroment_block, current_directory,
startup_info, &temp_process_info);
DestroyEnvironmentBlock(enviroment_block);
if (!launched) {
@@ -292,7 +294,7 @@ Process LaunchProcess(const string16& cmdline,
return Process();
}
} else {
- if (!CreateProcess(nullptr, &writable_cmdline[0], nullptr, nullptr,
+ if (!CreateProcess(executable_path, &writable_cmdline[0], nullptr, nullptr,
inherit_handles, flags, nullptr, current_directory,
startup_info, &temp_process_info)) {
DPLOG(ERROR) << "Command line:" << std::endl << UTF16ToUTF8(cmdline)
@@ -322,7 +324,8 @@ Process LaunchProcess(const string16& cmdline,
Process LaunchElevatedProcess(const CommandLine& cmdline,
const LaunchOptions& options) {
- const string16 file = cmdline.GetProgram().value();
+ const string16 file = !options.real_path.empty() ?
+ options.real_path.value() : cmdline.GetProgram().value();
const string16 arguments = cmdline.GetArgumentsString();
SHELLEXECUTEINFO shex_info = {};
« base/process/launch.h ('K') | « base/process/launch_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698