summaryrefslogtreecommitdiffstats
path: root/chrome_elf/create_file/chrome_create_file.cc
diff options
context:
space:
mode:
authorcaitkp@chromium.org <caitkp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-07 21:59:10 +0000
committercaitkp@chromium.org <caitkp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-07 21:59:10 +0000
commita8eab3bb4993c6db09e963a436a305d07e327e1e (patch)
treeabc17b2eecb42d425c855160e3374c1511cb9bdc /chrome_elf/create_file/chrome_create_file.cc
parent69c355d4f8883f4504fb7752f658918d528f55df (diff)
downloadchromium_src-a8eab3bb4993c6db09e963a436a305d07e327e1e.zip
chromium_src-a8eab3bb4993c6db09e963a436a305d07e327e1e.tar.gz
chromium_src-a8eab3bb4993c6db09e963a436a305d07e327e1e.tar.bz2
Make redirects work on canary by looking in the correct profile
BUG=334379 Review URL: https://codereview.chromium.org/156103004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249806 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_elf/create_file/chrome_create_file.cc')
-rw-r--r--chrome_elf/create_file/chrome_create_file.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/chrome_elf/create_file/chrome_create_file.cc b/chrome_elf/create_file/chrome_create_file.cc
index a39cd3e..f1cd599 100644
--- a/chrome_elf/create_file/chrome_create_file.cc
+++ b/chrome_elf/create_file/chrome_create_file.cc
@@ -243,6 +243,11 @@ HANDLE CreateFileNTDLL(
return file_handle;
}
+bool IsCanary(LPWSTR exe_path) {
+ wchar_t* found = wcsstr(exe_path, L"Google\\Chrome SxS");
+ return !!found;
+}
+
bool ShouldBypass(LPCWSTR file_path) {
// If the shell functions are not present, forward the call to kernel32.
if (!PopulateShellFunctions())
@@ -259,10 +264,17 @@ bool ShouldBypass(LPCWSTR file_path) {
HRESULT appdata_result = g_get_folder_func(
NULL, CSIDL_LOCAL_APPDATA, NULL, 0, local_appdata_path);
+ wchar_t buffer[MAX_PATH] = {};
+ if (!GetModuleFileNameW(NULL, buffer, MAX_PATH))
+ return false;
+
+ bool is_canary = IsCanary(buffer);
+
// If getting the %LOCALAPPDATA% path or appending to it failed, then forward
// the call to kernel32.
if (!SUCCEEDED(appdata_result) ||
- !g_path_append_func(local_appdata_path, kAppDataDirName) ||
+ !g_path_append_func(local_appdata_path, is_canary ?
+ kCanaryAppDataDirName : kAppDataDirName) ||
!g_path_append_func(local_appdata_path, kUserDataDirName)) {
return false;
}