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

Unified Diff: base/process/launch_win.cc

Issue 1809383004: Set current directory when launching Native Messaging processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « base/process/launch.h ('k') | chrome/browser/extensions/api/messaging/native_process_launcher_posix.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 985dccc0a3214b3d5d704127ab10721b5dd301ad..38aa0125fe0796cf3d07c22657edae8f4e4c9e43 100644
--- a/base/process/launch_win.cc
+++ b/base/process/launch_win.cc
@@ -290,6 +290,10 @@ Process LaunchProcess(const string16& cmdline,
PROCESS_INFORMATION temp_process_info = {};
+ LPCTSTR current_directory = options.current_directory.empty()
+ ? NULL
Lei Zhang 2016/03/29 00:57:54 nullptr in new code?
Sergey Ulanov 2016/04/04 18:01:27 Done.
+ : options.current_directory.value().c_str();
+
string16 writable_cmdline(cmdline);
if (options.as_user) {
flags |= CREATE_UNICODE_ENVIRONMENT;
@@ -300,12 +304,10 @@ Process LaunchProcess(const string16& cmdline,
return Process();
}
- BOOL launched =
- CreateProcessAsUser(options.as_user, NULL,
- &writable_cmdline[0],
- NULL, NULL, inherit_handles, flags,
- enviroment_block, NULL, startup_info,
- &temp_process_info);
+ BOOL launched = CreateProcessAsUser(
+ options.as_user, NULL, &writable_cmdline[0], NULL, NULL,
+ inherit_handles, flags, enviroment_block, current_directory,
+ startup_info, &temp_process_info);
DestroyEnvironmentBlock(enviroment_block);
if (!launched) {
DPLOG(ERROR) << "Command line:" << std::endl << UTF16ToUTF8(cmdline)
@@ -313,10 +315,9 @@ Process LaunchProcess(const string16& cmdline,
return Process();
}
} else {
- if (!CreateProcess(NULL,
- &writable_cmdline[0], NULL, NULL,
- inherit_handles, flags, NULL, NULL,
- startup_info, &temp_process_info)) {
+ if (!CreateProcess(NULL, &writable_cmdline[0], NULL, NULL, inherit_handles,
+ flags, NULL, current_directory, startup_info,
+ &temp_process_info)) {
DPLOG(ERROR) << "Command line:" << std::endl << UTF16ToUTF8(cmdline)
<< std::endl;
return Process();
« no previous file with comments | « base/process/launch.h ('k') | chrome/browser/extensions/api/messaging/native_process_launcher_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698