Chromium Code Reviews| Index: chrome/installer/util/install_util.cc |
| =================================================================== |
| --- chrome/installer/util/install_util.cc (revision 66046) |
| +++ 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,27 @@ |
| 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] == '"') { |
|
robertshield
2010/11/14 15:21:31
Add a comment here along the lines of "include the
tommi (sloooow) - chröme
2010/11/14 21:28:07
Not sure I follow... this part does remove the quo
robertshield
2010/11/14 21:40:17
uh, yeah, sorry I misread it earlier. pebkac.
|
| + DCHECK_EQ(program, params.substr(1, program.length())); |
| + params = params.substr(program.length() + 2); |
|
robertshield
2010/11/14 15:21:31
Should we also DCHECK that the last character is a
tommi (sloooow) - chröme
2010/11/14 21:28:07
Done.
|
| + } else { |
| + DCHECK_EQ(program, params.substr(0, program.length())); |
| + params = params.substr(program.length()); |
| + } |
| + |
| + TrimWhitespace(params, TRIM_ALL, ¶ms); |
| + |
| 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) |