| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
| 6 #include "base/win/scoped_handle.h" | 6 #include "base/win/scoped_handle.h" |
| 7 | 7 |
| 8 #include "base/win/windows_version.h" | 8 #include "base/win/windows_version.h" |
| 9 #include "sandbox/win/src/nt_internals.h" | 9 #include "sandbox/win/src/nt_internals.h" |
| 10 #include "sandbox/win/src/process_mitigations.h" | 10 #include "sandbox/win/src/process_mitigations.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 return SBOX_TEST_NOT_FOUND; | 158 return SBOX_TEST_NOT_FOUND; |
| 159 | 159 |
| 160 ULONG size = 0; | 160 ULONG size = 0; |
| 161 ULONG dep_flags = 0; | 161 ULONG dep_flags = 0; |
| 162 if (!SUCCEEDED(query_information_process(::GetCurrentProcess(), | 162 if (!SUCCEEDED(query_information_process(::GetCurrentProcess(), |
| 163 ProcessExecuteFlags, &dep_flags, | 163 ProcessExecuteFlags, &dep_flags, |
| 164 sizeof(dep_flags), &size))) { | 164 sizeof(dep_flags), &size))) { |
| 165 return SBOX_TEST_THIRD_ERROR; | 165 return SBOX_TEST_THIRD_ERROR; |
| 166 } | 166 } |
| 167 | 167 |
| 168 static const int MEM_EXECUTE_OPTION_ENABLE = 1; | |
| 169 static const int MEM_EXECUTE_OPTION_DISABLE = 2; | 168 static const int MEM_EXECUTE_OPTION_DISABLE = 2; |
| 170 static const int MEM_EXECUTE_OPTION_ATL7_THUNK_EMULATION = 4; | |
| 171 static const int MEM_EXECUTE_OPTION_PERMANENT = 8; | 169 static const int MEM_EXECUTE_OPTION_PERMANENT = 8; |
| 172 dep_flags &= 0xff; | 170 dep_flags &= 0xff; |
| 173 | 171 |
| 174 if (dep_flags != (MEM_EXECUTE_OPTION_DISABLE | | 172 if (dep_flags != (MEM_EXECUTE_OPTION_DISABLE | |
| 175 MEM_EXECUTE_OPTION_PERMANENT)) { | 173 MEM_EXECUTE_OPTION_PERMANENT)) { |
| 176 return SBOX_TEST_FOURTH_ERROR; | 174 return SBOX_TEST_FOURTH_ERROR; |
| 177 } | 175 } |
| 178 } | 176 } |
| 179 | 177 |
| 180 return SBOX_TEST_SUCCEEDED; | 178 return SBOX_TEST_SUCCEEDED; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 EXPECT_EQ(policy->SetProcessMitigations(MITIGATION_WIN32K_DISABLE), | 237 EXPECT_EQ(policy->SetProcessMitigations(MITIGATION_WIN32K_DISABLE), |
| 240 SBOX_ALL_OK); | 238 SBOX_ALL_OK); |
| 241 EXPECT_EQ(policy->AddRule(sandbox::TargetPolicy::SUBSYS_WIN32K_LOCKDOWN, | 239 EXPECT_EQ(policy->AddRule(sandbox::TargetPolicy::SUBSYS_WIN32K_LOCKDOWN, |
| 242 sandbox::TargetPolicy::FAKE_USER_GDI_INIT, NULL), | 240 sandbox::TargetPolicy::FAKE_USER_GDI_INIT, NULL), |
| 243 sandbox::SBOX_ALL_OK); | 241 sandbox::SBOX_ALL_OK); |
| 244 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckWin8Lockdown")); | 242 EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"CheckWin8Lockdown")); |
| 245 } | 243 } |
| 246 | 244 |
| 247 } // namespace sandbox | 245 } // namespace sandbox |
| 248 | 246 |
| OLD | NEW |