| OLD | NEW |
| 1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2010 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 #include "sandbox/src/sandbox_nt_util.h" | 5 #include "sandbox/src/sandbox_nt_util.h" |
| 6 | 6 |
| 7 #include "base/win/pe_image.h" | 7 #include "base/win/pe_image.h" |
| 8 #include "sandbox/src/sandbox_factory.h" | 8 #include "sandbox/src/sandbox_factory.h" |
| 9 #include "sandbox/src/target_services.h" | 9 #include "sandbox/src/target_services.h" |
| 10 | 10 |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 | 466 |
| 467 NTSTATUS AutoProtectMemory::ChangeProtection(void* address, size_t bytes, | 467 NTSTATUS AutoProtectMemory::ChangeProtection(void* address, size_t bytes, |
| 468 ULONG protect) { | 468 ULONG protect) { |
| 469 DCHECK_NT(!changed_); | 469 DCHECK_NT(!changed_); |
| 470 SIZE_T new_bytes = bytes; | 470 SIZE_T new_bytes = bytes; |
| 471 NTSTATUS ret = g_nt.ProtectVirtualMemory(NtCurrentProcess, &address, | 471 NTSTATUS ret = g_nt.ProtectVirtualMemory(NtCurrentProcess, &address, |
| 472 &new_bytes, protect, &old_protect_); | 472 &new_bytes, protect, &old_protect_); |
| 473 if (NT_SUCCESS(ret)) { | 473 if (NT_SUCCESS(ret)) { |
| 474 changed_ = true; | 474 changed_ = true; |
| 475 address_ = address; | 475 address_ = address; |
| 476 bytes_ = bytes; | 476 bytes_ = new_bytes; |
| 477 } | 477 } |
| 478 | 478 |
| 479 return ret; | 479 return ret; |
| 480 } | 480 } |
| 481 | 481 |
| 482 NTSTATUS AutoProtectMemory::RevertProtection() { | 482 NTSTATUS AutoProtectMemory::RevertProtection() { |
| 483 if (!changed_) | 483 if (!changed_) |
| 484 return STATUS_SUCCESS; | 484 return STATUS_SUCCESS; |
| 485 | 485 |
| 486 DCHECK_NT(address_); | 486 DCHECK_NT(address_); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 UNREFERENCED_PARAMETER(type); | 577 UNREFERENCED_PARAMETER(type); |
| 578 return buffer; | 578 return buffer; |
| 579 } | 579 } |
| 580 | 580 |
| 581 void __cdecl operator delete(void* memory, void* buffer, | 581 void __cdecl operator delete(void* memory, void* buffer, |
| 582 sandbox::AllocationType type) { | 582 sandbox::AllocationType type) { |
| 583 UNREFERENCED_PARAMETER(memory); | 583 UNREFERENCED_PARAMETER(memory); |
| 584 UNREFERENCED_PARAMETER(buffer); | 584 UNREFERENCED_PARAMETER(buffer); |
| 585 UNREFERENCED_PARAMETER(type); | 585 UNREFERENCED_PARAMETER(type); |
| 586 } | 586 } |
| OLD | NEW |