summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-15 18:24:34 +0000
committerkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-15 18:24:34 +0000
commit2b164b0d6d727a0968c687a47dfabb61cf0b1286 (patch)
treec06ad738c1cbc20592d1c745f337566f72e9d4de /chrome
parentf5f36152e843a215629f3991da644f8da37e02ff (diff)
downloadchromium_src-2b164b0d6d727a0968c687a47dfabb61cf0b1286.zip
chromium_src-2b164b0d6d727a0968c687a47dfabb61cf0b1286.tar.gz
chromium_src-2b164b0d6d727a0968c687a47dfabb61cf0b1286.tar.bz2
Do not remove quotes around paths in command line to setup.exe.
BUG=1546676 Review URL: http://codereview.chromium.org/18244 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8101 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/installer/mini_installer/mini_installer.cc33
1 files changed, 18 insertions, 15 deletions
diff --git a/chrome/installer/mini_installer/mini_installer.cc b/chrome/installer/mini_installer/mini_installer.cc
index 30f6208..d81c992 100644
--- a/chrome/installer/mini_installer/mini_installer.cc
+++ b/chrome/installer/mini_installer/mini_installer.cc
@@ -274,11 +274,6 @@ bool UnpackBinaryResources(HMODULE module, const wchar_t* base_path,
// so that they can be passed on to setup.exe. We do not return any error from
// this method and simply skip making any changes in case of error.
void AppendCommandLineFlags(wchar_t* buffer, int size) {
- int args_num;
- wchar_t** args = ::CommandLineToArgvW(::GetCommandLine(), &args_num);
- if (args_num <= 0)
- return;
-
wchar_t full_exe_path[MAX_PATH];
int len = ::GetModuleFileNameW(NULL, full_exe_path, MAX_PATH);
if (len <= 0 && len >= MAX_PATH)
@@ -288,18 +283,26 @@ void AppendCommandLineFlags(wchar_t* buffer, int size) {
if (exe_name == NULL)
return;
- int start = 1;
- if (args_num > 0 && !StrEndsWith(args[0], exe_name))
- start = 0;
-
- for (int i = start; i < args_num; ++i) {
- if (size < lstrlen(args[i]) + 1)
- break;
+ int args_num;
+ wchar_t* cmd_line = ::GetCommandLine();
+ wchar_t** args = ::CommandLineToArgvW(cmd_line, &args_num);
+ if (args_num <= 0)
+ return;
- ::lstrcat(buffer, L" ");
- ::lstrcat(buffer, args[i]);
- size = size - (lstrlen(args[i]) + 1);
+ wchar_t* cmd_to_append = NULL;
+ if (!StrEndsWith(args[0], exe_name)) {
+ // Current executable name not in the command line so just append
+ // the whole command line.
+ cmd_to_append = cmd_line;
+ } else if (args_num > 1 ) {
+ wchar_t* tmp = StrStr(cmd_line, exe_name);
+ tmp = StrStr(tmp, L" ");
+ cmd_to_append = tmp;
}
+
+ if (size > ::lstrlen(cmd_to_append))
+ ::lstrcat(buffer, cmd_to_append);
+
LocalFree(args);
}