OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // Implementation of NtMapViewOfSection intercept for 32 bit builds. | 5 // Implementation of NtMapViewOfSection intercept for 32 bit builds. |
6 // | 6 // |
7 // TODO(robertshield): Implement the 64 bit intercept. | 7 // TODO(robertshield): Implement the 64 bit intercept. |
8 | 8 |
9 #include "chrome_elf/blacklist/blacklist_interceptions.h" | 9 #include "chrome_elf/blacklist/blacklist_interceptions.h" |
10 | 10 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 } | 141 } |
142 | 142 |
143 PIMAGE_NT_HEADERS headers = pe.GetNTHeaders(); | 143 PIMAGE_NT_HEADERS headers = pe.GetNTHeaders(); |
144 if (headers) { | 144 if (headers) { |
145 if (headers->OptionalHeader.AddressOfEntryPoint) | 145 if (headers->OptionalHeader.AddressOfEntryPoint) |
146 *flags |= sandbox::MODULE_HAS_ENTRY_POINT; | 146 *flags |= sandbox::MODULE_HAS_ENTRY_POINT; |
147 if (headers->OptionalHeader.SizeOfCode) | 147 if (headers->OptionalHeader.SizeOfCode) |
148 *flags |= sandbox::MODULE_HAS_CODE; | 148 *flags |= sandbox::MODULE_HAS_CODE; |
149 } | 149 } |
150 } | 150 } |
151 } __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? | 151 } __except((GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION || |
| 152 GetExceptionCode() == EXCEPTION_IN_PAGE_ERROR) ? |
152 EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { | 153 EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { |
153 out_name->clear(); | 154 out_name->clear(); |
154 } | 155 } |
155 } | 156 } |
156 | 157 |
157 base::string16 GetImageInfoFromLoadedModule(HMODULE module, uint32* flags) { | 158 base::string16 GetImageInfoFromLoadedModule(HMODULE module, uint32* flags) { |
158 std::string out_name; | 159 std::string out_name; |
159 base::win::PEImage pe(module); | 160 base::win::PEImage pe(module); |
160 SafeGetImageInfo(pe, &out_name, flags); | 161 SafeGetImageInfo(pe, &out_name, flags); |
161 return base::string16(out_name.begin(), out_name.end()); | 162 return base::string16(out_name.begin(), out_name.end()); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 NTSTATUS WINAPI BlNtMapViewOfSection64( | 234 NTSTATUS WINAPI BlNtMapViewOfSection64( |
234 HANDLE section, HANDLE process, PVOID *base, ULONG_PTR zero_bits, | 235 HANDLE section, HANDLE process, PVOID *base, ULONG_PTR zero_bits, |
235 SIZE_T commit_size, PLARGE_INTEGER offset, PSIZE_T view_size, | 236 SIZE_T commit_size, PLARGE_INTEGER offset, PSIZE_T view_size, |
236 SECTION_INHERIT inherit, ULONG allocation_type, ULONG protect) { | 237 SECTION_INHERIT inherit, ULONG allocation_type, ULONG protect) { |
237 return BlNtMapViewOfSection(g_nt_map_view_of_section_func, section, process, | 238 return BlNtMapViewOfSection(g_nt_map_view_of_section_func, section, process, |
238 base, zero_bits, commit_size, offset, view_size, | 239 base, zero_bits, commit_size, offset, view_size, |
239 inherit, allocation_type, protect); | 240 inherit, allocation_type, protect); |
240 } | 241 } |
241 #endif | 242 #endif |
242 } // namespace blacklist | 243 } // namespace blacklist |
OLD | NEW |