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

Side by Side Diff: chrome_elf/blacklist/blacklist_interceptions.cc

Issue 942003008: Reland the ULONG -> SIZE_T change from 317177 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | sandbox/win/src/nt_internals.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 } 44 }
45 45
46 // TODO(robertshield): Some of the helper functions below overlap somewhat with 46 // TODO(robertshield): Some of the helper functions below overlap somewhat with
47 // code in sandbox_nt_util.cc. See if they can be unified. 47 // code in sandbox_nt_util.cc. See if they can be unified.
48 48
49 // Native reimplementation of PSAPIs GetMappedFileName. 49 // Native reimplementation of PSAPIs GetMappedFileName.
50 base::string16 GetBackingModuleFilePath(PVOID address) { 50 base::string16 GetBackingModuleFilePath(PVOID address) {
51 DCHECK_NT(g_nt_query_virtual_memory_func); 51 DCHECK_NT(g_nt_query_virtual_memory_func);
52 52
53 // We'll start with something close to max_path characters for the name. 53 // We'll start with something close to max_path characters for the name.
54 ULONG buffer_bytes = MAX_PATH * 2; 54 SIZE_T buffer_bytes = MAX_PATH * 2;
55 std::vector<BYTE> buffer_data(buffer_bytes); 55 std::vector<BYTE> buffer_data(buffer_bytes);
56 56
57 for (;;) { 57 for (;;) {
58 MEMORY_SECTION_NAME* section_name = 58 MEMORY_SECTION_NAME* section_name =
59 reinterpret_cast<MEMORY_SECTION_NAME*>(&buffer_data[0]); 59 reinterpret_cast<MEMORY_SECTION_NAME*>(&buffer_data[0]);
60 60
61 if (!section_name) 61 if (!section_name)
62 break; 62 break;
63 63
64 ULONG returned_bytes; 64 SIZE_T returned_bytes;
65 NTSTATUS ret = g_nt_query_virtual_memory_func( 65 NTSTATUS ret = g_nt_query_virtual_memory_func(
66 NtCurrentProcess, address, MemorySectionName, section_name, 66 NtCurrentProcess, address, MemorySectionName, section_name,
67 buffer_bytes, &returned_bytes); 67 buffer_bytes, &returned_bytes);
68 68
69 if (STATUS_BUFFER_OVERFLOW == ret) { 69 if (STATUS_BUFFER_OVERFLOW == ret) {
70 // Retry the call with the given buffer size. 70 // Retry the call with the given buffer size.
71 buffer_bytes = returned_bytes + 1; 71 buffer_bytes = returned_bytes + 1;
72 buffer_data.resize(buffer_bytes); 72 buffer_data.resize(buffer_bytes);
73 section_name = NULL; 73 section_name = NULL;
74 continue; 74 continue;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 NTSTATUS WINAPI BlNtMapViewOfSection64( 267 NTSTATUS WINAPI BlNtMapViewOfSection64(
268 HANDLE section, HANDLE process, PVOID *base, ULONG_PTR zero_bits, 268 HANDLE section, HANDLE process, PVOID *base, ULONG_PTR zero_bits,
269 SIZE_T commit_size, PLARGE_INTEGER offset, PSIZE_T view_size, 269 SIZE_T commit_size, PLARGE_INTEGER offset, PSIZE_T view_size,
270 SECTION_INHERIT inherit, ULONG allocation_type, ULONG protect) { 270 SECTION_INHERIT inherit, ULONG allocation_type, ULONG protect) {
271 return BlNtMapViewOfSection(g_nt_map_view_of_section_func, section, process, 271 return BlNtMapViewOfSection(g_nt_map_view_of_section_func, section, process,
272 base, zero_bits, commit_size, offset, view_size, 272 base, zero_bits, commit_size, offset, view_size,
273 inherit, allocation_type, protect); 273 inherit, allocation_type, protect);
274 } 274 }
275 #endif 275 #endif
276 } // namespace blacklist 276 } // namespace blacklist
OLDNEW
« no previous file with comments | « no previous file | sandbox/win/src/nt_internals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698