OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // For information about interceptions as a whole see | 5 // For information about interceptions as a whole see |
6 // http://dev.chromium.org/developers/design-documents/sandbox . | 6 // http://dev.chromium.org/developers/design-documents/sandbox . |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "sandbox/win/src/interception.h" | 10 #include "sandbox/win/src/interception.h" |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 | 426 |
427 if (!ok || (offsetof(DllInterceptionData, thunks) != written)) | 427 if (!ok || (offsetof(DllInterceptionData, thunks) != written)) |
428 return false; | 428 return false; |
429 | 429 |
430 // Attempt to protect all the thunks, but ignore failure | 430 // Attempt to protect all the thunks, but ignore failure |
431 DWORD old_protection; | 431 DWORD old_protection; |
432 ::VirtualProtectEx(child, thunks, thunk_bytes, | 432 ::VirtualProtectEx(child, thunks, thunk_bytes, |
433 PAGE_EXECUTE_READ, &old_protection); | 433 PAGE_EXECUTE_READ, &old_protection); |
434 | 434 |
435 ResultCode ret = child_->TransferVariable("g_originals", g_originals, | 435 ResultCode ret = child_->TransferVariable("g_originals", g_originals, |
436 sizeof(g_originals)); | 436 sizeof(g_originals)); |
437 | 437 return (SBOX_ALL_OK == ret); |
438 return SBOX_ALL_OK == ret ? true : false; | |
439 } | 438 } |
440 | 439 |
441 bool InterceptionManager::PatchClientFunctions(DllInterceptionData* thunks, | 440 bool InterceptionManager::PatchClientFunctions(DllInterceptionData* thunks, |
442 size_t thunk_bytes, | 441 size_t thunk_bytes, |
443 DllInterceptionData* dll_data) { | 442 DllInterceptionData* dll_data) { |
444 DCHECK(NULL != thunks); | 443 DCHECK(NULL != thunks); |
445 DCHECK(NULL != dll_data); | 444 DCHECK(NULL != dll_data); |
446 | 445 |
447 HMODULE ntdll_base = ::GetModuleHandle(kNtdllName); | 446 HMODULE ntdll_base = ::GetModuleHandle(kNtdllName); |
448 if (!ntdll_base) | 447 if (!ntdll_base) |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 ::FreeLibrary(local_interceptor); | 541 ::FreeLibrary(local_interceptor); |
543 #endif | 542 #endif |
544 | 543 |
545 if (it != interceptions_.end()) | 544 if (it != interceptions_.end()) |
546 return false; | 545 return false; |
547 | 546 |
548 return true; | 547 return true; |
549 } | 548 } |
550 | 549 |
551 } // namespace sandbox | 550 } // namespace sandbox |
OLD | NEW |