| 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 #include <map> | 5 #include <map> |
| 6 | 6 |
| 7 #include "sandbox/win/src/policy_broker.h" | 7 #include "sandbox/win/src/policy_broker.h" |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/win/pe_image.h" | 10 #include "base/win/pe_image.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 INIT_GLOBAL_RTL(RtlFreeHeap); | 73 INIT_GLOBAL_RTL(RtlFreeHeap); |
| 74 INIT_GLOBAL_RTL(_strnicmp); | 74 INIT_GLOBAL_RTL(_strnicmp); |
| 75 INIT_GLOBAL_RTL(strlen); | 75 INIT_GLOBAL_RTL(strlen); |
| 76 INIT_GLOBAL_RTL(wcslen); | 76 INIT_GLOBAL_RTL(wcslen); |
| 77 | 77 |
| 78 #ifndef NDEBUG | 78 #ifndef NDEBUG |
| 79 // Verify that the structure is fully initialized. | 79 // Verify that the structure is fully initialized. |
| 80 for (size_t i = 0; i < sizeof(g_nt)/sizeof(void*); i++) | 80 for (size_t i = 0; i < sizeof(g_nt)/sizeof(void*); i++) |
| 81 DCHECK(reinterpret_cast<char**>(&g_nt)[i]); | 81 DCHECK(reinterpret_cast<char**>(&g_nt)[i]); |
| 82 #endif | 82 #endif |
| 83 ResultCode ret = child->TransferVariable("g_nt", &g_nt, sizeof(g_nt)); | 83 return (SBOX_ALL_OK == child->TransferVariable("g_nt", &g_nt, sizeof(g_nt))); |
| 84 | |
| 85 return SBOX_ALL_OK == ret ? true : false; | |
| 86 } | 84 } |
| 87 | 85 |
| 88 #undef INIT_GLOBAL_NT | 86 #undef INIT_GLOBAL_NT |
| 89 #undef INIT_GLOBAL_RTL | 87 #undef INIT_GLOBAL_RTL |
| 90 | 88 |
| 91 bool SetupBasicInterceptions(InterceptionManager* manager) { | 89 bool SetupBasicInterceptions(InterceptionManager* manager) { |
| 92 // Interceptions provided by process_thread_policy, without actual policy. | 90 // Interceptions provided by process_thread_policy, without actual policy. |
| 93 if (!INTERCEPT_NT(manager, NtOpenThread, OPEN_TREAD_ID, 20) || | 91 if (!INTERCEPT_NT(manager, NtOpenThread, OPEN_TREAD_ID, 20) || |
| 94 !INTERCEPT_NT(manager, NtOpenProcess, OPEN_PROCESS_ID, 20) || | 92 !INTERCEPT_NT(manager, NtOpenProcess, OPEN_PROCESS_ID, 20) || |
| 95 !INTERCEPT_NT(manager, NtOpenProcessToken, OPEN_PROCESS_TOKEN_ID, 16)) | 93 !INTERCEPT_NT(manager, NtOpenProcessToken, OPEN_PROCESS_TOKEN_ID, 16)) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 109 return false; | 107 return false; |
| 110 | 108 |
| 111 return INTERCEPT_NT(manager, NtOpenThreadTokenEx, OPEN_THREAD_TOKEN_EX_ID, | 109 return INTERCEPT_NT(manager, NtOpenThreadTokenEx, OPEN_THREAD_TOKEN_EX_ID, |
| 112 24); | 110 24); |
| 113 } | 111 } |
| 114 | 112 |
| 115 return true; | 113 return true; |
| 116 } | 114 } |
| 117 | 115 |
| 118 } // namespace sandbox | 116 } // namespace sandbox |
| OLD | NEW |