diff options
author | caitkp@chromium.org <caitkp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-13 05:17:08 +0000 |
---|---|---|
committer | caitkp@chromium.org <caitkp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-13 05:17:08 +0000 |
commit | a32a8047aa46eb13fb6a2edcff39595382d65d28 (patch) | |
tree | 0c3b42ec6916906582a0edcfd5f476b7142e48d0 /chrome_elf | |
parent | ba703c63d8c0441aad2ce0004248416a3103b991 (diff) | |
download | chromium_src-a32a8047aa46eb13fb6a2edcff39595382d65d28.zip chromium_src-a32a8047aa46eb13fb6a2edcff39595382d65d28.tar.gz chromium_src-a32a8047aa46eb13fb6a2edcff39595382d65d28.tar.bz2 |
Make sure CreateFile call is not inlined, so EMET doesn't get upset.
BUG=348383
Review URL: https://codereview.chromium.org/197863002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256751 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_elf')
-rw-r--r-- | chrome_elf/create_file/chrome_create_file.cc | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/chrome_elf/create_file/chrome_create_file.cc b/chrome_elf/create_file/chrome_create_file.cc index 9521ecb2..59b15bd 100644 --- a/chrome_elf/create_file/chrome_create_file.cc +++ b/chrome_elf/create_file/chrome_create_file.cc @@ -87,6 +87,27 @@ bool PopulateShellFunctions() { } // namespace +// Turn off optimization to make sure these calls don't get inlined. +#pragma optimize("", off) +// Wrapper method for kernel32!CreateFile, to avoid setting off caller +// mitigation detectors. +HANDLE CreateFileWImpl(LPCWSTR file_name, + DWORD desired_access, + DWORD share_mode, + LPSECURITY_ATTRIBUTES security_attributes, + DWORD creation_disposition, + DWORD flags_and_attributes, + HANDLE template_file) { + return CreateFile(file_name, + desired_access, + share_mode, + security_attributes, + creation_disposition, + flags_and_attributes, + template_file); + +} + HANDLE WINAPI CreateFileWRedirect( LPCWSTR file_name, DWORD desired_access, @@ -105,15 +126,15 @@ HANDLE WINAPI CreateFileWRedirect( flags_and_attributes, template_file); } - return CreateFile(file_name, - desired_access, - share_mode, - security_attributes, - creation_disposition, - flags_and_attributes, - template_file); - + return CreateFileWImpl(file_name, + desired_access, + share_mode, + security_attributes, + creation_disposition, + flags_and_attributes, + template_file); } +#pragma optimize("", on) int GetRedirectCount() { return g_redirect_count; |