Skip to content

Commit

Permalink
Use an alternate mechanism for CreateFile calls in Chrome
Browse files Browse the repository at this point in the history
BUG=334379

Review URL: https://codereview.chromium.org/138593004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245464 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
caitkp@chromium.org committed Jan 17, 2014
1 parent 675f2f2 commit 31fc1d2
Show file tree
Hide file tree
Showing 12 changed files with 713 additions and 1 deletion.
7 changes: 7 additions & 0 deletions build/common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -2478,6 +2478,13 @@
['enable_ipc_fuzzer==1', {
'defines': ['ENABLE_IPC_FUZZER=1'],
}],
['OS=="win" and component=="shared_library"', {
'dependencies': [
# All targets in a component build must depend on chrome_redirects,
# to ensure that certain calls go through it.
'<(DEPTH)/chrome_elf/chrome_elf.gyp:chrome_redirects',
],
}],
], # conditions for 'target_defaults'
'target_conditions': [
['enable_wexit_time_destructors==1', {
Expand Down
12 changes: 12 additions & 0 deletions chrome/chrome_dll.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@
'../content/content.gyp:content_app_browser',
],
'conditions': [
['OS=="win"', {
'dependencies': [
'<(DEPTH)/chrome_elf/chrome_elf.gyp:chrome_elf',
],
}],
['use_aura==1', {
'dependencies': [
'../ui/compositor/compositor.gyp:compositor',
Expand Down Expand Up @@ -363,6 +368,13 @@
'app/chrome_main_delegate.cc',
'app/chrome_main_delegate.h',
],
'conditions': [
['OS=="win"', {
'dependencies': [
'<(DEPTH)/chrome_elf/chrome_elf.gyp:chrome_elf',
],
}],
],
}, # target chrome_child_dll
],
}],
Expand Down
1 change: 1 addition & 0 deletions chrome/chrome_exe.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@
'../base/base.gyp:base',
'../breakpad/breakpad.gyp:breakpad_handler',
'../breakpad/breakpad.gyp:breakpad_sender',
'../chrome_elf/chrome_elf.gyp:chrome_elf',
'../components/components.gyp:breakpad_component',
'../components/components.gyp:policy',
'../chrome_elf/chrome_elf.gyp:chrome_elf',
Expand Down
1 change: 1 addition & 0 deletions chrome_elf/chrome_elf.def
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
LIBRARY "chrome_elf.dll"

EXPORTS
CreateFileW=chrome_redirects.CreateFileW
SignalChromeElf
46 changes: 45 additions & 1 deletion chrome_elf/chrome_elf.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,35 @@
'blacklist.gypi',
],
'targets': [
{
'target_name': 'chrome_redirects',
'type': 'shared_library',
'include_dirs': [
'..',
],
'sources': [
'chrome_redirects.def',
],
'dependencies': [
'chrome_elf_lib',
],
'msvs_settings': {
'VCLinkerTool': {
'BaseAddress': '0x01c10000',
# Set /SUBSYSTEM:WINDOWS.
'SubSystem': '2',
},
},
'conditions': [
['component=="shared_library"', {
# In component builds, all targets depend on chrome_redirects by
# default. Remove it here to avoid a circular dependency.
'dependencies!': [
'../chrome_elf/chrome_elf.gyp:chrome_redirects',
],
}],
],
},
{
'target_name': 'chrome_elf',
'type': 'shared_library',
Expand All @@ -25,11 +54,12 @@
'dependencies': [
'blacklist',
'chrome_elf_lib',
'chrome_redirects',
],
'msvs_settings': {
'VCLinkerTool': {
'BaseAddress': '0x01c20000',
# Set /SUBSYSTEM:WINDOWS for chrome_elf.dll (for consistency).
# Set /SUBSYSTEM:WINDOWS.
'SubSystem': '2',
'AdditionalDependencies!': [
'user32.lib',
Expand All @@ -45,6 +75,7 @@
'type': 'executable',
'sources': [
'blacklist/test/blacklist_test.cc',
'create_file/chrome_create_file_unittest.cc',
'elf_imports_unittest.cc',
'ntdll_cache_unittest.cc',
],
Expand Down Expand Up @@ -73,10 +104,23 @@
'..',
],
'sources': [
'chrome_elf_constants.cc',
'chrome_elf_constants.h',
'chrome_elf_types.h',
'create_file/chrome_create_file.cc',
'create_file/chrome_create_file.h',
'ntdll_cache.cc',
'ntdll_cache.h',
],
'conditions': [
['component=="shared_library"', {
# In component builds, all targets depend on chrome_redirects by
# default. Remove it here to avoid a circular dependency.
'dependencies!': [
'../chrome_elf/chrome_elf.gyp:chrome_redirects',
],
}],
],
},
],
}
13 changes: 13 additions & 0 deletions chrome_elf/chrome_elf_constants.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome_elf/chrome_elf_constants.h"

const wchar_t kUserDataDirName[] = L"User Data";

#if defined(GOOGLE_CHROME_BUILD)
const wchar_t kAppDataDirName[] = L"Google\\Chrome";
#else
const wchar_t kAppDataDirName[] = L"Chromium";
#endif
14 changes: 14 additions & 0 deletions chrome_elf/chrome_elf_constants.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// A handful of resource-like constants related to the ChromeELF.

#ifndef CHROME_ELF_CHROME_ELF_CONSTANTS_H_
#define CHROME_ELF_CHROME_ELF_CONSTANTS_H_

// directory names
extern const wchar_t kAppDataDirName[];
extern const wchar_t kUserDataDirName[];

#endif // CHROME_ELF_CHROME_ELF_CONSTANTS_H_
8 changes: 8 additions & 0 deletions chrome_elf/chrome_redirects.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
; Copyright 2014 The Chromium Authors. All rights reserved.
; Use of this source code is governed by a BSD-style license that can be
; found in the LICENSE file.

LIBRARY "chrome_redirects.dll"

EXPORTS
CreateFileW=CreateFileWRedirect
Loading

0 comments on commit 31fc1d2

Please sign in to comment.