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 |
11 #include <stddef.h> | 11 #include <stddef.h> |
12 #include <stdint.h> | 12 #include <stdint.h> |
13 | 13 |
14 #include <string> | 14 #include <string> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 // Note that only #includes from base that are either header-only or built into | 17 // Note that only #includes from base that are either header-only or built into |
18 // base_static (see base/base.gyp) are allowed here. | 18 // base_static (see base/base.gyp) are allowed here. |
19 #include "base/win/pe_image.h" | 19 #include "base/win/pe_image.h" |
20 #include "chrome_elf/blacklist/blacklist.h" | 20 #include "chrome_elf/blacklist/blacklist.h" |
21 #include "chrome_elf/crash/crash_helper.h" | 21 #include "chrome_elf/blacklist/crashpad_helper.h" |
22 #include "sandbox/win/src/internal_types.h" | 22 #include "sandbox/win/src/internal_types.h" |
23 #include "sandbox/win/src/nt_internals.h" | 23 #include "sandbox/win/src/nt_internals.h" |
24 #include "sandbox/win/src/sandbox_nt_util.h" | 24 #include "sandbox/win/src/sandbox_nt_util.h" |
25 #include "sandbox/win/src/sandbox_types.h" | 25 #include "sandbox/win/src/sandbox_types.h" |
26 | 26 |
27 namespace { | 27 namespace { |
28 | 28 |
29 NtQuerySectionFunction g_nt_query_section_func = NULL; | 29 NtQuerySectionFunction g_nt_query_section_func = NULL; |
30 NtQueryVirtualMemoryFunction g_nt_query_virtual_memory_func = NULL; | 30 NtQueryVirtualMemoryFunction g_nt_query_virtual_memory_func = NULL; |
31 NtUnmapViewOfSectionFunction g_nt_unmap_view_of_section_func = NULL; | 31 NtUnmapViewOfSectionFunction g_nt_unmap_view_of_section_func = NULL; |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 SECTION_INHERIT inherit, | 255 SECTION_INHERIT inherit, |
256 ULONG allocation_type, | 256 ULONG allocation_type, |
257 ULONG protect) { | 257 ULONG protect) { |
258 NTSTATUS ret = STATUS_UNSUCCESSFUL; | 258 NTSTATUS ret = STATUS_UNSUCCESSFUL; |
259 | 259 |
260 __try { | 260 __try { |
261 ret = BlNtMapViewOfSectionImpl(orig_MapViewOfSection, section, process, | 261 ret = BlNtMapViewOfSectionImpl(orig_MapViewOfSection, section, process, |
262 base, zero_bits, commit_size, offset, | 262 base, zero_bits, commit_size, offset, |
263 view_size, inherit, allocation_type, | 263 view_size, inherit, allocation_type, |
264 protect); | 264 protect); |
265 } __except (elf_crash::GenerateCrashDump(GetExceptionInformation())) { | 265 } __except(GenerateCrashDump(GetExceptionInformation())) { |
266 } | 266 } |
267 | 267 |
268 return ret; | 268 return ret; |
269 } | 269 } |
270 | 270 |
271 #if defined(_WIN64) | 271 #if defined(_WIN64) |
272 NTSTATUS WINAPI BlNtMapViewOfSection64( | 272 NTSTATUS WINAPI BlNtMapViewOfSection64( |
273 HANDLE section, HANDLE process, PVOID *base, ULONG_PTR zero_bits, | 273 HANDLE section, HANDLE process, PVOID *base, ULONG_PTR zero_bits, |
274 SIZE_T commit_size, PLARGE_INTEGER offset, PSIZE_T view_size, | 274 SIZE_T commit_size, PLARGE_INTEGER offset, PSIZE_T view_size, |
275 SECTION_INHERIT inherit, ULONG allocation_type, ULONG protect) { | 275 SECTION_INHERIT inherit, ULONG allocation_type, ULONG protect) { |
276 return BlNtMapViewOfSection(g_nt_map_view_of_section_func, section, process, | 276 return BlNtMapViewOfSection(g_nt_map_view_of_section_func, section, process, |
277 base, zero_bits, commit_size, offset, view_size, | 277 base, zero_bits, commit_size, offset, view_size, |
278 inherit, allocation_type, protect); | 278 inherit, allocation_type, protect); |
279 } | 279 } |
280 #endif | 280 #endif |
281 } // namespace blacklist | 281 } // namespace blacklist |
OLD | NEW |