From f9c1cb22a99fdebd0a0a7ae0cc5c669b253365cd Mon Sep 17 00:00:00 2001 From: "robertshield@chromium.org" Date: Tue, 22 Feb 2011 21:25:06 +0000 Subject: Fix for chrome_launcher.exe command line construction. BUG=73425 TEST=NONE Review URL: http://codereview.chromium.org/6549022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75635 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome_frame/chrome_launcher.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'chrome_frame/chrome_launcher.cc') diff --git a/chrome_frame/chrome_launcher.cc b/chrome_frame/chrome_launcher.cc index af28992..c7ca618 100644 --- a/chrome_frame/chrome_launcher.cc +++ b/chrome_frame/chrome_launcher.cc @@ -143,9 +143,15 @@ bool SanitizeAndLaunchChrome(const wchar_t* command_line) { std::wstring chrome_path; if (GetChromeExecutablePath(&chrome_path)) { const wchar_t* args = PathGetArgs(command_line); + + // Build the command line string with the quoted path to chrome.exe. + std::wstring command_line; + command_line.reserve(chrome_path.size() + 2); + command_line.append(1, L'\"').append(chrome_path).append(1, L'\"'); + if (args != NULL) { - chrome_path += L" "; - chrome_path += args; + command_line += L' '; + command_line += args; } STARTUPINFO startup_info = {0}; @@ -153,7 +159,7 @@ bool SanitizeAndLaunchChrome(const wchar_t* command_line) { startup_info.dwFlags = STARTF_USESHOWWINDOW; startup_info.wShowWindow = SW_SHOW; PROCESS_INFORMATION process_info = {0}; - if (CreateProcess(NULL, &chrome_path[0], + if (CreateProcess(&chrome_path[0], &command_line[0], NULL, NULL, FALSE, 0, NULL, NULL, &startup_info, &process_info)) { // Close handles. -- cgit v1.1