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

Side by Side Diff: chrome_elf/create_file/chrome_create_file.cc

Issue 154653002: Breakpad coverage for chrome_elf start up (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests on chromium builds Created 6 years, 10 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome_elf/create_file/chrome_create_file.h" 5 #include "chrome_elf/create_file/chrome_create_file.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "chrome_elf/chrome_elf_constants.h" 10 #include "chrome_elf/chrome_elf_constants.h"
11 #include "chrome_elf/chrome_elf_util.h"
11 #include "chrome_elf/ntdll_cache.h" 12 #include "chrome_elf/ntdll_cache.h"
12 #include "sandbox/win/src/nt_internals.h" 13 #include "sandbox/win/src/nt_internals.h"
13 14
14 namespace { 15 namespace {
15 16
16 // From ShlObj.h in the Windows SDK. 17 // From ShlObj.h in the Windows SDK.
17 #define CSIDL_LOCAL_APPDATA 0x001c 18 #define CSIDL_LOCAL_APPDATA 0x001c
18 19
19 typedef BOOL (WINAPI *PathIsUNCFunction)( 20 typedef BOOL (WINAPI *PathIsUNCFunction)(
20 IN LPCWSTR path); 21 IN LPCWSTR path);
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } else if (creation_disposition == FILE_OVERWRITE_IF) { 237 } else if (creation_disposition == FILE_OVERWRITE_IF) {
237 SetLastError(io_status_block.Information == FILE_OVERWRITTEN ? 238 SetLastError(io_status_block.Information == FILE_OVERWRITTEN ?
238 ERROR_ALREADY_EXISTS : ERROR_SUCCESS); 239 ERROR_ALREADY_EXISTS : ERROR_SUCCESS);
239 } else { 240 } else {
240 SetLastError(ERROR_SUCCESS); 241 SetLastError(ERROR_SUCCESS);
241 } 242 }
242 243
243 return file_handle; 244 return file_handle;
244 } 245 }
245 246
246 bool IsCanary(LPWSTR exe_path) {
247 wchar_t* found = wcsstr(exe_path, L"Google\\Chrome SxS");
248 return !!found;
249 }
250
251 bool ShouldBypass(LPCWSTR file_path) { 247 bool ShouldBypass(LPCWSTR file_path) {
252 // Do not redirect in non-browser processes. 248 // Do not redirect in non-browser processes.
253 wchar_t* command_line = ::GetCommandLine(); 249 wchar_t* command_line = ::GetCommandLine();
254 if (command_line && wcsstr(command_line, L"--type")) 250 if (command_line && wcsstr(command_line, L"--type"))
255 return false; 251 return false;
256 252
257 // If the shell functions are not present, forward the call to kernel32. 253 // If the shell functions are not present, forward the call to kernel32.
258 if (!PopulateShellFunctions()) 254 if (!PopulateShellFunctions())
259 return false; 255 return false;
260 256
(...skipping 26 matching lines...) Expand all
287 LPCWSTR file_name = g_path_find_filename_func(file_path); 283 LPCWSTR file_name = g_path_find_filename_func(file_path);
288 284
289 bool in_userdata_dir = !!g_path_is_prefix_func(local_appdata_path, file_path); 285 bool in_userdata_dir = !!g_path_is_prefix_func(local_appdata_path, file_path);
290 bool is_settings_file = wcscmp(file_name, kPreferencesFilename) == 0 || 286 bool is_settings_file = wcscmp(file_name, kPreferencesFilename) == 0 ||
291 wcscmp(file_name, kLocalStateFilename) == 0; 287 wcscmp(file_name, kLocalStateFilename) == 0;
292 288
293 // Check if we are trying to access the Preferences in the UserData dir. If 289 // Check if we are trying to access the Preferences in the UserData dir. If
294 // so, then redirect the call to bypass kernel32. 290 // so, then redirect the call to bypass kernel32.
295 return in_userdata_dir && is_settings_file; 291 return in_userdata_dir && is_settings_file;
296 } 292 }
OLDNEW
« no previous file with comments | « chrome_elf/create_file/chrome_create_file.h ('k') | chrome_elf/create_file/chrome_create_file_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698