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

Unified Diff: chrome/installer/util/install_util.cc

Issue 4989001: Attempt to reland http://codereview.chromium.org/4928002/... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 1 month 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 | « chrome/installer/util/install_util.h ('k') | chrome/installer/util/master_preferences.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/install_util.cc
===================================================================
--- chrome/installer/util/install_util.cc (revision 66087)
+++ chrome/installer/util/install_util.cc (working copy)
@@ -12,7 +12,6 @@
#include <algorithm>
-#include "base/command_line.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/path_service.h"
@@ -37,14 +36,28 @@
return prefs;
}
-bool InstallUtil::ExecuteExeAsAdmin(const std::wstring& exe,
- const std::wstring& params,
- DWORD* exit_code) {
+bool InstallUtil::ExecuteExeAsAdmin(const CommandLine& cmd, DWORD* exit_code) {
+ FilePath::StringType program(cmd.GetProgram().value());
+ DCHECK(!program.empty());
+ DCHECK(program[0] != '\"');
+
+ CommandLine::StringType params(cmd.command_line_string());
+ if (params[0] == '"') {
+ DCHECK_EQ('"', params[program.length() + 1]);
+ DCHECK_EQ(program, params.substr(1, program.length()));
+ params = params.substr(program.length() + 2);
+ } else {
+ DCHECK_EQ(program, params.substr(0, program.length()));
+ params = params.substr(program.length());
+ }
+
+ TrimWhitespace(params, TRIM_ALL, &params);
+
SHELLEXECUTEINFO info = {0};
info.cbSize = sizeof(SHELLEXECUTEINFO);
info.fMask = SEE_MASK_NOCLOSEPROCESS;
info.lpVerb = L"runas";
- info.lpFile = exe.c_str();
+ info.lpFile = program.c_str();
info.lpParameters = params.c_str();
info.nShow = SW_SHOW;
if (::ShellExecuteEx(&info) == FALSE)
« no previous file with comments | « chrome/installer/util/install_util.h ('k') | chrome/installer/util/master_preferences.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698